Skip to content

Commit

Permalink
ethoc: inline regs access
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Chou <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
hippo5329 authored and davem330 committed Oct 19, 2009
1 parent f696558 commit 16dd18b
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions drivers/net/ethoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,58 +222,59 @@ struct ethoc_bd {
u32 addr;
};

static u32 ethoc_read(struct ethoc *dev, loff_t offset)
static inline u32 ethoc_read(struct ethoc *dev, loff_t offset)
{
return ioread32(dev->iobase + offset);
}

static void ethoc_write(struct ethoc *dev, loff_t offset, u32 data)
static inline void ethoc_write(struct ethoc *dev, loff_t offset, u32 data)
{
iowrite32(data, dev->iobase + offset);
}

static void ethoc_read_bd(struct ethoc *dev, int index, struct ethoc_bd *bd)
static inline void ethoc_read_bd(struct ethoc *dev, int index,
struct ethoc_bd *bd)
{
loff_t offset = ETHOC_BD_BASE + (index * sizeof(struct ethoc_bd));
bd->stat = ethoc_read(dev, offset + 0);
bd->addr = ethoc_read(dev, offset + 4);
}

static void ethoc_write_bd(struct ethoc *dev, int index,
static inline void ethoc_write_bd(struct ethoc *dev, int index,
const struct ethoc_bd *bd)
{
loff_t offset = ETHOC_BD_BASE + (index * sizeof(struct ethoc_bd));
ethoc_write(dev, offset + 0, bd->stat);
ethoc_write(dev, offset + 4, bd->addr);
}

static void ethoc_enable_irq(struct ethoc *dev, u32 mask)
static inline void ethoc_enable_irq(struct ethoc *dev, u32 mask)
{
u32 imask = ethoc_read(dev, INT_MASK);
imask |= mask;
ethoc_write(dev, INT_MASK, imask);
}

static void ethoc_disable_irq(struct ethoc *dev, u32 mask)
static inline void ethoc_disable_irq(struct ethoc *dev, u32 mask)
{
u32 imask = ethoc_read(dev, INT_MASK);
imask &= ~mask;
ethoc_write(dev, INT_MASK, imask);
}

static void ethoc_ack_irq(struct ethoc *dev, u32 mask)
static inline void ethoc_ack_irq(struct ethoc *dev, u32 mask)
{
ethoc_write(dev, INT_SOURCE, mask);
}

static void ethoc_enable_rx_and_tx(struct ethoc *dev)
static inline void ethoc_enable_rx_and_tx(struct ethoc *dev)
{
u32 mode = ethoc_read(dev, MODER);
mode |= MODER_RXEN | MODER_TXEN;
ethoc_write(dev, MODER, mode);
}

static void ethoc_disable_rx_and_tx(struct ethoc *dev)
static inline void ethoc_disable_rx_and_tx(struct ethoc *dev)
{
u32 mode = ethoc_read(dev, MODER);
mode &= ~(MODER_RXEN | MODER_TXEN);
Expand Down

0 comments on commit 16dd18b

Please sign in to comment.