* [U-Boot] [PATCH] usb: sunxi: don't touch reset bits in ccm if CONFIG_SUNXI_GEN_SUN6I is not defined
@ 2018-06-14 3:04 Vasily Khoruzhick
2018-06-14 3:23 ` Chen-Yu Tsai
0 siblings, 1 reply; 6+ messages in thread
From: Vasily Khoruzhick @ 2018-06-14 3:04 UTC (permalink / raw)
To: u-boot
CCM in sun4i and sun5i doesn't have reset.
Fixes commit 1ed9c1118 ("usb: sunxi: ehci: get rid of ifdefs")
and commit 56830cee3 ("usb: sunxi: ohci: get rid of ifdefs")
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
---
drivers/usb/host/ehci-sunxi.c | 10 ++++++++--
drivers/usb/host/ohci-sunxi.c | 10 ++++++++--
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/host/ehci-sunxi.c b/drivers/usb/host/ehci-sunxi.c
index 35fbe03331..f5b661ef12 100644
--- a/drivers/usb/host/ehci-sunxi.c
+++ b/drivers/usb/host/ehci-sunxi.c
@@ -85,9 +85,12 @@ no_phy:
setbits_le32(&priv->ccm->ahb_gate0,
priv->ahb_gate_mask | extra_ahb_gate_mask);
- if (priv->cfg->has_reset)
+ if (priv->cfg->has_reset) {
+#ifdef CONFIG_SUNXI_GEN_SUN6I
setbits_le32(&priv->ccm->ahb_reset0_cfg,
priv->ahb_gate_mask | extra_ahb_gate_mask);
+#endif
+ }
hcor = (struct ehci_hcor *)((uintptr_t)hccr +
HC_LENGTH(ehci_readl(&hccr->cr_capbase)));
@@ -112,8 +115,11 @@ static int ehci_usb_remove(struct udevice *dev)
if (ret)
return ret;
- if (priv->cfg->has_reset)
+ if (priv->cfg->has_reset) {
+#ifdef CONFIG_SUNXI_GEN_SUN6I
clrbits_le32(&priv->ccm->ahb_reset0_cfg, priv->ahb_gate_mask);
+#endif
+ }
clrbits_le32(&priv->ccm->ahb_gate0, priv->ahb_gate_mask);
return 0;
diff --git a/drivers/usb/host/ohci-sunxi.c b/drivers/usb/host/ohci-sunxi.c
index 2b99169da6..c8c9e1d2fe 100644
--- a/drivers/usb/host/ohci-sunxi.c
+++ b/drivers/usb/host/ohci-sunxi.c
@@ -92,9 +92,12 @@ no_phy:
priv->ahb_gate_mask | extra_ahb_gate_mask);
setbits_le32(&priv->ccm->usb_clk_cfg,
priv->usb_gate_mask | priv->cfg->extra_usb_gate_mask);
- if (priv->cfg->has_reset)
+ if (priv->cfg->has_reset) {
+#ifdef CONFIG_SUNXI_GEN_SUN6I
setbits_le32(&priv->ccm->ahb_reset0_cfg,
priv->ahb_gate_mask | extra_ahb_gate_mask);
+#endif
+ }
return ohci_register(dev, regs);
}
@@ -116,8 +119,11 @@ static int ohci_usb_remove(struct udevice *dev)
if (ret)
return ret;
- if (priv->cfg->has_reset)
+ if (priv->cfg->has_reset) {
+#ifdef CONFIG_SUNXI_GEN_SUN6I
clrbits_le32(&priv->ccm->ahb_reset0_cfg, priv->ahb_gate_mask);
+#endif
+ }
clrbits_le32(&priv->ccm->usb_clk_cfg, priv->usb_gate_mask);
clrbits_le32(&priv->ccm->ahb_gate0, priv->ahb_gate_mask);
--
2.17.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] usb: sunxi: don't touch reset bits in ccm if CONFIG_SUNXI_GEN_SUN6I is not defined
2018-06-14 3:04 [U-Boot] [PATCH] usb: sunxi: don't touch reset bits in ccm if CONFIG_SUNXI_GEN_SUN6I is not defined Vasily Khoruzhick
@ 2018-06-14 3:23 ` Chen-Yu Tsai
2018-06-14 3:31 ` Vasily Khoruzhick
0 siblings, 1 reply; 6+ messages in thread
From: Chen-Yu Tsai @ 2018-06-14 3:23 UTC (permalink / raw)
To: u-boot
On Thu, Jun 14, 2018 at 11:04 AM, Vasily Khoruzhick <anarsoul@gmail.com> wrote:
> CCM in sun4i and sun5i doesn't have reset.
>
> Fixes commit 1ed9c1118 ("usb: sunxi: ehci: get rid of ifdefs")
> and commit 56830cee3 ("usb: sunxi: ohci: get rid of ifdefs")
>
> Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
> ---
> drivers/usb/host/ehci-sunxi.c | 10 ++++++++--
> drivers/usb/host/ohci-sunxi.c | 10 ++++++++--
> 2 files changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/usb/host/ehci-sunxi.c b/drivers/usb/host/ehci-sunxi.c
> index 35fbe03331..f5b661ef12 100644
> --- a/drivers/usb/host/ehci-sunxi.c
> +++ b/drivers/usb/host/ehci-sunxi.c
> @@ -85,9 +85,12 @@ no_phy:
>
> setbits_le32(&priv->ccm->ahb_gate0,
> priv->ahb_gate_mask | extra_ahb_gate_mask);
> - if (priv->cfg->has_reset)
> + if (priv->cfg->has_reset) {
> +#ifdef CONFIG_SUNXI_GEN_SUN6I
The "has_reset" field is supposed to deal with this. Is it not working?
ChenYu
> setbits_le32(&priv->ccm->ahb_reset0_cfg,
> priv->ahb_gate_mask | extra_ahb_gate_mask);
> +#endif
> + }
>
> hcor = (struct ehci_hcor *)((uintptr_t)hccr +
> HC_LENGTH(ehci_readl(&hccr->cr_capbase)));
> @@ -112,8 +115,11 @@ static int ehci_usb_remove(struct udevice *dev)
> if (ret)
> return ret;
>
> - if (priv->cfg->has_reset)
> + if (priv->cfg->has_reset) {
> +#ifdef CONFIG_SUNXI_GEN_SUN6I
> clrbits_le32(&priv->ccm->ahb_reset0_cfg, priv->ahb_gate_mask);
> +#endif
> + }
> clrbits_le32(&priv->ccm->ahb_gate0, priv->ahb_gate_mask);
>
> return 0;
> diff --git a/drivers/usb/host/ohci-sunxi.c b/drivers/usb/host/ohci-sunxi.c
> index 2b99169da6..c8c9e1d2fe 100644
> --- a/drivers/usb/host/ohci-sunxi.c
> +++ b/drivers/usb/host/ohci-sunxi.c
> @@ -92,9 +92,12 @@ no_phy:
> priv->ahb_gate_mask | extra_ahb_gate_mask);
> setbits_le32(&priv->ccm->usb_clk_cfg,
> priv->usb_gate_mask | priv->cfg->extra_usb_gate_mask);
> - if (priv->cfg->has_reset)
> + if (priv->cfg->has_reset) {
> +#ifdef CONFIG_SUNXI_GEN_SUN6I
> setbits_le32(&priv->ccm->ahb_reset0_cfg,
> priv->ahb_gate_mask | extra_ahb_gate_mask);
> +#endif
> + }
>
> return ohci_register(dev, regs);
> }
> @@ -116,8 +119,11 @@ static int ohci_usb_remove(struct udevice *dev)
> if (ret)
> return ret;
>
> - if (priv->cfg->has_reset)
> + if (priv->cfg->has_reset) {
> +#ifdef CONFIG_SUNXI_GEN_SUN6I
> clrbits_le32(&priv->ccm->ahb_reset0_cfg, priv->ahb_gate_mask);
> +#endif
> + }
> clrbits_le32(&priv->ccm->usb_clk_cfg, priv->usb_gate_mask);
> clrbits_le32(&priv->ccm->ahb_gate0, priv->ahb_gate_mask);
>
> --
> 2.17.1
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] usb: sunxi: don't touch reset bits in ccm if CONFIG_SUNXI_GEN_SUN6I is not defined
2018-06-14 3:23 ` Chen-Yu Tsai
@ 2018-06-14 3:31 ` Vasily Khoruzhick
2018-06-14 5:29 ` Jagan Teki
0 siblings, 1 reply; 6+ messages in thread
From: Vasily Khoruzhick @ 2018-06-14 3:31 UTC (permalink / raw)
To: u-boot
On Wed, Jun 13, 2018 at 8:23 PM, Chen-Yu Tsai <wens@csie.org> wrote:
>> + if (priv->cfg->has_reset) {
>> +#ifdef CONFIG_SUNXI_GEN_SUN6I
>
> The "has_reset" field is supposed to deal with this. Is it not working?
There's no ahb_reset0_cfg in ccm on sun4i and sun5i, so compilation fails with
drivers/usb/host/ohci-sunxi.c:96:26: error: 'struct sunxi_ccm_reg' has
no member named 'ahb_reset0_cfg'
(And similar error for ehci-sunxi.c)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] usb: sunxi: don't touch reset bits in ccm if CONFIG_SUNXI_GEN_SUN6I is not defined
2018-06-14 3:31 ` Vasily Khoruzhick
@ 2018-06-14 5:29 ` Jagan Teki
2018-06-14 5:36 ` Vasily Khoruzhick
0 siblings, 1 reply; 6+ messages in thread
From: Jagan Teki @ 2018-06-14 5:29 UTC (permalink / raw)
To: u-boot
On Thu, Jun 14, 2018 at 9:01 AM, Vasily Khoruzhick <anarsoul@gmail.com> wrote:
> On Wed, Jun 13, 2018 at 8:23 PM, Chen-Yu Tsai <wens@csie.org> wrote:
>
>>> + if (priv->cfg->has_reset) {
>>> +#ifdef CONFIG_SUNXI_GEN_SUN6I
>>
>> The "has_reset" field is supposed to deal with this. Is it not working?
>
> There's no ahb_reset0_cfg in ccm on sun4i and sun5i, so compilation fails with
>
> drivers/usb/host/ohci-sunxi.c:96:26: error: 'struct sunxi_ccm_reg' has
> no member named 'ahb_reset0_cfg'
Add reset0_cfg_off on driver_data for sun6i. and check the same while writing.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] usb: sunxi: don't touch reset bits in ccm if CONFIG_SUNXI_GEN_SUN6I is not defined
2018-06-14 5:29 ` Jagan Teki
@ 2018-06-14 5:36 ` Vasily Khoruzhick
2018-06-14 5:41 ` Jagan Teki
0 siblings, 1 reply; 6+ messages in thread
From: Vasily Khoruzhick @ 2018-06-14 5:36 UTC (permalink / raw)
To: u-boot
On Wed, Jun 13, 2018 at 10:29 PM, Jagan Teki <jagannadh.teki@gmail.com> wrote:
> On Thu, Jun 14, 2018 at 9:01 AM, Vasily Khoruzhick <anarsoul@gmail.com> wrote:
>> On Wed, Jun 13, 2018 at 8:23 PM, Chen-Yu Tsai <wens@csie.org> wrote:
>>
>>>> + if (priv->cfg->has_reset) {
>>>> +#ifdef CONFIG_SUNXI_GEN_SUN6I
>>>
>>> The "has_reset" field is supposed to deal with this. Is it not working?
>>
>> There's no ahb_reset0_cfg in ccm on sun4i and sun5i, so compilation fails with
>>
>> drivers/usb/host/ohci-sunxi.c:96:26: error: 'struct sunxi_ccm_reg' has
>> no member named 'ahb_reset0_cfg'
>
> Add reset0_cfg_off on driver_data for sun6i. and check the same while writing.
I don't think that hardcoding ahb_reset0_cfg offset here is a good
idea. Using offsetof() isn't possible without ifdef, since
this field won't be present in struct sunxi_ccm_reg for sun4i and sun5i.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] usb: sunxi: don't touch reset bits in ccm if CONFIG_SUNXI_GEN_SUN6I is not defined
2018-06-14 5:36 ` Vasily Khoruzhick
@ 2018-06-14 5:41 ` Jagan Teki
0 siblings, 0 replies; 6+ messages in thread
From: Jagan Teki @ 2018-06-14 5:41 UTC (permalink / raw)
To: u-boot
On Thu, Jun 14, 2018 at 11:06 AM, Vasily Khoruzhick <anarsoul@gmail.com> wrote:
> On Wed, Jun 13, 2018 at 10:29 PM, Jagan Teki <jagannadh.teki@gmail.com> wrote:
>> On Thu, Jun 14, 2018 at 9:01 AM, Vasily Khoruzhick <anarsoul@gmail.com> wrote:
>>> On Wed, Jun 13, 2018 at 8:23 PM, Chen-Yu Tsai <wens@csie.org> wrote:
>>>
>>>>> + if (priv->cfg->has_reset) {
>>>>> +#ifdef CONFIG_SUNXI_GEN_SUN6I
>>>>
>>>> The "has_reset" field is supposed to deal with this. Is it not working?
>>>
>>> There's no ahb_reset0_cfg in ccm on sun4i and sun5i, so compilation fails with
>>>
>>> drivers/usb/host/ohci-sunxi.c:96:26: error: 'struct sunxi_ccm_reg' has
>>> no member named 'ahb_reset0_cfg'
>>
>> Add reset0_cfg_off on driver_data for sun6i. and check the same while writing.
>
> I don't think that hardcoding ahb_reset0_cfg offset here is a good
> idea. Using offsetof() isn't possible without ifdef, since
> this field won't be present in struct sunxi_ccm_reg for sun4i and sun5i.
ie reason I've mentioned to add offset field for sun6i, this is what
we do with phyctl_offset in phy driver. I won't recommend #ifdef
again.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-06-14 5:41 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-14 3:04 [U-Boot] [PATCH] usb: sunxi: don't touch reset bits in ccm if CONFIG_SUNXI_GEN_SUN6I is not defined Vasily Khoruzhick
2018-06-14 3:23 ` Chen-Yu Tsai
2018-06-14 3:31 ` Vasily Khoruzhick
2018-06-14 5:29 ` Jagan Teki
2018-06-14 5:36 ` Vasily Khoruzhick
2018-06-14 5:41 ` Jagan Teki
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.