[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <PS2PR06MB343298952D34545A7372FEFAF27F9@PS2PR06MB3432.apcprd06.prod.outlook.com>
Date: Mon, 5 Sep 2022 02:25:06 +0000
From: Xiaowu Ding <xiaowu.ding@...uarmicro.com>
To: Andrew Lunn <andrew@...n.ch>
CC: "davem@...emloft.net" <davem@...emloft.net>,
"edumazet@...gle.com" <edumazet@...gle.com>,
"kuba@...nel.org" <kuba@...nel.org>,
"pabeni@...hat.com" <pabeni@...hat.com>,
"linux@...linux.org.uk" <linux@...linux.org.uk>,
"nicolas.ferre@...rochip.com" <nicolas.ferre@...rochip.com>,
"claudiu.beznea@...rochip.com" <claudiu.beznea@...rochip.com>,
"palmer@...belt.com" <palmer@...belt.com>,
"paul.walmsley@...ive.com" <paul.walmsley@...ive.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-riscv@...ts.infradead.org" <linux-riscv@...ts.infradead.org>
Subject: 答复: [PATCH net-next] driver: cadence macb driver support acpi mode
Hi Andrew:
Thank you very much for your advices.
There will be some problems with the clk_hw_register_fixed_rate interface in the acpi mode.
It seems that the kernel common clock framework can not support the acpi mode,just support the dt mode.
Register the fixed clocks with the clk_hw_register_fixed_rate function ,and the clks hw should be used by some
Drivers,but the driver can not get the clock hw with the devm_get_clk function,because this function can not support
acpi mode, the driver cannot find the device correct parent clk hw node.
So currently, we just get the clk rate from the acpi node with the device_property_read_u32 function.
Br Xiaowu
-----邮件原件-----
发件人: Andrew Lunn <andrew@...n.ch>
发送时间: 2022年8月24日 23:17
收件人: Xiaowu Ding <xiaowu.ding@...uarmicro.com>
抄送: davem@...emloft.net; edumazet@...gle.com; kuba@...nel.org; pabeni@...hat.com; linux@...linux.org.uk; nicolas.ferre@...rochip.com; claudiu.beznea@...rochip.com; palmer@...belt.com; paul.walmsley@...ive.com; netdev@...r.kernel.org; linux-kernel@...r.kernel.org; linux-riscv@...ts.infradead.org
主题: Re: [PATCH net-next] driver: cadence macb driver support acpi mode
> +/* On ACPI platforms, clocks are controlled by firmware and/or
> + * ACPI, not by drivers.Need to store the clock value.
> + */
> +struct macb_acpi_config {
> + u32 hclk_rate; /* amba clock rate*/
> + u32 pclk_rate; /* amba apb clock rate*/
> + u32 txclk_rate; /* tx clock rate*/
> + u32 rxclk_rate; /* rx clock rate*/
> + u32 tsuclk_rate; /* tx clock rate*/
> + bool acpi_enable; /* is acpi or not */
> +};
> +static int macb_acpi_support(struct macb *bp) {
> + struct device *dev = &bp->pdev->dev;
> + struct macb_acpi_config *config = &bp->acpicfg;
> + int ret;
> + u32 property;
> +
> + /*acpi must be report the pclk*/
> + property = 0;
> + ret = device_property_read_u32(dev, MACB_SYSPCLOCK, &property);
> + if (ret) {
> + dev_err(dev, "unable to obtain %s property\n", MACB_SYSPCLOCK);
> + return ret;
> + }
> +
> + config->pclk_rate = property;
It seems like you could make this simpler by just calling
clk_hw_register_fixed_rate(dev, "pclk", NULL, 0, property);
You then don't need to modify any other code with respect to clocks.
The clock does exist, so model it in the common clock framework.
Andrew
Powered by blists - more mailing lists