Yes, these hacks will be removed when the clocks are implemented in ACPI. I provided this patch only so people could compile and run the previous patches and provide feedback.
Brandon
-----Original Message----- From: Hanjun Guo [mailto:hanjun.guo@linaro.org] Sent: Wednesday, October 23, 2013 6:58 AM To: Anderson, Brandon; linaro-acpi@lists.linaro.org Cc: naresh.bhat@linaro.org; graeme.gregory@linaro.org; Suthikulpanit, Suravee Subject: Re: [RFC PATCH 3/3] ACPI: Hack clock names to get prototype running
On 2013-10-22 8:33, brandon.anderson@amd.com wrote:
From: Brandon Anderson brandon.anderson@amd.com
!!! For prototyping use only, not intended for final implementation !!!
Manually label the first fixed-clock as 'apb_pclk', and then manually register this clock with each device being registered. The amba subsystem and drivers require this clock when probing the device. This code will not be required once ACPI clock info is integrated into drivers/amba/acpi.c
Signed-off-by: Brandon Anderson brandon.anderson@amd.com
drivers/amba/acpi.c | 14 ++++++++++++-- drivers/clk/clk-fixed-rate.c | 15 +++++++++++++-- 2 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/drivers/amba/acpi.c b/drivers/amba/acpi.c index 04efcbd..822000e 100644 --- a/drivers/amba/acpi.c +++ b/drivers/amba/acpi.c @@ -52,8 +52,18 @@ static int acpi_amba_add_resource(struct acpi_resource *ares, void *data) static void acpi_amba_register_clk(struct acpi_device *adev) {
- /* TODO: Retrieve clock details from ACPI and register the appropriate
clock under this device for amba subsystem and drivers to reference */
- /* HACK: re-register the first clock under this device so that other
subsystems will find it */
- struct clk *clk = clk_get_sys("LINA0008:00", "apb_pclk");
if we can get the clk data as I said in the former email, this HACK is not needed any more.
- if (!IS_ERR(clk)) {
/* for amba_get_enable_pclk() */
clk_register_clkdev(clk, "apb_pclk", dev_name(&adev->dev));
/* for pl011 driver call to devm_get_clk() */
clk_register_clkdev(clk, NULL, dev_name(&adev->dev));
- } else {
pr_debug("%s: cannot look up clock\n", __func__);
- }
} /* acpi_amba_add_device() diff --git a/drivers/clk/clk-fixed-rate.c b/drivers/clk/clk-fixed-rate.c index 226cefb..015002a 100644 --- a/drivers/clk/clk-fixed-rate.c +++ b/drivers/clk/clk-fixed-rate.c @@ -111,6 +111,8 @@ static int fixed_clk_probe_acpi(struct platform_device *pdev) { struct clk *clk = ERR_PTR(-ENODEV); unsigned long long rate = 0; acpi_status status;
- static int clk_idx = 0;
- char *dt_clk_name = NULL;
/* there is a corresponding FREQ method under fixed clock object */ status = acpi_evaluate_integer(ACPI_HANDLE(&pdev->dev), "FREQ", @@ -123,11 +125,20 @@ static int fixed_clk_probe_acpi(struct platform_device *pdev) { if (IS_ERR(clk)) return -ENODEV;
- /* HACK: label the first clock as 'apb_pclk' */
- if (clk_idx++ == 0) {
dt_clk_name = "apb_pclk";
- }
and here too.
may be I missed something, your comments are welcome :)
Thanks Hanjun