spi: dw-mmio: add ACPI support
authorJay Fang <f.fangjian@huawei.com>
Mon, 3 Dec 2018 03:15:50 +0000 (11:15 +0800)
committerMark Brown <broonie@kernel.org>
Tue, 4 Dec 2018 17:24:57 +0000 (17:24 +0000)
The Hisilicon Hip08 platform, that uses ACPI, has this controller.
Let's add ACPI support for DW SPI MMIO-based host.

The ACPI ID used is "HISI0173" for the Designware SPI controller of
Hisilicon Hip08 platform.

Signed-off-by: Jay Fang <f.fangjian@huawei.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-dw-mmio.c
drivers/spi/spi-dw.c

index 3ffb6a40fe0c3040aada120769bf3a0dc7286012..d0dd7814e997834793f3e1e49339bd28c73d15ee 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/of.h>
 #include <linux/of_gpio.h>
 #include <linux/of_platform.h>
+#include <linux/acpi.h>
 #include <linux/property.h>
 #include <linux/regmap.h>
 
@@ -243,12 +244,19 @@ static const struct of_device_id dw_spi_mmio_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, dw_spi_mmio_of_match);
 
+static const struct acpi_device_id dw_spi_mmio_acpi_match[] = {
+       {"HISI0173", 0},
+       {},
+};
+MODULE_DEVICE_TABLE(acpi, dw_spi_mmio_acpi_match);
+
 static struct platform_driver dw_spi_mmio_driver = {
        .probe          = dw_spi_mmio_probe,
        .remove         = dw_spi_mmio_remove,
        .driver         = {
                .name   = DRIVER_NAME,
                .of_match_table = dw_spi_mmio_of_match,
+               .acpi_match_table = ACPI_PTR(dw_spi_mmio_acpi_match),
        },
 };
 module_platform_driver(dw_spi_mmio_driver);
index b705f2bdb8b9493cd39d416d512084f4b8d33849..2e822a56576acfa04afaf3c51064cdcd7d7d82c5 100644 (file)
@@ -507,6 +507,7 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws)
        master->handle_err = dw_spi_handle_err;
        master->max_speed_hz = dws->max_freq;
        master->dev.of_node = dev->of_node;
+       master->dev.fwnode = dev->fwnode;
        master->flags = SPI_MASTER_GPIO_SS;
 
        if (dws->set_cs)