[PATCH] usb: dwc3: pci: remove use of platform_data

From: Heikki Krogerus
Date: Mon Jan 12 2015 - 09:15:10 EST


This replaces the platform_data used on AMD Nolan SoC with
generic device property.

Signed-off-by: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx>
---
drivers/usb/dwc3/dwc3-pci.c | 53 ++++++++++++++++++++++++---------------------
1 file changed, 28 insertions(+), 25 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c
index 8d95056..0f20139 100644
--- a/drivers/usb/dwc3/dwc3-pci.c
+++ b/drivers/usb/dwc3/dwc3-pci.c
@@ -22,8 +22,6 @@
#include <linux/pci.h>
#include <linux/platform_device.h>

-#include "platform_data.h"
-
/* FIXME define these in <linux/pci_ids.h> */
#define PCI_VENDOR_ID_SYNOPSYS 0x16c3
#define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3 0xabcd
@@ -37,34 +35,39 @@ static int dwc3_pci_quirks(struct pci_dev *pdev)
{
if (pdev->vendor == PCI_VENDOR_ID_AMD &&
pdev->device == PCI_DEVICE_ID_AMD_NL_USB) {
- struct dwc3_platform_data pdata;
-
- memset(&pdata, 0, sizeof(pdata));
-
- pdata.has_lpm_erratum = true;
- pdata.lpm_nyet_threshold = 0xf;
-
- pdata.u2exit_lfps_quirk = true;
- pdata.u2ss_inp3_quirk = true;
- pdata.req_p1p2p3_quirk = true;
- pdata.del_p1p2p3_quirk = true;
- pdata.del_phy_power_chg_quirk = true;
- pdata.lfps_filter_quirk = true;
- pdata.rx_detect_poll_quirk = true;
-
- pdata.tx_de_emphasis_quirk = true;
- pdata.tx_de_emphasis = 1;
-
+ struct platform_device *dwc3 = pci_get_drvdata(pdev);
+ struct dev_gen_prop *prop;
+
+ prop = devm_kcalloc(&pdev->dev, 14, sizeof(*prop), GFP_KERNEL);
+ if (!prop)
+ return -ENOMEM;
+
+ prop[1].num = devm_kzalloc(&pdev->dev, sizeof(u8 *),
+ GFP_KERNEL);
+ if (!prop[1].num)
+ return -ENOMEM;
+
+ prop[0].name = "snps,has-lpm-erratum";
+ prop[1].name = "snps,lpm-nyet-threshold";
+ prop[1].nval = 1;
+ prop[1].num[0] = 0xf;
+ prop[2].name = "snps,u2exit_lfps_quirk";
+ prop[3].name = "snps,u2ss_inp3_quirk";
+ prop[4].name = "snps,req_p1p2p3_quirk";
+ prop[5].name = "snps,del_p1p2p3_quirk";
+ prop[6].name = "snps,del_phy_power_chg_quirk";
+ prop[7].name = "snps,lfps_filter_quirk";
+ prop[8].name = "snps,rx_detect_poll_quirk";
+ prop[9].name = "snps,tx_de_emphasis_quirk";
/*
* FIXME these quirks should be removed when AMD NL
* taps out
*/
- pdata.disable_scramble_quirk = true;
- pdata.dis_u3_susphy_quirk = true;
- pdata.dis_u2_susphy_quirk = true;
+ prop[10].name = "snps,disable_scramble_quirk";
+ prop[11].name = "snps,dis_u3_susphy_quirk";
+ prop[12].name = "snps,dis_u2_susphy_quirk";

- return platform_device_add_data(pci_get_drvdata(pdev), &pdata,
- sizeof(pdata));
+ dwc3->dev.gen_prop = prop;
}

return 0;
--
2.1.4


--XOIedfhf+7KOe/yw--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/