[U-Boot] [PATCH 3/3] smc91111: switch to MULTI_NET api

Jean-Christophe PLAGNIOL-VILLARD
2009-08-11T20:49:07Z

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
board/netstar/eeprom.c | 3 +-
board/voiceblue/eeprom.c | 3 +-
drivers/net/smc91111.c | 420 +++++++++++++++++++------------------
drivers/net/smc91111.h | 8 +-
include/configs/ADNPESC1.h | 1 +
include/configs/DK1C20.h | 1 +
include/configs/DK1S10.h | 1 +
include/configs/EP1C20.h | 1 +
include/configs/EP1S10.h | 1 +
include/configs/EP1S40.h | 1 +
include/configs/MigoR.h | 1 +
include/configs/PK1C20.h | 1 +
include/configs/bf533-ezkit.h | 1 +
include/configs/bf533-stamp.h | 1 +
include/configs/bf538f-ezkit.h | 1 +
include/configs/bf561-ezkit.h | 1 +
include/configs/blackstamp.h | 1 +
include/configs/cerf250.h | 1 +
include/configs/cm-bf533.h | 1 +
include/configs/cm-bf561.h | 1 +
include/configs/cradle.h | 1 +
include/configs/delta.h | 1 +
include/configs/dnp1110.h | 1 +
include/configs/gr_cpci_ax2000.h | 1 +
include/configs/gr_ep2s60.h | 1 +
include/configs/innokom.h | 1 +
include/configs/integratorcp.h | 1 +
include/configs/logodl.h | 1 +
include/configs/lpd7a400-10.h | 1 +
include/configs/lpd7a404-10.h | 1 +
include/configs/ms7722se.h | 1 +
include/configs/netstar.h | 1 +
include/configs/nhk8815.h | 1 +
include/configs/pxa255_idp.h | 1 +
include/configs/versatile.h | 1 +
include/configs/voiceblue.h | 1 +
include/configs/xaeniax.h | 1 +
include/configs/xm250.h | 1 +
include/configs/xsengine.h | 1 +
include/configs/zylonite.h | 1 +
include/netdev.h | 1 +
41 files changed, 259 insertions(+), 212 deletions(-)

diff --git a/board/netstar/eeprom.c b/board/netstar/eeprom.c
index 5806128..05c6768 100644
--- a/board/netstar/eeprom.c
+++ b/board/netstar/eeprom.c
@@ -27,9 +27,8 @@
#include <common.h>
#include <exports.h>
#include <timestamp.h>
-#include "../drivers/net/smc91111.h"
-
#define SMC_BASE_ADDRESS CONFIG_SMC91111_BASE
+#include "../drivers/net/smc91111.h"

