1 From 4aed231f49954114d5ae23e97789e9aa540a0b70 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
3 Date: Tue, 16 Jun 2015 12:52:07 +0200
4 Subject: [PATCH] USB: bcma: use separated function for USB 2.0 initialization
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 This will allow adding USB 3.0 (XHCI) support cleanly.
11 Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
13 drivers/usb/host/bcma-hcd.c | 51 +++++++++++++++++++++++++++++++--------------
14 1 file changed, 35 insertions(+), 16 deletions(-)
16 --- a/drivers/usb/host/bcma-hcd.c
17 +++ b/drivers/usb/host/bcma-hcd.c
18 @@ -34,6 +34,7 @@ MODULE_DESCRIPTION("Common USB driver fo
19 MODULE_LICENSE("GPL");
21 struct bcma_hcd_device {
22 + struct bcma_device *core;
23 struct platform_device *ehci_dev;
24 struct platform_device *ohci_dev;
26 @@ -293,27 +294,16 @@ err_alloc:
30 -static int bcma_hcd_probe(struct bcma_device *dev)
31 +static int bcma_hcd_usb20_init(struct bcma_hcd_device *usb_dev)
34 + struct bcma_device *dev = usb_dev->core;
35 + struct bcma_chipinfo *chipinfo = &dev->bus->chipinfo;
37 - struct bcma_hcd_device *usb_dev;
38 - struct bcma_chipinfo *chipinfo;
40 - chipinfo = &dev->bus->chipinfo;
42 - /* TODO: Probably need checks here; is the core connected? */
45 if (dma_set_mask_and_coherent(dev->dma_dev, DMA_BIT_MASK(32)))
48 - usb_dev = devm_kzalloc(&dev->dev, sizeof(struct bcma_hcd_device),
53 - bcma_hci_platform_power_gpio(dev, true);
56 case BCMA_CORE_NS_USB20:
57 bcma_hcd_init_chip_arm(dev);
58 @@ -346,7 +336,6 @@ static int bcma_hcd_probe(struct bcma_de
59 goto err_unregister_ohci_dev;
62 - bcma_set_drvdata(dev, usb_dev);
65 err_unregister_ohci_dev:
66 @@ -354,6 +343,36 @@ err_unregister_ohci_dev:
70 +static int bcma_hcd_probe(struct bcma_device *dev)
73 + struct bcma_hcd_device *usb_dev;
75 + /* TODO: Probably need checks here; is the core connected? */
77 + usb_dev = devm_kzalloc(&dev->dev, sizeof(struct bcma_hcd_device),
81 + usb_dev->core = dev;
83 + bcma_hci_platform_power_gpio(dev, true);
85 + switch (dev->id.id) {
86 + case BCMA_CORE_USB20_HOST:
87 + case BCMA_CORE_NS_USB20:
88 + err = bcma_hcd_usb20_init(usb_dev);
96 + bcma_set_drvdata(dev, usb_dev);
100 static void bcma_hcd_remove(struct bcma_device *dev)
102 struct bcma_hcd_device *usb_dev = bcma_get_drvdata(dev);