1 // SPDX-License-Identifier: GPL-2.0-only
3 * Intel LPSS ACPI support.
5 * Copyright (C) 2015, Intel Corporation
7 * Authors: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
8 * Mika Westerberg <mika.westerberg@linux.intel.com>
11 #include <linux/acpi.h>
12 #include <linux/ioport.h>
13 #include <linux/kernel.h>
14 #include <linux/module.h>
15 #include <linux/pm_runtime.h>
16 #include <linux/platform_device.h>
17 #include <linux/property.h>
18 #include <linux/pxa2xx_ssp.h>
20 #include "intel-lpss.h"
22 static const struct property_entry spt_spi_properties[] = {
23 PROPERTY_ENTRY_U32("intel,spi-pxa2xx-type", LPSS_SPT_SSP),
27 static const struct software_node spt_spi_node = {
28 .properties = spt_spi_properties,
31 static const struct intel_lpss_platform_info spt_info = {
32 .clk_rate = 120000000,
33 .swnode = &spt_spi_node,
36 static const struct property_entry spt_i2c_properties[] = {
37 PROPERTY_ENTRY_U32("i2c-sda-hold-time-ns", 230),
41 static const struct software_node spt_i2c_node = {
42 .properties = spt_i2c_properties,
45 static const struct intel_lpss_platform_info spt_i2c_info = {
46 .clk_rate = 120000000,
47 .swnode = &spt_i2c_node,
50 static const struct property_entry uart_properties[] = {
51 PROPERTY_ENTRY_U32("reg-io-width", 4),
52 PROPERTY_ENTRY_U32("reg-shift", 2),
53 PROPERTY_ENTRY_BOOL("snps,uart-16550-compatible"),
57 static const struct software_node uart_node = {
58 .properties = uart_properties,
61 static const struct intel_lpss_platform_info spt_uart_info = {
62 .clk_rate = 120000000,
63 .clk_con_id = "baudclk",
67 static const struct property_entry bxt_spi_properties[] = {
68 PROPERTY_ENTRY_U32("intel,spi-pxa2xx-type", LPSS_BXT_SSP),
72 static const struct software_node bxt_spi_node = {
73 .properties = bxt_spi_properties,
76 static const struct intel_lpss_platform_info bxt_info = {
77 .clk_rate = 100000000,
78 .swnode = &bxt_spi_node,
81 static const struct property_entry bxt_i2c_properties[] = {
82 PROPERTY_ENTRY_U32("i2c-sda-hold-time-ns", 42),
83 PROPERTY_ENTRY_U32("i2c-sda-falling-time-ns", 171),
84 PROPERTY_ENTRY_U32("i2c-scl-falling-time-ns", 208),
88 static const struct software_node bxt_i2c_node = {
89 .properties = bxt_i2c_properties,
92 static const struct intel_lpss_platform_info bxt_i2c_info = {
93 .clk_rate = 133000000,
94 .swnode = &bxt_i2c_node,
97 static const struct property_entry apl_i2c_properties[] = {
98 PROPERTY_ENTRY_U32("i2c-sda-hold-time-ns", 207),
99 PROPERTY_ENTRY_U32("i2c-sda-falling-time-ns", 171),
100 PROPERTY_ENTRY_U32("i2c-scl-falling-time-ns", 208),
104 static const struct software_node apl_i2c_node = {
105 .properties = apl_i2c_properties,
108 static const struct intel_lpss_platform_info apl_i2c_info = {
109 .clk_rate = 133000000,
110 .swnode = &apl_i2c_node,
113 static const struct property_entry cnl_spi_properties[] = {
114 PROPERTY_ENTRY_U32("intel,spi-pxa2xx-type", LPSS_CNL_SSP),
118 static const struct software_node cnl_spi_node = {
119 .properties = cnl_spi_properties,
122 static const struct intel_lpss_platform_info cnl_info = {
123 .clk_rate = 120000000,
124 .swnode = &cnl_spi_node,
127 static const struct intel_lpss_platform_info cnl_i2c_info = {
128 .clk_rate = 216000000,
129 .swnode = &spt_i2c_node,
132 static const struct acpi_device_id intel_lpss_acpi_ids[] = {
134 { "INT3440", (kernel_ulong_t)&spt_info },
135 { "INT3441", (kernel_ulong_t)&spt_info },
136 { "INT3442", (kernel_ulong_t)&spt_i2c_info },
137 { "INT3443", (kernel_ulong_t)&spt_i2c_info },
138 { "INT3444", (kernel_ulong_t)&spt_i2c_info },
139 { "INT3445", (kernel_ulong_t)&spt_i2c_info },
140 { "INT3446", (kernel_ulong_t)&spt_i2c_info },
141 { "INT3447", (kernel_ulong_t)&spt_i2c_info },
142 { "INT3448", (kernel_ulong_t)&spt_uart_info },
143 { "INT3449", (kernel_ulong_t)&spt_uart_info },
144 { "INT344A", (kernel_ulong_t)&spt_uart_info },
146 { "INT34B0", (kernel_ulong_t)&cnl_info },
147 { "INT34B1", (kernel_ulong_t)&cnl_info },
148 { "INT34B2", (kernel_ulong_t)&cnl_i2c_info },
149 { "INT34B3", (kernel_ulong_t)&cnl_i2c_info },
150 { "INT34B4", (kernel_ulong_t)&cnl_i2c_info },
151 { "INT34B5", (kernel_ulong_t)&cnl_i2c_info },
152 { "INT34B6", (kernel_ulong_t)&cnl_i2c_info },
153 { "INT34B7", (kernel_ulong_t)&cnl_i2c_info },
154 { "INT34B8", (kernel_ulong_t)&spt_uart_info },
155 { "INT34B9", (kernel_ulong_t)&spt_uart_info },
156 { "INT34BA", (kernel_ulong_t)&spt_uart_info },
157 { "INT34BC", (kernel_ulong_t)&cnl_info },
159 { "80860AAC", (kernel_ulong_t)&bxt_i2c_info },
160 { "80860ABC", (kernel_ulong_t)&bxt_info },
161 { "80860AC2", (kernel_ulong_t)&bxt_info },
163 { "80865AAC", (kernel_ulong_t)&apl_i2c_info },
164 { "80865ABC", (kernel_ulong_t)&bxt_info },
165 { "80865AC2", (kernel_ulong_t)&bxt_info },
168 MODULE_DEVICE_TABLE(acpi, intel_lpss_acpi_ids);
170 static int intel_lpss_acpi_probe(struct platform_device *pdev)
172 struct intel_lpss_platform_info *info;
173 const struct acpi_device_id *id;
176 id = acpi_match_device(intel_lpss_acpi_ids, &pdev->dev);
180 info = devm_kmemdup(&pdev->dev, (void *)id->driver_data, sizeof(*info),
185 info->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
189 info->irq = platform_get_irq(pdev, 0);
191 ret = intel_lpss_probe(&pdev->dev, info);
195 pm_runtime_set_active(&pdev->dev);
196 pm_runtime_enable(&pdev->dev);
201 static int intel_lpss_acpi_remove(struct platform_device *pdev)
203 intel_lpss_remove(&pdev->dev);
204 pm_runtime_disable(&pdev->dev);
209 static INTEL_LPSS_PM_OPS(intel_lpss_acpi_pm_ops);
211 static struct platform_driver intel_lpss_acpi_driver = {
212 .probe = intel_lpss_acpi_probe,
213 .remove = intel_lpss_acpi_remove,
215 .name = "intel-lpss",
216 .acpi_match_table = intel_lpss_acpi_ids,
217 .pm = &intel_lpss_acpi_pm_ops,
221 module_platform_driver(intel_lpss_acpi_driver);
223 MODULE_AUTHOR("Andy Shevchenko <andriy.shevchenko@linux.intel.com>");
224 MODULE_AUTHOR("Mika Westerberg <mika.westerberg@linux.intel.com>");
225 MODULE_DESCRIPTION("Intel LPSS ACPI driver");
226 MODULE_LICENSE("GPL v2");