Message ID | 20220607132204.746180-1-conor.dooley@microchip.com |
---|---|
Headers | show |
Series | Add support for PolarFire SoC's musb controller | expand |
On 07/06/2022 16:18, Ben Dooks wrote: > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe > > On 07/06/2022 14:22, Conor Dooley wrote: >> Add support for Microchips's PolarFire SoC's musb controller in host, >> peripheral and otg mode. >> >> Tested-by: Valentina Fernandez <valentina.fernandezalanis@microchip.com> >> Signed-off-by: Conor Dooley <conor.dooley@microchip.com> >> --- >> drivers/usb/musb/Kconfig | 13 +- >> drivers/usb/musb/Makefile | 1 + >> drivers/usb/musb/mpfs.c | 285 ++++++++++++++++++++++++++++++++++++++ >> 3 files changed, 298 insertions(+), 1 deletion(-) >> create mode 100644 drivers/usb/musb/mpfs.c >> ---8<--- >> + >> + platform_set_drvdata(pdev, glue); >> + >> + memset(musb_resources, 0x00, >> + sizeof(*musb_resources) * ARRAY_SIZE(musb_resources)); >> + >> + musb_resources[0].name = pdev->resource[0].name; >> + musb_resources[0].start = pdev->resource[0].start; >> + musb_resources[0].end = pdev->resource[0].end; >> + musb_resources[0].flags = pdev->resource[0].flags; >> + >> + musb_resources[1].name = pdev->resource[1].name; >> + musb_resources[1].start = pdev->resource[1].start; >> + musb_resources[1].end = pdev->resource[1].end; >> + musb_resources[1].flags = pdev->resource[1].flags; >> + >> + musb_resources[2].name = pdev->resource[2].name; >> + musb_resources[2].start = pdev->resource[2].start; >> + musb_resources[2].end = pdev->resource[2].end; >> + musb_resources[2].flags = pdev->resource[2].flags; > > I wonder if you could memcpy or just use compiler assignment for > these? > Looks like since we wrote the driver, Rob's changed all the others to do this more nicely: https://git.kernel.org/torvalds/c/9879c81b6807 >> + >> + ret = platform_device_add_resources(musb_pdev, musb_resources, >> + ARRAY_SIZE(musb_resources)); >> + if (ret) { >> + dev_err(dev, "failed to add resources\n"); >> + goto err_clk_disable; >> + } >> + >> + ret = platform_device_add_data(musb_pdev, pdata, sizeof(*pdata)); >> + if (ret) { >> + dev_err(dev, "failed to add platform_data\n"); >> + goto err_clk_disable; >> + } >> + >> + ret = platform_device_add(musb_pdev); >> + if (ret) { >> + dev_err(dev, "failed to register musb device\n"); >> + goto err_clk_disable; >> + } >> + >> + dev_info(&pdev->dev, "Registered MPFS MUSB driver\n"); >> + return 0; >> + >> +err_clk_disable: >> + clk_disable_unprepare(clk); >> + >> +err_phy_release: >> + usb_phy_generic_unregister(glue->phy); >> + platform_device_put(musb_pdev); >> + return ret; >> +} >> + >> +static int mpfs_remove(struct platform_device *pdev) >> +{ >> + struct mpfs_glue *glue = platform_get_drvdata(pdev); >> + >> + platform_device_unregister(glue->musb); >> + usb_phy_generic_unregister(pdev); >> + >> + return 0; >> +} >> + >> +#ifdef CONFIG_OF >> +static const struct of_device_id mpfs_id_table[] = { >> + { .compatible = "microchip,mpfs-musb" }, >> + { } >> +}; >> +MODULE_DEVICE_TABLE(of, mpfs_id_table); >> +#endif >> + >> +static struct platform_driver mpfs_musb_driver = { >> + .probe = mpfs_probe, >> + .remove = mpfs_remove, >> + .driver = { >> + .name = "mpfs-musb", >> + .of_match_table = of_match_ptr(mpfs_id_table) >> + }, >> +}; >> + >> +module_platform_driver(mpfs_musb_driver); >> + >> +MODULE_DESCRIPTION("PolarFire SoC MUSB Glue Layer"); >> +MODULE_LICENSE("GPL"); > > > -- > Ben Dooks http://www.codethink.co.uk/ > Senior Engineer Codethink - Providing Genius > > https://www.codethink.co.uk/privacy.html