U-Boot
Threads by month
- ----- 2025 -----
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2000 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
August 2009
- 165 participants
- 500 discussions

25 Aug '09
Add a simple print for the Blackfin's Ethernet Rx function,
so we can debug incomming Ethernet functions easier.
Signed-off-by: Robin Getz <rgetz(a)blackfin.uclinux.org>
---
drivers/net/bfin_mac.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
index 12d98c2..ec45b63 100644
--- a/drivers/net/bfin_mac.c
+++ b/drivers/net/bfin_mac.c
@@ -186,6 +186,9 @@ static int bfin_EMAC_recv(struct eth_device *dev)
printf("Ethernet: bad frame\n");
break;
}
+
+ debug("%s: len = %d\n", __func__, length - 4);
+
NetRxPackets[rxIdx] =
(volatile uchar *)(rxbuf[rxIdx]->FrmData->Dest);
NetReceive(NetRxPackets[rxIdx], length - 4);
--
1.6.0.2
2
1
Optionally add RFC 2349 "Transfer Size Option", so we can minimize the
time spent sending data over the UART (now print a single line during a
tftp transfer).
- If turned on (CONFIG_TFTP_TSIZE), U-Boot asks for the size of the file.
- if receives the file size, a single line (50 chars) are printed.
one hash mark == 2% of the file downloaded.
- if it doesn't receive the file size (the server doesn't support RFC
2349, prints standard hash marks (one mark for each UDP frame).
Signed-off-by: Robin Getz <rgetz(a)blackfin.uclinux.org>
---
net/tftp.c | 42 ++++++++++++++++++++++++++++++++++++++++--
1 files changed, 40 insertions(+), 2 deletions(-)
diff --git a/net/tftp.c b/net/tftp.c
index 0fa7033..865f41a 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -56,6 +56,10 @@ static ulong TftpLastBlock; /* last packet sequence number received */
static ulong TftpBlockWrap; /* count of sequence number wraparounds */
static ulong TftpBlockWrapOffset; /* memory offset due to wrapping */
static int TftpState;
+#ifdef CONFIG_TFTP_TSIZE
+static int TftpTsize; /* The file size reported by the server */
+static short TftpNumchars; /* The number of hashes we printed */
+#endif
#define STATE_RRQ 1
#define STATE_DATA 2
@@ -202,6 +206,10 @@ TftpSend (void)
sprintf((char *)pkt, "%lu", TIMEOUT / 1000);
debug("send option \"timeout %s\"\n", (char *)pkt);
pkt += strlen((char *)pkt) + 1;
+#ifdef CONFIG_TFTP_TSIZE
+ memcpy((char *)pkt, "tsize\0000\0", 8);
+ pkt += 8;
+#endif
/* try for more effic. blk size */
pkt += sprintf((char *)pkt,"blksize%c%d%c",
0,TftpBlkSizeOption,0);
@@ -311,8 +319,14 @@ TftpHandler (uchar * pkt, unsigned dest, unsigned src, unsigned len)
simple_strtoul((char*)pkt+i+8,NULL,10);
debug("Blocksize ack: %s, %d\n",
(char*)pkt+i+8,TftpBlkSize);
- break;
}
+#ifdef CONFIG_TFTP_TSIZE
+ if (strcmp ((char*)pkt+i,"tsize") == 0) {
+ TftpTsize = simple_strtoul((char*)pkt+i+6,NULL,10);
+ debug("size = %s, %d\n",
+ (char*)pkt+i+6, TftpTsize);
+ }
+#endif
}
#ifdef CONFIG_MCAST_TFTP
parse_multicast_oack((char *)pkt,len-1);
@@ -338,7 +352,16 @@ TftpHandler (uchar * pkt, unsigned dest, unsigned src, unsigned len)
TftpBlockWrap++;
TftpBlockWrapOffset += TftpBlkSize * TFTP_SEQUENCE_SIZE;
printf ("\n\t %lu MB received\n\t ", TftpBlockWrapOffset>>20);
- } else {
+ }
+#ifdef CONFIG_TFTP_TSIZE
+ else if (TftpTsize) {
+ while (TftpNumchars < NetBootFileXferSize * 50 / TftpTsize) {
+ putc('#');
+ TftpNumchars++;
+ }
+ }
+#endif
+ else {
if (((TftpBlock - 1) % 10) == 0) {
putc ('#');
} else if ((TftpBlock % (10 * HASHES_PER_LINE)) == 0) {
@@ -432,6 +455,13 @@ TftpHandler (uchar * pkt, unsigned dest, unsigned src, unsigned len)
* We received the whole thing. Try to
* run it.
*/
+#ifdef CONFIG_TFTP_TSIZE
+ /* Print out the hash marks for the last packet received */
+ while (TftpTsize && TftpNumchars < 49) {
+ putc('#');
+ TftpNumchars++;
+ }
+#endif
puts ("\ndone\n");
NetState = NETLOOP_SUCCESS;
}
@@ -561,6 +595,10 @@ TftpStart (void)
#ifdef CONFIG_MCAST_TFTP
mcast_cleanup();
#endif
+#ifdef CONFIG_TFTP_TSIZE
+ TftpTsize = 0;
+ TftpNumchars = 0;
+#endif
TftpSend ();
}
--
1.6.0.2
2
1