static u16 read_eeprom_reg(u16 reg)
{
diff --git a/board/voiceblue/eeprom.c b/board/voiceblue/eeprom.c
index f01597a..8b3fbed 100644
--- a/board/voiceblue/eeprom.c
+++ b/board/voiceblue/eeprom.c
@@ -27,9 +27,8 @@
#include <common.h>
#include <exports.h>
#include <timestamp.h>
-#include "../drivers/net/smc91111.h"
-
#define SMC_BASE_ADDRESS CONFIG_SMC91111_BASE
+#include "../drivers/net/smc91111.h"

static u16 read_eeprom_reg(u16 reg)
{
diff --git a/drivers/net/smc91111.c b/drivers/net/smc91111.c
index b41e4d2..1c0c20f 100644
--- a/drivers/net/smc91111.c
+++ b/drivers/net/smc91111.c
@@ -61,9 +61,10 @@

#include <common.h>
#include <command.h>
-#include <config.h>
+#include <malloc.h>
#include "smc91111.h"
#include <net.h>
+#include <netdev.h>

/* Use power-down feature of the chip */
#define POWER_DOWN 0
@@ -114,7 +115,6 @@ static const char version[] =
#define PRINTK(args...)
#endif

-
/*------------------------------------------------------------------------
.
. The internal workings of the driver. If you are changing anything
@@ -127,14 +127,7 @@ static const char version[] =
/* Memory sizing constant */
#define LAN91C111_MEMORY_MULTIPLIER (1024*2)

-#ifndef CONFIG_SMC91111_BASE
-#define CONFIG_SMC91111_BASE 0x20000300
-#endif
-
-#define SMC_BASE_ADDRESS CONFIG_SMC91111_BASE
-
#define SMC_DEV_NAME "SMC91111"
-#define SMC_PHY_ADDR 0x0000
#define SMC_ALLOC_MAX_TRY 5
#define SMC_TX_TIMEOUT 30

@@ -143,75 +136,51 @@ static const char version[] =
#define ETH_ZLEN 60

#ifdef CONFIG_SMC_USE_32_BIT
-#define USE_32_BIT 1
+#define is_use_32bit(x) (x->use_32bit)
#else
-#undef USE_32_BIT
+#define is_use_32bit(x) (0)
#endif
+
+struct smc91111_device {
+ int id;
+ void *regs;
+
+ int use_32bit;
+
+ struct eth_device netdev;
+ unsigned short phy_addr;
+};
+#define to_smc91111(_nd) container_of(_nd, struct smc91111_device, netdev)
+
/*-----------------------------------------------------------------
.
. The driver can be entered at any of the following entry points.
.
.------------------------------------------------------------------ */

-extern int eth_init(bd_t *bd);
-extern void eth_halt(void);
-extern int eth_rx(void);
-extern int eth_send(volatile void *packet, int length);
-
#ifdef SHARED_RESOURCES
extern void swap_to(int device_id);
#endif

/*
- . This is called by register_netdev(). It is responsible for
- . checking the portlist for the SMC9000 series chipset. If it finds
- . one, then it will initialize the device, find the hardware information,
- . and sets up the appropriate device parameters.
- . NOTE: Interrupts are *OFF* when this procedure is called.
- .
- . NB:This shouldn't be static since it is referred to externally.
-*/
-int smc_init(void);
-
-/*
. This is called by unregister_netdev(). It is responsible for
. cleaning up before the driver is finally unregistered and discarded.
*/
void smc_destructor(void);

/*
- . The kernel calls this function when someone wants to use the device,
- . typically 'ifconfig ethX up'.
-*/
-static int smc_open(bd_t *bd);
-
-
-/*
- . This is called by the kernel in response to 'ifconfig ethX down'. It
- . is responsible for cleaning up everything that the open routine
- . does, and maybe putting the card into a powerdown state.
-*/
-static int smc_close(void);
-
-/*
. Configures the PHY through the MII Management interface
*/
#ifndef CONFIG_SMC91111_EXT_PHY
-static void smc_phy_configure(void);
+static void smc_phy_configure(struct smc91111_device *smc);
#endif /* !CONFIG_SMC91111_EXT_PHY */

-/*
- . This is a separate procedure to handle the receipt of a packet, to
- . leave the interrupt code looking slightly cleaner
-*/
-static int smc_rcv(void);
-
/* See if a MAC address is defined in the current environment. If so use it. If not
. print a warning and set the environment and other globals with the default.
. If an EEPROM is present it really should be consulted.
*/
-int smc_get_ethaddr(bd_t *bd);
-int get_rom_mac(uchar *v_rom_mac);
+int smc_get_ethaddr(struct smc91111_device *smc, bd_t *bd);
+int get_rom_mac(struct smc91111_device *smc, uchar *v_rom_mac);

/*
------------------------------------------------------------
@@ -233,30 +202,31 @@ int get_rom_mac(uchar *v_rom_mac);
* packets being corrupt (shifted) on the wire, etc. Switching to the
* inx,outx functions fixed this problem.
*/
-static inline word SMC_inw(dword offset);
-static inline void SMC_outw(word value, dword offset);
-static inline byte SMC_inb(dword offset);
-static inline void SMC_outb(byte value, dword offset);
-static inline void SMC_insw(dword offset, volatile uchar* buf, dword len);
-static inline void SMC_outsw(dword offset, uchar* buf, dword len);
+#define SMC_inw(offset) SMC_io_inw(smc, offset)
+#define SMC_outw(value, offset) SMC_io_outw(smc, value, offset)
+#define SMC_inb(offset) SMC_io_inb(smc, offset)
+#define SMC_outb(value, offset) SMC_io_outb(smc, value, offset)
+#define SMC_insw(offset, buf, len) SMC_io_insw(smc, offset, buf, len)
+#define SMC_outsw(offset, buf, len) SMC_io_outsw(smc, offset, buf, len)

#define barrier() __asm__ __volatile__("": : :"memory")

-static inline word SMC_inw(dword offset)
+static inline word SMC_io_inw(struct smc91111_device *smc, dword offset)
{
word v;
- v = *((volatile word*)(SMC_BASE_ADDRESS+offset));
+ v = *((volatile word*)(smc->regs+offset));
barrier(); *(volatile u32*)(0xc0000000);
return v;
}

-static inline void SMC_outw(word value, dword offset)
+static inline void SMC_io_outw(struct smc91111_device *smc, word value,
+ dword offset)
{
- *((volatile word*)(SMC_BASE_ADDRESS+offset)) = value;
+ *((volatile word*)(smc->regs+offset)) = value;
barrier(); *(volatile u32*)(0xc0000000);
}

-static inline byte SMC_inb(dword offset)
+static inline byte SMC_io_inb(struct smc91111_device *smc, dword offset)
{
word _w;

@@ -264,18 +234,22 @@ static inline byte SMC_inb(dword offset)
return (offset & 1) ? (byte)(_w >> 8) : (byte)(_w);
}

-static inline void SMC_outb(byte value, dword offset)
+static inline void SMC_io_outb(struct smc91111_device *smc, byte value,
+ dword offset)
{
word _w;

_w = SMC_inw(offset & ~((dword)1));
if (offset & 1)
- *((volatile word*)(SMC_BASE_ADDRESS+(offset & ~((dword)1)))) = (value<<8) | (_w & 0x00ff);
+ *((volatile word*)(smc->regs+(offset & ~((dword)1)))) =
+ (value<<8) | (_w & 0x00ff);
else
- *((volatile word*)(SMC_BASE_ADDRESS+offset)) = value | (_w & 0xff00);
+ *((volatile word*)(smc->regs+offset)) =
+ value | (_w & 0xff00);
}

-static inline void SMC_insw(dword offset, volatile uchar* buf, dword len)
+static inline void SMC_io_insw(struct smc91111_device *smc, dword offset,
+ volatile uchar* buf, dword len)
{
volatile word *p = (volatile word *)buf;

@@ -286,7 +260,8 @@ static inline void SMC_insw(dword offset, volatile uchar* buf, dword len)
}
}

-static inline void SMC_outsw(dword offset, uchar* buf, dword len)
+static inline void SMC_io_outsw(struct smc91111_device *smc, dword offset,
+ uchar* buf, dword len)
{
volatile word *p = (volatile word *)buf;

@@ -339,7 +314,7 @@ void smc_get_macaddr( byte *addr ) {
/***********************************************
* Show available memory *
***********************************************/
-void dump_memory_info(void)
+void dump_memory_info(struct smc91111_device *smc)
{
word mem_info;
word old_bank;
@@ -363,25 +338,26 @@ static void print_packet( byte *, int );

/* this does a soft reset on the device */
-static void smc_reset( void );
+static void smc_reset(struct smc91111_device *smc);

/* Enable Interrupts, Receive, and Transmit */
-static void smc_enable( void );
+static void smc_enable(struct smc91111_device *smc);

/* this puts the device in an inactive state */
-static void smc_shutdown( void );
+static void smc_shutdown(struct smc91111_device *smc);

/* Routines to Read and Write the PHY Registers across the
MII Management Interface
*/

#ifndef CONFIG_SMC91111_EXT_PHY
-static word smc_read_phy_register(byte phyreg);
-static void smc_write_phy_register(byte phyreg, word phydata);
+static word smc_read_phy_register(struct smc91111_device *smc, byte phyreg);
+static void smc_write_phy_register(struct smc91111_device *smc, byte phyreg,
+ word phydata);
#endif /* !CONFIG_SMC91111_EXT_PHY */

-static int poll4int (byte mask, int timeout)
+static int poll4int (struct smc91111_device *smc, byte mask, int timeout)
{
int tmo = get_timer (0) + timeout * CONFIG_SYS_HZ;
int is_timeout = 0;
@@ -406,7 +382,7 @@ static int poll4int (byte mask, int timeout)
}

/* Only one release command at a time, please */
-static inline void smc_wait_mmu_release_complete (void)
+static inline void smc_wait_mmu_release_complete (struct smc91111_device *smc)
{
int count = 0;

@@ -435,7 +411,7 @@ static inline void smc_wait_mmu_release_complete (void)
. 5. clear all interrupts
.
*/
-static void smc_reset (void)
+static void smc_reset (struct smc91111_device *smc)
{
PRINTK2 ("%s: smc_reset\n", SMC_DEV_NAME);

@@ -475,7 +451,7 @@ static void smc_reset (void)

/* Reset the MMU */
SMC_SELECT_BANK (2);
- smc_wait_mmu_release_complete ();
+ smc_wait_mmu_release_complete (smc);
SMC_outw (MC_RESET, MMU_CMD_REG);
while (SMC_inw (MMU_CMD_REG) & MC_BUSY)
udelay (1); /* Wait until not busy */
@@ -496,7 +472,7 @@ static void smc_reset (void)
. 2. Enable the receiver
. 3. Enable interrupts
*/
-static void smc_enable()
+static void smc_enable(struct smc91111_device *smc)
{
PRINTK2("%s: smc_enable\n", SMC_DEV_NAME);
SMC_SELECT_BANK( 0 );
@@ -522,7 +498,7 @@ static void smc_enable()
. the manual says that it will wake up in response to any I/O requests
. in the register space. Empirical results do not show this working.
*/
-static void smc_shutdown()
+static void smc_shutdown(struct smc91111_device *smc)
{
PRINTK2(CARDNAME ": smc_shutdown\n");

@@ -558,8 +534,10 @@ static void smc_shutdown()
. Enable the transmit interrupt, so I know if it failed
. Free the kernel data if I actually sent it.
*/
-static int smc_send_packet (volatile void *packet, int packet_length)
+static int smc_send(struct eth_device *netdev, volatile void *packet,
+ int packet_length)
{
+ struct smc91111_device *smc = to_smc91111(netdev);
byte packet_no;
unsigned long ioaddr;
byte *buf;
@@ -637,7 +615,7 @@ again:

/* I can send the packet now.. */

- ioaddr = SMC_BASE_ADDRESS;
+ ioaddr = (ulong)smc->regs;

buf = (byte *) packet;

@@ -676,13 +654,13 @@ again:

/* send the packet length ( +6 for status, length and ctl byte )
and the status word ( set to zeros ) */
-#ifdef USE_32_BIT
- SMC_outl ((length + 6) << 16, SMC91111_DATA_REG);
-#else
- SMC_outw (0, SMC91111_DATA_REG);
- /* send the packet length ( +6 for status words, length, and ctl */
- SMC_outw ((length + 6), SMC91111_DATA_REG);
-#endif
+ if (is_use_32bit(smc)) {
+ SMC_outl ((length + 6) << 16, SMC91111_DATA_REG);
+ } else {
+ SMC_outw (0, SMC91111_DATA_REG);
+ /* send the packet length ( +6 for status words, length, and ctl */
+ SMC_outw ((length + 6), SMC91111_DATA_REG);
+ }

/* send the actual data
. I _think_ it's faster to send the longs first, and then
@@ -691,32 +669,32 @@ again:
. a good idea to check which is optimal? But that could take
. almost as much time as is saved?
*/
-#ifdef USE_32_BIT
- SMC_outsl (SMC91111_DATA_REG, buf, length >> 2);
+ if (is_use_32bit(smc)) {
+ SMC_outsl (SMC91111_DATA_REG, buf, length >> 2);
#ifndef CONFIG_XAENIAX
- if (length & 0x2)
- SMC_outw (*((word *) (buf + (length & 0xFFFFFFFC))),
- SMC91111_DATA_REG);
+ if (length & 0x2)
+ SMC_outw (*((word *) (buf + (length & 0xFFFFFFFC))),
+ SMC91111_DATA_REG);
#else
- /* On XANEIAX, we can only use 32-bit writes, so we need to handle
- * unaligned tail part specially. The standard code doesn't work.
- */
- if ((length & 3) == 3) {
- u16 * ptr = (u16*) &buf[length-3];
- SMC_outl((*ptr) | ((0x2000 | buf[length-1]) << 16),
- SMC91111_DATA_REG);
- } else if ((length & 2) == 2) {
- u16 * ptr = (u16*) &buf[length-2];
- SMC_outl(*ptr, SMC91111_DATA_REG);
- } else if (length & 1) {
- SMC_outl((0x2000 | buf[length-1]), SMC91111_DATA_REG);
+ /* On XANEIAX, we can only use 32-bit writes, so we need to handle
+ * unaligned tail part specially. The standard code doesn't work.
+ */
+ if ((length & 3) == 3) {
+ u16 * ptr = (u16*) &buf[length-3];
+ SMC_outl((*ptr) | ((0x2000 | buf[length-1]) << 16),
+ SMC91111_DATA_REG);
+ } else if ((length & 2) == 2) {
+ u16 * ptr = (u16*) &buf[length-2];
+ SMC_outl(*ptr, SMC91111_DATA_REG);
+ } else if (length & 1) {
+ SMC_outl((0x2000 | buf[length-1]), SMC91111_DATA_REG);
+ } else {
+ SMC_outl(0, SMC91111_DATA_REG);
+ }
+#endif
} else {
- SMC_outl(0, SMC91111_DATA_REG);
+ SMC_outsw (SMC91111_DATA_REG, buf, (length) >> 1);
}
-#endif
-#else
- SMC_outsw (SMC91111_DATA_REG, buf, (length) >> 1);
-#endif /* USE_32_BIT */

#ifndef CONFIG_XAENIAX
/* Send the last byte, if there is one. */
@@ -733,7 +711,7 @@ again:
/* poll for TX INT */
/* if (poll4int (IM_TX_INT, SMC_TX_TIMEOUT)) { */
/* poll for TX_EMPTY INT - autorelease enabled */
- if (poll4int(IM_TX_EMPTY_INT, SMC_TX_TIMEOUT)) {
+ if (poll4int(smc, IM_TX_EMPTY_INT, SMC_TX_TIMEOUT)) {
/* sending failed */
PRINTK2 ("%s: TX timeout, sending failed...\n", SMC_DEV_NAME);

@@ -813,19 +791,24 @@ void smc_destructor()
* Set up everything, reset the card, etc ..
*
*/
-static int smc_open (bd_t * bd)
+static int smc_init(struct eth_device *netdev, bd_t * bd)
{
+ struct smc91111_device *smc = to_smc91111(netdev);
int i, err;

+#ifdef SHARED_RESOURCES
+ swap_to(ETHERNET);
+#endif
+
PRINTK2 ("%s: smc_open\n", SMC_DEV_NAME);

/* reset the hardware */
- smc_reset ();
- smc_enable ();
+ smc_reset (smc);
+ smc_enable (smc);

/* Configure the PHY */
#ifndef CONFIG_SMC91111_EXT_PHY
- smc_phy_configure ();
+ smc_phy_configure (smc);
#endif

/* conservative setting (10Mbps, HalfDuplex, no AutoNeg.) */
@@ -833,21 +816,22 @@ static int smc_open (bd_t * bd)
/* SMC_outw(0, RPC_REG); */
SMC_SELECT_BANK (1);

- err = smc_get_ethaddr (bd); /* set smc_mac_addr, and sync it with u-boot globals */
+ /* set smc_mac_addr, and sync it with u-boot globals */
+ err = smc_get_ethaddr (smc, bd);
if (err < 0)
return -1;
-#ifdef USE_32_BIT
- for (i = 0; i < 6; i += 2) {
- word address;
+ if (is_use_32bit(smc)) {
+ for (i = 0; i < 6; i += 2) {
+ word address;

- address = smc_mac_addr[i + 1] << 8;
- address |= smc_mac_addr[i];
- SMC_outw (address, (ADDR0_REG + i));
+ address = smc_mac_addr[i + 1] << 8;
+ address |= smc_mac_addr[i];
+ SMC_outw (address, (ADDR0_REG + i));
+ }
+ } else {
+ for (i = 0; i < 6; i++)
+ SMC_outb (smc_mac_addr[i], (ADDR0_REG + i));
}
-#else
- for (i = 0; i < 6; i++)
- SMC_outb (smc_mac_addr[i], (ADDR0_REG + i));
-#endif

return 0;
}
@@ -864,15 +848,14 @@ static int smc_open (bd_t * bd)
. o otherwise, read in the packet
--------------------------------------------------------------
*/
-static int smc_rcv()
+static int smc_recv(struct eth_device *netdev)
{
+ struct smc91111_device *smc = to_smc91111(netdev);
int packet_number;
word status;
word packet_length;
int is_error = 0;
-#ifdef USE_32_BIT
dword stat_len;
-#endif
byte saved_pnr;
word saved_ptr;

@@ -893,14 +876,14 @@ static int smc_rcv()
SMC_outw( PTR_READ | PTR_RCV | PTR_AUTOINC, PTR_REG );

/* First two words are status and packet_length */
-#ifdef USE_32_BIT
- stat_len = SMC_inl(SMC91111_DATA_REG);
- status = stat_len & 0xffff;
- packet_length = stat_len >> 16;
-#else
- status = SMC_inw( SMC91111_DATA_REG );
- packet_length = SMC_inw( SMC91111_DATA_REG );
-#endif
+ if (is_use_32bit(smc)) {
+ stat_len = SMC_inl(SMC91111_DATA_REG);
+ status = stat_len & 0xffff;
+ packet_length = stat_len >> 16;
+ } else {
+ status = SMC_inw( SMC91111_DATA_REG );
+ packet_length = SMC_inw( SMC91111_DATA_REG );
+ }

packet_length &= 0x07ff; /* mask off top bits */

@@ -916,29 +899,31 @@ static int smc_rcv()
/* TODO ? */

-#ifdef USE_32_BIT
- PRINTK3(" Reading %d dwords (and %d bytes) \n",
- packet_length >> 2, packet_length & 3 );
- /* QUESTION: Like in the TX routine, do I want
- to send the DWORDs or the bytes first, or some
- mixture. A mixture might improve already slow PIO
- performance */
- SMC_insl( SMC91111_DATA_REG , NetRxPackets[0], packet_length >> 2 );
- /* read the left over bytes */
- if (packet_length & 3) {
- int i;
-
- byte *tail = (byte *)(NetRxPackets[0] + (packet_length & ~3));
- dword leftover = SMC_inl(SMC91111_DATA_REG);
- for (i=0; i<(packet_length & 3); i++)
- *tail++ = (byte) (leftover >> (8*i)) & 0xff;
+ if (is_use_32bit(smc)) {
+ PRINTK3(" Reading %d dwords (and %d bytes) \n",
+ packet_length >> 2, packet_length & 3 );
+ /* QUESTION: Like in the TX routine, do I want
+ to send the DWORDs or the bytes first, or some
+ mixture. A mixture might improve already slow PIO
+ performance */
+ SMC_insl( SMC91111_DATA_REG , NetRxPackets[0],
+ packet_length >> 2 );
+ /* read the left over bytes */
+ if (packet_length & 3) {
+ int i;
+
+ byte *tail = (byte *)(NetRxPackets[0] +
+ (packet_length & ~3));
+ dword leftover = SMC_inl(SMC91111_DATA_REG);
+ for (i=0; i<(packet_length & 3); i++)
+ *tail++ = (byte)(leftover >> (8*i)) & 0xff;
+ }
+ } else {
+ PRINTK3(" Reading %d words and %d byte(s) \n",
+ (packet_length >> 1 ), packet_length & 1 );
+ SMC_insw(SMC91111_DATA_REG , NetRxPackets[0],
+ packet_length >> 1);
}
-#else
- PRINTK3(" Reading %d words and %d byte(s) \n",
- (packet_length >> 1 ), packet_length & 1 );
- SMC_insw(SMC91111_DATA_REG , NetRxPackets[0], packet_length >> 1);
-
-#endif /* USE_32_BIT */

#if SMC_DEBUG > 2
printf("Receiving Packet\n");
@@ -990,14 +975,13 @@ static int smc_rcv()
. an 'ifconfig ethX down'
.
-----------------------------------------------------*/
-static int smc_close()
+static void smc_halt(struct eth_device *netdev)
{
+ struct smc91111_device *smc = to_smc91111(netdev);
PRINTK2("%s: smc_close\n", SMC_DEV_NAME);

/* clear everything */
- smc_shutdown();
-
- return 0;
+ smc_shutdown(smc);
}

@@ -1105,7 +1089,7 @@ static void smc_dump_mii_stream (byte * bits, int size)
. Reads a register from the MII Management serial interface
.-------------------------------------------------------------*/
#ifndef CONFIG_SMC91111_EXT_PHY
-static word smc_read_phy_register (byte phyreg)
+static word smc_read_phy_register (struct smc91111_device *smc, byte phyreg)
{
int oldBank;
int i;
@@ -1115,7 +1099,7 @@ static word smc_read_phy_register (byte phyreg)
int clk_idx = 0;
int input_idx;
word phydata;
- byte phyaddr = SMC_PHY_ADDR;
+ byte phyaddr = smc->phy_addr;

/* 32 consecutive ones on MDO to establish sync */
for (i = 0; i < 32; ++i)
@@ -1222,7 +1206,8 @@ static word smc_read_phy_register (byte phyreg)
/*------------------------------------------------------------
. Writes a register to the MII Management serial interface
.-------------------------------------------------------------*/
-static void smc_write_phy_register (byte phyreg, word phydata)
+static void smc_write_phy_register (struct smc91111_device *smc, byte phyreg,
+ word phydata)
{
int oldBank;
int i;
@@ -1230,7 +1215,7 @@ static void smc_write_phy_register (byte phyreg, word phydata)
word mii_reg;
byte bits[65];
int clk_idx = 0;
- byte phyaddr = SMC_PHY_ADDR;
+ byte phyaddr = smc->phy_addr;

/* 32 consecutive ones on MDO to establish sync */
for (i = 0; i < 32; ++i)
@@ -1345,7 +1330,7 @@ static void smc_wait_ms(unsigned int ms)
. smc_phy_fixed() if the user has requested a certain config.
.-------------------------------------------------------------*/
#ifndef CONFIG_SMC91111_EXT_PHY
-static void smc_phy_configure ()
+static void smc_phy_configure (struct smc91111_device *smc)
{
int timeout;
byte phyaddr;
@@ -1358,15 +1343,15 @@ static void smc_phy_configure ()

/* Get the detected phy address */
- phyaddr = SMC_PHY_ADDR;
+ phyaddr = smc->phy_addr;

/* Reset the PHY, setting all other bits to zero */
- smc_write_phy_register (PHY_CNTL_REG, PHY_CNTL_RST);
+ smc_write_phy_register (smc, PHY_CNTL_REG, PHY_CNTL_RST);

/* Wait for the reset to complete, or time out */
timeout = 6; /* Wait up to 3 seconds */
while (timeout--) {
- if (!(smc_read_phy_register (PHY_CNTL_REG)
+ if (!(smc_read_phy_register (smc, PHY_CNTL_REG)
& PHY_CNTL_RST)) {
/* reset complete */
break;
@@ -1385,14 +1370,14 @@ static void smc_phy_configure ()

/* Enable PHY Interrupts (for register 18) */
/* Interrupts listed here are disabled */
- smc_write_phy_register (PHY_MASK_REG, 0xffff);
+ smc_write_phy_register (smc, PHY_MASK_REG, 0xffff);

/* Configure the Receive/Phy Control register */
SMC_SELECT_BANK (0);
SMC_outw (RPC_DEFAULT, RPC_REG);

/* Copy our capabilities from PHY_STAT_REG to PHY_AD_REG */
- my_phy_caps = smc_read_phy_register (PHY_STAT_REG);
+ my_phy_caps = smc_read_phy_register (smc, PHY_STAT_REG);
my_ad_caps = PHY_AD_CSMA; /* I am CSMA capable */

if (my_phy_caps & PHY_STAT_CAP_T4)
@@ -1411,18 +1396,18 @@ static void smc_phy_configure ()
my_ad_caps |= PHY_AD_10_HDX;

/* Update our Auto-Neg Advertisement Register */
- smc_write_phy_register (PHY_AD_REG, my_ad_caps);
+ smc_write_phy_register (smc, PHY_AD_REG, my_ad_caps);

/* Read the register back. Without this, it appears that when */
/* auto-negotiation is restarted, sometimes it isn't ready and */
/* the link does not come up. */
- smc_read_phy_register(PHY_AD_REG);
+ smc_read_phy_register(smc, PHY_AD_REG);

PRINTK2 ("%s: phy caps=%x\n", SMC_DEV_NAME, my_phy_caps);
PRINTK2 ("%s: phy advertised caps=%x\n", SMC_DEV_NAME, my_ad_caps);

/* Restart auto-negotiation process in order to advertise my caps */
- smc_write_phy_register (PHY_CNTL_REG,
+ smc_write_phy_register (smc, PHY_CNTL_REG,
PHY_CNTL_ANEG_EN | PHY_CNTL_ANEG_RST);

/* Wait for the auto-negotiation to complete. This may take from */
@@ -1431,7 +1416,7 @@ static void smc_phy_configure ()
timeout = CONFIG_SMC_AUTONEG_TIMEOUT * 2;
while (timeout--) {

- status = smc_read_phy_register (PHY_STAT_REG);
+ status = smc_read_phy_register (smc, PHY_STAT_REG);
if (status & PHY_STAT_ANEG_ACK) {
/* auto-negotiate complete */
break;
@@ -1447,7 +1432,8 @@ static void smc_phy_configure ()
/* Restart auto-negotiation */
printf ("%s: PHY restarting auto-negotiation\n",
SMC_DEV_NAME);
- smc_write_phy_register (PHY_CNTL_REG,
+ smc_write_phy_register (smc,
+ PHY_CNTL_REG,
PHY_CNTL_ANEG_EN |
PHY_CNTL_ANEG_RST |
PHY_CNTL_SPEED |
@@ -1512,44 +1498,26 @@ static void print_packet( byte * buf, int length )
}
#endif

-int eth_init(bd_t *bd) {
-#ifdef SHARED_RESOURCES
- swap_to(ETHERNET);
-#endif
- return (smc_open(bd));
-}
-
-void eth_halt() {
- smc_close();
-}
-
-int eth_rx() {
- return smc_rcv();
-}
-
-int eth_send(volatile void *packet, int length) {
- return smc_send_packet(packet, length);
-}
-
-int smc_get_ethaddr (bd_t * bd)
+int smc_get_ethaddr (struct smc91111_device *smc, bd_t * bd)
{
- uchar v_mac[6];
+ struct eth_device *netdev = &smc->netdev;

- if (!eth_getenv_enetaddr("ethaddr", v_mac)) {
+ if (!eth_getenv_num_enetaddr(netdev->index, netdev->enetaddr)) {
/* get ROM mac value if any */
- if (!get_rom_mac(v_mac)) {
+ if (!get_rom_mac(smc, netdev->enetaddr)) {
printf("\n*** ERROR: ethaddr is NOT set !!\n");
return -1;
}
- eth_setenv_enetaddr("ethaddr", v_mac);
+ eth_setenv_num_enetaddr(netdev->index, netdev->enetaddr);
}

- smc_set_mac_addr(v_mac); /* use old function to update smc default */
- PRINTK("Using MAC Address %pM\n", v_mac);
+ /* use old function to update smc default */
+ smc_set_mac_addr(netdev->enetaddr);
+ PRINTK("Using MAC Address %pM\n", netdev->enetaddr);
return 0;
}

-int get_rom_mac (uchar *v_rom_mac)
+int get_rom_mac (struct smc91111_device *smc, uchar *v_rom_mac)
{
#ifdef HARDCODE_MAC /* used for testing or to supress run time warnings */
char hw_mac_addr[] = { 0x02, 0x80, 0xad, 0x20, 0x31, 0xb8 };
@@ -1570,3 +1538,47 @@ int get_rom_mac (uchar *v_rom_mac)
return (valid_mac ? 1 : 0);
#endif
}
+
+int smc91111_initialize(int id, void *regs, int use_32bit)
+{
+ struct smc91111_device *smc;
+ struct eth_device *netdev;
+
+ smc = calloc(1, sizeof(struct smc91111_device));
+ if (!smc) {
+ printf("Error: Failed to allocate memory for smc91111_%d\n", id);
+ return -1;
+ }
+
+ netdev = &smc->netdev;
+
+ smc->regs = regs;
+ smc->phy_addr = 0;
+ smc->id = id;
+ smc->use_32bit = use_32bit;
+
+ sprintf(netdev->name, "smc91111_%d", id);
+ netdev->init = smc_init;
+ netdev->halt = smc_halt;
+ netdev->send = smc_send;
+ netdev->recv = smc_recv;
+
+ eth_register(netdev);
+
+ return 0;
+}
+
+#ifdef CONFIG_SMC_USE_32_BIT
+#define USE_32BIT 1
+#else
+#define USE_32BIT 0
+#endif
+
+int cpu_eth_init(bd_t *bis)
+{
+ int rc = 0;
+
+ rc = smc91111_initialize(0, (void *)CONFIG_SMC91111_BASE, USE_32BIT);
+
+ return rc;
+}
diff --git a/drivers/net/smc91111.h b/drivers/net/smc91111.h
index 967addd..b2ed6a5 100644
--- a/drivers/net/smc91111.h
+++ b/drivers/net/smc91111.h
@@ -72,6 +72,10 @@ typedef unsigned long int dword;

/* Because of bank switching, the LAN91xxx uses only 16 I/O ports */

+#ifndef SMC_BASE_ADDRESS
+#define SMC_BASE_ADDRESS smc->regs
+#endif
+
#define SMC_IO_EXTENT 16

#ifdef CONFIG_PXA250
@@ -301,8 +305,6 @@ typedef unsigned long int dword;

#endif /* CONFIG_SMC_USE_IOFUNCS */

-#if defined(CONFIG_SMC_USE_32_BIT)
-
#ifdef CONFIG_XSENGINE
#define SMC_inl(r) (*((volatile dword *)(SMC_BASE_ADDRESS+(r<<1))))
#else
@@ -331,8 +333,6 @@ typedef unsigned long int dword;
} \
})

-#endif /* CONFIG_SMC_USE_32_BIT */
-
#endif

/*---------------------------------------------------------------
diff --git a/include/configs/ADNPESC1.h b/include/configs/ADNPESC1.h
index b8afc17..664a073 100644
--- a/include/configs/ADNPESC1.h
+++ b/include/configs/ADNPESC1.h
@@ -412,6 +412,7 @@
#if (CONFIG_SYS_NIOS_CPU_LAN0_TYPE == 0) /* LAN91C111 */

#define CONFIG_DRIVER_SMC91111 /* Using SMC91c111 */
+#define CONFIG_NET_MULTI
#undef CONFIG_SMC91111_EXT_PHY /* Internal PHY */
#define CONFIG_SMC91111_BASE (CONFIG_SYS_NIOS_CPU_LAN0_BASE + CONFIG_SYS_NIOS_CPU_LAN0_OFFS)

diff --git a/include/configs/DK1C20.h b/include/configs/DK1C20.h
index 45ff2f7..36e7aa0 100644
--- a/include/configs/DK1C20.h
+++ b/include/configs/DK1C20.h
@@ -218,6 +218,7 @@
#if (CONFIG_SYS_NIOS_CPU_LAN0_TYPE == 0) /* LAN91C111 */

#define CONFIG_DRIVER_SMC91111 /* Using SMC91c111 */
+#define CONFIG_NET_MULTI
#undef CONFIG_SMC91111_EXT_PHY /* Internal PHY */
#define CONFIG_SMC91111_BASE (CONFIG_SYS_NIOS_CPU_LAN0_BASE + CONFIG_SYS_NIOS_CPU_LAN0_OFFS)

diff --git a/include/configs/DK1S10.h b/include/configs/DK1S10.h
index ae567a3..6f74b20 100644
--- a/include/configs/DK1S10.h
+++ b/include/configs/DK1S10.h
@@ -235,6 +235,7 @@
#if (CONFIG_SYS_NIOS_CPU_LAN0_TYPE == 0) /* LAN91C111 */

#define CONFIG_DRIVER_SMC91111 /* Using SMC91c111 */
+#define CONFIG_NET_MULTI
#undef CONFIG_SMC91111_EXT_PHY /* Internal PHY */
#define CONFIG_SMC91111_BASE (CONFIG_SYS_NIOS_CPU_LAN0_BASE + CONFIG_SYS_NIOS_CPU_LAN0_OFFS)

diff --git a/include/configs/EP1C20.h b/include/configs/EP1C20.h
index 8941e4d..fc6cf20 100644
--- a/include/configs/EP1C20.h
+++ b/include/configs/EP1C20.h
@@ -151,6 +151,7 @@
* cache bypass so there's no need to monkey with inx/outx macros.
*----------------------------------------------------------------------*/
#define CONFIG_SMC91111_BASE 0x82110300 /* Base addr (bypass) */
+#define CONFIG_NET_MULTI
#define CONFIG_DRIVER_SMC91111 /* Using SMC91c111 */
#undef CONFIG_SMC91111_EXT_PHY /* Internal PHY */
#define CONFIG_SMC_USE_32_BIT /* 32-bit interface */
diff --git a/include/configs/EP1S10.h b/include/configs/EP1S10.h
index 53bd0d8..21176b1 100644
--- a/include/configs/EP1S10.h
+++ b/include/configs/EP1S10.h
@@ -145,6 +145,7 @@
* cache bypass so there's no need to monkey with inx/outx macros.
*----------------------------------------------------------------------*/
#define CONFIG_SMC91111_BASE 0x82110300 /* Base addr (bypass) */
+#define CONFIG_NET_MULTI
#define CONFIG_DRIVER_SMC91111 /* Using SMC91c111 */
#undef CONFIG_SMC91111_EXT_PHY /* Internal PHY */
#define CONFIG_SMC_USE_32_BIT /* 32-bit interface */
diff --git a/include/configs/EP1S40.h b/include/configs/EP1S40.h
index 9e9a8a4..cbf150a 100644
--- a/include/configs/EP1S40.h
+++ b/include/configs/EP1S40.h
@@ -145,6 +145,7 @@
* cache bypass so there's no need to monkey with inx/outx macros.
*----------------------------------------------------------------------*/
#define CONFIG_SMC91111_BASE 0x82110300 /* Base addr (bypass) */
+#define CONFIG_NET_MULTI
#define CONFIG_DRIVER_SMC91111 /* Using SMC91c111 */
#undef CONFIG_SMC91111_EXT_PHY /* Internal PHY */
#define CONFIG_SMC_USE_32_BIT /* 32-bit interface */
diff --git a/include/configs/MigoR.h b/include/configs/MigoR.h
index 3853574..3324a8c 100644
--- a/include/configs/MigoR.h
+++ b/include/configs/MigoR.h
@@ -51,6 +51,7 @@

/* SMC9111 */
#define CONFIG_DRIVER_SMC91111
+#define CONFIG_NET_MULTI
#define CONFIG_SMC91111_BASE (0xB0000000)

/* MEMORY */
diff --git a/include/configs/PK1C20.h b/include/configs/PK1C20.h
index 522349f..75843a7 100644
--- a/include/configs/PK1C20.h
+++ b/include/configs/PK1C20.h
@@ -151,6 +151,7 @@
* cache bypass so there's no need to monkey with inx/outx macros.
*----------------------------------------------------------------------*/
#define CONFIG_SMC91111_BASE 0x82110300 /* Base addr (bypass) */
+#define CONFIG_NET_MULTI
#define CONFIG_DRIVER_SMC91111 /* Using SMC91c111 */
#undef CONFIG_SMC91111_EXT_PHY /* Internal PHY */
#define CONFIG_SMC_USE_32_BIT /* 32-bit interface */
diff --git a/include/configs/bf533-ezkit.h b/include/configs/bf533-ezkit.h
index f896cb0..532bc77 100644
--- a/include/configs/bf533-ezkit.h
+++ b/include/configs/bf533-ezkit.h
@@ -66,6 +66,7 @@
*/
#define ADI_CMDS_NETWORK 1
#define CONFIG_DRIVER_SMC91111 1
+#define CONFIG_NET_MULTI
#define CONFIG_SMC91111_BASE 0x20310300
#define SMC91111_EEPROM_INIT() \
do { \
diff --git a/include/configs/bf533-stamp.h b/include/configs/bf533-stamp.h
index 4be2a5c..ac2093c 100644
--- a/include/configs/bf533-stamp.h
+++ b/include/configs/bf533-stamp.h
@@ -61,6 +61,7 @@
*/
#define ADI_CMDS_NETWORK 1
#define CONFIG_DRIVER_SMC91111 1
+#define CONFIG_NET_MULTI
#define CONFIG_SMC91111_BASE 0x20300300
#define SMC91111_EEPROM_INIT() \
do { \
diff --git a/include/configs/bf538f-ezkit.h b/include/configs/bf538f-ezkit.h
index 535687f..309c8b8 100644
--- a/include/configs/bf538f-ezkit.h
+++ b/include/configs/bf538f-ezkit.h
@@ -61,6 +61,7 @@
*/
#define ADI_CMDS_NETWORK 1
#define CONFIG_DRIVER_SMC91111 1
+#define CONFIG_NET_MULTI
#define CONFIG_SMC91111_BASE 0x20310300
#define CONFIG_HOSTNAME bf538f-ezkit
/* Uncomment next line to use fixed MAC address */
diff --git a/include/configs/bf561-ezkit.h b/include/configs/bf561-ezkit.h
index 4779a97..9b40d02 100644
--- a/include/configs/bf561-ezkit.h
+++ b/include/configs/bf561-ezkit.h
@@ -61,6 +61,7 @@
*/
#define ADI_CMDS_NETWORK 1
#define CONFIG_DRIVER_SMC91111 1
+#define CONFIG_NET_MULTI
#define CONFIG_SMC91111_BASE 0x2C010300
#define CONFIG_SMC_USE_32_BIT 1
#define CONFIG_HOSTNAME bf561-ezkit
diff --git a/include/configs/blackstamp.h b/include/configs/blackstamp.h
index 887f3fb..789e922 100644
--- a/include/configs/blackstamp.h
+++ b/include/configs/blackstamp.h
@@ -31,6 +31,7 @@
* Board settings
*/
#define CONFIG_DRIVER_SMC91111 1
+#define CONFIG_NET_MULTI
#define CONFIG_SMC91111_BASE 0x20300300

/* FLASH/ETHERNET uses the same address range
diff --git a/include/configs/cerf250.h b/include/configs/cerf250.h
index b924758..6e00679 100644
--- a/include/configs/cerf250.h
+++ b/include/configs/cerf250.h
@@ -54,6 +54,7 @@
* Hardware drivers
*/
#define CONFIG_DRIVER_SMC91111
+#define CONFIG_NET_MULTI
#define CONFIG_SMC91111_BASE 0x04000300
#define CONFIG_SMC_USE_32_BIT

diff --git a/include/configs/cm-bf533.h b/include/configs/cm-bf533.h
index ea548e9..3c670e0 100644
--- a/include/configs/cm-bf533.h
+++ b/include/configs/cm-bf533.h
@@ -61,6 +61,7 @@
*/
#define ADI_CMDS_NETWORK 1
#define CONFIG_DRIVER_SMC91111 1
+#define CONFIG_NET_MULTI
#define CONFIG_SMC91111_BASE 0x20200300
#define CONFIG_HOSTNAME cm-bf533
/* Uncomment next line to use fixed MAC address */
diff --git a/include/configs/cm-bf561.h b/include/configs/cm-bf561.h
index 59dc8d2..8ea7de5 100644
--- a/include/configs/cm-bf561.h
+++ b/include/configs/cm-bf561.h
@@ -62,6 +62,7 @@
#define ADI_CMDS_NETWORK 1
/* The next 2 lines are for use with DEV-BF5xx */
#define CONFIG_DRIVER_SMC91111 1
+#define CONFIG_NET_MULTI
#define CONFIG_SMC91111_BASE 0x28000300
/* The next 3 lines are for use with EXT-BF5xx-USB-ETH2 */
/* #define CONFIG_DRIVER_SMC911X 1 */
diff --git a/include/configs/cradle.h b/include/configs/cradle.h
index b150c22..11db360 100644
--- a/include/configs/cradle.h
+++ b/include/configs/cradle.h
@@ -50,6 +50,7 @@
* Hardware drivers
*/
#define CONFIG_DRIVER_SMC91111
+#define CONFIG_NET_MULTI
#define CONFIG_SMC91111_BASE 0x10000300
#define CONFIG_SMC91111_EXT_PHY
#define CONFIG_SMC_USE_32_BIT
diff --git a/include/configs/delta.h b/include/configs/delta.h
index 95e04f9..3c69a4d 100644
--- a/include/configs/delta.h
+++ b/include/configs/delta.h
@@ -54,6 +54,7 @@
#undef TURN_ON_ETHERNET
#ifdef TURN_ON_ETHERNET
# define CONFIG_DRIVER_SMC91111 1
+# define CONFIG_NET_MULTI
# define CONFIG_SMC91111_BASE 0x14000300
# define CONFIG_SMC91111_EXT_PHY
# define CONFIG_SMC_USE_32_BIT
diff --git a/include/configs/dnp1110.h b/include/configs/dnp1110.h
index b6cfc67..a6af22d 100644
--- a/include/configs/dnp1110.h
+++ b/include/configs/dnp1110.h
@@ -55,6 +55,7 @@
* Hardware drivers
*/
#define CONFIG_DRIVER_SMC91111
+#define CONFIG_NET_MULTI
#define CONFIG_SMC91111_BASE 0x20000300

diff --git a/include/configs/gr_cpci_ax2000.h b/include/configs/gr_cpci_ax2000.h
index bbe635b..79043b9 100644
--- a/include/configs/gr_cpci_ax2000.h
+++ b/include/configs/gr_cpci_ax2000.h
@@ -293,6 +293,7 @@
* Ethernet configuration uses on board SMC91C111
*/
#define CONFIG_DRIVER_SMC91111 1
+#define CONFIG_NET_MULTI
#define CONFIG_SMC91111_BASE 0x20000300 /* chip select 3 */
#define CONFIG_SMC_USE_32_BIT 1 /* 32 bit bus */
#undef CONFIG_SMC_91111_EXT_PHY /* we use internal phy */
diff --git a/include/configs/gr_ep2s60.h b/include/configs/gr_ep2s60.h
index 7b0a08f..aa5edc8 100644
--- a/include/configs/gr_ep2s60.h
+++ b/include/configs/gr_ep2s60.h
@@ -268,6 +268,7 @@

/* USE SMC91C111 MAC */
#define CONFIG_DRIVER_SMC91111 1
+#define CONFIG_NET_MULTI
#define CONFIG_SMC91111_BASE 0x20000300 /* chip select 3 */
#define CONFIG_SMC_USE_32_BIT 1 /* 32 bit bus */
#undef CONFIG_SMC_91111_EXT_PHY /* we use internal phy */
diff --git a/include/configs/innokom.h b/include/configs/innokom.h
index ed03ad3..307a6d8 100644
--- a/include/configs/innokom.h
+++ b/include/configs/innokom.h
@@ -158,6 +158,7 @@
* SMSC91C111 Network Card
*/
#define CONFIG_DRIVER_SMC91111 1
+#define CONFIG_NET_MULTI
#define CONFIG_SMC91111_BASE 0x14000000 /* chip select 5 */
#undef CONFIG_SMC_USE_32_BIT /* 16 bit bus access */
#undef CONFIG_SMC_91111_EXT_PHY /* we use internal phy */
diff --git a/include/configs/integratorcp.h b/include/configs/integratorcp.h
index e38d569..70bf5de 100644
--- a/include/configs/integratorcp.h
+++ b/include/configs/integratorcp.h
@@ -54,6 +54,7 @@
* Hardware drivers
*/
#define CONFIG_DRIVER_SMC91111
+#define CONFIG_NET_MULTI
#define CONFIG_SMC_USE_32_BIT
#define CONFIG_SMC91111_BASE 0xC8000000
#undef CONFIG_SMC91111_EXT_PHY
diff --git a/include/configs/logodl.h b/include/configs/logodl.h
index 5b903f0..6407757 100644
--- a/include/configs/logodl.h
+++ b/include/configs/logodl.h
@@ -134,6 +134,7 @@
*/
#if 0
#define CONFIG_DRIVER_SMC91111 1
+#define CONFIG_NET_MULTI
#define CONFIG_SMC91111_BASE 0x10000000 /* chip select 4 */
#undef CONFIG_SMC_USE_32_BIT /* 16 bit bus access */
#undef CONFIG_SMC_91111_EXT_PHY /* we use internal phy */
diff --git a/include/configs/lpd7a400-10.h b/include/configs/lpd7a400-10.h
index 6145c37..28b6976 100644
--- a/include/configs/lpd7a400-10.h
+++ b/include/configs/lpd7a400-10.h
@@ -73,6 +73,7 @@
* (LAN chip) tied to Vcc, so we just care about the chip select
*/
#define CONFIG_DRIVER_SMC91111
+#define CONFIG_NET_MULTI
#define CONFIG_SMC91111_BASE (0x70000000)
#undef CONFIG_SMC_USE_32_BIT
#define CONFIG_SMC_USE_IOFUNCS
diff --git a/include/configs/lpd7a404-10.h b/include/configs/lpd7a404-10.h
index ce23f3d..33069f6 100644
--- a/include/configs/lpd7a404-10.h
+++ b/include/configs/lpd7a404-10.h
@@ -73,6 +73,7 @@
* (LAN chip) tied to Vcc, so we just care about the chip select
*/
#define CONFIG_DRIVER_SMC91111
+#define CONFIG_NET_MULTI
#define CONFIG_SMC91111_BASE (0x70000000)
#undef CONFIG_SMC_USE_32_BIT
#define CONFIG_SMC_USE_IOFUNCS
diff --git a/include/configs/ms7722se.h b/include/configs/ms7722se.h
index 6755af3..f949cb1 100644
--- a/include/configs/ms7722se.h
+++ b/include/configs/ms7722se.h
@@ -49,6 +49,7 @@

/* SMC9111 */
#define CONFIG_DRIVER_SMC91111
+#define CONFIG_NET_MULTI
#define CONFIG_SMC91111_BASE (0xB8000000)

/* MEMORY */
diff --git a/include/configs/netstar.h b/include/configs/netstar.h
index f0b4207..df0c5b1 100644
--- a/include/configs/netstar.h
+++ b/include/configs/netstar.h
@@ -94,6 +94,7 @@
#define CONFIG_SYS_NS16550_COM1 OMAP1510_UART1_BASE /* uart1 */

#define CONFIG_DRIVER_SMC91111
+#define CONFIG_NET_MULTI
#define CONFIG_SMC91111_BASE 0x04000300

#define CONFIG_SYS_FLASH_BASE PHYS_FLASH_1
diff --git a/include/configs/nhk8815.h b/include/configs/nhk8815.h
index 8a83d92..3309fb7 100644
--- a/include/configs/nhk8815.h
+++ b/include/configs/nhk8815.h
@@ -133,6 +133,7 @@
#define __mem_isa(a) ((a) + PCI_MEMORY_VADDR)

#define CONFIG_DRIVER_SMC91111 /* Using SMC91c111*/
+#define CONFIG_NET_MULTI
#define CONFIG_SMC91111_BASE 0x34000300
#undef CONFIG_SMC91111_EXT_PHY /* Internal PHY */
#define CONFIG_SMC_USE_32_BIT
diff --git a/include/configs/pxa255_idp.h b/include/configs/pxa255_idp.h
index 2cae8ca..1087dd7 100644
--- a/include/configs/pxa255_idp.h
+++ b/include/configs/pxa255_idp.h
@@ -88,6 +88,7 @@
* Hardware drivers
*/
#define CONFIG_DRIVER_SMC91111
+#define CONFIG_NET_MULTI
#define CONFIG_SMC91111_BASE (PXA_CS5_PHYS + IDP_CS5_ETH_OFFSET + 0x300)
#define CONFIG_SMC_USE_32_BIT 1
/* #define CONFIG_SMC_USE_IOFUNCS */
diff --git a/include/configs/versatile.h b/include/configs/versatile.h
index a9b70cc..09c38e6 100644
--- a/include/configs/versatile.h
+++ b/include/configs/versatile.h
@@ -83,6 +83,7 @@
*/

#define CONFIG_DRIVER_SMC91111
+#define CONFIG_NET_MULTI
#define CONFIG_SMC_USE_32_BIT
#define CONFIG_SMC91111_BASE 0x10010000
#undef CONFIG_SMC91111_EXT_PHY
diff --git a/include/configs/voiceblue.h b/include/configs/voiceblue.h
index c9c3132..fd2f1c9 100644
--- a/include/configs/voiceblue.h
+++ b/include/configs/voiceblue.h
@@ -95,6 +95,7 @@
* Hardware drivers
*/
#define CONFIG_DRIVER_SMC91111
+#define CONFIG_NET_MULTI
#define CONFIG_SMC91111_BASE 0x08000300

#define CONFIG_HARD_I2C
diff --git a/include/configs/xaeniax.h b/include/configs/xaeniax.h
index 83883f6..22ea650 100644
--- a/include/configs/xaeniax.h
+++ b/include/configs/xaeniax.h
@@ -197,6 +197,7 @@
* SMSC91C111 Network Card
*/
#define CONFIG_DRIVER_SMC91111 1
+#define CONFIG_NET_MULTI
#define CONFIG_SMC91111_BASE 0x10000300 /* chip select 3 */
#define CONFIG_SMC_USE_32_BIT 1 /* 32 bit bus */
#undef CONFIG_SMC_91111_EXT_PHY /* we use internal phy */
diff --git a/include/configs/xm250.h b/include/configs/xm250.h
index f18701a..36e6c82 100644
--- a/include/configs/xm250.h
+++ b/include/configs/xm250.h
@@ -51,6 +51,7 @@
* Hardware drivers
*/
#define CONFIG_DRIVER_SMC91111
+#define CONFIG_NET_MULTI
#define CONFIG_SMC91111_BASE 0x04000300
#undef CONFIG_SMC91111_EXT_PHY
#define CONFIG_SMC_USE_32_BIT
diff --git a/include/configs/xsengine.h b/include/configs/xsengine.h
index 2697cca..330f6c3 100644
--- a/include/configs/xsengine.h
+++ b/include/configs/xsengine.h
@@ -95,6 +95,7 @@

/* Hardware drivers */
#define CONFIG_DRIVER_SMC91111
+#define CONFIG_NET_MULTI
#define CONFIG_SMC91111_BASE 0x04000300
#define CONFIG_SMC_USE_32_BIT 1

diff --git a/include/configs/zylonite.h b/include/configs/zylonite.h
index 86b6ea1..40478bf 100644
--- a/include/configs/zylonite.h
+++ b/include/configs/zylonite.h
@@ -63,6 +63,7 @@
#undef TURN_ON_ETHERNET
#ifdef TURN_ON_ETHERNET
# define CONFIG_DRIVER_SMC91111 1
+# define CONFIG_NET_MULTI
# define CONFIG_SMC91111_BASE 0x14000300
# define CONFIG_SMC91111_EXT_PHY
# define CONFIG_SMC_USE_32_BIT
diff --git a/include/netdev.h b/include/netdev.h
index 3e66586..834d3c0 100644
--- a/include/netdev.h
+++ b/include/netdev.h
@@ -73,6 +73,7 @@ int rtl8169_initialize(bd_t *bis);
int scc_initialize(bd_t *bis);
int skge_initialize(bd_t *bis);
int smc911x_initialize(u8 dev_num, int base_addr);
+int smc91111_initialize(int id, void *regs, int use_32bit);
int tsi108_eth_initialize(bd_t *bis);
int uec_initialize(int index);
int uec_standard_init(bd_t *bis);
--
1.6.4