On 28.07.2017 01:32, Michał Mirosław wrote:
> On Thu, Jul 27, 2017 at 07:46:07PM +0300, Dmitry Osipenko wrote:
>> From: Thierry Reding <[email protected]>
>>
>> All of these Tegra SoC generations have a ChipIdea UDC IP block that can
>> be used for device mode communication with a host. Implement rudimentary
>> support that doesn't allow switching between host and device modes.
>>
>> Signed-off-by: Thierry Reding <[email protected]>
>> [[email protected]: rebased patches and added DMA alignment quirk for Tegra20]
>> Signed-off-by: Dmitry Osipenko <[email protected]>
>> Acked-by: Peter Chen <[email protected]>
>
> This works on my Asus TF300T (Tegra3 device). Minor nit below.
>
> Tested-by: Michał Mirosław <[email protected]> (on tf300t)
>
Nice, thank you!
> [...]
>> diff --git a/drivers/usb/chipidea/ci_hdrc_tegra.c
>> b/drivers/usb/chipidea/ci_hdrc_tegra.c
>> new file mode 100644
>> index 000000000000..7814500e71fa
>> --- /dev/null
>> +++ b/drivers/usb/chipidea/ci_hdrc_tegra.c
>> @@ -0,0 +1,160 @@
> [...]
>> +struct tegra_udc_soc_info {
>> + bool supports_unaligned_dma;
>> +};
> [...]
>> +static const struct tegra_udc_soc_info tegra20_udc_soc_info = {
>> + .supports_unaligned_dma = false,
>> +};
>> +
>> +static const struct tegra_udc_soc_info tegra30_udc_soc_info = {
>> + .supports_unaligned_dma = true,
>> +};
>> +
>> +static const struct tegra_udc_soc_info tegra114_udc_soc_info = {
>> + .supports_unaligned_dma = true,
>> +};
>> +
>> +static const struct tegra_udc_soc_info tegra124_udc_soc_info = {
>> + .supports_unaligned_dma = true,
>> +};
>> +
>> +static const struct of_device_id tegra_udc_of_match[] = {
>> + {
>> + .compatible = "nvidia,tegra20-udc",
>> + .data = &tegra20_udc_soc_info,
>> + }, {
>> + .compatible = "nvidia,tegra30-udc",
>> + .data = &tegra30_udc_soc_info,
>> + }, {
>> + .compatible = "nvidia,tegra114-udc",
>> + .data = &tegra114_udc_soc_info,
>> + }, {
>> + .compatible = "nvidia,tegra124-udc",
>> + .data = &tegra124_udc_soc_info,
>> + }, {
>> + /* sentinel */
>> + }
>> +};
>> +MODULE_DEVICE_TABLE(of, tegra_udc_of_match);
> [...]
>> +static int tegra_udc_probe(struct platform_device *pdev)
>> +{
> [...]
>> + /* setup device specific quirks */
>> + soc = id->data;
>> +
>> + if (!soc->supports_unaligned_dma)
>> + udc->data.flags |= CI_HDRC_REQUIRES_ALIGNED_DMA;
> [...]
>
> Some lines would be saved if this was just:
>
> udc->data.flags |= id->data;
>
I think a verbose approach is more preferable and it also more future proof
since we may extend soc_info with other stuff later.
--
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html