aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-pxa2xx.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/spi/spi-pxa2xx.h')
-rw-r--r--drivers/spi/spi-pxa2xx.h34
1 files changed, 13 insertions, 21 deletions
diff --git a/drivers/spi/spi-pxa2xx.h b/drivers/spi/spi-pxa2xx.h
index 6bec59c90cd4..85a58c906869 100644
--- a/drivers/spi/spi-pxa2xx.h
+++ b/drivers/spi/spi-pxa2xx.h
@@ -115,23 +115,17 @@ struct chip_data {
115 void (*cs_control)(u32 command); 115 void (*cs_control)(u32 command);
116}; 116};
117 117
118#define DEFINE_SSP_REG(reg, off) \ 118static inline u32 pxa2xx_spi_read(const struct driver_data *drv_data,
119static inline u32 read_##reg(void const __iomem *p) \ 119 unsigned reg)
120{ return __raw_readl(p + (off)); } \ 120{
121\ 121 return __raw_readl(drv_data->ioaddr + reg);
122static inline void write_##reg(u32 v, void __iomem *p) \ 122}
123{ __raw_writel(v, p + (off)); } 123
124 124static inline void pxa2xx_spi_write(const struct driver_data *drv_data,
125DEFINE_SSP_REG(SSCR0, 0x00) 125 unsigned reg, u32 val)
126DEFINE_SSP_REG(SSCR1, 0x04) 126{
127DEFINE_SSP_REG(SSSR, 0x08) 127 __raw_writel(val, drv_data->ioaddr + reg);
128DEFINE_SSP_REG(SSITR, 0x0c) 128}
129DEFINE_SSP_REG(SSDR, 0x10)
130DEFINE_SSP_REG(DDS_RATE, 0x28) /* DDS Clock Rate */
131DEFINE_SSP_REG(SSTO, 0x28)
132DEFINE_SSP_REG(SSPSP, 0x2c)
133DEFINE_SSP_REG(SSITF, SSITF)
134DEFINE_SSP_REG(SSIRF, SSIRF)
135 129
136#define START_STATE ((void *)0) 130#define START_STATE ((void *)0)
137#define RUNNING_STATE ((void *)1) 131#define RUNNING_STATE ((void *)1)
@@ -155,13 +149,11 @@ static inline int pxa25x_ssp_comp(struct driver_data *drv_data)
155 149
156static inline void write_SSSR_CS(struct driver_data *drv_data, u32 val) 150static inline void write_SSSR_CS(struct driver_data *drv_data, u32 val)
157{ 151{
158 void __iomem *reg = drv_data->ioaddr;
159
160 if (drv_data->ssp_type == CE4100_SSP || 152 if (drv_data->ssp_type == CE4100_SSP ||
161 drv_data->ssp_type == QUARK_X1000_SSP) 153 drv_data->ssp_type == QUARK_X1000_SSP)
162 val |= read_SSSR(reg) & SSSR_ALT_FRM_MASK; 154 val |= pxa2xx_spi_read(drv_data, SSSR) & SSSR_ALT_FRM_MASK;
163 155
164 write_SSSR(val, reg); 156 pxa2xx_spi_write(drv_data, SSSR, val);
165} 157}
166 158
167extern int pxa2xx_spi_flush(struct driver_data *drv_data); 159extern int pxa2xx_spi_flush(struct driver_data *drv_data);