lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2858581a-59f2-0260-840e-137724f5d666@microchip.com>
Date:   Sun, 12 Jun 2022 22:14:28 +0000
From:   <Conor.Dooley@...rochip.com>
To:     <ben.dooks@...ethink.co.uk>, <b-liu@...com>,
        <gregkh@...uxfoundation.org>
CC:     <Daire.McNamara@...rochip.com>,
        <Valentina.FernandezAlanis@...rochip.com>,
        <linux-kernel@...r.kernel.org>, <linux-usb@...r.kernel.org>,
        <linux-riscv@...ts.infradead.org>
Subject: Re: [PATCH 1/3] usb: musb: Add support for PolarFire SoC's musb
 controller

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@...rochip.com>
>> Signed-off-by: Conor Dooley <conor.dooley@...rochip.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