Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Rafał Miłecki and committed by
Greg Kroah-Hartman
e8624859 35be784c

+25 -55
+25 -55
drivers/usb/host/bcma-hcd.c
··· 239 239 return 0; 240 240 } 241 241 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) 272 243 { 273 244 u32 val; 274 - 275 - /* 276 - * Delay after PHY initialized to ensure HC is ready to be configured 277 - */ 278 - usleep_range(1000, 2000); 279 245 280 246 /* Set packet buffer OUT threshold */ 281 247 val = bcma_read32(dev, 0x94); ··· 253 287 val = bcma_read32(dev, 0x9c); 254 288 val |= 1; 255 289 bcma_write32(dev, 0x9c, val); 290 + 291 + /* 292 + * Broadcom initializes PHY and then waits to ensure HC is ready to be 293 + * configured. In our case the order is reversed. We just initialized 294 + * controller and we let HCD initialize PHY, so let's wait (sleep) now. 295 + */ 296 + usleep_range(1000, 2000); 256 297 } 257 298 258 - static void bcma_hcd_init_chip_arm(struct bcma_device *dev) 299 + /** 300 + * bcma_hcd_usb20_ns_init - Initialize Northstar USB 2.0 controller 301 + */ 302 + static int bcma_hcd_usb20_ns_init(struct bcma_hcd_device *bcma_hcd) 259 303 { 260 - bcma_core_enable(dev, 0); 304 + struct bcma_device *core = bcma_hcd->core; 305 + struct bcma_chipinfo *ci = &core->bus->chipinfo; 306 + struct device *dev = &core->dev; 261 307 262 - if (dev->bus->chipinfo.id == BCMA_CHIP_ID_BCM4707 || 263 - dev->bus->chipinfo.id == BCMA_CHIP_ID_BCM53018) { 264 - if (dev->bus->chipinfo.pkg == BCMA_PKG_ID_BCM4707 || 265 - dev->bus->chipinfo.pkg == BCMA_PKG_ID_BCM4708) 266 - bcma_hcd_init_chip_arm_phy(dev); 308 + bcma_core_enable(core, 0); 267 309 268 - bcma_hcd_init_chip_arm_hc(dev); 269 - } 310 + if (ci->id == BCMA_CHIP_ID_BCM4707 || 311 + ci->id == BCMA_CHIP_ID_BCM53018) 312 + bcma_hcd_usb20_ns_init_hc(core); 313 + 314 + of_platform_default_populate(dev->of_node, NULL, dev); 315 + 316 + return 0; 270 317 } 271 318 272 319 static void bcma_hci_platform_power_gpio(struct bcma_device *dev, bool val) ··· 352 373 if (dma_set_mask_and_coherent(dev->dma_dev, DMA_BIT_MASK(32))) 353 374 return -EOPNOTSUPP; 354 375 355 - switch (dev->id.id) { 356 - case BCMA_CORE_NS_USB20: 357 - bcma_hcd_init_chip_arm(dev); 358 - break; 359 - case BCMA_CORE_USB20_HOST: 360 - bcma_hcd_init_chip_mips(dev); 361 - break; 362 - default: 363 - return -ENODEV; 364 - } 376 + bcma_hcd_init_chip_mips(dev); 365 377 366 378 /* In AI chips EHCI is addrspace 0, OHCI is 1 */ 367 379 ohci_addr = dev->addr_s[0]; ··· 421 451 err = -ENOTSUPP; 422 452 break; 423 453 case BCMA_CORE_NS_USB20: 424 - err = bcma_hcd_usb20_init(usb_dev); 454 + err = bcma_hcd_usb20_ns_init(usb_dev); 425 455 break; 426 456 case BCMA_CORE_NS_USB30: 427 457 err = bcma_hcd_usb30_init(usb_dev);