diff options
-rw-r--r-- | arch/powerpc/platforms/83xx/mpc832x_rdb.c | 16 | ||||
-rw-r--r-- | arch/powerpc/sysdev/fsl_soc.c | 14 | ||||
-rw-r--r-- | arch/powerpc/sysdev/fsl_soc.h | 5 | ||||
-rw-r--r-- | drivers/spi/spi_mpc83xx.c | 20 | ||||
-rw-r--r-- | include/linux/fsl_devices.h | 5 |
5 files changed, 23 insertions, 37 deletions
diff --git a/arch/powerpc/platforms/83xx/mpc832x_rdb.c b/arch/powerpc/platforms/83xx/mpc832x_rdb.c index 2a1295f19832..28e23cde64a1 100644 --- a/arch/powerpc/platforms/83xx/mpc832x_rdb.c +++ b/arch/powerpc/platforms/83xx/mpc832x_rdb.c | |||
@@ -39,16 +39,10 @@ | |||
39 | #endif | 39 | #endif |
40 | 40 | ||
41 | #ifdef CONFIG_QUICC_ENGINE | 41 | #ifdef CONFIG_QUICC_ENGINE |
42 | static void mpc83xx_spi_activate_cs(u8 cs, u8 polarity) | 42 | static void mpc83xx_spi_cs_control(struct spi_device *spi, bool on) |
43 | { | 43 | { |
44 | pr_debug("%s %d %d\n", __func__, cs, polarity); | 44 | pr_debug("%s %d %d\n", __func__, spi->chip_select, on); |
45 | par_io_data_set(3, 13, polarity); | 45 | par_io_data_set(3, 13, on); |
46 | } | ||
47 | |||
48 | static void mpc83xx_spi_deactivate_cs(u8 cs, u8 polarity) | ||
49 | { | ||
50 | pr_debug("%s %d %d\n", __func__, cs, polarity); | ||
51 | par_io_data_set(3, 13, !polarity); | ||
52 | } | 46 | } |
53 | 47 | ||
54 | static struct mmc_spi_platform_data mpc832x_mmc_pdata = { | 48 | static struct mmc_spi_platform_data mpc832x_mmc_pdata = { |
@@ -74,9 +68,7 @@ static int __init mpc832x_spi_init(void) | |||
74 | par_io_config_pin(3, 14, 2, 0, 0, 0); /* SD_INSERT, I */ | 68 | par_io_config_pin(3, 14, 2, 0, 0, 0); /* SD_INSERT, I */ |
75 | par_io_config_pin(3, 15, 2, 0, 0, 0); /* SD_PROTECT,I */ | 69 | par_io_config_pin(3, 15, 2, 0, 0, 0); /* SD_PROTECT,I */ |
76 | 70 | ||
77 | return fsl_spi_init(&mpc832x_spi_boardinfo, 1, | 71 | return fsl_spi_init(&mpc832x_spi_boardinfo, 1, mpc83xx_spi_cs_control); |
78 | mpc83xx_spi_activate_cs, | ||
79 | mpc83xx_spi_deactivate_cs); | ||
80 | } | 72 | } |
81 | machine_device_initcall(mpc832x_rdb, mpc832x_spi_init); | 73 | machine_device_initcall(mpc832x_rdb, mpc832x_spi_init); |
82 | #endif /* CONFIG_QUICC_ENGINE */ | 74 | #endif /* CONFIG_QUICC_ENGINE */ |
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c index a01c89d3f9bd..a46c1c867930 100644 --- a/arch/powerpc/sysdev/fsl_soc.c +++ b/arch/powerpc/sysdev/fsl_soc.c | |||
@@ -420,8 +420,8 @@ arch_initcall(fsl_usb_of_init); | |||
420 | static int __init of_fsl_spi_probe(char *type, char *compatible, u32 sysclk, | 420 | static int __init of_fsl_spi_probe(char *type, char *compatible, u32 sysclk, |
421 | struct spi_board_info *board_infos, | 421 | struct spi_board_info *board_infos, |
422 | unsigned int num_board_infos, | 422 | unsigned int num_board_infos, |
423 | void (*activate_cs)(u8 cs, u8 polarity), | 423 | void (*cs_control)(struct spi_device *dev, |
424 | void (*deactivate_cs)(u8 cs, u8 polarity)) | 424 | bool on)) |
425 | { | 425 | { |
426 | struct device_node *np; | 426 | struct device_node *np; |
427 | unsigned int i = 0; | 427 | unsigned int i = 0; |
@@ -433,8 +433,7 @@ static int __init of_fsl_spi_probe(char *type, char *compatible, u32 sysclk, | |||
433 | struct resource res[2]; | 433 | struct resource res[2]; |
434 | struct platform_device *pdev; | 434 | struct platform_device *pdev; |
435 | struct fsl_spi_platform_data pdata = { | 435 | struct fsl_spi_platform_data pdata = { |
436 | .activate_cs = activate_cs, | 436 | .cs_control = cs_control, |
437 | .deactivate_cs = deactivate_cs, | ||
438 | }; | 437 | }; |
439 | 438 | ||
440 | memset(res, 0, sizeof(res)); | 439 | memset(res, 0, sizeof(res)); |
@@ -501,8 +500,7 @@ next: | |||
501 | 500 | ||
502 | int __init fsl_spi_init(struct spi_board_info *board_infos, | 501 | int __init fsl_spi_init(struct spi_board_info *board_infos, |
503 | unsigned int num_board_infos, | 502 | unsigned int num_board_infos, |
504 | void (*activate_cs)(u8 cs, u8 polarity), | 503 | void (*cs_control)(struct spi_device *spi, bool on)) |
505 | void (*deactivate_cs)(u8 cs, u8 polarity)) | ||
506 | { | 504 | { |
507 | u32 sysclk = -1; | 505 | u32 sysclk = -1; |
508 | int ret; | 506 | int ret; |
@@ -518,10 +516,10 @@ int __init fsl_spi_init(struct spi_board_info *board_infos, | |||
518 | } | 516 | } |
519 | 517 | ||
520 | ret = of_fsl_spi_probe(NULL, "fsl,spi", sysclk, board_infos, | 518 | ret = of_fsl_spi_probe(NULL, "fsl,spi", sysclk, board_infos, |
521 | num_board_infos, activate_cs, deactivate_cs); | 519 | num_board_infos, cs_control); |
522 | if (!ret) | 520 | if (!ret) |
523 | of_fsl_spi_probe("spi", "fsl_spi", sysclk, board_infos, | 521 | of_fsl_spi_probe("spi", "fsl_spi", sysclk, board_infos, |
524 | num_board_infos, activate_cs, deactivate_cs); | 522 | num_board_infos, cs_control); |
525 | 523 | ||
526 | return spi_register_board_info(board_infos, num_board_infos); | 524 | return spi_register_board_info(board_infos, num_board_infos); |
527 | } | 525 | } |
diff --git a/arch/powerpc/sysdev/fsl_soc.h b/arch/powerpc/sysdev/fsl_soc.h index 9c744e4285a0..b5f3456780b8 100644 --- a/arch/powerpc/sysdev/fsl_soc.h +++ b/arch/powerpc/sysdev/fsl_soc.h | |||
@@ -4,6 +4,8 @@ | |||
4 | 4 | ||
5 | #include <asm/mmu.h> | 5 | #include <asm/mmu.h> |
6 | 6 | ||
7 | struct spi_device; | ||
8 | |||
7 | extern phys_addr_t get_immrbase(void); | 9 | extern phys_addr_t get_immrbase(void); |
8 | #if defined(CONFIG_CPM2) || defined(CONFIG_QUICC_ENGINE) || defined(CONFIG_8xx) | 10 | #if defined(CONFIG_CPM2) || defined(CONFIG_QUICC_ENGINE) || defined(CONFIG_8xx) |
9 | extern u32 get_brgfreq(void); | 11 | extern u32 get_brgfreq(void); |
@@ -19,8 +21,7 @@ struct device_node; | |||
19 | 21 | ||
20 | extern int fsl_spi_init(struct spi_board_info *board_infos, | 22 | extern int fsl_spi_init(struct spi_board_info *board_infos, |
21 | unsigned int num_board_infos, | 23 | unsigned int num_board_infos, |
22 | void (*activate_cs)(u8 cs, u8 polarity), | 24 | void (*cs_control)(struct spi_device *spi, bool on)); |
23 | void (*deactivate_cs)(u8 cs, u8 polarity)); | ||
24 | 25 | ||
25 | extern void fsl_rstcr_restart(char *cmd); | 26 | extern void fsl_rstcr_restart(char *cmd); |
26 | 27 | ||
diff --git a/drivers/spi/spi_mpc83xx.c b/drivers/spi/spi_mpc83xx.c index df6420029004..b95085a46f90 100644 --- a/drivers/spi/spi_mpc83xx.c +++ b/drivers/spi/spi_mpc83xx.c | |||
@@ -89,9 +89,6 @@ struct mpc83xx_spi { | |||
89 | 89 | ||
90 | bool qe_mode; | 90 | bool qe_mode; |
91 | 91 | ||
92 | void (*activate_cs) (u8 cs, u8 polarity); | ||
93 | void (*deactivate_cs) (u8 cs, u8 polarity); | ||
94 | |||
95 | u8 busy; | 92 | u8 busy; |
96 | 93 | ||
97 | struct workqueue_struct *workqueue; | 94 | struct workqueue_struct *workqueue; |
@@ -153,15 +150,14 @@ MPC83XX_SPI_TX_BUF(u32) | |||
153 | 150 | ||
154 | static void mpc83xx_spi_chipselect(struct spi_device *spi, int value) | 151 | static void mpc83xx_spi_chipselect(struct spi_device *spi, int value) |
155 | { | 152 | { |
156 | struct mpc83xx_spi *mpc83xx_spi; | 153 | struct mpc83xx_spi *mpc83xx_spi = spi_master_get_devdata(spi->master); |
157 | u8 pol = spi->mode & SPI_CS_HIGH ? 1 : 0; | 154 | struct fsl_spi_platform_data *pdata = spi->dev.parent->platform_data; |
155 | bool pol = spi->mode & SPI_CS_HIGH; | ||
158 | struct spi_mpc83xx_cs *cs = spi->controller_state; | 156 | struct spi_mpc83xx_cs *cs = spi->controller_state; |
159 | 157 | ||
160 | mpc83xx_spi = spi_master_get_devdata(spi->master); | ||
161 | |||
162 | if (value == BITBANG_CS_INACTIVE) { | 158 | if (value == BITBANG_CS_INACTIVE) { |
163 | if (mpc83xx_spi->deactivate_cs) | 159 | if (pdata->cs_control) |
164 | mpc83xx_spi->deactivate_cs(spi->chip_select, pol); | 160 | pdata->cs_control(spi, !pol); |
165 | } | 161 | } |
166 | 162 | ||
167 | if (value == BITBANG_CS_ACTIVE) { | 163 | if (value == BITBANG_CS_ACTIVE) { |
@@ -186,8 +182,8 @@ static void mpc83xx_spi_chipselect(struct spi_device *spi, int value) | |||
186 | mpc83xx_spi_write_reg(mode, regval); | 182 | mpc83xx_spi_write_reg(mode, regval); |
187 | local_irq_restore(flags); | 183 | local_irq_restore(flags); |
188 | } | 184 | } |
189 | if (mpc83xx_spi->activate_cs) | 185 | if (pdata->cs_control) |
190 | mpc83xx_spi->activate_cs(spi->chip_select, pol); | 186 | pdata->cs_control(spi, pol); |
191 | } | 187 | } |
192 | } | 188 | } |
193 | 189 | ||
@@ -582,8 +578,6 @@ static int __init mpc83xx_spi_probe(struct platform_device *dev) | |||
582 | master->cleanup = mpc83xx_spi_cleanup; | 578 | master->cleanup = mpc83xx_spi_cleanup; |
583 | 579 | ||
584 | mpc83xx_spi = spi_master_get_devdata(master); | 580 | mpc83xx_spi = spi_master_get_devdata(master); |
585 | mpc83xx_spi->activate_cs = pdata->activate_cs; | ||
586 | mpc83xx_spi->deactivate_cs = pdata->deactivate_cs; | ||
587 | mpc83xx_spi->qe_mode = pdata->qe_mode; | 581 | mpc83xx_spi->qe_mode = pdata->qe_mode; |
588 | mpc83xx_spi->get_rx = mpc83xx_spi_rx_buf_u8; | 582 | mpc83xx_spi->get_rx = mpc83xx_spi_rx_buf_u8; |
589 | mpc83xx_spi->get_tx = mpc83xx_spi_tx_buf_u8; | 583 | mpc83xx_spi->get_tx = mpc83xx_spi_tx_buf_u8; |
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h index d9051d717d27..7bc1b643d370 100644 --- a/include/linux/fsl_devices.h +++ b/include/linux/fsl_devices.h | |||
@@ -95,14 +95,15 @@ struct fsl_usb2_platform_data { | |||
95 | #define FSL_USB2_PORT0_ENABLED 0x00000001 | 95 | #define FSL_USB2_PORT0_ENABLED 0x00000001 |
96 | #define FSL_USB2_PORT1_ENABLED 0x00000002 | 96 | #define FSL_USB2_PORT1_ENABLED 0x00000002 |
97 | 97 | ||
98 | struct spi_device; | ||
99 | |||
98 | struct fsl_spi_platform_data { | 100 | struct fsl_spi_platform_data { |
99 | u32 initial_spmode; /* initial SPMODE value */ | 101 | u32 initial_spmode; /* initial SPMODE value */ |
100 | u16 bus_num; | 102 | u16 bus_num; |
101 | bool qe_mode; | 103 | bool qe_mode; |
102 | /* board specific information */ | 104 | /* board specific information */ |
103 | u16 max_chipselect; | 105 | u16 max_chipselect; |
104 | void (*activate_cs)(u8 cs, u8 polarity); | 106 | void (*cs_control)(struct spi_device *spi, bool on); |
105 | void (*deactivate_cs)(u8 cs, u8 polarity); | ||
106 | u32 sysclk; | 107 | u32 sysclk; |
107 | }; | 108 | }; |
108 | 109 | ||