diff options
author | Jens Gehrlein <sew_s@tqs.de> | 2008-05-05 14:06:11 +0200 |
---|---|---|
committer | Ben Warren <biggerbadderben@gmail.com> | 2008-05-22 23:10:01 -0700 |
commit | 557b377d8bfc8b833b6e749457bcdfa298331a24 (patch) | |
tree | ec81af9d6e1a6f0d3d6074bee90c8e6dbb477f47 /drivers/net/smc911x.c | |
parent | 2c8d41969b47eb0b973912830c58689b2ba0e50a (diff) | |
download | u-boot-imx-557b377d8bfc8b833b6e749457bcdfa298331a24.zip u-boot-imx-557b377d8bfc8b833b6e749457bcdfa298331a24.tar.gz u-boot-imx-557b377d8bfc8b833b6e749457bcdfa298331a24.tar.bz2 |
smc911x: add 16 bit support
Signed-off-by: Jens Gehrlein <sew_s@tqs.de>
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
Diffstat (limited to 'drivers/net/smc911x.c')
-rw-r--r-- | drivers/net/smc911x.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c index 5302cb5..6d93bf0 100644 --- a/drivers/net/smc911x.c +++ b/drivers/net/smc911x.c @@ -30,6 +30,12 @@ #include <net.h> #include <miiphy.h> +#if defined (CONFIG_DRIVER_SMC911X_32_BIT) && \ + defined (CONFIG_DRIVER_SMC911X_16_BIT) +#error "SMC911X: Only one of CONFIG_DRIVER_SMC911X_32_BIT and \ + CONFIG_DRIVER_SMC911X_16_BIT shall be set" +#endif + #ifdef CONFIG_DRIVER_SMC911X_32_BIT static inline u32 reg_read(u32 addr) { @@ -39,9 +45,20 @@ static inline void reg_write(u32 addr, u32 val) { *(volatile u32*)addr = val; } +#elif CONFIG_DRIVER_SMC911X_16_BIT +static inline u32 reg_read(u32 addr) +{ + volatile u16 *addr_16 = (u16 *)addr; + return ((*addr_16 & 0x0000ffff) | (*(addr_16 + 1) << 16)); +} +static inline void reg_write(u32 addr, u32 val) +{ + *(volatile u16*)addr = (u16)val; + *(volatile u16*)(addr + 2) = (u16)(val >> 16); +} #else -#error "SMC911X: Only 32-bit bus is supported" -#endif +#error "SMC911X: undefined bus width" +#endif /* CONFIG_DRIVER_SMC911X_16_BIT */ #define mdelay(n) udelay((n)*1000) |