Skip to content

Commit

Permalink
Convert CS8900 Ethernet driver to CONFIG_NET_MULTI API
Browse files Browse the repository at this point in the history
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 <[email protected]>
Tested-by: Wolfgang Denk <[email protected]>
Acked-by: Wolfgang Denk <[email protected]>
  • Loading branch information
ben-skyportsystems committed Aug 25, 2009
1 parent d47628a commit b1c0eaa
Show file tree
Hide file tree
Showing 38 changed files with 476 additions and 210 deletions.
12 changes: 12 additions & 0 deletions board/altera/dk1c20/dk1c20.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
*/

#include <common.h>
#include <netdev.h>
#include <nios-io.h>
#if defined(CONFIG_SEVENSEG)
#include "../common/sevenseg.h"
Expand Down Expand Up @@ -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
12 changes: 12 additions & 0 deletions board/altera/dk1s10/dk1s10.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
*/

#include <common.h>
#include <netdev.h>
#if defined(CONFIG_SEVENSEG)
#include "../common/sevenseg.h"
#endif
Expand Down Expand Up @@ -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
12 changes: 12 additions & 0 deletions board/armadillo/armadillo.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
*/

#include <common.h>
#include <netdev.h>
#include <clps7111.h>

DECLARE_GLOBAL_DATA_PTR;
Expand Down Expand Up @@ -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
12 changes: 12 additions & 0 deletions board/csb226/csb226.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
*/

#include <common.h>
#include <netdev.h>
#include <asm/arch/pxa-regs.h>

DECLARE_GLOBAL_DATA_PTR;
Expand Down Expand Up @@ -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
12 changes: 12 additions & 0 deletions board/ep7312/ep7312.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/

#include <common.h>
#include <netdev.h>
#include <clps7111.h>

DECLARE_GLOBAL_DATA_PTR;
Expand Down Expand Up @@ -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
12 changes: 12 additions & 0 deletions board/freescale/mx31ads/mx31ads.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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
12 changes: 12 additions & 0 deletions board/impa7/impa7.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/

#include <common.h>
#include <netdev.h>
#include <clps7111.h>

DECLARE_GLOBAL_DATA_PTR;
Expand Down Expand Up @@ -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
12 changes: 12 additions & 0 deletions board/lart/lart.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/

#include <common.h>
#include <netdev.h>

DECLARE_GLOBAL_DATA_PTR;

Expand Down Expand Up @@ -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
28 changes: 18 additions & 10 deletions board/mpl/vcma9/cmd_vcma9.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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];
Expand All @@ -83,35 +91,35 @@ 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");
}
} else if (strcmp(argv[2], "dump") == 0) {
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);
}
Expand Down
12 changes: 12 additions & 0 deletions board/mpl/vcma9/vcma9.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
*/

#include <common.h>
#include <netdev.h>
#include <s3c2410.h>
#include <stdio_dev.h>
#include <i2c.h>
Expand Down Expand Up @@ -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
12 changes: 12 additions & 0 deletions board/mx1ads/mx1ads.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
*/

#include <common.h>
#include <netdev.h>
/*#include <mc9328.h>*/
#include <asm/arch/imx-regs.h>

Expand Down Expand Up @@ -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
12 changes: 12 additions & 0 deletions board/samsung/smdk2400/smdk2400.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
*/

#include <common.h>
#include <netdev.h>
#include <s3c2400.h>

DECLARE_GLOBAL_DATA_PTR;
Expand Down Expand Up @@ -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
12 changes: 12 additions & 0 deletions board/samsung/smdk2410/smdk2410.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
*/

#include <common.h>
#include <netdev.h>
#include <s3c2410.h>

DECLARE_GLOBAL_DATA_PTR;
Expand Down Expand Up @@ -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
12 changes: 12 additions & 0 deletions board/samsung/smdk6400/smdk6400.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
*/

#include <common.h>
#include <netdev.h>
#include <s3c6400.h>

/* ------------------------------------------------------------------------- */
Expand Down Expand Up @@ -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
Loading

0 comments on commit b1c0eaa

Please sign in to comment.