diff options
author | Alan Cox <alan@linux.intel.com> | 2009-08-06 19:45:24 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-09-15 19:02:12 (GMT) |
commit | 79de99e864fb731392bec78f251ce0310fed5d9a (patch) | |
tree | baab22d5f5dac0feaf578686fb0344dca9d344ce /drivers/staging/sep/sep_dev.h | |
parent | f5e3980f9b28b703bc009af9dfa33ae2236503da (diff) | |
download | linux-79de99e864fb731392bec78f251ce0310fed5d9a.tar.xz |
Staging: sep: rework write_register/read_register
Replace the macros with an inline to get type safety and pass sep_dev
instead of the reg pointer
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/sep/sep_dev.h')
-rw-r--r-- | drivers/staging/sep/sep_dev.h | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/drivers/staging/sep/sep_dev.h b/drivers/staging/sep/sep_dev.h index b3d48e1..1baff89 100644 --- a/drivers/staging/sep/sep_dev.h +++ b/drivers/staging/sep/sep_dev.h @@ -60,7 +60,7 @@ struct sep_device { unsigned long rar_region_addr; /* start address of the access to the SEP registers from driver */ - unsigned long reg_base_address; + void __iomem *reg_base_address; /* transaction counter that coordinates the transactions between SEP and HOST */ unsigned long host_to_sep_send_counter; /* counter for the messages from sep */ @@ -103,17 +103,27 @@ struct sep_device { extern struct sep_device *sep_dev; -extern inline void sep_write_reg(struct sep_device *dev, int reg, u32 value) +static inline void sep_write_reg(struct sep_device *dev, int reg, u32 value) { void __iomem *addr = dev->reg_base_address + reg; - writel(value, reg); + writel(value, addr); } -extern inline u32 sep_read_reg(struct sep_device *dev, int reg) +static inline u32 sep_read_reg(struct sep_device *dev, int reg) { void __iomem *addr = dev->reg_base_address + reg; - return readl(reg); + return readl(addr); } +/* wait for SRAM write complete(indirect write */ +static inline void sep_wait_sram_write(struct sep_device *dev) +{ + u32 reg_val; + do + reg_val = sep_read_reg(dev, HW_SRAM_DATA_READY_REG_ADDR); + while(!(reg_val & 1)); +} + + #endif |