Skip to contentSkip to conversation

Axi-usb: Add support for 64-bit addressing.

PATCH Superseded Nava kishore Manne 4 participants 12 messages May 30, 2016 – Sep 1, 2016

Subsystems (3)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 Axi-usb: Add support for 64-bit addressing.

This patch updates the driver to support 64-bit DMA addressing.

---
Changes for v4:
-Used boolen property insted of addrwith property in the DT
as suggested by Arnd Bergmann.
-Adopt the DT relevant changes into the driver.

Changes for v3:
-Added new compatable string for 5.00 IP version as suggested by
Arnd Bergmann.
-Used write_fn() insted of lo_hi_writeq() as suggested by
Arnd Bergmann.

Changes for v2:
-Added dma-ranges property in device tree as suggested by Arnd Bergmann. -Modified the driver code based on the xlnx,addrwidth.

 .../devicetree/bindings/usb/udc-xilinx.txt         |  5 ++-
 drivers/usb/gadget/udc/udc-xilinx.c                | 52 +++++++++++++++++++++-
 2 files changed, 54 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/usb/udc-xilinx.txt +4 -1
index 47b4e39..d08d972 100644
@@ -1,12 +1,14 @@
 Xilinx USB2 device controller
 
 Required properties:
-- compatible		: Should be "xlnx,usb2-device-4.00.a"
+- compatible		: Should be "xlnx,usb2-device-4.00.a" or
+			  "xlnx,usb2-device-5.00"
 - reg			: Physical base address and size of the USB2
 			  device registers map.
 - interrupts		: Should contain single irq line of USB2 device
 			  controller
 - xlnx,has-builtin-dma	: if DMA is included
+- xlnx,has-64bit-dma	: if DMA is included 64-bit addressing support.
 
 Example:
  		axi-usb2-device at 42e00000 {
@@ -14,5 +16,6 @@ Example:
                         interrupts = <0x0 0x39 0x1>;
                         reg = <0x42e00000 0x10000>;
                         xlnx,has-builtin-dma;
+			xlnx,has-64bit-dma;
                 };
 
drivers/usb/gadget/udc/udc-xilinx.c +50 -2

94 lines not on this page · raw message

Signature · 1 line
2.1.1
#1 lore raw
Quoted 91 lines · Nava kishore Manne

This patch updates the driver to support 64-bit DMA addressing.

---
Changes for v4:
-Used boolen property insted of addrwith property in the DT
as suggested by Arnd Bergmann.
-Adopt the DT relevant changes into the driver.

Changes for v3:
-Added new compatable string for 5.00 IP version as suggested by
Arnd Bergmann.
-Used write_fn() insted of lo_hi_writeq() as suggested by
Arnd Bergmann.

Changes for v2:
-Added dma-ranges property in device tree as suggested by Arnd Bergmann. -Modified the driver code based on the xlnx,addrwidth.

 .../devicetree/bindings/usb/udc-xilinx.txt         |  5 ++-
 drivers/usb/gadget/udc/udc-xilinx.c                | 52 +++++++++++++++++++++-
 2 files changed, 54 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/usb/udc-xilinx.txt +4 -1
index 47b4e39..d08d972 100644
@@ -1,12 +1,14 @@
 Xilinx USB2 device controller
 
 Required properties:
-- compatible           : Should be "xlnx,usb2-device-4.00.a"
+- compatible           : Should be "xlnx,usb2-device-4.00.a" or
+                         "xlnx,usb2-device-5.00"
 - reg                  : Physical base address and size of the USB2
                          device registers map.
 - interrupts           : Should contain single irq line of USB2 device
                          controller
 - xlnx,has-builtin-dma : if DMA is included
+- xlnx,has-64bit-dma   : if DMA is included 64-bit addressing support.
 
 Example:
                axi-usb2-device at 42e00000 {
@@ -14,5 +16,6 @@ Example:
                         interrupts = <0x0 0x39 0x1>;
                         reg = <0x42e00000 0x10000>;
                         xlnx,has-builtin-dma;
+                       xlnx,has-64bit-dma;
                 };
 
drivers/usb/gadget/udc/udc-xilinx.c +12 -0
index 1cbb0ac..6fb80c6 100644
@@ -47,6 +47,15 @@
 #define XUSB_DMA_LENGTH_OFFSET         0x0210  /* DMA Length Register */
 #define XUSB_DMA_STATUS_OFFSET         0x0214  /* DMA Status Register */
 
+/* DMA source Address Reg for LSB */
+#define XUSB_DMA_DSAR_ADDR_OFFSET_LSB   0x0308
+/* DMA source Address Reg for MSB */
+#define XUSB_DMA_DSAR_ADDR_OFFSET_MSB   0x030C
+/* DMA destination Addr Reg LSB */
+#define XUSB_DMA_DDAR_ADDR_OFFSET_LSB   0x0310
+/* DMA destination Addr Reg MSB */
+#define XUSB_DMA_DDAR_ADDR_OFFSET_MSB   0x0314
+
 /* Endpoint Configuration Space offsets */
 #define XUSB_EP_CFGSTATUS_OFFSET       0x00    /* Endpoint Config Status  */
 #define XUSB_EP_BUF0COUNT_OFFSET       0x08    /* Buffer 0 Count */
@@ -169,6 +178,7 @@ struct xusb_ep {
  * @setup: usb_ctrlrequest structure for control requests
  * @req: pointer to dummy request for get status command
  * @dev: pointer to device structure in gadget
+ * @is_extend_dma: flag indiacting whether the dma is 64-bit support or not.
  * @usb_state: device in suspended state or not
  * @remote_wkp: remote wakeup enabled by host
  * @setupseqtx: tx status
@@ -186,6 +196,7 @@ struct xusb_udc {
        struct usb_ctrlrequest setup;
        struct xusb_req *req;
        struct device *dev;
+       bool is_extend_dma;
        u32 usb_state;
        u32 remote_wkp;
        u32 setupseqtx;
@@ -215,6 +226,20 @@ static const struct usb_endpoint_descriptor config_bulk_out_desc = {
 };
 
 /**
+ * xudc_write64 - write 64bit value to device registers

drivers/usb/gadget/udc/udc-xilinx.c static const struct usb_endpoint_descriptor config_bulk_out_desc = { · line 239

Quoted 10 lines
drivers/usb/gadget/udc/udc-xilinx.c +10 -0
+ * @ep: pointer to the usb device endpoint structure.
+ * @offset: register offset
+ * @val: data to be written
+ **/
+static void xudc_write64(struct xusb_ep *ep, u32 offset, u64 val)
+{
+       struct xusb_udc *udc = ep->udc;
+
+       udc->write_fn(udc->addr, offset, lower_32_bits(val));
+       udc->write_fn(udc->addr, offset+0x04, upper_32_bits(val));

can we move this to a single 64 bit write?

Quoted 3 lines
drivers/usb/gadget/udc/udc-xilinx.c +3 -0
+}
+
+/**
#2 lore raw

Hi Shubhrajyoti,

Thanks for the review...

Quoted 5 lines
Quoted 5 lines

/**
+ * xudc_write64 - write 64bit value to device registers
+ * @ep: pointer to the usb device endpoint structure.
+ * @offset: register offset
+ * @val: data to be written

Quoted 8 lines

drivers/usb/gadget/udc/udc-xilinx.c static const struct usb_endpoint_descriptor config_bulk_out_desc = { · line 239

Quoted 6 lines

+ **/

drivers/usb/gadget/udc/udc-xilinx.c +5 -0
+static void xudc_write64(struct xusb_ep *ep, u32 offset, u64 val) {
+       struct xusb_udc *udc = ep->udc;
+
+       udc->write_fn(udc->addr, offset, lower_32_bits(val));
+       udc->write_fn(udc->addr, offset+0x04, upper_32_bits(val));

can we move this to a single 64 bit write?

Initially I sent the patches with writeq() ,lo_hi_writeq() later we decided to replace with write_fun().
The reason for this is lo_hi_writeq() always assumes a little-endian register, so it's broken if anyone builds this device with big-endian registers. So replaced the 64bit calls with write_fun() as suggested by Arnd Bergmann. Hope it clears your query.
Please refer to the below thread

	http://lkml.iu.edu/hypermail/linux/kernel/1604.2/02046.html 

Regards,
Navakishore.

maintainer Acked-by on v4 1/1
#4 lore raw
In reply to Nava kishore Manne
Quoted 15 lines · Nava kishore Manne

This patch updates the driver to support 64-bit DMA addressing.

---
Changes for v4:
-Used boolen property insted of addrwith property in the DT
as suggested by Arnd Bergmann.
-Adopt the DT relevant changes into the driver.

Changes for v3:
-Added new compatable string for 5.00 IP version as suggested by
Arnd Bergmann.
-Used write_fn() insted of lo_hi_writeq() as suggested by
Arnd Bergmann.

Quoted 5 lines

Changes for v2:
-Added dma-ranges property in device tree as suggested by Arnd Bergmann. -Modified the driver code based on the xlnx,addrwidth.

 .../devicetree/bindings/usb/udc-xilinx.txt         |  5 ++-
Quoted 2 lines
 drivers/usb/gadget/udc/udc-xilinx.c                | 52 +++++++++++++++++++++-
 2 files changed, 54 insertions(+), 3 deletions(-)
#3 lore raw
In reply to Nava kishore Manne
Quoted 19 lines · Nava kishore Manne

Hi Shubhrajyoti,

Thanks for the review...

Quoted 5 lines
Quoted 5 lines

/**
+ * xudc_write64 - write 64bit value to device registers
+ * @ep: pointer to the usb device endpoint structure.
+ * @offset: register offset
+ * @val: data to be written

Quoted 8 lines

drivers/usb/gadget/udc/udc-xilinx.c static const struct usb_endpoint_descriptor config_bulk_out_desc = { · line 239

Quoted 6 lines

+ **/

drivers/usb/gadget/udc/udc-xilinx.c +5 -0
+static void xudc_write64(struct xusb_ep *ep, u32 offset, u64 val) {
+       struct xusb_udc *udc = ep->udc;
+
+       udc->write_fn(udc->addr, offset, lower_32_bits(val));
+       udc->write_fn(udc->addr, offset+0x04, upper_32_bits(val));

can we move this to a single 64 bit write?

Quoted 6 lines

Initially I sent the patches with writeq() ,lo_hi_writeq() later we decided to replace with write_fun().
The reason for this is lo_hi_writeq() always assumes a little-endian register, so it's broken if anyone builds this device with big-endian registers. So replaced the 64bit calls with write_fun() as suggested by Arnd Bergmann. Hope it clears your query.
Please refer to the below thread

        http://lkml.iu.edu/hypermail/linux/kernel/1604.2/02046.html

missed that discurssion.

thanks

Quoted 5 lines

Regards,
Navakishore.

#5 lore raw
In reply to Rob Herring

Ping!!

Quoted 41 lines

-----Original Message-----
From: Rob Herring [mailto:robh at kernel.org]
Sent: Friday, June 03, 2016 4:28 AM
To: Nava kishore Manne <[email protected]>
Cc: pawel.moll at arm.com; mark.rutland at arm.com; ijc+devicetree at hellion.org.uk; galak at codeaurora.org; Michal Simek <[email protected]>; Soren Brinkmann <[email protected]>; balbi at ti.com; gregkh at linuxfoundation.org; Hyun Kwon <[email protected]>; Nava kishore Manne <[email protected]>; Radhey Shyam Pandey <[email protected]>; devicetree at vger.kernel.org; linux- arm-kernel at lists.infradead.org; linux-kernel at vger.kernel.org
Subject: Re: [PATCH v4] Axi-usb: Add support for 64-bit addressing.

Quoted 9 lines · Nava kishore Manne

This patch updates the driver to support 64-bit DMA addressing.

---
Changes for v4:
-Used boolen property insted of addrwith property in the DT
as suggested by Arnd Bergmann.
-Adopt the DT relevant changes into the driver.

Quoted 8 lines

Changes for v3:
-Added new compatable string for 5.00 IP version as suggested by
Arnd Bergmann.
-Used write_fn() insted of lo_hi_writeq() as suggested by
Arnd Bergmann.

Changes for v2:
-Added dma-ranges property in device tree as suggested by Arnd

Bergmann.

Quoted 3 lines

-Modified the driver code based on the xlnx,addrwidth.

 .../devicetree/bindings/usb/udc-xilinx.txt         |  5 ++-
Quoted 1 line
 drivers/usb/gadget/udc/udc-xilinx.c                | 52

+++++++++++++++++++++-

Quoted 1 line
 2 files changed, 54 insertions(+), 3 deletions(-)
#6 lore raw
In reply to Rob Herring

Ping!!

Quoted 13 lines

-----Original Message-----
From: Nava kishore Manne
Sent: Monday, June 27, 2016 6:18 PM
To: 'Rob Herring' <[email protected]>
Cc: pawel.moll at arm.com; mark.rutland at arm.com; ijc+devicetree at hellion.org.uk; galak at codeaurora.org; Michal Simek <[email protected]>; Soren Brinkmann <[email protected]>;
balbi at ti.com; gregkh at linuxfoundation.org; Hyun Kwon <[email protected]>; Radhey Shyam Pandey <[email protected]>; devicetree at vger.kernel.org; linux-arm-kernel at lists.infradead.org; linux- kernel at vger.kernel.org
Subject: RE: [PATCH v4] Axi-usb: Add support for 64-bit addressing.

Quoted 44 lines

Ping!!

Quoted 42 lines

-----Original Message-----
From: Rob Herring [mailto:robh at kernel.org]
Sent: Friday, June 03, 2016 4:28 AM
To: Nava kishore Manne <[email protected]>
Cc: pawel.moll at arm.com; mark.rutland at arm.com; ijc+devicetree at hellion.org.uk; galak at codeaurora.org; Michal Simek <[email protected]>; Soren Brinkmann <[email protected]>; balbi at ti.com; gregkh at linuxfoundation.org; Hyun Kwon <[email protected]>; Nava kishore Manne <[email protected]>; Radhey Shyam Pandey <[email protected]>; devicetree at vger.kernel.org; linux- arm-kernel at lists.infradead.org; linux-kernel at vger.kernel.org
Subject: Re: [PATCH v4] Axi-usb: Add support for 64-bit addressing.

Quoted 15 lines · Nava kishore Manne

This patch updates the driver to support 64-bit DMA addressing.

---
Changes for v4:
-Used boolen property insted of addrwith property in the DT
as suggested by Arnd Bergmann.
-Adopt the DT relevant changes into the driver.

Changes for v3:
-Added new compatable string for 5.00 IP version as suggested by
Arnd Bergmann.
-Used write_fn() insted of lo_hi_writeq() as suggested by
Arnd Bergmann.

Quoted 3 lines

Changes for v2:
-Added dma-ranges property in device tree as
suggested by Arnd

Bergmann.

Quoted 3 lines

-Modified the driver code based on the xlnx,addrwidth.

 .../devicetree/bindings/usb/udc-xilinx.txt         |  5 ++-
Quoted 1 line
 drivers/usb/gadget/udc/udc-xilinx.c                | 52

+++++++++++++++++++++-

Quoted 1 line
 2 files changed, 54 insertions(+), 3 deletions(-)

This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

#7 lore raw
Quoted 1 line · Nava kishore Manne

Ping!!

<snip>

Quoted 2 lines

This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

You do realize that with an email footer like this, you prevent any of us from responding to you, sorry. I shouldn't even be writing this...

greg k-h

#8 lore raw

Hi Greg,

Quoted 5 lines
Quoted 1 line

Ping!!

<snip>

Quoted 1 line
Quoted 8 lines
Quoted 1 line

This email and any attachments are intended for the sole use of the named

recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

You do realize that with an email footer like this, you prevent any of us from responding to you, sorry. I shouldn't even be writing this...

Sorry something fishy happened with my email-client
I have fixed it now next time onwards will take care before giving replies...

Regards,
Navakishore.

Quoted 4 lines

greg k-h

#9 lore raw
In reply to [email protected]

Ping!!

Quoted 40 lines

-----Original Message-----
From: Nava kishore Manne
Sent: Wednesday, July 13, 2016 1:00 PM
To: 'gregkh at linuxfoundation.org' <[email protected]>
Cc: Rob Herring <[email protected]>; pawel.moll at arm.com; mark.rutland at arm.com; ijc+devicetree at hellion.org.uk;
galak at codeaurora.org; Michal Simek <[email protected]>; Soren Brinkmann <[email protected]>; balbi at ti.com; Hyun Kwon <[email protected]>; Radhey Shyam Pandey <[email protected]>; devicetree at vger.kernel.org; linux-arm-kernel at lists.infradead.org; linux- kernel at vger.kernel.org
Subject: RE: [PATCH v4] Axi-usb: Add support for 64-bit addressing.

Hi Greg,

Quoted 11 lines
Quoted 1 line

Ping!!

<snip>

Quoted 3 lines

This email and any attachments are intended for the sole use of the named

recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any

attachments immediately.

Quoted 3 lines

You do realize that with an email footer like this, you prevent any of us from responding to you, sorry. I shouldn't even be writing this...

Sorry something fishy happened with my email-client I have fixed it now next time onwards will take care before giving replies...

Regards,
Navakishore.

Quoted 4 lines

greg k-h

#10 lore raw
In reply to [email protected]

Ping!!

Quoted 58 lines

-----Original Message-----
From: Nava kishore Manne
Sent: Monday, July 25, 2016 3:57 PM
To: 'gregkh at linuxfoundation.org' <[email protected]>
Cc: 'Rob Herring' <[email protected]>; 'pawel.moll at arm.com' <[email protected]>; 'mark.rutland at arm.com' <[email protected]>; 'ijc+devicetree at hellion.org.uk' <[email protected]>; 'galak at codeaurora.org' <[email protected]>; Michal Simek <[email protected]>; Soren Brinkmann <[email protected]>; 'balbi at ti.com' <[email protected]>; Hyun Kwon <[email protected]>; Radhey Shyam Pandey <[email protected]>; 'devicetree at vger.kernel.org' <[email protected]>; 'linux-arm- kernel at lists.infradead.org' <[email protected]>; 'linux- kernel at vger.kernel.org' <[email protected]>
Subject: RE: [PATCH v4] Axi-usb: Add support for 64-bit addressing.

Ping!!

Quoted 40 lines

-----Original Message-----
From: Nava kishore Manne
Sent: Wednesday, July 13, 2016 1:00 PM
To: 'gregkh at linuxfoundation.org' <[email protected]>
Cc: Rob Herring <[email protected]>; pawel.moll at arm.com; mark.rutland at arm.com; ijc+devicetree at hellion.org.uk; galak at codeaurora.org; Michal Simek <[email protected]>; Soren Brinkmann <[email protected]>; balbi at ti.com; Hyun Kwon <[email protected]>; Radhey Shyam Pandey <[email protected]>; devicetree at vger.kernel.org; linux-arm-kernel at lists.infradead.org; linux- kernel at vger.kernel.org
Subject: RE: [PATCH v4] Axi-usb: Add support for 64-bit addressing.

Hi Greg,

Quoted 11 lines
Quoted 1 line

Ping!!

<snip>

Quoted 3 lines

This email and any attachments are intended for the sole use of the named

recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any

attachments immediately.

Quoted 3 lines

You do realize that with an email footer like this, you prevent any of us from responding to you, sorry. I shouldn't even be writing this...

Sorry something fishy happened with my email-client I have fixed it now next time onwards will take care before giving replies...

Regards,
Navakishore.

Quoted 4 lines

greg k-h

#11 lore raw
Quoted 1 line · Nava kishore Manne

Ping!!

ping what?

I don't see a patch here, and nothing is in my to-review queue about this.

Perhaps send it again?

confused,

greg k-h