mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/6] Rename definitions for ULPI registers
@ 2012-03-24 14:00 Alexander Shiyan
  2012-03-24 14:00 ` [PATCH 2/6] Add ULPI detection function Alexander Shiyan
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Alexander Shiyan @ 2012-03-24 14:00 UTC (permalink / raw)
  To: barebox

These registers can be used for any standart ULPI chip,
not only for ISP1504.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/usb/otg/isp1504.c |   14 +++++++-------
 drivers/usb/otg/ulpi.c    |    4 ++--
 include/usb/ulpi.h        |   20 ++++++++++----------
 3 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/usb/otg/isp1504.c b/drivers/usb/otg/isp1504.c
index 9ba74b1..9884df4 100644
--- a/drivers/usb/otg/isp1504.c
+++ b/drivers/usb/otg/isp1504.c
@@ -6,10 +6,10 @@ int isp1504_set_vbus_power(void __iomem *view, int on)
 {
 	int vid, pid, ret = 0;
 
-	vid = (ulpi_read(ISP1504_VID_HIGH, view) << 8) |
-		ulpi_read(ISP1504_VID_LOW, view);
-	pid = (ulpi_read(ISP1504_PID_HIGH, view) << 8) |
-		ulpi_read(ISP1504_PID_LOW, view);
+	vid = (ulpi_read(ULPI_VID_HIGH, view) << 8) |
+		ulpi_read(ULPI_VID_LOW, view);
+	pid = (ulpi_read(ULPI_PID_HIGH, view) << 8) |
+		ulpi_read(ULPI_PID_LOW, view);
 
 	pr_info("ULPI Vendor ID 0x%x    Product ID 0x%x\n", vid, pid);
 	if (vid != 0x4cc || pid != 0x1504) {
@@ -22,15 +22,15 @@ int isp1504_set_vbus_power(void __iomem *view, int on)
 				DRV_VBUS |          /* enable internal Vbus */
 				USE_EXT_VBUS_IND |  /* use external indicator */
 				CHRG_VBUS,          /* charge Vbus */
-				ISP1504_OTGCTL, view);
+				ULPI_OTGCTL, view);
 	} else {
 		ret = ulpi_clear(DRV_VBUS_EXT | /* disable external Vbus */
 				DRV_VBUS,         /* disable internal Vbus */
-				ISP1504_OTGCTL, view);
+				ULPI_OTGCTL, view);
 
 		ret |= ulpi_set(USE_EXT_VBUS_IND | /* use external indicator */
 				DISCHRG_VBUS,          /* discharge Vbus */
-				ISP1504_OTGCTL, view);
+				ULPI_OTGCTL, view);
 	}
 
 	return ret;
diff --git a/drivers/usb/otg/ulpi.c b/drivers/usb/otg/ulpi.c
index 6ed6f01..575ed94 100644
--- a/drivers/usb/otg/ulpi.c
+++ b/drivers/usb/otg/ulpi.c
@@ -87,7 +87,7 @@ int ulpi_set(u8 bits, int reg, void __iomem *view)
 	}
 
 	writel((ULPIVW_RUN | ULPIVW_WRITE |
-		      ((reg + ISP1504_REG_SET) << ULPIVW_ADDR_SHIFT) |
+		      ((reg + ULPI_REG_SET) << ULPIVW_ADDR_SHIFT) |
 		      ((bits & ULPIVW_WDATA_MASK) << ULPIVW_WDATA_SHIFT)),
 		     view);
 
@@ -104,7 +104,7 @@ int ulpi_clear(u8 bits, int reg, void __iomem *view)
 	int ret;
 
 	writel((ULPIVW_RUN | ULPIVW_WRITE |
-		      ((reg + ISP1504_REG_CLEAR) << ULPIVW_ADDR_SHIFT) |
+		      ((reg + ULPI_REG_CLEAR) << ULPIVW_ADDR_SHIFT) |
 		      ((bits & ULPIVW_WDATA_MASK) << ULPIVW_WDATA_SHIFT)),
 		     view);
 
diff --git a/include/usb/ulpi.h b/include/usb/ulpi.h
index 0397fdb..9eed6a4 100644
--- a/include/usb/ulpi.h
+++ b/include/usb/ulpi.h
@@ -5,19 +5,19 @@ int ulpi_set(u8 bits, int reg, void __iomem *view);
 int ulpi_clear(u8 bits, int reg, void __iomem *view);
 int ulpi_read(int reg, void __iomem *view);
 
-/* ISP 1504 register addresses */
-#define ISP1504_VID_LOW		0x00	/* Vendor ID low */
-#define ISP1504_VID_HIGH	0x01	/* Vendor ID high */
-#define ISP1504_PID_LOW		0x02	/* Product ID low */
-#define ISP1504_PID_HIGH	0x03	/* Product ID high */
-#define ISP1504_ITFCTL		0x07	/* Interface Control */
-#define ISP1504_OTGCTL		0x0A	/* OTG Control */
+/* ULPI register addresses */
+#define ULPI_VID_LOW		0x00	/* Vendor ID low */
+#define ULPI_VID_HIGH		0x01	/* Vendor ID high */
+#define ULPI_PID_LOW		0x02	/* Product ID low */
+#define ULPI_PID_HIGH		0x03	/* Product ID high */
+#define ULPI_ITFCTL		0x07	/* Interface Control */
+#define ULPI_OTGCTL		0x0A	/* OTG Control */
 
 /* add to above register address to access Set/Clear functions */
-#define ISP1504_REG_SET		0x01
-#define ISP1504_REG_CLEAR	0x02
+#define ULPI_REG_SET		0x01
+#define ULPI_REG_CLEAR		0x02
 
-/* 1504 OTG Control Register bits */
+/* ULPI OTG Control Register bits */
 #define USE_EXT_VBUS_IND	(1 << 7)	/* Use ext. Vbus indicator */
 #define DRV_VBUS_EXT		(1 << 6)	/* Drive Vbus external */
 #define DRV_VBUS		(1 << 5)	/* Drive Vbus */
-- 
1.7.3.4


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

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

* [PATCH 2/6] Add ULPI detection function.
  2012-03-24 14:00 [PATCH 1/6] Rename definitions for ULPI registers Alexander Shiyan
@ 2012-03-24 14:00 ` Alexander Shiyan
  2012-03-24 14:00 ` [PATCH 3/6] Move set_vbus_power code to ULPI driver Alexander Shiyan
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Alexander Shiyan @ 2012-03-24 14:00 UTC (permalink / raw)
  To: barebox

Added ULPI detection function.
Same function from isp1504 driver removed.
Used implementation from Linux kernel.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/usb/otg/isp1504.c |   12 ++----------
 drivers/usb/otg/ulpi.c    |   45 +++++++++++++++++++++++++++++++++++++++++++++
 include/usb/ulpi.h        |    1 +
 3 files changed, 48 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/otg/isp1504.c b/drivers/usb/otg/isp1504.c
index 9884df4..c093a3a 100644
--- a/drivers/usb/otg/isp1504.c
+++ b/drivers/usb/otg/isp1504.c
@@ -4,18 +4,10 @@
 
 int isp1504_set_vbus_power(void __iomem *view, int on)
 {
-	int vid, pid, ret = 0;
+	int ret = 0;
 
-	vid = (ulpi_read(ULPI_VID_HIGH, view) << 8) |
-		ulpi_read(ULPI_VID_LOW, view);
-	pid = (ulpi_read(ULPI_PID_HIGH, view) << 8) |
-		ulpi_read(ULPI_PID_LOW, view);
-
-	pr_info("ULPI Vendor ID 0x%x    Product ID 0x%x\n", vid, pid);
-	if (vid != 0x4cc || pid != 0x1504) {
-		pr_err("No ISP1504 found\n");
+	if (ulpi_init(view))
 		return -1;
-	}
 
 	if (on) {
 		ret = ulpi_set(DRV_VBUS_EXT |       /* enable external Vbus */
diff --git a/drivers/usb/otg/ulpi.c b/drivers/usb/otg/ulpi.c
index 575ed94..ad13b4b 100644
--- a/drivers/usb/otg/ulpi.c
+++ b/drivers/usb/otg/ulpi.c
@@ -116,3 +116,48 @@ int ulpi_clear(u8 bits, int reg, void __iomem *view)
 }
 EXPORT_SYMBOL(ulpi_clear);
 
+struct ulpi_info {
+	uint32_t	id;
+	char		*name;
+};
+
+#define ULPI_ID(vendor, product) (((vendor) << 16) | (product))
+#define ULPI_INFO(_id, _name)		\
+	{				\
+		.id	= (_id),	\
+		.name	= (_name),	\
+	}
+
+/* ULPI hardcoded IDs, used for probing */
+static struct ulpi_info ulpi_ids[] = {
+	ULPI_INFO(ULPI_ID(0x04cc, 0x1504), "NXP ISP1504"),
+	ULPI_INFO(ULPI_ID(0x0424, 0x0006), "SMSC USB331x"),
+};
+
+int ulpi_init(void __iomem *view)
+{
+	int i, vid, pid, ret;
+	uint32_t ulpi_id = 0;
+
+	for (i = 0; i < 4; i++) {
+		ret = ulpi_read(ULPI_PID_HIGH - i, view);
+		if (ret < 0)
+			return ret;
+		ulpi_id = (ulpi_id << 8) | ret;
+	}
+	vid = ulpi_id & 0xffff;
+	pid = ulpi_id >> 16;
+
+	for (i = 0; i < ARRAY_SIZE(ulpi_ids); i++) {
+		if (ulpi_ids[i].id == ULPI_ID(vid, pid)) {
+			pr_info("Found %s ULPI transceiver (0x%04x:0x%04x).\n",
+			ulpi_ids[i].name, vid, pid);
+			return 0;
+		}
+	}
+
+	pr_err("No ULPI found.\n");
+
+	return -1;
+}
+EXPORT_SYMBOL(ulpi_init);
diff --git a/include/usb/ulpi.h b/include/usb/ulpi.h
index 9eed6a4..d841a98 100644
--- a/include/usb/ulpi.h
+++ b/include/usb/ulpi.h
@@ -4,6 +4,7 @@
 int ulpi_set(u8 bits, int reg, void __iomem *view);
 int ulpi_clear(u8 bits, int reg, void __iomem *view);
 int ulpi_read(int reg, void __iomem *view);
+int ulpi_init(void __iomem *view);
 
 /* ULPI register addresses */
 #define ULPI_VID_LOW		0x00	/* Vendor ID low */
-- 
1.7.3.4


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

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

* [PATCH 3/6] Move set_vbus_power code to ULPI driver
  2012-03-24 14:00 [PATCH 1/6] Rename definitions for ULPI registers Alexander Shiyan
  2012-03-24 14:00 ` [PATCH 2/6] Add ULPI detection function Alexander Shiyan