[U-Boot] [PATCH v4][Net] Convert CS8900 Ethernet driver to CONFIG_NET_MULTI API
by Ben Warren 25 Aug '09
by Ben Warren 25 Aug '09
25 Aug '09
All in-tree boards that use this controller have CONFIG_NET_MULTI added
Also:
- changed CONFIG_DRIVER_CS8900 to CONFIG_CS8900
- changed CS8900_BASE to CONFIG_CS8900_BASE
- changed CS8900_BUS?? to CONFIG_CS8900_BUS??
- cleaned up line lengths
- modified VCMA9 command function that accesses the device
- removed MAC address initialization from lib_arm/board.c
Signed-off-by: Ben Warren <biggerbadderben(a)gmail.com>
Tested-by: Wolfgang Denk <wd(a)denx.de>
Acked-by: Wolfgang Denk <wd(a)denx.de>
---
v4: Changed 8-bit accesses to use volatile keyword (change made by wd(a)denx.de)
v3: Added accessor macros to ensure proper bus access
v2: Fixed typo: CS8900_BUS32 -> CONFIG_CS8900_BUS32
Added more descriptive printf in cs8900_init as suggested by Wolfgang
Initialize 'priv' data structure in cs8900_initialize()
board/altera/dk1c20/dk1c20.c | 12 ++
board/altera/dk1s10/dk1s10.c | 12 ++
board/armadillo/armadillo.c | 12 ++
board/csb226/csb226.c | 12 ++
board/ep7312/ep7312.c | 12 ++
board/freescale/mx31ads/mx31ads.c | 12 ++
board/impa7/impa7.c | 12 ++
board/lart/lart.c | 12 ++
board/mpl/vcma9/cmd_vcma9.c | 28 +++--
board/mpl/vcma9/vcma9.c | 12 ++
board/mx1ads/mx1ads.c | 12 ++
board/samsung/smdk2400/smdk2400.c | 12 ++
board/samsung/smdk2410/smdk2410.c | 12 ++
board/samsung/smdk6400/smdk6400.c | 12 ++
board/sbc2410x/sbc2410x.c | 12 ++
board/ssv/adnpesc1/adnpesc1.c | 12 ++
board/trab/trab.c | 12 ++
drivers/net/Makefile | 2 +-
drivers/net/cs8900.c | 276 ++++++++++++++++++++++---------------
drivers/net/cs8900.h | 41 ++++---
include/configs/ADNPESC1.h | 14 +-
include/configs/DK1C20.h | 14 +-
include/configs/DK1S10.h | 14 +-
include/configs/VCMA9.h | 7 +-
include/configs/armadillo.h | 9 +-
include/configs/csb226.h | 7 +-
include/configs/ep7312.h | 9 +-
include/configs/impa7.h | 7 +-
include/configs/lart.h | 7 +-
include/configs/mx1ads.h | 7 +-
include/configs/mx31ads.h | 7 +-
include/configs/sbc2410x.h | 7 +-
include/configs/smdk2400.h | 7 +-
include/configs/smdk2410.h | 7 +-
include/configs/smdk6400.h | 7 +-
include/configs/trab.h | 7 +-
include/netdev.h | 1 +
lib_arm/board.c | 9 --
38 files changed, 476 insertions(+), 210 deletions(-)
diff --git a/board/altera/dk1c20/dk1c20.c b/board/altera/dk1c20/dk1c20.c
index 11c19b7..0bcaa4f 100644
--- a/board/altera/dk1c20/dk1c20.c
+++ b/board/altera/dk1c20/dk1c20.c
@@ -25,6 +25,7 @@
*/
#include <common.h>
+#include <netdev.h>
#include <nios-io.h>
#if defined(CONFIG_SEVENSEG)
#include "../common/sevenseg.h"
@@ -79,3 +80,14 @@ int ide_preinit (void)
return 0;
}
#endif
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+#ifdef CONFIG_CS8900
+ rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+ return rc;
+}
+#endif
diff --git a/board/altera/dk1s10/dk1s10.c b/board/altera/dk1s10/dk1s10.c
index 64d591e..fb96501 100644
--- a/board/altera/dk1s10/dk1s10.c
+++ b/board/altera/dk1s10/dk1s10.c
@@ -22,6 +22,7 @@
*/
#include <common.h>
+#include <netdev.h>
#if defined(CONFIG_SEVENSEG)
#include "../common/sevenseg.h"
#endif
@@ -58,3 +59,14 @@ phys_size_t initdram (int board_type)
{
return (0);
}
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+#ifdef CONFIG_CS8900
+ rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+ return rc;
+}
+#endif
diff --git a/board/armadillo/armadillo.c b/board/armadillo/armadillo.c
index ca5bd1d..a825144 100644
--- a/board/armadillo/armadillo.c
+++ b/board/armadillo/armadillo.c
@@ -26,6 +26,7 @@
*/
#include <common.h>
+#include <netdev.h>
#include <clps7111.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -58,3 +59,14 @@ int dram_init (void)
return (0);
}
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+#ifdef CONFIG_CS8900
+ rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+ return rc;
+}
+#endif
diff --git a/board/csb226/csb226.c b/board/csb226/csb226.c
index 80caf8b..0a6c13d 100644
--- a/board/csb226/csb226.c
+++ b/board/csb226/csb226.c
@@ -24,6 +24,7 @@
*/
#include <common.h>
+#include <netdev.h>
#include <asm/arch/pxa-regs.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -151,3 +152,14 @@ void show_boot_progress (int status)
return;
}
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+#ifdef CONFIG_CS8900
+ rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+ return rc;
+}
+#endif
diff --git a/board/ep7312/ep7312.c b/board/ep7312/ep7312.c
index 6968a5d..8ed14ad 100644
--- a/board/ep7312/ep7312.c
+++ b/board/ep7312/ep7312.c
@@ -23,6 +23,7 @@
*/
#include <common.h>
+#include <netdev.h>
#include <clps7111.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -52,3 +53,14 @@ int dram_init (void)
return (0);
}
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+#ifdef CONFIG_CS8900
+ rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+ return rc;
+}
+#endif
diff --git a/board/freescale/mx31ads/mx31ads.c b/board/freescale/mx31ads/mx31ads.c
index c24c47c..bc25c6d 100644
--- a/board/freescale/mx31ads/mx31ads.c
+++ b/board/freescale/mx31ads/mx31ads.c
@@ -21,6 +21,7 @@
*/
#include <common.h>
+#include <netdev.h>
#include <asm/io.h>
#include <asm/arch/mx31.h>
#include <asm/arch/mx31-regs.h>
@@ -104,3 +105,14 @@ int checkboard (void)
printf("Board: MX31ADS\n");
return 0;
}
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+#ifdef CONFIG_CS8900
+ rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+ return rc;
+}
+#endif
diff --git a/board/impa7/impa7.c b/board/impa7/impa7.c
index 3230dd4..205b1b3 100644
--- a/board/impa7/impa7.c
+++ b/board/impa7/impa7.c
@@ -23,6 +23,7 @@
*/
#include <common.h>
+#include <netdev.h>
#include <clps7111.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -57,3 +58,14 @@ int dram_init (void)
return (0);
}
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+#ifdef CONFIG_CS8900
+ rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+ return rc;
+}
+#endif
diff --git a/board/lart/lart.c b/board/lart/lart.c
index 8d534c8..a0b459f 100644
--- a/board/lart/lart.c
+++ b/board/lart/lart.c
@@ -23,6 +23,7 @@
*/
#include <common.h>
+#include <netdev.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -62,3 +63,14 @@ int dram_init (void)
return (0);
}
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+#ifdef CONFIG_CS8900
+ rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+ return rc;
+}
+#endif
diff --git a/board/mpl/vcma9/cmd_vcma9.c b/board/mpl/vcma9/cmd_vcma9.c
index 0160774..0ee9595 100644
--- a/board/mpl/vcma9/cmd_vcma9.c
+++ b/board/mpl/vcma9/cmd_vcma9.c
@@ -31,7 +31,7 @@
#include "vcma9.h"
#include "../common/common_util.h"
-#if defined(CONFIG_DRIVER_CS8900)
+#if defined(CONFIG_CS8900)
#include <../drivers/net/cs8900.h>
static uchar cs8900_chksum(ushort data)
@@ -56,25 +56,33 @@ extern int do_mplcommon(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
int do_vcma9(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
+ struct eth_device *dev;
+ char cs8900_name[10];
if (strcmp(argv[1], "info") == 0)
{
print_vcma9_info();
return 0;
}
-#if defined(CONFIG_DRIVER_CS8900)
+#if defined(CONFIG_CS8900)
if (strcmp(argv[1], "cs8900") == 0) {
+ sprintf(cs8900_name, "%s-0", CS8900_DRIVERNAME);
+ dev = eth_get_dev_by_name(cs8900_name);
+ if (!dev) {
+ printf("Couldn't find CS8900 driver");
+ return 0;
+ }
if (strcmp(argv[2], "read") == 0) {
uchar addr; ushort data;
addr = simple_strtoul(argv[3], NULL, 16);
- cs8900_e2prom_read(addr, &data);
+ cs8900_e2prom_read(dev, addr, &data);
printf("0x%2.2X: 0x%4.4X\n", addr, data);
} else if (strcmp(argv[2], "write") == 0) {
uchar addr; ushort data;
addr = simple_strtoul(argv[3], NULL, 16);
data = simple_strtoul(argv[4], NULL, 16);
- cs8900_e2prom_write(addr, data);
+ cs8900_e2prom_write(dev, addr, data);
} else if (strcmp(argv[2], "setaddr") == 0) {
uchar addr, i, csum; ushort data;
uchar ethaddr[6];
@@ -83,22 +91,22 @@ int do_vcma9(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
if (eth_getenv_enetaddr("ethaddr", ethaddr)) {
addr = 1;
data = 0x2158;
- cs8900_e2prom_write(addr, data);
+ cs8900_e2prom_write(dev, addr, data);
csum = cs8900_chksum(data);
addr++;
for (i = 0; i < 6; i+=2) {
data = ethaddr[i+1] << 8 |
ethaddr[i];
- cs8900_e2prom_write(addr, data);
+ cs8900_e2prom_write(dev, addr, data);
csum += cs8900_chksum(data);
addr++;
}
/* calculate header link byte */
data = 0xA100 | (addr * 2);
- cs8900_e2prom_write(0, data);
+ cs8900_e2prom_write(dev, 0, data);
csum += cs8900_chksum(data);
/* write checksum word */
- cs8900_e2prom_write(addr, (0 - csum) << 8);
+ cs8900_e2prom_write(dev, addr, (0 - csum) << 8);
} else {
puts("\nplease defined 'ethaddr'\n");
}
@@ -106,12 +114,12 @@ int do_vcma9(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
uchar addr = 0, endaddr, csum; ushort data;
puts("Dump of CS8900 config device: ");
- cs8900_e2prom_read(addr, &data);
+ cs8900_e2prom_read(dev, addr, &data);
if ((data & 0xE000) == 0xA000) {
endaddr = (data & 0x00FF) / 2;
csum = cs8900_chksum(data);
for (addr = 1; addr <= endaddr; addr++) {
- cs8900_e2prom_read(addr, &data);
+ cs8900_e2prom_read(dev, addr, &data);
printf("\n0x%2.2X: 0x%4.4X", addr, data);
csum += cs8900_chksum(data);
}
diff --git a/board/mpl/vcma9/vcma9.c b/board/mpl/vcma9/vcma9.c
index 2b3fad2..3216d63 100644
--- a/board/mpl/vcma9/vcma9.c
+++ b/board/mpl/vcma9/vcma9.c
@@ -26,6 +26,7 @@
*/
#include <common.h>
+#include <netdev.h>
#include <s3c2410.h>
#include <stdio_dev.h>
#include <i2c.h>
@@ -349,3 +350,14 @@ void print_vcma9_info(void)
Show_VCMA9_Info(s, &s[6]);
}
}
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+#ifdef CONFIG_CS8900
+ rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+ return rc;
+}
+#endif
diff --git a/board/mx1ads/mx1ads.c b/board/mx1ads/mx1ads.c
index ba152e2..f8ce210 100644
--- a/board/mx1ads/mx1ads.c
+++ b/board/mx1ads/mx1ads.c
@@ -24,6 +24,7 @@
*/
#include <common.h>
+#include <netdev.h>
/*#include <mc9328.h>*/
#include <asm/arch/imx-regs.h>
@@ -167,3 +168,14 @@ int dram_init (void)
return 0;
}
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+#ifdef CONFIG_CS8900
+ rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+ return rc;
+}
+#endif
diff --git a/board/samsung/smdk2400/smdk2400.c b/board/samsung/smdk2400/smdk2400.c
index 0b82070..2c47063 100644
--- a/board/samsung/smdk2400/smdk2400.c
+++ b/board/samsung/smdk2400/smdk2400.c
@@ -26,6 +26,7 @@
*/
#include <common.h>
+#include <netdev.h>
#include <s3c2400.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -110,3 +111,14 @@ static int key_pressed(void)
return rc;
}
#endif /* CONFIG_MODEM_SUPPORT */
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+#ifdef CONFIG_CS8900
+ rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+ return rc;
+}
+#endif
diff --git a/board/samsung/smdk2410/smdk2410.c b/board/samsung/smdk2410/smdk2410.c
index 802348d..25c38e6 100644
--- a/board/samsung/smdk2410/smdk2410.c
+++ b/board/samsung/smdk2410/smdk2410.c
@@ -26,6 +26,7 @@
*/
#include <common.h>
+#include <netdev.h>
#include <s3c2410.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -121,3 +122,14 @@ int dram_init (void)
return 0;
}
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+#ifdef CONFIG_CS8900
+ rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+ return rc;
+}
+#endif
diff --git a/board/samsung/smdk6400/smdk6400.c b/board/samsung/smdk6400/smdk6400.c
index 52cd174..561c0c8 100644
--- a/board/samsung/smdk6400/smdk6400.c
+++ b/board/samsung/smdk6400/smdk6400.c
@@ -29,6 +29,7 @@
*/
#include <common.h>
+#include <netdev.h>
#include <s3c6400.h>
/* ------------------------------------------------------------------------- */
@@ -117,3 +118,14 @@ ulong board_flash_get_legacy (ulong base, int banknum, flash_info_t *info)
} else
return 0;
}
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+#ifdef CONFIG_CS8900
+ rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+ return rc;
+}
+#endif
diff --git a/board/sbc2410x/sbc2410x.c b/board/sbc2410x/sbc2410x.c
index 6c894a3..6276850 100644
--- a/board/sbc2410x/sbc2410x.c
+++ b/board/sbc2410x/sbc2410x.c
@@ -29,6 +29,7 @@
*/
#include <common.h>
+#include <netdev.h>
#include <s3c2410.h>
#if defined(CONFIG_CMD_NAND)
@@ -178,3 +179,14 @@ void nand_init(void)
printf ("%4lu MB\n", nand_probe((ulong)nand) >> 20);
}
#endif
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+#ifdef CONFIG_CS8900
+ rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+ return rc;
+}
+#endif
diff --git a/board/ssv/adnpesc1/adnpesc1.c b/board/ssv/adnpesc1/adnpesc1.c
index 9d32741..72810d0 100644
--- a/board/ssv/adnpesc1/adnpesc1.c
+++ b/board/ssv/adnpesc1/adnpesc1.c
@@ -22,6 +22,7 @@
*/
#include <common.h>
+#include <netdev.h>
#include <nios-io.h>
#include <spi.h>
@@ -100,3 +101,14 @@ int post_hotkeys_pressed(void)
return 0; /* No hotkeys supported */
}
#endif /* CONFIG_POST */
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+#ifdef CONFIG_CS8900
+ rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+ return rc;
+}
+#endif
diff --git a/board/trab/trab.c b/board/trab/trab.c
index ddf6abf..2dccd87 100644
--- a/board/trab/trab.c
+++ b/board/trab/trab.c
@@ -24,6 +24,7 @@
/* #define DEBUG */
#include <common.h>
+#include <netdev.h>
#include <malloc.h>
#include <s3c2400.h>
#include <command.h>
@@ -420,3 +421,14 @@ static void tsc2000_set_brightness(void)
tsc2000_write(0, 0xb, br & 0xff);
}
#endif
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+#ifdef CONFIG_CS8900
+ rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+ return rc;
+}
+#endif
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 34b56d8..6758557 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -30,7 +30,7 @@ COBJS-$(CONFIG_PPC4xx_EMAC) += 4xx_enet.o
COBJS-$(CONFIG_DRIVER_AX88180) += ax88180.o
COBJS-$(CONFIG_BCM570x) += bcm570x.o bcm570x_autoneg.o 5701rls.o
COBJS-$(CONFIG_BFIN_MAC) += bfin_mac.o
-COBJS-$(CONFIG_DRIVER_CS8900) += cs8900.o
+COBJS-$(CONFIG_CS8900) += cs8900.o
COBJS-$(CONFIG_TULIP) += dc2114x.o
COBJS-$(CONFIG_DRIVER_DM9000) += dm9000x.o
COBJS-$(CONFIG_DNET) += dnet.o
diff --git a/drivers/net/cs8900.c b/drivers/net/cs8900.c
index 5e2b3b0..587f7f6 100644
--- a/drivers/net/cs8900.c
+++ b/drivers/net/cs8900.c
@@ -1,6 +1,9 @@
/*
* Cirrus Logic CS8900A Ethernet
*
+ * (C) 2009 Ben Warren , biggerbadderben(a)gmail.com
+ * Converted to use CONFIG_NET_MULTI API
+ *
* (C) 2003 Wolfgang Denk, wd(a)denx.de
* Extension to synchronize ethaddr environment variable
* against value in EEPROM
@@ -38,220 +41,229 @@
#include <common.h>
#include <command.h>
-#include "cs8900.h"
+#include <asm/io.h>
#include <net.h>
+#include <malloc.h>
+#include "cs8900.h"
#undef DEBUG
/* packet page register access functions */
-#ifdef CS8900_BUS32
+#ifdef CONFIG_CS8900_BUS32
+
+#define REG_WRITE(v, a) writel((v),(a))
+#define REG_READ(a) readl((a))
+
/* we don't need 16 bit initialisation on 32 bit bus */
#define get_reg_init_bus(x) get_reg((x))
+
#else
-static unsigned short get_reg_init_bus (int regno)
-{
- /* force 16 bit busmode */
- volatile unsigned char c;
- c = CS8900_BUS16_0;
- c = CS8900_BUS16_1;
- c = CS8900_BUS16_0;
- c = CS8900_BUS16_1;
- c = CS8900_BUS16_0;
+#define REG_WRITE(v, a) writew((v),(a))
+#define REG_READ(a) readw((a))
- CS8900_PPTR = regno;
- return CS8900_PDATA;
+static u16 get_reg_init_bus(struct eth_device *dev, int regno)
+{
+ /* force 16 bit busmode */
+ volatile u8 c;
+ struct cs8900_priv *priv = (struct cs8900_priv *)(dev->priv);
+ uint8_t volatile * const iob = (uint8_t volatile * const)dev->iobase;
+
+ c = readb(iob);
+ c = readb(iob + 1);
+ c = readb(iob);
+ c = readb(iob + 1);
+ c = readb(iob);
+
+ REG_WRITE(regno, &priv->regs->pptr);
+ return REG_READ(&priv->regs->pdata);
}
#endif
-static unsigned short get_reg (int regno)
+static u16 get_reg(struct eth_device *dev, int regno)
{
- CS8900_PPTR = regno;
- return CS8900_PDATA;
+ struct cs8900_priv *priv = (struct cs8900_priv *)(dev->priv);
+ REG_WRITE(regno, &priv->regs->pptr);
+ return REG_READ(&priv->regs->pdata);
}
-static void put_reg (int regno, unsigned short val)
+static void put_reg(struct eth_device *dev, int regno, u16 val)
{
- CS8900_PPTR = regno;
- CS8900_PDATA = val;
+ struct cs8900_priv *priv = (struct cs8900_priv *)(dev->priv);
+ REG_WRITE(regno, &priv->regs->pptr);
+ REG_WRITE(val, &priv->regs->pdata);
}
-static void eth_reset (void)
+static void cs8900_reset(struct eth_device *dev)
{
int tmo;
- unsigned short us;
+ u16 us;
/* reset NIC */
- put_reg (PP_SelfCTL, get_reg (PP_SelfCTL) | PP_SelfCTL_Reset);
+ put_reg(dev, PP_SelfCTL, get_reg(dev, PP_SelfCTL) | PP_SelfCTL_Reset);
/* wait for 200ms */
- udelay (200000);
+ udelay(200000);
/* Wait until the chip is reset */
- tmo = get_timer (0) + 1 * CONFIG_SYS_HZ;
- while ((((us = get_reg_init_bus (PP_SelfSTAT)) & PP_SelfSTAT_InitD) == 0)
- && tmo < get_timer (0))
+ tmo = get_timer(0) + 1 * CONFIG_SYS_HZ;
+ while ((((us = get_reg_init_bus(dev, PP_SelfSTAT)) &
+ PP_SelfSTAT_InitD) == 0) && tmo < get_timer(0))
/*NOP*/;
}
-static void eth_reginit (void)
+static void cs8900_reginit(struct eth_device *dev)
{
/* receive only error free packets addressed to this card */
- put_reg (PP_RxCTL, PP_RxCTL_IA | PP_RxCTL_Broadcast | PP_RxCTL_RxOK);
+ put_reg(dev, PP_RxCTL,
+ PP_RxCTL_IA | PP_RxCTL_Broadcast | PP_RxCTL_RxOK);
/* do not generate any interrupts on receive operations */
- put_reg (PP_RxCFG, 0);
+ put_reg(dev, PP_RxCFG, 0);
/* do not generate any interrupts on transmit operations */
- put_reg (PP_TxCFG, 0);
+ put_reg(dev, PP_TxCFG, 0);
/* do not generate any interrupts on buffer operations */
- put_reg (PP_BufCFG, 0);
+ put_reg(dev, PP_BufCFG, 0);
/* enable transmitter/receiver mode */
- put_reg (PP_LineCTL, PP_LineCTL_Rx | PP_LineCTL_Tx);
+ put_reg(dev, PP_LineCTL, PP_LineCTL_Rx | PP_LineCTL_Tx);
}
-void cs8900_get_enetaddr (void)
+void cs8900_get_enetaddr(struct eth_device *dev)
{
int i;
- uchar enetaddr[6];
-
- /* if the env is setup, then bail */
- if (eth_getenv_enetaddr("ethaddr", enetaddr))
- return;
/* verify chip id */
- if (get_reg_init_bus (PP_ChipID) != 0x630e)
+ if (get_reg_init_bus(dev, PP_ChipID) != 0x630e)
return;
- eth_reset ();
- if ((get_reg (PP_SelfSTAT) & (PP_SelfSTAT_EEPROM | PP_SelfSTAT_EEPROM_OK)) ==
- (PP_SelfSTAT_EEPROM | PP_SelfSTAT_EEPROM_OK)) {
+ cs8900_reset(dev);
+ if ((get_reg(dev, PP_SelfSTAT) &
+ (PP_SelfSTAT_EEPROM | PP_SelfSTAT_EEPROM_OK)) ==
+ (PP_SelfSTAT_EEPROM | PP_SelfSTAT_EEPROM_OK)) {
/* Load the MAC from EEPROM */
- for (i = 0; i < 6 / 2; i++) {
- unsigned int Addr;
+ for (i = 0; i < 3; i++) {
+ u32 Addr;
- Addr = get_reg (PP_IA + i * 2);
- enetaddr[i * 2] = Addr & 0xFF;
- enetaddr[i * 2 + 1] = Addr >> 8;
+ Addr = get_reg(dev, PP_IA + i * 2);
+ dev->enetaddr[i * 2] = Addr & 0xFF;
+ dev->enetaddr[i * 2 + 1] = Addr >> 8;
}
-
- eth_setenv_enetaddr("ethaddr", enetaddr);
- debug("### Set environment from HW MAC addr = \"%pM\"\n", enetaddr);
}
}
-void eth_halt (void)
+void cs8900_halt(struct eth_device *dev)
{
/* disable transmitter/receiver mode */
- put_reg (PP_LineCTL, 0);
+ put_reg(dev, PP_LineCTL, 0);
/* "shutdown" to show ChipID or kernel wouldn't find he cs8900 ... */
- get_reg_init_bus (PP_ChipID);
+ get_reg_init_bus(dev, PP_ChipID);
}
-int eth_init (bd_t * bd)
+static int cs8900_init(struct eth_device *dev, bd_t * bd)
{
- uchar enetaddr[6];
+ uchar *enetaddr = dev->enetaddr;
+ u16 id;
/* verify chip id */
- if (get_reg_init_bus (PP_ChipID) != 0x630e) {
- printf ("CS8900 Ethernet chip not found?!\n");
- return 0;
+ id = get_reg_init_bus(dev, PP_ChipID);
+ if (id != 0x630e) {
+ printf ("CS8900 Ethernet chip not found: "
+ "ID=0x%04x instead 0x%04x\n", id, 0x630e);
+ return 1;
}
- eth_reset ();
+ cs8900_reset (dev);
/* set the ethernet address */
- eth_getenv_enetaddr("ethaddr", enetaddr);
- put_reg (PP_IA + 0, enetaddr[0] | (enetaddr[1] << 8));
- put_reg (PP_IA + 2, enetaddr[2] | (enetaddr[3] << 8));
- put_reg (PP_IA + 4, enetaddr[4] | (enetaddr[5] << 8));
+ put_reg(dev, PP_IA + 0, enetaddr[0] | (enetaddr[1] << 8));
+ put_reg(dev, PP_IA + 2, enetaddr[2] | (enetaddr[3] << 8));
+ put_reg(dev, PP_IA + 4, enetaddr[4] | (enetaddr[5] << 8));
- eth_reginit ();
+ cs8900_reginit(dev);
return 0;
}
/* Get a data block via Ethernet */
-int eth_rx (void)
+static int cs8900_recv(struct eth_device *dev)
{
int i;
- unsigned short rxlen;
- unsigned short *addr;
- unsigned short status;
+ u16 rxlen;
+ u16 *addr;
+ u16 status;
- status = get_reg (PP_RER);
+ struct cs8900_priv *priv = (struct cs8900_priv *)(dev->priv);
+
+ status = get_reg(dev, PP_RER);
if ((status & PP_RER_RxOK) == 0)
return 0;
- status = CS8900_RTDATA; /* stat */
- rxlen = CS8900_RTDATA; /* len */
+ status = REG_READ(&priv->regs->rtdata);
+ rxlen = REG_READ(&priv->regs->rtdata);
-#ifdef DEBUG
if (rxlen > PKTSIZE_ALIGN + PKTALIGN)
- printf ("packet too big!\n");
-#endif
- for (addr = (unsigned short *) NetRxPackets[0], i = rxlen >> 1; i > 0;
+ debug("packet too big!\n");
+ for (addr = (u16 *) NetRxPackets[0], i = rxlen >> 1; i > 0;
i--)
- *addr++ = CS8900_RTDATA;
+ *addr++ = REG_READ(&priv->regs->rtdata);
if (rxlen & 1)
- *addr++ = CS8900_RTDATA;
+ *addr++ = REG_READ(&priv->regs->rtdata);
/* Pass the packet up to the protocol layers. */
NetReceive (NetRxPackets[0], rxlen);
-
return rxlen;
}
/* Send a data block via Ethernet. */
-int eth_send (volatile void *packet, int length)
+static int cs8900_send(struct eth_device *dev,
+ volatile void *packet, int length)
{
- volatile unsigned short *addr;
+ volatile u16 *addr;
int tmo;
- unsigned short s;
+ u16 s;
+ struct cs8900_priv *priv = (struct cs8900_priv *)(dev->priv);
retry:
/* initiate a transmit sequence */
- CS8900_TxCMD = PP_TxCmd_TxStart_Full;
- CS8900_TxLEN = length;
+ REG_WRITE(PP_TxCmd_TxStart_Full, &priv->regs->txcmd);
+ REG_WRITE(length, &priv->regs->txlen);
/* Test to see if the chip has allocated memory for the packet */
- if ((get_reg (PP_BusSTAT) & PP_BusSTAT_TxRDY) == 0) {
+ if ((get_reg(dev, PP_BusSTAT) & PP_BusSTAT_TxRDY) == 0) {
/* Oops... this should not happen! */
-#ifdef DEBUG
- printf ("cs: unable to send packet; retrying...\n");
-#endif
- for (tmo = get_timer (0) + 5 * CONFIG_SYS_HZ; get_timer (0) < tmo;)
+ debug("cs: unable to send packet; retrying...\n");
+ for (tmo = get_timer(0) + 5 * CONFIG_SYS_HZ;
+ get_timer(0) < tmo;)
/*NOP*/;
- eth_reset ();
- eth_reginit ();
+ cs8900_reset(dev);
+ cs8900_reginit(dev);
goto retry;
}
/* Write the contents of the packet */
/* assume even number of bytes */
for (addr = packet; length > 0; length -= 2)
- CS8900_RTDATA = *addr++;
+ REG_WRITE(*addr++, &priv->regs->rtdata);
/* wait for transfer to succeed */
- tmo = get_timer (0) + 5 * CONFIG_SYS_HZ;
- while ((s = get_reg (PP_TER) & ~0x1F) == 0) {
- if (get_timer (0) >= tmo)
+ tmo = get_timer(0) + 5 * CONFIG_SYS_HZ;
+ while ((s = get_reg(dev, PP_TER) & ~0x1F) == 0) {
+ if (get_timer(0) >= tmo)
break;
}
/* nothing */ ;
- if ((s & (PP_TER_CRS | PP_TER_TxOK)) != PP_TER_TxOK) {
-#ifdef DEBUG
- printf ("\ntransmission error %#x\n", s);
-#endif
+ if((s & (PP_TER_CRS | PP_TER_TxOK)) != PP_TER_TxOK) {
+ debug("\ntransmission error %#x\n", s);
}
return 0;
}
-static void cs8900_e2prom_ready(void)
+static void cs8900_e2prom_ready(struct eth_device *dev)
{
- while (get_reg(PP_SelfSTAT) & SI_BUSY)
+ while (get_reg(dev, PP_SelfSTAT) & SI_BUSY)
;
}
@@ -259,12 +271,13 @@ static void cs8900_e2prom_ready(void)
/* read a 16-bit word out of the EEPROM */
/***********************************************************/
-int cs8900_e2prom_read(unsigned char addr, unsigned short *value)
+int cs8900_e2prom_read(struct eth_device *dev,
+ u8 addr, u16 *value)
{
- cs8900_e2prom_ready();
- put_reg(PP_EECMD, EEPROM_READ_CMD | addr);
- cs8900_e2prom_ready();
- *value = get_reg(PP_EEData);
+ cs8900_e2prom_ready(dev);
+ put_reg(dev, PP_EECMD, EEPROM_READ_CMD | addr);
+ cs8900_e2prom_ready(dev);
+ *value = get_reg(dev, PP_EEData);
return 0;
}
@@ -274,16 +287,51 @@ int cs8900_e2prom_read(unsigned char addr, unsigned short *value)
/* write a 16-bit word into the EEPROM */
/***********************************************************/
-int cs8900_e2prom_write(unsigned char addr, unsigned short value)
+int cs8900_e2prom_write(struct eth_device *dev, u8 addr, u16 value)
+{
+ cs8900_e2prom_ready(dev);
+ put_reg(dev, PP_EECMD, EEPROM_WRITE_EN);
+ cs8900_e2prom_ready(dev);
+ put_reg(dev, PP_EEData, value);
+ put_reg(dev, PP_EECMD, EEPROM_WRITE_CMD | addr);
+ cs8900_e2prom_ready(dev);
+ put_reg(dev, PP_EECMD, EEPROM_WRITE_DIS);
+ cs8900_e2prom_ready(dev);
+
+ return 0;
+}
+
+int cs8900_initialize(u8 dev_num, int base_addr)
{
- cs8900_e2prom_ready();
- put_reg(PP_EECMD, EEPROM_WRITE_EN);
- cs8900_e2prom_ready();
- put_reg(PP_EEData, value);
- put_reg(PP_EECMD, EEPROM_WRITE_CMD | addr);
- cs8900_e2prom_ready();
- put_reg(PP_EECMD, EEPROM_WRITE_DIS);
- cs8900_e2prom_ready();
+ struct eth_device *dev;
+ struct cs8900_priv *priv;
+
+ dev = malloc(sizeof(*dev));
+ if (!dev) {
+ free(dev);
+ return 0;
+ }
+ memset(dev, 0, sizeof(*dev));
+
+ priv = malloc(sizeof(*priv));
+ if (!priv) {
+ free(priv);
+ return 0;
+ }
+ memset(priv, 0, sizeof(*priv));
+ priv->regs = (struct cs8900_regs *)base_addr;
+
+ /* Load MAC address from EEPROM */
+ cs8900_get_enetaddr(dev);
+
+ dev->iobase = base_addr;
+ dev->priv = priv;
+ dev->init = cs8900_init;
+ dev->halt = cs8900_halt;
+ dev->send = cs8900_send;
+ dev->recv = cs8900_recv;
+ sprintf(dev->name, "%s-%hu", CS8900_DRIVERNAME, dev_num);
+ eth_register(dev);
return 0;
}
diff --git a/drivers/net/cs8900.h b/drivers/net/cs8900.h
index f9c32dd..23c5cb0 100644
--- a/drivers/net/cs8900.h
+++ b/drivers/net/cs8900.h
@@ -1,6 +1,11 @@
+#ifndef CS8900_H
+#define CS8900_H
/*
* Cirrus Logic CS8900A Ethernet
*
+ * (C) 2009 Ben Warren , biggerbadderben(a)gmail.com
+ * Converted to use CONFIG_NET_MULTI API
+ *
* (C) Copyright 2002
* Sysgo Real-Time Solutions, GmbH <www.elinos.com>
* Marius Groeger <mgroeger(a)sysgo.de>
@@ -35,33 +40,34 @@
#include <asm/types.h>
#include <config.h>
-#ifdef CONFIG_DRIVER_CS8900
-
+#define CS8900_DRIVERNAME "CS8900"
/* although the registers are 16 bit, they are 32-bit aligned on the
EDB7111. so we have to read them as 32-bit registers and ignore the
upper 16-bits. i'm not sure if this holds for the EDB7211. */
-#ifdef CS8900_BUS16
+#ifdef CONFIG_CS8900_BUS16
/* 16 bit aligned registers, 16 bit wide */
#define CS8900_REG u16
- #define CS8900_OFF 0x02
- #define CS8900_BUS16_0 *(volatile u8 *)(CS8900_BASE+0x00)
- #define CS8900_BUS16_1 *(volatile u8 *)(CS8900_BASE+0x01)
-#elif defined(CS8900_BUS32)
+#elif defined(CONFIG_CS8900_BUS32)
/* 32 bit aligned registers, 16 bit wide (we ignore upper 16 bits) */
#define CS8900_REG u32
- #define CS8900_OFF 0x04
#else
#error unknown bussize ...
#endif
-#define CS8900_RTDATA *(volatile CS8900_REG *)(CS8900_BASE+0x00*CS8900_OFF)
-#define CS8900_TxCMD *(volatile CS8900_REG *)(CS8900_BASE+0x02*CS8900_OFF)
-#define CS8900_TxLEN *(volatile CS8900_REG *)(CS8900_BASE+0x03*CS8900_OFF)
-#define CS8900_ISQ *(volatile CS8900_REG *)(CS8900_BASE+0x04*CS8900_OFF)
-#define CS8900_PPTR *(volatile CS8900_REG *)(CS8900_BASE+0x05*CS8900_OFF)
-#define CS8900_PDATA *(volatile CS8900_REG *)(CS8900_BASE+0x06*CS8900_OFF)
+struct cs8900_regs {
+ CS8900_REG rtdata;
+ CS8900_REG pad0;
+ CS8900_REG txcmd;
+ CS8900_REG txlen;
+ CS8900_REG isq;
+ CS8900_REG pptr;
+ CS8900_REG pdata;
+};
+struct cs8900_priv {
+ struct cs8900_regs *regs;
+};
#define ISQ_RxEvent 0x04
#define ISQ_TxEvent 0x08
@@ -251,7 +257,8 @@
#define EEPROM_READ_CMD 0x0200
#define EEPROM_ERASE_CMD 0x0300
-extern int cs8900_e2prom_read(uchar, ushort *);
-extern int cs8900_e2prom_write(uchar, ushort);
+/* Exported functions */
+int cs8900_e2prom_read(struct eth_device *dev, uchar, ushort *);
+int cs8900_e2prom_write(struct eth_device *dev, uchar, ushort);
-#endif /* CONFIG_DRIVER_CS8900 */
+#endif /* CS8900_H */
diff --git a/include/configs/ADNPESC1.h b/include/configs/ADNPESC1.h
index b8afc17..2d4fc77 100644
--- a/include/configs/ADNPESC1.h
+++ b/include/configs/ADNPESC1.h
@@ -426,15 +426,17 @@
/********************************************/
/* !!! CS8900 is __not__ tested on NIOS !!! */
/********************************************/
-#define CONFIG_DRIVER_CS8900 /* Using CS8900 */
-#define CS8900_BASE (CONFIG_SYS_NIOS_CPU_LAN0_BASE + CONFIG_SYS_NIOS_CPU_LAN0_OFFS)
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900 /* Using CS8900 */
+#define CONFIG_CS8900_BASE (CONFIG_SYS_NIOS_CPU_LAN0_BASE + \
+ CONFIG_SYS_NIOS_CPU_LAN0_OFFS)
#if (CONFIG_SYS_NIOS_CPU_LAN0_BUSW == 32)
-#undef CS8900_BUS16
-#define CS8900_BUS32 1
+#undef CONFIG_CS8900_BUS16
+#define CONFIG_CS8900_BUS32
#else /* no */
-#define CS8900_BUS16 1
-#undef CS8900_BUS32
+#define CONFIG_CS8900_BUS16
+#undef CONFIG_CS8900_BUS32
#endif
#else
diff --git a/include/configs/DK1C20.h b/include/configs/DK1C20.h
index 45ff2f7..cdc488b 100644
--- a/include/configs/DK1C20.h
+++ b/include/configs/DK1C20.h
@@ -232,15 +232,17 @@
/********************************************/
/* !!! CS8900 is __not__ tested on NIOS !!! */
/********************************************/
-#define CONFIG_DRIVER_CS8900 /* Using CS8900 */
-#define CS8900_BASE (CONFIG_SYS_NIOS_CPU_LAN0_BASE + CONFIG_SYS_NIOS_CPU_LAN0_OFFS)
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900 /* Using CS8900 */
+#define CONFIG_CS8900_BASE (CONFIG_SYS_NIOS_CPU_LAN0_BASE + \
+ CONFIG_SYS_NIOS_CPU_LAN0_OFFS)
#if (CONFIG_SYS_NIOS_CPU_LAN0_BUSW == 32)
-#undef CS8900_BUS16
-#define CS8900_BUS32 1
+#undef CONFIG_CS8900_BUS16
+#define CONFIG_CS8900_BUS32
#else /* no */
-#define CS8900_BUS16 1
-#undef CS8900_BUS32
+#define CONFIG_CS8900_BUS16
+#undef CONFIG_CS8900_BUS32
#endif
#else
diff --git a/include/configs/DK1S10.h b/include/configs/DK1S10.h
index ae567a3..6e78861 100644
--- a/include/configs/DK1S10.h
+++ b/include/configs/DK1S10.h
@@ -249,15 +249,17 @@
/********************************************/
/* !!! CS8900 is __not__ tested on NIOS !!! */
/********************************************/
-#define CONFIG_DRIVER_CS8900 /* Using CS8900 */
-#define CS8900_BASE (CONFIG_SYS_NIOS_CPU_LAN0_BASE + CONFIG_SYS_NIOS_CPU_LAN0_OFFS)
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900 /* Using CS8900 */
+#define CONFIG_CS8900_BASE (CONFIG_SYS_NIOS_CPU_LAN0_BASE + \
+ CONFIG_SYS_NIOS_CPU_LAN0_OFFS)
#if (CONFIG_SYS_NIOS_CPU_LAN0_BUSW == 32)
-#undef CS8900_BUS16
-#define CS8900_BUS32 1
+#undef CONFIG_CS8900_BUS16
+#define CONFIG_CS8900_BUS32
#else /* no */
-#define CS8900_BUS16 1
-#undef CS8900_BUS32
+#define CONFIG_CS8900_BUS16
+#undef CONFIG_CS8900_BUS32
#endif
#else
diff --git a/include/configs/VCMA9.h b/include/configs/VCMA9.h
index 6051480..618b7f0 100644
--- a/include/configs/VCMA9.h
+++ b/include/configs/VCMA9.h
@@ -108,9 +108,10 @@
/*
* Hardware drivers
*/
-#define CONFIG_DRIVER_CS8900 1 /* we have a CS8900 on-board */
-#define CS8900_BASE 0x20000300
-#define CS8900_BUS16 1 /* the Linux driver does accesses as shorts */
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900 /* we have a CS8900 on-board */
+#define CONFIG_CS8900_BASE 0x20000300
+#define CONFIG_CS8900_BUS16 /* the Linux driver does accesses as shorts */
#define CONFIG_DRIVER_S3C24X0_I2C 1 /* we use the buildin I2C controller */
diff --git a/include/configs/armadillo.h b/include/configs/armadillo.h
index f7eec27..49ea3a1 100644
--- a/include/configs/armadillo.h
+++ b/include/configs/armadillo.h
@@ -56,10 +56,11 @@
/*
* Hardware drivers
*/
-#define CONFIG_DRIVER_CS8900 1 /* we have a CS8900 on-board */
-#define CS8900_BASE 0x20000300 /* armadillo board */
-#define CS8900_BUS16 1
-#undef CS8900_BUS32
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900 /* we have a CS8900 on-board */
+#define CONFIG_CS8900_BASE 0x20000300 /* armadillo board */
+#define CONFIG_CS8900_BUS16
+#undef CONFIG_CS8900_BUS32
/*
* select serial console configuration
diff --git a/include/configs/csb226.h b/include/configs/csb226.h
index 12bab47..0661d65 100644
--- a/include/configs/csb226.h
+++ b/include/configs/csb226.h
@@ -150,9 +150,10 @@
/*
* Network chip
*/
-#define CONFIG_DRIVER_CS8900 1
-#define CS8900_BUS32 1
-#define CS8900_BASE 0x08000000
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900
+#define CONFIG_CS8900_BUS32
+#define CONFIG_CS8900_BASE 0x08000000
/*
* Stack sizes
diff --git a/include/configs/ep7312.h b/include/configs/ep7312.h
index 630fff3..e151faa 100644
--- a/include/configs/ep7312.h
+++ b/include/configs/ep7312.h
@@ -47,10 +47,11 @@
/*
* Hardware drivers
*/
-#define CONFIG_DRIVER_CS8900 1 /* we have a CS8900 on-board */
-#define CS8900_BASE 0x20000000
-#define CS8900_BUS16 1
-#undef CS8900_BUS32
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900 /* we have a CS8900 on-board */
+#define CONFIG_CS8900_BASE 0x20000000
+#define CONFIG_CS8900_BUS16
+#undef CONFIG_CS8900_BUS32
/*
* select serial console configuration
diff --git a/include/configs/impa7.h b/include/configs/impa7.h
index c7001cc..fdfa022 100644
--- a/include/configs/impa7.h
+++ b/include/configs/impa7.h
@@ -47,9 +47,10 @@
/*
* Hardware drivers
*/
-#define CONFIG_DRIVER_CS8900 1 /* we have a CS8900 on-board */
-#define CS8900_BASE 0x20000000
-#define CS8900_BUS32 1
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900 /* we have a CS8900 on-board */
+#define CONFIG_CS8900_BASE 0x20000000
+#define CONFIG_CS8900_BUS32
/*
* select serial console configuration
diff --git a/include/configs/lart.h b/include/configs/lart.h
index 5d6d460..2d3b369 100644
--- a/include/configs/lart.h
+++ b/include/configs/lart.h
@@ -47,9 +47,10 @@
/*
* Hardware drivers
*/
-#define CONFIG_DRIVER_CS8900 1 /* we have a CS8900 on-board */
-#define CS8900_BASE 0x20008300
-#define CS8900_BUS16 1
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900 /* we have a CS8900 on-board */
+#define CONFIG_CS8900_BASE 0x20008300
+#define CONFIG_CS8900_BUS16
/*
* select serial console configuration
diff --git a/include/configs/mx1ads.h b/include/configs/mx1ads.h
index 12e567b..b2ffd3e 100644
--- a/include/configs/mx1ads.h
+++ b/include/configs/mx1ads.h
@@ -66,9 +66,10 @@
/*
* CS8900 Ethernet drivers
*/
-#define CONFIG_DRIVER_CS8900 1 /* we have a CS8900 on-board */
-#define CS8900_BASE 0x15000300
-#define CS8900_BUS16 1 /* the Linux driver does accesses as shorts */
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900 /* we have a CS8900 on-board */
+#define CONFIG_CS8900_BASE 0x15000300
+#define CONFIG_CS8900_BUS16 /* the Linux driver does accesses as shorts */
/*
* select serial console configuration
diff --git a/include/configs/mx31ads.h b/include/configs/mx31ads.h
index 363ea1b..ec1c905 100644
--- a/include/configs/mx31ads.h
+++ b/include/configs/mx31ads.h
@@ -109,9 +109,10 @@
"cp.b ${loadaddr} ${uboot_addr} ${filesize}; " \
"setenv filesize; saveenv\0"
-#define CONFIG_DRIVER_CS8900 1
-#define CS8900_BASE 0xb4020300
-#define CS8900_BUS16 1 /* follow the Linux driver */
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900
+#define CONFIG_CS8900_BASE 0xb4020300
+#define CONFIG_CS8900_BUS16 1 /* follow the Linux driver */
/*
* The MX31ADS board seems to have a hardware "peculiarity" confirmed under
diff --git a/include/configs/sbc2410x.h b/include/configs/sbc2410x.h
index f3dc7fe..f2ea926 100644
--- a/include/configs/sbc2410x.h
+++ b/include/configs/sbc2410x.h
@@ -63,9 +63,10 @@
/*
* Hardware drivers
*/
-#define CONFIG_DRIVER_CS8900 1 /* we have a CS8900 on-board */
-#define CS8900_BASE 0x19000300
-#define CS8900_BUS16 1 /* the Linux driver does accesses as shorts */
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900 /* we have a CS8900 on-board */
+#define CONFIG_CS8900_BASE 0x19000300
+#define CONFIG_CS8900_BUS16 /* the Linux driver does accesses as shorts */
/*
* select serial console configuration
diff --git a/include/configs/smdk2400.h b/include/configs/smdk2400.h
index b712db4..c234177 100644
--- a/include/configs/smdk2400.h
+++ b/include/configs/smdk2400.h
@@ -56,9 +56,10 @@
/*
* Hardware drivers
*/
-#define CONFIG_DRIVER_CS8900 1 /* we have a CS8900 on-board */
-#define CS8900_BASE 0x07000300 /* agrees with WIN CE PA */
-#define CS8900_BUS16 1 /* the Linux driver does accesses as shorts */
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900 /* we have a CS8900 on-board */
+#define CONFIG_CS8900_BASE 0x07000300 /* agrees with WIN CE PA */
+#define CONFIG_CS8900_BUS16 /* the Linux driver does accesses as shorts */
/*
* select serial console configuration
diff --git a/include/configs/smdk2410.h b/include/configs/smdk2410.h
index a473278..d340098 100644
--- a/include/configs/smdk2410.h
+++ b/include/configs/smdk2410.h
@@ -53,9 +53,10 @@
/*
* Hardware drivers
*/
-#define CONFIG_DRIVER_CS8900 1 /* we have a CS8900 on-board */
-#define CS8900_BASE 0x19000300
-#define CS8900_BUS16 1 /* the Linux driver does accesses as shorts */
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900 /* we have a CS8900 on-board */
+#define CONFIG_CS8900_BASE 0x19000300
+#define CONFIG_CS8900_BUS16 /* the Linux driver does accesses as shorts */
/*
* select serial console configuration
diff --git a/include/configs/smdk6400.h b/include/configs/smdk6400.h
index ddc8e71..f6e1221 100644
--- a/include/configs/smdk6400.h
+++ b/include/configs/smdk6400.h
@@ -74,9 +74,10 @@
/*
* Hardware drivers
*/
-#define CONFIG_DRIVER_CS8900 1 /* we have a CS8900 on-board */
-#define CS8900_BASE 0x18800300
-#define CS8900_BUS16 1 /* follow the Linux driver */
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900 /* we have a CS8900 on-board */
+#define CONFIG_CS8900_BASE 0x18800300
+#define CONFIG_CS8900_BUS16 /* follow the Linux driver */
/*
* select serial console configuration
diff --git a/include/configs/trab.h b/include/configs/trab.h
index 7687ee6..43c191b 100644
--- a/include/configs/trab.h
+++ b/include/configs/trab.h
@@ -99,9 +99,10 @@
/*
* Hardware drivers
*/
-#define CONFIG_DRIVER_CS8900 1 /* we have a CS8900 on-board */
-#define CS8900_BASE 0x07000300 /* agrees with WIN CE PA */
-#define CS8900_BUS16 1 /* the Linux driver does accesses as shorts */
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900 /* we have a CS8900 on-board */
+#define CONFIG_CS8900_BASE 0x07000300 /* agrees with WIN CE PA */
+#define CONFIG_CS8900_BUS16 /* the Linux driver does accesses as shorts */
#define CONFIG_DRIVER_S3C24X0_I2C 1 /* we use the buildin I2C controller */
diff --git a/include/netdev.h b/include/netdev.h
index 3e66586..95d79a6 100644
--- a/include/netdev.h
+++ b/include/netdev.h
@@ -43,6 +43,7 @@ int cpu_eth_init(bd_t *bis);
/* Driver initialization prototypes */
int au1x00_enet_initialize(bd_t*);
int bfin_EMAC_initialize(bd_t *bis);
+int cs8900_initialize(u8 dev_num, int base_addr);
int dc21x4x_initialize(bd_t *bis);
int davinci_emac_initialize(void);
int dnet_eth_initialize(int id, void *regs, unsigned int phy_addr);
diff --git a/lib_arm/board.c b/lib_arm/board.c
index a44d308..fa87d51 100644
--- a/lib_arm/board.c
+++ b/lib_arm/board.c
@@ -73,10 +73,6 @@ extern void dataflash_print_info(void);
const char version_string[] =
U_BOOT_VERSION" (" U_BOOT_DATE " - " U_BOOT_TIME ")"CONFIG_IDENT_STRING;
-#ifdef CONFIG_DRIVER_CS8900
-extern void cs8900_get_enetaddr (void);
-#endif
-
#ifdef CONFIG_DRIVER_RTL8019
extern void rtl8019_get_enetaddr (uchar * addr);
#endif
@@ -423,11 +419,6 @@ extern void davinci_eth_set_mac_addr (const u_int8_t *addr);
}
#endif
-#ifdef CONFIG_DRIVER_CS8900
- /* XXX: this needs to be moved to board init */
- cs8900_get_enetaddr ();
-#endif
-
#if defined(CONFIG_DRIVER_SMC91111) || defined (CONFIG_DRIVER_LAN91C96)
/* XXX: this needs to be moved to board init */
if (getenv ("ethaddr")) {
--
1.5.6.3
1
1

[U-Boot] [PATCH v3][Net] Convert CS8900 Ethernet driver to CONFIG_NET_MULTI API
by Ben Warren 25 Aug '09
by Ben Warren 25 Aug '09
25 Aug '09
All in-tree boards that use this controller have CONFIG_NET_MULTI added
Also:
- changed CONFIG_DRIVER_CS8900 to CONFIG_CS8900
- changed CS8900_BASE to CONFIG_CS8900_BASE
- changed CS8900_BUS?? to CONFIG_CS8900_BUS??
- cleaned up line lengths
- modified VCMA9 command function that accesses the device
- removed MAC address initialization from lib_arm/board.c
Signed-off-by: Ben Warren <biggerbadderben(a)gmail.com>
---
v3: Added accessor macros to ensure proper bus access
v2: Fixed typo: CS8900_BUS32 -> CONFIG_CS8900_BUS32
Added more descriptive printf in cs8900_init as suggested by Wolfgang
Initialize 'priv' data structure in cs8900_initialize()
board/altera/dk1c20/dk1c20.c | 12 ++
board/altera/dk1s10/dk1s10.c | 12 ++
board/armadillo/armadillo.c | 12 ++
board/csb226/csb226.c | 12 ++
board/ep7312/ep7312.c | 12 ++
board/freescale/mx31ads/mx31ads.c | 12 ++
board/impa7/impa7.c | 12 ++
board/lart/lart.c | 12 ++
board/mpl/vcma9/cmd_vcma9.c | 28 +++--
board/mpl/vcma9/vcma9.c | 12 ++
board/mx1ads/mx1ads.c | 12 ++
board/samsung/smdk2400/smdk2400.c | 12 ++
board/samsung/smdk2410/smdk2410.c | 12 ++
board/samsung/smdk6400/smdk6400.c | 12 ++
board/sbc2410x/sbc2410x.c | 12 ++
board/ssv/adnpesc1/adnpesc1.c | 12 ++
board/trab/trab.c | 12 ++
drivers/net/Makefile | 2 +-
drivers/net/cs8900.c | 271 ++++++++++++++++++++++---------------
drivers/net/cs8900.h | 41 ++++---
include/configs/ADNPESC1.h | 14 +-
include/configs/DK1C20.h | 14 +-
include/configs/DK1S10.h | 14 +-
include/configs/VCMA9.h | 7 +-
include/configs/armadillo.h | 9 +-
include/configs/csb226.h | 7 +-
include/configs/ep7312.h | 9 +-
include/configs/impa7.h | 7 +-
include/configs/lart.h | 7 +-
include/configs/mx1ads.h | 7 +-
include/configs/mx31ads.h | 7 +-
include/configs/sbc2410x.h | 7 +-
include/configs/smdk2400.h | 7 +-
include/configs/smdk2410.h | 7 +-
include/configs/smdk6400.h | 7 +-
include/configs/trab.h | 7 +-
include/netdev.h | 1 +
lib_arm/board.c | 9 --
38 files changed, 473 insertions(+), 208 deletions(-)
diff --git a/board/altera/dk1c20/dk1c20.c b/board/altera/dk1c20/dk1c20.c
index 11c19b7..0bcaa4f 100644
--- a/board/altera/dk1c20/dk1c20.c
+++ b/board/altera/dk1c20/dk1c20.c
@@ -25,6 +25,7 @@
*/
#include <common.h>
+#include <netdev.h>
#include <nios-io.h>
#if defined(CONFIG_SEVENSEG)
#include "../common/sevenseg.h"
@@ -79,3 +80,14 @@ int ide_preinit (void)
return 0;
}
#endif
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+#ifdef CONFIG_CS8900
+ rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+ return rc;
+}
+#endif
diff --git a/board/altera/dk1s10/dk1s10.c b/board/altera/dk1s10/dk1s10.c
index 64d591e..fb96501 100644
--- a/board/altera/dk1s10/dk1s10.c
+++ b/board/altera/dk1s10/dk1s10.c
@@ -22,6 +22,7 @@
*/
#include <common.h>
+#include <netdev.h>
#if defined(CONFIG_SEVENSEG)
#include "../common/sevenseg.h"
#endif
@@ -58,3 +59,14 @@ phys_size_t initdram (int board_type)
{
return (0);
}
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+#ifdef CONFIG_CS8900
+ rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+ return rc;
+}
+#endif
diff --git a/board/armadillo/armadillo.c b/board/armadillo/armadillo.c
index ca5bd1d..a825144 100644
--- a/board/armadillo/armadillo.c
+++ b/board/armadillo/armadillo.c
@@ -26,6 +26,7 @@
*/
#include <common.h>
+#include <netdev.h>
#include <clps7111.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -58,3 +59,14 @@ int dram_init (void)
return (0);
}
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+#ifdef CONFIG_CS8900
+ rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+ return rc;
+}
+#endif
diff --git a/board/csb226/csb226.c b/board/csb226/csb226.c
index 80caf8b..0a6c13d 100644
--- a/board/csb226/csb226.c
+++ b/board/csb226/csb226.c
@@ -24,6 +24,7 @@
*/
#include <common.h>
+#include <netdev.h>
#include <asm/arch/pxa-regs.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -151,3 +152,14 @@ void show_boot_progress (int status)
return;
}
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+#ifdef CONFIG_CS8900
+ rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+ return rc;
+}
+#endif
diff --git a/board/ep7312/ep7312.c b/board/ep7312/ep7312.c
index 6968a5d..8ed14ad 100644
--- a/board/ep7312/ep7312.c
+++ b/board/ep7312/ep7312.c
@@ -23,6 +23,7 @@
*/
#include <common.h>
+#include <netdev.h>
#include <clps7111.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -52,3 +53,14 @@ int dram_init (void)
return (0);
}
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+#ifdef CONFIG_CS8900
+ rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+ return rc;
+}
+#endif
diff --git a/board/freescale/mx31ads/mx31ads.c b/board/freescale/mx31ads/mx31ads.c
index c24c47c..bc25c6d 100644
--- a/board/freescale/mx31ads/mx31ads.c
+++ b/board/freescale/mx31ads/mx31ads.c
@@ -21,6 +21,7 @@
*/
#include <common.h>
+#include <netdev.h>
#include <asm/io.h>
#include <asm/arch/mx31.h>
#include <asm/arch/mx31-regs.h>
@@ -104,3 +105,14 @@ int checkboard (void)
printf("Board: MX31ADS\n");
return 0;
}
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+#ifdef CONFIG_CS8900
+ rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+ return rc;
+}
+#endif
diff --git a/board/impa7/impa7.c b/board/impa7/impa7.c
index 3230dd4..205b1b3 100644
--- a/board/impa7/impa7.c
+++ b/board/impa7/impa7.c
@@ -23,6 +23,7 @@
*/
#include <common.h>
+#include <netdev.h>
#include <clps7111.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -57,3 +58,14 @@ int dram_init (void)
return (0);
}
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+#ifdef CONFIG_CS8900
+ rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+ return rc;
+}
+#endif
diff --git a/board/lart/lart.c b/board/lart/lart.c
index 8d534c8..a0b459f 100644
--- a/board/lart/lart.c
+++ b/board/lart/lart.c
@@ -23,6 +23,7 @@
*/
#include <common.h>
+#include <netdev.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -62,3 +63,14 @@ int dram_init (void)
return (0);
}
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+#ifdef CONFIG_CS8900
+ rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+ return rc;
+}
+#endif
diff --git a/board/mpl/vcma9/cmd_vcma9.c b/board/mpl/vcma9/cmd_vcma9.c
index 0160774..0ee9595 100644
--- a/board/mpl/vcma9/cmd_vcma9.c
+++ b/board/mpl/vcma9/cmd_vcma9.c
@@ -31,7 +31,7 @@
#include "vcma9.h"
#include "../common/common_util.h"
-#if defined(CONFIG_DRIVER_CS8900)
+#if defined(CONFIG_CS8900)
#include <../drivers/net/cs8900.h>
static uchar cs8900_chksum(ushort data)
@@ -56,25 +56,33 @@ extern int do_mplcommon(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
int do_vcma9(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
+ struct eth_device *dev;
+ char cs8900_name[10];
if (strcmp(argv[1], "info") == 0)
{
print_vcma9_info();
return 0;
}
-#if defined(CONFIG_DRIVER_CS8900)
+#if defined(CONFIG_CS8900)
if (strcmp(argv[1], "cs8900") == 0) {
+ sprintf(cs8900_name, "%s-0", CS8900_DRIVERNAME);
+ dev = eth_get_dev_by_name(cs8900_name);
+ if (!dev) {
+ printf("Couldn't find CS8900 driver");
+ return 0;
+ }
if (strcmp(argv[2], "read") == 0) {
uchar addr; ushort data;
addr = simple_strtoul(argv[3], NULL, 16);
- cs8900_e2prom_read(addr, &data);
+ cs8900_e2prom_read(dev, addr, &data);
printf("0x%2.2X: 0x%4.4X\n", addr, data);
} else if (strcmp(argv[2], "write") == 0) {
uchar addr; ushort data;
addr = simple_strtoul(argv[3], NULL, 16);
data = simple_strtoul(argv[4], NULL, 16);
- cs8900_e2prom_write(addr, data);
+ cs8900_e2prom_write(dev, addr, data);
} else if (strcmp(argv[2], "setaddr") == 0) {
uchar addr, i, csum; ushort data;
uchar ethaddr[6];
@@ -83,22 +91,22 @@ int do_vcma9(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
if (eth_getenv_enetaddr("ethaddr", ethaddr)) {
addr = 1;
data = 0x2158;
- cs8900_e2prom_write(addr, data);
+ cs8900_e2prom_write(dev, addr, data);
csum = cs8900_chksum(data);
addr++;
for (i = 0; i < 6; i+=2) {
data = ethaddr[i+1] << 8 |
ethaddr[i];
- cs8900_e2prom_write(addr, data);
+ cs8900_e2prom_write(dev, addr, data);
csum += cs8900_chksum(data);
addr++;
}
/* calculate header link byte */
data = 0xA100 | (addr * 2);
- cs8900_e2prom_write(0, data);
+ cs8900_e2prom_write(dev, 0, data);
csum += cs8900_chksum(data);
/* write checksum word */
- cs8900_e2prom_write(addr, (0 - csum) << 8);
+ cs8900_e2prom_write(dev, addr, (0 - csum) << 8);
} else {
puts("\nplease defined 'ethaddr'\n");
}
@@ -106,12 +114,12 @@ int do_vcma9(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
uchar addr = 0, endaddr, csum; ushort data;
puts("Dump of CS8900 config device: ");
- cs8900_e2prom_read(addr, &data);
+ cs8900_e2prom_read(dev, addr, &data);
if ((data & 0xE000) == 0xA000) {
endaddr = (data & 0x00FF) / 2;
csum = cs8900_chksum(data);
for (addr = 1; addr <= endaddr; addr++) {
- cs8900_e2prom_read(addr, &data);
+ cs8900_e2prom_read(dev, addr, &data);
printf("\n0x%2.2X: 0x%4.4X", addr, data);
csum += cs8900_chksum(data);
}
diff --git a/board/mpl/vcma9/vcma9.c b/board/mpl/vcma9/vcma9.c
index 2b3fad2..3216d63 100644
--- a/board/mpl/vcma9/vcma9.c
+++ b/board/mpl/vcma9/vcma9.c
@@ -26,6 +26,7 @@
*/
#include <common.h>
+#include <netdev.h>
#include <s3c2410.h>
#include <stdio_dev.h>
#include <i2c.h>
@@ -349,3 +350,14 @@ void print_vcma9_info(void)
Show_VCMA9_Info(s, &s[6]);
}
}
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+#ifdef CONFIG_CS8900
+ rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+ return rc;
+}
+#endif
diff --git a/board/mx1ads/mx1ads.c b/board/mx1ads/mx1ads.c
index ba152e2..f8ce210 100644
--- a/board/mx1ads/mx1ads.c
+++ b/board/mx1ads/mx1ads.c
@@ -24,6 +24,7 @@
*/
#include <common.h>
+#include <netdev.h>
/*#include <mc9328.h>*/
#include <asm/arch/imx-regs.h>
@@ -167,3 +168,14 @@ int dram_init (void)
return 0;
}
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+#ifdef CONFIG_CS8900
+ rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+ return rc;
+}
+#endif
diff --git a/board/samsung/smdk2400/smdk2400.c b/board/samsung/smdk2400/smdk2400.c
index 0b82070..2c47063 100644
--- a/board/samsung/smdk2400/smdk2400.c
+++ b/board/samsung/smdk2400/smdk2400.c
@@ -26,6 +26,7 @@
*/
#include <common.h>
+#include <netdev.h>
#include <s3c2400.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -110,3 +111,14 @@ static int key_pressed(void)
return rc;
}
#endif /* CONFIG_MODEM_SUPPORT */
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+#ifdef CONFIG_CS8900
+ rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+ return rc;
+}
+#endif
diff --git a/board/samsung/smdk2410/smdk2410.c b/board/samsung/smdk2410/smdk2410.c
index 802348d..25c38e6 100644
--- a/board/samsung/smdk2410/smdk2410.c
+++ b/board/samsung/smdk2410/smdk2410.c
@@ -26,6 +26,7 @@
*/
#include <common.h>
+#include <netdev.h>
#include <s3c2410.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -121,3 +122,14 @@ int dram_init (void)
return 0;
}
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+#ifdef CONFIG_CS8900
+ rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+ return rc;
+}
+#endif
diff --git a/board/samsung/smdk6400/smdk6400.c b/board/samsung/smdk6400/smdk6400.c
index 52cd174..561c0c8 100644
--- a/board/samsung/smdk6400/smdk6400.c
+++ b/board/samsung/smdk6400/smdk6400.c
@@ -29,6 +29,7 @@
*/
#include <common.h>
+#include <netdev.h>
#include <s3c6400.h>
/* ------------------------------------------------------------------------- */
@@ -117,3 +118,14 @@ ulong board_flash_get_legacy (ulong base, int banknum, flash_info_t *info)
} else
return 0;
}
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+#ifdef CONFIG_CS8900
+ rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+ return rc;
+}
+#endif
diff --git a/board/sbc2410x/sbc2410x.c b/board/sbc2410x/sbc2410x.c
index 6c894a3..6276850 100644
--- a/board/sbc2410x/sbc2410x.c
+++ b/board/sbc2410x/sbc2410x.c
@@ -29,6 +29,7 @@
*/
#include <common.h>
+#include <netdev.h>
#include <s3c2410.h>
#if defined(CONFIG_CMD_NAND)
@@ -178,3 +179,14 @@ void nand_init(void)
printf ("%4lu MB\n", nand_probe((ulong)nand) >> 20);
}
#endif
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+#ifdef CONFIG_CS8900
+ rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+ return rc;
+}
+#endif
diff --git a/board/ssv/adnpesc1/adnpesc1.c b/board/ssv/adnpesc1/adnpesc1.c
index 9d32741..72810d0 100644
--- a/board/ssv/adnpesc1/adnpesc1.c
+++ b/board/ssv/adnpesc1/adnpesc1.c
@@ -22,6 +22,7 @@
*/
#include <common.h>
+#include <netdev.h>
#include <nios-io.h>
#include <spi.h>
@@ -100,3 +101,14 @@ int post_hotkeys_pressed(void)
return 0; /* No hotkeys supported */
}
#endif /* CONFIG_POST */
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+#ifdef CONFIG_CS8900
+ rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+ return rc;
+}
+#endif
diff --git a/board/trab/trab.c b/board/trab/trab.c
index ddf6abf..2dccd87 100644
--- a/board/trab/trab.c
+++ b/board/trab/trab.c
@@ -24,6 +24,7 @@
/* #define DEBUG */
#include <common.h>
+#include <netdev.h>
#include <malloc.h>
#include <s3c2400.h>
#include <command.h>
@@ -420,3 +421,14 @@ static void tsc2000_set_brightness(void)
tsc2000_write(0, 0xb, br & 0xff);
}
#endif
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+#ifdef CONFIG_CS8900
+ rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
+#endif
+ return rc;
+}
+#endif
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 2df075c..f6d6c6c 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -30,7 +30,7 @@ COBJS-$(CONFIG_PPC4xx_EMAC) += 4xx_enet.o
COBJS-$(CONFIG_DRIVER_AX88180) += ax88180.o
COBJS-$(CONFIG_BCM570x) += bcm570x.o bcm570x_autoneg.o 5701rls.o
COBJS-$(CONFIG_BFIN_MAC) += bfin_mac.o
-COBJS-$(CONFIG_DRIVER_CS8900) += cs8900.o
+COBJS-$(CONFIG_CS8900) += cs8900.o
COBJS-$(CONFIG_TULIP) += dc2114x.o
COBJS-$(CONFIG_DRIVER_DM9000) += dm9000x.o
COBJS-$(CONFIG_DNET) += dnet.o
diff --git a/drivers/net/cs8900.c b/drivers/net/cs8900.c
index 5e2b3b0..b5555fe 100644
--- a/drivers/net/cs8900.c
+++ b/drivers/net/cs8900.c
@@ -1,6 +1,9 @@
/*
* Cirrus Logic CS8900A Ethernet
*
+ * (C) 2009 Ben Warren , biggerbadderben(a)gmail.com
+ * Converted to use CONFIG_NET_MULTI API
+ *
* (C) 2003 Wolfgang Denk, wd(a)denx.de
* Extension to synchronize ethaddr environment variable
* against value in EEPROM
@@ -38,220 +41,228 @@
#include <common.h>
#include <command.h>
-#include "cs8900.h"
+#include <asm/io.h>
#include <net.h>
+#include <malloc.h>
+#include "cs8900.h"
#undef DEBUG
/* packet page register access functions */
-#ifdef CS8900_BUS32
+#ifdef CONFIG_CS8900_BUS32
+
+#define REG_WRITE(v, a) writel((v),(a))
+#define REG_READ(a) readl((a))
+
/* we don't need 16 bit initialisation on 32 bit bus */
#define get_reg_init_bus(x) get_reg((x))
+
#else
-static unsigned short get_reg_init_bus (int regno)
+
+#define REG_WRITE(v, a) writew((v),(a))
+#define REG_READ(a) readw((a))
+
+static u16 get_reg_init_bus(struct eth_device *dev, int regno)
{
/* force 16 bit busmode */
- volatile unsigned char c;
+ volatile u8 c;
+ struct cs8900_priv *priv = (struct cs8900_priv *)(dev->priv);
- c = CS8900_BUS16_0;
- c = CS8900_BUS16_1;
- c = CS8900_BUS16_0;
- c = CS8900_BUS16_1;
- c = CS8900_BUS16_0;
+ c = readb(dev->iobase);
+ c = readb(dev->iobase + 1);
+ c = readb(dev->iobase);
+ c = readb(dev->iobase + 1);
+ c = readb(dev->iobase);
- CS8900_PPTR = regno;
- return CS8900_PDATA;
+ REG_WRITE(regno, &priv->regs->pptr);
+ return REG_READ(&priv->regs->pdata);
}
#endif
-static unsigned short get_reg (int regno)
+static u16 get_reg(struct eth_device *dev, int regno)
{
- CS8900_PPTR = regno;
- return CS8900_PDATA;
+ struct cs8900_priv *priv = (struct cs8900_priv *)(dev->priv);
+ REG_WRITE(regno, &priv->regs->pptr);
+ return REG_READ(&priv->regs->pdata);
}
-static void put_reg (int regno, unsigned short val)
+static void put_reg(struct eth_device *dev, int regno, u16 val)
{
- CS8900_PPTR = regno;
- CS8900_PDATA = val;
+ struct cs8900_priv *priv = (struct cs8900_priv *)(dev->priv);
+ REG_WRITE(regno, &priv->regs->pptr);
+ REG_WRITE(val, &priv->regs->pdata);
}
-static void eth_reset (void)
+static void cs8900_reset(struct eth_device *dev)
{
int tmo;
- unsigned short us;
+ u16 us;
/* reset NIC */
- put_reg (PP_SelfCTL, get_reg (PP_SelfCTL) | PP_SelfCTL_Reset);
+ put_reg(dev, PP_SelfCTL, get_reg(dev, PP_SelfCTL) | PP_SelfCTL_Reset);
/* wait for 200ms */
- udelay (200000);
+ udelay(200000);
/* Wait until the chip is reset */
- tmo = get_timer (0) + 1 * CONFIG_SYS_HZ;
- while ((((us = get_reg_init_bus (PP_SelfSTAT)) & PP_SelfSTAT_InitD) == 0)
- && tmo < get_timer (0))
+ tmo = get_timer(0) + 1 * CONFIG_SYS_HZ;
+ while ((((us = get_reg_init_bus(dev, PP_SelfSTAT)) &
+ PP_SelfSTAT_InitD) == 0) && tmo < get_timer(0))
/*NOP*/;
}
-static void eth_reginit (void)
+static void cs8900_reginit(struct eth_device *dev)
{
/* receive only error free packets addressed to this card */
- put_reg (PP_RxCTL, PP_RxCTL_IA | PP_RxCTL_Broadcast | PP_RxCTL_RxOK);
+ put_reg(dev, PP_RxCTL,
+ PP_RxCTL_IA | PP_RxCTL_Broadcast | PP_RxCTL_RxOK);
/* do not generate any interrupts on receive operations */
- put_reg (PP_RxCFG, 0);
+ put_reg(dev, PP_RxCFG, 0);
/* do not generate any interrupts on transmit operations */
- put_reg (PP_TxCFG, 0);
+ put_reg(dev, PP_TxCFG, 0);
/* do not generate any interrupts on buffer operations */
- put_reg (PP_BufCFG, 0);
+ put_reg(dev, PP_BufCFG, 0);
/* enable transmitter/receiver mode */
- put_reg (PP_LineCTL, PP_LineCTL_Rx | PP_LineCTL_Tx);
+ put_reg(dev, PP_LineCTL, PP_LineCTL_Rx | PP_LineCTL_Tx);
}
-void cs8900_get_enetaddr (void)
+void cs8900_get_enetaddr(struct eth_device *dev)
{
int i;
- uchar enetaddr[6];
-
- /* if the env is setup, then bail */
- if (eth_getenv_enetaddr("ethaddr", enetaddr))
- return;
/* verify chip id */
- if (get_reg_init_bus (PP_ChipID) != 0x630e)
+ if (get_reg_init_bus(dev, PP_ChipID) != 0x630e)
return;
- eth_reset ();
- if ((get_reg (PP_SelfSTAT) & (PP_SelfSTAT_EEPROM | PP_SelfSTAT_EEPROM_OK)) ==
- (PP_SelfSTAT_EEPROM | PP_SelfSTAT_EEPROM_OK)) {
+ cs8900_reset(dev);
+ if ((get_reg(dev, PP_SelfSTAT) &
+ (PP_SelfSTAT_EEPROM | PP_SelfSTAT_EEPROM_OK)) ==
+ (PP_SelfSTAT_EEPROM | PP_SelfSTAT_EEPROM_OK)) {
/* Load the MAC from EEPROM */
- for (i = 0; i < 6 / 2; i++) {
- unsigned int Addr;
+ for (i = 0; i < 3; i++) {
+ u32 Addr;
- Addr = get_reg (PP_IA + i * 2);
- enetaddr[i * 2] = Addr & 0xFF;
- enetaddr[i * 2 + 1] = Addr >> 8;
+ Addr = get_reg(dev, PP_IA + i * 2);
+ dev->enetaddr[i * 2] = Addr & 0xFF;
+ dev->enetaddr[i * 2 + 1] = Addr >> 8;
}
-
- eth_setenv_enetaddr("ethaddr", enetaddr);
- debug("### Set environment from HW MAC addr = \"%pM\"\n", enetaddr);
}
}
-void eth_halt (void)
+void cs8900_halt(struct eth_device *dev)
{
/* disable transmitter/receiver mode */
- put_reg (PP_LineCTL, 0);
+ put_reg(dev, PP_LineCTL, 0);
/* "shutdown" to show ChipID or kernel wouldn't find he cs8900 ... */
- get_reg_init_bus (PP_ChipID);
+ get_reg_init_bus(dev, PP_ChipID);
}
-int eth_init (bd_t * bd)
+static int cs8900_init(struct eth_device *dev, bd_t * bd)
{
- uchar enetaddr[6];
+ uchar *enetaddr = dev->enetaddr;
+ u16 id;
/* verify chip id */
- if (get_reg_init_bus (PP_ChipID) != 0x630e) {
- printf ("CS8900 Ethernet chip not found?!\n");
- return 0;
+ id = get_reg_init_bus(dev, PP_ChipID);
+ if (id != 0x630e) {
+ printf ("CS8900 Ethernet chip not found: "
+ "ID=0x%04x instead 0x%04x\n", id, 0x630e);
+ return 1;
}
- eth_reset ();
+ cs8900_reset (dev);
/* set the ethernet address */
- eth_getenv_enetaddr("ethaddr", enetaddr);
- put_reg (PP_IA + 0, enetaddr[0] | (enetaddr[1] << 8));
- put_reg (PP_IA + 2, enetaddr[2] | (enetaddr[3] << 8));
- put_reg (PP_IA + 4, enetaddr[4] | (enetaddr[5] << 8));
+ put_reg(dev, PP_IA + 0, enetaddr[0] | (enetaddr[1] << 8));
+ put_reg(dev, PP_IA + 2, enetaddr[2] | (enetaddr[3] << 8));
+ put_reg(dev, PP_IA + 4, enetaddr[4] | (enetaddr[5] << 8));
- eth_reginit ();
+ cs8900_reginit(dev);
return 0;
}
/* Get a data block via Ethernet */
-int eth_rx (void)
+static int cs8900_recv(struct eth_device *dev)
{
int i;
- unsigned short rxlen;
- unsigned short *addr;
- unsigned short status;
+ u16 rxlen;
+ u16 *addr;
+ u16 status;
- status = get_reg (PP_RER);
+ struct cs8900_priv *priv = (struct cs8900_priv *)(dev->priv);
+
+ status = get_reg(dev, PP_RER);
if ((status & PP_RER_RxOK) == 0)
return 0;
- status = CS8900_RTDATA; /* stat */
- rxlen = CS8900_RTDATA; /* len */
+ status = REG_READ(&priv->regs->rtdata);
+ rxlen = REG_READ(&priv->regs->rtdata);
-#ifdef DEBUG
if (rxlen > PKTSIZE_ALIGN + PKTALIGN)
- printf ("packet too big!\n");
-#endif
- for (addr = (unsigned short *) NetRxPackets[0], i = rxlen >> 1; i > 0;
+ debug("packet too big!\n");
+ for (addr = (u16 *) NetRxPackets[0], i = rxlen >> 1; i > 0;
i--)
- *addr++ = CS8900_RTDATA;
+ *addr++ = REG_READ(&priv->regs->rtdata);
if (rxlen & 1)
- *addr++ = CS8900_RTDATA;
+ *addr++ = REG_READ(&priv->regs->rtdata);
/* Pass the packet up to the protocol layers. */
NetReceive (NetRxPackets[0], rxlen);
-
return rxlen;
}
/* Send a data block via Ethernet. */
-int eth_send (volatile void *packet, int length)
+static int cs8900_send(struct eth_device *dev,
+ volatile void *packet, int length)
{
- volatile unsigned short *addr;
+ volatile u16 *addr;
int tmo;
- unsigned short s;
+ u16 s;
+ struct cs8900_priv *priv = (struct cs8900_priv *)(dev->priv);
retry:
/* initiate a transmit sequence */
- CS8900_TxCMD = PP_TxCmd_TxStart_Full;
- CS8900_TxLEN = length;
+ REG_WRITE(PP_TxCmd_TxStart_Full, &priv->regs->txcmd);
+ REG_WRITE(length, &priv->regs->txlen);
/* Test to see if the chip has allocated memory for the packet */
- if ((get_reg (PP_BusSTAT) & PP_BusSTAT_TxRDY) == 0) {
+ if ((get_reg(dev, PP_BusSTAT) & PP_BusSTAT_TxRDY) == 0) {
/* Oops... this should not happen! */
-#ifdef DEBUG
- printf ("cs: unable to send packet; retrying...\n");
-#endif
- for (tmo = get_timer (0) + 5 * CONFIG_SYS_HZ; get_timer (0) < tmo;)
+ debug("cs: unable to send packet; retrying...\n");
+ for (tmo = get_timer(0) + 5 * CONFIG_SYS_HZ;
+ get_timer(0) < tmo;)
/*NOP*/;
- eth_reset ();
- eth_reginit ();
+ cs8900_reset(dev);
+ cs8900_reginit(dev);
goto retry;
}
/* Write the contents of the packet */
/* assume even number of bytes */
for (addr = packet; length > 0; length -= 2)
- CS8900_RTDATA = *addr++;
+ REG_WRITE(*addr++, &priv->regs->rtdata);
/* wait for transfer to succeed */
- tmo = get_timer (0) + 5 * CONFIG_SYS_HZ;
- while ((s = get_reg (PP_TER) & ~0x1F) == 0) {
- if (get_timer (0) >= tmo)
+ tmo = get_timer(0) + 5 * CONFIG_SYS_HZ;
+ while ((s = get_reg(dev, PP_TER) & ~0x1F) == 0) {
+ if (get_timer(0) >= tmo)
break;
}
/* nothing */ ;
- if ((s & (PP_TER_CRS | PP_TER_TxOK)) != PP_TER_TxOK) {
-#ifdef DEBUG
- printf ("\ntransmission error %#x\n", s);
-#endif
+ if((s & (PP_TER_CRS | PP_TER_TxOK)) != PP_TER_TxOK) {
+ debug("\ntransmission error %#x\n", s);
}
return 0;
}
-static void cs8900_e2prom_ready(void)
+static void cs8900_e2prom_ready(struct eth_device *dev)
{
- while (get_reg(PP_SelfSTAT) & SI_BUSY)
+ while (get_reg(dev, PP_SelfSTAT) & SI_BUSY)
;
}
@@ -259,12 +270,13 @@ static void cs8900_e2prom_ready(void)
/* read a 16-bit word out of the EEPROM */
/***********************************************************/
-int cs8900_e2prom_read(unsigned char addr, unsigned short *value)
+int cs8900_e2prom_read(struct eth_device *dev,
+ u8 addr, u16 *value)
{
- cs8900_e2prom_ready();
- put_reg(PP_EECMD, EEPROM_READ_CMD | addr);
- cs8900_e2prom_ready();
- *value = get_reg(PP_EEData);
+ cs8900_e2prom_ready(dev);
+ put_reg(dev, PP_EECMD, EEPROM_READ_CMD | addr);
+ cs8900_e2prom_ready(dev);
+ *value = get_reg(dev, PP_EEData);
return 0;
}
@@ -274,16 +286,51 @@ int cs8900_e2prom_read(unsigned char addr, unsigned short *value)
/* write a 16-bit word into the EEPROM */
/***********************************************************/
-int cs8900_e2prom_write(unsigned char addr, unsigned short value)
+int cs8900_e2prom_write(struct eth_device *dev, u8 addr, u16 value)
+{
+ cs8900_e2prom_ready(dev);
+ put_reg(dev, PP_EECMD, EEPROM_WRITE_EN);
+ cs8900_e2prom_ready(dev);
+ put_reg(dev, PP_EEData, value);
+ put_reg(dev, PP_EECMD, EEPROM_WRITE_CMD | addr);
+ cs8900_e2prom_ready(dev);
+ put_reg(dev, PP_EECMD, EEPROM_WRITE_DIS);
+ cs8900_e2prom_ready(dev);
+
+ return 0;
+}
+
+int cs8900_initialize(u8 dev_num, int base_addr)
{
- cs8900_e2prom_ready();
- put_reg(PP_EECMD, EEPROM_WRITE_EN);
- cs8900_e2prom_ready();
- put_reg(PP_EEData, value);
- put_reg(PP_EECMD, EEPROM_WRITE_CMD | addr);
- cs8900_e2prom_ready();
- put_reg(PP_EECMD, EEPROM_WRITE_DIS);
- cs8900_e2prom_ready();
+ struct eth_device *dev;
+ struct cs8900_priv *priv;
+
+ dev = malloc(sizeof(*dev));
+ if (!dev) {
+ free(dev);
+ return 0;
+ }
+ memset(dev, 0, sizeof(*dev));
+
+ priv = malloc(sizeof(*priv));
+ if (!priv) {
+ free(priv);
+ return 0;
+ }
+ memset(priv, 0, sizeof(*priv));
+ priv->regs = (struct cs8900_regs *)base_addr;
+
+ /* Load MAC address from EEPROM */
+ cs8900_get_enetaddr(dev);
+
+ dev->iobase = base_addr;
+ dev->priv = priv;
+ dev->init = cs8900_init;
+ dev->halt = cs8900_halt;
+ dev->send = cs8900_send;
+ dev->recv = cs8900_recv;
+ sprintf(dev->name, "%s-%hu", CS8900_DRIVERNAME, dev_num);
+ eth_register(dev);
return 0;
}
diff --git a/drivers/net/cs8900.h b/drivers/net/cs8900.h
index f9c32dd..23c5cb0 100644
--- a/drivers/net/cs8900.h
+++ b/drivers/net/cs8900.h
@@ -1,6 +1,11 @@
+#ifndef CS8900_H
+#define CS8900_H
/*
* Cirrus Logic CS8900A Ethernet
*
+ * (C) 2009 Ben Warren , biggerbadderben(a)gmail.com
+ * Converted to use CONFIG_NET_MULTI API
+ *
* (C) Copyright 2002
* Sysgo Real-Time Solutions, GmbH <www.elinos.com>
* Marius Groeger <mgroeger(a)sysgo.de>
@@ -35,33 +40,34 @@
#include <asm/types.h>
#include <config.h>
-#ifdef CONFIG_DRIVER_CS8900
-
+#define CS8900_DRIVERNAME "CS8900"
/* although the registers are 16 bit, they are 32-bit aligned on the
EDB7111. so we have to read them as 32-bit registers and ignore the
upper 16-bits. i'm not sure if this holds for the EDB7211. */
-#ifdef CS8900_BUS16
+#ifdef CONFIG_CS8900_BUS16
/* 16 bit aligned registers, 16 bit wide */
#define CS8900_REG u16
- #define CS8900_OFF 0x02
- #define CS8900_BUS16_0 *(volatile u8 *)(CS8900_BASE+0x00)
- #define CS8900_BUS16_1 *(volatile u8 *)(CS8900_BASE+0x01)
-#elif defined(CS8900_BUS32)
+#elif defined(CONFIG_CS8900_BUS32)
/* 32 bit aligned registers, 16 bit wide (we ignore upper 16 bits) */
#define CS8900_REG u32
- #define CS8900_OFF 0x04
#else
#error unknown bussize ...
#endif
-#define CS8900_RTDATA *(volatile CS8900_REG *)(CS8900_BASE+0x00*CS8900_OFF)
-#define CS8900_TxCMD *(volatile CS8900_REG *)(CS8900_BASE+0x02*CS8900_OFF)
-#define CS8900_TxLEN *(volatile CS8900_REG *)(CS8900_BASE+0x03*CS8900_OFF)
-#define CS8900_ISQ *(volatile CS8900_REG *)(CS8900_BASE+0x04*CS8900_OFF)
-#define CS8900_PPTR *(volatile CS8900_REG *)(CS8900_BASE+0x05*CS8900_OFF)
-#define CS8900_PDATA *(volatile CS8900_REG *)(CS8900_BASE+0x06*CS8900_OFF)
+struct cs8900_regs {
+ CS8900_REG rtdata;
+ CS8900_REG pad0;
+ CS8900_REG txcmd;
+ CS8900_REG txlen;
+ CS8900_REG isq;
+ CS8900_REG pptr;
+ CS8900_REG pdata;
+};
+struct cs8900_priv {
+ struct cs8900_regs *regs;
+};
#define ISQ_RxEvent 0x04
#define ISQ_TxEvent 0x08
@@ -251,7 +257,8 @@
#define EEPROM_READ_CMD 0x0200
#define EEPROM_ERASE_CMD 0x0300
-extern int cs8900_e2prom_read(uchar, ushort *);
-extern int cs8900_e2prom_write(uchar, ushort);
+/* Exported functions */
+int cs8900_e2prom_read(struct eth_device *dev, uchar, ushort *);
+int cs8900_e2prom_write(struct eth_device *dev, uchar, ushort);
-#endif /* CONFIG_DRIVER_CS8900 */
+#endif /* CS8900_H */
diff --git a/include/configs/ADNPESC1.h b/include/configs/ADNPESC1.h
index b8afc17..2d4fc77 100644
--- a/include/configs/ADNPESC1.h
+++ b/include/configs/ADNPESC1.h
@@ -426,15 +426,17 @@
/********************************************/
/* !!! CS8900 is __not__ tested on NIOS !!! */
/********************************************/
-#define CONFIG_DRIVER_CS8900 /* Using CS8900 */
-#define CS8900_BASE (CONFIG_SYS_NIOS_CPU_LAN0_BASE + CONFIG_SYS_NIOS_CPU_LAN0_OFFS)
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900 /* Using CS8900 */
+#define CONFIG_CS8900_BASE (CONFIG_SYS_NIOS_CPU_LAN0_BASE + \
+ CONFIG_SYS_NIOS_CPU_LAN0_OFFS)
#if (CONFIG_SYS_NIOS_CPU_LAN0_BUSW == 32)
-#undef CS8900_BUS16
-#define CS8900_BUS32 1
+#undef CONFIG_CS8900_BUS16
+#define CONFIG_CS8900_BUS32
#else /* no */
-#define CS8900_BUS16 1
-#undef CS8900_BUS32
+#define CONFIG_CS8900_BUS16
+#undef CONFIG_CS8900_BUS32
#endif
#else
diff --git a/include/configs/DK1C20.h b/include/configs/DK1C20.h
index 45ff2f7..cdc488b 100644
--- a/include/configs/DK1C20.h
+++ b/include/configs/DK1C20.h
@@ -232,15 +232,17 @@
/********************************************/
/* !!! CS8900 is __not__ tested on NIOS !!! */
/********************************************/
-#define CONFIG_DRIVER_CS8900 /* Using CS8900 */
-#define CS8900_BASE (CONFIG_SYS_NIOS_CPU_LAN0_BASE + CONFIG_SYS_NIOS_CPU_LAN0_OFFS)
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900 /* Using CS8900 */
+#define CONFIG_CS8900_BASE (CONFIG_SYS_NIOS_CPU_LAN0_BASE + \
+ CONFIG_SYS_NIOS_CPU_LAN0_OFFS)
#if (CONFIG_SYS_NIOS_CPU_LAN0_BUSW == 32)
-#undef CS8900_BUS16
-#define CS8900_BUS32 1
+#undef CONFIG_CS8900_BUS16
+#define CONFIG_CS8900_BUS32
#else /* no */
-#define CS8900_BUS16 1
-#undef CS8900_BUS32
+#define CONFIG_CS8900_BUS16
+#undef CONFIG_CS8900_BUS32
#endif
#else
diff --git a/include/configs/DK1S10.h b/include/configs/DK1S10.h
index ae567a3..6e78861 100644
--- a/include/configs/DK1S10.h
+++ b/include/configs/DK1S10.h
@@ -249,15 +249,17 @@
/********************************************/
/* !!! CS8900 is __not__ tested on NIOS !!! */
/********************************************/
-#define CONFIG_DRIVER_CS8900 /* Using CS8900 */
-#define CS8900_BASE (CONFIG_SYS_NIOS_CPU_LAN0_BASE + CONFIG_SYS_NIOS_CPU_LAN0_OFFS)
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900 /* Using CS8900 */
+#define CONFIG_CS8900_BASE (CONFIG_SYS_NIOS_CPU_LAN0_BASE + \
+ CONFIG_SYS_NIOS_CPU_LAN0_OFFS)
#if (CONFIG_SYS_NIOS_CPU_LAN0_BUSW == 32)
-#undef CS8900_BUS16
-#define CS8900_BUS32 1
+#undef CONFIG_CS8900_BUS16
+#define CONFIG_CS8900_BUS32
#else /* no */
-#define CS8900_BUS16 1
-#undef CS8900_BUS32
+#define CONFIG_CS8900_BUS16
+#undef CONFIG_CS8900_BUS32
#endif
#else
diff --git a/include/configs/VCMA9.h b/include/configs/VCMA9.h
index 6051480..618b7f0 100644
--- a/include/configs/VCMA9.h
+++ b/include/configs/VCMA9.h
@@ -108,9 +108,10 @@
/*
* Hardware drivers
*/
-#define CONFIG_DRIVER_CS8900 1 /* we have a CS8900 on-board */
-#define CS8900_BASE 0x20000300
-#define CS8900_BUS16 1 /* the Linux driver does accesses as shorts */
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900 /* we have a CS8900 on-board */
+#define CONFIG_CS8900_BASE 0x20000300
+#define CONFIG_CS8900_BUS16 /* the Linux driver does accesses as shorts */
#define CONFIG_DRIVER_S3C24X0_I2C 1 /* we use the buildin I2C controller */
diff --git a/include/configs/armadillo.h b/include/configs/armadillo.h
index f7eec27..49ea3a1 100644
--- a/include/configs/armadillo.h
+++ b/include/configs/armadillo.h
@@ -56,10 +56,11 @@
/*
* Hardware drivers
*/
-#define CONFIG_DRIVER_CS8900 1 /* we have a CS8900 on-board */
-#define CS8900_BASE 0x20000300 /* armadillo board */
-#define CS8900_BUS16 1
-#undef CS8900_BUS32
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900 /* we have a CS8900 on-board */
+#define CONFIG_CS8900_BASE 0x20000300 /* armadillo board */
+#define CONFIG_CS8900_BUS16
+#undef CONFIG_CS8900_BUS32
/*
* select serial console configuration
diff --git a/include/configs/csb226.h b/include/configs/csb226.h
index 12bab47..0661d65 100644
--- a/include/configs/csb226.h
+++ b/include/configs/csb226.h
@@ -150,9 +150,10 @@
/*
* Network chip
*/
-#define CONFIG_DRIVER_CS8900 1
-#define CS8900_BUS32 1
-#define CS8900_BASE 0x08000000
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900
+#define CONFIG_CS8900_BUS32
+#define CONFIG_CS8900_BASE 0x08000000
/*
* Stack sizes
diff --git a/include/configs/ep7312.h b/include/configs/ep7312.h
index 630fff3..e151faa 100644
--- a/include/configs/ep7312.h
+++ b/include/configs/ep7312.h
@@ -47,10 +47,11 @@
/*
* Hardware drivers
*/
-#define CONFIG_DRIVER_CS8900 1 /* we have a CS8900 on-board */
-#define CS8900_BASE 0x20000000
-#define CS8900_BUS16 1
-#undef CS8900_BUS32
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900 /* we have a CS8900 on-board */
+#define CONFIG_CS8900_BASE 0x20000000
+#define CONFIG_CS8900_BUS16
+#undef CONFIG_CS8900_BUS32
/*
* select serial console configuration
diff --git a/include/configs/impa7.h b/include/configs/impa7.h
index c7001cc..fdfa022 100644
--- a/include/configs/impa7.h
+++ b/include/configs/impa7.h
@@ -47,9 +47,10 @@
/*
* Hardware drivers
*/
-#define CONFIG_DRIVER_CS8900 1 /* we have a CS8900 on-board */
-#define CS8900_BASE 0x20000000
-#define CS8900_BUS32 1
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900 /* we have a CS8900 on-board */
+#define CONFIG_CS8900_BASE 0x20000000
+#define CONFIG_CS8900_BUS32
/*
* select serial console configuration
diff --git a/include/configs/lart.h b/include/configs/lart.h
index 5d6d460..2d3b369 100644
--- a/include/configs/lart.h
+++ b/include/configs/lart.h
@@ -47,9 +47,10 @@
/*
* Hardware drivers
*/
-#define CONFIG_DRIVER_CS8900 1 /* we have a CS8900 on-board */
-#define CS8900_BASE 0x20008300
-#define CS8900_BUS16 1
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900 /* we have a CS8900 on-board */
+#define CONFIG_CS8900_BASE 0x20008300
+#define CONFIG_CS8900_BUS16
/*
* select serial console configuration
diff --git a/include/configs/mx1ads.h b/include/configs/mx1ads.h
index 12e567b..b2ffd3e 100644
--- a/include/configs/mx1ads.h
+++ b/include/configs/mx1ads.h
@@ -66,9 +66,10 @@
/*
* CS8900 Ethernet drivers
*/
-#define CONFIG_DRIVER_CS8900 1 /* we have a CS8900 on-board */
-#define CS8900_BASE 0x15000300
-#define CS8900_BUS16 1 /* the Linux driver does accesses as shorts */
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900 /* we have a CS8900 on-board */
+#define CONFIG_CS8900_BASE 0x15000300
+#define CONFIG_CS8900_BUS16 /* the Linux driver does accesses as shorts */
/*
* select serial console configuration
diff --git a/include/configs/mx31ads.h b/include/configs/mx31ads.h
index 363ea1b..ec1c905 100644
--- a/include/configs/mx31ads.h
+++ b/include/configs/mx31ads.h
@@ -109,9 +109,10 @@
"cp.b ${loadaddr} ${uboot_addr} ${filesize}; " \
"setenv filesize; saveenv\0"
-#define CONFIG_DRIVER_CS8900 1
-#define CS8900_BASE 0xb4020300
-#define CS8900_BUS16 1 /* follow the Linux driver */
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900
+#define CONFIG_CS8900_BASE 0xb4020300
+#define CONFIG_CS8900_BUS16 1 /* follow the Linux driver */
/*
* The MX31ADS board seems to have a hardware "peculiarity" confirmed under
diff --git a/include/configs/sbc2410x.h b/include/configs/sbc2410x.h
index f3dc7fe..f2ea926 100644
--- a/include/configs/sbc2410x.h
+++ b/include/configs/sbc2410x.h
@@ -63,9 +63,10 @@
/*
* Hardware drivers
*/
-#define CONFIG_DRIVER_CS8900 1 /* we have a CS8900 on-board */
-#define CS8900_BASE 0x19000300
-#define CS8900_BUS16 1 /* the Linux driver does accesses as shorts */
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900 /* we have a CS8900 on-board */
+#define CONFIG_CS8900_BASE 0x19000300
+#define CONFIG_CS8900_BUS16 /* the Linux driver does accesses as shorts */
/*
* select serial console configuration
diff --git a/include/configs/smdk2400.h b/include/configs/smdk2400.h
index b712db4..c234177 100644
--- a/include/configs/smdk2400.h
+++ b/include/configs/smdk2400.h
@@ -56,9 +56,10 @@
/*
* Hardware drivers
*/
-#define CONFIG_DRIVER_CS8900 1 /* we have a CS8900 on-board */
-#define CS8900_BASE 0x07000300 /* agrees with WIN CE PA */
-#define CS8900_BUS16 1 /* the Linux driver does accesses as shorts */
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900 /* we have a CS8900 on-board */
+#define CONFIG_CS8900_BASE 0x07000300 /* agrees with WIN CE PA */
+#define CONFIG_CS8900_BUS16 /* the Linux driver does accesses as shorts */
/*
* select serial console configuration
diff --git a/include/configs/smdk2410.h b/include/configs/smdk2410.h
index a473278..d340098 100644
--- a/include/configs/smdk2410.h
+++ b/include/configs/smdk2410.h
@@ -53,9 +53,10 @@
/*
* Hardware drivers
*/
-#define CONFIG_DRIVER_CS8900 1 /* we have a CS8900 on-board */
-#define CS8900_BASE 0x19000300
-#define CS8900_BUS16 1 /* the Linux driver does accesses as shorts */
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900 /* we have a CS8900 on-board */
+#define CONFIG_CS8900_BASE 0x19000300
+#define CONFIG_CS8900_BUS16 /* the Linux driver does accesses as shorts */
/*
* select serial console configuration
diff --git a/include/configs/smdk6400.h b/include/configs/smdk6400.h
index ddc8e71..f6e1221 100644
--- a/include/configs/smdk6400.h
+++ b/include/configs/smdk6400.h
@@ -74,9 +74,10 @@
/*
* Hardware drivers
*/
-#define CONFIG_DRIVER_CS8900 1 /* we have a CS8900 on-board */
-#define CS8900_BASE 0x18800300
-#define CS8900_BUS16 1 /* follow the Linux driver */
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900 /* we have a CS8900 on-board */
+#define CONFIG_CS8900_BASE 0x18800300
+#define CONFIG_CS8900_BUS16 /* follow the Linux driver */
/*
* select serial console configuration
diff --git a/include/configs/trab.h b/include/configs/trab.h
index 7687ee6..43c191b 100644
--- a/include/configs/trab.h
+++ b/include/configs/trab.h
@@ -99,9 +99,10 @@
/*
* Hardware drivers
*/
-#define CONFIG_DRIVER_CS8900 1 /* we have a CS8900 on-board */
-#define CS8900_BASE 0x07000300 /* agrees with WIN CE PA */
-#define CS8900_BUS16 1 /* the Linux driver does accesses as shorts */
+#define CONFIG_NET_MULTI
+#define CONFIG_CS8900 /* we have a CS8900 on-board */
+#define CONFIG_CS8900_BASE 0x07000300 /* agrees with WIN CE PA */
+#define CONFIG_CS8900_BUS16 /* the Linux driver does accesses as shorts */
#define CONFIG_DRIVER_S3C24X0_I2C 1 /* we use the buildin I2C controller */
diff --git a/include/netdev.h b/include/netdev.h
index 4636b57..f8f824f 100644
--- a/include/netdev.h
+++ b/include/netdev.h
@@ -43,6 +43,7 @@ int cpu_eth_init(bd_t *bis);
/* Driver initialization prototypes */
int au1x00_enet_initialize(bd_t*);
int bfin_EMAC_initialize(bd_t *bis);
+int cs8900_initialize(u8 dev_num, int base_addr);
int dc21x4x_initialize(bd_t *bis);
int davinci_emac_initialize(void);
int dnet_eth_initialize(int id, void *regs, unsigned int phy_addr);
diff --git a/lib_arm/board.c b/lib_arm/board.c
index a44d308..fa87d51 100644
--- a/lib_arm/board.c
+++ b/lib_arm/board.c
@@ -73,10 +73,6 @@ extern void dataflash_print_info(void);
const char version_string[] =
U_BOOT_VERSION" (" U_BOOT_DATE " - " U_BOOT_TIME ")"CONFIG_IDENT_STRING;
-#ifdef CONFIG_DRIVER_CS8900
-extern void cs8900_get_enetaddr (void);
-#endif
-
#ifdef CONFIG_DRIVER_RTL8019
extern void rtl8019_get_enetaddr (uchar * addr);
#endif
@@ -423,11 +419,6 @@ extern void davinci_eth_set_mac_addr (const u_int8_t *addr);
}
#endif
-#ifdef CONFIG_DRIVER_CS8900
- /* XXX: this needs to be moved to board init */
- cs8900_get_enetaddr ();
-#endif
-
#if defined(CONFIG_DRIVER_SMC91111) || defined (CONFIG_DRIVER_LAN91C96)
/* XXX: this needs to be moved to board init */
if (getenv ("ethaddr")) {
--
1.5.6.3
2
6

[U-Boot] [PATCH 1/1] ppc4xx: Fix ECC Correction bug with SMC ordering for NDFC driver
by Feng Kan 25 Aug '09
by Feng Kan 25 Aug '09
25 Aug '09
Fix ECC Correction bug where the byte offset location were double
flipped causing correction routine to toggle the wrong byte location
in the ECC segment. The ndfc_calculate_ecc routine change the order
of getting the ECC code.
/* The NDFC uses Smart Media (SMC) bytes order */
ecc_code[0] = p[2];
ecc_code[1] = p[1];
ecc_code[2] = p[3];
But in the Correction algorithm when calculating the byte offset
location, the s1 is used as the upper part of the address. Which
again reverse the order making the final byte offset address
location incorrect.
byteoffs = (s1 << 0) & 0x80;
.
.
byteoffs |= (s0 >> 4) & 0x08;
The order is change to read it in straight and let the correction
function to revert it to SMC order.
Signed-off-by: Feng Kan <fkan(a)amcc.com>
Acked-by: Victor Gallardo <vgallardo(a)amcc.com>
Acked-by: Prodyut Hazarika <phazarika(a)amcc.com>
---
drivers/mtd/nand/ndfc.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/nand/ndfc.c b/drivers/mtd/nand/ndfc.c
index 528b22b..0891936 100644
--- a/drivers/mtd/nand/ndfc.c
+++ b/drivers/mtd/nand/ndfc.c
@@ -89,8 +89,8 @@ static int ndfc_calculate_ecc(struct mtd_info *mtdinfo,
/* The NDFC uses Smart Media (SMC) bytes order
*/
- ecc_code[0] = p[2];
- ecc_code[1] = p[1];
+ ecc_code[0] = p[1];
+ ecc_code[1] = p[2];
ecc_code[2] = p[3];
return 0;
--
1.5.5
2
1

25 Aug '09
Hi,
I'm having a big problem with my board reset that it's very similar to
MPC8548CDS. I've been using for a long time a reset just in MPC8548 core,
using DBCR0 register. But after many resets, my u-boot crash when try to
relocate code to ram, and I can't debug it with BDI.
I saw the MPC8548 erratas and GEN14 errata advice to use the HRESET. So I
tried using a sequencer power source that could solve my problem.
As the core reset, this approach works fine for a while, but after many
resets, it hangs in the same point.
I'd review my ddr configurations, tlbs, laws and I'm really stuck at this
time.
Any suggestion of where my problem resides?
Thanks a lot,
Nedel, Werner.
1
1
Add chip select region for an Epson S1D15313.
Signed-off-by: Eric Millbrandt <emillbrandt(a)dekaresearch.com>
---
include/configs/galaxy5200.h | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/include/configs/galaxy5200.h b/include/configs/galaxy5200.h
index eb2cae6..54c6b80 100644
--- a/include/configs/galaxy5200.h
+++ b/include/configs/galaxy5200.h
@@ -212,6 +212,11 @@
#define CONFIG_SYS_CS1_SIZE 0x90000
#define CONFIG_SYS_CS1_CFG 0x0002d900
+/* Chip Select configuration for Epson S1D13513 */
+#define CONFIG_SYS_CS3_START 0x10000000
+#define CONFIG_SYS_CS3_SIZE 0x103fffff
+#define CONFIG_SYS_CS3_CFG 0xffff3d10
+
/*
* Ethernet configuration
*/
--
1.6.3.1
1
0

25 Aug '09
Modify mpc5xxx_gpio structure to include the i2c output-only enable
and data value out registers.
Signed-off-by: Eric Millbrandt <emillbrandt(a)dekaresearch.com>
---
A quick string search shows that no in-tree code is currently using any of
the modified fields and the structure size does not change.
include/mpc5xxx.h | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/mpc5xxx.h b/include/mpc5xxx.h
index 476d149..4a642a4 100644
--- a/include/mpc5xxx.h
+++ b/include/mpc5xxx.h
@@ -691,10 +691,10 @@ struct mpc5xxx_gpio {
volatile u32 simple_ddr; /* GPIO + 0x0c */
volatile u32 simple_dvo; /* GPIO + 0x10 */
volatile u32 simple_ival; /* GPIO + 0x14 */
- volatile u8 outo_gpioe; /* GPIO + 0x18 */
- volatile u8 reserved1[3]; /* GPIO + 0x19 */
- volatile u8 outo_dvo; /* GPIO + 0x1c */
- volatile u8 reserved2[3]; /* GPIO + 0x1d */
+ volatile u16 outo_gpioe; /* GPIO + 0x18 */
+ volatile u8 reserved1[2]; /* GPIO + 0x1a */
+ volatile u16 outo_dvo; /* GPIO + 0x1c */
+ volatile u8 reserved2[2]; /* GPIO + 0x1e */
volatile u8 sint_gpioe; /* GPIO + 0x20 */
volatile u8 reserved3[3]; /* GPIO + 0x21 */
volatile u8 sint_ode; /* GPIO + 0x24 */
--
1.6.3.1
1
0
Hi all,
unfortunately some merge conflicts have creeped in undetected into
the next branch. To fix the mess I had to rebase the "next" branch.
Sorry if this is causing inconveniences.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd(a)denx.de
A wise person makes his own decisions, a weak one obeys public
opinion. -- Chinese proverb
1
0
is there a reason to keep ENV_IS_EMBEDDED around ? i see a few places that
use CONFIG_ENV_IS_EMBEDDED, but it seems to be largely useless at the moment
as the define doesn't really do anything without ENV_IS_EMBEDDED.
in other words, i'd like to just do a sed on the tree to convert all
ENV_IS_EMBEDDED instances to CONFIG_ENV_IS_EMBEDDED.
-mike
3
12