Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

spi: pxa2xx: Differentiate Intel LPSS types

Intel LPSS SPI properties differ between between platforms. Now private
registers offset 0x400 or 0x800 is autodetected but there is need to
support also other offset and handle a few other differences.

Prepare for that by splitting the LPSS_SSP type into compatible hardware
types and set it now based on PCI or ACPI ID. That type will be used to set
properties that differ between current and upcoming platforms.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Jarkko Nikula and committed by
Mark Brown
03fbf488 b787f68c

+36 -19
+4 -4
drivers/spi/spi-pxa2xx-pci.c
··· 62 62 .max_clk_rate = 3686400, 63 63 }, 64 64 [PORT_BYT] = { 65 - .type = LPSS_SSP, 65 + .type = LPSS_BYT_SSP, 66 66 .port_id = 0, 67 67 .num_chipselect = 1, 68 68 .max_clk_rate = 50000000, ··· 70 70 .rx_param = &byt_rx_param, 71 71 }, 72 72 [PORT_BSW0] = { 73 - .type = LPSS_SSP, 73 + .type = LPSS_BYT_SSP, 74 74 .port_id = 0, 75 75 .num_chipselect = 1, 76 76 .max_clk_rate = 50000000, ··· 78 78 .rx_param = &bsw0_rx_param, 79 79 }, 80 80 [PORT_BSW1] = { 81 - .type = LPSS_SSP, 81 + .type = LPSS_BYT_SSP, 82 82 .port_id = 1, 83 83 .num_chipselect = 1, 84 84 .max_clk_rate = 50000000, ··· 86 86 .rx_param = &bsw1_rx_param, 87 87 }, 88 88 [PORT_BSW2] = { 89 - .type = LPSS_SSP, 89 + .type = LPSS_BYT_SSP, 90 90 .port_id = 2, 91 91 .num_chipselect = 1, 92 92 .max_clk_rate = 50000000,
+30 -14
drivers/spi/spi-pxa2xx.c
··· 74 74 75 75 static bool is_lpss_ssp(const struct driver_data *drv_data) 76 76 { 77 - return drv_data->ssp_type == LPSS_SSP; 77 + switch (drv_data->ssp_type) { 78 + case LPSS_LPT_SSP: 79 + case LPSS_BYT_SSP: 80 + return true; 81 + default: 82 + return false; 83 + } 78 84 } 79 85 80 86 static bool is_quark_x1000_ssp(const struct driver_data *drv_data) ··· 1091 1085 tx_hi_thres = 0; 1092 1086 rx_thres = RX_THRESH_QUARK_X1000_DFLT; 1093 1087 break; 1094 - case LPSS_SSP: 1088 + case LPSS_LPT_SSP: 1089 + case LPSS_BYT_SSP: 1095 1090 tx_thres = LPSS_TX_LOTHRESH_DFLT; 1096 1091 tx_hi_thres = LPSS_TX_HITHRESH_DFLT; 1097 1092 rx_thres = LPSS_RX_THRESH_DFLT; ··· 1249 1242 } 1250 1243 1251 1244 #ifdef CONFIG_ACPI 1245 + 1246 + static struct acpi_device_id pxa2xx_spi_acpi_match[] = { 1247 + { "INT33C0", LPSS_LPT_SSP }, 1248 + { "INT33C1", LPSS_LPT_SSP }, 1249 + { "INT3430", LPSS_LPT_SSP }, 1250 + { "INT3431", LPSS_LPT_SSP }, 1251 + { "80860F0E", LPSS_BYT_SSP }, 1252 + { "8086228E", LPSS_BYT_SSP }, 1253 + { }, 1254 + }; 1255 + MODULE_DEVICE_TABLE(acpi, pxa2xx_spi_acpi_match); 1256 + 1252 1257 static struct pxa2xx_spi_master * 1253 1258 pxa2xx_spi_acpi_get_pdata(struct platform_device *pdev) 1254 1259 { ··· 1268 1249 struct acpi_device *adev; 1269 1250 struct ssp_device *ssp; 1270 1251 struct resource *res; 1271 - int devid; 1252 + const struct acpi_device_id *id; 1253 + int devid, type; 1272 1254 1273 1255 if (!ACPI_HANDLE(&pdev->dev) || 1274 1256 acpi_bus_get_device(ACPI_HANDLE(&pdev->dev), &adev)) 1257 + return NULL; 1258 + 1259 + id = acpi_match_device(pdev->dev.driver->acpi_match_table, &pdev->dev); 1260 + if (id) 1261 + type = (int)id->driver_data; 1262 + else 1275 1263 return NULL; 1276 1264 1277 1265 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); ··· 1298 1272 1299 1273 ssp->clk = devm_clk_get(&pdev->dev, NULL); 1300 1274 ssp->irq = platform_get_irq(pdev, 0); 1301 - ssp->type = LPSS_SSP; 1275 + ssp->type = type; 1302 1276 ssp->pdev = pdev; 1303 1277 1304 1278 ssp->port_id = -1; ··· 1311 1285 return pdata; 1312 1286 } 1313 1287 1314 - static struct acpi_device_id pxa2xx_spi_acpi_match[] = { 1315 - { "INT33C0", 0 }, 1316 - { "INT33C1", 0 }, 1317 - { "INT3430", 0 }, 1318 - { "INT3431", 0 }, 1319 - { "80860F0E", 0 }, 1320 - { "8086228E", 0 }, 1321 - { }, 1322 - }; 1323 - MODULE_DEVICE_TABLE(acpi, pxa2xx_spi_acpi_match); 1324 1288 #else 1325 1289 static inline struct pxa2xx_spi_master * 1326 1290 pxa2xx_spi_acpi_get_pdata(struct platform_device *pdev)
+2 -1
include/linux/pxa2xx_ssp.h
··· 194 194 PXA168_SSP, 195 195 PXA910_SSP, 196 196 CE4100_SSP, 197 - LPSS_SSP, 198 197 QUARK_X1000_SSP, 198 + LPSS_LPT_SSP, 199 + LPSS_BYT_SSP, 199 200 }; 200 201 201 202 struct ssp_device {