0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include <linux/acpi.h>
0012 #include <linux/ioport.h>
0013 #include <linux/kernel.h>
0014 #include <linux/module.h>
0015 #include <linux/pm_runtime.h>
0016 #include <linux/platform_device.h>
0017 #include <linux/property.h>
0018 #include <linux/pxa2xx_ssp.h>
0019
0020 #include "intel-lpss.h"
0021
0022 static const struct property_entry spt_spi_properties[] = {
0023 PROPERTY_ENTRY_U32("intel,spi-pxa2xx-type", LPSS_SPT_SSP),
0024 { }
0025 };
0026
0027 static const struct software_node spt_spi_node = {
0028 .properties = spt_spi_properties,
0029 };
0030
0031 static const struct intel_lpss_platform_info spt_info = {
0032 .clk_rate = 120000000,
0033 .swnode = &spt_spi_node,
0034 };
0035
0036 static const struct property_entry spt_i2c_properties[] = {
0037 PROPERTY_ENTRY_U32("i2c-sda-hold-time-ns", 230),
0038 { },
0039 };
0040
0041 static const struct software_node spt_i2c_node = {
0042 .properties = spt_i2c_properties,
0043 };
0044
0045 static const struct intel_lpss_platform_info spt_i2c_info = {
0046 .clk_rate = 120000000,
0047 .swnode = &spt_i2c_node,
0048 };
0049
0050 static const struct property_entry uart_properties[] = {
0051 PROPERTY_ENTRY_U32("reg-io-width", 4),
0052 PROPERTY_ENTRY_U32("reg-shift", 2),
0053 PROPERTY_ENTRY_BOOL("snps,uart-16550-compatible"),
0054 { },
0055 };
0056
0057 static const struct software_node uart_node = {
0058 .properties = uart_properties,
0059 };
0060
0061 static const struct intel_lpss_platform_info spt_uart_info = {
0062 .clk_rate = 120000000,
0063 .clk_con_id = "baudclk",
0064 .swnode = &uart_node,
0065 };
0066
0067 static const struct property_entry bxt_spi_properties[] = {
0068 PROPERTY_ENTRY_U32("intel,spi-pxa2xx-type", LPSS_BXT_SSP),
0069 { }
0070 };
0071
0072 static const struct software_node bxt_spi_node = {
0073 .properties = bxt_spi_properties,
0074 };
0075
0076 static const struct intel_lpss_platform_info bxt_info = {
0077 .clk_rate = 100000000,
0078 .swnode = &bxt_spi_node,
0079 };
0080
0081 static const struct property_entry bxt_i2c_properties[] = {
0082 PROPERTY_ENTRY_U32("i2c-sda-hold-time-ns", 42),
0083 PROPERTY_ENTRY_U32("i2c-sda-falling-time-ns", 171),
0084 PROPERTY_ENTRY_U32("i2c-scl-falling-time-ns", 208),
0085 { },
0086 };
0087
0088 static const struct software_node bxt_i2c_node = {
0089 .properties = bxt_i2c_properties,
0090 };
0091
0092 static const struct intel_lpss_platform_info bxt_i2c_info = {
0093 .clk_rate = 133000000,
0094 .swnode = &bxt_i2c_node,
0095 };
0096
0097 static const struct property_entry apl_i2c_properties[] = {
0098 PROPERTY_ENTRY_U32("i2c-sda-hold-time-ns", 207),
0099 PROPERTY_ENTRY_U32("i2c-sda-falling-time-ns", 171),
0100 PROPERTY_ENTRY_U32("i2c-scl-falling-time-ns", 208),
0101 { },
0102 };
0103
0104 static const struct software_node apl_i2c_node = {
0105 .properties = apl_i2c_properties,
0106 };
0107
0108 static const struct intel_lpss_platform_info apl_i2c_info = {
0109 .clk_rate = 133000000,
0110 .swnode = &apl_i2c_node,
0111 };
0112
0113 static const struct property_entry cnl_spi_properties[] = {
0114 PROPERTY_ENTRY_U32("intel,spi-pxa2xx-type", LPSS_CNL_SSP),
0115 { }
0116 };
0117
0118 static const struct software_node cnl_spi_node = {
0119 .properties = cnl_spi_properties,
0120 };
0121
0122 static const struct intel_lpss_platform_info cnl_info = {
0123 .clk_rate = 120000000,
0124 .swnode = &cnl_spi_node,
0125 };
0126
0127 static const struct intel_lpss_platform_info cnl_i2c_info = {
0128 .clk_rate = 216000000,
0129 .swnode = &spt_i2c_node,
0130 };
0131
0132 static const struct acpi_device_id intel_lpss_acpi_ids[] = {
0133
0134 { "INT3440", (kernel_ulong_t)&spt_info },
0135 { "INT3441", (kernel_ulong_t)&spt_info },
0136 { "INT3442", (kernel_ulong_t)&spt_i2c_info },
0137 { "INT3443", (kernel_ulong_t)&spt_i2c_info },
0138 { "INT3444", (kernel_ulong_t)&spt_i2c_info },
0139 { "INT3445", (kernel_ulong_t)&spt_i2c_info },
0140 { "INT3446", (kernel_ulong_t)&spt_i2c_info },
0141 { "INT3447", (kernel_ulong_t)&spt_i2c_info },
0142 { "INT3448", (kernel_ulong_t)&spt_uart_info },
0143 { "INT3449", (kernel_ulong_t)&spt_uart_info },
0144 { "INT344A", (kernel_ulong_t)&spt_uart_info },
0145
0146 { "INT34B0", (kernel_ulong_t)&cnl_info },
0147 { "INT34B1", (kernel_ulong_t)&cnl_info },
0148 { "INT34B2", (kernel_ulong_t)&cnl_i2c_info },
0149 { "INT34B3", (kernel_ulong_t)&cnl_i2c_info },
0150 { "INT34B4", (kernel_ulong_t)&cnl_i2c_info },
0151 { "INT34B5", (kernel_ulong_t)&cnl_i2c_info },
0152 { "INT34B6", (kernel_ulong_t)&cnl_i2c_info },
0153 { "INT34B7", (kernel_ulong_t)&cnl_i2c_info },
0154 { "INT34B8", (kernel_ulong_t)&spt_uart_info },
0155 { "INT34B9", (kernel_ulong_t)&spt_uart_info },
0156 { "INT34BA", (kernel_ulong_t)&spt_uart_info },
0157 { "INT34BC", (kernel_ulong_t)&cnl_info },
0158
0159 { "80860AAC", (kernel_ulong_t)&bxt_i2c_info },
0160 { "80860ABC", (kernel_ulong_t)&bxt_info },
0161 { "80860AC2", (kernel_ulong_t)&bxt_info },
0162
0163 { "80865AAC", (kernel_ulong_t)&apl_i2c_info },
0164 { "80865ABC", (kernel_ulong_t)&bxt_info },
0165 { "80865AC2", (kernel_ulong_t)&bxt_info },
0166 { }
0167 };
0168 MODULE_DEVICE_TABLE(acpi, intel_lpss_acpi_ids);
0169
0170 static int intel_lpss_acpi_probe(struct platform_device *pdev)
0171 {
0172 struct intel_lpss_platform_info *info;
0173 const struct acpi_device_id *id;
0174 int ret;
0175
0176 id = acpi_match_device(intel_lpss_acpi_ids, &pdev->dev);
0177 if (!id)
0178 return -ENODEV;
0179
0180 info = devm_kmemdup(&pdev->dev, (void *)id->driver_data, sizeof(*info),
0181 GFP_KERNEL);
0182 if (!info)
0183 return -ENOMEM;
0184
0185 info->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
0186 info->irq = platform_get_irq(pdev, 0);
0187
0188 ret = intel_lpss_probe(&pdev->dev, info);
0189 if (ret)
0190 return ret;
0191
0192 pm_runtime_set_active(&pdev->dev);
0193 pm_runtime_enable(&pdev->dev);
0194
0195 return 0;
0196 }
0197
0198 static int intel_lpss_acpi_remove(struct platform_device *pdev)
0199 {
0200 intel_lpss_remove(&pdev->dev);
0201 pm_runtime_disable(&pdev->dev);
0202
0203 return 0;
0204 }
0205
0206 static INTEL_LPSS_PM_OPS(intel_lpss_acpi_pm_ops);
0207
0208 static struct platform_driver intel_lpss_acpi_driver = {
0209 .probe = intel_lpss_acpi_probe,
0210 .remove = intel_lpss_acpi_remove,
0211 .driver = {
0212 .name = "intel-lpss",
0213 .acpi_match_table = intel_lpss_acpi_ids,
0214 .pm = &intel_lpss_acpi_pm_ops,
0215 },
0216 };
0217
0218 module_platform_driver(intel_lpss_acpi_driver);
0219
0220 MODULE_AUTHOR("Andy Shevchenko <andriy.shevchenko@linux.intel.com>");
0221 MODULE_AUTHOR("Mika Westerberg <mika.westerberg@linux.intel.com>");
0222 MODULE_DESCRIPTION("Intel LPSS ACPI driver");
0223 MODULE_LICENSE("GPL v2");