aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpi_apd.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/acpi_apd.c')
-rw-r--r--drivers/acpi/acpi_apd.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/drivers/acpi/acpi_apd.c b/drivers/acpi/acpi_apd.c
index 1daf9c46df8e..d58fbf7f04e6 100644
--- a/drivers/acpi/acpi_apd.c
+++ b/drivers/acpi/acpi_apd.c
@@ -42,6 +42,7 @@ struct apd_private_data;
42struct apd_device_desc { 42struct apd_device_desc {
43 unsigned int flags; 43 unsigned int flags;
44 unsigned int fixed_clk_rate; 44 unsigned int fixed_clk_rate;
45 struct property_entry *properties;
45 int (*setup)(struct apd_private_data *pdata); 46 int (*setup)(struct apd_private_data *pdata);
46}; 47};
47 48
@@ -71,22 +72,35 @@ static int acpi_apd_setup(struct apd_private_data *pdata)
71} 72}
72 73
73#ifdef CONFIG_X86_AMD_PLATFORM_DEVICE 74#ifdef CONFIG_X86_AMD_PLATFORM_DEVICE
74static struct apd_device_desc cz_i2c_desc = { 75static const struct apd_device_desc cz_i2c_desc = {
75 .setup = acpi_apd_setup, 76 .setup = acpi_apd_setup,
76 .fixed_clk_rate = 133000000, 77 .fixed_clk_rate = 133000000,
77}; 78};
78 79
79static struct apd_device_desc cz_uart_desc = { 80static struct property_entry uart_properties[] = {
81 PROPERTY_ENTRY_U32("reg-io-width", 4),
82 PROPERTY_ENTRY_U32("reg-shift", 2),
83 PROPERTY_ENTRY_BOOL("snps,uart-16550-compatible"),
84 { },
85};
86
87static const struct apd_device_desc cz_uart_desc = {
80 .setup = acpi_apd_setup, 88 .setup = acpi_apd_setup,
81 .fixed_clk_rate = 48000000, 89 .fixed_clk_rate = 48000000,
90 .properties = uart_properties,
82}; 91};
83#endif 92#endif
84 93
85#ifdef CONFIG_ARM64 94#ifdef CONFIG_ARM64
86static struct apd_device_desc xgene_i2c_desc = { 95static const struct apd_device_desc xgene_i2c_desc = {
87 .setup = acpi_apd_setup, 96 .setup = acpi_apd_setup,
88 .fixed_clk_rate = 100000000, 97 .fixed_clk_rate = 100000000,
89}; 98};
99
100static const struct apd_device_desc vulcan_spi_desc = {
101 .setup = acpi_apd_setup,
102 .fixed_clk_rate = 133000000,
103};
90#endif 104#endif
91 105
92#else 106#else
@@ -125,6 +139,12 @@ static int acpi_apd_create_device(struct acpi_device *adev,
125 goto err_out; 139 goto err_out;
126 } 140 }
127 141
142 if (dev_desc->properties) {
143 ret = device_add_properties(&adev->dev, dev_desc->properties);
144 if (ret)
145 goto err_out;
146 }
147
128 adev->driver_data = pdata; 148 adev->driver_data = pdata;
129 pdev = acpi_create_platform_device(adev); 149 pdev = acpi_create_platform_device(adev);
130 if (!IS_ERR_OR_NULL(pdev)) 150 if (!IS_ERR_OR_NULL(pdev))
@@ -149,6 +169,7 @@ static const struct acpi_device_id acpi_apd_device_ids[] = {
149#endif 169#endif
150#ifdef CONFIG_ARM64 170#ifdef CONFIG_ARM64
151 { "APMC0D0F", APD_ADDR(xgene_i2c_desc) }, 171 { "APMC0D0F", APD_ADDR(xgene_i2c_desc) },
172 { "BRCM900D", APD_ADDR(vulcan_spi_desc) },
152#endif 173#endif
153 { } 174 { }
154}; 175};