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

usb: musb: sunxi: Add support for musb controller in A33 SoC

The A33 SoC uses the same musb controller as found on the A31 and later,
but allwinner has removed the configdata register, this commit adds special
handling for this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>

authored by

Hans de Goede and committed by
Felipe Balbi
d91de093 132e2377

+17 -1
+2 -1
Documentation/devicetree/bindings/usb/allwinner,sun4i-a10-musb.txt
··· 2 2 ------------------------------------------- 3 3 4 4 Required properties: 5 - - compatible : "allwinner,sun4i-a10-musb" or "allwinner,sun6i-a31-musb" 5 + - compatible : "allwinner,sun4i-a10-musb", "allwinner,sun6i-a31-musb" 6 + or "allwinner,sun8i-a33-musb" 6 7 - reg : mmio address range of the musb controller 7 8 - clocks : clock specifier for the musb controller ahb gate clock 8 9 - reset : reset specifier for the ahb reset (A31 and newer only)
+15
drivers/usb/musb/sunxi.c
··· 73 73 #define SUNXI_MUSB_FL_PHY_ON 4 74 74 #define SUNXI_MUSB_FL_HAS_SRAM 5 75 75 #define SUNXI_MUSB_FL_HAS_RESET 6 76 + #define SUNXI_MUSB_FL_NO_CONFIGDATA 7 76 77 77 78 /* Our read/write methods need access and do not get passed in a musb ref :| */ 78 79 static struct musb *sunxi_musb; ··· 371 370 372 371 static u8 sunxi_musb_readb(const void __iomem *addr, unsigned offset) 373 372 { 373 + struct sunxi_glue *glue; 374 + 374 375 if (addr == sunxi_musb->mregs) { 375 376 /* generic control or fifo control reg access */ 376 377 switch (offset) { ··· 395 392 case MUSB_RXFIFOSZ: 396 393 return readb(addr + SUNXI_MUSB_RXFIFOSZ); 397 394 case MUSB_CONFIGDATA + 0x10: /* See musb_read_configdata() */ 395 + glue = dev_get_drvdata(sunxi_musb->controller->parent); 396 + /* A33 saves a reg, and we get to hardcode this */ 397 + if (test_bit(SUNXI_MUSB_FL_NO_CONFIGDATA, 398 + &glue->flags)) 399 + return 0xde; 400 + 398 401 return readb(addr + SUNXI_MUSB_CONFIGDATA); 399 402 /* Offset for these is fixed by sunxi_musb_busctl_offset() */ 400 403 case SUNXI_MUSB_TXFUNCADDR: ··· 652 643 if (of_device_is_compatible(np, "allwinner,sun6i-a31-musb")) 653 644 set_bit(SUNXI_MUSB_FL_HAS_RESET, &glue->flags); 654 645 646 + if (of_device_is_compatible(np, "allwinner,sun8i-a33-musb")) { 647 + set_bit(SUNXI_MUSB_FL_HAS_RESET, &glue->flags); 648 + set_bit(SUNXI_MUSB_FL_NO_CONFIGDATA, &glue->flags); 649 + } 650 + 655 651 glue->clk = devm_clk_get(&pdev->dev, NULL); 656 652 if (IS_ERR(glue->clk)) { 657 653 dev_err(&pdev->dev, "Error getting clock: %ld\n", ··· 737 723 static const struct of_device_id sunxi_musb_match[] = { 738 724 { .compatible = "allwinner,sun4i-a10-musb", }, 739 725 { .compatible = "allwinner,sun6i-a31-musb", }, 726 + { .compatible = "allwinner,sun8i-a33-musb", }, 740 727 {} 741 728 }; 742 729