aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorThomas Chou <thomas@wytron.com.tw>2009-10-07 10:16:42 -0400
committerDavid S. Miller <davem@davemloft.net>2009-10-19 00:24:14 -0400
commit16dd18b0837dee46f1a6b0c01830c5f2b7187266 (patch)
tree81b5c96ba5f0aacab71237fdc8a7724d6be4c9a9 /drivers
parentf6965582ac9b87d875aac8e23afdb03fe35ee33d (diff)
ethoc: inline regs access
Signed-off-by: Thomas Chou <thomas@wytron.com.tw> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethoc.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/net/ethoc.c b/drivers/net/ethoc.c
index 1d338c6f5314..88a1c5223069 100644
--- a/drivers/net/ethoc.c
+++ b/drivers/net/ethoc.c
@@ -222,24 +222,25 @@ struct ethoc_bd {
222 u32 addr; 222 u32 addr;
223}; 223};
224 224
225static u32 ethoc_read(struct ethoc *dev, loff_t offset) 225static inline u32 ethoc_read(struct ethoc *dev, loff_t offset)
226{ 226{
227 return ioread32(dev->iobase + offset); 227 return ioread32(dev->iobase + offset);
228} 228}
229 229
230static void ethoc_write(struct ethoc *dev, loff_t offset, u32 data) 230static inline void ethoc_write(struct ethoc *dev, loff_t offset, u32 data)
231{ 231{
232 iowrite32(data, dev->iobase + offset); 232 iowrite32(data, dev->iobase + offset);
233} 233}
234 234
235static void ethoc_read_bd(struct ethoc *dev, int index, struct ethoc_bd *bd) 235static inline void ethoc_read_bd(struct ethoc *dev, int index,
236 struct ethoc_bd *bd)
236{ 237{
237 loff_t offset = ETHOC_BD_BASE + (index * sizeof(struct ethoc_bd)); 238 loff_t offset = ETHOC_BD_BASE + (index * sizeof(struct ethoc_bd));
238 bd->stat = ethoc_read(dev, offset + 0); 239 bd->stat = ethoc_read(dev, offset + 0);
239 bd->addr = ethoc_read(dev, offset + 4); 240 bd->addr = ethoc_read(dev, offset + 4);
240} 241}
241 242
242static void ethoc_write_bd(struct ethoc *dev, int index, 243static inline void ethoc_write_bd(struct ethoc *dev, int index,
243 const struct ethoc_bd *bd) 244 const struct ethoc_bd *bd)
244{ 245{
245 loff_t offset = ETHOC_BD_BASE + (index * sizeof(struct ethoc_bd)); 246 loff_t offset = ETHOC_BD_BASE + (index * sizeof(struct ethoc_bd));
@@ -247,33 +248,33 @@ static void ethoc_write_bd(struct ethoc *dev, int index,
247 ethoc_write(dev, offset + 4, bd->addr); 248 ethoc_write(dev, offset + 4, bd->addr);
248} 249}
249 250
250static void ethoc_enable_irq(struct ethoc *dev, u32 mask) 251static inline void ethoc_enable_irq(struct ethoc *dev, u32 mask)
251{ 252{
252 u32 imask = ethoc_read(dev, INT_MASK); 253 u32 imask = ethoc_read(dev, INT_MASK);
253 imask |= mask; 254 imask |= mask;
254 ethoc_write(dev, INT_MASK, imask); 255 ethoc_write(dev, INT_MASK, imask);
255} 256}
256 257
257static void ethoc_disable_irq(struct ethoc *dev, u32 mask) 258static inline void ethoc_disable_irq(struct ethoc *dev, u32 mask)
258{ 259{
259 u32 imask = ethoc_read(dev, INT_MASK); 260 u32 imask = ethoc_read(dev, INT_MASK);
260 imask &= ~mask; 261 imask &= ~mask;
261 ethoc_write(dev, INT_MASK, imask); 262 ethoc_write(dev, INT_MASK, imask);
262} 263}
263 264
264static void ethoc_ack_irq(struct ethoc *dev, u32 mask) 265static inline void ethoc_ack_irq(struct ethoc *dev, u32 mask)
265{ 266{
266 ethoc_write(dev, INT_SOURCE, mask); 267 ethoc_write(dev, INT_SOURCE, mask);
267} 268}
268 269
269static void ethoc_enable_rx_and_tx(struct ethoc *dev) 270static inline void ethoc_enable_rx_and_tx(struct ethoc *dev)
270{ 271{
271 u32 mode = ethoc_read(dev, MODER); 272 u32 mode = ethoc_read(dev, MODER);
272 mode |= MODER_RXEN | MODER_TXEN; 273 mode |= MODER_RXEN | MODER_TXEN;
273 ethoc_write(dev, MODER, mode); 274 ethoc_write(dev, MODER, mode);
274} 275}
275 276
276static void ethoc_disable_rx_and_tx(struct ethoc *dev) 277static inline void ethoc_disable_rx_and_tx(struct ethoc *dev)
277{ 278{
278 u32 mode = ethoc_read(dev, MODER); 279 u32 mode = ethoc_read(dev, MODER);
279 mode &= ~(MODER_RXEN | MODER_TXEN); 280 mode &= ~(MODER_RXEN | MODER_TXEN);