Re: IMX23 usb instability on 3.9-rc5

2013-04-07 Thread Alexandre Pereira da Silva
On Sat, Apr 6, 2013 at 4:44 PM, Fabio Estevam  wrote:
> Maybe bad DDR initialization? Are using U-boot or bootlets to setup the DDR?
>
> What is your DDR frequency: 133 or 96MHz? I saw some posts in the
> olimex forum that people had to run it at 96MHz to get stable
> operation.

Thanks Fabio,

That seems to be the case. I did two of the mods sugested on olimex forums.
1) Remove R17.
2) Drop DDR speed to 96MHZ.

The first improved the behavior a lot, but still have crashes. The
second have almost eliminated them.

On Sat, Apr 6, 2013 at 4:44 PM, Fabio Estevam  wrote:
> Alexandre,
>
> On Sat, Apr 6, 2013 at 4:39 PM, Alexandre Pereira da Silva
>  wrote:
>> Hello,
>>
>> I am testing a usb key connected on a IMX23-Olinuxino board. The
>> kernel panics at heavy usb trafic. This was build with the mxs
>> defconfig
>>
>> This happens everytime with "dd if=/dev/sda of=/dev/null bs=4k". The
>> messages of the failure varies a lot from run to run.
>
> Maybe bad DDR initialization? Are using U-boot or bootlets to setup the DDR?
>
> What is your DDR frequency: 133 or 96MHz? I saw some posts in the
> olimex forum that people had to run it at 96MHz to get stable
> operation.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


IMX23 usb instability on 3.9-rc5

2013-04-06 Thread Alexandre Pereira da Silva
Hello,

I am testing a usb key connected on a IMX23-Olinuxino board. The
kernel panics at heavy usb trafic. This was build with the mxs
defconfig

This happens everytime with "dd if=/dev/sda of=/dev/null bs=4k". The
messages of the failure varies a lot from run to run.

I tested also on kernel version 3.7.10 and the results are the same.

Please let me know if you need any more details.

