From: Jagan Teki Date: Sun, 28 Jan 2018 21:49:26 +0530 Subject: [U-Boot] [PATCH v3 05/30] sunxi: musb: Enable OTG device clock for H3 In-Reply-To: <1517156391-11353-1-git-send-email-jagan@amarulasolutions.com> References: <1517156391-11353-1-git-send-email-jagan@amarulasolutions.com> Message-ID: <1517156391-11353-6-git-send-email-jagan@amarulasolutions.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de From: Jun Nie Enable OTG clock and deassert reset Signed-off-by: Jun Nie [jagan: fixed AHB_GATE_OFFSET_OTG_DEVICE to use H3/H5/A64] Signed-off-by: Jagan Teki Reviewed-by: Jagan Teki Cc: Marek Vasut --- arch/arm/include/asm/arch-sunxi/clock_sun6i.h | 1 + drivers/usb/musb-new/sunxi.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/arch/arm/include/asm/arch-sunxi/clock_sun6i.h b/arch/arm/include/asm/arch-sunxi/clock_sun6i.h index 2c82d0a..624d624 100644 --- a/arch/arm/include/asm/arch-sunxi/clock_sun6i.h +++ b/arch/arm/include/asm/arch-sunxi/clock_sun6i.h @@ -279,6 +279,7 @@ struct sunxi_ccm_reg { #define AHB_GATE_OFFSET_USB_EHCI2 26 #define AHB_GATE_OFFSET_USB_EHCI1 25 #define AHB_GATE_OFFSET_USB_EHCI0 24 +#define AHB_GATE_OFFSET_OTG_DEVICE 23 #else #define AHB_GATE_OFFSET_USB_OHCI1 30 #define AHB_GATE_OFFSET_USB_OHCI0 29 diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c index 46c8bd2..c3b8fa4 100644 --- a/drivers/usb/musb-new/sunxi.c +++ b/drivers/usb/musb-new/sunxi.c @@ -266,6 +266,11 @@ static int sunxi_musb_init(struct musb *musb) #ifdef CONFIG_SUNXI_GEN_SUN6I setbits_le32(&ccm->ahb_reset0_cfg, 1 << AHB_GATE_OFFSET_USB0); #endif +#if defined(CONFIG_MACH_SUNXI_H3_H5) || defined(CONFIG_MACH_SUN50I) + setbits_le32(&ccm->ahb_gate0, BIT(AHB_GATE_OFFSET_OTG_DEVICE)); + setbits_le32(&ccm->ahb_reset0_cfg, BIT(AHB_GATE_OFFSET_OTG_DEVICE)); +#endif + sunxi_usb_phy_init(0); USBC_ConfigFIFO_Base(); @@ -380,6 +385,9 @@ static int musb_usb_remove(struct udevice *dev) #ifdef CONFIG_SUNXI_GEN_SUN6I clrbits_le32(&ccm->ahb_reset0_cfg, 1 << AHB_GATE_OFFSET_USB0); #endif +#if defined(CONFIG_MACH_SUNXI_H3_H5) || defined(CONFIG_MACH_SUN50I) + clrbits_le32(&ccm->ahb_gate0, 1 << AHB_GATE_OFFSET_OTG_DEVICE); +#endif clrbits_le32(&ccm->ahb_gate0, 1 << AHB_GATE_OFFSET_USB0); free(host->host); -- 2.7.4