mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Rolf Evers-Fischer <rolf.evers.fischer@delphi.com>
Subject: [PATCH 4/9] ARM: AM33xx: Enable USB and USB phy clocks
Date: Fri, 26 Sep 2014 10:22:10 +0200	[thread overview]
Message-ID: <1411719735-30949-5-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1411719735-30949-1-git-send-email-s.hauer@pengutronix.de>

From: Rolf Evers-Fischer <rolf.evers.fischer@delphi.com>

These are necessary for USB support. To make sure they are actually
enabled when a USB capable barebox is started call the clock enable
function during startup also for the full barebox, not only the MLO.

Signed-off-by: Rolf Evers-Fischer <rolf.evers.fischer@delphi.com>
---
 arch/arm/mach-omap/am33xx_clock.c                | 15 +++++++++++++--
 arch/arm/mach-omap/am33xx_generic.c              |  2 ++
 arch/arm/mach-omap/include/mach/am33xx-clock.h   |  2 ++
 arch/arm/mach-omap/include/mach/am33xx-generic.h |  1 +
 4 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap/am33xx_clock.c b/arch/arm/mach-omap/am33xx_clock.c
index 9105ddc..6d8adde 100644
--- a/arch/arm/mach-omap/am33xx_clock.c
+++ b/arch/arm/mach-omap/am33xx_clock.c
@@ -88,8 +88,10 @@ static void power_domain_transition_enable(void)
 /*
  * Enable the module clock and the power domain for required peripherals
  */
-static void per_clocks_enable(void)
+void am33xx_enable_per_clocks(void)
 {
+	u32 clkdcoldo;
+
 	/* Enable the module clock */
 	__raw_writel(PRCM_MOD_EN, CM_PER_TIMER2_CLKCTRL);
 	while (__raw_readl(CM_PER_TIMER2_CLKCTRL) != PRCM_MOD_EN);
@@ -154,6 +156,15 @@ static void per_clocks_enable(void)
 
 	__raw_writel(PRCM_MOD_EN, CM_PER_SPI1_CLKCTRL);
 	while (__raw_readl(CM_PER_SPI1_CLKCTRL) != PRCM_MOD_EN);
+
+	/* USB */
+	__raw_writel(PRCM_MOD_EN, CM_PER_USB0_CLKCTRL);
+	while ((__raw_readl(CM_PER_USB0_CLKCTRL) & 0x30000) != 0x0);
+
+	clkdcoldo = __raw_readl(CM_CLKDCOLDO_DPLL_PER);
+	clkdcoldo = clkdcoldo | 0x100;
+	__raw_writel(clkdcoldo, CM_CLKDCOLDO_DPLL_PER);
+	while ((__raw_readl(CM_CLKDCOLDO_DPLL_PER) & 0x00000200) != 0x200);
 }
 
 static void mpu_pll_config(int mpupll_M, int osc)
@@ -305,5 +316,5 @@ void am33xx_pll_init(int mpupll_M, int osc, int ddrpll_M)
 	/* Enable power domain transition */
 	power_domain_transition_enable();
 	/* Enable the required peripherals */
-	per_clocks_enable();
+	am33xx_enable_per_clocks();
 }
diff --git a/arch/arm/mach-omap/am33xx_generic.c b/arch/arm/mach-omap/am33xx_generic.c
index 71c528c..f293134 100644
--- a/arch/arm/mach-omap/am33xx_generic.c
+++ b/arch/arm/mach-omap/am33xx_generic.c
@@ -207,6 +207,8 @@ int am33xx_init(void)
 {
 	omap_gpmc_base = (void *)AM33XX_GPMC_BASE;
 
+	am33xx_enable_per_clocks();
+
 	return am33xx_bootsource();
 }
 
diff --git a/arch/arm/mach-omap/include/mach/am33xx-clock.h b/arch/arm/mach-omap/include/mach/am33xx-clock.h
index 10c2f29..2564fa7 100644
--- a/arch/arm/mach-omap/include/mach/am33xx-clock.h
+++ b/arch/arm/mach-omap/include/mach/am33xx-clock.h
@@ -74,6 +74,7 @@
 #define CM_CLKMODE_DPLL_PER             (CM_WKUP + 0x8c)
 #define CM_DIV_M2_DPLL_PER              (CM_WKUP + 0xAC)
 #define CM_IDLEST_DPLL_PER              (CM_WKUP + 0x70)
+#define CM_CLKDCOLDO_DPLL_PER           (CM_WKUP + 0x7C) /* for USB_PHY clock */
 
 /* Display PLL */
 #define CM_CLKSEL_DPLL_DISP             (CM_WKUP + 0x54)
@@ -140,6 +141,7 @@
 #define CM_PER_MMC0_CLKCTRL             (CM_PER + 0x3C)
 #define CM_PER_MMC1_CLKCTRL             (CM_PER + 0xF4)
 #define CM_PER_MMC2_CLKCTRL             (CM_PER + 0xF8)
+#define CM_PER_USB0_CLKCTRL             (CM_PER + 0x1c) /* USB */
 
 /* PRCM */
 #define CM_DPLL_OFFSET                  (AM33XX_PRM_BASE + 0x0300)
diff --git a/arch/arm/mach-omap/include/mach/am33xx-generic.h b/arch/arm/mach-omap/include/mach/am33xx-generic.h
index 75ac00a..6c85d51 100644
--- a/arch/arm/mach-omap/include/mach/am33xx-generic.h
+++ b/arch/arm/mach-omap/include/mach/am33xx-generic.h
@@ -30,6 +30,7 @@ u32 am33xx_running_in_sdram(void);
 
 void __noreturn am33xx_reset_cpu(unsigned long addr);
 
+void am33xx_enable_per_clocks(void);
 int am33xx_init(void);
 int am33xx_devices_init(void);
 
-- 
2.1.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2014-09-26  8:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-26  8:22 MUSB support Sascha Hauer
2014-09-26  8:22 ` [PATCH 1/9] USB: add usb phy header file Sascha Hauer
2014-09-26  8:22 ` [PATCH 2/9] USB: gadget: put poller into core Sascha Hauer
2014-09-26  8:22 ` [PATCH 3/9] USB: gadget: allow multiple udc drivers Sascha Hauer
2014-09-26  8:22 ` Sascha Hauer [this message]
2014-09-26  8:22 ` [PATCH 5/9] USB: Add MUSB driver from Linux Sascha Hauer
2014-09-26  8:22 ` [PATCH 6/9] USB: MUSB: Add barebox specific changes Sascha Hauer
2014-09-26  8:22 ` [PATCH 7/9] ARM: dts: Update am335x-bone-common.dtsi Sascha Hauer
2014-09-26  8:22 ` [PATCH 8/9] Documentation: USB: Add description for OTG device Sascha Hauer
2014-09-26  8:22 ` [PATCH 9/9] ARM: am335x_defconfig: Enable USB support Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1411719735-30949-5-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=rolf.evers.fischer@delphi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox