Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1352699 > unrolled thread

[PATCH v3 0/7] usb: add support for Intel dual role port mux

Started byLu Baolu <baolu.lu@linux.intel.com>
First post2016-03-08 09:00 +0100
Last post2016-03-11 02:50 +0100
Articles 7 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v3 0/7] usb: add support for Intel dual role port mux Lu Baolu <baolu.lu@linux.intel.com> - 2016-03-08 09:00 +0100
    [PATCH v3 7/7] mfd: intel_vuport: Add Intel virtual USB port MFD Driver Lu Baolu <baolu.lu@linux.intel.com> - 2016-03-08 09:00 +0100
    [PATCH v3 1/7] extcon: usb-gpio: add device binding for platform device Lu Baolu <baolu.lu@linux.intel.com> - 2016-03-08 09:00 +0100
    [PATCH v3 2/7] extcon: usb-gpio: add support for ACPI gpio interface Lu Baolu <baolu.lu@linux.intel.com> - 2016-03-08 09:00 +0100
    Re: [PATCH v3 0/7] usb: add support for Intel dual role port mux Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-11 01:10 +0100
      Re: [PATCH v3 0/7] usb: add support for Intel dual role port mux Lu Baolu <baolu.lu@linux.intel.com> - 2016-03-11 01:30 +0100
        Re: [PATCH v3 0/7] usb: add support for Intel dual role port mux Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-11 02:50 +0100

#1352699 — [PATCH v3 0/7] usb: add support for Intel dual role port mux

FromLu Baolu <baolu.lu@linux.intel.com>
Date2016-03-08 09:00 +0100
Subject[PATCH v3 0/7] usb: add support for Intel dual role port mux
Message-ID<rakIG-6lY-9@gated-at.bofh.it>
Intel SOC chips are featured with USB dual role. The host role is
provided by Intel xHCI IP, and the gadget role is provided by IP
from designware. Tablet platform designs always share a single
port for both host and gadget controllers. There is a mux to
switch the port to the right controller according to the cable
type. OS needs to provide the callback to control the mux when
a plug-in event raises. The method to control the mux is platform
dependent. At least three types of implementation can be found
across current devices. 1) GPIO pins; 2) a unit which can be
controlled by memory mapped registers; 3) ACPI ASL code.

This patch series adds supports for Intel dual role port mux.
It includes:
(1) A helper layer on top of extcon for individual mux driver.
    It listens to the USB-HOST extcon cable and call the switch
    call-back when the cable state changes.
(2) Drivers for GPIO controlled port mux which could be found on
    Baytrail devices. A mfd driver is used to split the GPIOs into
    USB gpio extcon device and a USB mux device. Driver for USB
    gpio extcon device is already in upstream Linux. This patch
    series includes a driver for GPIO USB mux.
(3) Drivers for USB port mux controlled through memory mapped
    registers and the logic to create the mux device. This type
    of dual role port mux could be found in Cherry Trail and
    Broxton devices.

Lu Baolu (7):
  extcon: usb-gpio: add device binding for platform device
  extcon: usb-gpio: add support for ACPI gpio interface
  usb: mux: add common code for Intel dual role port mux
  usb: mux: add driver for Intel gpio controlled port mux
  usb: mux: add driver for Intel drcfg controlled port mux
  usb: pci-quirks: add Intel USB drcfg mux device
  mfd: intel_vuport: Add Intel virtual USB port MFD Driver

 Documentation/ABI/testing/sysfs-bus-platform |  15 +++
 MAINTAINERS                                  |  15 +++
 drivers/extcon/extcon-usb-gpio.c             |  10 +-
 drivers/mfd/Kconfig                          |   8 ++
 drivers/mfd/Makefile                         |   1 +
 drivers/mfd/intel-vuport.c                   |  74 ++++++++++++
 drivers/usb/Kconfig                          |   2 +
 drivers/usb/Makefile                         |   1 +
 drivers/usb/host/pci-quirks.c                |  47 +++++++-
 drivers/usb/host/xhci-ext-caps.h             |   2 +
 drivers/usb/mux/Kconfig                      |  25 ++++
 drivers/usb/mux/Makefile                     |   6 +
 drivers/usb/mux/intel-mux-drcfg.c            | 161 ++++++++++++++++++++++++++
 drivers/usb/mux/intel-mux-gpio.c             | 125 ++++++++++++++++++++
 drivers/usb/mux/intel-mux.c                  | 166 +++++++++++++++++++++++++++
 include/linux/usb/intel-mux.h                |  47 ++++++++
 16 files changed, 702 insertions(+), 3 deletions(-)
 create mode 100644 drivers/mfd/intel-vuport.c
 create mode 100644 drivers/usb/mux/Kconfig
 create mode 100644 drivers/usb/mux/Makefile
 create mode 100644 drivers/usb/mux/intel-mux-drcfg.c
 create mode 100644 drivers/usb/mux/intel-mux-gpio.c
 create mode 100644 drivers/usb/mux/intel-mux.c
 create mode 100644 include/linux/usb/intel-mux.h

