aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMika Westerberg <mika.westerberg@linux.intel.com>2016-02-08 10:14:31 -0500
committerMark Brown <broonie@kernel.org>2016-02-09 14:01:11 -0500
commit30f3a6ab44d8d06bb3d94f6320e4aa76df59d025 (patch)
tree123be907145582b282d6054f163c14ec4ddc65aa
parentc1e4a53c6b8161ded3a44e3352ef38206d0967ea (diff)
spi: pxa2xx: Add support for both chip selects on Intel Braswell
Intel Braswell LPSS SPI controller actually has two chip selects and there is no capabilities register where this could be found out. These two chip selects are controlled by bits which are in slightly differrent location than Broxton has. Braswell Windows driver also starts chip select (ACPI DeviceSelection) numbering from 1 so translate it to be suitable for Linux as well. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--drivers/spi/spi-pxa2xx.c21
-rw-r--r--include/linux/pxa2xx_ssp.h1
2 files changed, 21 insertions, 1 deletions
diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c
index 81d68e01046a..0eb79368eabc 100644
--- a/drivers/spi/spi-pxa2xx.c
+++ b/drivers/spi/spi-pxa2xx.c
@@ -83,6 +83,7 @@ struct lpss_config {
83 /* Chip select control */ 83 /* Chip select control */
84 unsigned cs_sel_shift; 84 unsigned cs_sel_shift;
85 unsigned cs_sel_mask; 85 unsigned cs_sel_mask;
86 unsigned cs_num;
86}; 87};
87 88
88/* Keep these sorted with enum pxa_ssp_type */ 89/* Keep these sorted with enum pxa_ssp_type */
@@ -107,6 +108,19 @@ static const struct lpss_config lpss_platforms[] = {
107 .tx_threshold_lo = 160, 108 .tx_threshold_lo = 160,
108 .tx_threshold_hi = 224, 109 .tx_threshold_hi = 224,
109 }, 110 },
111 { /* LPSS_BSW_SSP */
112 .offset = 0x400,
113 .reg_general = 0x08,
114 .reg_ssp = 0x0c,
115 .reg_cs_ctrl = 0x18,
116 .reg_capabilities = -1,
117 .rx_threshold = 64,
118 .tx_threshold_lo = 160,
119 .tx_threshold_hi = 224,
120 .cs_sel_shift = 2,
121 .cs_sel_mask = 1 << 2,
122 .cs_num = 2,
123 },
110 { /* LPSS_SPT_SSP */ 124 { /* LPSS_SPT_SSP */
111 .offset = 0x200, 125 .offset = 0x200,
112 .reg_general = -1, 126 .reg_general = -1,
@@ -142,6 +156,7 @@ static bool is_lpss_ssp(const struct driver_data *drv_data)
142 switch (drv_data->ssp_type) { 156 switch (drv_data->ssp_type) {
143 case LPSS_LPT_SSP: 157 case LPSS_LPT_SSP:
144 case LPSS_BYT_SSP: 158 case LPSS_BYT_SSP:
159 case LPSS_BSW_SSP:
145 case LPSS_SPT_SSP: 160 case LPSS_SPT_SSP:
146 case LPSS_BXT_SSP: 161 case LPSS_BXT_SSP:
147 return true; 162 return true;
@@ -1189,6 +1204,7 @@ static int setup(struct spi_device *spi)
1189 break; 1204 break;
1190 case LPSS_LPT_SSP: 1205 case LPSS_LPT_SSP:
1191 case LPSS_BYT_SSP: 1206 case LPSS_BYT_SSP:
1207 case LPSS_BSW_SSP:
1192 case LPSS_SPT_SSP: 1208 case LPSS_SPT_SSP:
1193 case LPSS_BXT_SSP: 1209 case LPSS_BXT_SSP:
1194 config = lpss_get_config(drv_data); 1210 config = lpss_get_config(drv_data);
@@ -1336,7 +1352,7 @@ static const struct acpi_device_id pxa2xx_spi_acpi_match[] = {
1336 { "INT3430", LPSS_LPT_SSP }, 1352 { "INT3430", LPSS_LPT_SSP },
1337 { "INT3431", LPSS_LPT_SSP }, 1353 { "INT3431", LPSS_LPT_SSP },
1338 { "80860F0E", LPSS_BYT_SSP }, 1354 { "80860F0E", LPSS_BYT_SSP },
1339 { "8086228E", LPSS_BYT_SSP }, 1355 { "8086228E", LPSS_BSW_SSP },
1340 { }, 1356 { },
1341}; 1357};
1342MODULE_DEVICE_TABLE(acpi, pxa2xx_spi_acpi_match); 1358MODULE_DEVICE_TABLE(acpi, pxa2xx_spi_acpi_match);
@@ -1473,6 +1489,7 @@ static int pxa2xx_spi_fw_translate_cs(struct spi_master *master, unsigned cs)
1473 * to match what Linux expects. 1489 * to match what Linux expects.
1474 */ 1490 */
1475 case LPSS_BYT_SSP: 1491 case LPSS_BYT_SSP:
1492 case LPSS_BSW_SSP:
1476 return cs - 1; 1493 return cs - 1;
1477 1494
1478 default: 1495 default:
@@ -1622,6 +1639,8 @@ static int pxa2xx_spi_probe(struct platform_device *pdev)
1622 tmp &= LPSS_CAPS_CS_EN_MASK; 1639 tmp &= LPSS_CAPS_CS_EN_MASK;
1623 tmp >>= LPSS_CAPS_CS_EN_SHIFT; 1640 tmp >>= LPSS_CAPS_CS_EN_SHIFT;
1624 platform_info->num_chipselect = ffz(tmp); 1641 platform_info->num_chipselect = ffz(tmp);
1642 } else if (config->cs_num) {
1643 platform_info->num_chipselect = config->cs_num;
1625 } 1644 }
1626 } 1645 }
1627 master->num_chipselect = platform_info->num_chipselect; 1646 master->num_chipselect = platform_info->num_chipselect;
diff --git a/include/linux/pxa2xx_ssp.h b/include/linux/pxa2xx_ssp.h
index c2f2574ff61c..2a097d176ba9 100644
--- a/include/linux/pxa2xx_ssp.h
+++ b/include/linux/pxa2xx_ssp.h
@@ -197,6 +197,7 @@ enum pxa_ssp_type {
197 QUARK_X1000_SSP, 197 QUARK_X1000_SSP,
198 LPSS_LPT_SSP, /* Keep LPSS types sorted with lpss_platforms[] */ 198 LPSS_LPT_SSP, /* Keep LPSS types sorted with lpss_platforms[] */
199 LPSS_BYT_SSP, 199 LPSS_BYT_SSP,
200 LPSS_BSW_SSP,
200 LPSS_SPT_SSP, 201 LPSS_SPT_SSP,
201 LPSS_BXT_SSP, 202 LPSS_BXT_SSP,
202}; 203};