Here its the panic messages:
# dd if=/dev/sda of=/dev/null bs=4k
[   83.49] Unable to handle kernel paging request at virtual
address be7a170c
[   83.49] pgd = c2b54000
[   83.49] [be7a170c] *pgd=
[   83.49] Internal error: Oops: 8005 [#1] ARM
[   83.49] Modules linked in:
[   83.49] CPU: 0Not tainted  (3.9.0-rc5-9-ge04a3b9 #4)
[   83.49] PC is at 0xbe7a170c
[   83.49] LR is at new_slab+0x274/0x2c4
[   83.49] pc : []lr : []psr: 6093
[   83.49] sp : c2bc9c68  ip : c3345000  fp : 0020
[   83.49] r10:   r9 : 6013  r8 : c111f880
[   83.49] r7 : c3345000  r6 : c3344fc0  r5 : c3344000  r4 : c3401b80
[   83.49] r3 :   r2 : 0040  r1 : c3344fc0  r0 : c3401b80
[   83.49] Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM
Segment user
[   83.49] Control: 0005317f  Table: 42b54000  DAC: 0015
[   83.49] Process dd (pid: 112, stack limit = 0xc2bc81b8)
[   83.49] Stack: (0xc2bc9c68 to 0xc2bca000)
[   83.49] 9c60:   c113f300  c3401b80
c34005c0 8050 c0401cec
[   83.49] 9c80: 0001 c29b4588  c00e8064 c29b4588
c2bced80 0001 00400040
[   83.49] 9ca0:  c0221334 c29b4588 c2bced80 c0221268
 c3401b80 8050
[   83.49] 9cc0: c00e8064 c10dd220 000ec6ff  0020
c00ba998 c3401b80 8050
[   83.49] 9ce0: 0001   1000 0001
c10dd220  c00e8064
[   83.49] 9d00:  c00e8a34 0001 c10dd220 
0020 c10dd220 0001
[   83.49] 9d20:  c00e8ad8 c10dd220 c10dd220 0020
c00e8c28 c3005104 c00eb51c
[   83.49] 9d40: c3343fc0 c3005114 c00889d0 c3005114 1d40
c3004ff0 000ec6ff 
[   83.49] 9d60: c3005108 c00ee1ec c3005114 c3005104 c3005114
c3005104 c3005114 c0406cc0
[   83.49] 9d80: c10dd220 c0088a4c 6013 c3005104 0004
0020 c10dd220 0001
[   83.49] 9da0: 000ec6ff  0020 c0091754 0001
 c00915f4 c00569fc
[   83.49] 9dc0: 0001 c2a6d1c0  91827364 c2a6dee0
c2a6dee0 c2bc9dd8 c2bc9dd8
[   83.49] 9de0: c10dc994 c10dd254 1d1c c10dc1a0 1d1c
c3005104  c2a6d1c0
[   83.49] 9e00: 1d1b 01d1c000  c0091a28 0020
c3005104 c2a6d1c0 c0089d1c
[   83.49] 9e20: 1d1c 0001 c2952000 c2935400 01d1c000
 1000 
[   83.49] 9e40: c2bc9f40 000cc081   
c2a6d248 01d1b000 
[   83.49] 9e60: 01d1c000  c2bc9ef8 c3004ff0 1d1d
0001 0002 
[   83.49] 9e80: 1000 01421008   
c2a6d1c0 1000 c2bc9f80
[   83.49] 9ea0: c2b05d80 01d1c000   01421008
c00bf214 01d1c000 
[   83.49] 9ec0:    0001 
c2a6d1c0  
[   83.49] 9ee0:   c2b05d80  
 01d1c000 
[   83.49] 9f00:   1000  1000
  
[   83.49] 9f20:     
  
[   83.49] 9f40: 01421008 1000 c2a6d1c0 1000 c2a6d1c0
01421008 c2bc9f80 c00bf934
[   83.49] 9f60: c2a6d1c0 01421008 c2a6d1c0  01421008
1000 01d1c000 c00bfbb4
[   83.49] 9f80: 01d1c000  1000 000ac968 
01421008 0003 c000e268
[   83.49] 9fa0: c2bc8000 c000e0c0 000ac968  
01421008 1000 
[   83.49] 9fc0: 000ac968  01421008 0003 1000
01421008 1000 01421008
[   83.49] 9fe0: 1000 bed23ac8 e0dc b6f7e97c 6010
  
[   83.49] [] (new_slab+0x274/0x2c4) from []
(__slab_alloc.constprop.44+0x394/0x504)
[   83.49] [] (__slab_alloc.constprop.44+0x394/0x504)
from [] (kmem_cache_alloc+0x54/0x154)
[   83.49] [] (kmem_cache_alloc+0x54/0x154) from
[] (alloc_buffer_head+0x14/0x4c)
[   83.49] [] (alloc_buffer_head+0x14/0x4c) from
[] (alloc_page_buffers+0x1c/0xac)
[   83.49] [] (alloc_page_buffers+0x1c/0xac) from
[] (create_empty_buffers+0x14/0x130)
[   83.49] [] (create_empty_buffers+0x14/0x130) from
[] (create_page_buffers+0x34/0x4c)
[   83.49] [] (create_page_buffers+0x34/0x4c) from
[] (block_read_full_page+0x28/0x348)
[   83.49] [] (block_read_full_page+0x28/0x348) from
[] (__do_page_cache_readahead+0x1c0/0x218)
[   83.49] [] (__do_page_cache_readahead+0x1c0/0x218)
from [] (ra_submit+0x20/0x24)
[   83.49] [] (ra_submit+0x20/0x24) from []
(generic_file

[PATCH RESEND] usb: gadget: lpc32xx_udc: Fix compatibility with STOTG04

2012-10-15 Thread 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.

Signed-off-by: Alexandre Pereira da Silva 
---

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(-)

diff --git a/drivers/usb/gadget/lpc32xx_udc.c 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);
 
/* VBUS on or off? */
-   if (value & OTG_B_SESS_VLD)
+   if (value & INT_SESS_VLD)
udc->vbus = 1;
else
udc->vbus = 0;
-- 
1.7.10

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2012-10-15 Thread Alexandre Pereira da Silva
This message is an debugging message. It's useful for finding protocol
details but it's not necessarily an error.

Signed-off-by: Alexandre Pereira da Silva 
---
 drivers/usb/gadget/lpc32xx_udc.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/lpc32xx_udc.c b/drivers/usb/gadget/lpc32xx_udc.c
index 21a9861..d1cf1f4 100644
--- a/drivers/usb/gadget/lpc32xx_udc.c
+++ b/drivers/usb/gadget/lpc32xx_udc.c
@@ -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;
-- 
1.7.10

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] usb: gadget: lpc32xx_udc: Disable setup request error message

2012-09-12 Thread Alexandre Pereira da Silva
This message is an debugging message. It's useful for finding protocol
details but it's not necessarily an error.

Signed-off-by: Alexandre Pereira da Silva 
---
 drivers/usb/gadget/lpc32xx_udc.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/lpc32xx_udc.c b/drivers/usb/gadget/lpc32xx_udc.c
index 21a9861..d1cf1f4 100644
--- a/drivers/usb/gadget/lpc32xx_udc.c
+++ b/drivers/usb/gadget/lpc32xx_udc.c
@@ -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;
-- 
1.7.10

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] usb: gadget: lpc32xx_udc: Fix compatibility with STOTG04

