Skip to content

Commit e862485

Browse files
Rafał Miłeckigregkh
authored andcommitted
USB: bcma: drop Northstar PHY 2.0 initialization code
This driver should initialize controller only, PHY initialization should be handled by separated PHY driver. We already have phy-bcm-ns-usb2 in place so let it makes its duty. Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 35be784 commit e862485

1 file changed

Lines changed: 25 additions & 55 deletions

File tree

‎drivers/usb/host/bcma-hcd.c‎

Lines changed: 25 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -239,44 +239,10 @@ static int bcma_hcd_usb20_old_arm_init(struct bcma_hcd_device *usb_dev)
239239
return 0;
240240
}
241241

242-
static void bcma_hcd_init_chip_arm_phy(struct bcma_device *dev)
243-
{
244-
struct bcma_device *arm_core;
245-
void __iomem *dmu;
246-
247-
arm_core = bcma_find_core(dev->bus, BCMA_CORE_ARMCA9);
248-
if (!arm_core) {
249-
dev_err(&dev->dev, "can not find ARM Cortex A9 ihost core\n");
250-
return;
251-
}
252-
253-
dmu = ioremap_nocache(arm_core->addr_s[0], 0x1000);
254-
if (!dmu) {
255-
dev_err(&dev->dev, "can not map ARM Cortex A9 ihost core\n");
256-
return;
257-
}
258-
259-
/* Unlock DMU PLL settings */
260-
iowrite32(0x0000ea68, dmu + 0x180);
261-
262-
/* Write USB 2.0 PLL control setting */
263-
iowrite32(0x00dd10c3, dmu + 0x164);
264-
265-
/* Lock DMU PLL settings */
266-
iowrite32(0x00000000, dmu + 0x180);
267-
268-
iounmap(dmu);
269-
}
270-
271-
static void bcma_hcd_init_chip_arm_hc(struct bcma_device *dev)
242+
static void bcma_hcd_usb20_ns_init_hc(struct bcma_device *dev)
272243
{
273244
u32 val;
274245

275-
/*
276-
* Delay after PHY initialized to ensure HC is ready to be configured
277-
*/
278-
usleep_range(1000, 2000);
279-
280246
/* Set packet buffer OUT threshold */
281247
val = bcma_read32(dev, 0x94);
282248
val &= 0xffff;
@@ -287,20 +253,33 @@ static void bcma_hcd_init_chip_arm_hc(struct bcma_device *dev)
287253
val = bcma_read32(dev, 0x9c);
288254
val |= 1;
289255
bcma_write32(dev, 0x9c, val);
256+
257+
/*
258+
* Broadcom initializes PHY and then waits to ensure HC is ready to be
259+
* configured. In our case the order is reversed. We just initialized
260+
* controller and we let HCD initialize PHY, so let's wait (sleep) now.
261+
*/
262+
usleep_range(1000, 2000);
290263
}
291264

292-
static void bcma_hcd_init_chip_arm(struct bcma_device *dev)
265+
/**
266+
* bcma_hcd_usb20_ns_init - Initialize Northstar USB 2.0 controller
267+
*/
268+
static int bcma_hcd_usb20_ns_init(struct bcma_hcd_device *bcma_hcd)
293269
{
294-
bcma_core_enable(dev, 0);
270+
struct bcma_device *core = bcma_hcd->core;
271+
struct bcma_chipinfo *ci = &core->bus->chipinfo;
272+
struct device *dev = &core->dev;
295273

296-
if (dev->bus->chipinfo.id == BCMA_CHIP_ID_BCM4707 ||
297-
dev->bus->chipinfo.id == BCMA_CHIP_ID_BCM53018) {
298-
if (dev->bus->chipinfo.pkg == BCMA_PKG_ID_BCM4707 ||
299-
dev->bus->chipinfo.pkg == BCMA_PKG_ID_BCM4708)
300-
bcma_hcd_init_chip_arm_phy(dev);
274+
bcma_core_enable(core, 0);
301275

302-
bcma_hcd_init_chip_arm_hc(dev);
303-
}
276+
if (ci->id == BCMA_CHIP_ID_BCM4707 ||
277+
ci->id == BCMA_CHIP_ID_BCM53018)
278+
bcma_hcd_usb20_ns_init_hc(core);
279+
280+
of_platform_default_populate(dev->of_node, NULL, dev);
281+
282+
return 0;
304283
}
305284

306285
static void bcma_hci_platform_power_gpio(struct bcma_device *dev, bool val)
@@ -373,16 +352,7 @@ static int bcma_hcd_usb20_init(struct bcma_hcd_device *usb_dev)
373352
if (dma_set_mask_and_coherent(dev->dma_dev, DMA_BIT_MASK(32)))
374353
return -EOPNOTSUPP;
375354

376-
switch (dev->id.id) {
377-
case BCMA_CORE_NS_USB20:
378-
bcma_hcd_init_chip_arm(dev);
379-
break;
380-
case BCMA_CORE_USB20_HOST:
381-
bcma_hcd_init_chip_mips(dev);
382-
break;
383-
default:
384-
return -ENODEV;
385-
}
355+
bcma_hcd_init_chip_mips(dev);
386356

387357
/* In AI chips EHCI is addrspace 0, OHCI is 1 */
388358
ohci_addr = dev->addr_s[0];
@@ -451,7 +421,7 @@ static int bcma_hcd_probe(struct bcma_device *core)
451421
err = -ENOTSUPP;
452422
break;
453423
case BCMA_CORE_NS_USB20:
454-
err = bcma_hcd_usb20_init(usb_dev);
424+
err = bcma_hcd_usb20_ns_init(usb_dev);
455425
break;
456426
case BCMA_CORE_NS_USB30:
457427
err = bcma_hcd_usb30_init(usb_dev);

0 commit comments

Comments
 (0)