put it in “include/linux” #include linux/mydebug.h>
#define __MYDEBUG__
#ifdef __MYDEBUG__
#define MYDEBUG(format,...) printk("File: "__FILE__", Line: %05d: "format"\n", __LINE__, ##__VA_ARGS__)
#else
#define MYDEBUG(format,...)
#endif
MYDEBUG("dev name is %s", dev_name(&pdev->dev));
static inline const char *dev_name(const struct device *dev)
{
/* Use the init name until the kobject becomes available */
if (dev->init_name)
return dev->init_name;
return kobject_name(&dev->kobj);
}
static void rvin_write(struct rvin_dev *vin, u32 value, u32 offset)
{
iowrite32(value, vin->base + offset);
}
static u32 rvin_read(struct rvin_dev *vin, u32 offset)
{
return ioread32(vin->base + offset);
}
struct rvin_dev {
struct device *dev;
void __iomem *base;
......}
u32 vnmc;
vnmc = rvin_read(vin, VNMC_REG);
rvin_write(vin, vnmc & ~(VNMC_SCLE | VNMC_VUP), VNMC_REG);
static int my_read_register(unsigned long addr, size_t size, const char *name)
{
void __iomem *p;
unsigned long value = 0;
// if (!request_mem_region(addr, size, name)){
// return -EINVAL;
// }
p = ioremap(addr, size);
if (p) {
value = ioread32(p);
}
iounmap(p);
return value;
}
unsigned long vindm;
unsigned long addr_vindm = 0;
addr_phyim = 0xFEAA0184;
phyim = my_read_register(addr_phyim, 4, "PHYDIM");
MYDEBUG("Value of phyim is %x", phyim);
MYDEBUG("lcnt: %x", ioread32(priv->base + 0x0160));
static void __iomem *baseaddr;
if (!request_mem_region(GPJ0CON_PA, 8, "GPJ0BASE"))
return -EINVAL;
baseaddr = ioremap(GPJ0CON_PA, 8);
writel(0x11111111, baseaddr + S5P_GPJ0CON);