Change log:
v2->v3:
 - uvport mfd driver got reviewed by Lee Jones, the following
   changes were made accordingly.
 - seperate uvport driver from the mux drivers in MAINTAINERS file
 - refine the description in Kconfig
 - refine the mfd_cell structure data

v1->v2:
 - move mux driver from drivers/usb/misc to drivers/usb/mux;
 - replace debugfs with sysfs for user level mux control;
 - remove unnecessary register restore if mux registeration failed;
 - Add "Acked-by: Chanwoo Choi <cw00.choi@samsung.com>" to extcon changes;
 - Make the file names and exported function names more specific;
 - Remove the usb_mux_get_dev() interface;
 - Move "struct intel_usb_mux" from .h to .c file;
 - Fix various kbuild robot warnings.
-- 
2.1.4

[toc] | [next] | [standalone]


#1352701 — [PATCH v3 7/7] mfd: intel_vuport: Add Intel virtual USB port MFD Driver

FromLu Baolu <baolu.lu@linux.intel.com>
Date2016-03-08 09:00 +0100
Subject[PATCH v3 7/7] mfd: intel_vuport: Add Intel virtual USB port MFD Driver
Message-ID<rakIH-6lY-21@gated-at.bofh.it>
In reply to#1352699
Some Intel platforms have an USB port mux controlled by GPIOs.
There's a single ACPI platform device that provides both USB ID
extcon device and a USB port mux device. This MFD driver will
split the 2 devices for their respective drivers.

Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Suggested-by: David Cohen <david.a.cohen@linux.intel.com>
Reviewed-by: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---
 MAINTAINERS                |  6 ++++
 drivers/mfd/Kconfig        |  8 +++++
 drivers/mfd/Makefile       |  1 +
 drivers/mfd/intel-vuport.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 89 insertions(+)
 create mode 100644 drivers/mfd/intel-vuport.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 399cefe..1486c80 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5599,6 +5599,12 @@ L:	linux-pm@vger.kernel.org
 S:	Supported
 F:	drivers/cpufreq/intel_pstate.c
 
+INTEL VIRTUAL USB PORT DRIVER
+M:	Lu Baolu <baolu.lu@linux.intel.com>
+L:	linux-usb@vger.kernel.org
+S:	Supported
+F:	drivers/mfd/intel-vuport.c
+
 INTEL FRAMEBUFFER DRIVER (excluding 810 and 815)
 M:	Maik Broemme <mbroemme@plusserver.de>
 L:	linux-fbdev@vger.kernel.org
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 9ca66de..48933d4 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -1534,5 +1534,13 @@ config MFD_VEXPRESS_SYSREG
 	  System Registers are the platform configuration block
 	  on the ARM Ltd. Versatile Express board.
 
+config MFD_INTEL_VUPORT
+	tristate "Intel virtual USB port controller"
+	select MFD_CORE
+	depends on X86 && ACPI
+	help
+	  Say Y here to enable support for Intel's dual role port mux
+	  controlled by GPIOs.
+
 endmenu
 endif
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 0f230a6..0ccd107 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -198,3 +198,4 @@ intel-soc-pmic-objs		:= intel_soc_pmic_core.o intel_soc_pmic_crc.o
 intel-soc-pmic-$(CONFIG_INTEL_PMC_IPC)	+= intel_soc_pmic_bxtwc.o
 obj-$(CONFIG_INTEL_SOC_PMIC)	+= intel-soc-pmic.o
 obj-$(CONFIG_MFD_MT6397)	+= mt6397-core.o
