Skip to contentSkip to conversation

usb: gadget: lpc32xx_udc: Fix compatibility with STOTG04

PATCH RESEND In review Alexandre Pereira da Silva 3 participants 6 messages Oct 15, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 usb: gadget: lpc32xx_udc: Fix compatibility with STOTG04

The STOTG04 is an replacement for ISP1301.

Most of the registers on STOTG04 are the same as on ISP1301, but the register ISP1301_I2C_OTG_CONTROL_2 (address 0x10) doesn't exist on the ST part.

This is a work around for this by using the interrupt source register that should behave the same on both parts and has the needed information.

---

This patch is very important to LPC32xx users. IMHO this should go in for 3.7-rc2.

 drivers/usb/gadget/lpc32xx_udc.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/gadget/lpc32xx_udc.c +2 -2
index f696fb9..21a9861 100644
@@ -2930,10 +2930,10 @@ static void vbus_work(struct work_struct *work)
 
 		/* Get the VBUS status from the transceiver */
 		value = i2c_smbus_read_byte_data(udc->isp1301_i2c_client,
-						 ISP1301_I2C_OTG_CONTROL_2);
+						 ISP1301_I2C_INTERRUPT_SOURCE);
 
 		/* VBUS on or off? */
-		if (value & OTG_B_SESS_VLD)
+		if (value & INT_SESS_VLD)
 			udc->vbus = 1;
 		else
 			udc->vbus = 0;
Signature · 1 line
1.7.10
#1 lore raw

PATCH RESEND 1/1 usb: gadget: lpc32xx_udc: Disable setup request error

This message is an debugging message. It's useful for finding protocol details but it's not necessarily an error.

---
 drivers/usb/gadget/lpc32xx_udc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/lpc32xx_udc.c +1 -1
