Message ID | 1453807111-103111-3-git-send-email-mika.westerberg@linux.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Mika, [auto build test ERROR on spi/for-next] [also build test ERROR on v4.5-rc1 next-20160125] [if your patch is applied to the wrong git tree, please drop us a note to help improving the system] url: https://github.com/0day-ci/linux/commits/Mika-Westerberg/spi-pxa2xx-Chip-select-fixes-for-Intel-Baytrail-and-Braswell/20160126-192113 base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi for-next config: arm-zeus_defconfig (attached as .config) reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=arm All errors (new ones prefixed by >>): drivers/spi/spi-pxa2xx.c: In function 'pxa2xx_spi_probe': >> drivers/spi/spi-pxa2xx.c:1512:28: error: 'pxa2xx_spi_fw_translate_cs' undeclared (first use in this function) master->fw_translate_cs = pxa2xx_spi_fw_translate_cs; ^ drivers/spi/spi-pxa2xx.c:1512:28: note: each undeclared identifier is reported only once for each function it appears in vim +/pxa2xx_spi_fw_translate_cs +1512 drivers/spi/spi-pxa2xx.c 1506 master->bus_num = ssp->port_id; 1507 master->dma_alignment = DMA_ALIGNMENT; 1508 master->cleanup = cleanup; 1509 master->setup = setup; 1510 master->transfer_one_message = pxa2xx_spi_transfer_one_message; 1511 master->unprepare_transfer_hardware = pxa2xx_spi_unprepare_transfer; > 1512 master->fw_translate_cs = pxa2xx_spi_fw_translate_cs; 1513 master->auto_runtime_pm = true; 1514 1515 drv_data->ssp_type = ssp->type; --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
On Tue, Jan 26, 2016 at 01:18:29PM +0200, Mika Westerberg wrote: > #else /* !CONFIG_ACPI */ > static int pxa2xx_spi_get_port_id(struct acpi_device *adev) > { > return -1; > } > +#define pxa2xx_spi_fw_translate_cs NULL I need to move this elsewhere because it is still guarded by CONFIG_PCI as pointed out by kbuild robot. Will do that in next revision. -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index ab9914ad8365..baa98365a490 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -1328,11 +1328,30 @@ static int pxa2xx_spi_get_port_id(struct acpi_device *adev) port_id = devid; return port_id; } + +static int pxa2xx_spi_fw_translate_cs(struct spi_master *master, unsigned cs) +{ + struct driver_data *drv_data = spi_master_get_devdata(master); + + switch (drv_data->ssp_type) { + /* + * For Atoms the Windows driver starts enumerating chip selects + * from 1 instead of 0 so translate it here to match what Linux + * expects. + */ + case LPSS_BYT_SSP: + return cs - 1; + + default: + return cs; + } +} #else /* !CONFIG_ACPI */ static int pxa2xx_spi_get_port_id(struct acpi_device *adev) { return -1; } +#define pxa2xx_spi_fw_translate_cs NULL #endif /* @@ -1490,6 +1509,7 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) master->setup = setup; master->transfer_one_message = pxa2xx_spi_transfer_one_message; master->unprepare_transfer_hardware = pxa2xx_spi_unprepare_transfer; + master->fw_translate_cs = pxa2xx_spi_fw_translate_cs; master->auto_runtime_pm = true; drv_data->ssp_type = ssp->type;
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> --- drivers/spi/spi-pxa2xx.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)