Commit 84bc70f9 authored by Nathan Sullivan's avatar Nathan Sullivan Committed by Peter Chen

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: default avatarNathan Sullivan <nathan.sullivan@ni.com>
Signed-off-by: default avatarPeter Chen <peter.chen@freescale.com>
parent 56ffa1d1
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/phy/phy.h> #include <linux/phy/phy.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/usb/chipidea.h> #include <linux/usb/chipidea.h>
...@@ -30,18 +31,36 @@ static const struct ci_hdrc_platform_data ci_default_pdata = { ...@@ -30,18 +31,36 @@ static const struct ci_hdrc_platform_data ci_default_pdata = {
.flags = CI_HDRC_DISABLE_STREAMING, .flags = CI_HDRC_DISABLE_STREAMING,
}; };
static struct ci_hdrc_platform_data ci_zynq_pdata = {
.capoffset = DEF_CAPOFFSET,
};
static const struct of_device_id ci_hdrc_usb2_of_match[] = {
{ .compatible = "chipidea,usb2"},
{ .compatible = "xlnx,zynq-usb-2.20a", .data = &ci_zynq_pdata},
{ }
};
MODULE_DEVICE_TABLE(of, ci_hdrc_usb2_of_match);
static int ci_hdrc_usb2_probe(struct platform_device *pdev) static int ci_hdrc_usb2_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct ci_hdrc_usb2_priv *priv; struct ci_hdrc_usb2_priv *priv;
struct ci_hdrc_platform_data *ci_pdata = dev_get_platdata(dev); struct ci_hdrc_platform_data *ci_pdata = dev_get_platdata(dev);
int ret; int ret;
const struct of_device_id *match;
if (!ci_pdata) { if (!ci_pdata) {
ci_pdata = devm_kmalloc(dev, sizeof(*ci_pdata), GFP_KERNEL); ci_pdata = devm_kmalloc(dev, sizeof(*ci_pdata), GFP_KERNEL);
*ci_pdata = ci_default_pdata; /* struct copy */ *ci_pdata = ci_default_pdata; /* struct copy */
} }
match = of_match_device(ci_hdrc_usb2_of_match, &pdev->dev);
if (match && match->data) {
/* struct copy */
*ci_pdata = *(struct ci_hdrc_platform_data *)match->data;
}
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv) if (!priv)
return -ENOMEM; return -ENOMEM;
...@@ -96,12 +115,6 @@ static int ci_hdrc_usb2_remove(struct platform_device *pdev) ...@@ -96,12 +115,6 @@ static int ci_hdrc_usb2_remove(struct platform_device *pdev)
return 0; return 0;
} }
static const struct of_device_id ci_hdrc_usb2_of_match[] = {
{ .compatible = "chipidea,usb2" },
{ }
};
MODULE_DEVICE_TABLE(of, ci_hdrc_usb2_of_match);
static struct platform_driver ci_hdrc_usb2_driver = { static struct platform_driver ci_hdrc_usb2_driver = {
.probe = ci_hdrc_usb2_probe, .probe = ci_hdrc_usb2_probe,
.remove = ci_hdrc_usb2_remove, .remove = ci_hdrc_usb2_remove,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment