diff options
author | Mika Westerberg <mika.westerberg@linux.intel.com> | 2016-02-08 10:14:29 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2016-02-09 14:01:01 -0500 |
commit | 0c27d9cf7245d832d3d34f289c1bcd4f7f3fbd30 (patch) | |
tree | 48a988e083ffe1cff8410d109a0409c1611e5436 /drivers/spi | |
parent | fcdcc79628a1919bde9acf239e364f65bab6327c (diff) |
spi: pxa2xx: Translate ACPI DeviceSelection to Linux chip select on Baytrail
The Windows Baytrail SPI host controller driver uses 1 as the first (and
only) value for ACPI DeviceSelection like can be seen in DSDT taken from
Lenovo Thinkpad 10:
Device (FPNT)
{
...
Method (_CRS, 0, NotSerialized) // _CRS: Current Resource Settings
{
Name (UBUF, ResourceTemplate ()
{
SpiSerialBus (0x0001, // DeviceSelection
PolarityLow, FourWireMode, 0x08,
ControllerInitiated, 0x007A1200, ClockPolarityLow,
ClockPhaseFirst, "\\_SB.SPI1",
0x00, ResourceConsumer,,)
This will fail to enumerate in Linux with following error:
[ 0.241296] pxa2xx-spi 80860F0E:00: cs1 >= max 1
[ 0.241312] spi_master spi32766: failed to add SPI device VFSI6101:00 from ACPI
To make the Linux SPI core successfully enumerate the device we provide a
custom version of ->fw_translate_cs() that translates DeviceSelection
correctly.
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>
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spi-pxa2xx.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index ce66cf44bba5..7d6d3b74d25b 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c | |||
@@ -1445,6 +1445,28 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev) | |||
1445 | } | 1445 | } |
1446 | #endif | 1446 | #endif |
1447 | 1447 | ||
1448 | static int pxa2xx_spi_fw_translate_cs(struct spi_master *master, unsigned cs) | ||
1449 | { | ||
1450 | struct driver_data *drv_data = spi_master_get_devdata(master); | ||
1451 | |||
1452 | if (has_acpi_companion(&drv_data->pdev->dev)) { | ||
1453 | switch (drv_data->ssp_type) { | ||
1454 | /* | ||
1455 | * For Atoms the ACPI DeviceSelection used by the Windows | ||
1456 | * driver starts from 1 instead of 0 so translate it here | ||
1457 | * to match what Linux expects. | ||
1458 | */ | ||
1459 | case LPSS_BYT_SSP: | ||
1460 | return cs - 1; | ||
1461 | |||
1462 | default: | ||
1463 | break; | ||
1464 | } | ||
1465 | } | ||
1466 | |||
1467 | return cs; | ||
1468 | } | ||
1469 | |||
1448 | static int pxa2xx_spi_probe(struct platform_device *pdev) | 1470 | static int pxa2xx_spi_probe(struct platform_device *pdev) |
1449 | { | 1471 | { |
1450 | struct device *dev = &pdev->dev; | 1472 | struct device *dev = &pdev->dev; |
@@ -1497,6 +1519,7 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) | |||
1497 | master->setup = setup; | 1519 | master->setup = setup; |
1498 | master->transfer_one_message = pxa2xx_spi_transfer_one_message; | 1520 | master->transfer_one_message = pxa2xx_spi_transfer_one_message; |
1499 | master->unprepare_transfer_hardware = pxa2xx_spi_unprepare_transfer; | 1521 | master->unprepare_transfer_hardware = pxa2xx_spi_unprepare_transfer; |
1522 | master->fw_translate_cs = pxa2xx_spi_fw_translate_cs; | ||
1500 | master->auto_runtime_pm = true; | 1523 | master->auto_runtime_pm = true; |
1501 | 1524 | ||
1502 | drv_data->ssp_type = ssp->type; | 1525 | drv_data->ssp_type = ssp->type; |