Re: [PATCH v2 2/4] usb: common: Move u_serial from gadget/function to usb/common

2017-08-08 Thread Lu Baolu
Hi,

On 08/08/2017 02:14 PM, Felipe Balbi wrote:
> Hi,
>
> Lu Baolu  writes:
>>> Lu Baolu  writes:
 The component u_serial provides a glue layer between TTY layer
 and a USB gadget device needed to provide a basic serial port
 functionality. Currently, u_serial sits under gadget/function
 and depends on CONFIG_USB_GADGET to be compiled and used.

 Most of the serial gadget devices are based on a UDC (USB device
 controller) and implemented by making use of the Linux gadget
 frameworks. But we are facing other implementions as well. One
 example can be found with xHCI debug capability. The xHCI debug
 capability implements a serial gadget with hardware and firmware,
 and provides an interface similar with xHCI host for submitting
 and reaping the transfer requests.

 In order to make better use of u_serial when implementing xHCI
 debug capability in xHCI driver, this patch moves u_serial.c
 from gadget/function to usb/common, and moves u_serial.h from
 gadget/function to include/linux/usb.

 Signed-off-by: Lu Baolu 
>>> NAK, u_serial uses the gadget API. It's definitely not COMMON.
>>>
>> Okay. It seems that I can't use u_serial anyway. I will implement
>> a new tty glue for my case.
> have you looked at drivers/usb/serial/?
>

Yes, I've checked that. I think usb-serial framework is too complex
for this case. XHCI debug capability is a simple gadget attached to
xHCI host.

Best regards,
Lu Baolu
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 2/4] usb: common: Move u_serial from gadget/function to usb/common

2017-08-08 Thread Felipe Balbi

Hi,

Lu Baolu  writes:
>> Lu Baolu  writes:
>>> The component u_serial provides a glue layer between TTY layer
>>> and a USB gadget device needed to provide a basic serial port
>>> functionality. Currently, u_serial sits under gadget/function
>>> and depends on CONFIG_USB_GADGET to be compiled and used.
>>>
>>> Most of the serial gadget devices are based on a UDC (USB device
>>> controller) and implemented by making use of the Linux gadget
>>> frameworks. But we are facing other implementions as well. One
>>> example can be found with xHCI debug capability. The xHCI debug
>>> capability implements a serial gadget with hardware and firmware,
>>> and provides an interface similar with xHCI host for submitting
>>> and reaping the transfer requests.
>>>
>>> In order to make better use of u_serial when implementing xHCI
>>> debug capability in xHCI driver, this patch moves u_serial.c
>>> from gadget/function to usb/common, and moves u_serial.h from
>>> gadget/function to include/linux/usb.
>>>
>>> Signed-off-by: Lu Baolu 
>> NAK, u_serial uses the gadget API. It's definitely not COMMON.
>>
>
> Okay. It seems that I can't use u_serial anyway. I will implement
> a new tty glue for my case.

have you looked at drivers/usb/serial/?

-- 
balbi
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 2/4] usb: common: Move u_serial from gadget/function to usb/common

2017-08-07 Thread Lu Baolu
Hi,

On 08/07/2017 04:13 PM, Felipe Balbi wrote:
> Hi,
>
> Lu Baolu  writes:
>> The component u_serial provides a glue layer between TTY layer
>> and a USB gadget device needed to provide a basic serial port
>> functionality. Currently, u_serial sits under gadget/function
>> and depends on CONFIG_USB_GADGET to be compiled and used.
>>
>> Most of the serial gadget devices are based on a UDC (USB device
>> controller) and implemented by making use of the Linux gadget
>> frameworks. But we are facing other implementions as well. One
>> example can be found with xHCI debug capability. The xHCI debug
>> capability implements a serial gadget with hardware and firmware,
>> and provides an interface similar with xHCI host for submitting
>> and reaping the transfer requests.
>>
>> In order to make better use of u_serial when implementing xHCI
>> debug capability in xHCI driver, this patch moves u_serial.c
>> from gadget/function to usb/common, and moves u_serial.h from
>> gadget/function to include/linux/usb.
>>
>> Signed-off-by: Lu Baolu 
> NAK, u_serial uses the gadget API. It's definitely not COMMON.
>

Okay. It seems that I can't use u_serial anyway. I will implement
a new tty glue for my case.

Best regards,
Lu Baolu
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 2/4] usb: common: Move u_serial from gadget/function to usb/common

2017-08-07 Thread Felipe Balbi

Hi,

Lu Baolu  writes:
> The component u_serial provides a glue layer between TTY layer
> and a USB gadget device needed to provide a basic serial port
> functionality. Currently, u_serial sits under gadget/function
> and depends on CONFIG_USB_GADGET to be compiled and used.
>
> Most of the serial gadget devices are based on a UDC (USB device
> controller) and implemented by making use of the Linux gadget
> frameworks. But we are facing other implementions as well. One
> example can be found with xHCI debug capability. The xHCI debug
> capability implements a serial gadget with hardware and firmware,
> and provides an interface similar with xHCI host for submitting
> and reaping the transfer requests.
>
> In order to make better use of u_serial when implementing xHCI
> debug capability in xHCI driver, this patch moves u_serial.c
> from gadget/function to usb/common, and moves u_serial.h from
> gadget/function to include/linux/usb.
>
> Signed-off-by: Lu Baolu 

NAK, u_serial uses the gadget API. It's definitely not COMMON.

-- 
balbi


signature.asc
Description: PGP signature


[PATCH v2 2/4] usb: common: Move u_serial from gadget/function to usb/common