index 21a9861..d1cf1f4 100644
@@ -2399,7 +2399,7 @@ static void udc_handle_ep0_setup(struct lpc32xx_udc *udc)
 
 		if (i < 0) {
 			/* setup processing failed, force stall */
-			dev_err(udc->dev,
+			dev_dbg(udc->dev,
 				"req %02x.%02x protocol STALL; stat %d\n",
 				reqtype, req, i);
 			udc->ep0state = WAIT_FOR_SETUP;
Signature · 1 line
1.7.10
Acked-by on v1 1/1
#2 lore raw

Re: [PATCH RESEND] usb: gadget: lpc32xx_udc: Disable setup request error

Quoted 4 lines · Alexandre Pereira da Silva

This message is an debugging message. It's useful for finding protocol details but it's not necessarily an error.

Was also confirmed by the NXP developers a while ago, I think.

Quoted 18 lines

---

---
 drivers/usb/gadget/lpc32xx_udc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/lpc32xx_udc.c +1 -1
index 21a9861..d1cf1f4 100644
@@ -2399,7 +2399,7 @@ static void udc_handle_ep0_setup(struct lpc32xx_udc *udc)
 
 		if (i < 0) {
 			/* setup processing failed, force stall */
-			dev_err(udc->dev,
+			dev_dbg(udc->dev,
 				"req %02x.%02x protocol STALL; stat %d\n",
 				reqtype, req, i);
 			udc->ep0state = WAIT_FOR_SETUP;
#3 lore raw
In reply to Alexandre Pereira da Silva

Hi,

Quoted 22 lines · Alexandre Pereira da Silva

The STOTG04 is an replacement for ISP1301.

Most of the registers on STOTG04 are the same as on ISP1301, but the register ISP1301_I2C_OTG_CONTROL_2 (address 0x10) doesn't exist on the ST part.

This is a work around for this by using the interrupt source register that should behave the same on both parts and has the needed information.

---

This patch is very important to LPC32xx users. IMHO this should go in for 3.7-rc2.

 drivers/usb/gadget/lpc32xx_udc.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/gadget/lpc32xx_udc.c +0 -0
index f696fb9..21a9861 100644

drivers/usb/gadget/lpc32xx_udc.c static void vbus_work(struct work_struct *work) · line 2936

Quoted 9 lines
drivers/usb/gadget/lpc32xx_udc.c +2 -2
@@ -2930,10 +2930,10 @@ static void vbus_work(struct work_struct *work)
 
 		/* Get the VBUS status from the transceiver */
 		value = i2c_smbus_read_byte_data(udc->isp1301_i2c_client,
-						 ISP1301_I2C_OTG_CONTROL_2);
+						 ISP1301_I2C_INTERRUPT_SOURCE);
 
 		/* VBUS on or off? */
-		if (value & OTG_B_SESS_VLD)
+		if (value & INT_SESS_VLD)

why isn't this using a PHY driver instead ?

Quoted 6 lines
drivers/usb/gadget/lpc32xx_udc.c +0 -0
 			udc->vbus = 1;
 		else
 			udc->vbus = 0;
Signature · 1 line
1.7.10
Signature · 1 line
balbi
#4 lore raw
Quoted 32 lines · Felipe Balbi
Quoted 30 lines · Alexandre Pereira da Silva

The STOTG04 is an replacement for ISP1301.

Most of the registers on STOTG04 are the same as on ISP1301, but the register ISP1301_I2C_OTG_CONTROL_2 (address 0x10) doesn't exist on the ST part.

This is a work around for this by using the interrupt source register that should behave the same on both parts and has the needed information.

---

This patch is very important to LPC32xx users. IMHO this should go in for 3.7-rc2.

drivers/usb/gadget/lpc32xx_udc.c | 4 ++-- 1 file changed, 2
insertions(+), 2 deletions(-)

(quoted diff) +0 -0

b/drivers/usb/gadget/lpc32xx_udc.c index f696fb9..21a9861 100644 --- a/drivers/usb/gadget/lpc32xx_udc.c +++ b/drivers/usb/gadget/lpc32xx_udc.c @@ -2930,10 +2930,10 @@ static void vbus_work(struct work_struct *work)

/* Get the VBUS status from the transceiver */ value = i2c_smbus_read_byte_data(udc->isp1301_i2c_client, - ISP1301_I2C_OTG_CONTROL_2); + ISP1301_I2C_INTERRUPT_SOURCE);

Quoted 4 lines
Quoted 2 lines

/* VBUS on or off? */ - if (value & OTG_B_SESS_VLD) + if (value
& INT_SESS_VLD)

why isn't this using a PHY driver instead ?

Right, should definitely be done in a subsequent patch.

Thanks for pointing this out.

Tested-by on v1 1/1
#5 lore raw
In reply to Alexandre Pereira da Silva
Quoted 10 lines · Alexandre Pereira da Silva

The STOTG04 is an replacement for ISP1301.

Most of the registers on STOTG04 are the same as on ISP1301, but the register ISP1301_I2C_OTG_CONTROL_2 (address 0x10) doesn't exist on the ST part.

This is a work around for this by using the interrupt source register that should behave the same on both parts and has the needed information.

Quoted 24 lines

---

This patch is very important to LPC32xx users. IMHO this should go in for 3.7-rc2.

 drivers/usb/gadget/lpc32xx_udc.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/gadget/lpc32xx_udc.c +2 -2
index f696fb9..21a9861 100644
@@ -2930,10 +2930,10 @@ static void vbus_work(struct work_struct *work)
 
 		/* Get the VBUS status from the transceiver */
 		value = i2c_smbus_read_byte_data(udc->isp1301_i2c_client,
-						 ISP1301_I2C_OTG_CONTROL_2);
+						 ISP1301_I2C_INTERRUPT_SOURCE);
 
 		/* VBUS on or off? */
-		if (value & OTG_B_SESS_VLD)
+		if (value & INT_SESS_VLD)
 			udc->vbus = 1;
 		else
 			udc->vbus = 0;