spi-pxa2xx.c (b7c08cf85c9a3a4b05474b7acacc9fbce8fb3eaf) spi-pxa2xx.c (0db642151ad80967e9e1c2abf3e19bd7902ecdc9)
1/*
2 * Copyright (C) 2005 Stephen Street / StreetFire Sound Labs
3 * Copyright (C) 2013, Intel Corporation
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.

--- 1286 unchanged lines hidden (view full) ---

1295 return;
1296
1297 if (drv_data->ssp_type != CE4100_SSP && gpio_is_valid(chip->gpio_cs))
1298 gpio_free(chip->gpio_cs);
1299
1300 kfree(chip);
1301}
1302
1/*
2 * Copyright (C) 2005 Stephen Street / StreetFire Sound Labs
3 * Copyright (C) 2013, Intel Corporation
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.

--- 1286 unchanged lines hidden (view full) ---

1295 return;
1296
1297 if (drv_data->ssp_type != CE4100_SSP && gpio_is_valid(chip->gpio_cs))
1298 gpio_free(chip->gpio_cs);
1299
1300 kfree(chip);
1301}
1302
1303#ifdef CONFIG_PCI
1303#ifdef CONFIG_ACPI
1304
1305static const struct acpi_device_id pxa2xx_spi_acpi_match[] = {
1306 { "INT33C0", LPSS_LPT_SSP },
1307 { "INT33C1", LPSS_LPT_SSP },
1308 { "INT3430", LPSS_LPT_SSP },
1309 { "INT3431", LPSS_LPT_SSP },
1310 { "80860F0E", LPSS_BYT_SSP },
1311 { "8086228E", LPSS_BYT_SSP },
1312 { },
1313};
1314MODULE_DEVICE_TABLE(acpi, pxa2xx_spi_acpi_match);
1315
1304#ifdef CONFIG_ACPI
1305
1306static const struct acpi_device_id pxa2xx_spi_acpi_match[] = {
1307 { "INT33C0", LPSS_LPT_SSP },
1308 { "INT33C1", LPSS_LPT_SSP },
1309 { "INT3430", LPSS_LPT_SSP },
1310 { "INT3431", LPSS_LPT_SSP },
1311 { "80860F0E", LPSS_BYT_SSP },
1312 { "8086228E", LPSS_BYT_SSP },
1313 { },
1314};
1315MODULE_DEVICE_TABLE(acpi, pxa2xx_spi_acpi_match);
1316
1317static int pxa2xx_spi_get_port_id(struct acpi_device *adev)
1318{
1319 unsigned int devid;
1320 int port_id = -1;
1321
1322 if (adev && adev->pnp.unique_id &&
1323 !kstrtouint(adev->pnp.unique_id, 0, &devid))
1324 port_id = devid;
1325 return port_id;
1326}
1327#else /* !CONFIG_ACPI */
1328static int pxa2xx_spi_get_port_id(struct acpi_device *adev)
1329{
1330 return -1;
1331}
1332#endif
1333
1316/*
1317 * PCI IDs of compound devices that integrate both host controller and private
1318 * integrated DMA engine. Please note these are not used in module
1319 * autoloading and probing in this module but matching the LPSS SSP type.
1320 */
1321static const struct pci_device_id pxa2xx_spi_pci_compound_match[] = {
1322 /* SPT-LP */
1323 { PCI_VDEVICE(INTEL, 0x9d29), LPSS_SPT_SSP },

--- 18 unchanged lines hidden (view full) ---

1342
1343 if (dev != chan->device->dev->parent)
1344 return false;
1345
1346 return true;
1347}
1348
1349static struct pxa2xx_spi_master *
1334/*
1335 * PCI IDs of compound devices that integrate both host controller and private
1336 * integrated DMA engine. Please note these are not used in module
1337 * autoloading and probing in this module but matching the LPSS SSP type.
1338 */
1339static const struct pci_device_id pxa2xx_spi_pci_compound_match[] = {
1340 /* SPT-LP */
1341 { PCI_VDEVICE(INTEL, 0x9d29), LPSS_SPT_SSP },

--- 18 unchanged lines hidden (view full) ---

1360
1361 if (dev != chan->device->dev->parent)
1362 return false;
1363
1364 return true;
1365}
1366
1367static struct pxa2xx_spi_master *
1350pxa2xx_spi_acpi_get_pdata(struct platform_device *pdev)
1368pxa2xx_spi_init_pdata(struct platform_device *pdev)
1351{
1352 struct pxa2xx_spi_master *pdata;
1353 struct acpi_device *adev;
1354 struct ssp_device *ssp;
1355 struct resource *res;
1356 const struct acpi_device_id *adev_id = NULL;
1357 const struct pci_device_id *pcidev_id = NULL;
1369{
1370 struct pxa2xx_spi_master *pdata;
1371 struct acpi_device *adev;
1372 struct ssp_device *ssp;
1373 struct resource *res;
1374 const struct acpi_device_id *adev_id = NULL;
1375 const struct pci_device_id *pcidev_id = NULL;
1358 unsigned int devid;
1359 int type;
1360
1361 adev = ACPI_COMPANION(&pdev->dev);
1376 int type;
1377
1378 adev = ACPI_COMPANION(&pdev->dev);
1362 if (!adev)
1363 return NULL;
1364
1365 if (dev_is_pci(pdev->dev.parent))
1366 pcidev_id = pci_match_id(pxa2xx_spi_pci_compound_match,
1367 to_pci_dev(pdev->dev.parent));
1379
1380 if (dev_is_pci(pdev->dev.parent))
1381 pcidev_id = pci_match_id(pxa2xx_spi_pci_compound_match,
1382 to_pci_dev(pdev->dev.parent));
1368 else
1383 else if (adev)
1369 adev_id = acpi_match_device(pdev->dev.driver->acpi_match_table,
1370 &pdev->dev);
1384 adev_id = acpi_match_device(pdev->dev.driver->acpi_match_table,
1385 &pdev->dev);
1386 else
1387 return NULL;
1371
1372 if (adev_id)
1373 type = (int)adev_id->driver_data;
1374 else if (pcidev_id)
1375 type = (int)pcidev_id->driver_data;
1376 else
1377 return NULL;
1378

--- 17 unchanged lines hidden (view full) ---

1396 pdata->rx_param = pdev->dev.parent;
1397 pdata->dma_filter = pxa2xx_spi_idma_filter;
1398 }
1399
1400 ssp->clk = devm_clk_get(&pdev->dev, NULL);
1401 ssp->irq = platform_get_irq(pdev, 0);
1402 ssp->type = type;
1403 ssp->pdev = pdev;
1388
1389 if (adev_id)
1390 type = (int)adev_id->driver_data;
1391 else if (pcidev_id)
1392 type = (int)pcidev_id->driver_data;
1393 else
1394 return NULL;
1395

--- 17 unchanged lines hidden (view full) ---

1413 pdata->rx_param = pdev->dev.parent;
1414 pdata->dma_filter = pxa2xx_spi_idma_filter;
1415 }
1416
1417 ssp->clk = devm_clk_get(&pdev->dev, NULL);
1418 ssp->irq = platform_get_irq(pdev, 0);
1419 ssp->type = type;
1420 ssp->pdev = pdev;
1421 ssp->port_id = pxa2xx_spi_get_port_id(adev);
1404
1422
1405 ssp->port_id = -1;
1406 if (adev->pnp.unique_id && !kstrtouint(adev->pnp.unique_id, 0, &devid))
1407 ssp->port_id = devid;
1408
1409 pdata->num_chipselect = 1;
1410 pdata->enable_dma = true;
1411
1412 return pdata;
1413}
1414
1423 pdata->num_chipselect = 1;
1424 pdata->enable_dma = true;
1425
1426 return pdata;
1427}
1428
1415#else
1429#else /* !CONFIG_PCI */
1416static inline struct pxa2xx_spi_master *
1430static inline struct pxa2xx_spi_master *
1417pxa2xx_spi_acpi_get_pdata(struct platform_device *pdev)
1431pxa2xx_spi_init_pdata(struct platform_device *pdev)
1418{
1419 return NULL;
1420}
1421#endif
1422
1423static int pxa2xx_spi_probe(struct platform_device *pdev)
1424{
1425 struct device *dev = &pdev->dev;
1426 struct pxa2xx_spi_master *platform_info;
1427 struct spi_master *master;
1428 struct driver_data *drv_data;
1429 struct ssp_device *ssp;
1430 const struct lpss_config *config;
1431 int status;
1432 u32 tmp;
1433
1434 platform_info = dev_get_platdata(dev);
1435 if (!platform_info) {
1432{
1433 return NULL;
1434}
1435#endif
1436
1437static int pxa2xx_spi_probe(struct platform_device *pdev)
1438{
1439 struct device *dev = &pdev->dev;
1440 struct pxa2xx_spi_master *platform_info;
1441 struct spi_master *master;
1442 struct driver_data *drv_data;
1443 struct ssp_device *ssp;
1444 const struct lpss_config *config;
1445 int status;
1446 u32 tmp;
1447
1448 platform_info = dev_get_platdata(dev);
1449 if (!platform_info) {
1436 platform_info = pxa2xx_spi_acpi_get_pdata(pdev);
1450 platform_info = pxa2xx_spi_init_pdata(pdev);
1437 if (!platform_info) {
1438 dev_err(&pdev->dev, "missing platform data\n");
1439 return -ENODEV;
1440 }
1441 }
1442
1443 ssp = pxa_ssp_request(pdev->id, pdev->name);
1444 if (!ssp)

--- 280 unchanged lines hidden ---
1451 if (!platform_info) {
1452 dev_err(&pdev->dev, "missing platform data\n");
1453 return -ENODEV;
1454 }
1455 }
1456
1457 ssp = pxa_ssp_request(pdev->id, pdev->name);
1458 if (!ssp)

--- 280 unchanged lines hidden ---