2012-09-12 Thread 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.

Signed-off-by: Alexandre Pereira da Silva 
---
 drivers/usb/gadget/lpc32xx_udc.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/lpc32xx_udc.c 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);
 
/* VBUS on or off? */
-   if (value & OTG_B_SESS_VLD)
+   if (value & INT_SESS_VLD)
udc->vbus = 1;
else
udc->vbus = 0;
-- 
1.7.10

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] usb: gadget: composite: parse dt values

2012-08-09 Thread Alexandre Pereira da Silva
On Thu, Aug 9, 2012 at 8:49 AM, Felipe Balbi  wrote:
> Hi,
>
> On Thu, Aug 09, 2012 at 01:42:42PM +0200, Sebastian Andrzej Siewior wrote:
>> On Tue, Jul 24, 2012 at 10:15:20AM -0300, Alexandre Pereira da Silva wrote:
>> > --- /dev/null
>> > +++ b/Documentation/devicetree/bindings/usb/gadget.txt
>> > @@ -0,0 +1,20 @@
>> > +Usb Gadget DeviceTree bindings
>> > +
>> > +These optional properties inside the usb device controller node are used 
>> > to
>> > +change some of the gadget drivers configuration:
>> > +- vendor-id: Usb vendor id
>> > +- product-id: Usb product id
>> > +- release: Version of this device
>> > +- vendor: Textual description of the vendor
>> > +- device: Textual description of this device
>> > +- serial: Textual representation of the device's serial number
>> > +
>> > +Binding Example:
>> > +   usbd@3102 {
>> > +   vendor-id = <0x0525>;
>> > +   product-id = <0xa4a6>;
>> > +   release = <1>;
>> > +   vendor = "Some Corp";
>> > +   device = "Test Device";
>> > +   serial = "12345";
>
> on top of everything Sebastian said, I think we should stick to the
> field names set forth on the USB specification meaning that instead of
> vendor-id we should use idVendor, instead of vendor we should use
> iManufacturer, and so on.

Thanks for the feedback.

I agree that this should look more like the usb specifications and
allow mapping between usb interfaces and gadget drivers.

I will rework this to provide a new patch that at least don't conflict
with this idea.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] usb: gadget: composite: parse dt values

2012-07-24 Thread Alexandre Pereira da Silva
Grab the devicetree node properties to set VendorId, ProductId,
bcdDevice, Manucacturer, Product and SerialNumber

Signed-off-by: Alexandre Pereira da Silva 
Acked-by: Michal Nazarewicz 
Acked-by: Rob Herring 
---
Applies to v3.5

Changes since V1:
* Minor patch description and code comments updates

 Documentation/devicetree/bindings/usb/gadget.txt |   20 +++
 drivers/usb/gadget/composite.c   |   39 ++
 2 files changed, 59 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/gadget.txt

diff --git a/Documentation/devicetree/bindings/usb/gadget.txt 
b/Documentation/devicetree/bindings/usb/gadget.txt
new file mode 100644
index 000..93388d3
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/gadget.txt
@@ -0,0 +1,20 @@
+Usb Gadget DeviceTree bindings
+
+These optional properties inside the usb device controller node are used to
+change some of the gadget drivers configuration:
+- vendor-id: Usb vendor id
+- product-id: Usb product id
+- release: Version of this device
+- vendor: Textual description of the vendor
+- device: Textual description of this device
+- serial: Textual representation of the device's serial number
+
+Binding Example:
+   usbd@3102 {
+   vendor-id = <0x0525>;
+   product-id = <0xa4a6>;
+   release = <1>;
+   vendor = "Some Corp";
+   device = "Test Device";
+   serial = "12345";
+   };
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 390749b..a02be8c 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1419,10 +1420,44 @@ static u8 override_id(struct usb_composite_dev *cdev, 
u8 *desc)
return *desc;
 }
 
