Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: chipidea: add xilinx zynq platform data

Due to having hardware tx buffers less than 512 bytes in size, streaming
must be enabled on the Zynq for the udc to work at all. Add platform data
specific to the Zynq udc, which does not set the CI_HDRC_DISABLE_STREAMING
flag.

Based on a patch by the same name from the Xilinx vendor tree.

Signed-off-by: Nathan Sullivan <nathan.sullivan@ni.com>
Signed-off-by: Peter Chen <peter.chen@freescale.com>

authored by

Nathan Sullivan and committed by
Peter Chen
84bc70f9 56ffa1d1

+19 -6
+19 -6
drivers/usb/chipidea/ci_hdrc_usb2.c
··· 12 12 #include <linux/dma-mapping.h> 13 13 #include <linux/module.h> 14 14 #include <linux/of.h> 15 + #include <linux/of_platform.h> 15 16 #include <linux/phy/phy.h> 16 17 #include <linux/platform_device.h> 17 18 #include <linux/usb/chipidea.h> ··· 31 30 .flags = CI_HDRC_DISABLE_STREAMING, 32 31 }; 33 32 33 + static struct ci_hdrc_platform_data ci_zynq_pdata = { 34 + .capoffset = DEF_CAPOFFSET, 35 + }; 36 + 37 + static const struct of_device_id ci_hdrc_usb2_of_match[] = { 38 + { .compatible = "chipidea,usb2"}, 39 + { .compatible = "xlnx,zynq-usb-2.20a", .data = &ci_zynq_pdata}, 40 + { } 41 + }; 42 + MODULE_DEVICE_TABLE(of, ci_hdrc_usb2_of_match); 43 + 34 44 static int ci_hdrc_usb2_probe(struct platform_device *pdev) 35 45 { 36 46 struct device *dev = &pdev->dev; 37 47 struct ci_hdrc_usb2_priv *priv; 38 48 struct ci_hdrc_platform_data *ci_pdata = dev_get_platdata(dev); 39 49 int ret; 50 + const struct of_device_id *match; 40 51 41 52 if (!ci_pdata) { 42 53 ci_pdata = devm_kmalloc(dev, sizeof(*ci_pdata), GFP_KERNEL); 43 54 *ci_pdata = ci_default_pdata; /* struct copy */ 55 + } 56 + 57 + match = of_match_device(ci_hdrc_usb2_of_match, &pdev->dev); 58 + if (match && match->data) { 59 + /* struct copy */ 60 + *ci_pdata = *(struct ci_hdrc_platform_data *)match->data; 44 61 } 45 62 46 63 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); ··· 114 95 115 96 return 0; 116 97 } 117 - 118 - static const struct of_device_id ci_hdrc_usb2_of_match[] = { 119 - { .compatible = "chipidea,usb2" }, 120 - { } 121 - }; 122 - MODULE_DEVICE_TABLE(of, ci_hdrc_usb2_of_match); 123 98 124 99 static struct platform_driver ci_hdrc_usb2_driver = { 125 100 .probe = ci_hdrc_usb2_probe,