aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-omap2-mcspi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/spi/spi-omap2-mcspi.c')
-rw-r--r--drivers/spi/spi-omap2-mcspi.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index b1a651ef9579..643e7e27aa47 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -130,6 +130,7 @@ struct omap2_mcspi {
130 struct omap2_mcspi_dma *dma_channels; 130 struct omap2_mcspi_dma *dma_channels;
131 struct device *dev; 131 struct device *dev;
132 struct omap2_mcspi_regs ctx; 132 struct omap2_mcspi_regs ctx;
133 unsigned int pin_dir:1;
133}; 134};
134 135
135struct omap2_mcspi_cs { 136struct omap2_mcspi_cs {
@@ -764,8 +765,15 @@ static int omap2_mcspi_setup_transfer(struct spi_device *spi,
764 /* standard 4-wire master mode: SCK, MOSI/out, MISO/in, nCS 765 /* standard 4-wire master mode: SCK, MOSI/out, MISO/in, nCS
765 * REVISIT: this controller could support SPI_3WIRE mode. 766 * REVISIT: this controller could support SPI_3WIRE mode.
766 */ 767 */
767 l &= ~(OMAP2_MCSPI_CHCONF_IS|OMAP2_MCSPI_CHCONF_DPE1); 768 if (mcspi->pin_dir == MCSPI_PINDIR_D0_OUT_D1_IN) {
768 l |= OMAP2_MCSPI_CHCONF_DPE0; 769 l &= ~OMAP2_MCSPI_CHCONF_IS;
770 l &= ~OMAP2_MCSPI_CHCONF_DPE1;
771 l |= OMAP2_MCSPI_CHCONF_DPE0;
772 } else {
773 l |= OMAP2_MCSPI_CHCONF_IS;
774 l |= OMAP2_MCSPI_CHCONF_DPE1;
775 l &= ~OMAP2_MCSPI_CHCONF_DPE0;
776 }
769 777
770 /* wordlength */ 778 /* wordlength */
771 l &= ~OMAP2_MCSPI_CHCONF_WL_MASK; 779 l &= ~OMAP2_MCSPI_CHCONF_WL_MASK;
@@ -1166,6 +1174,11 @@ static int __devinit omap2_mcspi_probe(struct platform_device *pdev)
1166 master->cleanup = omap2_mcspi_cleanup; 1174 master->cleanup = omap2_mcspi_cleanup;
1167 master->dev.of_node = node; 1175 master->dev.of_node = node;
1168 1176
1177 dev_set_drvdata(&pdev->dev, master);
1178
1179 mcspi = spi_master_get_devdata(master);
1180 mcspi->master = master;
1181
1169 match = of_match_device(omap_mcspi_of_match, &pdev->dev); 1182 match = of_match_device(omap_mcspi_of_match, &pdev->dev);
1170 if (match) { 1183 if (match) {
1171 u32 num_cs = 1; /* default number of chipselect */ 1184 u32 num_cs = 1; /* default number of chipselect */
@@ -1174,19 +1187,17 @@ static int __devinit omap2_mcspi_probe(struct platform_device *pdev)
1174 of_property_read_u32(node, "ti,spi-num-cs", &num_cs); 1187 of_property_read_u32(node, "ti,spi-num-cs", &num_cs);
1175 master->num_chipselect = num_cs; 1188 master->num_chipselect = num_cs;
1176 master->bus_num = bus_num++; 1189 master->bus_num = bus_num++;
1190 if (of_get_property(node, "ti,pindir-d0-in-d1-out", NULL))
1191 mcspi->pin_dir = MCSPI_PINDIR_D0_IN_D1_OUT;
1177 } else { 1192 } else {
1178 pdata = pdev->dev.platform_data; 1193 pdata = pdev->dev.platform_data;
1179 master->num_chipselect = pdata->num_cs; 1194 master->num_chipselect = pdata->num_cs;
1180 if (pdev->id != -1) 1195 if (pdev->id != -1)
1181 master->bus_num = pdev->id; 1196 master->bus_num = pdev->id;
1197 mcspi->pin_dir = pdata->pin_dir;
1182 } 1198 }
1183 regs_offset = pdata->regs_offset; 1199 regs_offset = pdata->regs_offset;
1184 1200
1185 dev_set_drvdata(&pdev->dev, master);
1186
1187 mcspi = spi_master_get_devdata(master);
1188 mcspi->master = master;
1189
1190 r = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1201 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1191 if (r == NULL) { 1202 if (r == NULL) {
1192 status = -ENODEV; 1203 status = -ENODEV;