Lines Matching +full:usb +full:- +full:misc +full:- +full:reg

1 // SPDX-License-Identifier: GPL-2.0
4 * Broadcom USB-core driver (BCMA bus glue)
6 * Copyright 2011-2015 Hauke Mehrtens <hauke@hauke-m.de>
9 * Based on ssb-ohci driver
12 * Derived from the OHCI-PCI driver
14 * Copyright 2000-2002 David Brownell
18 * Derived from the USBcore related parts of Broadcom-SB
19 * Copyright 2005-2011 Broadcom Corporation
30 #include <linux/usb/ehci_pdriver.h>
31 #include <linux/usb/ohci_pdriver.h>
34 MODULE_DESCRIPTION("Common USB driver for BCMA Bus");
48 * timeout is in units of ten-microseconds.
50 static int bcma_wait_bits(struct bcma_device *dev, u16 reg, u32 bitmask, in bcma_wait_bits() argument
57 val = bcma_read32(dev, reg); in bcma_wait_bits()
63 return -ETIMEDOUT; in bcma_wait_bits()
70 if (dev->bus->chipinfo.id == 0x4716) { in bcma_hcd_4716wa()
73 tmp = bcma_cpu_clock(&dev->bus->drv_mips); in bcma_hcd_4716wa()
81 /* Change Shim mdio control reg to fix host not acking at in bcma_hcd_4716wa()
99 /* based on arch/mips/brcm-boards/bcm947xx/pcibios.c */
105 * USB 2.0 special considerations: in bcma_hcd_init_chip_mips()
111 * Register must be programmed to bring the USB core and various in bcma_hcd_init_chip_mips()
117 if (dev->id.rev >= 5) { in bcma_hcd_init_chip_mips()
118 /* Enable Misc PLL */ in bcma_hcd_init_chip_mips()
123 printk(KERN_EMERG "Failed to enable misc PPL!\n"); in bcma_hcd_init_chip_mips()
131 /* Make sure digital and AFE are locked in USB PHY */ in bcma_hcd_init_chip_mips()
159 /* Take USB and HSIC out of non-driving modes */ in bcma_hcd_init_chip_mips()
172 * bcma_hcd_usb20_old_arm_init - Initialize old USB 2.0 controller on ARM
174 * Old USB 2.0 core is identified as BCMA_CORE_USB20_HOST and was introduced
181 struct bcma_device *core = usb_dev->core; in bcma_hcd_usb20_old_arm_init()
182 struct device *dev = &core->dev; in bcma_hcd_usb20_old_arm_init()
186 if (core->id.rev < 5) in bcma_hcd_usb20_old_arm_init()
189 pmu_core = bcma_find_core(core->bus, BCMA_CORE_PMU); in bcma_hcd_usb20_old_arm_init()
192 return -ENOENT; in bcma_hcd_usb20_old_arm_init()
195 /* Take USB core out of reset */ in bcma_hcd_usb20_old_arm_init()
205 /* Enable Misc PLL */ in bcma_hcd_usb20_old_arm_init()
215 /* Program USB PHY PLL parameters */ in bcma_hcd_usb20_old_arm_init()
236 of_platform_default_populate(dev->of_node, NULL, dev); in bcma_hcd_usb20_old_arm_init()
265 * bcma_hcd_usb20_ns_init - Initialize Northstar USB 2.0 controller
269 struct bcma_device *core = bcma_hcd->core; in bcma_hcd_usb20_ns_init()
270 struct bcma_chipinfo *ci = &core->bus->chipinfo; in bcma_hcd_usb20_ns_init()
271 struct device *dev = &core->dev; in bcma_hcd_usb20_ns_init()
275 if (ci->id == BCMA_CHIP_ID_BCM4707 || in bcma_hcd_usb20_ns_init()
276 ci->id == BCMA_CHIP_ID_BCM53018) in bcma_hcd_usb20_ns_init()
279 of_platform_default_populate(dev->of_node, NULL, dev); in bcma_hcd_usb20_ns_init()
288 if (!usb_dev->gpio_desc) in bcma_hci_platform_power_gpio()
291 gpiod_set_value(usb_dev->gpio_desc, val); in bcma_hci_platform_power_gpio()
312 hci_res[0].end = hci_res[0].start + 0x1000 - 1; in bcma_hcd_create_pdev()
315 hci_res[1].start = dev->irq; in bcma_hcd_create_pdev()
320 return ERR_PTR(-ENOMEM); in bcma_hcd_create_pdev()
322 hci_dev->dev.parent = &dev->dev; in bcma_hcd_create_pdev()
323 hci_dev->dev.dma_mask = &hci_dev->dev.coherent_dma_mask; in bcma_hcd_create_pdev()
346 struct bcma_device *dev = usb_dev->core; in bcma_hcd_usb20_init()
347 struct bcma_chipinfo *chipinfo = &dev->bus->chipinfo; in bcma_hcd_usb20_init()
351 if (dma_set_mask_and_coherent(dev->dma_dev, DMA_BIT_MASK(32))) in bcma_hcd_usb20_init()
352 return -EOPNOTSUPP; in bcma_hcd_usb20_init()
357 ohci_addr = dev->addr_s[0]; in bcma_hcd_usb20_init()
358 if ((chipinfo->id == BCMA_CHIP_ID_BCM5357 || in bcma_hcd_usb20_init()
359 chipinfo->id == BCMA_CHIP_ID_BCM4749) in bcma_hcd_usb20_init()
360 && chipinfo->rev == 0) in bcma_hcd_usb20_init()
363 usb_dev->ohci_dev = bcma_hcd_create_pdev(dev, "ohci-platform", in bcma_hcd_usb20_init()
366 if (IS_ERR(usb_dev->ohci_dev)) in bcma_hcd_usb20_init()
367 return PTR_ERR(usb_dev->ohci_dev); in bcma_hcd_usb20_init()
369 usb_dev->ehci_dev = bcma_hcd_create_pdev(dev, "ehci-platform", in bcma_hcd_usb20_init()
370 dev->addr, &ehci_pdata, in bcma_hcd_usb20_init()
372 if (IS_ERR(usb_dev->ehci_dev)) { in bcma_hcd_usb20_init()
373 err = PTR_ERR(usb_dev->ehci_dev); in bcma_hcd_usb20_init()
380 platform_device_unregister(usb_dev->ohci_dev); in bcma_hcd_usb20_init()
386 struct bcma_device *core = bcma_hcd->core; in bcma_hcd_usb30_init()
387 struct device *dev = &core->dev; in bcma_hcd_usb30_init()
391 of_platform_default_populate(dev->of_node, NULL, dev); in bcma_hcd_usb30_init()
403 usb_dev = devm_kzalloc(&core->dev, sizeof(struct bcma_hcd_device), in bcma_hcd_probe()
406 return -ENOMEM; in bcma_hcd_probe()
407 usb_dev->core = core; in bcma_hcd_probe()
409 usb_dev->gpio_desc = devm_gpiod_get_optional(&core->dev, "vcc", in bcma_hcd_probe()
411 if (IS_ERR(usb_dev->gpio_desc)) in bcma_hcd_probe()
412 return dev_err_probe(&core->dev, PTR_ERR(usb_dev->gpio_desc), in bcma_hcd_probe()
415 switch (core->id.id) { in bcma_hcd_probe()
422 err = -ENOTSUPP; in bcma_hcd_probe()
431 return -ENODEV; in bcma_hcd_probe()
443 struct platform_device *ohci_dev = usb_dev->ohci_dev; in bcma_hcd_remove()
444 struct platform_device *ehci_dev = usb_dev->ehci_dev; in bcma_hcd_remove()