LIST_824x=" \
A3000 barco BMW CPC45 \
CU824 debris eXalion HIDDEN_DRAGON \
- MOUSSE MUSENKI MVBLUE OXC \
- PN62 Sandpoint8240 Sandpoint8245 sbc8240 \
- SL8245 utx8245 \
+ linkstation linkstationhg MOUSSE MUSENKI \
+ MVBLUE OXC PN62 Sandpoint8240 \
+ Sandpoint8245 sbc8240 SL8245 utx8245 \
"
#########################################################################
CROSS_COMPILE =
else
ifeq ($(ARCH),ppc)
-CROSS_COMPILE = powerpc-linux-
+CROSS_COMPILE = ppc_6xx-
endif
ifeq ($(ARCH),arm)
CROSS_COMPILE = arm-linux-
all: $(ALL)
+LSMODEL := $(shell head -n 1 include/config.h)
+
+linkstation_HGLAN_RAM: include/config.h
+ @[ -n "$(findstring HGLAN_RAM, $(LSMODEL))" ] || \
+ { echo "Bad configuration: $(LSMODEL)" ; \
+ exit 1 ; \
+ }
+ @make all
+ @mv u-boot.bin u-boot-hg.ram.bin
+
+linkstation_HGLAN: include/config.h
+ @[ -n "$(findstring HGLAN_ROM, $(LSMODEL))" ] || \
+ { echo "Bad configuration: $(LSMODEL)" ; \
+ exit 1 ; \
+ }
+ @make all
+ @mv u-boot.bin u-boot-hg.flash.bin
+
+linkstation_HDLAN_RAM: include/config.h
+ @[ -n "$(findstring HDLAN_RAM, $(LSMODEL))" ] || \
+ { echo "Bad configuration: $(LSMODEL)" ; \
+ exit 1 ; \
+ }
+ @make all
+ @mv u-boot.bin u-boot-hd.ram.bin
+
+linkstation_HDLAN: include/config.h
+ @[ -n "$(findstring HDLAN_ROM, $(LSMODEL))" ] || \
+ { echo "Bad configuration: $(LSMODEL)" ; \
+ exit 1 ; \
+ }
+ @make all
+ @mv u-boot.bin u-boot-hd.flash.bin
+
u-boot.hex: u-boot
$(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@
#########################################################################
else
+linkstation_HGLAN_RAM \
+linkstation_HGLAN \
+linkstation_HDLAN_RAM \
+linkstation_HDLAN \
all install u-boot u-boot.srec depend dep:
@echo "System not configured - see README" >&2
@ exit 1
HIDDEN_DRAGON_config: unconfig
@./mkconfig $(@:_config=) ppc mpc824x hidden_dragon
+linkstation_HGLAN_RAM_config: mrproper
+ @>include/config.h ; \
+ echo "/* HGLAN_RAM */" >>include/config.h ; \
+ echo "#define CONFIG_HGLAN 1" >>include/config.h ; \
+ echo "TEXT_BASE = 0x07F00000" >board/linkstation/config.tmp ; \
+ ./mkconfig -a linkstation ppc mpc824x linkstation ; \
+ echo "LinkStation HGLAN -- RAM BUILD ..."
+
+linkstation_HGLAN_config: mrproper
+ @>include/config.h ; \
+ echo "/* HGLAN_ROM */" >>include/config.h ; \
+ echo "#define CONFIG_HGLAN 1" >>include/config.h ; \
+ echo "TEXT_BASE = 0xFFF00000" >board/linkstation/config.tmp ; \
+ ./mkconfig -a linkstation ppc mpc824x linkstation ; \
+ echo "LinkStation HGLAN -- ROM BUILD ..."
+
+linkstation_HDLAN_RAM_config: mrproper
+ @>include/config.h ; \
+ echo "/* HDLAN_RAM */" >>include/config.h ; \
+ echo "#define CONFIG_HLAN 1" >>include/config.h ; \
+ echo "TEXT_BASE = 0x03F00000" >board/linkstation/config.tmp ; \
+ ./mkconfig -a linkstation ppc mpc824x linkstation ; \
+ echo "LinkStation HDLAN -- RAM BUILD ..."
+
+linkstation_HDLAN_config: mrproper
+ @>include/config.h ; \
+ echo "/* HDLAN_ROM */" >>include/config.h ; \
+ echo "#define CONFIG_HLAN 1" >>include/config.h ; \
+ echo "TEXT_BASE = 0xFFF00000" >board/linkstation/config.tmp ; \
+ ./mkconfig -a linkstation ppc mpc824x linkstation ; \
+ echo "LinkStation HDLAN -- ROM BUILD ..."
+
MOUSSE_config: unconfig
@./mkconfig $(@:_config=) ppc mpc824x mousse
verify = 0;
} else
#endif /* __I386__ */
+#ifdef CONFIG_LINKSTATION
+ extern boot_os_Fcn do_boot_lskernel;
+ do_boot_lskernel(cmdtp, flag, argc, argv,
+ addr, NULL, verify);
+ return 1; /* Only returns on error */
+#endif
{
puts ("Bad Magic Number\n");
SHOW_BOOT_PROGRESS (-1);
sprintf(buf, "%lX", filelen);
setenv("filesize", buf);
- return(filelen);
+// return(filelen);
+ return(0);
}
U_BOOT_CMD(
#endif /* CFG_CONSOLE_IS_IN_ENV */
-static int console_setfile (int file, device_t * dev)
+int console_setfile (int file, device_t * dev)
{
DECLARE_GLOBAL_DATA_PTR;
int error = 0;
gd->flags |= GD_FLG_DEVINIT; /* device initialization completed */
#ifndef CFG_CONSOLE_INFO_QUIET
+ if (strcmp(stdio_devices[stdout]->name, "serial")) {
+ extern char version_string[];
+ printf ("\n%s\n", version_string);
+ }
+
/* Print information */
- puts ("In: ");
+ puts ("stdin : ");
if (stdio_devices[stdin] == NULL) {
puts ("No input devices available!\n");
} else {
printf ("%s\n", stdio_devices[stdin]->name);
}
- puts ("Out: ");
+ puts ("stdout: ");
if (stdio_devices[stdout] == NULL) {
puts ("No output devices available!\n");
} else {
printf ("%s\n", stdio_devices[stdout]->name);
}
- puts ("Err: ");
+ puts ("stderr: ");
if (stdio_devices[stderr] == NULL) {
puts ("No error devices available!\n");
} else {
extern void mdm_init(void); /* defined in board.c */
#endif
+#ifdef CONFIG_LINKSTATION
+extern int avr_input(void);
+extern void avr_StopBoot(void);
+#endif
+
/***************************************************************************
* Watch for 'delay' seconds for autoboot stop or autoboot delay string.
* returns: 0 - no key string, allow autoboot
/* In order to keep up with incoming data, check timeout only
* when catch up.
*/
+ uint64_t onesec = endtick(1);
+ int bootremain = bootdelay;
while (!abort && get_ticks() <= etime) {
+ if (get_ticks() >= onesec) {
+ onesec = endtick(1);
+ putc('\r');
+ printf (CONFIG_AUTOBOOT_PROMPT, --bootremain);
+ }
for (i = 0; i < sizeof(delaykey) / sizeof(delaykey[0]); i ++) {
if (delaykey[i].len > 0 &&
presskey_len >= delaykey[i].len &&
}
}
+#ifdef CONFIG_LINKSTATION
+ int avr_action = avr_input();
+ if (avr_action == -3)
+ /* Abort boot */
+ abort = 1;
+ else if (avr_action == -2) {
+ /* Restart boot */
+ putc('\r');
+ printf (CONFIG_AUTOBOOT_PROMPT, bootdelay);
+ etime = endtick(bootdelay);
+ onesec = endtick(1);
+ bootremain = bootdelay;
+ }
+#endif
if (tstc()) {
if (presskey_len < presskey_max) {
presskey [presskey_len ++] = getc();
}
}
}
+ putc('\n');
# if DEBUG_BOOTKEYS
if (!abort)
puts ("key timeout\n");
int prev = disable_ctrlc(1); /* disable Control C checking */
# endif
+#ifdef CONFIG_LINKSTATION
+ s = getenv("bootcmd"); /* bootcmd can change (see avr.c) */
+#endif
+
# ifndef CFG_HUSH_PARSER
run_command (s, 0);
# else
}
#endif
+#ifdef CONFIG_LINKSTATION
+ avr_StopBoot();
+#endif
+
/*
* Main Loop for Monitor Command Processing
*/
strcpy (lastcommand, console_buffer);
else if (len == 0)
flag |= CMD_FLAG_REPEAT;
+#ifdef CONFIG_LINKSTATION
+ else if (len == -2)
+ return;
+#endif
#ifdef CONFIG_BOOT_RETRY_TIME
else if (len == -2) {
/* -2 means timed out, retry autoboot
extern void show_activity(int arg);
show_activity(0);
}
+#endif
+#ifdef CONFIG_LINKSTATION
+ while (!tstc()) {
+ int avr_ret = avr_input();
+ if (avr_ret == -2)
+ return (-2);
+ else if (avr_ret > 0)
+ return avr_ret;
+ }
#endif
c = getc();
/*------------------------------------------------------------------- */
+#ifndef CONFIG_LINKSTATION
int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
ulong msr, addr;
return 1;
}
+#endif
/* ------------------------------------------------------------------------- */
in_flash:
-#if defined(CONFIG_BMW)
+#if defined(CONFIG_BMW) || defined(CONFIG_LINKSTATION)
bl early_init_f /* Must be ASM: no stack yet! */
#endif
/*
mtspr HID0, r2
sync
+#if !defined(CONFIG_LINKSTATION)
/* Allocate Initial RAM in data cache.
*/
lis r3, CFG_INIT_RAM_ADDR@h
ori r3, r3, 0x0080
sync
mtspr 1011, r3
+#endif /* !CONFIG_LINKSTATION */
#endif /* !CONFIG_BMW */
/*
* Thisk the stack pointer *somewhere* sensible. Doesnt
GET_GOT /* initialize GOT access */
/* r3: IMMR */
+#if !defined(CONFIG_LINKSTATION)
bl cpu_init_f /* run low-level CPU init code (from Flash) */
+#endif
mr r3, r21
/* r3: BOOTFLAG */
mr r10, r5 /* Save copy of Destination Address */
mr r3, r5 /* Destination Address */
-#ifdef CFG_RAMBOOT
+#if defined(CFG_RAMBOOT) && !defined(CONFIG_LINKSTATION)
lis r4, CFG_SDRAM_BASE@h /* Source Address */
ori r4, r4, CFG_SDRAM_BASE@l
#else
cmplw 0, r7, r8
blt 4b
+ mfmsr r7 /* Exception prefix 0x000 */
+ li r8,0
+ ori r8,r8,MSR_IP
+ andc r7,r7,r8
+ SYNC
+ mtmsr r7
+ SYNC
+
mtlr r4 /* restore link register */
blr
#include <net.h>
#include <pci.h>
+#if 0
+#define DEBUG_TRACE
+#define DEBUG_TULIP
+#endif
+
#undef DEBUG_SROM
#undef DEBUG_SROM2
#undef UPDATE_SROM
-/* PCI Registers.
+/*
+ * PCI Registers.
*/
-#define PCI_CFDA_PSM 0x43
+#define PCI_CFDA_PSM 0x43
#define CFRV_RN 0x000000f0 /* Revision Number */
#define DC2114x_BRK 0x0020 /* CFRV break between DC21142 & DC21143 */
-/* Ethernet chip registers.
+/*
+ * Ethernet chip registers.
*/
#define DE4X5_BMR 0x000 /* Bus Mode Register */
#define DE4X5_TPD 0x008 /* Transmit Poll Demand Reg */
+#define DE4X5_RPD 0x010 /* Receive Poll Demand Reg */
#define DE4X5_RRBA 0x018 /* RX Ring Base Address Reg */
#define DE4X5_TRBA 0x020 /* TX Ring Base Address Reg */
#define DE4X5_STS 0x028 /* Status Register */
#define DE4X5_SICR 0x068 /* SIA Connectivity Register */
#define DE4X5_APROM 0x048 /* Ethernet Address PROM */
-/* Register bits.
+/*
+ * Register bits.
*/
#define BMR_SWR 0x00000001 /* Software Reset */
#define STS_TS 0x00700000 /* Transmit Process State */
#define OMR_PS 0x00040000 /* Port Select */
#define OMR_SDP 0x02000000 /* SD Polarity - MUST BE ASSERTED */
#define OMR_PM 0x00000080 /* Pass All Multicast */
+#define OMR_PMS 0x00000040 /* Promiscuous */
-/* Descriptor bits.
+/*
+ * Descriptor bits.
*/
#define R_OWN 0x80000000 /* Own Bit */
#define RD_RER 0x02000000 /* Receive End Of Ring */
#define SROM_HWADD 0x0014 /* Hardware Address offset in SROM */
#define SROM_RD 0x00004000 /* Read from Boot ROM */
-#define EE_DATA_WRITE 0x04 /* EEPROM chip data in. */
+#define EE_DATA_WRITE 0x04 /* EEPROM chip data in. */
#define EE_WRITE_0 0x4801
#define EE_WRITE_1 0x4805
-#define EE_DATA_READ 0x08 /* EEPROM chip data out. */
+#define EE_DATA_READ 0x08 /* EEPROM chip data out. */
#define SROM_SR 0x00000800 /* Select Serial ROM when set */
#define DT_IN 0x00000004 /* Serial Data In */
#define POLL_DEMAND 1
+#ifndef PCI_VENDOR_ID_ADMTEK
+# define PCI_VENDOR_ID_ADMTEK 0x1317
+#endif
+#ifndef PCI_DEVICE_ID_ADMTEK_AN983B
+# define PCI_DEVICE_ID_ADMTEK_AN983B 0x985
+#endif
+
+/* The chip types have been taken from linux-2.4.31
+ * drivers/net/tulip/tulip.h
+ * Only COMET is used for now
+ */
+enum chips {
+ DC21040 = 0,
+ DC21041 = 1,
+ DC21140 = 2,
+ DC21142 = 3, DC21143 = 3,
+ LC82C168,
+ MX98713,
+ MX98715,
+ MX98725,
+ AX88140,
+ PNIC2,
+ COMET,
+ COMPEX9881,
+ I21145,
+ DM910X,
+ CONEXANT,
+};
+static int chip_idx = DC21143;
+
#ifdef CONFIG_TULIP_FIX_DAVICOM
#define RESET_DM9102(dev) {\
unsigned long i;\
#else
#define RESET_DE4X5(dev) {\
int i;\
- i=INL(dev, DE4X5_BMR);\
- udelay(1000);\
+ i=0x01A04000;\
OUTL(dev, i | BMR_SWR, DE4X5_BMR);\
udelay(1000);\
OUTL(dev, i, DE4X5_BMR);\
udelay(1000);\
- for (i=0;i<5;i++) {INL(dev, DE4X5_BMR); udelay(10000);}\
- udelay(1000);\
}
#endif
#define START_DE4X5(dev) {\
- s32 omr; \
+ u32 omr; \
omr = INL(dev, DE4X5_OMR);\
omr |= OMR_ST | OMR_SR;\
OUTL(dev, omr, DE4X5_OMR); /* Enable the TX and/or RX */\
}
#define STOP_DE4X5(dev) {\
- s32 omr; \
+ u32 omr; \
omr = INL(dev, DE4X5_OMR);\
omr &= ~(OMR_ST|OMR_SR);\
OUTL(dev, omr, DE4X5_OMR); /* Disable the TX and/or RX */ \
}
-#define NUM_RX_DESC PKTBUFSRX
+#define NUM_RX_DESC 4
#ifndef CONFIG_TULIP_FIX_DAVICOM
- #define NUM_TX_DESC 1 /* Number of TX descriptors */
+ #define NUM_TX_DESC 2 /* Number of TX descriptors */
#else
#define NUM_TX_DESC 4
#endif
-#define RX_BUFF_SZ PKTSIZE_ALIGN
+#define BUFLEN 1536
#define TOUT_LOOP 1000000
#define SETUP_FRAME_LEN 192
#define ETH_ALEN 6
+#define ETH_ZLEN 60
struct de4x5_desc {
- volatile s32 status;
+ volatile u32 status;
u32 des1;
u32 buf;
u32 next;
};
-static struct de4x5_desc rx_ring[NUM_RX_DESC] __attribute__ ((aligned(32))); /* RX descriptor ring */
-static struct de4x5_desc tx_ring[NUM_TX_DESC] __attribute__ ((aligned(32))); /* TX descriptor ring */
-static int rx_new; /* RX descriptor ring pointer */
-static int tx_new; /* TX descriptor ring pointer */
+/* Note: transmit and receive buffers must be longword aligned and
+ longword divisable */
-static char rxRingSize;
-static char txRingSize;
+/* TX descriptor ring */
+static struct de4x5_desc tx_ring[NUM_TX_DESC] __attribute__ ((aligned(4)));
+/* TX buffer */
+static unsigned char txb[BUFLEN] __attribute__ ((aligned(32)));
+
+/* RX descriptor ring */
+static struct de4x5_desc rx_ring[NUM_RX_DESC] __attribute__ ((aligned(4)));
+/* RX buffers */
+static unsigned char rxb[NUM_RX_DESC * BUFLEN] __attribute__ ((aligned(32)));
+
+static int rx_new; /* RX descriptor ring pointer */
#if defined(UPDATE_SROM) || !defined(CONFIG_TULIP_FIX_DAVICOM)
static void sendto_srom(struct eth_device* dev, u_int command, u_long addr);
static struct pci_device_id supported[] = {
{ PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_TULIP_FAST },
{ PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_21142 },
+ { PCI_VENDOR_ID_ADMTEK, PCI_DEVICE_ID_ADMTEK_AN983B },
#ifdef CONFIG_TULIP_FIX_DAVICOM
{ PCI_VENDOR_ID_DAVICOM, PCI_DEVICE_ID_DAVICOM_DM9102A },
#endif
{
int idx=0;
int card_number = 0;
- unsigned int cfrv;
+ unsigned int cfrv;
unsigned char timer;
- pci_dev_t devbusfn;
+ pci_dev_t devbusfn;
unsigned int iobase;
unsigned short status;
struct eth_device* dev;
+ u16 vendor;
+ u16 device;
+#ifdef DEBUG_TULIP
+ printf("%s\n", __FUNCTION__);
+#endif
while(1) {
devbusfn = pci_find_devices(supported, idx++);
if (devbusfn == -1) {
break;
}
+ pci_read_config_word(devbusfn, PCI_VENDOR_ID, &vendor);
+ pci_read_config_word(devbusfn, PCI_DEVICE_ID, &device);
+
+ debug("dc21x4x: devbusfn: %08lX, VID: %08lX, DID: %08lX\n",
+ devbusfn, vendor, device);
- /* Get the chip configuration revision register. */
- pci_read_config_dword(devbusfn, PCI_REVISION_ID, &cfrv);
+ if (vendor == PCI_VENDOR_ID_ADMTEK && \
+ device == PCI_DEVICE_ID_ADMTEK_AN983B) {
+ chip_idx = COMET;
+ } else {
+ /* Get the chip configuration revision register. */
+ pci_read_config_dword(devbusfn, PCI_REVISION_ID, &cfrv);
#ifndef CONFIG_TULIP_FIX_DAVICOM
- if ((cfrv & CFRV_RN) < DC2114x_BRK ) {
- printf("Error: The chip is not DC21143.\n");
- continue;
- }
+ if ((cfrv & CFRV_RN) < DC2114x_BRK ) {
+ printf("Error: The chip is not DC21143.\n");
+ idx++;
+ continue;
+ }
#endif
-
+ }
pci_read_config_word(devbusfn, PCI_COMMAND, &status);
status |=
#ifdef CONFIG_TULIP_USE_IO
#ifdef CONFIG_TULIP_FIX_DAVICOM
sprintf(dev->name, "Davicom#%d", card_number);
#else
- sprintf(dev->name, "dc21x4x#%d", card_number);
+ if (chip_idx == COMET)
+ sprintf(dev->name, "COMET#%d", card_number);
+ else
+ sprintf(dev->name, "dc21x4x#%d", card_number);
#endif
#ifdef CONFIG_TULIP_USE_IO
/* Ensure we're not sleeping. */
pci_write_config_byte(devbusfn, PCI_CFDA_PSM, WAKEUP);
- udelay(10 * 1000);
-
#ifndef CONFIG_TULIP_FIX_DAVICOM
read_hw_addr(dev, bis);
#endif
int i;
int devbusfn = (int) dev->priv;
- /* Ensure we're not sleeping. */
- pci_write_config_byte(devbusfn, PCI_CFDA_PSM, WAKEUP);
+#if defined(DEBUG_TULIP) || defined(DEBUG_TRACE)
+ serial_printf("%0lu %s\n", get_timer(0), __FUNCTION__);
+#endif
#ifdef CONFIG_TULIP_FIX_DAVICOM
RESET_DM9102(dev);
RESET_DE4X5(dev);
#endif
- if ((INL(dev, DE4X5_STS) & (STS_TS | STS_RS)) != 0) {
- printf("Error: Cannot reset ethernet controller.\n");
- return 0;
- }
-
#ifdef CONFIG_TULIP_SELECT_MEDIA
dc21x4x_select_media(dev);
#else
- OUTL(dev, OMR_SDP | OMR_PS | OMR_PM, DE4X5_OMR);
+ if (chip_idx == COMET) {
+ /* No multicast */
+ OUTL(dev, 0, 0xAC);
+ OUTL(dev, 0, 0xB0);
+ } else {
+ OUTL(dev, OMR_SDP | OMR_PS | OMR_PM, DE4X5_OMR);
+ }
#endif
for (i = 0; i < NUM_RX_DESC; i++) {
rx_ring[i].status = cpu_to_le32(R_OWN);
- rx_ring[i].des1 = cpu_to_le32(RX_BUFF_SZ);
- rx_ring[i].buf = cpu_to_le32(phys_to_bus((u32) NetRxPackets[i]));
-#ifdef CONFIG_TULIP_FIX_DAVICOM
- rx_ring[i].next = cpu_to_le32(phys_to_bus((u32) &rx_ring[(i+1) % NUM_RX_DESC]));
-#else
- rx_ring[i].next = 0;
-#endif
+ rx_ring[i].des1 = cpu_to_le32(BUFLEN);
+ rx_ring[i].buf = cpu_to_le32(phys_to_bus((u32)&rxb[i * BUFLEN]));
+ rx_ring[i].next = cpu_to_le32(phys_to_bus((u32)&rx_ring[i+1]));
}
+ /* Write the end of list marker to the descriptor lists. */
+ rx_ring[NUM_RX_DESC - 1].des1 |= cpu_to_le32(RD_RER);
+ rx_ring[NUM_RX_DESC - 1].next = cpu_to_le32(phys_to_bus((u32)&rx_ring[0]));
- for (i=0; i < NUM_TX_DESC; i++) {
- tx_ring[i].status = 0;
- tx_ring[i].des1 = 0;
- tx_ring[i].buf = 0;
+ /* Point to the first descriptor */
+ rx_new = 0;
-#ifdef CONFIG_TULIP_FIX_DAVICOM
- tx_ring[i].next = cpu_to_le32(phys_to_bus((u32) &tx_ring[(i+1) % NUM_TX_DESC]));
-#else
- tx_ring[i].next = 0;
-#endif
- }
+ /* We only use 1 transmit buffer, but we use 2 descriptors so
+ transmit engines have somewhere to point to if they feel the need */
+
+ tx_ring[0].status = 0;
+ tx_ring[0].des1 = 0;
+ tx_ring[0].buf = cpu_to_le32(phys_to_bus((u32)&txb[0]));
+ tx_ring[0].next = cpu_to_le32(phys_to_bus((u32)&tx_ring[1]));
- rxRingSize = NUM_RX_DESC;
- txRingSize = NUM_TX_DESC;
+ /* this descriptor should never get used, since it will never be owned
+ by the machine (status will always == 0) */
+
+ tx_ring[1].status = 0;
+ tx_ring[1].des1 = 0;
+ tx_ring[1].buf = cpu_to_le32(phys_to_bus((u32)&txb[0]));
+ tx_ring[1].next = cpu_to_le32(phys_to_bus((u32)&tx_ring[0]));
/* Write the end of list marker to the descriptor lists. */
- rx_ring[rxRingSize - 1].des1 |= cpu_to_le32(RD_RER);
- tx_ring[txRingSize - 1].des1 |= cpu_to_le32(TD_TER);
+ tx_ring[1].des1 |= cpu_to_le32(TD_TER);
/* Tell the adapter where the TX/RX rings are located. */
- OUTL(dev, phys_to_bus((u32) &rx_ring), DE4X5_RRBA);
- OUTL(dev, phys_to_bus((u32) &tx_ring), DE4X5_TRBA);
+ OUTL(dev, phys_to_bus((u32) &rx_ring[0]), DE4X5_RRBA);
+ OUTL(dev, phys_to_bus((u32) &tx_ring[0]), DE4X5_TRBA);
+
+ if (chip_idx == COMET) {
+ /* Bit 18 (0x00040000) is reserved in the AN983B */
+ /* datasheet, but it is used by the tulip driver */
+ OUTL(dev, (INL(dev, (DE4X5_OMR)) & ~(OMR_PMS | OMR_PM)) | OMR_PS, DE4X5_OMR);
+ /* Enable automatic Tx underrun recovery */
+ OUTL(dev, INL(dev, 0x88) | 1, 0x88);
+// OUTL(dev, INL(dev, 0x88) | 0x19, 0x88);
+ }
START_DE4X5(dev);
- tx_new = 0;
- rx_new = 0;
+ /* Start receiving */
+ OUTL(dev, POLL_DEMAND, DE4X5_RPD);
- send_setup_frame(dev, bis);
+ if (chip_idx != COMET) { /* No setup frame needed by COMET */
+ send_setup_frame(dev, bis);
+ }
return 1;
}
{
int status = -1;
int i;
+ u32 len = length;
if (length <= 0) {
printf("%s: bad packet size: %d\n", dev->name, length);
goto Done;
}
- for(i = 0; tx_ring[tx_new].status & cpu_to_le32(T_OWN); i++) {
+ for(i = 0; tx_ring[0].status & cpu_to_le32(T_OWN); i++) {
if (i >= TOUT_LOOP) {
- printf("%s: tx error buffer not ready\n", dev->name);
+ printf(".%s: Tx not ready\n", dev->name);
goto Done;
}
}
- tx_ring[tx_new].buf = cpu_to_le32(phys_to_bus((u32) packet));
- tx_ring[tx_new].des1 = cpu_to_le32(TD_TER | TD_LS | TD_FS | length);
- tx_ring[tx_new].status = cpu_to_le32(T_OWN);
+ /* Disable the TX */
+ OUTL(dev, INL(dev, DE4X5_OMR) & ~OMR_ST, DE4X5_OMR);
+
+ memcpy(txb, (char*)packet, length);
+ /* setup the transmit descriptor */
+ tx_ring[0].des1 = cpu_to_le32(TD_LS | TD_FS | length);
+ tx_ring[0].status = cpu_to_le32(T_OWN);
+
+ /* Point to transmit descriptor */
+ OUTL(dev, phys_to_bus((u32) &tx_ring[0]), DE4X5_TRBA);
+
+ /* Enable the TX */
+ OUTL(dev, INL(dev, DE4X5_OMR) | OMR_ST, DE4X5_OMR);
+
+ /* Immediate transmit demand */
OUTL(dev, POLL_DEMAND, DE4X5_TPD);
- for(i = 0; tx_ring[tx_new].status & cpu_to_le32(T_OWN); i++) {
+ for(i = 0; tx_ring[0].status & cpu_to_le32(T_OWN); i++) {
if (i >= TOUT_LOOP) {
- printf(".%s: tx buffer not ready\n", dev->name);
+ printf(".%s: Tx Timeout\n", dev->name);
goto Done;
}
}
- if (le32_to_cpu(tx_ring[tx_new].status) & TD_ES) {
-#if 0 /* test-only */
+#ifdef DEBUG_TRACE
+ serial_printf("%0lu Tx L2: %d P: %04X IP: %08X\n",
+ get_timer(0), i, *((u16 *)(packet+0xC)),
+ *((u32 *)(packet+0x1E)));
+#endif
+
+ if (le32_to_cpu(tx_ring[0].status) & TD_ES) {
+#if 1 /* test-only */
printf("TX error status = 0x%08X\n",
- le32_to_cpu(tx_ring[tx_new].status));
+ le32_to_cpu(tx_ring[0].status));
#endif
- tx_ring[tx_new].status = 0x0;
+ tx_ring[0].status = 0x0;
goto Done;
}
status = length;
Done:
- tx_new = (tx_new+1) % NUM_TX_DESC;
return status;
}
static int dc21x4x_recv(struct eth_device* dev)
{
- s32 status;
+ u32 status;
+ int rx_prv;
int length = 0;
- for ( ; ; ) {
- status = (s32)le32_to_cpu(rx_ring[rx_new].status);
+#ifdef DEBUG_TULIP
+ u32 csr5 = INL(dev, DE4X5_STS);
+ if ((csr5 & STS_RS) != 0x00060000) {
+ OUTL(dev, 0x0001ffff, DE4X5_STS);
+ printf("Receive status: 0x%08X\n", csr5);
+ }
+#endif
- if (status & R_OWN) {
- break;
- }
+ status = (u32)le32_to_cpu(rx_ring[rx_new].status);
+ if (status & R_OWN)
+ return 0;
- if (status & RD_LS) {
- /* Valid frame status.
- */
- if (status & RD_ES) {
-
- /* There was an error.
- */
- printf("RX error status = 0x%08X\n", status);
- } else {
- /* A valid frame received.
- */
- length = (le32_to_cpu(rx_ring[rx_new].status) >> 16);
-
- /* Pass the packet up to the protocol
- * layers.
- */
- NetReceive(NetRxPackets[rx_new], length - 4);
- }
+#ifdef DEBUG_TULIP
+ printf("recv status: 0x%08X\n", status);
+#endif
- /* Change buffer ownership for this frame, back
- * to the adapter.
- */
+ if (status & RD_LS) {
+#ifdef DEBUG_TRACE
+ serial_printf("rx: %d status: %08X\n", rx_new, status);
+#endif
+ /* Valid frame status */
+ if (status & RD_ES) {
+ /* There was an error */
+ printf("RX error status = 0x%08X\n", status);
rx_ring[rx_new].status = cpu_to_le32(R_OWN);
- }
+ } else {
+ /* Received valid frame */
+ length = (int)(le32_to_cpu(rx_ring[rx_new].status) >> 16);
- /* Update entry information.
- */
- rx_new = (rx_new + 1) % rxRingSize;
+ /* Pass the packet up to the protocol layers. */
+ unsigned char rxdata[BUFLEN];
+ memcpy(rxdata, rxb + rx_new * BUFLEN, length - 4);
+
+ /* Give buffer ownership for this
+ * frame back to the adapter */
+ rx_ring[rx_new].status = cpu_to_le32(R_OWN);
+
+ /* Pass the received packet to the upper layer */
+ NetReceive(rxdata, length - 4);
+ }
}
+ /* Update current descriptor index */
+ rx_new = (rx_new + 1) % NUM_RX_DESC;
+
return length;
}
{
int devbusfn = (int) dev->priv;
+#ifdef DEBUG_TULIP
+ printf("%s\n", __FUNCTION__);
+#endif
STOP_DE4X5(dev);
OUTL(dev, 0, DE4X5_SICR);
- pci_write_config_byte(devbusfn, PCI_CFDA_PSM, SLEEP);
}
static void send_setup_frame(struct eth_device* dev, bd_t *bis)
}
}
- for(i = 0; tx_ring[tx_new].status & cpu_to_le32(T_OWN); i++) {
+ for(i = 0; tx_ring[0].status & cpu_to_le32(T_OWN); i++) {
if (i >= TOUT_LOOP) {
printf("%s: tx error buffer not ready\n", dev->name);
goto Done;
}
}
- tx_ring[tx_new].buf = cpu_to_le32(phys_to_bus((u32) &setup_frame[0]));
- tx_ring[tx_new].des1 = cpu_to_le32(TD_TER | TD_SET| SETUP_FRAME_LEN);
- tx_ring[tx_new].status = cpu_to_le32(T_OWN);
+ tx_ring[0].buf = cpu_to_le32(phys_to_bus((u32) &setup_frame[0]));
+ tx_ring[0].des1 = cpu_to_le32(TD_TER | TD_SET| SETUP_FRAME_LEN);
+ tx_ring[0].status = cpu_to_le32(T_OWN);
OUTL(dev, POLL_DEMAND, DE4X5_TPD);
- for(i = 0; tx_ring[tx_new].status & cpu_to_le32(T_OWN); i++) {
+ for(i = 0; tx_ring[0].status & cpu_to_le32(T_OWN); i++) {
if (i >= TOUT_LOOP) {
printf("%s: tx buffer not ready\n", dev->name);
goto Done;
}
}
- if (le32_to_cpu(tx_ring[tx_new].status) != 0x7FFFFFFF) {
- printf("TX error status2 = 0x%08X\n", le32_to_cpu(tx_ring[tx_new].status));
+ if (le32_to_cpu(tx_ring[0].status) != 0x7FFFFFFF) {
+ printf("TX error status2 = 0x%08X\n", le32_to_cpu(tx_ring[0].status));
}
- tx_new = (tx_new+1) % NUM_TX_DESC;
Done:
return;
static int
getfrom_srom(struct eth_device* dev, u_long addr)
{
- s32 tmp;
+ u32 tmp;
tmp = INL(dev, addr);
udelay(1);
#ifndef CONFIG_TULIP_FIX_DAVICOM
static void read_hw_addr(struct eth_device *dev, bd_t *bis)
{
- u_short tmp, *p = (u_short *)(&dev->enetaddr[0]);
- int i, j = 0;
-
- for (i = 0; i < (ETH_ALEN >> 1); i++) {
- tmp = read_srom(dev, DE4X5_APROM, ((SROM_HWADD >> 1) + i));
- *p = le16_to_cpu(tmp);
- j += *p++;
- }
+ if (chip_idx == COMET) {
+ /* COMET reads the ehernet address directly from the EEPROM */
+ *(u32 *)dev->enetaddr = cpu_to_le32(INL(dev, 0xA4));
+ *(u16 *)(dev->enetaddr+4) = cpu_to_le16(INL(dev, 0xA8));
+ *(u32 *)bis->bi_enetaddr = *(u32 *)dev->enetaddr;
+ *(u16 *)(bis->bi_enetaddr+4) = *(u16 *)(dev->enetaddr+4);
+ } else {
+ u_short tmp, *p = (u_short *)(&dev->enetaddr[0]);
+ int i, j = 0;
+
+ for (i = 0; i < (ETH_ALEN >> 1); i++) {
+ tmp=read_srom(dev, DE4X5_APROM, ((SROM_HWADD >> 1)+i));
+ *p = le16_to_cpu(tmp);
+ j += *p++;
+ }
- if ((j == 0) || (j == 0x2fffd)) {
- memset (dev->enetaddr, 0, ETH_ALEN);
- debug ("Warning: can't read HW address from SROM.\n");
- goto Done;
+ if ((j == 0) || (j == 0x2fffd)) {
+ memset (dev->enetaddr, 0, ETH_ALEN);
+ debug ("Warning: can't read HW address from SROM.\n");
+ goto Done;
+ }
}
return;
#endif /* UPDATE_SROM */
#endif /* CFG_CMD_NET && CONFIG_NET_MULTI && CONFIG_TULIP */
+
+/* vim: set ts=4: */
#include <command.h>
#include <devices.h>
+#include <console.h>
#include <net.h>
static char input_buffer[512];
output_packet_len = len;
NetLoop (NETCONS); /* wait for arp reply and send packet */
output_packet_len = 0;
+#if defined(CFG_CONSOLE_IS_IN_ENV) || defined(CONFIG_SILENT_CONSOLE)
+ if (NetState == NETLOOP_FAIL) {
+ /* ARP failed, fail back to serial console */
+ device_t *idev;
+ device_t *odev;
+
+ idev = search_device(DEV_FLAGS_INPUT, "serial");
+ odev = search_device(DEV_FLAGS_OUTPUT, "serial");
+
+ console_setfile (stdin, idev);
+ console_setfile (stdout, odev);
+ console_setfile (stderr, odev);
+
+#if defined(CONFIG_LINKSTATION)
+ void next_cons_choice(int console);
+ /* Console 0 is the serial console */
+ next_cons_choice(0);
+#endif
+ }
+#endif
return;
}
input_recursion = 1;
- net_timeout = 1;
+// net_timeout = 1;
+ net_timeout = 50;
NetLoop (NETCONS); /* kind of poll */
input_recursion = 0;
*
* Indent Options: indent -kr -i8
***************************************************************************/
-
+/*
+ * 26 August 2006 Mihai Georgian <u-boot@linuxnotincluded.org.uk>
+ * Modified to use le32_to_cpu and cpu_to_le32 properly
+ */
#include <common.h>
#include <malloc.h>
#include <net.h>
static u32 ioaddr;
/* Condensed operations for readability. */
+#define virt_to_bus(addr) cpu_to_le32(addr)
#define virt_to_le32desc(addr) cpu_to_le32(virt_to_bus(addr))
#define le32desc_to_virt(addr) bus_to_virt(le32_to_cpu(addr))
ioaddr = dev->iobase;
cur_rx = tpc->cur_rx;
- if ((tpc->RxDescArray[cur_rx].status & OWNbit) == 0) {
- if (!(tpc->RxDescArray[cur_rx].status & RxRES)) {
+ if ((le32_to_cpu(tpc->RxDescArray[cur_rx].status) & OWNbit) == 0) {
+ if (!(le32_to_cpu(tpc->RxDescArray[cur_rx].status) & RxRES)) {
unsigned char rxdata[RX_BUF_LEN];
- length = (int) (tpc->RxDescArray[cur_rx].
- status & 0x00001FFF) - 4;
+ length = (int) (le32_to_cpu(tpc->RxDescArray[cur_rx].
+ status) & 0x00001FFF) - 4;
memcpy(rxdata, tpc->RxBufferRing[cur_rx], length);
NetReceive(rxdata, length);
if (cur_rx == NUM_RX_DESC - 1)
tpc->RxDescArray[cur_rx].status =
- (OWNbit | EORbit) + RX_BUF_SIZE;
+ cpu_to_le32((OWNbit | EORbit) + RX_BUF_SIZE);
else
tpc->RxDescArray[cur_rx].status =
- OWNbit + RX_BUF_SIZE;
+ cpu_to_le32(OWNbit + RX_BUF_SIZE);
tpc->RxDescArray[cur_rx].buf_addr =
- virt_to_bus(tpc->RxBufferRing[cur_rx]);
+ cpu_to_le32(tpc->RxBufferRing[cur_rx]);
} else {
puts("Error Rx");
}
u8 *ptxb;
int entry = tpc->cur_tx % NUM_TX_DESC;
u32 len = length;
+ int ret;
#ifdef DEBUG_RTL8169_TX
int stime = currticks();
/* point to the current txb incase multiple tx_rings are used */
ptxb = tpc->Tx_skbuff[entry * MAX_ETH_FRAME_SIZE];
+#ifdef DEBUG_RTL8169_TX
+ printf("ptxb: %08X, length: %d\n", ptxb, (int)length);
+#endif
memcpy(ptxb, (char *)packet, (int)length);
while (len < ETH_ZLEN)
ptxb[len++] = '\0';
- tpc->TxDescArray[entry].buf_addr = virt_to_bus(ptxb);
+ tpc->TxDescArray[entry].buf_addr = cpu_to_le32(ptxb);
if (entry != (NUM_TX_DESC - 1)) {
tpc->TxDescArray[entry].status =
- (OWNbit | FSbit | LSbit) | ((len > ETH_ZLEN) ?
- len : ETH_ZLEN);
+ cpu_to_le32((OWNbit | FSbit | LSbit) |
+ ((len > ETH_ZLEN) ? len : ETH_ZLEN));
} else {
tpc->TxDescArray[entry].status =
- (OWNbit | EORbit | FSbit | LSbit) |
- ((len > ETH_ZLEN) ? length : ETH_ZLEN);
+ cpu_to_le32((OWNbit | EORbit | FSbit | LSbit) |
+ ((len > ETH_ZLEN) ? len : ETH_ZLEN));
}
RTL_W8(TxPoll, 0x40); /* set polling bit */
tpc->cur_tx++;
to = currticks() + TX_TIMEOUT;
- while ((tpc->TxDescArray[entry].status & OWNbit) && (currticks() < to)); /* wait */
+ while ((le32_to_cpu(tpc->TxDescArray[entry].status) & OWNbit)
+ && (currticks() < to)); /* wait */
if (currticks() >= to) {
#ifdef DEBUG_RTL8169_TX
puts ("tx timeout/error\n");
printf ("%s elapsed time : %d\n", __FUNCTION__, currticks()-stime);
#endif
- return 0;
+ ret = 0;
} else {
#ifdef DEBUG_RTL8169_TX
puts("tx done\n");
#endif
- return length;
+ ret = length;
}
+ /* Delay to make net console (nc) work properly */
+ udelay(20);
+ return ret;
}
static void rtl8169_set_rx_mode(struct eth_device *dev)
for (i = 0; i < NUM_RX_DESC; i++) {
if (i == (NUM_RX_DESC - 1))
tpc->RxDescArray[i].status =
- (OWNbit | EORbit) + RX_BUF_SIZE;
+ cpu_to_le32((OWNbit | EORbit) + RX_BUF_SIZE);
else
- tpc->RxDescArray[i].status = OWNbit + RX_BUF_SIZE;
+ tpc->RxDescArray[i].status =
+ cpu_to_le32(OWNbit + RX_BUF_SIZE);
tpc->RxBufferRing[i] = &rxb[i * RX_BUF_SIZE];
tpc->RxDescArray[i].buf_addr =
- virt_to_bus(tpc->RxBufferRing[i]);
+ cpu_to_le32(tpc->RxBufferRing[i]);
}
#ifdef DEBUG_RTL8169
if (tpc->TxDescArrays == 0)
puts("Allot Error");
/* Tx Desscriptor needs 256 bytes alignment; */
- TxPhyAddr = virt_to_bus(tpc->TxDescArrays);
+ TxPhyAddr = tpc->TxDescArrays;
diff = 256 - (TxPhyAddr - ((TxPhyAddr >> 8) << 8));
TxPhyAddr += diff;
tpc->TxDescArray = (struct TxDesc *) (tpc->TxDescArrays + diff);
+#ifdef DEBUG_RTL8169
+ printf("tpc->TxDescArray: %08X\n", tpc->TxDescArray);
+#endif
tpc->RxDescArrays = rx_ring;
/* Rx Desscriptor needs 256 bytes alignment; */
- RxPhyAddr = virt_to_bus(tpc->RxDescArrays);
+ RxPhyAddr = tpc->RxDescArrays;
diff = 256 - (RxPhyAddr - ((RxPhyAddr >> 8) << 8));
RxPhyAddr += diff;
tpc->RxDescArray = (struct RxDesc *) (tpc->RxDescArrays + diff);
+#ifdef DEBUG_RTL8169
+ printf("tpc->RxDescArray: %08X\n", tpc->RxDescArray);
+#endif
if (tpc->TxDescArrays == NULL || tpc->RxDescArrays == NULL) {
puts("Allocate RxDescArray or TxDescArray failed\n");
/* Get MAC address. FIXME: read EEPROM */
for (i = 0; i < MAC_ADDR_LEN; i++)
- dev->enetaddr[i] = RTL_R8(MAC0 + i);
+ bis->bi_enetaddr[i] = dev->enetaddr[i] = RTL_R8(MAC0 + i);
#ifdef DEBUG_RTL8169
printf("MAC Address");
PHY_Enable_Auto_Nego | PHY_Restart_Auto_Nego);
udelay(100);
+#ifdef CONFIG_LINKSTATION
+void miconCntl_FanLow(void);
+void miconCntl_FanHigh(void);
+void miconCntl_Eth1000M(int up);
+void miconCntl_Eth100M(int up);
+void miconCntl_Eth10M(int up);
+void miconCntl_5f(void);
+
+ miconCntl_FanLow();
+#endif
+
/* wait for auto-negotiation process */
for (i = 10000; i > 0; i--) {
/* check if auto-negotiation complete */
if (mdio_read(PHY_STAT_REG) & PHY_Auto_Neco_Comp) {
udelay(100);
option = RTL_R8(PHYstatus);
+#if defined(CONFIG_LINKSTATION) && defined(CONFIG_HTGL)
if (option & _1000bpsF) {
#ifdef DEBUG_RTL8169
printf("%s: 1000Mbps Full-duplex operation.\n",
dev->name);
#endif
- } else {
+ miconCntl_Eth1000M(1);
+ } else if (option & _100bps) {
+#ifdef DEBUG_RTL8169
+ printf("%s: 100Mbps %s-duplexoperation.\n",
+ dev->name,
+ (option & FullDup) ? "Full" : "Half");
+#endif
+ miconCntl_Eth100M(1);
+ } else if (option & _10bps) {
#ifdef DEBUG_RTL8169
printf
- ("%s: %sMbps %s-duplex operation.\n",
+ ("%s: 10Mbps %s-duplex operation.\n",
dev->name,
- (option & _100bps) ? "100" :
- "10",
- (option & FullDup) ? "Full" :
- "Half");
+ (option & FullDup) ? "Full" : "Half");
#endif
+ miconCntl_Eth100M(1);
}
+ miconCntl_5f();
+#else /* !defined(CONFIG_LINKSTATION) || !defined(CONFIG_HTGL) */
+ if (option & _1000bpsF) {
+#ifdef DEBUG_RTL8169
+ printf("%s: 1000Mbps Full-duplex operation.\n",
+ dev->name);
+#endif
+ miconCntl_FanHigh();
+ } else {
+#ifdef DEBUG_RTL8169
+ printk("%s: %sMbps %s-duplex operation.\n",
+ dev->name,
+ (option & _100bps) ? "100" : "10",
+ (option & FullDup) ? "Full" : "Half");
+#endif
+ }
+#endif
break;
} else {
udelay(100);
}
- } /* end for-loop to wait for auto-negotiation process */
+ } /* end for-loop to wait for auto-negotiation process */
} else {
udelay(100);
}
#endif
+
+/* vim: set ts=4: */
/* Magic value used to identify an ext2 filesystem. */
#define EXT2_MAGIC 0xEF53
+/* Magic value used to identify Buffalo's idea of ext2 */
+#define LINKSTATION_MAGIC 0xEF54
/* Amount of indirect blocks in an inode. */
#define INDIRECT_BLOCKS 12
/* Maximum lenght of a pathname. */
goto fail;
}
/* Make sure this is an ext2 filesystem. */
- if (__le16_to_cpu (data->sblock.magic) != EXT2_MAGIC) {
+ if ((__le16_to_cpu (data->sblock.magic) != EXT2_MAGIC) &&
+ (__le16_to_cpu (data->sblock.magic) != LINKSTATION_MAGIC)) {
goto fail;
}
data->diropen.data = data;
int devices_init (void);
int devices_done (void);
int device_deregister(char *devname);
+int console_setfile (int file, device_t * dev);
#ifdef CONFIG_LCD
int drv_lcd_init (void);
#endif
#ifdef CONFIG_NETCONSOLE
int drv_nc_init (void);
#endif
+#if defined(CFG_CONSOLE_IS_IN_ENV) || defined(CONFIG_SPLASH_SCREEN) || defined(CONFIG_SILENT_CONSOLE)
+device_t *search_device (int flags, char *name);
+#endif
#endif /* _DEVICES_H_ */
#define AMD_ID_LV320B_2 0x221A221A /* 2d ID word for AM29LV320MB at 0x38 */
#define AMD_ID_LV320B_3 0x22002200 /* 3d ID word for AM29LV320MB at 0x3c */
+#define AMD_ID_LV320T_2 0x221A221A /* 2d ID word for AM29LV320MT at 0x38 */
+#define AMD_ID_LV320T_3 0x22012201 /* 3d ID word for AM29LV320MT at 0x3c */
#define AMD_ID_LV640U 0x22D722D7 /* 29LV640U ID (64 M, uniform sectors) */
#define AMD_ID_LV650U 0x22D722D7 /* 29LV650U ID (64 M, uniform sectors) */
#define STM_ID_x800AB 0x005B005B /* M29W800AB ID (8M = 512K x 16 ) */
#define STM_ID_29W320DT 0x22CA22CA /* M29W320DT ID (32 M, top boot sector) */
#define STM_ID_29W320DB 0x22CB22CB /* M29W320DB ID (32 M, bottom boot sect) */
+#define STM_ID_29W324DT 0x225C225C /* M29W324DT ID (32 M, top boot sector) */
+#define STM_ID_29W324DB 0x225D225D /* M29W324DB ID (32 M, bottom boot sect) */
#define STM_ID_29W040B 0x00E300E3 /* M29W040B ID (4M = 512K x 8) */
#define INTEL_ID_28F016S 0x66a066a0 /* 28F016S[VS] ID (16M = 512k x 16) */
#define FLASH_STM800AB 0x0051 /* STM M29WF800AB ( 8M = 512K x 16 ) */
#define FLASH_STMW320DT 0x0052 /* STM M29W320DT (32 M, top boot sector) */
#define FLASH_STMW320DB 0x0053 /* STM M29W320DB (32 M, bottom boot sect)*/
+#define FLASH_STMW324DT 0x005C /* STM M29W320DT (32 M, top boot sector) */
+#define FLASH_STMW324DB 0x005D /* STM M29W320DB (32 M, bottom boot sect)*/
#define FLASH_STM320DB 0x00CB /* STM M29W320DB (4M = 64K x 64, bottom)*/
#define FLASH_STM800DT 0x00D7 /* STM M29W800DT (1M = 64K x 16, top) */
#define FLASH_STM800DB 0x005B /* STM M29W800DB (1M = 64K x 16, bottom)*/
#define PCI_DEVICE_ID_ITE_IT8172G_AUDIO 0x0801
#define PCI_DEVICE_ID_ITE_IT8181 0x8181
#define PCI_DEVICE_ID_ITE_8872 0x8872
+#define PCI_DEVICE_ID_ITE_8211 0x8211
+#define PCI_DEVICE_ID_ITE_8212 0x8212
#define PCI_DEVICE_ID_ITE_IT8330G_0 0xe886
#ifndef __VERSION_H__
#define __VERSION_H__
-#define U_BOOT_VERSION "U-Boot 1.1.4"
+#define U_BOOT_VERSION "U-Boot 1.1.4 LiSt 2.1.0"
#endif /* __VERSION_H__ */
*/
addr -= len;
addr &= ~(4096 - 1);
+#ifdef CONFIG_LINKSTATION
+ /* U-Boot code at 1 MB boundary to make it easier to debug */
+ addr &= ~(1048576 - 1);
+#endif
#ifdef CONFIG_E500
/* round down to next 64 kB limit so that IVPR stays aligned */
addr &= ~(65536 - 1);
/* Initialize the jump table for applications */
jumptable_init ();
+#if !defined(CONFIG_LINKSTATION)
/* Initialize the console (after the relocation and devices init) */
console_init_r ();
+#endif
#if defined(CONFIG_CCM) || \
defined(CONFIG_COGENT) || \
if ((s = getenv ("loadaddr")) != NULL) {
load_addr = simple_strtoul (s, NULL, 16);
}
+ debug("load_addr: %08lx\n", load_addr);
#if (CONFIG_COMMANDS & CFG_CMD_NET)
if ((s = getenv ("bootfile")) != NULL) {
copy_filename (BootFile, s, sizeof (BootFile));
reset_phy ();
#endif
+#if defined(CONFIG_LINKSTATION)
+ /* The LinkStation uses the net console by default */
+ console_init_r ();
+#endif
+
#ifdef CONFIG_POST
post_run (NULL, POST_RAM | post_bootmode_get(0));
#endif
#endif
extern int interrupt_init_cpu (unsigned *);
-extern void timer_interrupt_cpu (struct pt_regs *);
+extern void timer_interrupt_cpu (struct pt_regs *, ulong timestamp);
static unsigned decrementer_count; /* count value for 1e6/HZ microseconds */
void timer_interrupt (struct pt_regs *regs)
{
/* call cpu specific function from $(CPU)/interrupts.c */
- timer_interrupt_cpu (regs);
+ timer_interrupt_cpu (regs, timestamp);
/* Restore Decrementer Count */
set_dec (decrementer_count);
{
uchar *pkt;
+#ifdef ET_DEBUG
+ printf("%s dest: %08lx, dport: %d, sport: %d, len: %d\n",
+ __FUNCTION__, dest, dport, sport, len);
+#endif
+
/* convert to new style broadcast */
if (dest == 0)
dest = 0xFFFFFFFF;
IPaddr_t tmp;
volatile IP_t *ip = (volatile IP_t *)pkt;
+ if (!pkt && !dest && !src && !len) /* ARP packet */
+ return;
tmp = NetReadIP((void *)&ip->ip_src);
if (tmp != NetPingIP)
return;
ushort cti = 0, vlanid = VLAN_NONE, myvlanid, mynvlanid;
#ifdef ET_DEBUG
- printf("packet received\n");
+ printf("%s: packet received\n", __FUNCTION__);
#endif
NetRxPkt = inpkt;
x = ntohs(et->et_protlen);
-#ifdef ET_DEBUG
- printf("packet received\n");
-#endif
-
if (x < 1514) {
/*
* Got a 802 packet. Check the other protocol field.
/* matched waiting packet's address */
if (tmp == NetArpWaitReplyIP) {
#ifdef ET_DEBUG
- puts ("Got it\n");
+ puts ("ARP reply IP matches original pkt IP\n");
#endif
/* save address for later use */
memcpy(NetArpWaitPacketMAC, &arp->ar_data[0], 6);
#ifdef CONFIG_NETCONSOLE
- (*packetHandler)(0,0,0,0);
+ if (packetHandler)
+ (*packetHandler)(0,0,0,0);
+ else
+ printf("ARP: NULL packetHandler\n");
#endif
/* modify header, and transmit it */
memcpy(((Ethernet_t *)NetArpWaitTxPacket)->et_dest, NetArpWaitPacketMAC, 6);
NetCopyIP(&NetServerIP, &arp->ar_data[ 6]);
memcpy (NetServerEther, &arp->ar_data[ 0], 6);
- (*packetHandler)(0,0,0,0);
+ if (packetHandler)
+ (*packetHandler)(0,0,0,0);
+ else
+ printf("ARP: NULL packetHandler\n");
}
break;
#include "nfs.h"
#include "bootp.h"
-/*#define NFS_DEBUG*/
+#undef NFS_DEBUG
#if ((CONFIG_COMMANDS & CFG_CMD_NET) && (CONFIG_COMMANDS & CFG_CMD_NFS))
int sport;
id = ++rpc_id;
+#ifdef NFS_DEBUG
+ printf ("%s xid: %d, rpc_id: %d\n", __FUNCTION__, id, rpc_id);
+#endif
pkt.u.call.id = htonl(id);
pkt.u.call.type = htonl(MSG_CALL);
pkt.u.call.rpcvers = htonl(2); /* use RPC version 2 */
{
uint32_t data[16];
+#ifdef NFS_DEBUG
+ printf ("%s\n", __FUNCTION__);
+#endif
+
data[0] = 0; data[1] = 0; /* auth credential */
data[2] = 0; data[3] = 0; /* auth verifier */
data[4] = htonl(prog);
int len;
int pathlen;
+#ifdef NFS_DEBUG
+ printf ("%s\n", __FUNCTION__);
+#endif
+
pathlen = strlen (path);
p = &(data[0]);
uint32_t *p;
int len;
+#ifdef NFS_DEBUG
+ printf ("%s\n", __FUNCTION__);
+#endif
+
if ((NfsSrvMountPort == -1) || (!fs_mounted)) {
/* Nothing mounted, nothing to umount */
return;
uint32_t *p;
int len;
+#ifdef NFS_DEBUG
+ printf ("%s\n", __FUNCTION__);
+#endif
+
p = &(data[0]);
p = (uint32_t *)rpc_add_credentials ((long *)p);
int len;
int fnamelen;
+#ifdef NFS_DEBUG
+ printf ("%s\n", __FUNCTION__);
+#endif
+
fnamelen = strlen (fname);
p = &(data[0]);
uint32_t *p;
int len;
+#ifdef NFS_DEBUG
+ printf ("%s\n", __FUNCTION__);
+#endif
+
p = &(data[0]);
p = (uint32_t *)rpc_add_credentials ((long *)p);
if (rpc_pkt.u.reply.rstatus ||
rpc_pkt.u.reply.verifier ||
- rpc_pkt.u.reply.astatus ||
rpc_pkt.u.reply.astatus) {
+#ifdef NFS_DEBUG
+ printf ("rstatus: %d\n", rpc_pkt.u.reply.rstatus);
+ printf ("verifier: %08lx\n", rpc_pkt.u.reply.verifier);
+ printf ("v2: %08lx\n", rpc_pkt.u.reply.v2);
+ printf ("astatus: %d\n", rpc_pkt.u.reply.astatus);
+#endif
return -1;
}
memcpy ((unsigned char *)&rpc_pkt, pkt, len);
- if (ntohl(rpc_pkt.u.reply.id) != rpc_id)
+ if (ntohl(rpc_pkt.u.reply.id) != rpc_id) {
+#ifdef NFS_DEBUG
+ printf ("rpc_id error. expected: %d, got: %d\n", \
+ rpc_id, ntohl(rpc_pkt.u.reply.id));
+#endif
return -1;
+ }
if (rpc_pkt.u.reply.rstatus ||
rpc_pkt.u.reply.verifier ||
rpc_pkt.u.reply.astatus ||
rpc_pkt.u.reply.data[0]) {
+#ifdef NFS_DEBUG
+ printf ("rstatus: %d\n", rpc_pkt.u.reply.rstatus);
+ printf ("verifier: %08lx\n", rpc_pkt.u.reply.verifier);
+ printf ("astatus: %d\n", rpc_pkt.u.reply.astatus);
+ printf ("data[0]: %08lx\n", rpc_pkt.u.reply.data[0]);
+#endif
return -1;
}
struct rpc_t rpc_pkt;
int rlen;
-#ifdef NFS_DEBUG_nop
+#ifdef NFS_DEBUG
printf ("%s\n", __FUNCTION__);
#endif
printf ("%s\n", __FUNCTION__);
#endif
+ if (!pkt && !dest && !src && !len) /* ARP packet */
+ return;
if (dest != NfsOurPort) return;
switch (NfsState) {
# MA 02111-1307 USA
#
-BINS = img2srec$(SFX) mkimage$(SFX) envcrc$(SFX) gen_eth_addr$(SFX) bmp_logo$(SFX)
+BINS = img2srec$(SFX) mkimage$(SFX) envcrc$(SFX) gen_eth_addr$(SFX) bmp_logo$(SFX) ncb$(SFX)
-OBJS = environment.o img2srec.o mkimage.o crc32.o envcrc.o gen_eth_addr.o bmp_logo.o
+OBJS = environment.o img2srec.o mkimage.o crc32.o envcrc.o gen_eth_addr.o bmp_logo.o ncb.o
ifeq ($(ARCH),mips)
BINS += inca-swap-bytes$(SFX)