[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5e0f2920-b503-d1c1-26d9-fc3fcf7394ba@wanyeetech.com>
Date: Thu, 28 May 2020 10:13:28 +0800
From: Zhou Yanjie <zhouyanjie@...yeetech.com>
To: Stephen Boyd <sboyd@...nel.org>, linux-clk@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
mturquette@...libre.com, robh+dt@...nel.org,
dongsheng.qiu@...enic.com, aric.pzqi@...enic.com,
rick.tyliu@...enic.com, yanfei.li@...enic.com,
sernia.zhou@...mail.com, zhenwenjin@...il.com, paul@...pouillou.net
Subject: Re: [PATCH v12 7/7] clk: X1000: Add FIXDIV for SSI clock of X1000.
Hi Stephen,
在 2020/5/28 上午9:12, Stephen Boyd 写道:
> Quoting Zhou Yanjie (2020-05-27 10:56:35)
>> @@ -40,8 +43,47 @@
>> #define OPCR_SPENDN0 BIT(7)
>> #define OPCR_SPENDN1 BIT(6)
>>
>> +/* bits within the USBPCR register */
>> +#define USBPCR_SIDDQ BIT(21)
>> +#define USBPCR_OTG_DISABLE BIT(20)
>> +
>> static struct ingenic_cgu *cgu;
>>
>> +static int x1000_usb_phy_enable(struct clk_hw *hw)
>> +{
>> + void __iomem *reg_opcr = cgu->base + CGU_REG_OPCR;
>> + void __iomem *reg_usbpcr = cgu->base + CGU_REG_USBPCR;
>> +
>> + writel(readl(reg_opcr) | OPCR_SPENDN0, reg_opcr);
> Please include linux/io.h for writel/readl.
Sure, I'll add it.
>> + writel(readl(reg_usbpcr) & ~USBPCR_OTG_DISABLE & ~USBPCR_SIDDQ, reg_usbpcr);
>> + return 0;
>> +}
>> +
>> +static void x1000_usb_phy_disable(struct clk_hw *hw)
>> +{
>> + void __iomem *reg_opcr = cgu->base + CGU_REG_OPCR;
>> + void __iomem *reg_usbpcr = cgu->base + CGU_REG_USBPCR;
>> +
>> + writel(readl(reg_opcr) & ~OPCR_SPENDN0, reg_opcr);
>> + writel(readl(reg_usbpcr) | USBPCR_OTG_DISABLE | USBPCR_SIDDQ, reg_usbpcr);
>> +}
>> +
>> +static int x1000_usb_phy_is_enabled(struct clk_hw *hw)
>> +{
>> + void __iomem *reg_opcr = cgu->base + CGU_REG_OPCR;
>> + void __iomem *reg_usbpcr = cgu->base + CGU_REG_USBPCR;
>> +
>> + return (readl(reg_opcr) & OPCR_SPENDN0) &&
>> + !(readl(reg_usbpcr) & USBPCR_SIDDQ) &&
>> + !(readl(reg_usbpcr) & USBPCR_OTG_DISABLE);
>> +}
>> +
>> +static const struct clk_ops x1000_otg_phy_ops = {
>> + .enable = x1000_usb_phy_enable,
>> + .disable = x1000_usb_phy_disable,
>> + .is_enabled = x1000_usb_phy_is_enabled,
>> +};
>> +
>> static const s8 pll_od_encoding[8] = {
>> 0x0, 0x1, -1, 0x2, -1, -1, -1, 0x3,
>> };
>> @@ -277,4 +377,4 @@ static void __init x1000_cgu_init(struct device_node *np)
>>
>> ingenic_cgu_register_syscore_ops(cgu);
>> }
>> -CLK_OF_DECLARE(x1000_cgu, "ingenic,x1000-cgu", x1000_cgu_init);
>> +CLK_OF_DECLARE_DRIVER(x1000_cgu, "ingenic,x1000-cgu", x1000_cgu_init);
> Why does this change to DECLARE_DRIVER? Can you please add a comment
> here in the code indicating what other driver is probing this compatible
> string?
Yes, CGU has some children devices, this is useful for probing children
devices in the case where the device node is compatible with
"simple-mfd" (see commit 03d570e1a4dc for a reference).
Thanks and best regards!
Powered by blists - more mailing lists