diff options
author | Mike Frysinger <vapier.adi@gmail.com> | 2008-11-17 16:23:40 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-20 04:32:34 -0500 |
commit | a61fc1e995e6ccc884df50a1609b831a4b45a600 (patch) | |
tree | 18b0d94d93a1c0ca4e648747c0402e66d50e0d55 /drivers | |
parent | 3d3e35aa78c9498eed3209c9d82376085ed0c36f (diff) |
netdev/smc91x: unify Blackfin code a bit and use proper read/write functions
Signed-off-by: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/smc91x.h | 45 |
1 files changed, 12 insertions, 33 deletions
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h index a07cc9351c6b..f6d637968eda 100644 --- a/drivers/net/smc91x.h +++ b/drivers/net/smc91x.h | |||
@@ -87,49 +87,28 @@ static inline void SMC_outw(u16 val, void __iomem *ioaddr, int reg) | |||
87 | #define RPC_LSA_DEFAULT RPC_LED_100_10 | 87 | #define RPC_LSA_DEFAULT RPC_LED_100_10 |
88 | #define RPC_LSB_DEFAULT RPC_LED_TX_RX | 88 | #define RPC_LSB_DEFAULT RPC_LED_TX_RX |
89 | 89 | ||
90 | # if defined (CONFIG_BFIN561_EZKIT) | ||
91 | #define SMC_CAN_USE_8BIT 0 | 90 | #define SMC_CAN_USE_8BIT 0 |
92 | #define SMC_CAN_USE_16BIT 1 | 91 | #define SMC_CAN_USE_16BIT 1 |
92 | # if defined(CONFIG_BF561) | ||
93 | #define SMC_CAN_USE_32BIT 1 | 93 | #define SMC_CAN_USE_32BIT 1 |
94 | #define SMC_IO_SHIFT 0 | ||
95 | #define SMC_NOWAIT 1 | ||
96 | #define SMC_USE_BFIN_DMA 0 | ||
97 | |||
98 | |||
99 | #define SMC_inw(a, r) readw((a) + (r)) | ||
100 | #define SMC_outw(v, a, r) writew(v, (a) + (r)) | ||
101 | #define SMC_inl(a, r) readl((a) + (r)) | ||
102 | #define SMC_outl(v, a, r) writel(v, (a) + (r)) | ||
103 | #define SMC_outsl(a, r, p, l) outsl((unsigned long *)((a) + (r)), p, l) | ||
104 | #define SMC_insl(a, r, p, l) insl ((unsigned long *)((a) + (r)), p, l) | ||
105 | # else | 94 | # else |
106 | #define SMC_CAN_USE_8BIT 0 | ||
107 | #define SMC_CAN_USE_16BIT 1 | ||
108 | #define SMC_CAN_USE_32BIT 0 | 95 | #define SMC_CAN_USE_32BIT 0 |
96 | # endif | ||
109 | #define SMC_IO_SHIFT 0 | 97 | #define SMC_IO_SHIFT 0 |
110 | #define SMC_NOWAIT 1 | 98 | #define SMC_NOWAIT 1 |
111 | #define SMC_USE_BFIN_DMA 0 | 99 | #define SMC_USE_BFIN_DMA 0 |
112 | 100 | ||
113 | 101 | #define SMC_inw(a, r) readw((a) + (r)) | |
114 | #define SMC_inw(a, r) readw((a) + (r)) | 102 | #define SMC_outw(v, a, r) writew(v, (a) + (r)) |
115 | #define SMC_outw(v, a, r) writew(v, (a) + (r)) | 103 | #define SMC_insw(a, r, p, l) readsw((a) + (r), p, l) |
116 | #define SMC_outsw(a, r, p, l) outsw((unsigned long *)((a) + (r)), p, l) | 104 | #define SMC_outsw(a, r, p, l) writesw((a) + (r), p, l) |
117 | #define SMC_insw(a, r, p, l) insw ((unsigned long *)((a) + (r)), p, l) | 105 | # if SMC_CAN_USE_32BIT |
106 | #define SMC_inl(a, r) readl((a) + (r)) | ||
107 | #define SMC_outl(v, a, r) writel(v, (a) + (r)) | ||
108 | #define SMC_insl(a, r, p, l) readsl((a) + (r), p, l) | ||
109 | #define SMC_outsl(a, r, p, l) writesl((a) + (r), p, l) | ||
118 | # endif | 110 | # endif |
119 | /* check if the mac in reg is valid */ | 111 | |
120 | #define SMC_GET_MAC_ADDR(lp, addr) \ | ||
121 | do { \ | ||
122 | unsigned int __v; \ | ||
123 | __v = SMC_inw(ioaddr, ADDR0_REG(lp)); \ | ||
124 | addr[0] = __v; addr[1] = __v >> 8; \ | ||
125 | __v = SMC_inw(ioaddr, ADDR1_REG(lp)); \ | ||
126 | addr[2] = __v; addr[3] = __v >> 8; \ | ||
127 | __v = SMC_inw(ioaddr, ADDR2_REG(lp)); \ | ||
128 | addr[4] = __v; addr[5] = __v >> 8; \ | ||
129 | if (*(u32 *)(&addr[0]) == 0xFFFFFFFF) { \ | ||
130 | random_ether_addr(addr); \ | ||
131 | } \ | ||
132 | } while (0) | ||
133 | #elif defined(CONFIG_REDWOOD_5) || defined(CONFIG_REDWOOD_6) | 112 | #elif defined(CONFIG_REDWOOD_5) || defined(CONFIG_REDWOOD_6) |
134 | 113 | ||
135 | /* We can only do 16-bit reads and writes in the static memory space. */ | 114 | /* We can only do 16-bit reads and writes in the static memory space. */ |