@ 2012-03-24 14:00 ` Alexander Shiyan
  2012-03-24 14:00 ` [PATCH 4/6] Rename function ulpi_init to ulpi_detect Alexander Shiyan
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Alexander Shiyan @ 2012-03-24 14:00 UTC (permalink / raw)
  To: barebox

This is ULPI-specific, not ISP1504.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/usb/otg/isp1504.c |   21 +--------------------
 drivers/usb/otg/ulpi.c    |   24 ++++++++++++++++++++++++
 include/usb/ulpi.h        |    1 +
 3 files changed, 26 insertions(+), 20 deletions(-)

diff --git a/drivers/usb/otg/isp1504.c b/drivers/usb/otg/isp1504.c
index c093a3a..568ba72 100644
--- a/drivers/usb/otg/isp1504.c
+++ b/drivers/usb/otg/isp1504.c
@@ -1,29 +1,10 @@
 #include <common.h>
 #include <usb/ulpi.h>
-#include <usb/isp1504.h>
 
 int isp1504_set_vbus_power(void __iomem *view, int on)
 {
-	int ret = 0;
-
 	if (ulpi_init(view))
 		return -1;
 
-	if (on) {
-		ret = ulpi_set(DRV_VBUS_EXT |       /* enable external Vbus */
-				DRV_VBUS |          /* enable internal Vbus */
-				USE_EXT_VBUS_IND |  /* use external indicator */
-				CHRG_VBUS,          /* charge Vbus */
-				ULPI_OTGCTL, view);
-	} else {
-		ret = ulpi_clear(DRV_VBUS_EXT | /* disable external Vbus */
-				DRV_VBUS,         /* disable internal Vbus */
-				ULPI_OTGCTL, view);
-
-		ret |= ulpi_set(USE_EXT_VBUS_IND | /* use external indicator */
-				DISCHRG_VBUS,          /* discharge Vbus */
-				ULPI_OTGCTL, view);
-	}
-
-	return ret;
+	return ulpi_set_vbus(view, on);
 }
diff --git a/drivers/usb/otg/ulpi.c b/drivers/usb/otg/ulpi.c
index ad13b4b..5d52511 100644
--- a/drivers/usb/otg/ulpi.c
+++ b/drivers/usb/otg/ulpi.c
@@ -161,3 +161,27 @@ int ulpi_init(void __iomem *view)
 	return -1;
 }
 EXPORT_SYMBOL(ulpi_init);
+
+int ulpi_set_vbus(void __iomem *view, int on)
+{
+	int ret;
+
+	if (on) {
+		ret = ulpi_set(DRV_VBUS_EXT |		/* enable external Vbus */
+				DRV_VBUS |		/* enable internal Vbus */
+				USE_EXT_VBUS_IND |	/* use external indicator */
+				CHRG_VBUS,		/* charge Vbus */
+				ULPI_OTGCTL, view);
+	} else {
+		ret = ulpi_clear(DRV_VBUS_EXT |		/* disable external Vbus */
+				DRV_VBUS,		/* disable internal Vbus */
+				ULPI_OTGCTL, view);
+
+		ret |= ulpi_set(USE_EXT_VBUS_IND |	/* use external indicator */
+				DISCHRG_VBUS,		/* discharge Vbus */
+				ULPI_OTGCTL, view);
+	}
+
+	return ret;
+}
+EXPORT_SYMBOL(ulpi_set_vbus);
diff --git a/include/usb/ulpi.h b/include/usb/ulpi.h
index d841a98..75197e1 100644
--- a/include/usb/ulpi.h
+++ b/include/usb/ulpi.h
@@ -5,6 +5,7 @@ int ulpi_set(u8 bits, int reg, void __iomem *view);
 int ulpi_clear(u8 bits, int reg, void __iomem *view);
 int ulpi_read(int reg, void __iomem *view);
 int ulpi_init(void __iomem *view);
