public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: <Conor.Dooley@microchip.com>
To: <ben.dooks@codethink.co.uk>, <b-liu@ti.com>,
	<gregkh@linuxfoundation.org>
Cc: <Daire.McNamara@microchip.com>,
	<Valentina.FernandezAlanis@microchip.com>,
	<linux-kernel@vger.kernel.org>, <linux-usb@vger.kernel.org>,
	<linux-riscv@lists.infradead.org>
Subject: Re: [PATCH 1/3] usb: musb: Add support for PolarFire SoC's musb controller
Date: Sun, 12 Jun 2022 22:14:28 +0000	[thread overview]
Message-ID: <2858581a-59f2-0260-840e-137724f5d666@microchip.com> (raw)
In-Reply-To: <f4c2ad78-0b9e-c5da-e0a4-69f836e87b11@codethink.co.uk>

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


  reply	other threads:[~2022-06-12 22:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-07 13:22 [PATCH 0/3] Add support for PolarFire SoC's musb controller Conor Dooley
2022-06-07 13:22 ` [PATCH 1/3] usb: musb: " Conor Dooley
2022-06-07 15:18   ` Ben Dooks
2022-06-12 22:14     ` Conor.Dooley [this message]
2022-06-07 13:22 ` [PATCH 2/3] MAINTAINERS: add musb to PolarFire SoC entry Conor Dooley
2022-06-07 13:22 ` [PATCH 3/3] riscv: dts: microchip: fix icicle kit's dr_mode Conor Dooley
2022-06-08 12:21   ` Heinrich Schuchardt
2022-06-08 12:49     ` Conor.Dooley
2022-06-09  8:23       ` Conor.Dooley
2022-06-07 17:53 ` [PATCH 0/3] Add support for PolarFire SoC's musb controller Conor.Dooley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2858581a-59f2-0260-840e-137724f5d666@microchip.com \
    --to=conor.dooley@microchip.com \
    --cc=Daire.McNamara@microchip.com \
    --cc=Valentina.FernandezAlanis@microchip.com \
    --cc=b-liu@ti.com \
    --cc=ben.dooks@codethink.co.uk \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox