aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/plat-samsung/devs.c19
-rw-r--r--drivers/spi/spi-s3c64xx.c27
-rw-r--r--include/linux/platform_data/spi-s3c64xx.h2
3 files changed, 19 insertions, 29 deletions
diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c
index 82074625de5c..4c64ece1a308 100644
--- a/arch/arm/plat-samsung/devs.c
+++ b/arch/arm/plat-samsung/devs.c
@@ -1100,9 +1100,7 @@ struct platform_device s3c_device_wdt = {
1100#ifdef CONFIG_S3C64XX_DEV_SPI0 1100#ifdef CONFIG_S3C64XX_DEV_SPI0
1101static struct resource s3c64xx_spi0_resource[] = { 1101static struct resource s3c64xx_spi0_resource[] = {
1102 [0] = DEFINE_RES_MEM(S3C_PA_SPI0, SZ_256), 1102 [0] = DEFINE_RES_MEM(S3C_PA_SPI0, SZ_256),
1103 [1] = DEFINE_RES_DMA(DMACH_SPI0_TX), 1103 [1] = DEFINE_RES_IRQ(IRQ_SPI0),
1104 [2] = DEFINE_RES_DMA(DMACH_SPI0_RX),
1105 [3] = DEFINE_RES_IRQ(IRQ_SPI0),
1106}; 1104};
1107 1105
1108struct platform_device s3c64xx_device_spi0 = { 1106struct platform_device s3c64xx_device_spi0 = {
@@ -1130,6 +1128,8 @@ void __init s3c64xx_spi0_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
1130 pd.num_cs = num_cs; 1128 pd.num_cs = num_cs;
1131 pd.src_clk_nr = src_clk_nr; 1129 pd.src_clk_nr = src_clk_nr;
1132 pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi0_cfg_gpio; 1130 pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi0_cfg_gpio;
1131 pd.dma_tx = (void *)DMACH_SPI0_TX;
1132 pd.dma_rx = (void *)DMACH_SPI0_RX;
1133#if defined(CONFIG_PL330_DMA) 1133#if defined(CONFIG_PL330_DMA)
1134 pd.filter = pl330_filter; 1134 pd.filter = pl330_filter;
1135#elif defined(CONFIG_S3C64XX_PL080) 1135#elif defined(CONFIG_S3C64XX_PL080)
@@ -1145,9 +1145,7 @@ void __init s3c64xx_spi0_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
1145#ifdef CONFIG_S3C64XX_DEV_SPI1 1145#ifdef CONFIG_S3C64XX_DEV_SPI1
1146static struct resource s3c64xx_spi1_resource[] = { 1146static struct resource s3c64xx_spi1_resource[] = {
1147 [0] = DEFINE_RES_MEM(S3C_PA_SPI1, SZ_256), 1147 [0] = DEFINE_RES_MEM(S3C_PA_SPI1, SZ_256),
1148 [1] = DEFINE_RES_DMA(DMACH_SPI1_TX), 1148 [1] = DEFINE_RES_IRQ(IRQ_SPI1),
1149 [2] = DEFINE_RES_DMA(DMACH_SPI1_RX),
1150 [3] = DEFINE_RES_IRQ(IRQ_SPI1),
1151}; 1149};
1152 1150
1153struct platform_device s3c64xx_device_spi1 = { 1151struct platform_device s3c64xx_device_spi1 = {
@@ -1175,12 +1173,15 @@ void __init s3c64xx_spi1_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
1175 pd.num_cs = num_cs; 1173 pd.num_cs = num_cs;
1176 pd.src_clk_nr = src_clk_nr; 1174 pd.src_clk_nr = src_clk_nr;
1177 pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi1_cfg_gpio; 1175 pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi1_cfg_gpio;
1176 pd.dma_tx = (void *)DMACH_SPI1_TX;
1177 pd.dma_rx = (void *)DMACH_SPI1_RX;
1178#if defined(CONFIG_PL330_DMA) 1178#if defined(CONFIG_PL330_DMA)
1179 pd.filter = pl330_filter; 1179 pd.filter = pl330_filter;
1180#elif defined(CONFIG_S3C64XX_PL080) 1180#elif defined(CONFIG_S3C64XX_PL080)
1181 pd.filter = pl08x_filter_id; 1181 pd.filter = pl08x_filter_id;
1182#endif 1182#endif
1183 1183
1184
1184 s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi1); 1185 s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi1);
1185} 1186}
1186#endif /* CONFIG_S3C64XX_DEV_SPI1 */ 1187#endif /* CONFIG_S3C64XX_DEV_SPI1 */
@@ -1188,9 +1189,7 @@ void __init s3c64xx_spi1_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
1188#ifdef CONFIG_S3C64XX_DEV_SPI2 1189#ifdef CONFIG_S3C64XX_DEV_SPI2
1189static struct resource s3c64xx_spi2_resource[] = { 1190static struct resource s3c64xx_spi2_resource[] = {
1190 [0] = DEFINE_RES_MEM(S3C_PA_SPI2, SZ_256), 1191 [0] = DEFINE_RES_MEM(S3C_PA_SPI2, SZ_256),
1191 [1] = DEFINE_RES_DMA(DMACH_SPI2_TX), 1192 [1] = DEFINE_RES_IRQ(IRQ_SPI2),
1192 [2] = DEFINE_RES_DMA(DMACH_SPI2_RX),
1193 [3] = DEFINE_RES_IRQ(IRQ_SPI2),
1194}; 1193};
1195 1194
1196struct platform_device s3c64xx_device_spi2 = { 1195struct platform_device s3c64xx_device_spi2 = {
@@ -1218,6 +1217,8 @@ void __init s3c64xx_spi2_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
1218 pd.num_cs = num_cs; 1217 pd.num_cs = num_cs;
1219 pd.src_clk_nr = src_clk_nr; 1218 pd.src_clk_nr = src_clk_nr;
1220 pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi2_cfg_gpio; 1219 pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi2_cfg_gpio;
1220 pd.dma_tx = (void *)DMACH_SPI2_TX;
1221 pd.dma_rx = (void *)DMACH_SPI2_RX;
1221#if defined(CONFIG_PL330_DMA) 1222#if defined(CONFIG_PL330_DMA)
1222 pd.filter = pl330_filter; 1223 pd.filter = pl330_filter;
1223#elif defined(CONFIG_S3C64XX_PL080) 1224#elif defined(CONFIG_S3C64XX_PL080)
diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index 8e86e7f6663a..b954c5444cca 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -133,7 +133,6 @@
133struct s3c64xx_spi_dma_data { 133struct s3c64xx_spi_dma_data {
134 struct dma_chan *ch; 134 struct dma_chan *ch;
135 enum dma_transfer_direction direction; 135 enum dma_transfer_direction direction;
136 unsigned int dmach;
137}; 136};
138 137
139/** 138/**
@@ -325,7 +324,7 @@ static int s3c64xx_spi_prepare_transfer(struct spi_master *spi)
325 324
326 /* Acquire DMA channels */ 325 /* Acquire DMA channels */
327 sdd->rx_dma.ch = dma_request_slave_channel_compat(mask, filter, 326 sdd->rx_dma.ch = dma_request_slave_channel_compat(mask, filter,
328 (void *)(long)sdd->rx_dma.dmach, dev, "rx"); 327 sdd->cntrlr_info->dma_rx, dev, "rx");
329 if (!sdd->rx_dma.ch) { 328 if (!sdd->rx_dma.ch) {
330 dev_err(dev, "Failed to get RX DMA channel\n"); 329 dev_err(dev, "Failed to get RX DMA channel\n");
331 ret = -EBUSY; 330 ret = -EBUSY;
@@ -334,7 +333,7 @@ static int s3c64xx_spi_prepare_transfer(struct spi_master *spi)
334 spi->dma_rx = sdd->rx_dma.ch; 333 spi->dma_rx = sdd->rx_dma.ch;
335 334
336 sdd->tx_dma.ch = dma_request_slave_channel_compat(mask, filter, 335 sdd->tx_dma.ch = dma_request_slave_channel_compat(mask, filter,
337 (void *)(long)sdd->tx_dma.dmach, dev, "tx"); 336 sdd->cntrlr_info->dma_tx, dev, "tx");
338 if (!sdd->tx_dma.ch) { 337 if (!sdd->tx_dma.ch) {
339 dev_err(dev, "Failed to get TX DMA channel\n"); 338 dev_err(dev, "Failed to get TX DMA channel\n");
340 ret = -EBUSY; 339 ret = -EBUSY;
@@ -1028,7 +1027,6 @@ static inline struct s3c64xx_spi_port_config *s3c64xx_spi_get_port_config(
1028static int s3c64xx_spi_probe(struct platform_device *pdev) 1027static int s3c64xx_spi_probe(struct platform_device *pdev)
1029{ 1028{
1030 struct resource *mem_res; 1029 struct resource *mem_res;
1031 struct resource *res;
1032 struct s3c64xx_spi_driver_data *sdd; 1030 struct s3c64xx_spi_driver_data *sdd;
1033 struct s3c64xx_spi_info *sci = dev_get_platdata(&pdev->dev); 1031 struct s3c64xx_spi_info *sci = dev_get_platdata(&pdev->dev);
1034 struct spi_master *master; 1032 struct spi_master *master;
@@ -1087,20 +1085,9 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
1087 1085
1088 sdd->cur_bpw = 8; 1086 sdd->cur_bpw = 8;
1089 1087
1090 if (!sdd->pdev->dev.of_node) { 1088 if (!sdd->pdev->dev.of_node && (!sci->dma_tx || !sci->dma_rx)) {
1091 res = platform_get_resource(pdev, IORESOURCE_DMA, 0); 1089 dev_warn(&pdev->dev, "Unable to get SPI tx/rx DMA data. Switching to poll mode\n");
1092 if (!res) { 1090 sdd->port_conf->quirks = S3C64XX_SPI_QUIRK_POLL;
1093 dev_warn(&pdev->dev, "Unable to get SPI tx dma resource. Switching to poll mode\n");
1094 sdd->port_conf->quirks = S3C64XX_SPI_QUIRK_POLL;
1095 } else
1096 sdd->tx_dma.dmach = res->start;
1097
1098 res = platform_get_resource(pdev, IORESOURCE_DMA, 1);
1099 if (!res) {
1100 dev_warn(&pdev->dev, "Unable to get SPI rx dma resource. Switching to poll mode\n");
1101 sdd->port_conf->quirks = S3C64XX_SPI_QUIRK_POLL;
1102 } else
1103 sdd->rx_dma.dmach = res->start;
1104 } 1091 }
1105 1092
1106 sdd->tx_dma.direction = DMA_MEM_TO_DEV; 1093 sdd->tx_dma.direction = DMA_MEM_TO_DEV;
@@ -1197,9 +1184,9 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
1197 1184
1198 dev_dbg(&pdev->dev, "Samsung SoC SPI Driver loaded for Bus SPI-%d with %d Slaves attached\n", 1185 dev_dbg(&pdev->dev, "Samsung SoC SPI Driver loaded for Bus SPI-%d with %d Slaves attached\n",
1199 sdd->port_id, master->num_chipselect); 1186 sdd->port_id, master->num_chipselect);
1200 dev_dbg(&pdev->dev, "\tIOmem=[%pR]\tFIFO %dbytes\tDMA=[Rx-%d, Tx-%d]\n", 1187 dev_dbg(&pdev->dev, "\tIOmem=[%pR]\tFIFO %dbytes\tDMA=[Rx-%p, Tx-%p]\n",
1201 mem_res, (FIFO_LVL_MASK(sdd) >> 1) + 1, 1188 mem_res, (FIFO_LVL_MASK(sdd) >> 1) + 1,
1202 sdd->rx_dma.dmach, sdd->tx_dma.dmach); 1189 sci->dma_rx, sci->dma_tx);
1203 1190
1204 pm_runtime_mark_last_busy(&pdev->dev); 1191 pm_runtime_mark_last_busy(&pdev->dev);
1205 pm_runtime_put_autosuspend(&pdev->dev); 1192 pm_runtime_put_autosuspend(&pdev->dev);
diff --git a/include/linux/platform_data/spi-s3c64xx.h b/include/linux/platform_data/spi-s3c64xx.h
index d3889b98a1a1..fb5625bcca9a 100644
--- a/include/linux/platform_data/spi-s3c64xx.h
+++ b/include/linux/platform_data/spi-s3c64xx.h
@@ -40,6 +40,8 @@ struct s3c64xx_spi_info {
40 int num_cs; 40 int num_cs;
41 int (*cfg_gpio)(void); 41 int (*cfg_gpio)(void);
42 dma_filter_fn filter; 42 dma_filter_fn filter;
43 void *dma_tx;
44 void *dma_rx;
43}; 45};
44 46
45/** 47/**