diff options
Diffstat (limited to 'drivers/acpi/acpi_lpss.c')
-rw-r--r-- | drivers/acpi/acpi_lpss.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c index db3498bc4c2a..b693098f2160 100644 --- a/drivers/acpi/acpi_lpss.c +++ b/drivers/acpi/acpi_lpss.c | |||
@@ -84,6 +84,7 @@ static struct lpss_device_desc lpss_dma_desc = { | |||
84 | struct lpss_private_data { | 84 | struct lpss_private_data { |
85 | void __iomem *mmio_base; | 85 | void __iomem *mmio_base; |
86 | resource_size_t mmio_size; | 86 | resource_size_t mmio_size; |
87 | unsigned int fixed_clk_rate; | ||
87 | struct clk *clk; | 88 | struct clk *clk; |
88 | const struct lpss_device_desc *dev_desc; | 89 | const struct lpss_device_desc *dev_desc; |
89 | u32 prv_reg_ctx[LPSS_PRV_REG_COUNT]; | 90 | u32 prv_reg_ctx[LPSS_PRV_REG_COUNT]; |
@@ -103,7 +104,7 @@ static void lpss_uart_setup(struct lpss_private_data *pdata) | |||
103 | writel(reg | LPSS_GENERAL_UART_RTS_OVRD, pdata->mmio_base + offset); | 104 | writel(reg | LPSS_GENERAL_UART_RTS_OVRD, pdata->mmio_base + offset); |
104 | } | 105 | } |
105 | 106 | ||
106 | static void lpss_i2c_setup(struct lpss_private_data *pdata) | 107 | static void byt_i2c_setup(struct lpss_private_data *pdata) |
107 | { | 108 | { |
108 | unsigned int offset; | 109 | unsigned int offset; |
109 | u32 val; | 110 | u32 val; |
@@ -112,6 +113,9 @@ static void lpss_i2c_setup(struct lpss_private_data *pdata) | |||
112 | val = readl(pdata->mmio_base + offset); | 113 | val = readl(pdata->mmio_base + offset); |
113 | val |= LPSS_RESETS_RESET_APB | LPSS_RESETS_RESET_FUNC; | 114 | val |= LPSS_RESETS_RESET_APB | LPSS_RESETS_RESET_FUNC; |
114 | writel(val, pdata->mmio_base + offset); | 115 | writel(val, pdata->mmio_base + offset); |
116 | |||
117 | if (readl(pdata->mmio_base + pdata->dev_desc->prv_offset)) | ||
118 | pdata->fixed_clk_rate = 133000000; | ||
115 | } | 119 | } |
116 | 120 | ||
117 | static struct lpss_device_desc lpt_dev_desc = { | 121 | static struct lpss_device_desc lpt_dev_desc = { |
@@ -161,16 +165,10 @@ static struct lpss_device_desc byt_sdio_dev_desc = { | |||
161 | .flags = LPSS_CLK, | 165 | .flags = LPSS_CLK, |
162 | }; | 166 | }; |
163 | 167 | ||
164 | static struct lpss_shared_clock i2c_clock = { | ||
165 | .name = "i2c_clk", | ||
166 | .rate = 100000000, | ||
167 | }; | ||
168 | |||
169 | static struct lpss_device_desc byt_i2c_dev_desc = { | 168 | static struct lpss_device_desc byt_i2c_dev_desc = { |
170 | .flags = LPSS_CLK | LPSS_SAVE_CTX, | 169 | .flags = LPSS_CLK | LPSS_SAVE_CTX, |
171 | .prv_offset = 0x800, | 170 | .prv_offset = 0x800, |
172 | .shared_clock = &i2c_clock, | 171 | .setup = byt_i2c_setup, |
173 | .setup = lpss_i2c_setup, | ||
174 | }; | 172 | }; |
175 | 173 | ||
176 | static struct lpss_shared_clock bsw_pwm_clock = { | 174 | static struct lpss_shared_clock bsw_pwm_clock = { |
@@ -286,6 +284,12 @@ static int register_device_clock(struct acpi_device *adev, | |||
286 | parent = shared_clock->name; | 284 | parent = shared_clock->name; |
287 | } | 285 | } |
288 | 286 | ||
287 | if (pdata->fixed_clk_rate) { | ||
288 | clk = clk_register_fixed_rate(NULL, devname, parent, 0, | ||
289 | pdata->fixed_clk_rate); | ||
290 | goto out; | ||
291 | } | ||
292 | |||
289 | if (dev_desc->flags & LPSS_CLK_GATE) { | 293 | if (dev_desc->flags & LPSS_CLK_GATE) { |
290 | clk = clk_register_gate(NULL, devname, parent, 0, | 294 | clk = clk_register_gate(NULL, devname, parent, 0, |
291 | prv_base, 0, 0, NULL); | 295 | prv_base, 0, 0, NULL); |
@@ -316,7 +320,7 @@ static int register_device_clock(struct acpi_device *adev, | |||
316 | kfree(parent); | 320 | kfree(parent); |
317 | kfree(clk_name); | 321 | kfree(clk_name); |
318 | } | 322 | } |
319 | 323 | out: | |
320 | if (IS_ERR(clk)) | 324 | if (IS_ERR(clk)) |
321 | return PTR_ERR(clk); | 325 | return PTR_ERR(clk); |
322 | 326 | ||
@@ -364,6 +368,9 @@ static int acpi_lpss_create_device(struct acpi_device *adev, | |||
364 | 368 | ||
365 | pdata->dev_desc = dev_desc; | 369 | pdata->dev_desc = dev_desc; |
366 | 370 | ||
371 | if (dev_desc->setup) | ||
372 | dev_desc->setup(pdata); | ||
373 | |||
367 | if (dev_desc->flags & LPSS_CLK) { | 374 | if (dev_desc->flags & LPSS_CLK) { |
368 | ret = register_device_clock(adev, pdata); | 375 | ret = register_device_clock(adev, pdata); |
369 | if (ret) { | 376 | if (ret) { |
@@ -385,9 +392,6 @@ static int acpi_lpss_create_device(struct acpi_device *adev, | |||
385 | goto err_out; | 392 | goto err_out; |
386 | } | 393 | } |
387 | 394 | ||
388 | if (dev_desc->setup) | ||
389 | dev_desc->setup(pdata); | ||
390 | |||
391 | adev->driver_data = pdata; | 395 | adev->driver_data = pdata; |
392 | pdev = acpi_create_platform_device(adev); | 396 | pdev = acpi_create_platform_device(adev); |
393 | if (!IS_ERR_OR_NULL(pdev)) { | 397 | if (!IS_ERR_OR_NULL(pdev)) { |