diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-05-08 04:55:49 -0400 |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2013-05-14 00:53:58 -0400 |
commit | b59cc200ac025aca597fb21862c1c9e667f2eff2 (patch) | |
tree | fabada02fb402faffe5ec3582df3806b4c27d97c | |
parent | ee8209fd026b074bb8eb75bece516a338a281b1b (diff) |
ACPI / LPSS: register clock device for Lynxpoint DMA properly
The DMA controller in Lynxpoint is enumerated as a regular ACPI device now. To
work properly it is using the LPSS root clock as a functional clock. That's why
we have to register the clock device accordingly to the ACPI ID of the DMA
controller. The acpi_lpss.c module is responsible to do the job.
This patch also removes hardcoded name of the DMA device in clk-lpt.c and the
name of the root clock in acpi_lpss.c.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
-rw-r--r-- | drivers/acpi/acpi_lpss.c | 26 | ||||
-rw-r--r-- | drivers/clk/x86/clk-lpt.c | 15 | ||||
-rw-r--r-- | include/linux/platform_data/clk-lpss.h | 5 |
3 files changed, 38 insertions, 8 deletions
diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c index b1c95422ce74..652fd5ce303c 100644 --- a/drivers/acpi/acpi_lpss.c +++ b/drivers/acpi/acpi_lpss.c | |||
@@ -35,11 +35,16 @@ ACPI_MODULE_NAME("acpi_lpss"); | |||
35 | 35 | ||
36 | struct lpss_device_desc { | 36 | struct lpss_device_desc { |
37 | bool clk_required; | 37 | bool clk_required; |
38 | const char *clk_parent; | 38 | const char *clkdev_name; |
39 | bool ltr_required; | 39 | bool ltr_required; |
40 | unsigned int prv_offset; | 40 | unsigned int prv_offset; |
41 | }; | 41 | }; |
42 | 42 | ||
43 | static struct lpss_device_desc lpss_dma_desc = { | ||
44 | .clk_required = true, | ||
45 | .clkdev_name = "hclk", | ||
46 | }; | ||
47 | |||
43 | struct lpss_private_data { | 48 | struct lpss_private_data { |
44 | void __iomem *mmio_base; | 49 | void __iomem *mmio_base; |
45 | resource_size_t mmio_size; | 50 | resource_size_t mmio_size; |
@@ -49,7 +54,6 @@ struct lpss_private_data { | |||
49 | 54 | ||
50 | static struct lpss_device_desc lpt_dev_desc = { | 55 | static struct lpss_device_desc lpt_dev_desc = { |
51 | .clk_required = true, | 56 | .clk_required = true, |
52 | .clk_parent = "lpss_clk", | ||
53 | .prv_offset = 0x800, | 57 | .prv_offset = 0x800, |
54 | .ltr_required = true, | 58 | .ltr_required = true, |
55 | }; | 59 | }; |
@@ -60,6 +64,9 @@ static struct lpss_device_desc lpt_sdio_dev_desc = { | |||
60 | }; | 64 | }; |
61 | 65 | ||
62 | static const struct acpi_device_id acpi_lpss_device_ids[] = { | 66 | static const struct acpi_device_id acpi_lpss_device_ids[] = { |
67 | /* Generic LPSS devices */ | ||
68 | { "INTL9C60", (unsigned long)&lpss_dma_desc }, | ||
69 | |||
63 | /* Lynxpoint LPSS devices */ | 70 | /* Lynxpoint LPSS devices */ |
64 | { "INT33C0", (unsigned long)&lpt_dev_desc }, | 71 | { "INT33C0", (unsigned long)&lpt_dev_desc }, |
65 | { "INT33C1", (unsigned long)&lpt_dev_desc }, | 72 | { "INT33C1", (unsigned long)&lpt_dev_desc }, |
@@ -91,16 +98,27 @@ static int register_device_clock(struct acpi_device *adev, | |||
91 | struct lpss_private_data *pdata) | 98 | struct lpss_private_data *pdata) |
92 | { | 99 | { |
93 | const struct lpss_device_desc *dev_desc = pdata->dev_desc; | 100 | const struct lpss_device_desc *dev_desc = pdata->dev_desc; |
101 | struct lpss_clk_data *clk_data; | ||
94 | 102 | ||
95 | if (!lpss_clk_dev) | 103 | if (!lpss_clk_dev) |
96 | lpt_register_clock_device(); | 104 | lpt_register_clock_device(); |
97 | 105 | ||
98 | if (!dev_desc->clk_parent || !pdata->mmio_base | 106 | clk_data = platform_get_drvdata(lpss_clk_dev); |
107 | if (!clk_data) | ||
108 | return -ENODEV; | ||
109 | |||
110 | if (dev_desc->clkdev_name) { | ||
111 | clk_register_clkdev(clk_data->clk, dev_desc->clkdev_name, | ||
112 | dev_name(&adev->dev)); | ||
113 | return 0; | ||
114 | } | ||
115 | |||
116 | if (!pdata->mmio_base | ||
99 | || pdata->mmio_size < dev_desc->prv_offset + LPSS_CLK_SIZE) | 117 | || pdata->mmio_size < dev_desc->prv_offset + LPSS_CLK_SIZE) |
100 | return -ENODATA; | 118 | return -ENODATA; |
101 | 119 | ||
102 | pdata->clk = clk_register_gate(NULL, dev_name(&adev->dev), | 120 | pdata->clk = clk_register_gate(NULL, dev_name(&adev->dev), |
103 | dev_desc->clk_parent, 0, | 121 | clk_data->name, 0, |
104 | pdata->mmio_base + dev_desc->prv_offset, | 122 | pdata->mmio_base + dev_desc->prv_offset, |
105 | 0, 0, NULL); | 123 | 0, 0, NULL); |
106 | if (IS_ERR(pdata->clk)) | 124 | if (IS_ERR(pdata->clk)) |
diff --git a/drivers/clk/x86/clk-lpt.c b/drivers/clk/x86/clk-lpt.c index 5cf4f4686406..4f45eee9e33b 100644 --- a/drivers/clk/x86/clk-lpt.c +++ b/drivers/clk/x86/clk-lpt.c | |||
@@ -15,22 +15,29 @@ | |||
15 | #include <linux/clk-provider.h> | 15 | #include <linux/clk-provider.h> |
16 | #include <linux/err.h> | 16 | #include <linux/err.h> |
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/platform_data/clk-lpss.h> | ||
18 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
19 | 20 | ||
20 | #define PRV_CLOCK_PARAMS 0x800 | 21 | #define PRV_CLOCK_PARAMS 0x800 |
21 | 22 | ||
22 | static int lpt_clk_probe(struct platform_device *pdev) | 23 | static int lpt_clk_probe(struct platform_device *pdev) |
23 | { | 24 | { |
25 | struct lpss_clk_data *drvdata; | ||
24 | struct clk *clk; | 26 | struct clk *clk; |
25 | 27 | ||
28 | drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL); | ||
29 | if (!drvdata) | ||
30 | return -ENOMEM; | ||
31 | |||
26 | /* LPSS free running clock */ | 32 | /* LPSS free running clock */ |
27 | clk = clk_register_fixed_rate(&pdev->dev, "lpss_clk", NULL, CLK_IS_ROOT, | 33 | drvdata->name = "lpss_clk"; |
28 | 100000000); | 34 | clk = clk_register_fixed_rate(&pdev->dev, drvdata->name, NULL, |
35 | CLK_IS_ROOT, 100000000); | ||
29 | if (IS_ERR(clk)) | 36 | if (IS_ERR(clk)) |
30 | return PTR_ERR(clk); | 37 | return PTR_ERR(clk); |
31 | 38 | ||
32 | /* Shared DMA clock */ | 39 | drvdata->clk = clk; |
33 | clk_register_clkdev(clk, "hclk", "INTL9C60.0.auto"); | 40 | platform_set_drvdata(pdev, drvdata); |
34 | return 0; | 41 | return 0; |
35 | } | 42 | } |
36 | 43 | ||
diff --git a/include/linux/platform_data/clk-lpss.h b/include/linux/platform_data/clk-lpss.h index 528e73ce46d2..23901992b9dd 100644 --- a/include/linux/platform_data/clk-lpss.h +++ b/include/linux/platform_data/clk-lpss.h | |||
@@ -13,6 +13,11 @@ | |||
13 | #ifndef __CLK_LPSS_H | 13 | #ifndef __CLK_LPSS_H |
14 | #define __CLK_LPSS_H | 14 | #define __CLK_LPSS_H |
15 | 15 | ||
16 | struct lpss_clk_data { | ||
17 | const char *name; | ||
18 | struct clk *clk; | ||
19 | }; | ||
20 | |||
16 | extern int lpt_clk_init(void); | 21 | extern int lpt_clk_init(void); |
17 | 22 | ||
18 | #endif /* __CLK_LPSS_H */ | 23 | #endif /* __CLK_LPSS_H */ |