+int ulpi_set_vbus(void __iomem *view, int on);
 
 /* ULPI register addresses */
 #define ULPI_VID_LOW		0x00	/* Vendor ID low */
-- 
1.7.3.4


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

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

* [PATCH 4/6] Rename function ulpi_init to ulpi_detect
  2012-03-24 14:00 [PATCH 1/6] Rename definitions for ULPI registers Alexander Shiyan
  2012-03-24 14:00 ` [PATCH 2/6] Add ULPI detection function Alexander Shiyan
  2012-03-24 14:00 ` [PATCH 3/6] Move set_vbus_power code to ULPI driver Alexander Shiyan
@ 2012-03-24 14:00 ` Alexander Shiyan
  2012-03-24 14:00 ` [PATCH 5/6] Completely migrate option ISP1504 to ULPI Alexander Shiyan
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Alexander Shiyan @ 2012-03-24 14:00 UTC (permalink / raw)
  To: barebox


Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/usb/otg/ulpi.c |    4 ++--
 include/usb/ulpi.h     |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/otg/ulpi.c b/drivers/usb/otg/ulpi.c
index 5d52511..6d00ff0 100644
--- a/drivers/usb/otg/ulpi.c
+++ b/drivers/usb/otg/ulpi.c
@@ -134,7 +134,7 @@ static struct ulpi_info ulpi_ids[] = {
 	ULPI_INFO(ULPI_ID(0x0424, 0x0006), "SMSC USB331x"),
 };
 
-int ulpi_init(void __iomem *view)
+int ulpi_probe(void __iomem *view)
 {
 	int i, vid, pid, ret;
 	uint32_t ulpi_id = 0;
@@ -160,7 +160,7 @@ int ulpi_init(void __iomem *view)
 
 	return -1;
 }
-EXPORT_SYMBOL(ulpi_init);
+EXPORT_SYMBOL(ulpi_probe);
 
 int ulpi_set_vbus(void __iomem *view, int on)
 {
diff --git a/include/usb/ulpi.h b/include/usb/ulpi.h
index 75197e1..235d006 100644
--- a/include/usb/ulpi.h
+++ b/include/usb/ulpi.h
@@ -4,7 +4,7 @@
 int ulpi_set(u8 bits, int reg, void __iomem *view);
 int ulpi_clear(u8 bits, int reg, void __iomem *view);
 int ulpi_read(int reg, void __iomem *view);
-int ulpi_init(void __iomem *view);
+int ulpi_probe(void __iomem *view);
 int ulpi_set_vbus(void __iomem *view, int on);
 
 /* ULPI register addresses */
-- 
1.7.3.4


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

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

* [PATCH 5/6] Completely migrate option ISP1504 to ULPI
  2012-03-24 14:00 [PATCH 1/6] Rename definitions for ULPI registers Alexander Shiyan
                   ` (2 preceding siblings ...)
  2012-03-24 14:00 ` [PATCH 4/6] Rename function ulpi_init to ulpi_detect Alexander Shiyan
@ 2012-03-24 14:00 ` Alexander Shiyan
  2012-03-24 14:00 ` [PATCH 6/6] Cosmetic change name ISP1504 -> ISP150x Alexander Shiyan
  2012-04-02  7:35 ` [PATCH 1/6] Rename definitions for ULPI registers Sascha Hauer
  5 siblings, 0 replies; 7+ messages in thread
From: Alexander Shiyan @ 2012-03-24 14:00 UTC (permalink / raw)
  To: barebox

Since we do not have ISP1504-related functions, we migrated to ULPI.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 arch/arm/boards/guf-neso/board.c        |    4 ++--
 arch/arm/boards/pcm037/pcm037.c         |    6 +++---
 arch/arm/boards/pcm038/pcm038.c         |    4 ++--
 arch/arm/boards/phycard-i.MX27/pca100.c |    6 +++---
 arch/arm/configs/neso_defconfig         |    2 +-
 arch/arm/configs/pca100_defconfig       |    2 +-
 arch/arm/configs/pcm038_defconfig       |    2 +-
 arch/arm/mach-imx/Kconfig               |    2 +-
 drivers/usb/otg/Kconfig                 |    8 +++-----
 drivers/usb/otg/Makefile                |    1 -
 drivers/usb/otg/isp1504.c               |   10 ----------
 drivers/usb/otg/ulpi.c                  |   11 +++++++++--
 include/usb/isp1504.h                   |    6 ------
 include/usb/ulpi.h                      |    3 +--
 14 files changed, 27 insertions(+), 40 deletions(-)
 delete mode 100644 drivers/usb/otg/isp1504.c
 delete mode 100644 include/usb/isp1504.h

diff --git a/arch/arm/boards/guf-neso/board.c b/arch/arm/boards/guf-neso/board.c
index 62d82f2..84ef225 100644
--- a/arch/arm/boards/guf-neso/board.c
+++ b/arch/arm/boards/guf-neso/board.c
@@ -30,7 +30,7 @@
 #include <nand.h>
 #include <command.h>
 #include <spi/spi.h>
-#include <usb/isp1504.h>
+#include <usb/ulpi.h>
 
 #include <io.h>
 #include <asm/mmu.h>
@@ -133,7 +133,7 @@ static void neso_usbh_init(void)
 
 	gpio_set_value(USBH2_PHY_CS_GPIO, 0);
 	mdelay(10);
-	isp1504_set_vbus_power((void *)(IMX_OTG_BASE + 0x570), 1);
+	ulpi_setup((void *)(IMX_OTG_BASE + 0x570), 1);
 }
 #endif
 
diff --git a/arch/arm/boards/pcm037/pcm037.c b/arch/arm/boards/pcm037/pcm037.c
index d59612f..46f2ce9 100644
--- a/arch/arm/boards/pcm037/pcm037.c
+++ b/arch/arm/boards/pcm037/pcm037.c
@@ -27,7 +27,7 @@
 #include <driver.h>
 #include <fs.h>
 #include <environment.h>
-#include <usb/isp1504.h>
+#include <usb/ulpi.h>
 #include <mach/imx-regs.h>
 #include <mach/iomux-mx31.h>
 #include <asm/armlinux.h>
@@ -93,7 +93,7 @@ static void pcm037_usb_init(void)
 	imx_iomux_mode(MX31_PIN_USBOTG_STP__USBOTG_STP);
 
 	mdelay(50);
-	isp1504_set_vbus_power((void *)(IMX_OTG_BASE + 0x170), 1);
+	ulpi_setup((void *)(IMX_OTG_BASE + 0x170), 1);
 
 	/* Host 2 */
 	tmp = readl(IOMUXC_BASE + 0x8);
@@ -138,7 +138,7 @@ static void pcm037_usb_init(void)
 	writel(tmp, IMX_OTG_BASE + 0x584);
 
 	mdelay(50);
-	isp1504_set_vbus_power((void *)(IMX_OTG_BASE + 0x570), 1);
+	ulpi_setup((void *)(IMX_OTG_BASE + 0x570), 1);
 
 	/* Set to Host mode */
 	tmp = readl(IMX_OTG_BASE + 0x1a8);
diff --git a/arch/arm/boards/pcm038/pcm038.c b/arch/arm/boards/pcm038/pcm038.c
index 8dd6521..3bf0e31 100644
--- a/arch/arm/boards/pcm038/pcm038.c
+++ b/arch/arm/boards/pcm038/pcm038.c
@@ -41,7 +41,7 @@
 #include <mach/imxfb.h>
 #include <asm/mmu.h>
 #include <i2c/i2c.h>
-#include <usb/isp1504.h>
+#include <usb/ulpi.h>
 #include <mach/spi.h>
 #include <mach/iomux-mx27.h>
 #include <mach/devices-imx27.h>
@@ -127,7 +127,7 @@ static void pcm038_usbh_init(void)
 
 	mdelay(10);
 
-	isp1504_set_vbus_power((void *)(IMX_OTG_BASE + 0x570), 1);
+	ulpi_setup((void *)(IMX_OTG_BASE + 0x570), 1);
 }
 #endif
 
diff --git a/arch/arm/boards/phycard-i.MX27/pca100.c b/arch/arm/boards/phycard-i.MX27/pca100.c
index cfbddcf..a0a9911 100644
--- a/arch/arm/boards/phycard-i.MX27/pca100.c
+++ b/arch/arm/boards/phycard-i.MX27/pca100.c
@@ -39,7 +39,7 @@
 #include <mach/imxfb.h>
 #include <gpio.h>
 #include <asm/mmu.h>
-#include <usb/isp1504.h>
+#include <usb/ulpi.h>
 #include <mach/iomux-mx27.h>
 #include <mach/devices-imx27.h>
 
@@ -140,9 +140,9 @@ static void pca100_usb_register(void)
 
 	mdelay(10);
 
-	isp1504_set_vbus_power((void *)(IMX_OTG_BASE + 0x170), 1);
+	ulpi_setup((void *)(IMX_OTG_BASE + 0x170), 1);
 	add_generic_usb_ehci_device(-1, IMX_OTG_BASE, NULL);
-	isp1504_set_vbus_power((void *)(IMX_OTG_BASE + 0x570), 1);
+	ulpi_setup((void *)(IMX_OTG_BASE + 0x570), 1);
 	add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
 }
 #endif
diff --git a/arch/arm/configs/neso_defconfig b/arch/arm/configs/neso_defconfig
index 45ffe30..fe5110f 100644
--- a/arch/arm/configs/neso_defconfig
+++ b/arch/arm/configs/neso_defconfig
@@ -68,7 +68,7 @@ CONFIG_NAND_IMX=y
 CONFIG_UBI=y
 CONFIG_USB=y
 CONFIG_USB_EHCI=y
-CONFIG_USB_ISP1504=y
+CONFIG_USB_ULPI=y
 CONFIG_VIDEO=y
 CONFIG_DRIVER_VIDEO_IMX=y
 CONFIG_IMXFB_DRIVER_VIDEO_IMX_OVERLAY=y
diff --git a/arch/arm/configs/pca100_defconfig b/arch/arm/configs/pca100_defconfig
index 2df7e34..76039e2 100644
--- a/arch/arm/configs/pca100_defconfig
+++ b/arch/arm/configs/pca100_defconfig
@@ -65,6 +65,6 @@ CONFIG_NAND_IMX=y
 CONFIG_UBI=y
 CONFIG_USB=y
 CONFIG_USB_EHCI=y
-CONFIG_USB_ISP1504=y
+CONFIG_USB_ULPI=y
 CONFIG_ZLIB=y
 CONFIG_LZO_DECOMPRESS=y
diff --git a/arch/arm/configs/pcm038_defconfig b/arch/arm/configs/pcm038_defconfig
index b63337e..17a5e14 100644
--- a/arch/arm/configs/pcm038_defconfig
+++ b/arch/arm/configs/pcm038_defconfig
@@ -70,7 +70,7 @@ CONFIG_NAND_IMX=y
 CONFIG_UBI=y
 CONFIG_USB=y
 CONFIG_USB_EHCI=y
-CONFIG_USB_ISP1504=y
+CONFIG_USB_ULPI=y
 CONFIG_VIDEO=y
 CONFIG_DRIVER_VIDEO_IMX=y
 CONFIG_IMXFB_DRIVER_VIDEO_IMX_OVERLAY=y
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 853757b..75e87fe 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -307,7 +307,7 @@ choice
 config MACH_PCM037
 	bool "phyCORE-i.MX31"
 	select MACH_HAS_LOWLEVEL_INIT
-	select USB_ISP1504 if USB
+	select USB_ULPI if USB
 	select ARCH_HAS_L2X0
 	help
 	  Say Y here if you are using Phytec's phyCORE-i.MX31 (pcm037) equipped
diff --git a/drivers/usb/otg/Kconfig b/drivers/usb/otg/Kconfig
index de09cf3..2c5b789 100644
--- a/drivers/usb/otg/Kconfig
+++ b/drivers/usb/otg/Kconfig
@@ -1,9 +1,7 @@
 config USB_ULPI
-	bool
-
-config USB_ISP1504
-	select USB_ULPI
-	bool "ISP1504 Tranceiver support"
+	bool "ULPI Tranceiver support"
+	help
+	  Support for tranceivers that conforms ULPI specification.
 
 config USB_TWL4030
 	bool "TWL4030 Tranceiver support"
diff --git a/drivers/usb/otg/Makefile b/drivers/usb/otg/Makefile
index aa95cc9..465a7f0 100644
--- a/drivers/usb/otg/Makefile
+++ b/drivers/usb/otg/Makefile
@@ -1,4 +1,3 @@
 obj-$(CONFIG_USB_ULPI)		+= ulpi.o
-obj-$(CONFIG_USB_ISP1504)	+= isp1504.o
 obj-$(CONFIG_USB_TWL4030)	+= twl4030.o
 
diff --git a/drivers/usb/otg/isp1504.c b/drivers/usb/otg/isp1504.c
deleted file mode 100644
index 568ba72..0000000
--- a/drivers/usb/otg/isp1504.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <common.h>
-#include <usb/ulpi.h>
-
-int isp1504_set_vbus_power(void __iomem *view, int on)
-{
-	if (ulpi_init(view))
-		return -1;
-
-	return ulpi_set_vbus(view, on);
-}
diff --git a/drivers/usb/otg/ulpi.c b/drivers/usb/otg/ulpi.c
index 6d00ff0..662f78b 100644
--- a/drivers/usb/otg/ulpi.c
+++ b/drivers/usb/otg/ulpi.c
@@ -160,7 +160,6 @@ int ulpi_probe(void __iomem *view)
 
 	return -1;
 }
-EXPORT_SYMBOL(ulpi_probe);
 
 int ulpi_set_vbus(void __iomem *view, int on)
 {
@@ -184,4 +183,12 @@ int ulpi_set_vbus(void __iomem *view, int on)
 
 	return ret;
 }
-EXPORT_SYMBOL(ulpi_set_vbus);
+
+int ulpi_setup(void __iomem *view, int on)
+{
+	if (ulpi_probe(view))
+		return -1;
+
+	return ulpi_set_vbus(view, on);
+}
+EXPORT_SYMBOL(ulpi_setup);
diff --git a/include/usb/isp1504.h b/include/usb/isp1504.h
deleted file mode 100644
index 2eb7665..0000000
--- a/include/usb/isp1504.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef __INCLUDE_USB_ISP1504_H
-#define __INCLUDE_USB_ISP1504_H
-
-int isp1504_set_vbus_power(void __iomem *view, int on);
-
-#endif /* __INCLUDE_USB_ISP1504_H */
diff --git a/include/usb/ulpi.h b/include/usb/ulpi.h
index 235d006..542993c 100644
--- a/include/usb/ulpi.h
+++ b/include/usb/ulpi.h
@@ -4,8 +4,7 @@
 int ulpi_set(u8 bits, int reg, void __iomem *view);
 int ulpi_clear(u8 bits, int reg, void __iomem *view);
 int ulpi_read(int reg, void __iomem *view);
-int ulpi_probe(void __iomem *view);
-int ulpi_set_vbus(void __iomem *view, int on);
+int ulpi_setup(void __iomem *view, int on);
 
 /* ULPI register addresses */
 #define ULPI_VID_LOW		0x00	/* Vendor ID low */
-- 
1.7.3.4


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

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

* [PATCH 6/6] Cosmetic change name ISP1504 -> ISP150x
  2012-03-24 14:00 [PATCH 1/6] Rename definitions for ULPI registers Alexander Shiyan
                   ` (3 preceding siblings ...)
  2012-03-24 14:00 ` [PATCH 5/6] Completely migrate option ISP1504 to ULPI Alexander Shiyan
@ 2012-03-24 14:00 ` Alexander Shiyan
  2012-04-02  7:35 ` [PATCH 1/6] Rename definitions for ULPI registers Sascha Hauer
  5 siblings, 0 replies; 7+ messages in thread
From: Alexander Shiyan @ 2012-03-24 14:00 UTC (permalink / raw)
  To: barebox

ISP150x product line have same identifier, we can print these
chips as ISP150x.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/usb/otg/ulpi.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/otg/ulpi.c b/drivers/usb/otg/ulpi.c
index 662f78b..a5ca25f 100644
--- a/drivers/usb/otg/ulpi.c
+++ b/drivers/usb/otg/ulpi.c
@@ -130,7 +130,7 @@ struct ulpi_info {
 
 /* ULPI hardcoded IDs, used for probing */
 static struct ulpi_info ulpi_ids[] = {
-	ULPI_INFO(ULPI_ID(0x04cc, 0x1504), "NXP ISP1504"),
+	ULPI_INFO(ULPI_ID(0x04cc, 0x1504), "NXP ISP150x"),
 	ULPI_INFO(ULPI_ID(0x0424, 0x0006), "SMSC USB331x"),
 };
 
-- 
1.7.3.4


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

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

* Re: [PATCH 1/6] Rename definitions for ULPI registers
  2012-03-24 14:00 [PATCH 1/6] Rename definitions for ULPI registers Alexander Shiyan
                   ` (4 preceding siblings ...)
  2012-03-24 14:00 ` [PATCH 6/6] Cosmetic change name ISP1504 -> ISP150x Alexander Shiyan
@ 2012-04-02  7:35 ` Sascha Hauer
  5 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2012-04-02  7:35 UTC (permalink / raw)
  To: Alexander Shiyan; +Cc: barebox

On Sat, Mar 24, 2012 at 06:00:35PM +0400, Alexander Shiyan wrote:
> These registers can be used for any standart ULPI chip,
> not only for ISP1504.
> 
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>

Applied, thanks

Sascha

> ---
>  drivers/usb/otg/isp1504.c |   14 +++++++-------
>  drivers/usb/otg/ulpi.c    |    4 ++--
>  include/usb/ulpi.h        |   20 ++++++++++----------
>  3 files changed, 19 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/usb/otg/isp1504.c b/drivers/usb/otg/isp1504.c
> index 9ba74b1..9884df4 100644
> --- a/drivers/usb/otg/isp1504.c
> +++ b/drivers/usb/otg/isp1504.c
> @@ -6,10 +6,10 @@ int isp1504_set_vbus_power(void __iomem *view, int on)
>  {
>  	int vid, pid, ret = 0;
>  
> -	vid = (ulpi_read(ISP1504_VID_HIGH, view) << 8) |
> -		ulpi_read(ISP1504_VID_LOW, view);
> -	pid = (ulpi_read(ISP1504_PID_HIGH, view) << 8) |
> -		ulpi_read(ISP1504_PID_LOW, view);
> +	vid = (ulpi_read(ULPI_VID_HIGH, view) << 8) |
> +		ulpi_read(ULPI_VID_LOW, view);
> +	pid = (ulpi_read(ULPI_PID_HIGH, view) << 8) |
> +		ulpi_read(ULPI_PID_LOW, view);
>  
>  	pr_info("ULPI Vendor ID 0x%x    Product ID 0x%x\n", vid, pid);
>  	if (vid != 0x4cc || pid != 0x1504) {
> @@ -22,15 +22,15 @@ int isp1504_set_vbus_power(void __iomem *view, int on)
>  				DRV_VBUS |          /* enable internal Vbus */
>  				USE_EXT_VBUS_IND |  /* use external indicator */
>  				CHRG_VBUS,          /* charge Vbus */
> -				ISP1504_OTGCTL, view);
> +				ULPI_OTGCTL, view);
>  	} else {
>  		ret = ulpi_clear(DRV_VBUS_EXT | /* disable external Vbus */
>  				DRV_VBUS,         /* disable internal Vbus */
> -				ISP1504_OTGCTL, view);
> +				ULPI_OTGCTL, view);
>  
>  		ret |= ulpi_set(USE_EXT_VBUS_IND | /* use external indicator */
>  				DISCHRG_VBUS,          /* discharge Vbus */
> -				ISP1504_OTGCTL, view);
> +				ULPI_OTGCTL, view);
>  	}
>  
>  	return ret;
> diff --git a/drivers/usb/otg/ulpi.c b/drivers/usb/otg/ulpi.c
> index 6ed6f01..575ed94 100644
> --- a/drivers/usb/otg/ulpi.c
> +++ b/drivers/usb/otg/ulpi.c
> @@ -87,7 +87,7 @@ int ulpi_set(u8 bits, int reg, void __iomem *view)
>  	}
>  
>  	writel((ULPIVW_RUN | ULPIVW_WRITE |
> -		      ((reg + ISP1504_REG_SET) << ULPIVW_ADDR_SHIFT) |
> +		      ((reg + ULPI_REG_SET) << ULPIVW_ADDR_SHIFT) |
>  		      ((bits & ULPIVW_WDATA_MASK) << ULPIVW_WDATA_SHIFT)),
>  		     view);
>  
> @@ -104,7 +104,7 @@ int ulpi_clear(u8 bits, int reg, void __iomem *view)
>  	int ret;
>  
>  	writel((ULPIVW_RUN | ULPIVW_WRITE |
> -		      ((reg + ISP1504_REG_CLEAR) << ULPIVW_ADDR_SHIFT) |
> +		      ((reg + ULPI_REG_CLEAR) << ULPIVW_ADDR_SHIFT) |
>  		      ((bits & ULPIVW_WDATA_MASK) << ULPIVW_WDATA_SHIFT)),
>  		     view);
>  
> diff --git a/include/usb/ulpi.h b/include/usb/ulpi.h
> index 0397fdb..9eed6a4 100644
> --- a/include/usb/ulpi.h
> +++ b/include/usb/ulpi.h
> @@ -5,19 +5,19 @@ int ulpi_set(u8 bits, int reg, void __iomem *view);
>  int ulpi_clear(u8 bits, int reg, void __iomem *view);
>  int ulpi_read(int reg, void __iomem *view);
>  
> -/* ISP 1504 register addresses */
> -#define ISP1504_VID_LOW		0x00	/* Vendor ID low */
> -#define ISP1504_VID_HIGH	0x01	/* Vendor ID high */
> -#define ISP1504_PID_LOW		0x02	/* Product ID low */
> -#define ISP1504_PID_HIGH	0x03	/* Product ID high */
> -#define ISP1504_ITFCTL		0x07	/* Interface Control */
> -#define ISP1504_OTGCTL		0x0A	/* OTG Control */
> +/* ULPI register addresses */
> +#define ULPI_VID_LOW		0x00	/* Vendor ID low */
> +#define ULPI_VID_HIGH		0x01	/* Vendor ID high */
> +#define ULPI_PID_LOW		0x02	/* Product ID low */
> +#define ULPI_PID_HIGH		0x03	/* Product ID high */
> +#define ULPI_ITFCTL		0x07	/* Interface Control */
> +#define ULPI_OTGCTL		0x0A	/* OTG Control */
>  
>  /* add to above register address to access Set/Clear functions */
> -#define ISP1504_REG_SET		0x01
> -#define ISP1504_REG_CLEAR	0x02
> +#define ULPI_REG_SET		0x01
> +#define ULPI_REG_CLEAR		0x02
>  
> -/* 1504 OTG Control Register bits */
> +/* ULPI OTG Control Register bits */
>  #define USE_EXT_VBUS_IND	(1 << 7)	/* Use ext. Vbus indicator */
>  #define DRV_VBUS_EXT		(1 << 6)	/* Drive Vbus external */
>  #define DRV_VBUS		(1 << 5)	/* Drive Vbus */
> -- 
> 1.7.3.4
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

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

end of thread, other threads:[~2012-04-02  7:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-24 14:00 [PATCH 1/6] Rename definitions for ULPI registers Alexander Shiyan
2012-03-24 14:00 ` [PATCH 2/6] Add ULPI detection function Alexander Shiyan
2012-03-24 14:00 ` [PATCH 3/6] Move set_vbus_power code to ULPI driver Alexander Shiyan
2012-03-24 14:00 ` [PATCH 4/6] Rename function ulpi_init to ulpi_detect Alexander Shiyan
2012-03-24 14:00 ` [PATCH 5/6] Completely migrate option ISP1504 to ULPI Alexander Shiyan
2012-03-24 14:00 ` [PATCH 6/6] Cosmetic change name ISP1504 -> ISP150x Alexander Shiyan
2012-04-02  7:35 ` [PATCH 1/6] Rename definitions for ULPI registers Sascha Hauer

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