spi: pxa2xx: Translate ACPI DeviceSelection to Linux chip select on Baytrail
authorMika Westerberg <mika.westerberg@linux.intel.com>
Mon, 8 Feb 2016 15:14:29 +0000 (17:14 +0200)
committerMark Brown <broonie@kernel.org>
Tue, 9 Feb 2016 19:01:01 +0000 (19:01 +0000)
commit0c27d9cf7245d832d3d34f289c1bcd4f7f3fbd30
tree48a988e083ffe1cff8410d109a0409c1611e5436
parentfcdcc79628a1919bde9acf239e364f65bab6327c
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>
drivers/spi/spi-pxa2xx.c