Hello.
[Oops, just realized that I only replied to Daniel, CCing people/lists
from the original mail now...]
Daniel Mack wrote:
Ah, sorry - as Valentin pointed out, that 'extern' shouldn't be there.
Take the patch below instead please.
Daniel
From 382c09a6fbce8272d71fa7f62d13fc7f4b1a5b35 Mon Sep 17 00:00:00 2001
From: Daniel Mack <daniel@xxxxxxxx>
Date: Thu, 25 Jun 2009 13:33:48 +0200
Subject: [PATCH] USB OTG: Add driver for NXP's ISP1504 transceiver
This adds a minimal driver for NXP's ISP1504 transceivers, using the OTG
framework functions recently introduced.
Signed-off-by: Daniel Mack <daniel@xxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxx>
Cc: David Brownell <dbrownell@xxxxxxxxxxxxxxxxxxxxx>
Cc: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
Cc: linux-usb@xxxxxxxxxxxxxxx
[...]
diff --git a/drivers/usb/otg/isp1504.c b/drivers/usb/otg/isp1504.c
new file mode 100644
index 0000000..8a449db
--- /dev/null
+++ b/drivers/usb/otg/isp1504.c
@@ -0,0 +1,108 @@
+/*
+ * isp1504 - NXP ISP 1504 USB transceiver
Since this driver only uses the standard UPLI registers, shouldn't
it be called ulpi.c instead?
+/* 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 */
+
+/* add to above register address to access Set/Clear functions */
+#define ISP1504_REG_SET 0x01
+#define ISP1504_REG_CLEAR 0x02
These are generic ULPI registers, so you should really call them
ULPI_* and #define in ulpi.h...
+
+/* 1504 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 */
+#define CHRG_VBUS (1 << 4) /* Charge Vbus */
+#define DISCHRG_VBUS (1 << 3) /* Discharge Vbus */
+#define DM_PULL_DOWN (1 << 2) /* enable DM Pull Down */
+#define DP_PULL_DOWN (1 << 1) /* enable DP Pull Down */
+#define ID_PULL_UP (1 << 0) /* enable ID Pull Up */
These bits are generic too...
+
+/* 1504 hardcoded IDs, used for probing */
+#define ISP1504_ULPI_VID 0x04cc
Probably NXP_ULPI_VID...
+static int isp1504_set_vbus(struct otg_transceiver *otg, bool on)
+{
+ if (on)
+ return otg_io_write(otg, DRV_VBUS_EXT | DRV_VBUS |
Why do you think that (optional) external supply should always be used?
+ USE_EXT_VBUS_IND | CHRG_VBUS,
Likewise, why do you think that external Vbus indicator should always
be used?
Also, isn't Vbus charging that you're enabling here a part of SRP
protocol?
+ ISP1504_OTGCTL + ISP1504_REG_SET);
+ else {
+ int ret = otg_io_write(otg, DRV_VBUS_EXT | DRV_VBUS,
+ ISP1504_OTGCTL + ISP1504_REG_CLEAR);
+ if (ret)
+ return ret;
+
+ return otg_io_write(otg, USE_EXT_VBUS_IND | DISCHRG_VBUS,
Why do you switch to external Vbus supply?
+ ISP1504_OTGCTL + ISP1504_REG_SET);
+ }
+}
WBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html