* [PATCH v2 0/8] Support UDC on Tegra 20/30/114/124
@ 2017-07-27 16:46 Dmitry Osipenko
[not found] ` <cover.1501173271.git.digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 14+ messages in thread
From: Dmitry Osipenko @ 2017-07-27 16:46 UTC (permalink / raw)
To: Thierry Reding, Felipe Balbi, Greg Kroah-Hartman, Peter Chen,
Jonathan Hunter, Stephen Warren
Cc: Marc Dietrich, Nicolas Chauvet, linux-usb-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA
Some time ago Thierry Reding sent out patches that enabled UDC on NVIDIA
Tegra, unfortunately they haven't got enough traction to get into the
kernel. I've rebased those patches and added a fix for the Ethernet USB
Gadget on Tegra20, Marc Dietrich tested UDC driver on AC100 and Nicolas
Chauvet on TK1. Like an original patchset, this series adds support for
the peripheral mode only.
Changelog:
V2:
1) Added comments to each of patched USB Ethernet gadget models.
2) Added explanatory comment about why usb_phy_set_suspend() invocation
is necessary in tegra_udc_probe().
3) Dropped TrimSlice from patchset because it turned out that it uses USB1
controller for USB-to-SATA.
4) Moved tegra_defconfig patch before DT patches as per Stephen's suggestion.
5) Changed dr_mode to "peripheral" in DT patches since we don't support role
mode switching for now.
Dmitry Osipenko (4):
usb: gadget: f_ecm/f_eem/f_rndis: Setup quirk_avoids_skb_reserve
usb: chipidea: udc: Support SKB alignment quirk
ARM: defconfig: tegra: Enable ChipIdea UDC driver
ARM: tegra: Enable UDC on AC100
Thierry Reding (4):
usb: chipidea: Add support for Tegra20/30/114/124
ARM: tegra: Enable UDC on Beaver
ARM: tegra: Enable UDC on Dalmore
ARM: tegra: Enable UDC on Jetson TK1
arch/arm/boot/dts/tegra114-dalmore.dts | 10 ++
arch/arm/boot/dts/tegra124-jetson-tk1.dts | 12 ++-
arch/arm/boot/dts/tegra20-paz00.dts | 2 +
arch/arm/boot/dts/tegra30-beaver.dts | 10 ++
arch/arm/configs/tegra_defconfig | 10 +-
drivers/usb/chipidea/Makefile | 1 +
drivers/usb/chipidea/ci_hdrc_tegra.c | 160 ++++++++++++++++++++++++++++++
drivers/usb/chipidea/udc.c | 3 +
drivers/usb/gadget/function/f_ecm.c | 7 ++
drivers/usb/gadget/function/f_eem.c | 5 +
drivers/usb/gadget/function/f_rndis.c | 4 +
include/linux/usb/chipidea.h | 1 +
12 files changed, 219 insertions(+), 6 deletions(-)
create mode 100644 drivers/usb/chipidea/ci_hdrc_tegra.c
--
2.13.3
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v2 1/8] usb: gadget: f_ecm/f_eem/f_rndis: Setup quirk_avoids_skb_reserve
[not found] ` <cover.1501173271.git.digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-07-27 16:46 ` Dmitry Osipenko
2017-07-27 16:46 ` [PATCH v2 2/8] usb: chipidea: udc: Support SKB alignment quirk Dmitry Osipenko
` (6 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: Dmitry Osipenko @ 2017-07-27 16:46 UTC (permalink / raw)
To: Thierry Reding, Felipe Balbi, Greg Kroah-Hartman, Peter Chen,
Jonathan Hunter, Stephen Warren
Cc: Marc Dietrich, Nicolas Chauvet, linux-usb-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA
This quirk is required to make USB Ethernet gadget working with HW that
can't cope with unaligned DMA. For some reason only f_ncm handles that
quirk, let's handle it in the rest of the network models. All models have
been tested with a ChipIdea UDC driver on NVIDIA Tegra20 SoC that require
DMA to be aligned.
Signed-off-by: Dmitry Osipenko <digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
drivers/usb/gadget/function/f_ecm.c | 7 +++++++
drivers/usb/gadget/function/f_eem.c | 5 +++++
drivers/usb/gadget/function/f_rndis.c | 4 ++++
3 files changed, 16 insertions(+)
diff --git a/drivers/usb/gadget/function/f_ecm.c b/drivers/usb/gadget/function/f_ecm.c
index 4c488d15b6f6..1d198055fd74 100644
--- a/drivers/usb/gadget/function/f_ecm.c
+++ b/drivers/usb/gadget/function/f_ecm.c
@@ -584,6 +584,13 @@ static int ecm_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
*/
ecm->port.is_zlp_ok =
gadget_is_zlp_supported(cdev->gadget);
+
+ /* Setup DMA alignment workaround for UDC's that
+ * need it.
+ */
+ ecm->port.no_skb_reserve =
+ gadget_avoids_skb_reserve(cdev->gadget);
+
ecm->port.cdc_filter = DEFAULT_FILTER;
DBG(cdev, "activate ecm\n");
net = gether_connect(&ecm->port);
diff --git a/drivers/usb/gadget/function/f_eem.c b/drivers/usb/gadget/function/f_eem.c
index 007ec6e4a5d4..74e2453d8ac5 100644
--- a/drivers/usb/gadget/function/f_eem.c
+++ b/drivers/usb/gadget/function/f_eem.c
@@ -215,6 +215,11 @@ static int eem_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
*/
eem->port.is_zlp_ok = 1;
eem->port.cdc_filter = DEFAULT_FILTER;
+
+ /* setup DMA alignment workaround for UDC's that*need it */
+ eem->port.no_skb_reserve =
+ gadget_avoids_skb_reserve(cdev->gadget);
+
DBG(cdev, "activate eem\n");
net = gether_connect(&eem->port);
if (IS_ERR(net))
diff --git a/drivers/usb/gadget/function/f_rndis.c b/drivers/usb/gadget/function/f_rndis.c
index 16562e461121..1b379c051a84 100644
--- a/drivers/usb/gadget/function/f_rndis.c
+++ b/drivers/usb/gadget/function/f_rndis.c
@@ -593,6 +593,10 @@ static int rndis_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
*/
rndis->port.cdc_filter = 0;
+ /* Setup DMA alignment workaround for UDC's that need it */
+ rndis->port.no_skb_reserve =
+ gadget_avoids_skb_reserve(cdev->gadget);
+
DBG(cdev, "RNDIS RX/TX early activation ... \n");
net = gether_connect(&rndis->port);
if (IS_ERR(net))
--
2.13.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 2/8] usb: chipidea: udc: Support SKB alignment quirk
[not found] ` <cover.1501173271.git.digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-07-27 16:46 ` [PATCH v2 1/8] usb: gadget: f_ecm/f_eem/f_rndis: Setup quirk_avoids_skb_reserve Dmitry Osipenko
@ 2017-07-27 16:46 ` Dmitry Osipenko
2017-07-27 16:46 ` [PATCH v2 3/8] usb: chipidea: Add support for Tegra20/30/114/124 Dmitry Osipenko
` (5 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: Dmitry Osipenko @ 2017-07-27 16:46 UTC (permalink / raw)
To: Thierry Reding, Felipe Balbi, Greg Kroah-Hartman, Peter Chen,
Jonathan Hunter, Stephen Warren
Cc: Marc Dietrich, Nicolas Chauvet, linux-usb-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA
NVIDIA Tegra20 UDC can't cope with unaligned DMA and require a USB gadget
quirk that avoids SKB buffer alignment to be set in order to make Ethernet
Gadget working. Later Tegra generations do not require that quirk. Let's
add a new platform data flag that allows to enable USB gadget quirk for
platforms that require it.
Signed-off-by: Dmitry Osipenko <digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Acked-by: Peter Chen <peter.chen-3arQi8VN3Tc@public.gmane.org>
---
drivers/usb/chipidea/udc.c | 3 +++
include/linux/usb/chipidea.h | 1 +
2 files changed, 4 insertions(+)
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index 6502c13331e8..fe8a90543ea3 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -1896,6 +1896,9 @@ static int udc_start(struct ci_hdrc *ci)
ci->gadget.name = ci->platdata->name;
ci->gadget.otg_caps = otg_caps;
+ if (ci->platdata->flags & CI_HDRC_REQUIRES_ALIGNED_DMA)
+ ci->gadget.quirk_avoids_skb_reserve = 1;
+
if (ci->is_otg && (otg_caps->hnp_support || otg_caps->srp_support ||
otg_caps->adp_support))
ci->gadget.is_otg = 1;
diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h
index c5fdfcf99828..d725cff7268d 100644
--- a/include/linux/usb/chipidea.h
+++ b/include/linux/usb/chipidea.h
@@ -58,6 +58,7 @@ struct ci_hdrc_platform_data {
#define CI_HDRC_OVERRIDE_TX_BURST BIT(10)
#define CI_HDRC_OVERRIDE_RX_BURST BIT(11)
#define CI_HDRC_OVERRIDE_PHY_CONTROL BIT(12) /* Glue layer manages phy */
+#define CI_HDRC_REQUIRES_ALIGNED_DMA BIT(13)
enum usb_dr_mode dr_mode;
#define CI_HDRC_CONTROLLER_RESET_EVENT 0
#define CI_HDRC_CONTROLLER_STOPPED_EVENT 1
--
2.13.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 3/8] usb: chipidea: Add support for Tegra20/30/114/124
[not found] ` <cover.1501173271.git.digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-07-27 16:46 ` [PATCH v2 1/8] usb: gadget: f_ecm/f_eem/f_rndis: Setup quirk_avoids_skb_reserve Dmitry Osipenko
2017-07-27 16:46 ` [PATCH v2 2/8] usb: chipidea: udc: Support SKB alignment quirk Dmitry Osipenko
@ 2017-07-27 16:46 ` Dmitry Osipenko
[not found] ` <f103baa439a64b517e6c8cb51c30e81987dfedb3.1501173271.git.digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-07-27 16:46 ` [PATCH v2 4/8] ARM: defconfig: tegra: Enable ChipIdea UDC driver Dmitry Osipenko
` (4 subsequent siblings)
7 siblings, 1 reply; 14+ messages in thread
From: Dmitry Osipenko @ 2017-07-27 16:46 UTC (permalink / raw)
To: Thierry Reding, Felipe Balbi, Greg Kroah-Hartman, Peter Chen,
Jonathan Hunter, Stephen Warren
Cc: Marc Dietrich, Nicolas Chauvet, linux-usb-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA, Thierry Reding
From: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
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-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
[digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org: rebased patches and added DMA alignment quirk for Tegra20]
Signed-off-by: Dmitry Osipenko <digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Acked-by: Peter Chen <peter.chen-3arQi8VN3Tc@public.gmane.org>
---
drivers/usb/chipidea/Makefile | 1 +
drivers/usb/chipidea/ci_hdrc_tegra.c | 160 +++++++++++++++++++++++++++++++++++
2 files changed, 161 insertions(+)
create mode 100644 drivers/usb/chipidea/ci_hdrc_tegra.c
diff --git a/drivers/usb/chipidea/Makefile b/drivers/usb/chipidea/Makefile
index 39fca5715ed3..ddcbddf8361a 100644
--- a/drivers/usb/chipidea/Makefile
+++ b/drivers/usb/chipidea/Makefile
@@ -15,3 +15,4 @@ obj-$(CONFIG_USB_CHIPIDEA) += ci_hdrc_zevio.o
obj-$(CONFIG_USB_CHIPIDEA_PCI) += ci_hdrc_pci.o
obj-$(CONFIG_USB_CHIPIDEA_OF) += usbmisc_imx.o ci_hdrc_imx.o
+obj-$(CONFIG_USB_CHIPIDEA_OF) += ci_hdrc_tegra.o
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 @@
+/*
+ * Copyright (c) 2016, NVIDIA Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ */
+
+#include <linux/clk.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/reset.h>
+
+#include <linux/usb/chipidea.h>
+
+#include "ci.h"
+
+struct tegra_udc_soc_info {
+ bool supports_unaligned_dma;
+};
+
+struct tegra_udc {
+ struct ci_hdrc_platform_data data;
+ struct platform_device *dev;
+
+ struct usb_phy *phy;
+ struct clk *clk;
+};
+
+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)
+{
+ const struct tegra_udc_soc_info *soc;
+ const struct of_device_id *id;
+ struct tegra_udc *udc;
+ int err;
+
+ udc = devm_kzalloc(&pdev->dev, sizeof(*udc), GFP_KERNEL);
+ if (!udc)
+ return -ENOMEM;
+
+ id = of_match_node(tegra_udc_of_match, pdev->dev.of_node);
+ if (!id)
+ return -ENODEV;
+
+ udc->phy = devm_usb_get_phy_by_phandle(&pdev->dev, "nvidia,phy", 0);
+ if (IS_ERR(udc->phy)) {
+ err = PTR_ERR(udc->phy);
+ dev_err(&pdev->dev, "failed to get PHY: %d\n", err);
+ return err;
+ }
+
+ udc->clk = devm_clk_get(&pdev->dev, NULL);
+ if (IS_ERR(udc->clk)) {
+ err = PTR_ERR(udc->clk);
+ dev_err(&pdev->dev, "failed to get clock: %d\n", err);
+ return err;
+ }
+
+ err = clk_prepare_enable(udc->clk);
+ if (err < 0) {
+ dev_err(&pdev->dev, "failed to enable clock: %d\n", err);
+ return err;
+ }
+
+ /* setup and register ChipIdea HDRC device */
+ udc->data.name = "tegra-udc";
+ udc->data.capoffset = DEF_CAPOFFSET;
+ udc->data.flags = 0;
+ udc->data.usb_phy = udc->phy;
+
+ /* setup device specific quirks */
+ soc = id->data;
+
+ if (!soc->supports_unaligned_dma)
+ udc->data.flags |= CI_HDRC_REQUIRES_ALIGNED_DMA;
+
+ /*
+ * Tegra's USB PHY driver doesn't implement optional phy_init()
+ * hook, so we have to power on UDC controller before ChipIdea
+ * driver initialization kicks in.
+ */
+ usb_phy_set_suspend(udc->phy, 0);
+
+ udc->dev = ci_hdrc_add_device(&pdev->dev, pdev->resource,
+ pdev->num_resources, &udc->data);
+ if (IS_ERR(udc->dev)) {
+ err = PTR_ERR(udc->dev);
+ dev_err(&pdev->dev, "failed to add HDRC device: %d\n", err);
+ goto power_off;
+ }
+
+ platform_set_drvdata(pdev, udc);
+
+ return 0;
+
+power_off:
+ usb_phy_set_suspend(udc->phy, 1);
+ clk_disable_unprepare(udc->clk);
+ return err;
+}
+
+static int tegra_udc_remove(struct platform_device *pdev)
+{
+ struct tegra_udc *udc = platform_get_drvdata(pdev);
+
+ usb_phy_set_suspend(udc->phy, 1);
+ clk_disable_unprepare(udc->clk);
+
+ return 0;
+}
+
+static struct platform_driver tegra_udc_driver = {
+ .driver = {
+ .name = "tegra-udc",
+ .of_match_table = tegra_udc_of_match,
+ },
+ .probe = tegra_udc_probe,
+ .remove = tegra_udc_remove,
+};
+module_platform_driver(tegra_udc_driver);
+
+MODULE_DESCRIPTION("NVIDIA Tegra USB device mode driver");
+MODULE_AUTHOR("Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>");
+MODULE_ALIAS("platform:tegra-udc");
+MODULE_LICENSE("GPL v2");
--
2.13.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 4/8] ARM: defconfig: tegra: Enable ChipIdea UDC driver
[not found] ` <cover.1501173271.git.digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
` (2 preceding siblings ...)
2017-07-27 16:46 ` [PATCH v2 3/8] usb: chipidea: Add support for Tegra20/30/114/124 Dmitry Osipenko
@ 2017-07-27 16:46 ` Dmitry Osipenko
2017-07-27 16:46 ` [PATCH v2 5/8] ARM: tegra: Enable UDC on Beaver Dmitry Osipenko
` (3 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: Dmitry Osipenko @ 2017-07-27 16:46 UTC (permalink / raw)
To: Thierry Reding, Felipe Balbi, Greg Kroah-Hartman, Peter Chen,
Jonathan Hunter, Stephen Warren
Cc: Marc Dietrich, Nicolas Chauvet, linux-usb-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA
Since NVIDIA Tegra is supported now by the ChipIdea USB driver, let's
enable this driver in tegra_defconfig.
Signed-off-by: Dmitry Osipenko <digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
arch/arm/configs/tegra_defconfig | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/arm/configs/tegra_defconfig b/arch/arm/configs/tegra_defconfig
index f0efc854b5a2..b0ebe6631602 100644
--- a/arch/arm/configs/tegra_defconfig
+++ b/arch/arm/configs/tegra_defconfig
@@ -121,7 +121,6 @@ CONFIG_TOUCHSCREEN_WM97XX=y
CONFIG_TOUCHSCREEN_STMPE=y
CONFIG_INPUT_MISC=y
# CONFIG_LEGACY_PTYS is not set
-# CONFIG_DEVKMEM is not set
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_SERIAL_OF_PLATFORM=y
@@ -218,6 +217,9 @@ CONFIG_USB_EHCI_TEGRA=y
CONFIG_USB_ACM=y
CONFIG_USB_WDM=y
CONFIG_USB_STORAGE=y
+CONFIG_USB_CHIPIDEA=m
+CONFIG_USB_CHIPIDEA_UDC=y
+CONFIG_USB_GADGET=m
CONFIG_MMC=y
CONFIG_MMC_BLOCK_MINORS=16
CONFIG_MMC_SDHCI=y
@@ -247,8 +249,6 @@ CONFIG_RTC_DRV_TEGRA=y
CONFIG_DMADEVICES=y
CONFIG_TEGRA20_APB_DMA=y
CONFIG_STAGING=y
-CONFIG_SENSORS_ISL29018=y
-CONFIG_SENSORS_ISL29028=y
CONFIG_MFD_NVEC=y
CONFIG_KEYBOARD_NVEC=y
CONFIG_SERIO_NVEC_PS2=y
@@ -263,6 +263,8 @@ CONFIG_ARCH_TEGRA_124_SOC=y
CONFIG_MEMORY=y
CONFIG_IIO=y
CONFIG_MPU3050_I2C=y
+CONFIG_SENSORS_ISL29018=y
+CONFIG_SENSORS_ISL29028=y
CONFIG_AK8975=y
CONFIG_PWM=y
CONFIG_PWM_TEGRA=y
@@ -288,13 +290,11 @@ CONFIG_NLS_CODEPAGE_437=y
CONFIG_NLS_ISO8859_1=y
CONFIG_PRINTK_TIME=y
CONFIG_DEBUG_INFO=y
-CONFIG_DEBUG_FS=y
CONFIG_MAGIC_SYSRQ=y
CONFIG_DEBUG_SLAB=y
CONFIG_DEBUG_VM=y
CONFIG_DETECT_HUNG_TASK=y
CONFIG_SCHEDSTATS=y
-CONFIG_TIMER_STATS=y
# CONFIG_DEBUG_PREEMPT is not set
CONFIG_DEBUG_MUTEXES=y
CONFIG_DEBUG_SG=y
--
2.13.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 5/8] ARM: tegra: Enable UDC on Beaver
[not found] ` <cover.1501173271.git.digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
` (3 preceding siblings ...)
2017-07-27 16:46 ` [PATCH v2 4/8] ARM: defconfig: tegra: Enable ChipIdea UDC driver Dmitry Osipenko
@ 2017-07-27 16:46 ` Dmitry Osipenko
2017-07-27 16:46 ` [PATCH v2 6/8] ARM: tegra: Enable UDC on Dalmore Dmitry Osipenko
` (2 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: Dmitry Osipenko @ 2017-07-27 16:46 UTC (permalink / raw)
To: Thierry Reding, Felipe Balbi, Greg Kroah-Hartman, Peter Chen,
Jonathan Hunter, Stephen Warren
Cc: Marc Dietrich, Nicolas Chauvet, linux-usb-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA, Thierry Reding
From: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Override the compatible string of the first USB controller to enable
device mode.
Signed-off-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Acked-by: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
arch/arm/boot/dts/tegra30-beaver.dts | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/arch/arm/boot/dts/tegra30-beaver.dts b/arch/arm/boot/dts/tegra30-beaver.dts
index 4f41b18d9547..3e104ddeb220 100644
--- a/arch/arm/boot/dts/tegra30-beaver.dts
+++ b/arch/arm/boot/dts/tegra30-beaver.dts
@@ -1927,6 +1927,16 @@
non-removable;
};
+ usb@7d000000 {
+ compatible = "nvidia,tegra30-udc";
+ status = "okay";
+ dr_mode = "peripheral";
+ };
+
+ usb-phy@7d000000 {
+ status = "okay";
+ };
+
usb@7d004000 {
status = "okay";
};
--
2.13.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 6/8] ARM: tegra: Enable UDC on Dalmore
[not found] ` <cover.1501173271.git.digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
` (4 preceding siblings ...)
2017-07-27 16:46 ` [PATCH v2 5/8] ARM: tegra: Enable UDC on Beaver Dmitry Osipenko
@ 2017-07-27 16:46 ` Dmitry Osipenko
2017-07-27 16:46 ` [PATCH v2 7/8] ARM: tegra: Enable UDC on Jetson TK1 Dmitry Osipenko
2017-07-27 16:46 ` [PATCH v2 8/8] ARM: tegra: Enable UDC on AC100 Dmitry Osipenko
7 siblings, 0 replies; 14+ messages in thread
From: Dmitry Osipenko @ 2017-07-27 16:46 UTC (permalink / raw)
To: Thierry Reding, Felipe Balbi, Greg Kroah-Hartman, Peter Chen,
Jonathan Hunter, Stephen Warren
Cc: Marc Dietrich, Nicolas Chauvet, linux-usb-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA, Thierry Reding
From: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Override the compatible string of the first USB controller to enable
device mode.
Signed-off-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
arch/arm/boot/dts/tegra114-dalmore.dts | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/arch/arm/boot/dts/tegra114-dalmore.dts b/arch/arm/boot/dts/tegra114-dalmore.dts
index 1444fbd543e7..5af4dd321952 100644
--- a/arch/arm/boot/dts/tegra114-dalmore.dts
+++ b/arch/arm/boot/dts/tegra114-dalmore.dts
@@ -1122,6 +1122,16 @@
non-removable;
};
+ usb@7d000000 {
+ compatible = "nvidia,tegra114-udc";
+ status = "okay";
+ dr_mode = "peripheral";
+ };
+
+ usb-phy@7d000000 {
+ status = "okay";
+ };
+
usb@7d008000 {
status = "okay";
};
--
2.13.3
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 7/8] ARM: tegra: Enable UDC on Jetson TK1
[not found] ` <cover.1501173271.git.digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
` (5 preceding siblings ...)
2017-07-27 16:46 ` [PATCH v2 6/8] ARM: tegra: Enable UDC on Dalmore Dmitry Osipenko
@ 2017-07-27 16:46 ` Dmitry Osipenko
2017-07-27 16:46 ` [PATCH v2 8/8] ARM: tegra: Enable UDC on AC100 Dmitry Osipenko
7 siblings, 0 replies; 14+ messages in thread
From: Dmitry Osipenko @ 2017-07-27 16:46 UTC (permalink / raw)
To: Thierry Reding, Felipe Balbi, Greg Kroah-Hartman, Peter Chen,
Jonathan Hunter, Stephen Warren
Cc: Marc Dietrich, Nicolas Chauvet, linux-usb-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA, Thierry Reding
From: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Override the compatible string of the first USB controller to enable
device mode.
Signed-off-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Tested-by: Nicolas Chauvet <kwizart-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Acked-by: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
arch/arm/boot/dts/tegra124-jetson-tk1.dts | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/arch/arm/boot/dts/tegra124-jetson-tk1.dts b/arch/arm/boot/dts/tegra124-jetson-tk1.dts
index 7bacb2954f58..61873d642a45 100644
--- a/arch/arm/boot/dts/tegra124-jetson-tk1.dts
+++ b/arch/arm/boot/dts/tegra124-jetson-tk1.dts
@@ -1722,7 +1722,7 @@
lanes {
usb2-0 {
- nvidia,function = "xusb";
+ nvidia,function = "snps";
status = "okay";
};
@@ -1829,6 +1829,16 @@
};
};
+ usb@7d000000 {
+ compatible = "nvidia,tegra124-udc";
+ status = "okay";
+ dr_mode = "peripheral";
+ };
+
+ usb-phy@7d000000 {
+ status = "okay";
+ };
+
/* mini-PCIe USB */
usb@7d004000 {
status = "okay";
--
2.13.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 8/8] ARM: tegra: Enable UDC on AC100
[not found] ` <cover.1501173271.git.digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
` (6 preceding siblings ...)
2017-07-27 16:46 ` [PATCH v2 7/8] ARM: tegra: Enable UDC on Jetson TK1 Dmitry Osipenko
@ 2017-07-27 16:46 ` Dmitry Osipenko
7 siblings, 0 replies; 14+ messages in thread
From: Dmitry Osipenko @ 2017-07-27 16:46 UTC (permalink / raw)
To: Thierry Reding, Felipe Balbi, Greg Kroah-Hartman, Peter Chen,
Jonathan Hunter, Stephen Warren
Cc: Marc Dietrich, Nicolas Chauvet, linux-usb-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA
Override the compatible string of the first USB controller to enable
device mode.
Signed-off-by: Dmitry Osipenko <digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Tested-by: Marc Dietrich <marvin24-Mmb7MZpHnFY@public.gmane.org>
Acked-by: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
arch/arm/boot/dts/tegra20-paz00.dts | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm/boot/dts/tegra20-paz00.dts b/arch/arm/boot/dts/tegra20-paz00.dts
index b4bfa5586c23..bfa9421fcf94 100644
--- a/arch/arm/boot/dts/tegra20-paz00.dts
+++ b/arch/arm/boot/dts/tegra20-paz00.dts
@@ -452,7 +452,9 @@
};
usb@c5000000 {
+ compatible = "nvidia,tegra20-udc";
status = "okay";
+ dr_mode = "peripheral";
};
usb-phy@c5000000 {
--
2.13.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH v2 3/8] usb: chipidea: Add support for Tegra20/30/114/124
[not found] ` <f103baa439a64b517e6c8cb51c30e81987dfedb3.1501173271.git.digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-07-27 22:32 ` Michał Mirosław
[not found] ` <20170727223223.ezyzvmum7c773vel-cHozx32mtrEEUmgCuDUIdw@public.gmane.org>
0 siblings, 1 reply; 14+ messages in thread
From: Michał Mirosław @ 2017-07-27 22:32 UTC (permalink / raw)
To: Dmitry Osipenko
Cc: Thierry Reding, Felipe Balbi, Greg Kroah-Hartman, Peter Chen,
Jonathan Hunter, Stephen Warren, Marc Dietrich, Nicolas Chauvet,
linux-usb-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA, Thierry Reding
On Thu, Jul 27, 2017 at 07:46:07PM +0300, Dmitry Osipenko wrote:
> From: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
>
> 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-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> [digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org: rebased patches and added DMA alignment quirk for Tegra20]
> Signed-off-by: Dmitry Osipenko <digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Acked-by: Peter Chen <peter.chen-3arQi8VN3Tc@public.gmane.org>
This works on my Asus TF300T (Tegra3 device). Minor nit below.
Tested-by: Michał Mirosław <mirq-linux-CoA6ZxLDdyEEUmgCuDUIdw@public.gmane.org> (on tf300t)
[...]
> 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;
Best Regards,
Michał Mirosław
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 3/8] usb: chipidea: Add support for Tegra20/30/114/124
[not found] ` <20170727223223.ezyzvmum7c773vel-cHozx32mtrEEUmgCuDUIdw@public.gmane.org>
@ 2017-07-28 10:00 ` Dmitry Osipenko
[not found] ` <832adea3-b5f2-a28c-6be4-0f572052821b-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 14+ messages in thread
From: Dmitry Osipenko @ 2017-07-28 10:00 UTC (permalink / raw)
To: Michał Mirosław
Cc: Thierry Reding, Felipe Balbi, Greg Kroah-Hartman, Peter Chen,
Jonathan Hunter, Stephen Warren, Marc Dietrich, Nicolas Chauvet,
linux-usb-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA, Thierry Reding
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-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
>>
>> 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-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
>> [digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org: rebased patches and added DMA alignment quirk for Tegra20]
>> Signed-off-by: Dmitry Osipenko <digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>> Acked-by: Peter Chen <peter.chen-3arQi8VN3Tc@public.gmane.org>
>
> This works on my Asus TF300T (Tegra3 device). Minor nit below.
>
> Tested-by: Michał Mirosław <mirq-linux-CoA6ZxLDdyEEUmgCuDUIdw@public.gmane.org> (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
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 3/8] usb: chipidea: Add support for Tegra20/30/114/124
[not found] ` <832adea3-b5f2-a28c-6be4-0f572052821b-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-07-28 15:51 ` Michał Mirosław
[not found] ` <20170728155115.kn2o7iei5yhzmpdq-cHozx32mtrEEUmgCuDUIdw@public.gmane.org>
0 siblings, 1 reply; 14+ messages in thread
From: Michał Mirosław @ 2017-07-28 15:51 UTC (permalink / raw)
To: Dmitry Osipenko
Cc: Thierry Reding, Felipe Balbi, Greg Kroah-Hartman, Peter Chen,
Jonathan Hunter, Stephen Warren, Marc Dietrich, Nicolas Chauvet,
linux-usb-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA, Thierry Reding
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-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> >>
> >> 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-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> >> [digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org: rebased patches and added DMA alignment quirk for Tegra20]
> >> Signed-off-by: Dmitry Osipenko <digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> >> Acked-by: Peter Chen <peter.chen-3arQi8VN3Tc@public.gmane.org>
> >
> > This works on my Asus TF300T (Tegra3 device). Minor nit below.
> >
> > Tested-by: Michał Mirosław <mirq-linux-CoA6ZxLDdyEEUmgCuDUIdw@public.gmane.org> (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.
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
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 3/8] usb: chipidea: Add support for Tegra20/30/114/124
[not found] ` <20170728155115.kn2o7iei5yhzmpdq-cHozx32mtrEEUmgCuDUIdw@public.gmane.org>
@ 2017-07-31 1:14 ` Peter Chen
2017-07-31 10:13 ` Dmitry Osipenko
0 siblings, 1 reply; 14+ messages in thread
From: Peter Chen @ 2017-07-31 1:14 UTC (permalink / raw)
To: Michał Mirosław
Cc: Dmitry Osipenko, Thierry Reding, Felipe Balbi, Greg Kroah-Hartman,
Peter Chen, Jonathan Hunter, Stephen Warren, Marc Dietrich,
Nicolas Chauvet, linux-usb-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA, Thierry Reding
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-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> > >>
> > >> 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-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> > >> [digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org: rebased patches and added DMA alignment quirk for Tegra20]
> > >> Signed-off-by: Dmitry Osipenko <digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> > >> Acked-by: Peter Chen <peter.chen-3arQi8VN3Tc@public.gmane.org>
> > >
> > > This works on my Asus TF300T (Tegra3 device). Minor nit below.
> > >
> > > Tested-by: Michał Mirosław <mirq-linux-CoA6ZxLDdyEEUmgCuDUIdw@public.gmane.org> (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-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Best Regards,
Peter Chen
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 3/8] usb: chipidea: Add support for Tegra20/30/114/124
2017-07-31 1:14 ` Peter Chen
@ 2017-07-31 10:13 ` Dmitry Osipenko
0 siblings, 0 replies; 14+ messages in thread
From: Dmitry Osipenko @ 2017-07-31 10:13 UTC (permalink / raw)
To: Peter Chen, Michał Mirosław
Cc: Thierry Reding, Felipe Balbi, Greg Kroah-Hartman, Peter Chen,
Jonathan Hunter, Stephen Warren, Marc Dietrich, Nicolas Chauvet,
linux-usb-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA, Thierry Reding
On 31.07.2017 04:14, Peter Chen wrote:
> 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-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
>>>>>
>>>>> 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-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
>>>>> [digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org: rebased patches and added DMA alignment quirk for Tegra20]
>>>>> Signed-off-by: Dmitry Osipenko <digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>>>>> Acked-by: Peter Chen <peter.chen-3arQi8VN3Tc@public.gmane.org>
>>>>
>>>> This works on my Asus TF300T (Tegra3 device). Minor nit below.
>>>>
>>>> Tested-by: Michał Mirosław <mirq-linux-CoA6ZxLDdyEEUmgCuDUIdw@public.gmane.org> (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.
>
Okay, please let me know if there are any other nitpicks.
--
Dmitry
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2017-07-31 10:13 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-27 16:46 [PATCH v2 0/8] Support UDC on Tegra 20/30/114/124 Dmitry Osipenko
[not found] ` <cover.1501173271.git.digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-07-27 16:46 ` [PATCH v2 1/8] usb: gadget: f_ecm/f_eem/f_rndis: Setup quirk_avoids_skb_reserve Dmitry Osipenko
2017-07-27 16:46 ` [PATCH v2 2/8] usb: chipidea: udc: Support SKB alignment quirk Dmitry Osipenko
2017-07-27 16:46 ` [PATCH v2 3/8] usb: chipidea: Add support for Tegra20/30/114/124 Dmitry Osipenko
[not found] ` <f103baa439a64b517e6c8cb51c30e81987dfedb3.1501173271.git.digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-07-27 22:32 ` Michał Mirosław
[not found] ` <20170727223223.ezyzvmum7c773vel-cHozx32mtrEEUmgCuDUIdw@public.gmane.org>
2017-07-28 10:00 ` Dmitry Osipenko
[not found] ` <832adea3-b5f2-a28c-6be4-0f572052821b-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-07-28 15:51 ` Michał Mirosław
[not found] ` <20170728155115.kn2o7iei5yhzmpdq-cHozx32mtrEEUmgCuDUIdw@public.gmane.org>
2017-07-31 1:14 ` Peter Chen
2017-07-31 10:13 ` Dmitry Osipenko
2017-07-27 16:46 ` [PATCH v2 4/8] ARM: defconfig: tegra: Enable ChipIdea UDC driver Dmitry Osipenko
2017-07-27 16:46 ` [PATCH v2 5/8] ARM: tegra: Enable UDC on Beaver Dmitry Osipenko
2017-07-27 16:46 ` [PATCH v2 6/8] ARM: tegra: Enable UDC on Dalmore Dmitry Osipenko
2017-07-27 16:46 ` [PATCH v2 7/8] ARM: tegra: Enable UDC on Jetson TK1 Dmitry Osipenko
2017-07-27 16:46 ` [PATCH v2 8/8] ARM: tegra: Enable UDC on AC100 Dmitry Osipenko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.