1 From fa5622c2fadae573dd6b0f5bffe436b230b411f6 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 v3 4/6] usb: bcma: use separated function for USB 2.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
10 This will allow adding USB 3.0 (XHCI) support cleanly.
12 Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
13 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
15 drivers/usb/host/bcma-hcd.c | 51 +++++++++++++++++++++++++++++++--------------
16 1 file changed, 35 insertions(+), 16 deletions(-)
18 --- a/drivers/usb/host/bcma-hcd.c
19 +++ b/drivers/usb/host/bcma-hcd.c
20 @@ -35,6 +35,7 @@ MODULE_DESCRIPTION("Common USB driver fo
21 MODULE_LICENSE("GPL");
23 struct bcma_hcd_device {
24 + struct bcma_device *core;
25 struct platform_device *ehci_dev;
26 struct platform_device *ohci_dev;
27 struct gpio_desc *gpio_desc;
28 @@ -288,31 +289,16 @@ err_alloc:
32 -static int bcma_hcd_probe(struct bcma_device *dev)
33 +static int bcma_hcd_usb20_init(struct bcma_hcd_device *usb_dev)
36 + struct bcma_device *dev = usb_dev->core;
37 + struct bcma_chipinfo *chipinfo = &dev->bus->chipinfo;
39 - struct bcma_hcd_device *usb_dev;
40 - struct bcma_chipinfo *chipinfo;
42 - chipinfo = &dev->bus->chipinfo;
44 - /* TODO: Probably need checks here; is the core connected? */
47 if (dma_set_mask_and_coherent(dev->dma_dev, DMA_BIT_MASK(32)))
50 - usb_dev = devm_kzalloc(&dev->dev, sizeof(struct bcma_hcd_device),
55 - if (dev->dev.of_node)
56 - usb_dev->gpio_desc = devm_get_gpiod_from_child(&dev->dev, "vcc",
57 - &dev->dev.of_node->fwnode);
58 - if (!IS_ERR_OR_NULL(usb_dev->gpio_desc))
59 - gpiod_direction_output(usb_dev->gpio_desc, 1);
62 case BCMA_CORE_NS_USB20:
63 bcma_hcd_init_chip_arm(dev);
64 @@ -345,7 +331,6 @@ static int bcma_hcd_probe(struct bcma_de
65 goto err_unregister_ohci_dev;
68 - bcma_set_drvdata(dev, usb_dev);
71 err_unregister_ohci_dev:
72 @@ -353,6 +338,40 @@ err_unregister_ohci_dev:
76 +static int bcma_hcd_probe(struct bcma_device *dev)
79 + struct bcma_hcd_device *usb_dev;
81 + /* TODO: Probably need checks here; is the core connected? */
83 + usb_dev = devm_kzalloc(&dev->dev, sizeof(struct bcma_hcd_device),
87 + usb_dev->core = dev;
89 + if (dev->dev.of_node)
90 + usb_dev->gpio_desc = devm_get_gpiod_from_child(&dev->dev, "vcc",
91 + &dev->dev.of_node->fwnode);
92 + if (!IS_ERR_OR_NULL(usb_dev->gpio_desc))
93 + gpiod_direction_output(usb_dev->gpio_desc, 1);
95 + switch (dev->id.id) {
96 + case BCMA_CORE_USB20_HOST:
97 + case BCMA_CORE_NS_USB20:
98 + err = bcma_hcd_usb20_init(usb_dev);
106 + bcma_set_drvdata(dev, usb_dev);
110 static void bcma_hcd_remove(struct bcma_device *dev)
112 struct bcma_hcd_device *usb_dev = bcma_get_drvdata(dev);