diff options
author | Mike Frysinger <vapier@gentoo.org> | 2010-10-18 02:45:22 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2010-10-18 02:49:44 -0400 |
commit | 9c0a788b4315b83f6138ffa15c56ccf541106e58 (patch) | |
tree | 0ded6b5962366530454cef092b09046ac1d83ec8 /drivers/spi | |
parent | 6f7c17f4f91513247dfec52d6968cd70d5251b38 (diff) |
spi/bfin_spi: namespace local structs
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spi_bfin5xx.c | 119 |
1 files changed, 61 insertions, 58 deletions
diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c index d17ab37d3f64..ab483a0ec6d0 100644 --- a/drivers/spi/spi_bfin5xx.c +++ b/drivers/spi/spi_bfin5xx.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Blackfin On-Chip SPI Driver | 2 | * Blackfin On-Chip SPI Driver |
3 | * | 3 | * |
4 | * Copyright 2004-2007 Analog Devices Inc. | 4 | * Copyright 2004-2010 Analog Devices Inc. |
5 | * | 5 | * |
6 | * Enter bugs at http://blackfin.uclinux.org/ | 6 | * Enter bugs at http://blackfin.uclinux.org/ |
7 | * | 7 | * |
@@ -42,15 +42,15 @@ MODULE_LICENSE("GPL"); | |||
42 | #define DONE_STATE ((void *)2) | 42 | #define DONE_STATE ((void *)2) |
43 | #define ERROR_STATE ((void *)-1) | 43 | #define ERROR_STATE ((void *)-1) |
44 | 44 | ||
45 | struct master_data; | 45 | struct bfin_spi_master_data; |
46 | 46 | ||
47 | struct transfer_ops { | 47 | struct bfin_spi_transfer_ops { |
48 | void (*write) (struct master_data *); | 48 | void (*write) (struct bfin_spi_master_data *); |
49 | void (*read) (struct master_data *); | 49 | void (*read) (struct bfin_spi_master_data *); |
50 | void (*duplex) (struct master_data *); | 50 | void (*duplex) (struct bfin_spi_master_data *); |
51 | }; | 51 | }; |
52 | 52 | ||
53 | struct master_data { | 53 | struct bfin_spi_master_data { |
54 | /* Driver model hookup */ | 54 | /* Driver model hookup */ |
55 | struct platform_device *pdev; | 55 | struct platform_device *pdev; |
56 | 56 | ||
@@ -80,7 +80,7 @@ struct master_data { | |||
80 | /* Current message transfer state info */ | 80 | /* Current message transfer state info */ |
81 | struct spi_message *cur_msg; | 81 | struct spi_message *cur_msg; |
82 | struct spi_transfer *cur_transfer; | 82 | struct spi_transfer *cur_transfer; |
83 | struct slave_data *cur_chip; | 83 | struct bfin_spi_slave_data *cur_chip; |
84 | size_t len_in_bytes; | 84 | size_t len_in_bytes; |
85 | size_t len; | 85 | size_t len; |
86 | void *tx; | 86 | void *tx; |
@@ -105,10 +105,10 @@ struct master_data { | |||
105 | u16 flag_reg; | 105 | u16 flag_reg; |
106 | 106 | ||
107 | int cs_change; | 107 | int cs_change; |
108 | const struct transfer_ops *ops; | 108 | const struct bfin_spi_transfer_ops *ops; |
109 | }; | 109 | }; |
110 | 110 | ||
111 | struct slave_data { | 111 | struct bfin_spi_slave_data { |
112 | u16 ctl_reg; | 112 | u16 ctl_reg; |
113 | u16 baud; | 113 | u16 baud; |
114 | u16 flag; | 114 | u16 flag; |
@@ -119,13 +119,13 @@ struct slave_data { | |||
119 | u32 cs_gpio; | 119 | u32 cs_gpio; |
120 | u16 idle_tx_val; | 120 | u16 idle_tx_val; |
121 | u8 pio_interrupt; /* use spi data irq */ | 121 | u8 pio_interrupt; /* use spi data irq */ |
122 | const struct transfer_ops *ops; | 122 | const struct bfin_spi_transfer_ops *ops; |
123 | }; | 123 | }; |
124 | 124 | ||
125 | #define DEFINE_SPI_REG(reg, off) \ | 125 | #define DEFINE_SPI_REG(reg, off) \ |
126 | static inline u16 read_##reg(struct master_data *drv_data) \ | 126 | static inline u16 read_##reg(struct bfin_spi_master_data *drv_data) \ |
127 | { return bfin_read16(drv_data->regs_base + off); } \ | 127 | { return bfin_read16(drv_data->regs_base + off); } \ |
128 | static inline void write_##reg(struct master_data *drv_data, u16 v) \ | 128 | static inline void write_##reg(struct bfin_spi_master_data *drv_data, u16 v) \ |
129 | { bfin_write16(drv_data->regs_base + off, v); } | 129 | { bfin_write16(drv_data->regs_base + off, v); } |
130 | 130 | ||
131 | DEFINE_SPI_REG(CTRL, 0x00) | 131 | DEFINE_SPI_REG(CTRL, 0x00) |
@@ -136,7 +136,7 @@ DEFINE_SPI_REG(RDBR, 0x10) | |||
136 | DEFINE_SPI_REG(BAUD, 0x14) | 136 | DEFINE_SPI_REG(BAUD, 0x14) |
137 | DEFINE_SPI_REG(SHAW, 0x18) | 137 | DEFINE_SPI_REG(SHAW, 0x18) |
138 | 138 | ||
139 | static void bfin_spi_enable(struct master_data *drv_data) | 139 | static void bfin_spi_enable(struct bfin_spi_master_data *drv_data) |
140 | { | 140 | { |
141 | u16 cr; | 141 | u16 cr; |
142 | 142 | ||
@@ -144,7 +144,7 @@ static void bfin_spi_enable(struct master_data *drv_data) | |||
144 | write_CTRL(drv_data, (cr | BIT_CTL_ENABLE)); | 144 | write_CTRL(drv_data, (cr | BIT_CTL_ENABLE)); |
145 | } | 145 | } |
146 | 146 | ||
147 | static void bfin_spi_disable(struct master_data *drv_data) | 147 | static void bfin_spi_disable(struct bfin_spi_master_data *drv_data) |
148 | { | 148 | { |
149 | u16 cr; | 149 | u16 cr; |
150 | 150 | ||
@@ -167,7 +167,7 @@ static u16 hz_to_spi_baud(u32 speed_hz) | |||
167 | return spi_baud; | 167 | return spi_baud; |
168 | } | 168 | } |
169 | 169 | ||
170 | static int bfin_spi_flush(struct master_data *drv_data) | 170 | static int bfin_spi_flush(struct bfin_spi_master_data *drv_data) |
171 | { | 171 | { |
172 | unsigned long limit = loops_per_jiffy << 1; | 172 | unsigned long limit = loops_per_jiffy << 1; |
173 | 173 | ||
@@ -181,7 +181,7 @@ static int bfin_spi_flush(struct master_data *drv_data) | |||
181 | } | 181 | } |
182 | 182 | ||
183 | /* Chip select operation functions for cs_change flag */ | 183 | /* Chip select operation functions for cs_change flag */ |
184 | static void bfin_spi_cs_active(struct master_data *drv_data, struct slave_data *chip) | 184 | static void bfin_spi_cs_active(struct bfin_spi_master_data *drv_data, struct bfin_spi_slave_data *chip) |
185 | { | 185 | { |
186 | if (likely(chip->chip_select_num < MAX_CTRL_CS)) { | 186 | if (likely(chip->chip_select_num < MAX_CTRL_CS)) { |
187 | u16 flag = read_FLAG(drv_data); | 187 | u16 flag = read_FLAG(drv_data); |
@@ -194,7 +194,8 @@ static void bfin_spi_cs_active(struct master_data *drv_data, struct slave_data * | |||
194 | } | 194 | } |
195 | } | 195 | } |
196 | 196 | ||
197 | static void bfin_spi_cs_deactive(struct master_data *drv_data, struct slave_data *chip) | 197 | static void bfin_spi_cs_deactive(struct bfin_spi_master_data *drv_data, |
198 | struct bfin_spi_slave_data *chip) | ||
198 | { | 199 | { |
199 | if (likely(chip->chip_select_num < MAX_CTRL_CS)) { | 200 | if (likely(chip->chip_select_num < MAX_CTRL_CS)) { |
200 | u16 flag = read_FLAG(drv_data); | 201 | u16 flag = read_FLAG(drv_data); |
@@ -212,7 +213,8 @@ static void bfin_spi_cs_deactive(struct master_data *drv_data, struct slave_data | |||
212 | } | 213 | } |
213 | 214 | ||
214 | /* enable or disable the pin muxed by GPIO and SPI CS to work as SPI CS */ | 215 | /* enable or disable the pin muxed by GPIO and SPI CS to work as SPI CS */ |
215 | static inline void bfin_spi_cs_enable(struct master_data *drv_data, struct slave_data *chip) | 216 | static inline void bfin_spi_cs_enable(struct bfin_spi_master_data *drv_data, |
217 | struct bfin_spi_slave_data *chip) | ||
216 | { | 218 | { |
217 | if (chip->chip_select_num < MAX_CTRL_CS) { | 219 | if (chip->chip_select_num < MAX_CTRL_CS) { |
218 | u16 flag = read_FLAG(drv_data); | 220 | u16 flag = read_FLAG(drv_data); |
@@ -223,7 +225,8 @@ static inline void bfin_spi_cs_enable(struct master_data *drv_data, struct slave | |||
223 | } | 225 | } |
224 | } | 226 | } |
225 | 227 | ||
226 | static inline void bfin_spi_cs_disable(struct master_data *drv_data, struct slave_data *chip) | 228 | static inline void bfin_spi_cs_disable(struct bfin_spi_master_data *drv_data, |
229 | struct bfin_spi_slave_data *chip) | ||
227 | { | 230 | { |
228 | if (chip->chip_select_num < MAX_CTRL_CS) { | 231 | if (chip->chip_select_num < MAX_CTRL_CS) { |
229 | u16 flag = read_FLAG(drv_data); | 232 | u16 flag = read_FLAG(drv_data); |
@@ -235,9 +238,9 @@ static inline void bfin_spi_cs_disable(struct master_data *drv_data, struct slav | |||
235 | } | 238 | } |
236 | 239 | ||
237 | /* stop controller and re-config current chip*/ | 240 | /* stop controller and re-config current chip*/ |
238 | static void bfin_spi_restore_state(struct master_data *drv_data) | 241 | static void bfin_spi_restore_state(struct bfin_spi_master_data *drv_data) |
239 | { | 242 | { |
240 | struct slave_data *chip = drv_data->cur_chip; | 243 | struct bfin_spi_slave_data *chip = drv_data->cur_chip; |
241 | 244 | ||
242 | /* Clear status and disable clock */ | 245 | /* Clear status and disable clock */ |
243 | write_STAT(drv_data, BIT_STAT_CLR); | 246 | write_STAT(drv_data, BIT_STAT_CLR); |
@@ -255,12 +258,12 @@ static void bfin_spi_restore_state(struct master_data *drv_data) | |||
255 | } | 258 | } |
256 | 259 | ||
257 | /* used to kick off transfer in rx mode and read unwanted RX data */ | 260 | /* used to kick off transfer in rx mode and read unwanted RX data */ |
258 | static inline void bfin_spi_dummy_read(struct master_data *drv_data) | 261 | static inline void bfin_spi_dummy_read(struct bfin_spi_master_data *drv_data) |
259 | { | 262 | { |
260 | (void) read_RDBR(drv_data); | 263 | (void) read_RDBR(drv_data); |
261 | } | 264 | } |
262 | 265 | ||
263 | static void bfin_spi_u8_writer(struct master_data *drv_data) | 266 | static void bfin_spi_u8_writer(struct bfin_spi_master_data *drv_data) |
264 | { | 267 | { |
265 | /* clear RXS (we check for RXS inside the loop) */ | 268 | /* clear RXS (we check for RXS inside the loop) */ |
266 | bfin_spi_dummy_read(drv_data); | 269 | bfin_spi_dummy_read(drv_data); |
@@ -276,7 +279,7 @@ static void bfin_spi_u8_writer(struct master_data *drv_data) | |||
276 | } | 279 | } |
277 | } | 280 | } |
278 | 281 | ||
279 | static void bfin_spi_u8_reader(struct master_data *drv_data) | 282 | static void bfin_spi_u8_reader(struct bfin_spi_master_data *drv_data) |
280 | { | 283 | { |
281 | u16 tx_val = drv_data->cur_chip->idle_tx_val; | 284 | u16 tx_val = drv_data->cur_chip->idle_tx_val; |
282 | 285 | ||
@@ -291,7 +294,7 @@ static void bfin_spi_u8_reader(struct master_data *drv_data) | |||
291 | } | 294 | } |
292 | } | 295 | } |
293 | 296 | ||
294 | static void bfin_spi_u8_duplex(struct master_data *drv_data) | 297 | static void bfin_spi_u8_duplex(struct bfin_spi_master_data *drv_data) |
295 | { | 298 | { |
296 | /* discard old RX data and clear RXS */ | 299 | /* discard old RX data and clear RXS */ |
297 | bfin_spi_dummy_read(drv_data); | 300 | bfin_spi_dummy_read(drv_data); |
@@ -304,13 +307,13 @@ static void bfin_spi_u8_duplex(struct master_data *drv_data) | |||
304 | } | 307 | } |
305 | } | 308 | } |
306 | 309 | ||
307 | static const struct transfer_ops bfin_transfer_ops_u8 = { | 310 | static const struct bfin_spi_transfer_ops bfin_bfin_spi_transfer_ops_u8 = { |
308 | .write = bfin_spi_u8_writer, | 311 | .write = bfin_spi_u8_writer, |
309 | .read = bfin_spi_u8_reader, | 312 | .read = bfin_spi_u8_reader, |
310 | .duplex = bfin_spi_u8_duplex, | 313 | .duplex = bfin_spi_u8_duplex, |
311 | }; | 314 | }; |
312 | 315 | ||
313 | static void bfin_spi_u16_writer(struct master_data *drv_data) | 316 | static void bfin_spi_u16_writer(struct bfin_spi_master_data *drv_data) |
314 | { | 317 | { |
315 | /* clear RXS (we check for RXS inside the loop) */ | 318 | /* clear RXS (we check for RXS inside the loop) */ |
316 | bfin_spi_dummy_read(drv_data); | 319 | bfin_spi_dummy_read(drv_data); |
@@ -327,7 +330,7 @@ static void bfin_spi_u16_writer(struct master_data *drv_data) | |||
327 | } | 330 | } |
328 | } | 331 | } |
329 | 332 | ||
330 | static void bfin_spi_u16_reader(struct master_data *drv_data) | 333 | static void bfin_spi_u16_reader(struct bfin_spi_master_data *drv_data) |
331 | { | 334 | { |
332 | u16 tx_val = drv_data->cur_chip->idle_tx_val; | 335 | u16 tx_val = drv_data->cur_chip->idle_tx_val; |
333 | 336 | ||
@@ -343,7 +346,7 @@ static void bfin_spi_u16_reader(struct master_data *drv_data) | |||
343 | } | 346 | } |
344 | } | 347 | } |
345 | 348 | ||
346 | static void bfin_spi_u16_duplex(struct master_data *drv_data) | 349 | static void bfin_spi_u16_duplex(struct bfin_spi_master_data *drv_data) |
347 | { | 350 | { |
348 | /* discard old RX data and clear RXS */ | 351 | /* discard old RX data and clear RXS */ |
349 | bfin_spi_dummy_read(drv_data); | 352 | bfin_spi_dummy_read(drv_data); |
@@ -358,14 +361,14 @@ static void bfin_spi_u16_duplex(struct master_data *drv_data) | |||
358 | } | 361 | } |
359 | } | 362 | } |
360 | 363 | ||
361 | static const struct transfer_ops bfin_transfer_ops_u16 = { | 364 | static const struct bfin_spi_transfer_ops bfin_bfin_spi_transfer_ops_u16 = { |
362 | .write = bfin_spi_u16_writer, | 365 | .write = bfin_spi_u16_writer, |
363 | .read = bfin_spi_u16_reader, | 366 | .read = bfin_spi_u16_reader, |
364 | .duplex = bfin_spi_u16_duplex, | 367 | .duplex = bfin_spi_u16_duplex, |
365 | }; | 368 | }; |
366 | 369 | ||
367 | /* test if there is more transfer to be done */ | 370 | /* test if there is more transfer to be done */ |
368 | static void *bfin_spi_next_transfer(struct master_data *drv_data) | 371 | static void *bfin_spi_next_transfer(struct bfin_spi_master_data *drv_data) |
369 | { | 372 | { |
370 | struct spi_message *msg = drv_data->cur_msg; | 373 | struct spi_message *msg = drv_data->cur_msg; |
371 | struct spi_transfer *trans = drv_data->cur_transfer; | 374 | struct spi_transfer *trans = drv_data->cur_transfer; |
@@ -384,9 +387,9 @@ static void *bfin_spi_next_transfer(struct master_data *drv_data) | |||
384 | * caller already set message->status; | 387 | * caller already set message->status; |
385 | * dma and pio irqs are blocked give finished message back | 388 | * dma and pio irqs are blocked give finished message back |
386 | */ | 389 | */ |
387 | static void bfin_spi_giveback(struct master_data *drv_data) | 390 | static void bfin_spi_giveback(struct bfin_spi_master_data *drv_data) |
388 | { | 391 | { |
389 | struct slave_data *chip = drv_data->cur_chip; | 392 | struct bfin_spi_slave_data *chip = drv_data->cur_chip; |
390 | struct spi_transfer *last_transfer; | 393 | struct spi_transfer *last_transfer; |
391 | unsigned long flags; | 394 | unsigned long flags; |
392 | struct spi_message *msg; | 395 | struct spi_message *msg; |
@@ -418,8 +421,8 @@ static void bfin_spi_giveback(struct master_data *drv_data) | |||
418 | /* spi data irq handler */ | 421 | /* spi data irq handler */ |
419 | static irqreturn_t bfin_spi_pio_irq_handler(int irq, void *dev_id) | 422 | static irqreturn_t bfin_spi_pio_irq_handler(int irq, void *dev_id) |
420 | { | 423 | { |
421 | struct master_data *drv_data = dev_id; | 424 | struct bfin_spi_master_data *drv_data = dev_id; |
422 | struct slave_data *chip = drv_data->cur_chip; | 425 | struct bfin_spi_slave_data *chip = drv_data->cur_chip; |
423 | struct spi_message *msg = drv_data->cur_msg; | 426 | struct spi_message *msg = drv_data->cur_msg; |
424 | int n_bytes = drv_data->n_bytes; | 427 | int n_bytes = drv_data->n_bytes; |
425 | 428 | ||
@@ -490,8 +493,8 @@ static irqreturn_t bfin_spi_pio_irq_handler(int irq, void *dev_id) | |||
490 | 493 | ||
491 | static irqreturn_t bfin_spi_dma_irq_handler(int irq, void *dev_id) | 494 | static irqreturn_t bfin_spi_dma_irq_handler(int irq, void *dev_id) |
492 | { | 495 | { |
493 | struct master_data *drv_data = dev_id; | 496 | struct bfin_spi_master_data *drv_data = dev_id; |
494 | struct slave_data *chip = drv_data->cur_chip; | 497 | struct bfin_spi_slave_data *chip = drv_data->cur_chip; |
495 | struct spi_message *msg = drv_data->cur_msg; | 498 | struct spi_message *msg = drv_data->cur_msg; |
496 | unsigned long timeout; | 499 | unsigned long timeout; |
497 | unsigned short dmastat = get_dma_curr_irqstat(drv_data->dma_channel); | 500 | unsigned short dmastat = get_dma_curr_irqstat(drv_data->dma_channel); |
@@ -554,11 +557,11 @@ static irqreturn_t bfin_spi_dma_irq_handler(int irq, void *dev_id) | |||
554 | 557 | ||
555 | static void bfin_spi_pump_transfers(unsigned long data) | 558 | static void bfin_spi_pump_transfers(unsigned long data) |
556 | { | 559 | { |
557 | struct master_data *drv_data = (struct master_data *)data; | 560 | struct bfin_spi_master_data *drv_data = (struct bfin_spi_master_data *)data; |
558 | struct spi_message *message = NULL; | 561 | struct spi_message *message = NULL; |
559 | struct spi_transfer *transfer = NULL; | 562 | struct spi_transfer *transfer = NULL; |
560 | struct spi_transfer *previous = NULL; | 563 | struct spi_transfer *previous = NULL; |
561 | struct slave_data *chip = NULL; | 564 | struct bfin_spi_slave_data *chip = NULL; |
562 | unsigned int bits_per_word; | 565 | unsigned int bits_per_word; |
563 | u16 cr, cr_width, dma_width, dma_config; | 566 | u16 cr, cr_width, dma_width, dma_config; |
564 | u32 tranf_success = 1; | 567 | u32 tranf_success = 1; |
@@ -643,12 +646,12 @@ static void bfin_spi_pump_transfers(unsigned long data) | |||
643 | drv_data->n_bytes = 1; | 646 | drv_data->n_bytes = 1; |
644 | drv_data->len = transfer->len; | 647 | drv_data->len = transfer->len; |
645 | cr_width = 0; | 648 | cr_width = 0; |
646 | drv_data->ops = &bfin_transfer_ops_u8; | 649 | drv_data->ops = &bfin_bfin_spi_transfer_ops_u8; |
647 | } else if (bits_per_word == 16) { | 650 | } else if (bits_per_word == 16) { |
648 | drv_data->n_bytes = 2; | 651 | drv_data->n_bytes = 2; |
649 | drv_data->len = (transfer->len) >> 1; | 652 | drv_data->len = (transfer->len) >> 1; |
650 | cr_width = BIT_CTL_WORDSIZE; | 653 | cr_width = BIT_CTL_WORDSIZE; |
651 | drv_data->ops = &bfin_transfer_ops_u16; | 654 | drv_data->ops = &bfin_bfin_spi_transfer_ops_u16; |
652 | } else { | 655 | } else { |
653 | dev_err(&drv_data->pdev->dev, "transfer: unsupported bits_per_word\n"); | 656 | dev_err(&drv_data->pdev->dev, "transfer: unsupported bits_per_word\n"); |
654 | message->status = -EINVAL; | 657 | message->status = -EINVAL; |
@@ -661,7 +664,7 @@ static void bfin_spi_pump_transfers(unsigned long data) | |||
661 | 664 | ||
662 | dev_dbg(&drv_data->pdev->dev, | 665 | dev_dbg(&drv_data->pdev->dev, |
663 | "transfer: drv_data->ops is %p, chip->ops is %p, u8_ops is %p\n", | 666 | "transfer: drv_data->ops is %p, chip->ops is %p, u8_ops is %p\n", |
664 | drv_data->ops, chip->ops, &bfin_transfer_ops_u8); | 667 | drv_data->ops, chip->ops, &bfin_bfin_spi_transfer_ops_u8); |
665 | 668 | ||
666 | message->state = RUNNING_STATE; | 669 | message->state = RUNNING_STATE; |
667 | dma_config = 0; | 670 | dma_config = 0; |
@@ -868,10 +871,10 @@ static void bfin_spi_pump_transfers(unsigned long data) | |||
868 | /* pop a msg from queue and kick off real transfer */ | 871 | /* pop a msg from queue and kick off real transfer */ |
869 | static void bfin_spi_pump_messages(struct work_struct *work) | 872 | static void bfin_spi_pump_messages(struct work_struct *work) |
870 | { | 873 | { |
871 | struct master_data *drv_data; | 874 | struct bfin_spi_master_data *drv_data; |
872 | unsigned long flags; | 875 | unsigned long flags; |
873 | 876 | ||
874 | drv_data = container_of(work, struct master_data, pump_messages); | 877 | drv_data = container_of(work, struct bfin_spi_master_data, pump_messages); |
875 | 878 | ||
876 | /* Lock queue and check for queue work */ | 879 | /* Lock queue and check for queue work */ |
877 | spin_lock_irqsave(&drv_data->lock, flags); | 880 | spin_lock_irqsave(&drv_data->lock, flags); |
@@ -925,7 +928,7 @@ static void bfin_spi_pump_messages(struct work_struct *work) | |||
925 | */ | 928 | */ |
926 | static int bfin_spi_transfer(struct spi_device *spi, struct spi_message *msg) | 929 | static int bfin_spi_transfer(struct spi_device *spi, struct spi_message *msg) |
927 | { | 930 | { |
928 | struct master_data *drv_data = spi_master_get_devdata(spi->master); | 931 | struct bfin_spi_master_data *drv_data = spi_master_get_devdata(spi->master); |
929 | unsigned long flags; | 932 | unsigned long flags; |
930 | 933 | ||
931 | spin_lock_irqsave(&drv_data->lock, flags); | 934 | spin_lock_irqsave(&drv_data->lock, flags); |
@@ -970,8 +973,8 @@ static u16 ssel[][MAX_SPI_SSEL] = { | |||
970 | static int bfin_spi_setup(struct spi_device *spi) | 973 | static int bfin_spi_setup(struct spi_device *spi) |
971 | { | 974 | { |
972 | struct bfin5xx_spi_chip *chip_info; | 975 | struct bfin5xx_spi_chip *chip_info; |
973 | struct slave_data *chip = NULL; | 976 | struct bfin_spi_slave_data *chip = NULL; |
974 | struct master_data *drv_data = spi_master_get_devdata(spi->master); | 977 | struct bfin_spi_master_data *drv_data = spi_master_get_devdata(spi->master); |
975 | u16 bfin_ctl_reg; | 978 | u16 bfin_ctl_reg; |
976 | int ret = -EINVAL; | 979 | int ret = -EINVAL; |
977 | 980 | ||
@@ -1152,8 +1155,8 @@ static int bfin_spi_setup(struct spi_device *spi) | |||
1152 | */ | 1155 | */ |
1153 | static void bfin_spi_cleanup(struct spi_device *spi) | 1156 | static void bfin_spi_cleanup(struct spi_device *spi) |
1154 | { | 1157 | { |
1155 | struct slave_data *chip = spi_get_ctldata(spi); | 1158 | struct bfin_spi_slave_data *chip = spi_get_ctldata(spi); |
1156 | struct master_data *drv_data = spi_master_get_devdata(spi->master); | 1159 | struct bfin_spi_master_data *drv_data = spi_master_get_devdata(spi->master); |
1157 | 1160 | ||
1158 | if (!chip) | 1161 | if (!chip) |
1159 | return; | 1162 | return; |
@@ -1170,7 +1173,7 @@ static void bfin_spi_cleanup(struct spi_device *spi) | |||
1170 | spi_set_ctldata(spi, NULL); | 1173 | spi_set_ctldata(spi, NULL); |
1171 | } | 1174 | } |
1172 | 1175 | ||
1173 | static inline int bfin_spi_init_queue(struct master_data *drv_data) | 1176 | static inline int bfin_spi_init_queue(struct bfin_spi_master_data *drv_data) |
1174 | { | 1177 | { |
1175 | INIT_LIST_HEAD(&drv_data->queue); | 1178 | INIT_LIST_HEAD(&drv_data->queue); |
1176 | spin_lock_init(&drv_data->lock); | 1179 | spin_lock_init(&drv_data->lock); |
@@ -1192,7 +1195,7 @@ static inline int bfin_spi_init_queue(struct master_data *drv_data) | |||
1192 | return 0; | 1195 | return 0; |
1193 | } | 1196 | } |
1194 | 1197 | ||
1195 | static inline int bfin_spi_start_queue(struct master_data *drv_data) | 1198 | static inline int bfin_spi_start_queue(struct bfin_spi_master_data *drv_data) |
1196 | { | 1199 | { |
1197 | unsigned long flags; | 1200 | unsigned long flags; |
1198 | 1201 | ||
@@ -1214,7 +1217,7 @@ static inline int bfin_spi_start_queue(struct master_data *drv_data) | |||
1214 | return 0; | 1217 | return 0; |
1215 | } | 1218 | } |
1216 | 1219 | ||
1217 | static inline int bfin_spi_stop_queue(struct master_data *drv_data) | 1220 | static inline int bfin_spi_stop_queue(struct bfin_spi_master_data *drv_data) |
1218 | { | 1221 | { |
1219 | unsigned long flags; | 1222 | unsigned long flags; |
1220 | unsigned limit = 500; | 1223 | unsigned limit = 500; |
@@ -1243,7 +1246,7 @@ static inline int bfin_spi_stop_queue(struct master_data *drv_data) | |||
1243 | return status; | 1246 | return status; |
1244 | } | 1247 | } |
1245 | 1248 | ||
1246 | static inline int bfin_spi_destroy_queue(struct master_data *drv_data) | 1249 | static inline int bfin_spi_destroy_queue(struct bfin_spi_master_data *drv_data) |
1247 | { | 1250 | { |
1248 | int status; | 1251 | int status; |
1249 | 1252 | ||
@@ -1261,7 +1264,7 @@ static int __init bfin_spi_probe(struct platform_device *pdev) | |||
1261 | struct device *dev = &pdev->dev; | 1264 | struct device *dev = &pdev->dev; |
1262 | struct bfin5xx_spi_master *platform_info; | 1265 | struct bfin5xx_spi_master *platform_info; |
1263 | struct spi_master *master; | 1266 | struct spi_master *master; |
1264 | struct master_data *drv_data; | 1267 | struct bfin_spi_master_data *drv_data; |
1265 | struct resource *res; | 1268 | struct resource *res; |
1266 | int status = 0; | 1269 | int status = 0; |
1267 | 1270 | ||
@@ -1371,7 +1374,7 @@ out_error_get_res: | |||
1371 | /* stop hardware and remove the driver */ | 1374 | /* stop hardware and remove the driver */ |
1372 | static int __devexit bfin_spi_remove(struct platform_device *pdev) | 1375 | static int __devexit bfin_spi_remove(struct platform_device *pdev) |
1373 | { | 1376 | { |
1374 | struct master_data *drv_data = platform_get_drvdata(pdev); | 1377 | struct bfin_spi_master_data *drv_data = platform_get_drvdata(pdev); |
1375 | int status = 0; | 1378 | int status = 0; |
1376 | 1379 | ||
1377 | if (!drv_data) | 1380 | if (!drv_data) |
@@ -1410,7 +1413,7 @@ static int __devexit bfin_spi_remove(struct platform_device *pdev) | |||
1410 | #ifdef CONFIG_PM | 1413 | #ifdef CONFIG_PM |
1411 | static int bfin_spi_suspend(struct platform_device *pdev, pm_message_t state) | 1414 | static int bfin_spi_suspend(struct platform_device *pdev, pm_message_t state) |
1412 | { | 1415 | { |
1413 | struct master_data *drv_data = platform_get_drvdata(pdev); | 1416 | struct bfin_spi_master_data *drv_data = platform_get_drvdata(pdev); |
1414 | int status = 0; | 1417 | int status = 0; |
1415 | 1418 | ||
1416 | status = bfin_spi_stop_queue(drv_data); | 1419 | status = bfin_spi_stop_queue(drv_data); |
@@ -1431,7 +1434,7 @@ static int bfin_spi_suspend(struct platform_device *pdev, pm_message_t state) | |||
1431 | 1434 | ||
1432 | static int bfin_spi_resume(struct platform_device *pdev) | 1435 | static int bfin_spi_resume(struct platform_device *pdev) |
1433 | { | 1436 | { |
1434 | struct master_data *drv_data = platform_get_drvdata(pdev); | 1437 | struct bfin_spi_master_data *drv_data = platform_get_drvdata(pdev); |
1435 | int status = 0; | 1438 | int status = 0; |
1436 | 1439 | ||
1437 | write_CTRL(drv_data, drv_data->ctrl_reg); | 1440 | write_CTRL(drv_data, drv_data->ctrl_reg); |