diff options
author | Vivek Gautam <gautam.vivek@samsung.com> | 2014-06-04 05:04:52 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2014-06-30 13:26:36 -0400 |
commit | f32a5e2325caf3dd0d720932cc241d8ba22875a8 (patch) | |
tree | 33fc6393372da4a10c5c8e66f5efe5852010810e /drivers/usb/dwc3/core.c | |
parent | 7b0a12ab2e49379d7c6754996446020e117eef0b (diff) |
usb: dwc3: Keeping 'resource' related code together
Putting together the code related to getting the 'IORESOURCE_MEM'
and assigning the same to dwc->xhci_resources, for increasing
the readability.
Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/dwc3/core.c')
-rw-r--r-- | drivers/usb/dwc3/core.c | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index eb69eb9f06c8..fbe446350e28 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c | |||
@@ -656,6 +656,31 @@ static int dwc3_probe(struct platform_device *pdev) | |||
656 | return -ENODEV; | 656 | return -ENODEV; |
657 | } | 657 | } |
658 | 658 | ||
659 | dwc->xhci_resources[0].start = res->start; | ||
660 | dwc->xhci_resources[0].end = dwc->xhci_resources[0].start + | ||
661 | DWC3_XHCI_REGS_END; | ||
662 | dwc->xhci_resources[0].flags = res->flags; | ||
663 | dwc->xhci_resources[0].name = res->name; | ||
664 | |||
665 | res->start += DWC3_GLOBALS_REGS_START; | ||
666 | |||
667 | /* | ||
668 | * Request memory region but exclude xHCI regs, | ||
669 | * since it will be requested by the xhci-plat driver. | ||
670 | */ | ||
671 | regs = devm_ioremap_resource(dev, res); | ||
672 | if (IS_ERR(regs)) | ||
673 | return PTR_ERR(regs); | ||
674 | |||
675 | dwc->regs = regs; | ||
676 | dwc->regs_size = resource_size(res); | ||
677 | /* | ||
678 | * restore res->start back to its original value so that, | ||
679 | * in case the probe is deferred, we don't end up getting error in | ||
680 | * request the memory region the next time probe is called. | ||
681 | */ | ||
682 | res->start -= DWC3_GLOBALS_REGS_START; | ||
683 | |||
659 | if (node) { | 684 | if (node) { |
660 | dwc->maximum_speed = of_usb_get_maximum_speed(node); | 685 | dwc->maximum_speed = of_usb_get_maximum_speed(node); |
661 | 686 | ||
@@ -676,28 +701,9 @@ static int dwc3_probe(struct platform_device *pdev) | |||
676 | if (ret) | 701 | if (ret) |
677 | return ret; | 702 | return ret; |
678 | 703 | ||
679 | dwc->xhci_resources[0].start = res->start; | ||
680 | dwc->xhci_resources[0].end = dwc->xhci_resources[0].start + | ||
681 | DWC3_XHCI_REGS_END; | ||
682 | dwc->xhci_resources[0].flags = res->flags; | ||
683 | dwc->xhci_resources[0].name = res->name; | ||
684 | |||
685 | res->start += DWC3_GLOBALS_REGS_START; | ||
686 | |||
687 | /* | ||
688 | * Request memory region but exclude xHCI regs, | ||
689 | * since it will be requested by the xhci-plat driver. | ||
690 | */ | ||
691 | regs = devm_ioremap_resource(dev, res); | ||
692 | if (IS_ERR(regs)) | ||
693 | return PTR_ERR(regs); | ||
694 | |||
695 | spin_lock_init(&dwc->lock); | 704 | spin_lock_init(&dwc->lock); |
696 | platform_set_drvdata(pdev, dwc); | 705 | platform_set_drvdata(pdev, dwc); |
697 | 706 | ||
698 | dwc->regs = regs; | ||
699 | dwc->regs_size = resource_size(res); | ||
700 | |||
701 | dev->dma_mask = dev->parent->dma_mask; | 707 | dev->dma_mask = dev->parent->dma_mask; |
702 | dev->dma_parms = dev->parent->dma_parms; | 708 | dev->dma_parms = dev->parent->dma_parms; |
703 | dma_set_coherent_mask(dev, dev->parent->coherent_dma_mask); | 709 | dma_set_coherent_mask(dev, dev->parent->coherent_dma_mask); |