#include <linux/module.h>
#include <linux/init.h>
#include <asm/io.h>
MODULE_LICENSE("GPL");
MODULE_AUTHOR("David cheng");
MODULE_DESCRIPTION("DM368 i2c register read module");
MODULE_ALIAS("a simple module");
#define I2C_BASE 0x01c71000
#define I2C_SIZE 100
static int hello_init(void)
{
void __iomem *pI2cBase;
int i = 0;
unsigned int muxval;
pI2cBase = ioremap(I2C_BASE, I2C_SIZE);
printk("before read \n");
for (i = 1; i < 20; i++)
{
muxval = __raw_readl(pI2cBase + 0x04 * i);
printk("read completely value: 0x%.8x \n", muxval);
}
return 0;
}
static int hello_exit(void)
{
printk("Goodbye, cruel world\n");
return 0;
}
module_init(hello_init);
module_exit(hello_exit);