usb: dwc3: core: add dwc3_get_properties()
This helper will be responsible for reading and parsing our properties. No functional changes in this patch, cleanup only. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
This commit is contained in:
parent
3b2733227f
commit
c5ac6116db
@ -948,52 +948,13 @@ static void dwc3_core_exit_mode(struct dwc3 *dwc)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dwc3_probe(struct platform_device *pdev)
|
static void dwc3_get_properties(struct dwc3 *dwc)
|
||||||
{
|
{
|
||||||
struct device *dev = &pdev->dev;
|
struct device *dev = dwc->dev;
|
||||||
struct resource *res;
|
|
||||||
struct dwc3 *dwc;
|
|
||||||
u8 lpm_nyet_threshold;
|
u8 lpm_nyet_threshold;
|
||||||
u8 tx_de_emphasis;
|
u8 tx_de_emphasis;
|
||||||
u8 hird_threshold;
|
u8 hird_threshold;
|
||||||
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
void __iomem *regs;
|
|
||||||
|
|
||||||
dwc = devm_kzalloc(dev, sizeof(*dwc), GFP_KERNEL);
|
|
||||||
if (!dwc)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
dwc->dev = dev;
|
|
||||||
|
|
||||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
|
||||||
if (!res) {
|
|
||||||
dev_err(dev, "missing memory resource\n");
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
dwc->xhci_resources[0].start = res->start;
|
|
||||||
dwc->xhci_resources[0].end = dwc->xhci_resources[0].start +
|
|
||||||
DWC3_XHCI_REGS_END;
|
|
||||||
dwc->xhci_resources[0].flags = res->flags;
|
|
||||||
dwc->xhci_resources[0].name = res->name;
|
|
||||||
|
|
||||||
res->start += DWC3_GLOBALS_REGS_START;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Request memory region but exclude xHCI regs,
|
|
||||||
* since it will be requested by the xhci-plat driver.
|
|
||||||
*/
|
|
||||||
regs = devm_ioremap_resource(dev, res);
|
|
||||||
if (IS_ERR(regs)) {
|
|
||||||
ret = PTR_ERR(regs);
|
|
||||||
goto err0;
|
|
||||||
}
|
|
||||||
|
|
||||||
dwc->regs = regs;
|
|
||||||
dwc->regs_size = resource_size(res);
|
|
||||||
|
|
||||||
/* default to highest possible threshold */
|
/* default to highest possible threshold */
|
||||||
lpm_nyet_threshold = 0xff;
|
lpm_nyet_threshold = 0xff;
|
||||||
|
|
||||||
@ -1065,6 +1026,53 @@ static int dwc3_probe(struct platform_device *pdev)
|
|||||||
dwc->hird_threshold = hird_threshold
|
dwc->hird_threshold = hird_threshold
|
||||||
| (dwc->is_utmi_l1_suspend << 4);
|
| (dwc->is_utmi_l1_suspend << 4);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static int dwc3_probe(struct platform_device *pdev)
|
||||||
|
{
|
||||||
|
struct device *dev = &pdev->dev;
|
||||||
|
struct resource *res;
|
||||||
|
struct dwc3 *dwc;
|
||||||
|
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
void __iomem *regs;
|
||||||
|
|
||||||
|
dwc = devm_kzalloc(dev, sizeof(*dwc), GFP_KERNEL);
|
||||||
|
if (!dwc)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
dwc->dev = dev;
|
||||||
|
|
||||||
|
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||||
|
if (!res) {
|
||||||
|
dev_err(dev, "missing memory resource\n");
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
|
dwc->xhci_resources[0].start = res->start;
|
||||||
|
dwc->xhci_resources[0].end = dwc->xhci_resources[0].start +
|
||||||
|
DWC3_XHCI_REGS_END;
|
||||||
|
dwc->xhci_resources[0].flags = res->flags;
|
||||||
|
dwc->xhci_resources[0].name = res->name;
|
||||||
|
|
||||||
|
res->start += DWC3_GLOBALS_REGS_START;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Request memory region but exclude xHCI regs,
|
||||||
|
* since it will be requested by the xhci-plat driver.
|
||||||
|
*/
|
||||||
|
regs = devm_ioremap_resource(dev, res);
|
||||||
|
if (IS_ERR(regs)) {
|
||||||
|
ret = PTR_ERR(regs);
|
||||||
|
goto err0;
|
||||||
|
}
|
||||||
|
|
||||||
|
dwc->regs = regs;
|
||||||
|
dwc->regs_size = resource_size(res);
|
||||||
|
|
||||||
|
dwc3_get_properties(dwc);
|
||||||
|
|
||||||
platform_set_drvdata(pdev, dwc);
|
platform_set_drvdata(pdev, dwc);
|
||||||
dwc3_cache_hwparams(dwc);
|
dwc3_cache_hwparams(dwc);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user