mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/3] usb-imx28: fix enable
@ 2013-09-10 17:57 Eric Bénard
  2013-09-10 17:57 ` [PATCH 2/3] imx28-regs: i.MX28 has 2 USB controllers Eric Bénard
  2013-09-10 17:57 ` [PATCH 3/3] mx28-evk: enable USB Eric Bénard
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Bénard @ 2013-09-10 17:57 UTC (permalink / raw)
  To: barebox

we need to power on the PLL when enabling the USB clock.

Signed-off-by: Eric Bénard <eric@eukrea.com>
---
 arch/arm/mach-mxs/usb-imx28.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-mxs/usb-imx28.c b/arch/arm/mach-mxs/usb-imx28.c
index 61d59c3..e5b63c3 100644
--- a/arch/arm/mach-mxs/usb-imx28.c
+++ b/arch/arm/mach-mxs/usb-imx28.c
@@ -46,6 +46,7 @@
 #define CLK_PLL0CTRL0			(IMX_CCM_BASE + 0x0)
 #define CLK_PLL1CTRL0			(IMX_CCM_BASE + 0x20)
 #define PLLCTRL0_EN_USB_CLKS		(1 << 18)
+#define PLLCTRL0_POWER		(1 << 17)
 
 #define DIGCTRL_CTRL			(IMX_DIGCTL_BASE + 0x0)
 #define DIGCTL_CTRL_USB0_CLKGATE	(1 << 2)
@@ -77,7 +78,7 @@ int imx28_usb_phy0_enable(void)
 	imx28_usb_phy_reset((void *)IMX_USBPHY0_BASE);
 
 	/* Turn on the USB clocks */
-	writel(PLLCTRL0_EN_USB_CLKS, CLK_PLL0CTRL0 + SET);
+	writel(PLLCTRL0_EN_USB_CLKS | PLLCTRL0_POWER, CLK_PLL0CTRL0 + SET);
 
 	writel(DIGCTL_CTRL_USB0_CLKGATE, DIGCTRL_CTRL + CLR);
 
@@ -91,7 +92,7 @@ int imx28_usb_phy1_enable(void)
 	imx28_usb_phy_reset((void *)IMX_USBPHY1_BASE);
 
 	/* Turn on the USB clocks */
-	writel(PLLCTRL0_EN_USB_CLKS, CLK_PLL1CTRL0 + SET);
+	writel(PLLCTRL0_EN_USB_CLKS | PLLCTRL0_POWER, CLK_PLL1CTRL0 + SET);
 
 	writel(DIGCTL_CTRL_USB1_CLKGATE, DIGCTRL_CTRL + CLR);
 
-- 
1.8.3.1


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/3] imx28-regs: i.MX28 has 2 USB controllers
  2013-09-10 17:57 [PATCH 1/3] usb-imx28: fix enable Eric Bénard
@ 2013-09-10 17:57 ` Eric Bénard
  2013-09-10 17:57 ` [PATCH 3/3] mx28-evk: enable USB Eric Bénard
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Bénard @ 2013-09-10 17:57 UTC (permalink / raw)
  To: barebox

so declare both base address

Signed-off-by: Eric Bénard <eric@eukrea.com>
---
 arch/arm/mach-mxs/include/mach/imx28-regs.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-mxs/include/mach/imx28-regs.h b/arch/arm/mach-mxs/include/mach/imx28-regs.h
index fa8edd7..0882829 100644
--- a/arch/arm/mach-mxs/include/mach/imx28-regs.h
+++ b/arch/arm/mach-mxs/include/mach/imx28-regs.h
@@ -41,7 +41,8 @@
 #define IMX_DBGUART_BASE	0x80074000
 #define IMX_USBPHY0_BASE	0x8007c000
 #define IMX_USBPHY1_BASE	0x8007e000
-#define IMX_USB_BASE		0x80080000
+#define IMX_USB0_BASE		0x80080000
+#define IMX_USB1_BASE		0x80090000
 #define IMX_FEC0_BASE		0x800F0000
 #define IMX_FEC1_BASE		0x800F4000
 
-- 
1.8.3.1


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 3/3] mx28-evk: enable USB
  2013-09-10 17:57 [PATCH 1/3] usb-imx28: fix enable Eric Bénard
  2013-09-10 17:57 ` [PATCH 2/3] imx28-regs: i.MX28 has 2 USB controllers Eric Bénard
@ 2013-09-10 17:57 ` Eric Bénard
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Bénard @ 2013-09-10 17:57 UTC (permalink / raw)
  To: barebox

- USB1 is host (tested with a mass storage)
- USB0 is device (quickly tested with DFU)

Signed-off-by: Eric Bénard <eric@eukrea.com>
---
 arch/arm/boards/freescale-mx28-evk/mx28-evk.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/arch/arm/boards/freescale-mx28-evk/mx28-evk.c b/arch/arm/boards/freescale-mx28-evk/mx28-evk.c
index 92f0a75..fa631df 100644
--- a/arch/arm/boards/freescale-mx28-evk/mx28-evk.c
+++ b/arch/arm/boards/freescale-mx28-evk/mx28-evk.c
@@ -32,6 +32,8 @@
 #include <mach/iomux.h>
 #include <mach/ocotp.h>
 #include <mach/devices.h>
+#include <mach/usb.h>
+#include <usb/fsl_usb2.h>
 #include <spi/spi.h>
 
 #include <asm/armlinux.h>
@@ -135,6 +137,11 @@ static const uint32_t mx28evk_pads[] = {
 	SSP2_D3 | VE_3_3V | PULLUP(1) | STRENGTH(S8MA), /* SS0 !CS */
 	SSP2_CMD | VE_3_3V | PULLUP(1) | STRENGTH(S8MA), /* MOSI DIO */
 	SSP2_SCK | VE_3_3V | PULLUP(1) | STRENGTH(S8MA), /* CLK */
+
+	/* USB VBUS1 ENABLE - default to ON */
+	AUART2_RX_GPIO | VE_3_3V | PULLUP(0) | GPIO_OUT | GPIO_VALUE(1),
+	/* USB VBUS0 ENABLE - default to OFF */
+	AUART2_TX_GPIO | VE_3_3V | PULLUP(0) | GPIO_OUT | GPIO_VALUE(0),
 };
 
 static struct mxs_mci_platform_data mci_pdata = {
@@ -247,6 +254,12 @@ static const struct spi_board_info mx28evk_spi_board_info[] = {
 	}
 };
 
+#ifdef CONFIG_USB_GADGET_DRIVER_ARC
+static struct fsl_usb2_platform_data usb_pdata = {
+	.operating_mode	= FSL_USB2_DR_DEVICE,
+	.phy_mode	= FSL_USB2_PHY_UTMI,
+};
+#endif
 static int mx28_evk_devices_init(void)
 {
 	int i;
@@ -280,6 +293,14 @@ static int mx28_evk_devices_init(void)
 	add_generic_device("mxs_spi", 2, NULL, IMX_SSP2_BASE, 0x2000,
 			   IORESOURCE_MEM, NULL);
 
+#ifdef CONFIG_USB_GADGET_DRIVER_ARC
+	imx28_usb_phy0_enable();
+	imx28_usb_phy1_enable();
+	add_generic_usb_ehci_device(DEVICE_ID_DYNAMIC, IMX_USB1_BASE, NULL);
+	add_generic_device("fsl-udc", DEVICE_ID_DYNAMIC, NULL, IMX_USB0_BASE,
+			   0x200, IORESOURCE_MEM, &usb_pdata);
+#endif
+
 	return 0;
 }
 device_initcall(mx28_evk_devices_init);
-- 
1.8.3.1


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-09-10 17:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-10 17:57 [PATCH 1/3] usb-imx28: fix enable Eric Bénard
2013-09-10 17:57 ` [PATCH 2/3] imx28-regs: i.MX28 has 2 USB controllers Eric Bénard
2013-09-10 17:57 ` [PATCH 3/3] mx28-evk: enable USB Eric Bénard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox