On Fri, Jul 28, 2017 at 05:51:16PM +0200, Michał Mirosław wrote: > On Fri, Jul 28, 2017 at 01:00:32PM +0300, Dmitry Osipenko wrote: > > 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 <treding@xxxxxxxxxx> > > >> > > >> 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 <treding@xxxxxxxxxx> > > >> [digetx@xxxxxxxxx: rebased patches and added DMA alignment quirk for Tegra20] > > >> Signed-off-by: Dmitry Osipenko <digetx@xxxxxxxxx> > > >> Acked-by: Peter Chen <peter.chen@xxxxxxx> > > > > > > This works on my Asus TF300T (Tegra3 device). Minor nit below. > > > > > > Tested-by: Michał Mirosław <mirq-linux@xxxxxxxxxxxx> (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 prefer this way too, and add CI_HDRC_REQUIRES_ALIGNED_DMA as platform flags for necessary SoCs. Peter > > > > I think a verbose approach is more preferable and it also more future proof > > since we may extend soc_info with other stuff later. > > I would just leave that to be done when it's needed. :-) > > Or you could just have udc_flags in struct tegra_udc_soc_info, so > that it would not need to be translated - again saving code, bugs > and future developers' time. > > Best Regards, > Michał Mirosław > -- > To unsubscribe from this list: send the line "unsubscribe linux-usb" in > the body of a message to majordomo@xxxxxxxxxxxxxxx > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Best Regards, Peter Chen -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html