196-USB-bcma-use-separated-function-for-USB-2.0-initiali.patch 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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
  5. initialization
  6. MIME-Version: 1.0
  7. Content-Type: text/plain; charset=UTF-8
  8. Content-Transfer-Encoding: 8bit
  9. This will allow adding USB 3.0 (XHCI) support cleanly.
  10. Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  11. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
  12. ---
  13. drivers/usb/host/bcma-hcd.c | 51 +++++++++++++++++++++++++++++++--------------
  14. 1 file changed, 35 insertions(+), 16 deletions(-)
  15. --- a/drivers/usb/host/bcma-hcd.c
  16. +++ b/drivers/usb/host/bcma-hcd.c
  17. @@ -35,6 +35,7 @@ MODULE_DESCRIPTION("Common USB driver fo
  18. MODULE_LICENSE("GPL");
  19. struct bcma_hcd_device {
  20. + struct bcma_device *core;
  21. struct platform_device *ehci_dev;
  22. struct platform_device *ohci_dev;
  23. struct gpio_desc *gpio_desc;
  24. @@ -288,31 +289,16 @@ err_alloc:
  25. return ERR_PTR(ret);
  26. }
  27. -static int bcma_hcd_probe(struct bcma_device *dev)
  28. +static int bcma_hcd_usb20_init(struct bcma_hcd_device *usb_dev)
  29. {
  30. - int err;
  31. + struct bcma_device *dev = usb_dev->core;
  32. + struct bcma_chipinfo *chipinfo = &dev->bus->chipinfo;
  33. u32 ohci_addr;
  34. - struct bcma_hcd_device *usb_dev;
  35. - struct bcma_chipinfo *chipinfo;
  36. -
  37. - chipinfo = &dev->bus->chipinfo;
  38. -
  39. - /* TODO: Probably need checks here; is the core connected? */
  40. + int err;
  41. if (dma_set_mask_and_coherent(dev->dma_dev, DMA_BIT_MASK(32)))
  42. return -EOPNOTSUPP;
  43. - usb_dev = devm_kzalloc(&dev->dev, sizeof(struct bcma_hcd_device),
  44. - GFP_KERNEL);
  45. - if (!usb_dev)
  46. - return -ENOMEM;
  47. -
  48. - if (dev->dev.of_node)
  49. - usb_dev->gpio_desc = devm_get_gpiod_from_child(&dev->dev, "vcc",
  50. - &dev->dev.of_node->fwnode);
  51. - if (!IS_ERR_OR_NULL(usb_dev->gpio_desc))
  52. - gpiod_direction_output(usb_dev->gpio_desc, 1);
  53. -
  54. switch (dev->id.id) {
  55. case BCMA_CORE_NS_USB20:
  56. bcma_hcd_init_chip_arm(dev);
  57. @@ -345,7 +331,6 @@ static int bcma_hcd_probe(struct bcma_de
  58. goto err_unregister_ohci_dev;
  59. }
  60. - bcma_set_drvdata(dev, usb_dev);
  61. return 0;
  62. err_unregister_ohci_dev:
  63. @@ -353,6 +338,40 @@ err_unregister_ohci_dev:
  64. return err;
  65. }
  66. +static int bcma_hcd_probe(struct bcma_device *dev)
  67. +{
  68. + int err;
  69. + struct bcma_hcd_device *usb_dev;
  70. +
  71. + /* TODO: Probably need checks here; is the core connected? */
  72. +
  73. + usb_dev = devm_kzalloc(&dev->dev, sizeof(struct bcma_hcd_device),
  74. + GFP_KERNEL);
  75. + if (!usb_dev)
  76. + return -ENOMEM;
  77. + usb_dev->core = dev;
  78. +
  79. + if (dev->dev.of_node)
  80. + usb_dev->gpio_desc = devm_get_gpiod_from_child(&dev->dev, "vcc",
  81. + &dev->dev.of_node->fwnode);
  82. + if (!IS_ERR_OR_NULL(usb_dev->gpio_desc))
  83. + gpiod_direction_output(usb_dev->gpio_desc, 1);
  84. +
  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);
  89. + if (err)
  90. + return err;
  91. + break;
  92. + default:
  93. + return -ENODEV;
  94. + }
  95. +
  96. + bcma_set_drvdata(dev, usb_dev);
  97. + return 0;
  98. +}
  99. +
  100. static void bcma_hcd_remove(struct bcma_device *dev)
  101. {
  102. struct bcma_hcd_device *usb_dev = bcma_get_drvdata(dev);