From mboxrd@z Thu Jan 1 00:00:00 1970 From: nava.manne@xilinx.com (Nava kishore Manne) Date: Tue, 24 May 2016 10:51:08 +0530 Subject: [PATCH v3] Axi-usb: Add support for 64-bit addressing. Message-ID: <1464067268-35299-1-git-send-email-navam@xilinx.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org This patch updates the driver to support 64-bit DMA addressing. Signed-off-by: Nava kishore Manne --- 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 | 21 +++++---- drivers/usb/gadget/udc/udc-xilinx.c | 53 ++++++++++++++++++++-- 2 files changed, 63 insertions(+), 11 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/udc-xilinx.txt b/Documentation/devicetree/bindings/usb/udc-xilinx.txt index 47b4e39..09df757 100644 --- a/Documentation/devicetree/bindings/usb/udc-xilinx.txt +++ b/Documentation/devicetree/bindings/usb/udc-xilinx.txt @@ -1,18 +1,23 @@ 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 +- dma-ranges : Should be as the following + +- xlnx,addrwidth : Should be the dma addressing size in bits(ex: 64 bits) Example: - axi-usb2-device at 42e00000 { - compatible = "xlnx,usb2-device-4.00.a"; - interrupts = <0x0 0x39 0x1>; - reg = <0x42e00000 0x10000>; - xlnx,has-builtin-dma; - }; - + axi-usb2-device at 42e00000 { + compatible = "xlnx,usb2-device-4.00.a"; + interrupts = <0x0 0x39 0x1>; + reg = <0x42e00000 0x10000>; + dma-ranges = <0x00000000 0x00000000 0x40000000>; + xlnx,has-builtin-dma; + xlnx,addrwidth = <0x40>; + }; diff --git a/drivers/usb/gadget/udc/udc-xilinx.c b/drivers/usb/gadget/udc/udc-xilinx.c index 1cbb0ac..112a6f3 100644 --- a/drivers/usb/gadget/udc/udc-xilinx.c +++ b/drivers/usb/gadget/udc/udc-xilinx.c @@ -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 */ @@ -193,7 +202,7 @@ struct xusb_udc { void __iomem *addr; spinlock_t lock; bool dma_enabled; - + u32 dma_addrwidth; unsigned int (*read_fn)(void __iomem *); void (*write_fn)(void __iomem *, u32, u32); }; @@ -214,6 +223,20 @@ static const struct usb_endpoint_descriptor config_bulk_out_desc = { .wMaxPacketSize = cpu_to_le16(EP0_MAX_PACKET), }; +/** + * xudc_write64 - write 64bit value to device registers + * @addr: base addr of device registers + * @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)); +} + /** * xudc_write32 - little endian write to device registers * @addr: base addr of device registers @@ -330,8 +353,13 @@ static int xudc_start_dma(struct xusb_ep *ep, dma_addr_t src, * destination registers and then set the length * into the DMA length register. */ - udc->write_fn(udc->addr, XUSB_DMA_DSAR_ADDR_OFFSET, src); - udc->write_fn(udc->addr, XUSB_DMA_DDAR_ADDR_OFFSET, dst); + if (udc->dma_addrwidth > 32) { + xudc_write64(ep, XUSB_DMA_DSAR_ADDR_OFFSET_LSB, src); + xudc_write64(ep, XUSB_DMA_DDAR_ADDR_OFFSET_LSB, dst); + } else { + udc->write_fn(udc->addr, XUSB_DMA_DSAR_ADDR_OFFSET, src); + udc->write_fn(udc->addr, XUSB_DMA_DDAR_ADDR_OFFSET, dst); + } udc->write_fn(udc->addr, XUSB_DMA_LENGTH_OFFSET, length); /* @@ -2097,6 +2125,24 @@ static int xudc_probe(struct platform_device *pdev) udc->dma_enabled = of_property_read_bool(np, "xlnx,has-builtin-dma"); + if (of_device_is_compatible(np, "xlnx,usb2-device-5.00")) { + ret = of_property_read_u32(np, "xlnx,addrwidth", + &udc->dma_addrwidth); + if (ret < 0) + dev_warn(&pdev->dev, + "missing xlnx,addrwidth property\n"); + } else { + udc->dma_addrwidth = 32; + } + + /* Set the dma mask bits */ + ret = dma_set_mask_and_coherent(&pdev->dev, + DMA_BIT_MASK(udc->dma_addrwidth)); + if (ret < 0) { + dev_dbg(&pdev->dev, "no usable DMA configuration"); + goto fail; + } + /* Setup gadget structure */ udc->gadget.ops = &xusb_udc_ops; udc->gadget.max_speed = USB_SPEED_HIGH; @@ -2168,6 +2214,7 @@ static int xudc_remove(struct platform_device *pdev) /* Match table for of_platform binding */ static const struct of_device_id usb_of_match[] = { { .compatible = "xlnx,usb2-device-4.00.a", }, + { .compatible = "xlnx,usb2-device-5.00", }, { /* end of list */ }, }; MODULE_DEVICE_TABLE(of, usb_of_match); -- 2.8.3.394.g3916adf From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nava kishore Manne Subject: [PATCH v3] Axi-usb: Add support for 64-bit addressing. Date: Tue, 24 May 2016 10:51:08 +0530 Message-ID: <1464067268-35299-1-git-send-email-navam@xilinx.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane.org@lists.infradead.org To: robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com, ijc+devicetree@hellion.org.uk, galak@codeaurora.org, michal.simek@xilinx.com, soren.brinkmann@xilinx.com, balbi@ti.com, gregkh@linuxfoundation.org, hyun.kwon@xilinx.com, navam@xilinx.com, radhey.shyam.pandey@xilinx.com Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org List-Id: devicetree@vger.kernel.org This patch updates the driver to support 64-bit DMA addressing. Signed-off-by: Nava kishore Manne --- 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 | 21 +++++---- drivers/usb/gadget/udc/udc-xilinx.c | 53 ++++++++++++++++++++-- 2 files changed, 63 insertions(+), 11 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/udc-xilinx.txt b/Documentation/devicetree/bindings/usb/udc-xilinx.txt index 47b4e39..09df757 100644 --- a/Documentation/devicetree/bindings/usb/udc-xilinx.txt +++ b/Documentation/devicetree/bindings/usb/udc-xilinx.txt @@ -1,18 +1,23 @@ 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 +- dma-ranges : Should be as the following + +- xlnx,addrwidth : Should be the dma addressing size in bits(ex: 64 bits) Example: - axi-usb2-device@42e00000 { - compatible = "xlnx,usb2-device-4.00.a"; - interrupts = <0x0 0x39 0x1>; - reg = <0x42e00000 0x10000>; - xlnx,has-builtin-dma; - }; - + axi-usb2-device@42e00000 { + compatible = "xlnx,usb2-device-4.00.a"; + interrupts = <0x0 0x39 0x1>; + reg = <0x42e00000 0x10000>; + dma-ranges = <0x00000000 0x00000000 0x40000000>; + xlnx,has-builtin-dma; + xlnx,addrwidth = <0x40>; + }; diff --git a/drivers/usb/gadget/udc/udc-xilinx.c b/drivers/usb/gadget/udc/udc-xilinx.c index 1cbb0ac..112a6f3 100644 --- a/drivers/usb/gadget/udc/udc-xilinx.c +++ b/drivers/usb/gadget/udc/udc-xilinx.c @@ -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 */ @@ -193,7 +202,7 @@ struct xusb_udc { void __iomem *addr; spinlock_t lock; bool dma_enabled; - + u32 dma_addrwidth; unsigned int (*read_fn)(void __iomem *); void (*write_fn)(void __iomem *, u32, u32); }; @@ -214,6 +223,20 @@ static const struct usb_endpoint_descriptor config_bulk_out_desc = { .wMaxPacketSize = cpu_to_le16(EP0_MAX_PACKET), }; +/** + * xudc_write64 - write 64bit value to device registers + * @addr: base addr of device registers + * @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)); +} + /** * xudc_write32 - little endian write to device registers * @addr: base addr of device registers @@ -330,8 +353,13 @@ static int xudc_start_dma(struct xusb_ep *ep, dma_addr_t src, * destination registers and then set the length * into the DMA length register. */ - udc->write_fn(udc->addr, XUSB_DMA_DSAR_ADDR_OFFSET, src); - udc->write_fn(udc->addr, XUSB_DMA_DDAR_ADDR_OFFSET, dst); + if (udc->dma_addrwidth > 32) { + xudc_write64(ep, XUSB_DMA_DSAR_ADDR_OFFSET_LSB, src); + xudc_write64(ep, XUSB_DMA_DDAR_ADDR_OFFSET_LSB, dst); + } else { + udc->write_fn(udc->addr, XUSB_DMA_DSAR_ADDR_OFFSET, src); + udc->write_fn(udc->addr, XUSB_DMA_DDAR_ADDR_OFFSET, dst); + } udc->write_fn(udc->addr, XUSB_DMA_LENGTH_OFFSET, length); /* @@ -2097,6 +2125,24 @@ static int xudc_probe(struct platform_device *pdev) udc->dma_enabled = of_property_read_bool(np, "xlnx,has-builtin-dma"); + if (of_device_is_compatible(np, "xlnx,usb2-device-5.00")) { + ret = of_property_read_u32(np, "xlnx,addrwidth", + &udc->dma_addrwidth); + if (ret < 0) + dev_warn(&pdev->dev, + "missing xlnx,addrwidth property\n"); + } else { + udc->dma_addrwidth = 32; + } + + /* Set the dma mask bits */ + ret = dma_set_mask_and_coherent(&pdev->dev, + DMA_BIT_MASK(udc->dma_addrwidth)); + if (ret < 0) { + dev_dbg(&pdev->dev, "no usable DMA configuration"); + goto fail; + } + /* Setup gadget structure */ udc->gadget.ops = &xusb_udc_ops; udc->gadget.max_speed = USB_SPEED_HIGH; @@ -2168,6 +2214,7 @@ static int xudc_remove(struct platform_device *pdev) /* Match table for of_platform binding */ static const struct of_device_id usb_of_match[] = { { .compatible = "xlnx,usb2-device-4.00.a", }, + { .compatible = "xlnx,usb2-device-5.00", }, { /* end of list */ }, }; MODULE_DEVICE_TABLE(of, usb_of_match); -- 2.8.3.394.g3916adf From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754017AbcEXFfq (ORCPT ); Tue, 24 May 2016 01:35:46 -0400 Received: from mail-sn1nam02on0086.outbound.protection.outlook.com ([104.47.36.86]:11840 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751418AbcEXFfo (ORCPT ); Tue, 24 May 2016 01:35:44 -0400 Authentication-Results: spf=pass (sender IP is 149.199.60.100) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=xilinx.com; From: Nava kishore Manne To: , , , , , , , , , , , CC: , , Subject: [PATCH v3] Axi-usb: Add support for 64-bit addressing. Date: Tue, 24 May 2016 10:51:08 +0530 Message-ID: <1464067268-35299-1-git-send-email-navam@xilinx.com> X-Mailer: git-send-email 2.1.1 X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.0.0.1202-22340.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:149.199.60.100;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(2980300002)(438002)(189002)(199003)(9170700003)(87936001)(5008740100001)(48376002)(50466002)(586003)(45336002)(229853001)(52956003)(189998001)(50986999)(86362001)(575784001)(2906002)(2201001)(47776003)(1220700001)(4001450100002)(4326007)(63266004)(5003940100001)(42186005)(5001770100001)(90966002)(106466001)(103686003)(36756003)(92566002)(8676002)(6806005)(50226002)(19580405001)(19580395003)(33646002)(81166006)(8936002)(921003)(107986001)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:BL2NAM02HT030;H:xsj-pvapsmtpgw02;FPR:;SPF:Pass;MLV:sfv;MX:1;A:1;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: b209d978-3ce7-457c-76b5-08d383933c97 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(8251501002);SRVR:BL2NAM02HT030; X-Microsoft-Antispam-PRVS: <6e1f76f425d543b8a1374d74daa92ad0@BL2NAM02HT030.eop-nam02.prod.protection.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(13018025)(13024025)(13015025)(13017025)(8121501046)(5005006)(13023025)(3002001)(10201501046)(6055026);SRVR:BL2NAM02HT030;BCL:0;PCL:0;RULEID:;SRVR:BL2NAM02HT030; X-Forefront-PRVS: 09525C61DB X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2016 05:21:18.6706 (UTC) X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.60.100];Helo=[xsj-pvapsmtpgw02] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2NAM02HT030 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch updates the driver to support 64-bit DMA addressing. Signed-off-by: Nava kishore Manne --- 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 | 21 +++++---- drivers/usb/gadget/udc/udc-xilinx.c | 53 ++++++++++++++++++++-- 2 files changed, 63 insertions(+), 11 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/udc-xilinx.txt b/Documentation/devicetree/bindings/usb/udc-xilinx.txt index 47b4e39..09df757 100644 --- a/Documentation/devicetree/bindings/usb/udc-xilinx.txt +++ b/Documentation/devicetree/bindings/usb/udc-xilinx.txt @@ -1,18 +1,23 @@ 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 +- dma-ranges : Should be as the following + +- xlnx,addrwidth : Should be the dma addressing size in bits(ex: 64 bits) Example: - axi-usb2-device@42e00000 { - compatible = "xlnx,usb2-device-4.00.a"; - interrupts = <0x0 0x39 0x1>; - reg = <0x42e00000 0x10000>; - xlnx,has-builtin-dma; - }; - + axi-usb2-device@42e00000 { + compatible = "xlnx,usb2-device-4.00.a"; + interrupts = <0x0 0x39 0x1>; + reg = <0x42e00000 0x10000>; + dma-ranges = <0x00000000 0x00000000 0x40000000>; + xlnx,has-builtin-dma; + xlnx,addrwidth = <0x40>; + }; diff --git a/drivers/usb/gadget/udc/udc-xilinx.c b/drivers/usb/gadget/udc/udc-xilinx.c index 1cbb0ac..112a6f3 100644 --- a/drivers/usb/gadget/udc/udc-xilinx.c +++ b/drivers/usb/gadget/udc/udc-xilinx.c @@ -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 */ @@ -193,7 +202,7 @@ struct xusb_udc { void __iomem *addr; spinlock_t lock; bool dma_enabled; - + u32 dma_addrwidth; unsigned int (*read_fn)(void __iomem *); void (*write_fn)(void __iomem *, u32, u32); }; @@ -214,6 +223,20 @@ static const struct usb_endpoint_descriptor config_bulk_out_desc = { .wMaxPacketSize = cpu_to_le16(EP0_MAX_PACKET), }; +/** + * xudc_write64 - write 64bit value to device registers + * @addr: base addr of device registers + * @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)); +} + /** * xudc_write32 - little endian write to device registers * @addr: base addr of device registers @@ -330,8 +353,13 @@ static int xudc_start_dma(struct xusb_ep *ep, dma_addr_t src, * destination registers and then set the length * into the DMA length register. */ - udc->write_fn(udc->addr, XUSB_DMA_DSAR_ADDR_OFFSET, src); - udc->write_fn(udc->addr, XUSB_DMA_DDAR_ADDR_OFFSET, dst); + if (udc->dma_addrwidth > 32) { + xudc_write64(ep, XUSB_DMA_DSAR_ADDR_OFFSET_LSB, src); + xudc_write64(ep, XUSB_DMA_DDAR_ADDR_OFFSET_LSB, dst); + } else { + udc->write_fn(udc->addr, XUSB_DMA_DSAR_ADDR_OFFSET, src); + udc->write_fn(udc->addr, XUSB_DMA_DDAR_ADDR_OFFSET, dst); + } udc->write_fn(udc->addr, XUSB_DMA_LENGTH_OFFSET, length); /* @@ -2097,6 +2125,24 @@ static int xudc_probe(struct platform_device *pdev) udc->dma_enabled = of_property_read_bool(np, "xlnx,has-builtin-dma"); + if (of_device_is_compatible(np, "xlnx,usb2-device-5.00")) { + ret = of_property_read_u32(np, "xlnx,addrwidth", + &udc->dma_addrwidth); + if (ret < 0) + dev_warn(&pdev->dev, + "missing xlnx,addrwidth property\n"); + } else { + udc->dma_addrwidth = 32; + } + + /* Set the dma mask bits */ + ret = dma_set_mask_and_coherent(&pdev->dev, + DMA_BIT_MASK(udc->dma_addrwidth)); + if (ret < 0) { + dev_dbg(&pdev->dev, "no usable DMA configuration"); + goto fail; + } + /* Setup gadget structure */ udc->gadget.ops = &xusb_udc_ops; udc->gadget.max_speed = USB_SPEED_HIGH; @@ -2168,6 +2214,7 @@ static int xudc_remove(struct platform_device *pdev) /* Match table for of_platform binding */ static const struct of_device_id usb_of_match[] = { { .compatible = "xlnx,usb2-device-4.00.a", }, + { .compatible = "xlnx,usb2-device-5.00", }, { /* end of list */ }, }; MODULE_DEVICE_TABLE(of, usb_of_match); -- 2.8.3.394.g3916adf