2017-08-07 Thread Lu Baolu
The component u_serial provides a glue layer between TTY layer
and a USB gadget device needed to provide a basic serial port
functionality. Currently, u_serial sits under gadget/function
and depends on CONFIG_USB_GADGET to be compiled and used.

Most of the serial gadget devices are based on a UDC (USB device
controller) and implemented by making use of the Linux gadget
frameworks. But we are facing other implementions as well. One
example can be found with xHCI debug capability. The xHCI debug
capability implements a serial gadget with hardware and firmware,
and provides an interface similar with xHCI host for submitting
and reaping the transfer requests.

In order to make better use of u_serial when implementing xHCI
debug capability in xHCI driver, this patch moves u_serial.c
from gadget/function to usb/common, and moves u_serial.h from
gadget/function to include/linux/usb.

Signed-off-by: Lu Baolu 
---
 drivers/usb/Kconfig|3 +
 drivers/usb/Makefile   |3 +-
 drivers/usb/common/Makefile|1 +
 drivers/usb/common/u_serial.c  | 1604 +++
 drivers/usb/gadget/Kconfig |3 -
 drivers/usb/gadget/function/Makefile   |1 -
 drivers/usb/gadget/function/f_acm.c|4 +-
 drivers/usb/gadget/function/f_obex.c   |4 +-
 drivers/usb/gadget/function/f_serial.c |3 +-
 drivers/usb/gadget/function/u_serial.c | 1606 
 drivers/usb/gadget/function/u_serial.h |   71 --
 drivers/usb/gadget/legacy/acm_ms.c |3 +-
 drivers/usb/gadget/legacy/cdc2.c   |2 +-
 drivers/usb/gadget/legacy/dbgp.c   |3 +-
 drivers/usb/gadget/legacy/multi.c  |2 +-
 drivers/usb/gadget/legacy/nokia.c  |2 +-
 drivers/usb/gadget/legacy/serial.c |3 +-
 include/linux/usb/u_serial.h   |   71 ++
 18 files changed, 1689 insertions(+), 1700 deletions(-)
 create mode 100644 drivers/usb/common/u_serial.c
 delete mode 100644 drivers/usb/gadget/function/u_serial.c
 delete mode 100644 drivers/usb/gadget/function/u_serial.h
 create mode 100644 include/linux/usb/u_serial.h

diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index 939a63b..c39aceb 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -35,6 +35,9 @@ config USB_COMMON
 config USB_ARCH_HAS_HCD
def_bool y
 
+config USB_U_SERIAL
+   tristate
+
 config USB
tristate "Support for Host-side USB"
depends on USB_ARCH_HAS_HCD
diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile
index 9650b35..a3274aa 100644
--- a/drivers/usb/Makefile
+++ b/drivers/usb/Makefile
@@ -5,6 +5,7 @@
 # Object files in subdirectories
 
 obj-$(CONFIG_USB)  += core/
+obj-$(CONFIG_USB_COMMON)   += common/
 obj-$(CONFIG_USB_SUPPORT)  += phy/
 
 obj-$(CONFIG_USB_DWC3) += dwc3/
@@ -59,8 +60,6 @@ obj-$(CONFIG_USB_CHIPIDEA)+= chipidea/
 obj-$(CONFIG_USB_RENESAS_USBHS)+= renesas_usbhs/
 obj-$(CONFIG_USB_GADGET)   += gadget/
 
-obj-$(CONFIG_USB_COMMON)   += common/
-
 obj-$(CONFIG_USBIP_CORE)   += usbip/
 
 obj-$(CONFIG_TYPEC)+= typec/
diff --git a/drivers/usb/common/Makefile b/drivers/usb/common/Makefile
index 6bbb3ec..dff720b 100644
--- a/drivers/usb/common/Makefile
+++ b/drivers/usb/common/Makefile
@@ -8,3 +8,4 @@ usb-common-$(CONFIG_USB_LED_TRIG) += led.o
 
 obj-$(CONFIG_USB_OTG_FSM) += usb-otg-fsm.o
 obj-$(CONFIG_USB_ULPI_BUS) += ulpi.o
+obj-$(CONFIG_USB_U_SERIAL) += u_serial.o
diff --git a/drivers/usb/common/u_serial.c b/drivers/usb/common/u_serial.c
new file mode 100644
index 000..da09602
--- /dev/null
+++ b/drivers/usb/common/u_serial.c
@@ -0,0 +1,1604 @@
+/*
+ * u_serial.c - utilities for USB gadget "serial port"/TTY support
+ *
+ * Copyright (C) 2003 Al Borchers (alborch...@steinerpoint.com)
+ * Copyright (C) 2008 David Brownell
+ * Copyright (C) 2008 by Nokia Corporation
+ *
+ * This code also borrows from usbserial.c, which is
+ * Copyright (C) 1999 - 2002 Greg Kroah-Hartman (g...@kroah.com)
+ * Copyright (C) 2000 Peter Berger (pber...@brimson.com)
+ * Copyright (C) 2000 Al Borchers (alborch...@steinerpoint.com)
+ *
+ * This software is distributed under the terms of the GNU General
+ * Public License ("GPL") as published by the Free Software Foundation,
+ * either version 2 of that License or (at your option) any later version.
+ */
+
+/* #define VERBOSE_DEBUG */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/*
+ * This component encapsulates the TTY layer glue needed to provide basic
+ * "serial port" functionality through the USB gadget stack.  Each such
+ * port is exposed through a /dev/ttyGS* node.
+ *
+ * After this module has been loaded, the individual TTY port can be requested
+ * (gserial_alloc_line()) and it will stay available until they are removed
+ * (gserial_free_line()).