Re: [PATCH V4 08/11] clk: imx: imx8qxp-lpcg: add parsing clocks from device tree
From: Dong Aisheng <hidden>
Date: 2019-11-17 12:19:29
Also in:
linux-clk
On Tue, Sep 17, 2019 at 2:45 AM Stephen Boyd [off-list ref] wrote:
Quoting Dong Aisheng (2019-09-09 04:23:14)quoted
]On Sat, Sep 7, 2019 at 5:35 PM Stephen Boyd [off-list ref] wrote:quoted
Quoting Dong Aisheng (2019-08-20 04:13:22)quoted
Add parsing clocks from device tree.Please describe some more here.Will improve.quoted
quoted
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + base = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(base)) + return PTR_ERR(base); + + count = of_property_count_u32_elems(np, "clock-indices"); + if (count < 0) { + dev_err(&pdev->dev, "failed to count clocks\n"); + return -EINVAL; + }Is 'count' expected to be equal to IMX_LPCG_MAX_CLKS? Because later on in this function we set the num of clks to the MAX instead of the count from clock-indices.No. Here is a tricky to ease the clk getting. For example, one LPCG supports up to 8 clock outputs which each of them is fixed to 4 bits. Then we can easily use the bit-offset/clk-indices parsed from DT to fetch the corresponding clock by hws[clkspec->args[0] / 4]. And the cost is very limited with only a few pointers.Ok. Can you add a comment into the code to explain this?
Yes, added. Thanks for the good suggestion. Regards Aisheng _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel