mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] PCM038: Move USBH2 initialization to PCM970
@ 2012-05-14  8:34 Alexander Shiyan
  2012-05-14  8:34 ` [PATCH 2/2] Add compressed barebox_default_env to .gitignore Alexander Shiyan
  2012-05-14  8:57 ` [PATCH 1/2] PCM038: Move USBH2 initialization to PCM970 Juergen Beisert
  0 siblings, 2 replies; 4+ messages in thread
From: Alexander Shiyan @ 2012-05-14  8:34 UTC (permalink / raw)
  To: barebox

Actually ISP1504 ULPI chip are installed on PCM970 development board.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 arch/arm/boards/pcm038/pcm038.c |   40 -------------------------------
 arch/arm/boards/pcm038/pcm970.c |   49 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+), 40 deletions(-)

diff --git a/arch/arm/boards/pcm038/pcm038.c b/arch/arm/boards/pcm038/pcm038.c
index c8a6aac..d247edc 100644
--- a/arch/arm/boards/pcm038/pcm038.c
+++ b/arch/arm/boards/pcm038/pcm038.c
@@ -37,7 +37,6 @@
 #include <mach/imx-pll.h>
 #include <mach/imxfb.h>
 #include <i2c/i2c.h>
-#include <usb/ulpi.h>
 #include <mach/spi.h>
 #include <mach/iomux-mx27.h>
 #include <mach/devices-imx27.h>
@@ -107,27 +106,6 @@ static struct imx_fb_platform_data pcm038_fb_data = {
 	.dmacr	= 0x00020010,
 };
 
-#ifdef CONFIG_USB
-static void pcm038_usbh_init(void)
-{
-	uint32_t temp;
-
-	temp = readl(IMX_OTG_BASE + 0x600);
-	temp &= ~((3 << 21) | 1);
-	temp |= (1 << 5) | (1 << 16) | (1 << 19) | (1 << 20);
-	writel(temp, IMX_OTG_BASE + 0x600);
-
-	temp = readl(IMX_OTG_BASE + 0x584);
-	temp &= ~(3 << 30);
-	temp |= 2 << 30;
-	writel(temp, IMX_OTG_BASE + 0x584);
-
-	mdelay(10);
-
-	ulpi_setup((void *)(IMX_OTG_BASE + 0x570), 1);
-}
-#endif
-
 /**
  * The spctl0 register is a beast: Seems you can read it
  * only one times without writing it again.
@@ -260,19 +238,6 @@ static int pcm038_devices_init(void)
 		PA29_PF_VSYNC,
 		PA30_PF_CONTRAST,
 		PA31_PF_OE_ACD,
-		/* USB host 2 */
-		PA0_PF_USBH2_CLK,
-		PA1_PF_USBH2_DIR,
-		PA2_PF_USBH2_DATA7,
-		PA3_PF_USBH2_NXT,
-		PA4_PF_USBH2_STP,
-		PD19_AF_USBH2_DATA4,
-		PD20_AF_USBH2_DATA3,
-		PD21_AF_USBH2_DATA6,
-		PD22_AF_USBH2_DATA0,
-		PD23_AF_USBH2_DATA2,
-		PD24_AF_USBH2_DATA1,
-		PD26_AF_USBH2_DATA5,
 		/* I2C1 */
 		PD17_PF_I2C_DATA | GPIO_PUEN,
 		PD18_PF_I2C_CLK,
@@ -310,11 +275,6 @@ static int pcm038_devices_init(void)
 	imx27_add_i2c0(NULL);
 	imx27_add_i2c1(NULL);
 
-#ifdef CONFIG_USB
-	pcm038_usbh_init();
-	add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
-#endif
-
 	/* Register the fec device after the PLL re-initialisation
 	 * as the fec depends on the (now higher) ipg clock
 	 */
diff --git a/arch/arm/boards/pcm038/pcm970.c b/arch/arm/boards/pcm038/pcm970.c
index cdd68a3..7405fc1 100644
--- a/arch/arm/boards/pcm038/pcm970.c
+++ b/arch/arm/boards/pcm038/pcm970.c
@@ -15,15 +15,64 @@
  * MA 02111-1307 USA
  */
 
+#include <common.h>
 #include <io.h>
 #include <init.h>
 #include <mach/imx-regs.h>
+#include <mach/iomux-mx27.h>
+#include <mach/gpio.h>
+#include <usb/ulpi.h>
+
+#ifdef CONFIG_USB
+static void pcm970_usbh2_init(void)
+{
+	int i;
+	uint32_t temp;
+	unsigned int mode[] = {
+		/* USB Host 2 */
+		PA0_PF_USBH2_CLK,
+		PA1_PF_USBH2_DIR,
+		PA2_PF_USBH2_DATA7,
+		PA3_PF_USBH2_NXT,
+		PA4_PF_USBH2_STP,
+		PD19_AF_USBH2_DATA4,
+		PD20_AF_USBH2_DATA3,
+		PD21_AF_USBH2_DATA6,
+		PD22_AF_USBH2_DATA0,
+		PD23_AF_USBH2_DATA2,
+		PD24_AF_USBH2_DATA1,
+		PD26_AF_USBH2_DATA5,
+	};
+
+	for (i = 0; i < ARRAY_SIZE(mode); i++)
+		imx_gpio_mode(mode[i]);
+
+	temp = readl(IMX_OTG_BASE + 0x600);
+	temp &= ~((3 << 21) | 1);
+	temp |= (1 << 5) | (1 << 16) | (1 << 19) | (1 << 20);
+	writel(temp, IMX_OTG_BASE + 0x600);
+
+	temp = readl(IMX_OTG_BASE + 0x584);
+	temp &= ~(3 << 30);
+	temp |= 2 << 30;
+	writel(temp, IMX_OTG_BASE + 0x584);
+
+	mdelay(10);
+
+	if (!ulpi_setup((void *)(IMX_OTG_BASE + 0x570), 1))
+		add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
+}
+#endif
 
 static int pcm970_init(void)
 {
 	/* Configure SJA1000 on cs4 */
 	imx27_setup_weimcs(4, 0x0000DCF6, 0x444A0301, 0x44443302);
 
+#ifdef CONFIG_USB
+	pcm970_usbh2_init();
+#endif
+
 	return 0;
 }
 
-- 
1.7.3.4


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

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

* [PATCH 2/2] Add compressed barebox_default_env to .gitignore
  2012-05-14  8:34 [PATCH 1/2] PCM038: Move USBH2 initialization to PCM970 Alexander Shiyan
@ 2012-05-14  8:34 ` Alexander Shiyan
  2012-05-14  8:57 ` [PATCH 1/2] PCM038: Move USBH2 initialization to PCM970 Juergen Beisert
  1 sibling, 0 replies; 4+ messages in thread
From: Alexander Shiyan @ 2012-05-14  8:34 UTC (permalink / raw)
  To: barebox


Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 .gitignore |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/.gitignore b/.gitignore
index 8a5c583..8e208e0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -36,7 +36,7 @@ barebox.netx
 barebox.map
 System.map
 Module.symvers
-barebox_default_env
+barebox_default_env*
 
 #
 # Generated include files
-- 
1.7.3.4


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

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

* Re: [PATCH 1/2] PCM038: Move USBH2 initialization to PCM970
  2012-05-14  8:34 [PATCH 1/2] PCM038: Move USBH2 initialization to PCM970 Alexander Shiyan
  2012-05-14  8:34 ` [PATCH 2/2] Add compressed barebox_default_env to .gitignore Alexander Shiyan
@ 2012-05-14  8:57 ` Juergen Beisert
  2012-05-14  9:50   ` Alexander Shiyan
  1 sibling, 1 reply; 4+ messages in thread
From: Juergen Beisert @ 2012-05-14  8:57 UTC (permalink / raw)
  To: barebox

Alexander Shiyan wrote:
> [...]
> @@ -260,19 +238,6 @@ static int pcm038_devices_init(void)
>  		PA29_PF_VSYNC,
>  		PA30_PF_CONTRAST,
>  		PA31_PF_OE_ACD,
> -		/* USB host 2 */
> -		PA0_PF_USBH2_CLK,
> -		PA1_PF_USBH2_DIR,
> -		PA2_PF_USBH2_DATA7,
> -		PA3_PF_USBH2_NXT,
> -		PA4_PF_USBH2_STP,
> -		PD19_AF_USBH2_DATA4,
> -		PD20_AF_USBH2_DATA3,
> -		PD21_AF_USBH2_DATA6,
> -		PD22_AF_USBH2_DATA0,
> -		PD23_AF_USBH2_DATA2,
> -		PD24_AF_USBH2_DATA1,
> -		PD26_AF_USBH2_DATA5,
>
> [...]
>
> +#ifdef CONFIG_USB
> +static void pcm970_usbh2_init(void)
> +{
> +	int i;
> +	uint32_t temp;
> +	unsigned int mode[] = {
> +		/* USB Host 2 */
> +		PA0_PF_USBH2_CLK,
> +		PA1_PF_USBH2_DIR,
> +		PA2_PF_USBH2_DATA7,
> +		PA3_PF_USBH2_NXT,
> +		PA4_PF_USBH2_STP,
> +		PD19_AF_USBH2_DATA4,
> +		PD20_AF_USBH2_DATA3,
> +		PD21_AF_USBH2_DATA6,
> +		PD22_AF_USBH2_DATA0,
> +		PD23_AF_USBH2_DATA2,
> +		PD24_AF_USBH2_DATA1,
> +		PD26_AF_USBH2_DATA5,
> +	};
>
> [...]

This changes the initialization of the pins form 'always' to 'sometimes". I 
feel better if pins are physically connected they also should be initialized. 
And if the USB software feature is disable they should get initialized as 
well to keep the signals in a sane state to not confuse externally attached 
devices (in this case it could be useful to configure them as GPIO instead 
with reasonable directions and levels).

jbe

-- 
Pengutronix e.K.                              | Juergen Beisert             |
Linux Solutions for Science and Industry      | http://www.pengutronix.de/  |

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

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

* [PATCH 1/2] PCM038: Move USBH2 initialization to PCM970
  2012-05-14  8:57 ` [PATCH 1/2] PCM038: Move USBH2 initialization to PCM970 Juergen Beisert
@ 2012-05-14  9:50   ` Alexander Shiyan
  0 siblings, 0 replies; 4+ messages in thread
From: Alexander Shiyan @ 2012-05-14  9:50 UTC (permalink / raw)
  To: barebox

Actually ISP1504 ULPI chip are installed on PCM970 development board.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 arch/arm/boards/pcm038/pcm038.c |   40 -------------------------------
 arch/arm/boards/pcm038/pcm970.c |   50 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 50 insertions(+), 40 deletions(-)

diff --git a/arch/arm/boards/pcm038/pcm038.c b/arch/arm/boards/pcm038/pcm038.c
index c8a6aac..d247edc 100644
--- a/arch/arm/boards/pcm038/pcm038.c
+++ b/arch/arm/boards/pcm038/pcm038.c
@@ -37,7 +37,6 @@
 #include <mach/imx-pll.h>
 #include <mach/imxfb.h>
 #include <i2c/i2c.h>
-#include <usb/ulpi.h>
 #include <mach/spi.h>
 #include <mach/iomux-mx27.h>
 #include <mach/devices-imx27.h>
@@ -107,27 +106,6 @@ static struct imx_fb_platform_data pcm038_fb_data = {
 	.dmacr	= 0x00020010,
 };
 
-#ifdef CONFIG_USB
-static void pcm038_usbh_init(void)
-{
-	uint32_t temp;
-
-	temp = readl(IMX_OTG_BASE + 0x600);
-	temp &= ~((3 << 21) | 1);
-	temp |= (1 << 5) | (1 << 16) | (1 << 19) | (1 << 20);
-	writel(temp, IMX_OTG_BASE + 0x600);
-
-	temp = readl(IMX_OTG_BASE + 0x584);
-	temp &= ~(3 << 30);
-	temp |= 2 << 30;
-	writel(temp, IMX_OTG_BASE + 0x584);
-
-	mdelay(10);
-
-	ulpi_setup((void *)(IMX_OTG_BASE + 0x570), 1);
-}
-#endif
-
 /**
  * The spctl0 register is a beast: Seems you can read it
  * only one times without writing it again.
@@ -260,19 +238,6 @@ static int pcm038_devices_init(void)
 		PA29_PF_VSYNC,
 		PA30_PF_CONTRAST,
 		PA31_PF_OE_ACD,
-		/* USB host 2 */
-		PA0_PF_USBH2_CLK,
-		PA1_PF_USBH2_DIR,
-		PA2_PF_USBH2_DATA7,
-		PA3_PF_USBH2_NXT,
-		PA4_PF_USBH2_STP,
-		PD19_AF_USBH2_DATA4,
-		PD20_AF_USBH2_DATA3,
-		PD21_AF_USBH2_DATA6,
-		PD22_AF_USBH2_DATA0,
-		PD23_AF_USBH2_DATA2,
-		PD24_AF_USBH2_DATA1,
-		PD26_AF_USBH2_DATA5,
 		/* I2C1 */
 		PD17_PF_I2C_DATA | GPIO_PUEN,
 		PD18_PF_I2C_CLK,
@@ -310,11 +275,6 @@ static int pcm038_devices_init(void)
 	imx27_add_i2c0(NULL);
 	imx27_add_i2c1(NULL);
 
-#ifdef CONFIG_USB
-	pcm038_usbh_init();
-	add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
-#endif
-
 	/* Register the fec device after the PLL re-initialisation
 	 * as the fec depends on the (now higher) ipg clock
 	 */
diff --git a/arch/arm/boards/pcm038/pcm970.c b/arch/arm/boards/pcm038/pcm970.c
index cdd68a3..cd80677 100644
--- a/arch/arm/boards/pcm038/pcm970.c
+++ b/arch/arm/boards/pcm038/pcm970.c
@@ -15,15 +15,65 @@
  * MA 02111-1307 USA
  */
 
+#include <common.h>
 #include <io.h>
 #include <init.h>
 #include <mach/imx-regs.h>
+#include <mach/iomux-mx27.h>
+#include <mach/gpio.h>
+#include <usb/ulpi.h>
+
+#ifdef CONFIG_USB
+static void pcm970_usbh2_init(void)
+{
+	uint32_t temp;
+
+	temp = readl(IMX_OTG_BASE + 0x600);
+	temp &= ~((3 << 21) | 1);
+	temp |= (1 << 5) | (1 << 16) | (1 << 19) | (1 << 20);
+	writel(temp, IMX_OTG_BASE + 0x600);
+
+	temp = readl(IMX_OTG_BASE + 0x584);
+	temp &= ~(3 << 30);
+	temp |= 2 << 30;
+	writel(temp, IMX_OTG_BASE + 0x584);
+
+	mdelay(10);
+
+	if (!ulpi_setup((void *)(IMX_OTG_BASE + 0x570), 1))
+		add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
+}
+#endif
 
 static int pcm970_init(void)
 {
+	int i;
+	unsigned int mode[] = {
+		/* USB Host 2 */
+		PA0_PF_USBH2_CLK,
+		PA1_PF_USBH2_DIR,
+		PA2_PF_USBH2_DATA7,
+		PA3_PF_USBH2_NXT,
+		PA4_PF_USBH2_STP,
+		PD19_AF_USBH2_DATA4,
+		PD20_AF_USBH2_DATA3,
+		PD21_AF_USBH2_DATA6,
+		PD22_AF_USBH2_DATA0,
+		PD23_AF_USBH2_DATA2,
+		PD24_AF_USBH2_DATA1,
+		PD26_AF_USBH2_DATA5,
+	};
+
+	for (i = 0; i < ARRAY_SIZE(mode); i++)
+		imx_gpio_mode(mode[i]);
+
 	/* Configure SJA1000 on cs4 */
 	imx27_setup_weimcs(4, 0x0000DCF6, 0x444A0301, 0x44443302);
 
+#ifdef CONFIG_USB
+	pcm970_usbh2_init();
+#endif
+
 	return 0;
 }
 
-- 
1.7.3.4


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

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

end of thread, other threads:[~2012-05-14  9:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-14  8:34 [PATCH 1/2] PCM038: Move USBH2 initialization to PCM970 Alexander Shiyan
2012-05-14  8:34 ` [PATCH 2/2] Add compressed barebox_default_env to .gitignore Alexander Shiyan
2012-05-14  8:57 ` [PATCH 1/2] PCM038: Move USBH2 initialization to PCM970 Juergen Beisert
2012-05-14  9:50   ` Alexander Shiyan

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