+obj-$(CONFIG_MFD_INTEL_VUPORT)	+= intel-vuport.o
diff --git a/drivers/mfd/intel-vuport.c b/drivers/mfd/intel-vuport.c
new file mode 100644
index 0000000..a07920f
--- /dev/null
+++ b/drivers/mfd/intel-vuport.c
@@ -0,0 +1,74 @@
+/*
+ * MFD driver for Intel virtual USB port
+ *
+ * Copyright(c) 2016 Intel Corporation.
+ * Author: Lu Baolu <baolu.lu@linux.intel.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/acpi.h>
+#include <linux/gpio.h>
+#include <linux/mfd/core.h>
+#include <linux/platform_device.h>
+
+/* ACPI GPIO Mappings */
+static const struct acpi_gpio_params id_gpio = { 0, 0, false };
+static const struct acpi_gpio_params vbus_gpio = { 1, 0, false };
+static const struct acpi_gpio_params mux_gpio = { 2, 0, false };
+static const struct acpi_gpio_mapping acpi_usb_gpios[] = {
+	{ "id-gpios", &id_gpio, 1 },
+	{ "vbus_en-gpios", &vbus_gpio, 1 },
+	{ "usb_mux-gpios", &mux_gpio, 1 },
+	{ },
+};
+
+static const struct mfd_cell intel_vuport_mfd_cells[] = {
+	{ .name = "extcon-usb-gpio", },
+	{ .name = "intel-mux-gpio", },
+};
+
+static int vuport_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	int ret;
+
+	ret = acpi_dev_add_driver_gpios(ACPI_COMPANION(dev), acpi_usb_gpios);
+	if (ret)
+		return ret;
+
+	return mfd_add_devices(&pdev->dev, 0, intel_vuport_mfd_cells,
+			ARRAY_SIZE(intel_vuport_mfd_cells), NULL, 0,
+			NULL);
+}
+
+static int vuport_remove(struct platform_device *pdev)
+{
+	mfd_remove_devices(&pdev->dev);
+	acpi_dev_remove_driver_gpios(ACPI_COMPANION(&pdev->dev));
+
+	return 0;
+}
+
+static struct acpi_device_id vuport_acpi_match[] = {
+	{ "INT3496" },
+	{ }
+};
+MODULE_DEVICE_TABLE(acpi, vuport_acpi_match);
+
+static struct platform_driver vuport_driver = {
+	.driver = {
+		.name = "intel-vuport",
+		.acpi_match_table = ACPI_PTR(vuport_acpi_match),
+	},
+	.probe = vuport_probe,
+	.remove = vuport_remove,
+};
+
+module_platform_driver(vuport_driver);
+
+MODULE_AUTHOR("Lu Baolu <baolu.lu@linux.intel.com>");
+MODULE_DESCRIPTION("Intel virtual USB port");
+MODULE_LICENSE("GPL v2");
-- 
2.1.4

[toc] | [prev] | [next] | [standalone]


#1352705 — [PATCH v3 1/7] extcon: usb-gpio: add device binding for platform device

FromLu Baolu <baolu.lu@linux.intel.com>
Date2016-03-08 09:00 +0100
Subject[PATCH v3 1/7] extcon: usb-gpio: add device binding for platform device
Message-ID<rakIH-6lY-31@gated-at.bofh.it>
In reply to#1352699
This is needed to handle the GPIO connected USB ID pin found on
Intel Baytrail devices.

Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Felipe Balbi <balbi@kernel.org>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
---
 drivers/extcon/extcon-usb-gpio.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/extcon/extcon-usb-gpio.c b/drivers/extcon/extcon-usb-gpio.c
index 2b2fecf..af9c8b0 100644
--- a/drivers/extcon/extcon-usb-gpio.c
+++ b/drivers/extcon/extcon-usb-gpio.c
@@ -206,6 +206,12 @@ static const struct of_device_id usb_extcon_dt_match[] = {
 };
 MODULE_DEVICE_TABLE(of, usb_extcon_dt_match);
 
+static const struct platform_device_id usb_extcon_platform_ids[] = {
+	{ .name = "extcon-usb-gpio", },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(platform, usb_extcon_platform_ids);
+
 static struct platform_driver usb_extcon_driver = {
 	.probe		= usb_extcon_probe,
 	.remove		= usb_extcon_remove,
@@ -214,6 +220,7 @@ static struct platform_driver usb_extcon_driver = {
 		.pm	= &usb_extcon_pm_ops,
 		.of_match_table = usb_extcon_dt_match,
 	},
+	.id_table = usb_extcon_platform_ids,
 };
 
 module_platform_driver(usb_extcon_driver);
-- 
2.1.4

[toc] | [prev] | [next] | [standalone]


#1352706 — [PATCH v3 2/7] extcon: usb-gpio: add support for ACPI gpio interface

FromLu Baolu <baolu.lu@linux.intel.com>
Date2016-03-08 09:00 +0100
Subject[PATCH v3 2/7] extcon: usb-gpio: add support for ACPI gpio interface
Message-ID<rakII-6lY-35@gated-at.bofh.it>
In reply to#1352699
GPIO resource could be retrieved through APCI as well.

Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Felipe Balbi <balbi@kernel.org>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
---
 drivers/extcon/extcon-usb-gpio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/extcon/extcon-usb-gpio.c b/drivers/extcon/extcon-usb-gpio.c
index af9c8b0..472c431 100644
--- a/drivers/extcon/extcon-usb-gpio.c
+++ b/drivers/extcon/extcon-usb-gpio.c
@@ -26,6 +26,7 @@
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 #include <linux/workqueue.h>
+#include <linux/acpi.h>
 
 #define USB_GPIO_DEBOUNCE_MS	20	/* ms */
 
@@ -91,7 +92,7 @@ static int usb_extcon_probe(struct platform_device *pdev)
 	struct usb_extcon_info *info;
 	int ret;
 
-	if (!np)
+	if (!np && !ACPI_HANDLE(dev))
 		return -EINVAL;
 
 	info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
-- 
2.1.4

[toc] | [prev] | [next] | [standalone]


#1355496

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2016-03-11 01:10 +0100
Message-ID<rbiOu-6er-17@gated-at.bofh.it>
In reply to#1352699
On Tue, Mar 08, 2016 at 03:53:41PM +0800, Lu Baolu wrote:
> Intel SOC chips are featured with USB dual role. The host role is
> provided by Intel xHCI IP, and the gadget role is provided by IP
> from designware. Tablet platform designs always share a single
> port for both host and gadget controllers. There is a mux to
> switch the port to the right controller according to the cable
> type. OS needs to provide the callback to control the mux when
> a plug-in event raises. The method to control the mux is platform
> dependent. At least three types of implementation can be found
> across current devices. 1) GPIO pins; 2) a unit which can be
> controlled by memory mapped registers; 3) ACPI ASL code.
> 
> This patch series adds supports for Intel dual role port mux.
> It includes:
> (1) A helper layer on top of extcon for individual mux driver.
>     It listens to the USB-HOST extcon cable and call the switch
>     call-back when the cable state changes.
> (2) Drivers for GPIO controlled port mux which could be found on
>     Baytrail devices. A mfd driver is used to split the GPIOs into
>     USB gpio extcon device and a USB mux device. Driver for USB
>     gpio extcon device is already in upstream Linux. This patch
>     series includes a driver for GPIO USB mux.
> (3) Drivers for USB port mux controlled through memory mapped
>     registers and the logic to create the mux device. This type
>     of dual role port mux could be found in Cherry Trail and
>     Broxton devices.
> 
> Lu Baolu (7):
>   extcon: usb-gpio: add device binding for platform device
>   extcon: usb-gpio: add support for ACPI gpio interface
>   usb: mux: add common code for Intel dual role port mux
>   usb: mux: add driver for Intel gpio controlled port mux
>   usb: mux: add driver for Intel drcfg controlled port mux
>   usb: pci-quirks: add Intel USB drcfg mux device
>   mfd: intel_vuport: Add Intel virtual USB port MFD Driver

You don't describe here what you changed from v2, or even from v1.
Please always be specific, we don't remember what your last submissions
looked like at all...

thanks,

greg k-h

[toc] | [prev] | [next] | [standalone]


#1355507

FromLu Baolu <baolu.lu@linux.intel.com>
Date2016-03-11 01:30 +0100
Message-ID<rbj7Q-6lH-7@gated-at.bofh.it>
In reply to#1355496

On 03/11/2016 08:03 AM, Greg Kroah-Hartman wrote:
> On Tue, Mar 08, 2016 at 03:53:41PM +0800, Lu Baolu wrote:
>> Intel SOC chips are featured with USB dual role. The host role is
>> provided by Intel xHCI IP, and the gadget role is provided by IP
>> from designware. Tablet platform designs always share a single
>> port for both host and gadget controllers. There is a mux to
>> switch the port to the right controller according to the cable
>> type. OS needs to provide the callback to control the mux when
>> a plug-in event raises. The method to control the mux is platform
>> dependent. At least three types of implementation can be found
>> across current devices. 1) GPIO pins; 2) a unit which can be
>> controlled by memory mapped registers; 3) ACPI ASL code.
>>
>> This patch series adds supports for Intel dual role port mux.
>> It includes:
>> (1) A helper layer on top of extcon for individual mux driver.
>>     It listens to the USB-HOST extcon cable and call the switch
>>     call-back when the cable state changes.
>> (2) Drivers for GPIO controlled port mux which could be found on
>>     Baytrail devices. A mfd driver is used to split the GPIOs into
>>     USB gpio extcon device and a USB mux device. Driver for USB
>>     gpio extcon device is already in upstream Linux. This patch
>>     series includes a driver for GPIO USB mux.
>> (3) Drivers for USB port mux controlled through memory mapped
>>     registers and the logic to create the mux device. This type
>>     of dual role port mux could be found in Cherry Trail and
>>     Broxton devices.
>>
>> Lu Baolu (7):
>>   extcon: usb-gpio: add device binding for platform device
>>   extcon: usb-gpio: add support for ACPI gpio interface
>>   usb: mux: add common code for Intel dual role port mux
>>   usb: mux: add driver for Intel gpio controlled port mux
>>   usb: mux: add driver for Intel drcfg controlled port mux
>>   usb: pci-quirks: add Intel USB drcfg mux device
>>   mfd: intel_vuport: Add Intel virtual USB port MFD Driver
> You don't describe here what you changed from v2, or even from v1.
> Please always be specific, we don't remember what your last submissions
> looked like at all...

I am sorry. I put the change log after file change summary.
I will move it up here next time.

Best regards,
Baolu

>
> thanks,
>
> greg k-h
>

[toc] | [prev] | [next] | [standalone]


#1355530

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2016-03-11 02:50 +0100
Message-ID<rbknf-79u-9@gated-at.bofh.it>
In reply to#1355507
On Fri, Mar 11, 2016 at 08:20:43AM +0800, Lu Baolu wrote:
> 
> 
> On 03/11/2016 08:03 AM, Greg Kroah-Hartman wrote:
> > On Tue, Mar 08, 2016 at 03:53:41PM +0800, Lu Baolu wrote:
> >> Intel SOC chips are featured with USB dual role. The host role is
> >> provided by Intel xHCI IP, and the gadget role is provided by IP
> >> from designware. Tablet platform designs always share a single
> >> port for both host and gadget controllers. There is a mux to
> >> switch the port to the right controller according to the cable
> >> type. OS needs to provide the callback to control the mux when
> >> a plug-in event raises. The method to control the mux is platform
> >> dependent. At least three types of implementation can be found
> >> across current devices. 1) GPIO pins; 2) a unit which can be
> >> controlled by memory mapped registers; 3) ACPI ASL code.
> >>
> >> This patch series adds supports for Intel dual role port mux.
> >> It includes:
> >> (1) A helper layer on top of extcon for individual mux driver.
> >>     It listens to the USB-HOST extcon cable and call the switch
> >>     call-back when the cable state changes.
> >> (2) Drivers for GPIO controlled port mux which could be found on
> >>     Baytrail devices. A mfd driver is used to split the GPIOs into
> >>     USB gpio extcon device and a USB mux device. Driver for USB
> >>     gpio extcon device is already in upstream Linux. This patch
> >>     series includes a driver for GPIO USB mux.
> >> (3) Drivers for USB port mux controlled through memory mapped
> >>     registers and the logic to create the mux device. This type
> >>     of dual role port mux could be found in Cherry Trail and
> >>     Broxton devices.
> >>
> >> Lu Baolu (7):
> >>   extcon: usb-gpio: add device binding for platform device
> >>   extcon: usb-gpio: add support for ACPI gpio interface
> >>   usb: mux: add common code for Intel dual role port mux
> >>   usb: mux: add driver for Intel gpio controlled port mux
> >>   usb: mux: add driver for Intel drcfg controlled port mux
> >>   usb: pci-quirks: add Intel USB drcfg mux device
> >>   mfd: intel_vuport: Add Intel virtual USB port MFD Driver
> > You don't describe here what you changed from v2, or even from v1.
> > Please always be specific, we don't remember what your last submissions
> > looked like at all...
> 
> I am sorry. I put the change log after file change summary.
> I will move it up here next time.

Ah, totally missed it, sorry about that am not expecting that below a
diffstat.

greg k-h

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web