+static void composite_parse_dt(struct usb_composite_dev *cdev,
+   struct device_node *np)
+{
+   u32 reg;
+
+   if (!idVendor && of_property_read_u32(np, "vendor-id", ®) == 0)
+   idVendor = reg;
+
+   if (!idProduct && of_property_read_u32(np, "product-id", ®) == 0)
+   idProduct = reg;
+
+   if (!bcdDevice && of_property_read_u32(np, "release", ®) == 0)
+   bcdDevice = reg;
+
+   if (!iManufacturer)
+   if (of_property_read_string(np, "vendor",
+   &composite->iManufacturer) == 0)
+   cdev->manufacturer_override = override_id(cdev,
+   &cdev->desc.iManufacturer);
+
+   if (!iProduct)
+   if (of_property_read_string(np, "device",
+   &composite->iProduct) == 0)
+   cdev->product_override = override_id(cdev,
+   &cdev->desc.iProduct);
+
+   if (!iSerialNumber)
+   if (of_property_read_string(np, "serial",
+   &composite->iSerialNumber) == 0)
+   cdev->serial_override = override_id(cdev,
+   &cdev->desc.iSerialNumber);
+}
+
 static int composite_bind(struct usb_gadget *gadget)
 {
struct usb_composite_dev*cdev;
int status = -ENOMEM;
+   struct device_node  *np = gadget->dev.of_node;
 
cdev = kzalloc(sizeof *cdev, GFP_KERNEL);
if (!cdev)
@@ -1470,6 +1505,10 @@ static int composite_bind(struct usb_gadget *gadget)
 
cdev->desc = *composite->dev;
 
+   /* grab values from devicetree */
+   if (np)
+   composite_parse_dt(cdev, np);
+
/* standardized runtime overrides for device ID data */
if (idVendor)
cdev->desc.idVendor = cpu_to_le16(idVendor);
-- 
1.7.10

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RESEND] usb: gadget: composite: parse dt values

2012-07-09 Thread Alexandre Pereira da Silva
Grab the devicetree node properties to override VendorId, ProductId,
bcdDevice, Manucacturer, Product and SerialNumber

Signed-off-by: Alexandre Pereira da Silva 
Acked-by: Michal Nazarewicz 
Acked-by: Rob Herring 
---
 Documentation/devicetree/bindings/usb/gadget.txt |   20 +++
 drivers/usb/gadget/composite.c   |   39 ++
 2 files changed, 59 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/gadget.txt

diff --git a/Documentation/devicetree/bindings/usb/gadget.txt 
b/Documentation/devicetree/bindings/usb/gadget.txt
new file mode 100644
index 000..93388d3
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/gadget.txt
@@ -0,0 +1,20 @@
+Usb Gadget DeviceTree bindings
+
+These optional properties inside the usb device controller node are used to
+change some of the gadget drivers configuration:
+- vendor-id: Usb vendor id
+- product-id: Usb product id
+- release: Version of this device
+- vendor: Textual description of the vendor
+- device: Textual description of this device
+- serial: Textual representation of the device's serial number
+
+Binding Example:
+   usbd@3102 {
+   vendor-id = <0x0525>;
+   product-id = <0xa4a6>;
+   release = <1>;
+   vendor = "Some Corp";
+   device = "Test Device";
+   serial = "12345";
+   };
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 390749b..a02be8c 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1419,10 +1420,44 @@ static u8 override_id(struct usb_composite_dev *cdev, 
u8 *desc)
return *desc;
 }
 
+static void composite_parse_dt(struct usb_composite_dev *cdev,
+   struct device_node *np)
+{
+   u32 reg;
+
+   if (!idVendor && of_property_read_u32(np, "vendor-id", ®) == 0)
+   idVendor = reg;
+
+   if (!idProduct && of_property_read_u32(np, "product-id", ®) == 0)
+   idProduct = reg;
+
+   if (!bcdDevice && of_property_read_u32(np, "release", ®) == 0)
+   bcdDevice = reg;
+
+   if (!iManufacturer)
+   if (of_property_read_string(np, "vendor",
+   &composite->iManufacturer) == 0)
+   cdev->manufacturer_override = override_id(cdev,
+   &cdev->desc.iManufacturer);
+
+   if (!iProduct)
+   if (of_property_read_string(np, "device",
+   &composite->iProduct) == 0)
+   cdev->product_override = override_id(cdev,
+   &cdev->desc.iProduct);
+
+   if (!iSerialNumber)
+   if (of_property_read_string(np, "serial",
+   &composite->iSerialNumber) == 0)
+   cdev->serial_override = override_id(cdev,
+   &cdev->desc.iSerialNumber);
+}
+
 static int composite_bind(struct usb_gadget *gadget)
 {
struct usb_composite_dev*cdev;
int status = -ENOMEM;
+   struct device_node  *np = gadget->dev.of_node;
 
cdev = kzalloc(sizeof *cdev, GFP_KERNEL);
if (!cdev)
@@ -1470,6 +1505,10 @@ static int composite_bind(struct usb_gadget *gadget)
 
cdev->desc = *composite->dev;
 
+   /* grab overrides from devicetree */
+   if (np)
+   composite_parse_dt(cdev, np);
+
/* standardized runtime overrides for device ID data */
if (idVendor)
cdev->desc.idVendor = cpu_to_le16(idVendor);
-- 
1.7.10

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html