Commit b7ad4109 authored by Nishanth Menon's avatar Nishanth Menon Committed by Ben Warren

NET: LAN91C96 CONFIG_NET_MULTIify

Make the lan91c96 driver capable of CONFIG_NET_MULTI
to be clean for the new arch, add a a lil detect function
Most of the formatting change was done to keep checkpatch
silent, but a few functions and #if 0ed code which
does not make sense for NET_MULTI have been removed

Now, use the lan91c96_initialize() function to init the driver
Signed-off-by: default avatarNishanth Menon <nm@ti.com>
Signed-off-by: default avatarBen Warren <biggerbadderben@gmail.com>
parent 6ac59c55
......@@ -44,7 +44,7 @@ COBJS-$(CONFIG_GRETH) += greth.o
COBJS-$(CONFIG_INCA_IP_SWITCH) += inca-ip_sw.o
COBJS-$(CONFIG_KIRKWOOD_EGIGA) += kirkwood_egiga.o
COBJS-$(CONFIG_DRIVER_KS8695ETH) += ks8695eth.o
COBJS-$(CONFIG_DRIVER_LAN91C96) += lan91c96.o
COBJS-$(CONFIG_LAN91C96) += lan91c96.o
COBJS-$(CONFIG_MACB) += macb.o
COBJS-$(CONFIG_MCFFEC) += mcffec.o mcfmii.o
COBJS-$(CONFIG_MPC5xxx_FEC) += mpc5xxx_fec.o
......
This diff is collapsed.
......@@ -46,14 +46,6 @@
#include <asm/io.h>
#include <config.h>
/*
* This function may be called by the board specific initialisation code
* in order to override the default mac address.
*/
void smc_set_mac_addr(const unsigned char *addr);
/* I want some simple types */
typedef unsigned char byte;
......@@ -86,66 +78,71 @@ typedef unsigned long int dword;
#define SMC_IO_SHIFT 0
#endif
#define SMCREG(r) (SMC_BASE_ADDRESS+((r)<<SMC_IO_SHIFT))
#define SMCREG(edev, r) ((edev)->iobase+((r)<<SMC_IO_SHIFT))
#define SMC_inl(r) (*((volatile dword *)SMCREG(r)))
#define SMC_inw(r) (*((volatile word *)SMCREG(r)))
#define SMC_inb(p) ({ \
#define SMC_inl(edev, r) (*((volatile dword *)SMCREG(edev, r)))
#define SMC_inw(edev, r) (*((volatile word *)SMCREG(edev, r)))
#define SMC_inb(edev, p) ({ \
unsigned int __p = p; \
unsigned int __v = SMC_inw(__p & ~1); \
unsigned int __v = SMC_inw(edev, __p & ~1); \
if (__p & 1) __v >>= 8; \
else __v &= 0xff; \
__v; })
#define SMC_outl(d,r) (*((volatile dword *)SMCREG(r)) = d)
#define SMC_outw(d,r) (*((volatile word *)SMCREG(r)) = d)
#define SMC_outb(d,r) ({ word __d = (byte)(d); \
word __w = SMC_inw((r)&~1); \
#define SMC_outl(edev, d, r) (*((volatile dword *)SMCREG(edev, r)) = d)
#define SMC_outw(edev, d, r) (*((volatile word *)SMCREG(edev, r)) = d)
#define SMC_outb(edev, d, r) ({ word __d = (byte)(d); \
word __w = SMC_inw(edev, (r)&~1); \
__w &= ((r)&1) ? 0x00FF : 0xFF00; \
__w |= ((r)&1) ? __d<<8 : __d; \
SMC_outw(__w,(r)&~1); \
SMC_outw(edev, __w, (r)&~1); \
})
#define SMC_outsl(r,b,l) ({ int __i; \
#define SMC_outsl(edev, r, b, l) ({ int __i; \
dword *__b2; \
__b2 = (dword *) b; \
for (__i = 0; __i < l; __i++) { \
SMC_outl( *(__b2 + __i), r ); \
SMC_outl(edev, *(__b2 + __i),\
r); \
} \
})
#define SMC_outsw(r,b,l) ({ int __i; \
#define SMC_outsw(edev, r, b, l) ({ int __i; \
word *__b2; \
__b2 = (word *) b; \
for (__i = 0; __i < l; __i++) { \
SMC_outw( *(__b2 + __i), r ); \
SMC_outw(edev, *(__b2 + __i),\
r); \
} \
})
#define SMC_insl(r,b,l) ({ int __i ; \
#define SMC_insl(edev, r, b, l) ({ int __i ; \
dword *__b2; \
__b2 = (dword *) b; \
for (__i = 0; __i < l; __i++) { \
*(__b2 + __i) = SMC_inl(r); \
SMC_inl(0); \
*(__b2 + __i) = SMC_inl(edev,\
r); \
SMC_inl(edev, 0); \
}; \
})
#define SMC_insw(r,b,l) ({ int __i ; \
#define SMC_insw(edev, r, b, l) ({ int __i ; \
word *__b2; \
__b2 = (word *) b; \
for (__i = 0; __i < l; __i++) { \
*(__b2 + __i) = SMC_inw(r); \
SMC_inw(0); \
*(__b2 + __i) = SMC_inw(edev,\
r); \
SMC_inw(edev, 0); \
}; \
})
#define SMC_insb(r,b,l) ({ int __i ; \
#define SMC_insb(edev, r, b, l) ({ int __i ; \
byte *__b2; \
__b2 = (byte *) b; \
for (__i = 0; __i < l; __i++) { \
*(__b2 + __i) = SMC_inb(r); \
SMC_inb(0); \
*(__b2 + __i) = SMC_inb(edev,\
r); \
SMC_inb(edev, 0); \
}; \
})
......@@ -155,40 +152,35 @@ typedef unsigned long int dword;
* We have only 16 Bit PCMCIA access on Socket 0
*/
#define SMC_inw(r) (*((volatile word *)(SMC_BASE_ADDRESS+(r))))
#define SMC_inb(r) (((r)&1) ? SMC_inw((r)&~1)>>8 : SMC_inw(r)&0xFF)
#define SMC_inw(edev, r) (*((volatile word *)((edev)->iobase+(r))))
#define SMC_inb(edev, r) (((r)&1) ? SMC_inw(edev, (r)&~1)>>8 :\
SMC_inw(edev, r)&0xFF)
#define SMC_outw(d,r) (*((volatile word *)(SMC_BASE_ADDRESS+(r))) = d)
#define SMC_outb(d,r) ({ word __d = (byte)(d); \
word __w = SMC_inw((r)&~1); \
#define SMC_outw(edev, d, r) (*((volatile word *)((edev)->iobase+(r))) = d)
#define SMC_outb(edev, d, r) ({ word __d = (byte)(d); \
word __w = SMC_inw(edev, (r)&~1); \
__w &= ((r)&1) ? 0x00FF : 0xFF00; \
__w |= ((r)&1) ? __d<<8 : __d; \
SMC_outw(__w,(r)&~1); \
SMC_outw(edev, __w, (r)&~1); \
})
#if 0
#define SMC_outsw(r,b,l) outsw(SMC_BASE_ADDRESS+(r), (b), (l))
#else
#define SMC_outsw(r,b,l) ({ int __i; \
#define SMC_outsw(edev, r, b, l) ({ int __i; \
word *__b2; \
__b2 = (word *) b; \
for (__i = 0; __i < l; __i++) { \
SMC_outw( *(__b2 + __i), r); \
SMC_outw(edev, *(__b2 + __i),\
r); \
} \
})
#endif
#if 0
#define SMC_insw(r,b,l) insw(SMC_BASE_ADDRESS+(r), (b), (l))
#else
#define SMC_insw(r,b,l) ({ int __i ; \
#define SMC_insw(edev, r, b, l) ({ int __i ; \
word *__b2; \
__b2 = (word *) b; \
for (__i = 0; __i < l; __i++) { \
*(__b2 + __i) = SMC_inw(r); \
SMC_inw(0); \
*(__b2 + __i) = SMC_inw(edev,\
r); \
SMC_inw(edev, 0); \
}; \
})
#endif
#endif
......@@ -608,25 +600,25 @@ typedef unsigned long int dword;
/* select a register bank, 0 to 3 */
#define SMC_SELECT_BANK(x) { SMC_outw( x, LAN91C96_BANK_SELECT ); }
#define SMC_SELECT_BANK(edev, x) { SMC_outw(edev, x, LAN91C96_BANK_SELECT); }
/* this enables an interrupt in the interrupt mask register */
#define SMC_ENABLE_INT(x) {\
#define SMC_ENABLE_INT(edev, x) {\
unsigned char mask;\
SMC_SELECT_BANK(2);\
mask = SMC_inb( LAN91C96_INT_MASK );\
SMC_SELECT_BANK(edev, 2);\
mask = SMC_inb(edev, LAN91C96_INT_MASK);\
mask |= (x);\
SMC_outb( mask, LAN91C96_INT_MASK ); \
SMC_outb(edev, mask, LAN91C96_INT_MASK); \
}
/* this disables an interrupt from the interrupt mask register */
#define SMC_DISABLE_INT(x) {\
#define SMC_DISABLE_INT(edev, x) {\
unsigned char mask;\
SMC_SELECT_BANK(2);\
mask = SMC_inb( LAN91C96_INT_MASK );\
SMC_SELECT_BANK(edev, 2);\
mask = SMC_inb(edev, LAN91C96_INT_MASK);\
mask &= ~(x);\
SMC_outb( mask, LAN91C96_INT_MASK ); \
SMC_outb(edev, mask, LAN91C96_INT_MASK); \
}
/*----------------------------------------------------------------------
......
......@@ -57,6 +57,7 @@ int greth_initialize(bd_t *bis);
void gt6426x_eth_initialize(bd_t *bis);
int inca_switch_initialize(bd_t *bis);
int kirkwood_egiga_initialize(bd_t *bis);
int lan91c96_initialize(u8 dev_num, int base_addr);
int macb_eth_initialize(int id, void *regs, unsigned int phy_addr);
int mcdmafec_initialize(bd_t *bis);
int mcffec_initialize(bd_t *bis);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment