驱动位于linux/driver/net下。
1. 寄存器读写
asm/io.h
#define __raw_writeb(v,a) (__chk_io_ptr(a), *(volatile unsigned char __force *)(a) = (v))
#define __raw_readb(a) (__chk_io_ptr(a), *(volatile unsigned char __force *)(a))
db->io_addr = ioremap(db->addr_res->start, iosize);
db->io_data = ioremap(db->data_res->start, iosize);
static u8
ior(board_info_t * db, int reg)
{
writeb(reg, db->io_addr);
return readb(db->io_data);
}
static void
iow(board_info_t * db, int reg, int value)
{
writeb(reg, db->io_addr);
writeb(value, db->io_data);
}
2. 网口初始化