RE: [PATCH 00/19] usb: third series of updates for dwc2 driver
> -Original Message- > From: zhangfei [mailto:zhangfei@linaro.org] > Sent: Monday, March 16, 2015 3:26 AM > To: Kaukab, Yousaf; linux-usb@vger.kernel.org; ba...@ti.com; > john.y...@synopsys.com > Cc: Herrero, Gregory; r.bald...@samsung.com; > dingu...@opensource.altera.com > Subject: Re: [PATCH 00/19] usb: third series of updates for dwc2 driver > > > > On 03/09/2015 11:04 PM, Mian Yousaf Kaukab wrote: > > Hi, > > This patchset consists of some bug fixes and feature enhancements for > > the dwc2 driver. All the patches are verified on dwc2 v3.0a with > > dedicated fifos. Main focus of testing was with dma enabled. Although > > basic testing without dma was also done. > > > > This is based on testing/next branch in Felipe's git. > > Thanks Yousaf > Also verified on hikey board, dma mode, though it is also dwc2 v3.0a. Thank you for verifying this patch-set. Can I put your Tested-by on this series? BR, Yousaf -- 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: Possible no longer required cast in the function,usbhs_parse_dt in common.c
On Tue, Mar 17, 2015 at 03:37:42AM +, Peter Chen wrote: > > > > > Greetings All, > > I have been getting the below build warnings: > > drivers/usb/renesas_usbhs/common.c: In function ‘usbhs_parse_dt’: > > drivers/usb/renesas_usbhs/common.c:482:25: warning: cast from pointer to > > integer of different size [-Wpointer-to-int-cast] > > dparam->type = of_id ? (u32)of_id->data : 0; > > After looking into the function I am curious if the hardware is only 32 bit > > as if > > the supported hardware for this driver is then this cast is no longer > > required > > and I can send in a patch removing it. Furthermore, sorry for the simple > > question but I don't have access to the device specs for supported hardware > > so I though it would be better to ask before I send in patch fixing this > > issue. > > Thanks, > > Nick > > Patch is welcome, there will be comment if it is not suitable. Sorry, but no, a patch is not welcome from Nick. You all will note that Nick is banned from vger.kernel.org and I would recommend that everyone else on the cc: here also add him to their kill-files. It will make your life much easier. greg k-h -- 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 v4 1/1] extcon: usb-gpio: Introduce gpio usb extcon driver
Hi, On Tue, 2015-03-17 at 11:01 +0900, Chanwoo Choi wrote: > Hi Ivan, > > On 03/16/2015 11:23 PM, Ivan T. Ivanov wrote: > > Hi Roger, > > > > On Mon, 2015-03-16 at 15:11 +0200, Roger Quadros wrote: > > > Hi Ivan, > > > > > > On 16/03/15 14:32, Ivan T. Ivanov wrote: > > > > Hi, > > > > > > > > On Mon, 2015-02-02 at 12:21 +0200, Roger Quadros wrote: > > > > > This driver observes the USB ID pin connected over a GPIO and > > > > > updates the USB cable extcon states accordingly. > > > > > > > > > > The existing GPIO extcon driver is not suitable for this purpose > > > > > as it needs to be taught to understand USB cable states and it > > > > > can't handle more than one cable per instance. > > > > > > > > > > For the USB case we need to handle 2 cable states. > > > > > 1) USB (attach/detach) > > > > > 2) USB-HOST (attach/detach) > > > > > > > > > > This driver can be easily updated in the future to handle VBUS > > > > > events in case it happens to be available on GPIO for any platform. > > > > > > > > > > Signed-off-by: Roger Quadros > > > > > --- > > > > > v4: > > > > > - got rid of id_irqwake flag. Fail if enable/disable_irq_wake() fails > > > > > - changed host cable name to "USB-HOST" > > > > > > > > I am sorry that I am getting a bit little late into this. > > > > > > > > Isn't supposed that we have to use strings defined in > > > > const char extcon_cable_name[][]? > > > > > > > > > > > > > + > > > > > +/* List of detectable cables */ > > > > > +enum { > > > > > + EXTCON_CABLE_USB = 0, > > > > > + EXTCON_CABLE_USB_HOST, > > > > > + > > > > > > > > Same here: duplicated with enum extcon_cable_name > > > > > > > > > + EXTCON_CABLE_END, > > > > > +}; > > > > > + > > > > > +static const char *usb_extcon_cable[] = { > > > > > + [EXTCON_CABLE_USB] = "USB", > > > > > + [EXTCON_CABLE_USB_HOST] = "USB-HOST", > > > > > + NULL, > > > > > +}; > > > > > > I'm not exactly sure how else it is supposed to work if we > > > support only a subset of cables from the global extcon_cable_name[][]. > > > > I don't see issue that we use just 2 events. I think that we can > > reuse enum extcon_cable_name Now I see that extcon_dev_register() expect NULL terminated array of pointers, so it will not be possible to use enum extcon_cable_name as index in the above array, sorry. > > and strings already defined in > > extcon_cable_name[][] global variable. It is defined extern in > > extcon.h file exactly for this purpose, no? > > 'extcon_cable_name' global variable is not used on extcon driver directly. > It is just recommended cable name. Hm, this is what bothers me. How client drivers will know cable name if every provider start using its own naming scheme? If I write client driver I will use: extcon_register_interest(obj, name, extcon_cable_name[EXTCON_USB_HOST], nb); and this will now work with this driver because it define string differently. ... Well, I see that string is changed because your recommendation :-), then lets fix extcon_cable_name strings and not let drivers define its own names. > I have plan to use standard cable name for extcon driver instead of that > each extcon driver define the cable name. > Sound like a good plan :-) Regards, Ivan -- 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 v4 1/1] extcon: usb-gpio: Introduce gpio usb extcon driver
Fixed spelling error. On Tue, 2015-03-17 at 09:52 +0200, Ivan T. Ivanov wrote: > Hi, > > On Tue, 2015-03-17 at 11:01 +0900, Chanwoo Choi wrote: > > Hi Ivan, > > > > On 03/16/2015 11:23 PM, Ivan T. Ivanov wrote: > > > Hi Roger, > > > > > > On Mon, 2015-03-16 at 15:11 +0200, Roger Quadros wrote: > > > > Hi Ivan, > > > > > > > > On 16/03/15 14:32, Ivan T. Ivanov wrote: > > > > > Hi, > > > > > > > > > > On Mon, 2015-02-02 at 12:21 +0200, Roger Quadros wrote: > > > > > > This driver observes the USB ID pin connected over a GPIO and > > > > > > updates the USB cable extcon states accordingly. > > > > > > > > > > > > The existing GPIO extcon driver is not suitable for this purpose > > > > > > as it needs to be taught to understand USB cable states and it > > > > > > can't handle more than one cable per instance. > > > > > > > > > > > > For the USB case we need to handle 2 cable states. > > > > > > 1) USB (attach/detach) > > > > > > 2) USB-HOST (attach/detach) > > > > > > > > > > > > This driver can be easily updated in the future to handle VBUS > > > > > > events in case it happens to be available on GPIO for any platform. > > > > > > > > > > > > Signed-off-by: Roger Quadros > > > > > > --- > > > > > > v4: > > > > > > - got rid of id_irqwake flag. Fail if enable/disable_irq_wake() > > > > > > fails > > > > > > - changed host cable name to "USB-HOST" > > > > > > > > > > I am sorry that I am getting a bit little late into this. > > > > > > > > > > Isn't supposed that we have to use strings defined in > > > > > const char extcon_cable_name[][]? > > > > > > > > > > > > > > > > + > > > > > > +/* List of detectable cables */ > > > > > > +enum { > > > > > > + EXTCON_CABLE_USB = 0, > > > > > > + EXTCON_CABLE_USB_HOST, > > > > > > + > > > > > > > > > > Same here: duplicated with enum extcon_cable_name > > > > > > > > > > > + EXTCON_CABLE_END, > > > > > > +}; > > > > > > + > > > > > > +static const char *usb_extcon_cable[] = { > > > > > > + [EXTCON_CABLE_USB] = "USB", > > > > > > + [EXTCON_CABLE_USB_HOST] = "USB-HOST", > > > > > > + NULL, > > > > > > +}; > > > > > > > > I'm not exactly sure how else it is supposed to work if we > > > > support only a subset of cables from the global extcon_cable_name[][]. > > > > > > I don't see issue that we use just 2 events. I think that we can > > > reuse enum extcon_cable_name > > Now I see that extcon_dev_register() expect NULL terminated array of > pointers, so it will not be possible to use enum extcon_cable_name > as index in the above array, sorry. > > > > and strings already defined in > > > extcon_cable_name[][] global variable. It is defined extern in > > > extcon.h file exactly for this purpose, no? > > > > 'extcon_cable_name' global variable is not used on extcon driver directly. > > It is just recommended cable name. > > Hm, this is what bothers me. How client drivers will know cable name if > every provider start using its own naming scheme? > > If I write client driver I will use: > > extcon_register_interest(obj, name, extcon_cable_name[EXTCON_USB_HOST], nb); > > and this will now work with this driver because it define string differently. ^^^ s/now/not/ > > ... Well, I see that string is changed because your recommendation :-), > then lets fix extcon_cable_name strings and not let drivers define its own > names. > > > > I have plan to use standard cable name for extcon driver instead of that > > each extcon driver define the cable name. > > > > Sound like a good plan :-) > > Regards, > Ivan > > > -- 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 7/7] ARM: omap2plus_defconfig: Enable EXTCON_GPIO_USB
On 16/03/15 19:53, Tony Lindgren wrote: > * Roger Quadros [150126 04:19]: >> This driver is needed for USB cable type detection on dra7-evm, >> dra72-evm and am57xx-beagle-x15. >> >> Signed-off-by: Roger Quadros > > Applying this into omap-for-v4.1/defconfig. I think it's all > queued up after this, please check and repost patches if > it's still missing something as I've marked all the extcon > related threads as read here now. Thanks Tony. We just need to revert the following commit. addfcde7c485 ("ARM: dts: dra7x-evm: beagle-x15: Fix USB Host") I'll send a patch on l-o for that. cheers, -roger > > Regards, > > Tony > >> --- >> arch/arm/configs/omap2plus_defconfig | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/arch/arm/configs/omap2plus_defconfig >> b/arch/arm/configs/omap2plus_defconfig >> index 667d9d5..7e10e58 100644 >> --- a/arch/arm/configs/omap2plus_defconfig >> +++ b/arch/arm/configs/omap2plus_defconfig >> @@ -326,6 +326,7 @@ CONFIG_DMADEVICES=y >> CONFIG_TI_EDMA=y >> CONFIG_DMA_OMAP=y >> CONFIG_EXTCON=y >> +CONFIG_EXTCON_USB_GPIO=m >> CONFIG_EXTCON_PALMAS=y >> CONFIG_PWM=y >> CONFIG_PWM_TIECAP=y >> -- >> 2.1.0 >> -- 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
[PATCH V9 07/10] USB: f81232: implement set_termios()
The original driver had do not any h/w change in driver. This patch implements with configure H/W for baud/parity/word length/stop bits functional in f81232_set_termios(). This patch also implement DTR/RTS control when baudrate B0. We drop DTR/RTS when B0, otherwise enable it. We are checking baudrate in set_termios() too, If baudrate larger then 115200, it will be changed to 115200 and use tty_encode_baud_rate() to encode into tty Signed-off-by: Peter Hung --- drivers/usb/serial/f81232.c | 112 ++-- 1 file changed, 108 insertions(+), 4 deletions(-) diff --git a/drivers/usb/serial/f81232.c b/drivers/usb/serial/f81232.c index f0109a4..6be37f3 100644 --- a/drivers/usb/serial/f81232.c +++ b/drivers/usb/serial/f81232.c @@ -31,14 +31,19 @@ static const struct usb_device_id id_table[] = { }; MODULE_DEVICE_TABLE(usb, id_table); +/* Maximum baudrate for F81232 */ +#define F81232_MAX_BAUDRATE115200 + /* USB Control EP parameter */ #define F81232_REGISTER_REQUEST0xa0 #define F81232_GET_REGISTER0xc0 #define F81232_SET_REGISTER0x40 #define SERIAL_BASE_ADDRESS0x0120 +#define RECEIVE_BUFFER_REGISTER(0x00 + SERIAL_BASE_ADDRESS) #define INTERRUPT_ENABLE_REGISTER (0x01 + SERIAL_BASE_ADDRESS) #define FIFO_CONTROL_REGISTER (0x02 + SERIAL_BASE_ADDRESS) +#define LINE_CONTROL_REGISTER (0x03 + SERIAL_BASE_ADDRESS) #define MODEM_CONTROL_REGISTER (0x04 + SERIAL_BASE_ADDRESS) #define MODEM_STATUS_REGISTER (0x06 + SERIAL_BASE_ADDRESS) @@ -64,6 +69,11 @@ struct f81232_private { struct usb_serial_port *port; }; +static int calc_baud_divisor(speed_t baudrate) +{ + return DIV_ROUND_CLOSEST(F81232_MAX_BAUDRATE, baudrate); +} + static int f81232_get_register(struct usb_serial_port *port, u16 reg, u8 *val) { int status; @@ -350,6 +360,53 @@ static void f81232_break_ctl(struct tty_struct *tty, int break_state) */ } +static void f81232_set_baudrate(struct usb_serial_port *port, speed_t baudrate) +{ + u8 lcr; + int divisor, status = 0; + + divisor = calc_baud_divisor(baudrate); + + status = f81232_get_register(port, LINE_CONTROL_REGISTER, +&lcr); /* get LCR */ + if (status) { + dev_err(&port->dev, "%s failed to get LCR: %d\n", + __func__, status); + return; + } + + status = f81232_set_register(port, LINE_CONTROL_REGISTER, +lcr | UART_LCR_DLAB); /* Enable DLAB */ + if (status) { + dev_err(&port->dev, "%s failed to set DLAB: %d\n", + __func__, status); + return; + } + + status = f81232_set_register(port, RECEIVE_BUFFER_REGISTER, +divisor & 0x00ff); /* low */ + if (status) { + dev_err(&port->dev, "%s failed to set baudrate MSB: %d\n", + __func__, status); + goto reapply_lcr; + } + + status = f81232_set_register(port, INTERRUPT_ENABLE_REGISTER, +(divisor & 0xff00) >> 8); /* high */ + if (status) { + dev_err(&port->dev, "%s failed to set baudrate LSB: %d\n", + __func__, status); + } + +reapply_lcr: + status = f81232_set_register(port, LINE_CONTROL_REGISTER, + lcr & ~UART_LCR_DLAB); + if (status) { + dev_err(&port->dev, "%s failed to set DLAB: %d\n", + __func__, status); + } +} + static int f81232_port_enable(struct usb_serial_port *port) { u8 val; @@ -395,15 +452,62 @@ static int f81232_port_disable(struct usb_serial_port *port) static void f81232_set_termios(struct tty_struct *tty, struct usb_serial_port *port, struct ktermios *old_termios) { - /* FIXME - Stubbed out for now */ + u8 new_lcr = 0; + int status = 0; + speed_t baudrate; /* Don't change anything if nothing has changed */ if (old_termios && !tty_termios_hw_change(&tty->termios, old_termios)) return; - /* Do the real work here... */ - if (old_termios) - tty_termios_copy_hw(&tty->termios, old_termios); + if (C_BAUD(tty) == B0) + f81232_set_mctrl(port, 0, TIOCM_DTR | TIOCM_RTS); + else if (old_termios && (old_termios->c_cflag & CBAUD) == B0) + f81232_set_mctrl(port, TIOCM_DTR | TIOCM_RTS, 0); + + baudrate = tty_get_baud_rate(tty); + if (baudrate > 0) { + if (baudrate > F81232_MAX_BAUDRATE) { + baudrate = F81232_MAX_BAUDRATE; + tty_encode_baud_rate(tty, baudrate, baudrate); + } + f81232_set_baudrate(port, baudrate); + } + + if (C_PARENB(tty)) { + new_lcr |= UART_LCR
[PATCH V9 10/10] USB: f81232: modify/add author
Add me to co-author and fix no '>' in greg kh's email Signed-off-by: Peter Hung --- drivers/usb/serial/f81232.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/serial/f81232.c b/drivers/usb/serial/f81232.c index a0e0b9d..54cc707 100644 --- a/drivers/usb/serial/f81232.c +++ b/drivers/usb/serial/f81232.c @@ -688,5 +688,6 @@ static struct usb_serial_driver * const serial_drivers[] = { module_usb_serial_driver(serial_drivers, id_table); MODULE_DESCRIPTION("Fintek F81232 USB to serial adaptor driver"); -MODULE_AUTHOR("Greg Kroah-Hartman "); +MODULE_AUTHOR("Peter Hong "); MODULE_LICENSE("GPL v2"); -- 1.9.1 -- 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
[PATCH V9 09/10] USB: f81232: cleanup non-used define
We remove non-used define in this patch to avoid wrong usage. Signed-off-by: Peter Hung --- drivers/usb/serial/f81232.c | 14 -- 1 file changed, 14 deletions(-) diff --git a/drivers/usb/serial/f81232.c b/drivers/usb/serial/f81232.c index 0da16ce..a0e0b9d 100644 --- a/drivers/usb/serial/f81232.c +++ b/drivers/usb/serial/f81232.c @@ -47,20 +47,6 @@ MODULE_DEVICE_TABLE(usb, id_table); #define MODEM_CONTROL_REGISTER (0x04 + SERIAL_BASE_ADDRESS) #define MODEM_STATUS_REGISTER (0x06 + SERIAL_BASE_ADDRESS) -#define CONTROL_DTR0x01 -#define CONTROL_RTS0x02 - -#define UART_STATE 0x08 -#define UART_STATE_TRANSIENT_MASK 0x74 -#define UART_DCD 0x01 -#define UART_DSR 0x02 -#define UART_BREAK_ERROR 0x04 -#define UART_RING 0x08 -#define UART_FRAME_ERROR 0x10 -#define UART_PARITY_ERROR 0x20 -#define UART_OVERRUN_ERROR 0x40 -#define UART_CTS 0x80 - struct f81232_private { struct mutex lock; u8 modem_control; -- 1.9.1 -- 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
[PATCH V9 08/10] USB: f81232: clarify f81232_ioctl() and fix
We extract TIOCGSERIAL section in f81232_ioctl() to f81232_get_serial_info() to make it clarify. Also we fix device type from 16654 to 16550A, and set it's baud_base to 115200 (1.8432MHz/16). Signed-off-by: Peter Hung --- drivers/usb/serial/f81232.c | 30 +++--- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/drivers/usb/serial/f81232.c b/drivers/usb/serial/f81232.c index 6be37f3..0da16ce 100644 --- a/drivers/usb/serial/f81232.c +++ b/drivers/usb/serial/f81232.c @@ -600,24 +600,32 @@ static int f81232_carrier_raised(struct usb_serial_port *port) return 0; } +static int f81232_get_serial_info(struct usb_serial_port *port, + unsigned long arg) +{ + struct serial_struct ser; + + memset(&ser, 0, sizeof(ser)); + + ser.type = PORT_16550A; + ser.line = port->minor; + ser.port = port->port_number; + ser.baud_base = F81232_MAX_BAUDRATE; + + if (copy_to_user((void __user *)arg, &ser, sizeof(ser))) + return -EFAULT; + + return 0; +} + static int f81232_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { - struct serial_struct ser; struct usb_serial_port *port = tty->driver_data; switch (cmd) { case TIOCGSERIAL: - memset(&ser, 0, sizeof ser); - ser.type = PORT_16654; - ser.line = port->minor; - ser.port = port->port_number; - ser.baud_base = 460800; - - if (copy_to_user((void __user *)arg, &ser, sizeof ser)) - return -EFAULT; - - return 0; + return f81232_get_serial_info(port, arg); default: break; } -- 1.9.1 -- 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
[PATCH V9 06/10] USB: f81232: implement port enable/disable method
We put FCR/IER initial step to f81232_port_enable()/f81232_port_disable(). When port is open, it set MSR interrupt on. Otherwise set it off. Signed-off-by: Peter Hung --- drivers/usb/serial/f81232.c | 49 + 1 file changed, 49 insertions(+) diff --git a/drivers/usb/serial/f81232.c b/drivers/usb/serial/f81232.c index 28759a0..f0109a4 100644 --- a/drivers/usb/serial/f81232.c +++ b/drivers/usb/serial/f81232.c @@ -37,6 +37,8 @@ MODULE_DEVICE_TABLE(usb, id_table); #define F81232_SET_REGISTER0x40 #define SERIAL_BASE_ADDRESS0x0120 +#define INTERRUPT_ENABLE_REGISTER (0x01 + SERIAL_BASE_ADDRESS) +#define FIFO_CONTROL_REGISTER (0x02 + SERIAL_BASE_ADDRESS) #define MODEM_CONTROL_REGISTER (0x04 + SERIAL_BASE_ADDRESS) #define MODEM_STATUS_REGISTER (0x06 + SERIAL_BASE_ADDRESS) @@ -348,6 +350,48 @@ static void f81232_break_ctl(struct tty_struct *tty, int break_state) */ } +static int f81232_port_enable(struct usb_serial_port *port) +{ + u8 val; + int status; + + /* fifo on, trigger8, clear TX/RX*/ + val = UART_FCR_TRIGGER_8 | UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR | + UART_FCR_CLEAR_XMIT; + + status = f81232_set_register(port, FIFO_CONTROL_REGISTER, val); + if (status) { + dev_err(&port->dev, "%s failed to set FCR: %d\n", + __func__, status); + return status; + } + + /* MSR Interrupt only, LSR will read from Bulk-in odd byte */ + status = f81232_set_register(port, INTERRUPT_ENABLE_REGISTER, + UART_IER_MSI); + if (status) { + dev_err(&port->dev, "%s failed to set IER: %d\n", + __func__, status); + return status; + } + + return 0; +} + +static int f81232_port_disable(struct usb_serial_port *port) +{ + int status; + + status = f81232_set_register(port, INTERRUPT_ENABLE_REGISTER, 0); + if (status) { + dev_err(&port->dev, "%s failed to set IER: %d\n", + __func__, status); + return status; + } + + return 0; +} + static void f81232_set_termios(struct tty_struct *tty, struct usb_serial_port *port, struct ktermios *old_termios) { @@ -399,6 +443,10 @@ static int f81232_open(struct tty_struct *tty, struct usb_serial_port *port) { int result; + result = f81232_port_enable(port); + if (result) + return result; + /* Setup termios */ if (tty) f81232_set_termios(tty, port, NULL); @@ -421,6 +469,7 @@ static int f81232_open(struct tty_struct *tty, struct usb_serial_port *port) static void f81232_close(struct usb_serial_port *port) { + f81232_port_disable(port); usb_serial_generic_close(port); usb_kill_urb(port->interrupt_in_urb); } -- 1.9.1 -- 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
[PATCH V9 05/10] USB: f81232: implement MCR/MSR function
This patch implement relative MCR/MSR function, such like tiocmget()/tiocmset()/dtr_rts()/carrier_raised() original f81232_carrier_raised() compared with wrong value UART_DCD. It's should compared with UART_MSR_DCD. Signed-off-by: Peter Hung --- drivers/usb/serial/f81232.c | 139 +--- 1 file changed, 117 insertions(+), 22 deletions(-) diff --git a/drivers/usb/serial/f81232.c b/drivers/usb/serial/f81232.c index 1e1261f..28759a0 100644 --- a/drivers/usb/serial/f81232.c +++ b/drivers/usb/serial/f81232.c @@ -34,8 +34,10 @@ MODULE_DEVICE_TABLE(usb, id_table); /* USB Control EP parameter */ #define F81232_REGISTER_REQUEST0xa0 #define F81232_GET_REGISTER0xc0 +#define F81232_SET_REGISTER0x40 #define SERIAL_BASE_ADDRESS0x0120 +#define MODEM_CONTROL_REGISTER (0x04 + SERIAL_BASE_ADDRESS) #define MODEM_STATUS_REGISTER (0x06 + SERIAL_BASE_ADDRESS) #define CONTROL_DTR0x01 @@ -54,7 +56,7 @@ MODULE_DEVICE_TABLE(usb, id_table); struct f81232_private { struct mutex lock; - u8 line_control; + u8 modem_control; u8 modem_status; struct work_struct interrupt_work; struct usb_serial_port *port; @@ -95,6 +97,42 @@ static int f81232_get_register(struct usb_serial_port *port, u16 reg, u8 *val) return status; } +static int f81232_set_register(struct usb_serial_port *port, u16 reg, u8 val) +{ + int status; + u8 *tmp; + struct usb_device *dev = port->serial->dev; + + tmp = kmalloc(sizeof(val), GFP_KERNEL); + if (!tmp) + return -ENOMEM; + + *tmp = val; + + status = usb_control_msg(dev, + usb_sndctrlpipe(dev, 0), + F81232_REGISTER_REQUEST, + F81232_SET_REGISTER, + reg, + 0, + tmp, + sizeof(val), + USB_CTRL_SET_TIMEOUT); + if (status != sizeof(val)) { + dev_err(&port->dev, "%s failed status: %d\n", __func__, status); + + if (status < 0) + status = usb_translate_errors(status); + else + status = -EIO; + } else { + status = 0; + } + + kfree(tmp); + return status; +} + static void f81232_read_msr(struct usb_serial_port *port) { int status; @@ -139,6 +177,51 @@ static void f81232_read_msr(struct usb_serial_port *port) mutex_unlock(&priv->lock); } +static int f81232_set_mctrl(struct usb_serial_port *port, + unsigned int set, unsigned int clear) +{ + u8 val; + int status; + struct f81232_private *priv = usb_get_serial_port_data(port); + + if (((set | clear) & (TIOCM_DTR | TIOCM_RTS)) == 0) + return 0; /* no change */ + + /* 'set' takes precedence over 'clear' */ + clear &= ~set; + + /* force enable interrupt with OUT2 */ + mutex_lock(&priv->lock); + val = UART_MCR_OUT2 | priv->modem_control; + + if (clear & TIOCM_DTR) + val &= ~UART_MCR_DTR; + + if (clear & TIOCM_RTS) + val &= ~UART_MCR_RTS; + + if (set & TIOCM_DTR) + val |= UART_MCR_DTR; + + if (set & TIOCM_RTS) + val |= UART_MCR_RTS; + + dev_dbg(&port->dev, "%s new:%02x old:%02x\n", __func__, + val, priv->modem_control); + + status = f81232_set_register(port, MODEM_CONTROL_REGISTER, val); + if (status) { + dev_err(&port->dev, "%s set MCR status < 0\n", __func__); + mutex_unlock(&priv->lock); + return status; + } + + priv->modem_control = val; + mutex_unlock(&priv->lock); + + return 0; +} + static void f81232_update_line_status(struct usb_serial_port *port, unsigned char *data, size_t actual_length) @@ -254,12 +337,6 @@ static void f81232_process_read_urb(struct urb *urb) tty_flip_buffer_push(&port->port); } -static int set_control_lines(struct usb_device *dev, u8 value) -{ - /* FIXME - Stubbed out for now */ - return 0; -} - static void f81232_break_ctl(struct tty_struct *tty, int break_state) { /* FIXME - Stubbed out for now */ @@ -287,15 +364,35 @@ static void f81232_set_termios(struct tty_struct *tty, static int f81232_tiocmget(struct tty_struct *tty) { - /* FIXME - Stubbed out for now */ - return 0; + int r; + struct usb_serial_port *port = tty->driver_data; + struct f81232_private *port_priv = usb_get_serial_port_data(port); + u8 mcr, msr; + + /* force get current MSR changed state */ + f81232_r
[PATCH v1 00/20] usb: third series of updates for dwc2 driver
Hi, This patchset consists of some bug fixes and feature enhancements for the dwc2 driver. All the patches are verified on dwc2 v3.0a with dedicated fifos. Main focus of testing was with dma enabled. Although basic testing without dma was also done. This is based on testing/next branch in Felipe's git. Thank you, Best regards, Yousaf History: v1: - Fixed comments from John Youn and Robert Baldyga - Dropped all changes to pci.c due to http://permalink.gmane.org/gmane.linux.usb.general/123411 - Added patch to remove unnecessary EXPORT_SYMBOL_GPL calls Gregory Herrero (13): usb: dwc2: add controller hibernation support usb: dwc2: implement hibernation during bus suspend/resume usb: dwc2: controller must update lx_state before releasing lock usb: dwc2: add external_id_pin_ctl core parameter usb: dwc2: gadget: use reset detect interrupt usb: dwc2: gadget: ignore pm suspend/resume in L2 usb: dwc2: gadget: prevent new request submission during suspend usb: dwc2: gadget: powerup controller if needed usb: dwc2: gadget: enable otg flag in dual role configuration usb: dwc2: host: add bus_suspend/bus_resume callback usb: dwc2: host: resume root hub on port connect usb: dwc2: host: spinlock urb_enqueue usb: dwc2: host: don't use dma_alloc_coherent with irqs disabled Jingwu Lin (1): usb: dwc2: host: implement test mode Mian Yousaf Kaukab (6): usb: dwc2: move debugfs code to a separate file usb: dwc2: debugfs: add support for complete register dump usb: dwc2: set parameter values in probe function usb: dwc2: gadget: remove s3c_hsotg_ep_disable_force usb: dwc2: host: register handle to the phy usb: dwc2: remove dwc2_platform.ko drivers/usb/dwc2/Kconfig | 8 - drivers/usb/dwc2/Makefile| 9 +- drivers/usb/dwc2/core.c | 420 ++- drivers/usb/dwc2/core.h | 113 ++- drivers/usb/dwc2/core_intr.c | 44 ++- drivers/usb/dwc2/debug.h | 27 ++ drivers/usb/dwc2/debugfs.c | 770 +++ drivers/usb/dwc2/gadget.c| 459 +++--- drivers/usb/dwc2/hcd.c | 86 +++-- drivers/usb/dwc2/hcd.h | 7 +- drivers/usb/dwc2/hcd_intr.c | 13 + drivers/usb/dwc2/hcd_queue.c | 13 +- drivers/usb/dwc2/platform.c | 23 +- 13 files changed, 1491 insertions(+), 501 deletions(-) create mode 100644 drivers/usb/dwc2/debug.h create mode 100644 drivers/usb/dwc2/debugfs.c -- 1.9.1 -- 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
[PATCH v1 01/20] usb: dwc2: move debugfs code to a separate file
Prepare to add more debug code. Moreover, don't save dentry * for each file in struct dwc2_hsotg as clean up is done with debugfs_remove_recursive(). s3c_hsotg_delete_debug() is removed altogether for the same reason. Signed-off-by: Mian Yousaf Kaukab --- drivers/usb/dwc2/Makefile | 4 + drivers/usb/dwc2/core.h | 7 +- drivers/usb/dwc2/debug.h| 27 +++ drivers/usb/dwc2/debugfs.c | 416 drivers/usb/dwc2/gadget.c | 405 +- drivers/usb/dwc2/platform.c | 4 + 6 files changed, 456 insertions(+), 407 deletions(-) create mode 100644 drivers/usb/dwc2/debug.h create mode 100644 drivers/usb/dwc2/debugfs.c diff --git a/drivers/usb/dwc2/Makefile b/drivers/usb/dwc2/Makefile index 8f75267..147d759 100644 --- a/drivers/usb/dwc2/Makefile +++ b/drivers/usb/dwc2/Makefile @@ -13,6 +13,10 @@ ifneq ($(filter y,$(CONFIG_USB_DWC2_PERIPHERAL) $(CONFIG_USB_DWC2_DUAL_ROLE)),) dwc2-y += gadget.o endif +ifneq ($(CONFIG_DEBUG_FS),) + dwc2-y += debugfs.o +endif + # NOTE: The previous s3c-hsotg peripheral mode only driver has been moved to # this location and renamed gadget.c. When building for dynamically linked # modules, dwc2.ko will get built for host mode, peripheral mode, and dual-role diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index 836c012..3695c6f 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -615,9 +615,6 @@ struct dwc2_hsotg { enum dwc2_lx_state lx_state; struct dentry *debug_root; - struct dentry *debug_file; - struct dentry *debug_testmode; - struct dentry *debug_fifo; /* DWC OTG HW Release versions */ #define DWC2_CORE_REV_2_71a0x4f54271a @@ -1005,6 +1002,7 @@ extern void s3c_hsotg_core_init_disconnected(struct dwc2_hsotg *dwc2, bool reset); extern void s3c_hsotg_core_connect(struct dwc2_hsotg *hsotg); extern void s3c_hsotg_disconnect(struct dwc2_hsotg *dwc2); +extern int s3c_hsotg_set_test_mode(struct dwc2_hsotg *hsotg, int testmode); #else static inline int s3c_hsotg_remove(struct dwc2_hsotg *dwc2) { return 0; } @@ -1018,6 +1016,9 @@ static inline void s3c_hsotg_core_init_disconnected(struct dwc2_hsotg *dwc2, bool reset) {} static inline void s3c_hsotg_core_connect(struct dwc2_hsotg *hsotg) {} static inline void s3c_hsotg_disconnect(struct dwc2_hsotg *dwc2) {} +static inline int s3c_hsotg_set_test_mode(struct dwc2_hsotg *hsotg, + int testmode) +{ return 0; } #endif #if IS_ENABLED(CONFIG_USB_DWC2_HOST) || IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE) diff --git a/drivers/usb/dwc2/debug.h b/drivers/usb/dwc2/debug.h new file mode 100644 index 000..12dbd1d --- /dev/null +++ b/drivers/usb/dwc2/debug.h @@ -0,0 +1,27 @@ +/** + * debug.h - Designware USB2 DRD controller debug header + * + * Copyright (C) 2015 Intel Corporation + * Mian Yousaf Kaukab + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 of + * the License as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include "core.h" + +#ifdef CONFIG_DEBUG_FS +extern int dwc2_debugfs_init(struct dwc2_hsotg *); +extern void dwc2_debugfs_exit(struct dwc2_hsotg *); +#else +static inline int dwc2_debugfs_init(struct dwc2_hsotg *hsotg) +{ return 0; } +static inline void dwc2_debugfs_exit(struct dwc2_hsotg *hsotg) +{ } +#endif diff --git a/drivers/usb/dwc2/debugfs.c b/drivers/usb/dwc2/debugfs.c new file mode 100644 index 000..e57e554 --- /dev/null +++ b/drivers/usb/dwc2/debugfs.c @@ -0,0 +1,416 @@ +/** + * debugfs.c - Designware USB2 DRD controller debugfs + * + * Copyright (C) 2015 Intel Corporation + * Mian Yousaf Kaukab + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 of + * the License as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include + +#include "core.h" +#include "debug.h" + +#if IS_ENABLED(CONFIG_USB_DWC2_PERIPHERAL) || \ + IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE) +/** + * testmode_write - debugfs: change usb test mode + * @seq: The seq file to write to. + * @v: Unused parameter. + * + * This debugfs entry modify the current usb test mode. + */ +static ssize_t testm
[PATCH v1 18/20] usb: dwc2: host: don't use dma_alloc_coherent with irqs disabled
From: Gregory Herrero Align buffer must be allocated using kmalloc since irqs are disabled. Coherency is handled through dma_map_single which can be used with irqs disabled. Signed-off-by: Gregory Herrero --- drivers/usb/dwc2/hcd.c | 7 --- drivers/usb/dwc2/hcd_intr.c | 10 ++ drivers/usb/dwc2/hcd_queue.c | 7 --- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index fd2ad25..54f58c1 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -710,9 +710,7 @@ static int dwc2_hc_setup_align_buf(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh, /* 3072 = 3 max-size Isoc packets */ buf_size = 3072; - qh->dw_align_buf = dma_alloc_coherent(hsotg->dev, buf_size, - &qh->dw_align_buf_dma, - GFP_ATOMIC); + qh->dw_align_buf = kzalloc(buf_size, GFP_ATOMIC); if (!qh->dw_align_buf) return -ENOMEM; qh->dw_align_buf_size = buf_size; @@ -737,6 +735,9 @@ static int dwc2_hc_setup_align_buf(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh, } } + qh->dw_align_buf_dma = dma_map_single(hsotg->dev, + qh->dw_align_buf, qh->dw_align_buf_size, DMA_TO_DEVICE); + chan->align_buf = qh->dw_align_buf_dma; return 0; } diff --git a/drivers/usb/dwc2/hcd_intr.c b/drivers/usb/dwc2/hcd_intr.c index 6927bba..22f1476 100644 --- a/drivers/usb/dwc2/hcd_intr.c +++ b/drivers/usb/dwc2/hcd_intr.c @@ -468,6 +468,8 @@ static int dwc2_update_urb_state(struct dwc2_hsotg *hsotg, /* Non DWORD-aligned buffer case handling */ if (chan->align_buf && xfer_length && chan->ep_is_in) { dev_vdbg(hsotg->dev, "%s(): non-aligned buffer\n", __func__); + dma_unmap_single(hsotg->dev, chan->qh->dw_align_buf_dma, + chan->qh->dw_align_buf_size, DMA_FROM_DEVICE); memcpy(urb->buf + urb->actual_length, chan->qh->dw_align_buf, xfer_length); } @@ -559,6 +561,8 @@ static enum dwc2_halt_status dwc2_update_isoc_urb_state( chan->ep_is_in) { dev_vdbg(hsotg->dev, "%s(): non-aligned buffer\n", __func__); + dma_unmap_single(hsotg->dev, chan->qh->dw_align_buf_dma, + chan->qh->dw_align_buf_size, DMA_FROM_DEVICE); memcpy(urb->buf + frame_desc->offset + qtd->isoc_split_offset, chan->qh->dw_align_buf, frame_desc->actual_length); @@ -588,6 +592,8 @@ static enum dwc2_halt_status dwc2_update_isoc_urb_state( chan->ep_is_in) { dev_vdbg(hsotg->dev, "%s(): non-aligned buffer\n", __func__); + dma_unmap_single(hsotg->dev, chan->qh->dw_align_buf_dma, + chan->qh->dw_align_buf_size, DMA_FROM_DEVICE); memcpy(urb->buf + frame_desc->offset + qtd->isoc_split_offset, chan->qh->dw_align_buf, frame_desc->actual_length); @@ -926,6 +932,8 @@ static int dwc2_xfercomp_isoc_split_in(struct dwc2_hsotg *hsotg, if (chan->align_buf) { dev_vdbg(hsotg->dev, "%s(): non-aligned buffer\n", __func__); + dma_unmap_single(hsotg->dev, chan->qh->dw_align_buf_dma, + chan->qh->dw_align_buf_size, DMA_FROM_DEVICE); memcpy(qtd->urb->buf + frame_desc->offset + qtd->isoc_split_offset, chan->qh->dw_align_buf, len); } @@ -1155,6 +1163,8 @@ static void dwc2_update_urb_state_abn(struct dwc2_hsotg *hsotg, /* Non DWORD-aligned buffer case handling */ if (chan->align_buf && xfer_length && chan->ep_is_in) { dev_vdbg(hsotg->dev, "%s(): non-aligned buffer\n", __func__); + dma_unmap_single(hsotg->dev, chan->qh->dw_align_buf_dma, + chan->qh->dw_align_buf_size, DMA_FROM_DEVICE); memcpy(urb->buf + urb->actual_length, chan->qh->dw_align_buf, xfer_length); } diff --git a/drivers/usb/dwc2/hcd_queue.c b/drivers/usb/dwc2/hcd_queue.c index 02103b66..5f206ab 100644 --- a/drivers/usb/dwc2/hcd_queue.c +++ b/drivers/usb/dwc2/hcd_queue.c @@ -231,9 +231,10 @@ void dwc2_hcd_qh_free(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) { if (hsotg->core_params->dma_desc_enable > 0) dwc2_hcd_qh_free_ddma(hsotg, qh); - else if (qh->dw_align_buf) - dma_free_coherent(hsotg->dev, qh->dw_align_buf_size, - qh->dw_align_buf,
[PATCH v1 16/20] usb: dwc2: host: resume root hub on port connect
From: Gregory Herrero Once hub is runtime suspended, dwc2 must resume it on port connect event. Else, roothub will stay in suspended state and will not resume transfers. Signed-off-by: Gregory Herrero --- drivers/usb/dwc2/hcd_intr.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/dwc2/hcd_intr.c b/drivers/usb/dwc2/hcd_intr.c index 551ba87..6927bba 100644 --- a/drivers/usb/dwc2/hcd_intr.c +++ b/drivers/usb/dwc2/hcd_intr.c @@ -350,6 +350,9 @@ static void dwc2_port_intr(struct dwc2_hsotg *hsotg) dev_vdbg(hsotg->dev, "--Port Interrupt HPRT0=0x%08x Port Connect Detected--\n", hprt0); + if (hsotg->lx_state != DWC2_L0) + usb_hcd_resume_root_hub(hsotg->priv); + hsotg->flags.b.port_connect_status_change = 1; hsotg->flags.b.port_connect_status = 1; hprt0_modify |= HPRT0_CONNDET; -- 1.9.1 -- 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
[PATCH v1 14/20] usb: dwc2: host: register handle to the phy
If phy driver is present register hcd handle to it. Signed-off-by: Mian Yousaf Kaukab --- drivers/usb/dwc2/hcd.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index a387e9f..130e9a2 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -2907,6 +2907,9 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq) /* Don't support SG list at this point */ hcd->self.sg_tablesize = 0; + if (!IS_ERR_OR_NULL(hsotg->uphy)) + otg_set_host(hsotg->uphy->otg, &hcd->self); + /* * Finish generic HCD initialization and start the HCD. This function * allocates the DMA buffer pool, registers the USB bus, requests the @@ -2960,6 +2963,9 @@ void dwc2_hcd_remove(struct dwc2_hsotg *hsotg) return; } + if (!IS_ERR_OR_NULL(hsotg->uphy)) + otg_set_host(hsotg->uphy->otg, NULL); + usb_remove_hcd(hcd); hsotg->priv = NULL; dwc2_hcd_release(hsotg); -- 1.9.1 -- 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 3/3] ARM: mvebu: armada-385-ap: Enable USB3 port
On Tue, Mar 03, 2015 at 06:12:44PM +0200, Mathias Nyman wrote: > On 03.03.2015 11:59, Maxime Ripard wrote: > > On Mon, Mar 02, 2015 at 08:23:37PM +0100, Gregory CLEMENT wrote: > >> Hi Maxime, > >> > >> On 19/01/2015 14:01, Maxime Ripard wrote: > >>> The Armada 385 AP board has a USB3 port exposed that uses a GPIO to drive > >>> the > >>> VBUS line. Enable the needed drivers to support this. > >>> > >> > >> it seems that this patch was not applied yet. Patch 1 is now in > >> linux-next and should be part of 4.0-rc. But what about patch 2? > > > > IIRC, Greg or Matthias said that Matthias would look into these > > patches after the merge window. > > > > It still didn't happen though. > > > > Maxime > > > > Hi > > I understood that you wanted the first fix patch in as soon as possible so > I sent it forward to Greg, and it's now in his usb-linus branch. > > The other two patches, 2/3 and 3/3 you said were "regual" patches (for > usb-next?), > Andrew said he can take 3/3 and wondered if 2/3 and 3/3 need to go together? > > It doesn't matter for me, I can take 2/3 if you like, but I'd prefer if > someone > with more USB PHY insight could ack it first. There's been around two weeks, and we didn't have any additional reviews. How can we move forward on this? Thanks! Maxime -- Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com signature.asc Description: Digital signature
[PATCH v1 03/20] usb: dwc2: add controller hibernation support
From: Gregory Herrero When suspending usb bus, phy driver may disable controller power. In this case, registers need to be saved on suspend and restored on resume. Signed-off-by: Gregory Herrero --- drivers/usb/dwc2/core.c | 382 drivers/usb/dwc2/core.h | 84 +++ 2 files changed, 466 insertions(+) diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c index d5197d4..bf62d30 100644 --- a/drivers/usb/dwc2/core.c +++ b/drivers/usb/dwc2/core.c @@ -56,6 +56,388 @@ #include "core.h" #include "hcd.h" +#if IS_ENABLED(CONFIG_USB_DWC2_HOST) || IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE) +/** + * dwc2_backup_host_registers() - Backup controller host registers. + * When suspending usb bus, registers needs to be backuped + * if controller power is disabled once suspended. + * + * @hsotg: Programming view of the DWC_otg controller + */ +static int dwc2_backup_host_registers(struct dwc2_hsotg *hsotg) +{ + struct dwc2_hregs_backup *hr; + int i; + + dev_dbg(hsotg->dev, "%s\n", __func__); + + /* Backup Host regs */ + hr = hsotg->hr_backup; + if (!hr) { + hr = kmalloc(sizeof(*hr), GFP_KERNEL); + if (!hr) { + dev_err(hsotg->dev, "%s: can't allocate host regs\n", + __func__); + return -ENOMEM; + } + + hsotg->hr_backup = hr; + } + hr->hcfg = readl(hsotg->regs + HCFG); + hr->haintmsk = readl(hsotg->regs + HAINTMSK); + for (i = 0; i < hsotg->core_params->host_channels; ++i) + hr->hcintmsk[i] = readl(hsotg->regs + HCINTMSK(i)); + + hr->hprt0 = readl(hsotg->regs + HPRT0); + hr->hfir = readl(hsotg->regs + HFIR); + return 0; +} + +/** + * dwc2_restore_host_registers() - Restore controller host registers. + * When resuming usb bus, device registers needs to be restored + * if controller power were disabled. + * + * @hsotg: Programming view of the DWC_otg controller + */ +static int dwc2_restore_host_registers(struct dwc2_hsotg *hsotg) +{ + struct dwc2_hregs_backup *hr; + int i; + + dev_dbg(hsotg->dev, "%s\n", __func__); + + /* Restore host regs */ + hr = hsotg->hr_backup; + if (!hr) { + dev_err(hsotg->dev, "%s: no host registers to restore\n", + __func__); + return -EINVAL; + } + + writel(hr->hcfg, hsotg->regs + HCFG); + writel(hr->haintmsk, hsotg->regs + HAINTMSK); + + for (i = 0; i < hsotg->core_params->host_channels; ++i) + writel(hr->hcintmsk[i], hsotg->regs + HCINTMSK(i)); + + writel(hr->hprt0, hsotg->regs + HPRT0); + writel(hr->hfir, hsotg->regs + HFIR); + + kfree(hsotg->hr_backup); + + return 0; +} +#else +static inline int dwc2_backup_host_registers(struct dwc2_hsotg *hsotg) +{ return 0; } + +static inline int dwc2_restore_host_registers(struct dwc2_hsotg *hsotg) +{ return 0; } +#endif + +#if IS_ENABLED(CONFIG_USB_DWC2_PERIPHERAL) || \ + IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE) +/** + * dwc2_backup_device_registers() - Backup controller device registers. + * When suspending usb bus, registers needs to be backuped + * if controller power is disabled once suspended. + * + * @hsotg: Programming view of the DWC_otg controller + */ +static int dwc2_backup_device_registers(struct dwc2_hsotg *hsotg) +{ + struct dwc2_dregs_backup *dr; + int i; + + dev_dbg(hsotg->dev, "%s\n", __func__); + + /* Backup dev regs */ + dr = hsotg->dr_backup; + if (!dr) { + dr = kmalloc(sizeof(*dr), GFP_KERNEL); + if (!dr) { + dev_err(hsotg->dev, "%s: can't allocate device regs\n", + __func__); + return -ENOMEM; + } + + hsotg->dr_backup = dr; + } + + dr->dcfg = readl(hsotg->regs + DCFG); + dr->dctl = readl(hsotg->regs + DCTL); + dr->daintmsk = readl(hsotg->regs + DAINTMSK); + dr->diepmsk = readl(hsotg->regs + DIEPMSK); + dr->doepmsk = readl(hsotg->regs + DOEPMSK); + + for (i = 0; i < hsotg->num_of_eps; i++) { + /* Backup IN EPs */ + dr->diepctl[i] = readl(hsotg->regs + DIEPCTL(i)); + + /* Ensure DATA PID is correctly configured */ + if (dr->diepctl[i] & DXEPCTL_DPID) + dr->diepctl[i] |= DXEPCTL_SETD1PID; + else + dr->diepctl[i] |= DXEPCTL_SETD0PID; + + dr->dieptsiz[i] = readl(hsotg->regs + DIEPTSIZ(i)); + dr->diepdma[i] = readl(hsotg->regs + DIEPDMA(i)); + + /* Backup OUT EPs */ + dr->doepctl[i] = readl(hsotg->regs + DOEPCTL(i)); + + /* Ensure DATA PID is correctly configured */ + if (dr->doepctl[i] &
[PATCH v1 09/20] usb: dwc2: gadget: ignore pm suspend/resume in L2
From: Gregory Herrero Nothing to be done in pm suspend/resume when controller is in L2. Don't disconnect or reset. State is already saved when putting controller in hibernation and will be restored on USB bus resume. Signed-off-by: Gregory Herrero --- drivers/usb/dwc2/gadget.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index d528c02..539a3d4 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -3672,6 +3672,9 @@ int s3c_hsotg_suspend(struct dwc2_hsotg *hsotg) unsigned long flags; int ret = 0; + if (hsotg->lx_state != DWC2_L0) + return ret; + mutex_lock(&hsotg->init_mutex); if (hsotg->driver) { @@ -3712,6 +3715,9 @@ int s3c_hsotg_resume(struct dwc2_hsotg *hsotg) unsigned long flags; int ret = 0; + if (hsotg->lx_state == DWC2_L2) + return ret; + mutex_lock(&hsotg->init_mutex); if (hsotg->driver) { -- 1.9.1 -- 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
[PATCH v1 06/20] usb: dwc2: add external_id_pin_ctl core parameter
From: Gregory Herrero This is required due to an Intel specific hardware issue. Where id- pin setup causes glitches on the interrupt line when CONIDSTSCHG interrupt is enabled. Specify external_id_pin_ctl when an external driver (for example phy) can handle id change, so that CONIDSTSCHG interrupt can be disabled from the controller. Signed-off-by: Gregory Herrero --- drivers/usb/dwc2/core.c | 22 +- drivers/usb/dwc2/core.h | 6 ++ drivers/usb/dwc2/platform.c | 2 ++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c index bf62d30..e8e389f 100644 --- a/drivers/usb/dwc2/core.c +++ b/drivers/usb/dwc2/core.c @@ -459,8 +459,10 @@ static void dwc2_enable_common_interrupts(struct dwc2_hsotg *hsotg) if (hsotg->core_params->dma_enable <= 0) intmsk |= GINTSTS_RXFLVL; + if (hsotg->core_params->external_id_pin_ctl <= 0) + intmsk |= GINTSTS_CONIDSTSCHNG; - intmsk |= GINTSTS_CONIDSTSCHNG | GINTSTS_WKUPINT | GINTSTS_USBSUSP | + intmsk |= GINTSTS_WKUPINT | GINTSTS_USBSUSP | GINTSTS_SESSREQINT; writel(intmsk, hsotg->regs + GINTMSK); @@ -2984,6 +2986,23 @@ static void dwc2_set_param_uframe_sched(struct dwc2_hsotg *hsotg, int val) hsotg->core_params->uframe_sched = val; } +static void dwc2_set_param_external_id_pin_ctl(struct dwc2_hsotg *hsotg, + int val) +{ + if (DWC2_OUT_OF_BOUNDS(val, 0, 1)) { + if (val >= 0) { + dev_err(hsotg->dev, + "'%d' invalid for parameter external_id_pin_ctl\n", + val); + dev_err(hsotg->dev, "external_id_pin_ctl must be 0 or 1\n"); + } + val = 0; + dev_dbg(hsotg->dev, "Setting external_id_pin_ctl to %d\n", val); + } + + hsotg->core_params->external_id_pin_ctl = val; +} + /* * This function is called during module intialization to pass module parameters * for the DWC_otg core. @@ -3028,6 +3047,7 @@ void dwc2_set_parameters(struct dwc2_hsotg *hsotg, dwc2_set_param_ahbcfg(hsotg, params->ahbcfg); dwc2_set_param_otg_ver(hsotg, params->otg_ver); dwc2_set_param_uframe_sched(hsotg, params->uframe_sched); + dwc2_set_param_external_id_pin_ctl(hsotg, params->external_id_pin_ctl); } /** diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index e6abc28..e46304d 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -331,6 +331,11 @@ enum dwc2_ep0_state { * by the driver and are ignored in this * configuration value. * @uframe_sched: True to enable the microframe scheduler + * @external_id_pin_ctl: Specifies whether ID pin is handled externally. + * Disable CONIDSTSCHNG controller interrupt in such + * case. + * 0 - No (default) + * 1 - Yes * * The following parameters may be specified when starting the module. These * parameters define how the DWC_otg controller should be configured. A @@ -368,6 +373,7 @@ struct dwc2_core_params { int reload_ctl; int ahbcfg; int uframe_sched; + int external_id_pin_ctl; }; /** diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c index 4fb058b..ce39e8a0 100644 --- a/drivers/usb/dwc2/platform.c +++ b/drivers/usb/dwc2/platform.c @@ -77,6 +77,7 @@ static const struct dwc2_core_params params_bcm2835 = { .reload_ctl = 0, .ahbcfg = 0x10, .uframe_sched = 0, + .external_id_pin_ctl= -1, }; static const struct dwc2_core_params params_rk3066 = { @@ -105,6 +106,7 @@ static const struct dwc2_core_params params_rk3066 = { .reload_ctl = -1, .ahbcfg = 0x7, /* INCR16 */ .uframe_sched = -1, + .external_id_pin_ctl= -1, }; /** -- 1.9.1 -- 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
[PATCH v1 04/20] usb: dwc2: implement hibernation during bus suspend/resume
From: Gregory Herrero Allow controller to enter in hibernation during usb bus suspend and inform both phy and gadget about the suspended state. While in hibernation, the controller can't detect the resume condition. An external mechanism must call usb_phy_set_suspend on resume. Exit hibernation when controller gets the resume interrupt and inform only gadget driver about it. Signed-off-by: Gregory Herrero --- drivers/usb/dwc2/core.h | 2 ++ drivers/usb/dwc2/core_intr.c | 32 2 files changed, 34 insertions(+) diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index b0ee951..e6abc28 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -1088,6 +1088,7 @@ extern void s3c_hsotg_core_init_disconnected(struct dwc2_hsotg *dwc2, extern void s3c_hsotg_core_connect(struct dwc2_hsotg *hsotg); extern void s3c_hsotg_disconnect(struct dwc2_hsotg *dwc2); extern int s3c_hsotg_set_test_mode(struct dwc2_hsotg *hsotg, int testmode); +#define dwc2_is_device_connected(hsotg) (hsotg->connected) #else static inline int s3c_hsotg_remove(struct dwc2_hsotg *dwc2) { return 0; } @@ -1104,6 +1105,7 @@ static inline void s3c_hsotg_disconnect(struct dwc2_hsotg *dwc2) {} static inline int s3c_hsotg_set_test_mode(struct dwc2_hsotg *hsotg, int testmode) { return 0; } +#define dwc2_is_device_connected(hsotg) (0) #endif #if IS_ENABLED(CONFIG_USB_DWC2_HOST) || IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE) diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c index 02e3e2d..42f2fd5 100644 --- a/drivers/usb/dwc2/core_intr.c +++ b/drivers/usb/dwc2/core_intr.c @@ -334,6 +334,7 @@ static void dwc2_handle_session_req_intr(struct dwc2_hsotg *hsotg) */ static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg) { + int ret; dev_dbg(hsotg->dev, "++Resume or Remote Wakeup Detected Interrupt++\n"); dev_dbg(hsotg->dev, "%s lxstate = %d\n", __func__, hsotg->lx_state); @@ -345,6 +346,11 @@ static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg) /* Clear Remote Wakeup Signaling */ dctl &= ~DCTL_RMTWKUPSIG; writel(dctl, hsotg->regs + DCTL); + ret = dwc2_exit_hibernation(hsotg, true); + if (ret) + dev_err(hsotg->dev, "exit hibernation failed\n"); + + call_gadget(hsotg, resume); } /* Change to L0 state */ hsotg->lx_state = DWC2_L0; @@ -394,6 +400,7 @@ static void dwc2_handle_disconnect_intr(struct dwc2_hsotg *hsotg) static void dwc2_handle_usb_suspend_intr(struct dwc2_hsotg *hsotg) { u32 dsts; + int ret; dev_dbg(hsotg->dev, "USB SUSPEND\n"); @@ -408,6 +415,30 @@ static void dwc2_handle_usb_suspend_intr(struct dwc2_hsotg *hsotg) "DSTS.Suspend Status=%d HWCFG4.Power Optimize=%d\n", !!(dsts & DSTS_SUSPSTS), hsotg->hw_params.power_optimized); + if ((dsts & DSTS_SUSPSTS) && hsotg->hw_params.power_optimized) { + /* Ignore suspend request before enumeration */ + if (!dwc2_is_device_connected(hsotg)) { + dev_dbg(hsotg->dev, + "ignore suspend request before enumeration\n"); + goto clear_int; + } + + ret = dwc2_enter_hibernation(hsotg); + if (ret) { + dev_err(hsotg->dev, + "enter hibernation failed\n"); + goto skip_power_saving; + } + + udelay(100); + + /* Ask phy to be suspended */ + if (!IS_ERR_OR_NULL(hsotg->uphy)) + usb_phy_set_suspend(hsotg->uphy, true); +skip_power_saving: + /* Call gadget suspend callback */ + call_gadget(hsotg, suspend); + } } else { if (hsotg->op_state == OTG_STATE_A_PERIPHERAL) { dev_dbg(hsotg->dev, "a_peripheral->a_host\n"); @@ -423,6 +454,7 @@ static void dwc2_handle_usb_suspend_intr(struct dwc2_hsotg *hsotg) /* Change to L2 (suspend) state */ hsotg->lx_state = DWC2_L2; +clear_int: /* Clear interrupt */ writel(GINTSTS_USBSUSP, hsotg->regs + GINTSTS); } -- 1.9.1 -- 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
[PATCH v1 05/20] usb: dwc2: controller must update lx_state before releasing lock
From: Gregory Herrero During suspend, there could a race condition between ep_queue and suspend interrupt if lx_state is updated after releasing spinlock in call_gadget(hsotg, suspend). Signed-off-by: Gregory Herrero --- drivers/usb/dwc2/core_intr.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c index 42f2fd5..f5ef26e 100644 --- a/drivers/usb/dwc2/core_intr.c +++ b/drivers/usb/dwc2/core_intr.c @@ -436,6 +436,12 @@ static void dwc2_handle_usb_suspend_intr(struct dwc2_hsotg *hsotg) if (!IS_ERR_OR_NULL(hsotg->uphy)) usb_phy_set_suspend(hsotg->uphy, true); skip_power_saving: + /* +* Change to L2 (suspend) state before releasing +* spinlock +*/ + hsotg->lx_state = DWC2_L2; + /* Call gadget suspend callback */ call_gadget(hsotg, suspend); } @@ -443,6 +449,8 @@ skip_power_saving: if (hsotg->op_state == OTG_STATE_A_PERIPHERAL) { dev_dbg(hsotg->dev, "a_peripheral->a_host\n"); + /* Change to L2 (suspend) state */ + hsotg->lx_state = DWC2_L2; /* Clear the a_peripheral flag, back to a_host */ spin_unlock(&hsotg->lock); dwc2_hcd_start(hsotg); @@ -451,9 +459,6 @@ skip_power_saving: } } - /* Change to L2 (suspend) state */ - hsotg->lx_state = DWC2_L2; - clear_int: /* Clear interrupt */ writel(GINTSTS_USBSUSP, hsotg->regs + GINTSTS); -- 1.9.1 -- 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
[PATCH v1 20/20] usb: dwc2: remove dwc2_platform.ko
Ac dwc2 pci module is now exporting dwc2 platform device, include platform.o in dwc2-y and remove USB_DWC2_PLATFORM configuration option. Driver will be built as two modules, dwc2.ko and dwc2_pci.ko. dwc2.ko is the new platform driver. Remove all EXPORT_SYMBOL_GPL as they are not needed any more. Signed-off-by: Mian Yousaf Kaukab --- drivers/usb/dwc2/Kconfig | 8 drivers/usb/dwc2/Makefile| 5 + drivers/usb/dwc2/core.c | 3 --- drivers/usb/dwc2/core_intr.c | 1 - drivers/usb/dwc2/debugfs.c | 2 -- drivers/usb/dwc2/gadget.c| 5 - drivers/usb/dwc2/hcd.c | 2 -- 7 files changed, 1 insertion(+), 25 deletions(-) diff --git a/drivers/usb/dwc2/Kconfig b/drivers/usb/dwc2/Kconfig index 1bcb36a..fd95ba6 100644 --- a/drivers/usb/dwc2/Kconfig +++ b/drivers/usb/dwc2/Kconfig @@ -50,18 +50,10 @@ config USB_DWC2_DUAL_ROLE option requires USB_GADGET to be enabled. endchoice -config USB_DWC2_PLATFORM - tristate "DWC2 Platform" - default USB_DWC2_HOST || USB_DWC2_PERIPHERAL -help - The Designware USB2.0 platform interface module for - controllers directly connected to the CPU. - config USB_DWC2_PCI tristate "DWC2 PCI" depends on PCI default n - select USB_DWC2_PLATFORM select NOP_USB_XCEIV help The Designware USB2.0 PCI interface module for controllers diff --git a/drivers/usb/dwc2/Makefile b/drivers/usb/dwc2/Makefile index 147d759..1547002 100644 --- a/drivers/usb/dwc2/Makefile +++ b/drivers/usb/dwc2/Makefile @@ -2,7 +2,7 @@ ccflags-$(CONFIG_USB_DWC2_DEBUG)+= -DDEBUG ccflags-$(CONFIG_USB_DWC2_VERBOSE) += -DVERBOSE_DEBUG obj-$(CONFIG_USB_DWC2) += dwc2.o -dwc2-y := core.o core_intr.o +dwc2-y := core.o core_intr.o platform.o ifneq ($(filter y,$(CONFIG_USB_DWC2_HOST) $(CONFIG_USB_DWC2_DUAL_ROLE)),) dwc2-y += hcd.o hcd_intr.o @@ -27,6 +27,3 @@ ifneq ($(CONFIG_USB_DWC2_PCI),) obj-$(CONFIG_USB_DWC2) += dwc2_pci.o dwc2_pci-y := pci.o endif - -obj-$(CONFIG_USB_DWC2_PLATFORM)+= dwc2_platform.o -dwc2_platform-y:= platform.o diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c index a1eeebb..1df5803 100644 --- a/drivers/usb/dwc2/core.c +++ b/drivers/usb/dwc2/core.c @@ -3049,7 +3049,6 @@ void dwc2_set_parameters(struct dwc2_hsotg *hsotg, dwc2_set_param_uframe_sched(hsotg, params->uframe_sched); dwc2_set_param_external_id_pin_ctl(hsotg, params->external_id_pin_ctl); } -EXPORT_SYMBOL_GPL(dwc2_set_parameters); /** * During device initialization, read various hardware configuration @@ -3216,7 +3215,6 @@ int dwc2_get_hwparams(struct dwc2_hsotg *hsotg) return 0; } -EXPORT_SYMBOL_GPL(dwc2_get_hwparams); /* * Sets all parameters to the given value. @@ -3232,7 +3230,6 @@ void dwc2_set_all_params(struct dwc2_core_params *params, int value) for (i = 0; i < size; i++) p[i] = value; } -EXPORT_SYMBOL_GPL(dwc2_set_all_params); u16 dwc2_get_otg_version(struct dwc2_hsotg *hsotg) diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c index f5ef26e..e66eb38 100644 --- a/drivers/usb/dwc2/core_intr.c +++ b/drivers/usb/dwc2/core_intr.c @@ -556,4 +556,3 @@ out: spin_unlock(&hsotg->lock); return retval; } -EXPORT_SYMBOL_GPL(dwc2_handle_common_intr); diff --git a/drivers/usb/dwc2/debugfs.c b/drivers/usb/dwc2/debugfs.c index 2b9e1c2..b8b105e 100644 --- a/drivers/usb/dwc2/debugfs.c +++ b/drivers/usb/dwc2/debugfs.c @@ -762,11 +762,9 @@ err1: err0: return ret; } -EXPORT_SYMBOL_GPL(dwc2_debugfs_init); void dwc2_debugfs_exit(struct dwc2_hsotg *hsotg) { debugfs_remove_recursive(hsotg->debug_root); hsotg->debug_root = NULL; } -EXPORT_SYMBOL_GPL(dwc2_debugfs_exit); diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 7a83940..4bd9a4f 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -2190,7 +2190,6 @@ void s3c_hsotg_disconnect(struct dwc2_hsotg *hsotg) call_gadget(hsotg, disconnect); } -EXPORT_SYMBOL_GPL(s3c_hsotg_disconnect); /** * s3c_hsotg_irq_fifoempty - TX FIFO empty interrupt handler @@ -3666,7 +3665,6 @@ err_clk: return ret; } -EXPORT_SYMBOL_GPL(dwc2_gadget_init); /** * s3c_hsotg_remove - remove function for hsotg driver @@ -3679,7 +3677,6 @@ int s3c_hsotg_remove(struct dwc2_hsotg *hsotg) return 0; } -EXPORT_SYMBOL_GPL(s3c_hsotg_remove); int s3c_hsotg_suspend(struct dwc2_hsotg *hsotg) { @@ -3722,7 +3719,6 @@ int s3c_hsotg_suspend(struct dwc2_hsotg *hsotg) return ret; } -EXPORT_SYMBOL_GPL(s3c_hsotg_suspend); int s3c_hsotg_resume(struct dwc2_hsotg *hsotg) { @@ -3754,4 +3750,3 @@ int s3c_hsotg_resume(struct dwc2_hsotg *hsotg) return ret
[PATCH v1 13/20] usb: dwc2: gadget: remove s3c_hsotg_ep_disable_force
Force argument is not used anymore. Clean up leftovers from https://lkml.org/lkml/2014/12/9/283 Signed-off-by: Mian Yousaf Kaukab --- drivers/usb/dwc2/gadget.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 2e27bfd..7a83940 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -2763,7 +2763,7 @@ error: * s3c_hsotg_ep_disable - disable given endpoint * @ep: The endpoint to disable. */ -static int s3c_hsotg_ep_disable_force(struct usb_ep *ep, bool force) +static int s3c_hsotg_ep_disable(struct usb_ep *ep) { struct s3c_hsotg_ep *hs_ep = our_ep(ep); struct dwc2_hsotg *hsotg = hs_ep->parent; @@ -2806,10 +2806,6 @@ static int s3c_hsotg_ep_disable_force(struct usb_ep *ep, bool force) return 0; } -static int s3c_hsotg_ep_disable(struct usb_ep *ep) -{ - return s3c_hsotg_ep_disable_force(ep, false); -} /** * on_list - check request is on the given endpoint * @ep: The endpoint to check. -- 1.9.1 -- 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
[PATCH v1 15/20] usb: dwc2: host: add bus_suspend/bus_resume callback
From: Gregory Herrero Signed-off-by: Gregory Herrero --- drivers/usb/dwc2/hcd.c | 19 +++ 1 file changed, 19 insertions(+) diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index 130e9a2..23a8f2f 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -2305,6 +2305,22 @@ static void _dwc2_hcd_stop(struct usb_hcd *hcd) usleep_range(1000, 3000); } +static int _dwc2_hcd_suspend(struct usb_hcd *hcd) +{ + struct dwc2_hsotg *hsotg = dwc2_hcd_to_hsotg(hcd); + + hsotg->lx_state = DWC2_L2; + return 0; +} + +static int _dwc2_hcd_resume(struct usb_hcd *hcd) +{ + struct dwc2_hsotg *hsotg = dwc2_hcd_to_hsotg(hcd); + + hsotg->lx_state = DWC2_L0; + return 0; +} + /* Returns the current frame number */ static int _dwc2_hcd_get_frame_number(struct usb_hcd *hcd) { @@ -2675,6 +2691,9 @@ static struct hc_driver dwc2_hc_driver = { .hub_status_data = _dwc2_hcd_hub_status_data, .hub_control = _dwc2_hcd_hub_control, .clear_tt_buffer_complete = _dwc2_hcd_clear_tt_buffer_complete, + + .bus_suspend = _dwc2_hcd_suspend, + .bus_resume = _dwc2_hcd_resume, }; /* -- 1.9.1 -- 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
[PATCH v1 02/20] usb: dwc2: debugfs: add support for complete register dump
Dump all registers to take a complete snapshot of dwc2 state. Code is inspired by dwc3/debugfs.c Signed-off-by: Mian Yousaf Kaukab --- drivers/usb/dwc2/core.h| 1 + drivers/usb/dwc2/debugfs.c | 356 + 2 files changed, 357 insertions(+) diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index 3695c6f..1fd8d2b 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -615,6 +615,7 @@ struct dwc2_hsotg { enum dwc2_lx_state lx_state; struct dentry *debug_root; + struct debugfs_regset32 *regset; /* DWC OTG HW Release versions */ #define DWC2_CORE_REV_2_71a0x4f54271a diff --git a/drivers/usb/dwc2/debugfs.c b/drivers/usb/dwc2/debugfs.c index e57e554..2b9e1c2 100644 --- a/drivers/usb/dwc2/debugfs.c +++ b/drivers/usb/dwc2/debugfs.c @@ -391,9 +391,344 @@ static inline void s3c_hsotg_create_debug(struct dwc2_hsotg *hsotg) {} /* s3c_hsotg_delete_debug is removed as cleanup in done in dwc2_debugfs_exit */ +#define dump_register(nm) \ +{ \ + .name = #nm, \ + .offset = nm, \ +} + +static const struct debugfs_reg32 dwc2_regs[] = { + /* +* Accessing registers like this can trigger mode mismatch interrupt. +* However, according to dwc2 databook, the register access, in this +* case, is completed on the processor bus but is ignored by the core +* and does not affect its operation. +*/ + dump_register(GOTGCTL), + dump_register(GOTGINT), + dump_register(GAHBCFG), + dump_register(GUSBCFG), + dump_register(GRSTCTL), + dump_register(GINTSTS), + dump_register(GINTMSK), + dump_register(GRXSTSR), + dump_register(GRXSTSP), + dump_register(GRXFSIZ), + dump_register(GNPTXFSIZ), + dump_register(GNPTXSTS), + dump_register(GI2CCTL), + dump_register(GPVNDCTL), + dump_register(GGPIO), + dump_register(GUID), + dump_register(GSNPSID), + dump_register(GHWCFG1), + dump_register(GHWCFG2), + dump_register(GHWCFG3), + dump_register(GHWCFG4), + dump_register(GLPMCFG), + dump_register(GPWRDN), + dump_register(GDFIFOCFG), + dump_register(ADPCTL), + dump_register(HPTXFSIZ), + dump_register(DPTXFSIZN(1)), + dump_register(DPTXFSIZN(2)), + dump_register(DPTXFSIZN(3)), + dump_register(DPTXFSIZN(4)), + dump_register(DPTXFSIZN(5)), + dump_register(DPTXFSIZN(6)), + dump_register(DPTXFSIZN(7)), + dump_register(DPTXFSIZN(8)), + dump_register(DPTXFSIZN(9)), + dump_register(DPTXFSIZN(10)), + dump_register(DPTXFSIZN(11)), + dump_register(DPTXFSIZN(12)), + dump_register(DPTXFSIZN(13)), + dump_register(DPTXFSIZN(14)), + dump_register(DPTXFSIZN(15)), + dump_register(DCFG), + dump_register(DCTL), + dump_register(DSTS), + dump_register(DIEPMSK), + dump_register(DOEPMSK), + dump_register(DAINT), + dump_register(DAINTMSK), + dump_register(DTKNQR1), + dump_register(DTKNQR2), + dump_register(DTKNQR3), + dump_register(DTKNQR4), + dump_register(DVBUSDIS), + dump_register(DVBUSPULSE), + dump_register(DIEPCTL(0)), + dump_register(DIEPCTL(1)), + dump_register(DIEPCTL(2)), + dump_register(DIEPCTL(3)), + dump_register(DIEPCTL(4)), + dump_register(DIEPCTL(5)), + dump_register(DIEPCTL(6)), + dump_register(DIEPCTL(7)), + dump_register(DIEPCTL(8)), + dump_register(DIEPCTL(9)), + dump_register(DIEPCTL(10)), + dump_register(DIEPCTL(11)), + dump_register(DIEPCTL(12)), + dump_register(DIEPCTL(13)), + dump_register(DIEPCTL(14)), + dump_register(DIEPCTL(15)), + dump_register(DOEPCTL(0)), + dump_register(DOEPCTL(1)), + dump_register(DOEPCTL(2)), + dump_register(DOEPCTL(3)), + dump_register(DOEPCTL(4)), + dump_register(DOEPCTL(5)), + dump_register(DOEPCTL(6)), + dump_register(DOEPCTL(7)), + dump_register(DOEPCTL(8)), + dump_register(DOEPCTL(9)), + dump_register(DOEPCTL(10)), + dump_register(DOEPCTL(11)), + dump_register(DOEPCTL(12)), + dump_register(DOEPCTL(13)), + dump_register(DOEPCTL(14)), + dump_register(DOEPCTL(15)), + dump_register(DIEPINT(0)), + dump_register(DIEPINT(1)), + dump_register(DIEPINT(2)), + dump_register(DIEPINT(3)), + dump_register(DIEPINT(4)), + dump_register(DIEPINT(5)), + dump_register(DIEPINT(6)), + dump_register(DIEPINT(7)), + dump_register(DIEPINT(8)), + dump_register(DIEPINT(9)), + dump_register(DIEPINT(10)), + dump_register(DIEPINT(11)), + dump_register(DIEPINT(12)), + dump_register(DIEPINT(13)), + dump_register(DIEPINT(14)), + dum
[PATCH v1 17/20] usb: dwc2: host: spinlock urb_enqueue
From: Gregory Herrero During urb_enqueue, if the urb can't be queued to the endpoint, the urb is freed without any spinlock protection. This leads to memory corruption when concurrent urb_dequeue try to free same urb->hcpriv. Thus, ensure the whole urb_enqueue in spinlocked. Signed-off-by: Gregory Herrero --- drivers/usb/dwc2/hcd.c | 9 ++--- drivers/usb/dwc2/hcd_queue.c | 6 -- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index 23a8f2f..fd2ad25 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -354,7 +354,6 @@ static int dwc2_hcd_urb_enqueue(struct dwc2_hsotg *hsotg, gfp_t mem_flags) { struct dwc2_qtd *qtd; - unsigned long flags; u32 intr_mask; int retval; int dev_speed; @@ -405,11 +404,9 @@ static int dwc2_hcd_urb_enqueue(struct dwc2_hsotg *hsotg, */ return 0; - spin_lock_irqsave(&hsotg->lock, flags); tr_type = dwc2_hcd_select_transactions(hsotg); if (tr_type != DWC2_TRANSACTION_NONE) dwc2_hcd_queue_transactions(hsotg, tr_type); - spin_unlock_irqrestore(&hsotg->lock, flags); } return 0; @@ -2504,7 +2501,6 @@ static int _dwc2_hcd_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, spin_lock_irqsave(&hsotg->lock, flags); retval = usb_hcd_link_urb_to_ep(hcd, urb); - spin_unlock_irqrestore(&hsotg->lock, flags); if (retval) goto fail1; @@ -2513,17 +2509,16 @@ static int _dwc2_hcd_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, goto fail2; if (alloc_bandwidth) { - spin_lock_irqsave(&hsotg->lock, flags); dwc2_allocate_bus_bandwidth(hcd, dwc2_hcd_get_ep_bandwidth(hsotg, ep), urb); - spin_unlock_irqrestore(&hsotg->lock, flags); } + spin_unlock_irqrestore(&hsotg->lock, flags); + return 0; fail2: - spin_lock_irqsave(&hsotg->lock, flags); dwc2_urb->priv = NULL; usb_hcd_unlink_urb_from_ep(hcd, urb); spin_unlock_irqrestore(&hsotg->lock, flags); diff --git a/drivers/usb/dwc2/hcd_queue.c b/drivers/usb/dwc2/hcd_queue.c index bb97838..02103b66 100644 --- a/drivers/usb/dwc2/hcd_queue.c +++ b/drivers/usb/dwc2/hcd_queue.c @@ -777,7 +777,6 @@ int dwc2_hcd_qtd_add(struct dwc2_hsotg *hsotg, struct dwc2_qtd *qtd, struct dwc2_qh **qh, gfp_t mem_flags) { struct dwc2_hcd_urb *urb = qtd->urb; - unsigned long flags; int allocated = 0; int retval; @@ -792,7 +791,6 @@ int dwc2_hcd_qtd_add(struct dwc2_hsotg *hsotg, struct dwc2_qtd *qtd, allocated = 1; } - spin_lock_irqsave(&hsotg->lock, flags); retval = dwc2_hcd_qh_add(hsotg, *qh); if (retval) @@ -800,7 +798,6 @@ int dwc2_hcd_qtd_add(struct dwc2_hsotg *hsotg, struct dwc2_qtd *qtd, qtd->qh = *qh; list_add_tail(&qtd->qtd_list_entry, &(*qh)->qtd_list); - spin_unlock_irqrestore(&hsotg->lock, flags); return 0; @@ -817,10 +814,7 @@ fail: qtd_list_entry) dwc2_hcd_qtd_unlink_and_free(hsotg, qtd2, qh_tmp); - spin_unlock_irqrestore(&hsotg->lock, flags); dwc2_hcd_qh_free(hsotg, qh_tmp); - } else { - spin_unlock_irqrestore(&hsotg->lock, flags); } return retval; -- 1.9.1 -- 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
[PATCH v1 07/20] usb: dwc2: set parameter values in probe function
So the parameters can be used in both host and gadget modes. Also consolidate param functions in the core.h Signed-off-by: Mian Yousaf Kaukab --- drivers/usb/dwc2/core.c | 19 +++ drivers/usb/dwc2/core.h | 13 ++--- drivers/usb/dwc2/hcd.c | 34 +- drivers/usb/dwc2/hcd.h | 7 +-- drivers/usb/dwc2/platform.c | 17 - 5 files changed, 47 insertions(+), 43 deletions(-) diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c index e8e389f..a1eeebb 100644 --- a/drivers/usb/dwc2/core.c +++ b/drivers/usb/dwc2/core.c @@ -3049,6 +3049,7 @@ void dwc2_set_parameters(struct dwc2_hsotg *hsotg, dwc2_set_param_uframe_sched(hsotg, params->uframe_sched); dwc2_set_param_external_id_pin_ctl(hsotg, params->external_id_pin_ctl); } +EXPORT_SYMBOL_GPL(dwc2_set_parameters); /** * During device initialization, read various hardware configuration @@ -3215,6 +3216,24 @@ int dwc2_get_hwparams(struct dwc2_hsotg *hsotg) return 0; } +EXPORT_SYMBOL_GPL(dwc2_get_hwparams); + +/* + * Sets all parameters to the given value. + * + * Assumes that the dwc2_core_params struct contains only integers. + */ +void dwc2_set_all_params(struct dwc2_core_params *params, int value) +{ + int *p = (int *)params; + size_t size = sizeof(*params) / sizeof(*p); + int i; + + for (i = 0; i < size; i++) + p[i] = value; +} +EXPORT_SYMBOL_GPL(dwc2_set_all_params); + u16 dwc2_get_otg_version(struct dwc2_hsotg *hsotg) { diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index e46304d..d7fb1f7 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -1071,6 +1071,15 @@ extern void dwc2_set_param_ahbcfg(struct dwc2_hsotg *hsotg, int val); extern void dwc2_set_param_otg_ver(struct dwc2_hsotg *hsotg, int val); +extern void dwc2_set_parameters(struct dwc2_hsotg *hsotg, + const struct dwc2_core_params *params); + +extern void dwc2_set_all_params(struct dwc2_core_params *params, int value); + +extern int dwc2_get_hwparams(struct dwc2_hsotg *hsotg); + + + /* * Dump core registers and SPRAM */ @@ -1119,14 +1128,12 @@ extern int dwc2_hcd_get_frame_number(struct dwc2_hsotg *hsotg); extern void dwc2_hcd_disconnect(struct dwc2_hsotg *hsotg); extern void dwc2_hcd_start(struct dwc2_hsotg *hsotg); #else -static inline void dwc2_set_all_params(struct dwc2_core_params *params, int value) {} static inline int dwc2_hcd_get_frame_number(struct dwc2_hsotg *hsotg) { return 0; } static inline void dwc2_hcd_disconnect(struct dwc2_hsotg *hsotg) {} static inline void dwc2_hcd_start(struct dwc2_hsotg *hsotg) {} static inline void dwc2_hcd_remove(struct dwc2_hsotg *hsotg) {} -static inline int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq, - const struct dwc2_core_params *params) +static inline int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq) { return 0; } #endif diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index c78c874..a387e9f 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -2754,29 +2754,12 @@ static void dwc2_hcd_release(struct dwc2_hsotg *hsotg) } /* - * Sets all parameters to the given value. - * - * Assumes that the dwc2_core_params struct contains only integers. - */ -void dwc2_set_all_params(struct dwc2_core_params *params, int value) -{ - int *p = (int *)params; - size_t size = sizeof(*params) / sizeof(*p); - int i; - - for (i = 0; i < size; i++) - p[i] = value; -} -EXPORT_SYMBOL_GPL(dwc2_set_all_params); - -/* * Initializes the HCD. This function allocates memory for and initializes the * static parts of the usb_hcd and dwc2_hsotg structures. It also registers the * USB bus with the core and calls the hc_driver->start() function. It returns * a negative error on failure. */ -int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq, - const struct dwc2_core_params *params) +int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq) { struct usb_hcd *hcd; struct dwc2_host_chan *channel; @@ -2789,12 +2772,6 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq, dev_dbg(hsotg->dev, "DWC OTG HCD INIT\n"); - /* Detect config values from hardware */ - retval = dwc2_get_hwparams(hsotg); - - if (retval) - return retval; - retval = -ENOMEM; hcfg = readl(hsotg->regs + HCFG); @@ -2813,15 +2790,6 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq, hsotg->last_frame_num = HFNUM_MAX_FRNUM; #endif - hsotg->core_params = kzalloc(sizeof(*hsotg->core_params), GFP_KERNEL); - if (!hsotg->core_params) - goto error1; - - dwc2_set_all_params(hsotg->core_params, -1); - - /* Validate parameter values */ - dwc2_set_parameters(hsotg, params); - /* Check if the bus driver or platform co
[PATCH v1 11/20] usb: dwc2: gadget: powerup controller if needed
From: Gregory Herrero During vbus session, usb controller needs to exit hibernation if it was previously in suspend state. Since controller will be resetted and configured, there is no need to restore registers. Signed-off-by: Gregory Herrero --- drivers/usb/dwc2/gadget.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 72df171..bb83826 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -3205,6 +3205,14 @@ static int s3c_hsotg_vbus_session(struct usb_gadget *gadget, int is_active) spin_lock_irqsave(&hsotg->lock, flags); if (is_active) { + /* +* If controller is hibernated, it must exit from hibernation +* before being initialized +*/ + if (hsotg->lx_state == DWC2_L2) { + dwc2_exit_hibernation(hsotg, false); + hsotg->lx_state = DWC2_L0; + } /* Kill any ep0 requests as controller will be reinitialized */ kill_all_requests(hsotg, hsotg->eps_out[0], -ECONNRESET); s3c_hsotg_core_init_disconnected(hsotg, false); -- 1.9.1 -- 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
[PATCH v1 19/20] usb: dwc2: host: implement test mode
From: Jingwu Lin Add support for SetPortFeature(PORT_TEST) for root port. Signed-off-by: Jingwu Lin --- drivers/usb/dwc2/hcd.c | 9 + 1 file changed, 9 insertions(+) diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index 54f58c1..f8f3f5b 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -1764,6 +1764,15 @@ static int dwc2_hcd_hub_control(struct dwc2_hsotg *hsotg, u16 typereq, /* Not supported */ break; + case USB_PORT_FEAT_TEST: + hprt0 = dwc2_read_hprt0(hsotg); + dev_dbg(hsotg->dev, + "SetPortFeature - USB_PORT_FEAT_TEST\n"); + hprt0 &= ~HPRT0_TSTCTL_MASK; + hprt0 |= (windex >> 8) << HPRT0_TSTCTL_SHIFT; + writel(hprt0, hsotg->regs + HPRT0); + break; + default: retval = -EINVAL; dev_err(hsotg->dev, -- 1.9.1 -- 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
[PATCH v1 10/20] usb: dwc2: gadget: prevent new request submission during suspend
From: Gregory Herrero If usb controller is in partial power down, any write to registers may cause unpredictable behavior. Thus, prevent any new request submission once controller is in partial power down. Signed-off-by: Gregory Herrero --- drivers/usb/dwc2/gadget.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 539a3d4..72df171 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -790,6 +790,13 @@ static int s3c_hsotg_ep_queue(struct usb_ep *ep, struct usb_request *req, ep->name, req, req->length, req->buf, req->no_interrupt, req->zero, req->short_not_ok); + /* Prevent new request submission when controller is suspended */ + if (hs->lx_state == DWC2_L2) { + dev_dbg(hs->dev, "%s: don't submit request while suspended\n", + __func__); + return -EAGAIN; + } + /* initialise status of the request */ INIT_LIST_HEAD(&hs_req->queue); req->actual = 0; -- 1.9.1 -- 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
[PATCH V9 00/10] usb: serial: F81232 V9 patches
This series patch V9 is changed from V8 as following: 1. add comments for read URB 1byte LSR when port open. 2. change error handle flow of set_register()/get_register() V8 (old change): 1. The V7 MSR strange delta value is checked with locking problem. We changed f81232_set_mctrl() & f81232_read_msr() lock mechanism, the old version is only locked with variable protection, new version will lock from start to end with these 2 function. 2. f81232_set_baudrate() add error handling and no longer handle with baudrate B0, change to handle with f81232_set_termios() 3. When user set baudrate larger then 115200, we will change it with 115200 and tty_encode_baud_rate() in f81232_set_termios(). 4. V7 f81232_set_baudrate() divisor declared with type u8, it will make baudrate set failed with smaller then B600 (115200/300=384 overflow :Q). We changed it with integer type for divisor larger then 256. V7 (old change): 1. The buffer of usb_control_msg() in set_register()/get_register() are change from local variable to kmalloc(). (PATCH V7 02/11) 2. Change all set_register()/get_register() return value 0 is success, otherwise are failed. ( return 0 of usb_control_msg() treat as -EIO, PATCH V7 02/11) 3. tty_port_tty_get() called only when DCD has changed. (PATCH V7 05/11) 4. remove likely()/unlikely() branch prediction. 5. Implement DTR/RTS control when baudrate B0. We drop DTR/RTS when B0, otherwise enable it. (PATCH V7 08/11) 6. Change private struct line_control to modem_control with meanful. (PATCH V7 06/11) 7. We confirmd MSR strange delta value is not locking-issue. The issue maybe reproduce with set MCR & get MSR before IIR notice with MSR changed. V6 (old change): 1. transform all function not to use private data as parameter, using usb_serial_port instead. 2. process_read_urb() add process of Break/FrameError/ParityError/OE. (patch: 03/10) 3. fix calc_baud_divisor() will cause divide by zero with B0. (patch: 04/10) 4. Some init step we extract it from set_termios() to f81232_port_init() and run it when open port only. (patch: 04/10) 5. We'll force re-read msr in tiocmget() because the IIR with MSR change maybe delay received. (patch: 05/10) 6. fix MSR status bits changed but delta bits is 0 will cause read serial port malfunctional with update port status. (patch: 08/10) 7. Add MSR change statistic when MSR has been read. (patch: 09/10) 8. clarify a lot of code about Johan suggested. Peter Hung (10): USB: f81232: rename private struct member name USB: f81232: implement RX bulk-in EP USB: f81232: change lock mechanism USB: f81232: implement read IIR/MSR with endpoint USB: f81232: implement MCR/MSR function USB: f81232: implement port enable/disable method USB: f81232: implement set_termios() USB: f81232: clarify f81232_ioctl() and fix USB: f81232: cleanup non-used define USB: f81232: modify/add author drivers/usb/serial/f81232.c | 555 1 file changed, 457 insertions(+), 98 deletions(-) -- 1.9.1 -- 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
[PATCH v1 08/20] usb: dwc2: gadget: use reset detect interrupt
From: Gregory Herrero ResetDet interrupt is used to detect a reset of the bus while the controller is suspended. This may happens for example when using Command Verifier. Signed-off-by: Gregory Herrero --- drivers/usb/dwc2/gadget.c | 19 --- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index bed56dc..d528c02 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -2308,8 +2308,9 @@ void s3c_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg, writel(GINTSTS_ERLYSUSP | GINTSTS_SESSREQINT | GINTSTS_GOUTNAKEFF | GINTSTS_GINNAKEFF | GINTSTS_CONIDSTSCHNG | GINTSTS_USBRST | - GINTSTS_ENUMDONE | GINTSTS_OTGINT | - GINTSTS_USBSUSP | GINTSTS_WKUPINT, + GINTSTS_RESETDET | GINTSTS_ENUMDONE | + GINTSTS_OTGINT | GINTSTS_USBSUSP | + GINTSTS_WKUPINT, hsotg->regs + GINTMSK); if (using_dma(hsotg)) @@ -2475,7 +2476,19 @@ irq_retry: } } - if (gintsts & GINTSTS_USBRST) { + if (gintsts & GINTSTS_RESETDET) { + dev_dbg(hsotg->dev, "%s: USBRstDet\n", __func__); + + writel(GINTSTS_RESETDET, hsotg->regs + GINTSTS); + + /* This event must be used only if controller is suspended */ + if (hsotg->lx_state == DWC2_L2) { + dwc2_exit_hibernation(hsotg, true); + hsotg->lx_state = DWC2_L0; + } + } + + if ((gintsts & GINTSTS_USBRST) || (gintsts & GINTSTS_RESETDET)) { u32 usb_status = readl(hsotg->regs + GOTGCTL); -- 1.9.1 -- 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
[PATCH V9 02/10] USB: f81232: implement RX bulk-in EP
The F81232 bulk-in is RX data + LSR channel, data format is [LSR+Data][LSR+Data]. , We had implemented in f81232_process_read_urb(). Signed-off-by: Peter Hung --- drivers/usb/serial/f81232.c | 73 + 1 file changed, 40 insertions(+), 33 deletions(-) diff --git a/drivers/usb/serial/f81232.c b/drivers/usb/serial/f81232.c index 669a2f2..6b83870b 100644 --- a/drivers/usb/serial/f81232.c +++ b/drivers/usb/serial/f81232.c @@ -23,6 +23,7 @@ #include #include #include +#include static const struct usb_device_id id_table[] = { { USB_DEVICE(0x1934, 0x0706) }, @@ -104,44 +105,50 @@ exit: static void f81232_process_read_urb(struct urb *urb) { struct usb_serial_port *port = urb->context; - struct f81232_private *priv = usb_get_serial_port_data(port); unsigned char *data = urb->transfer_buffer; - char tty_flag = TTY_NORMAL; - unsigned long flags; - u8 line_status; - int i; + char tty_flag; + unsigned int i; + u8 lsr; - /* update line status */ - spin_lock_irqsave(&priv->lock, flags); - line_status = priv->modem_status; - priv->modem_status &= ~UART_STATE_TRANSIENT_MASK; - spin_unlock_irqrestore(&priv->lock, flags); + /* It's had 1-byte packet on open, the data is current LSR. but +* in this situation, the byte useless for open. +*/ - if (!urb->actual_length) + if ((urb->actual_length < 2) || (urb->actual_length % 2)) return; - /* break takes precedence over parity, */ - /* which takes precedence over framing errors */ - if (line_status & UART_BREAK_ERROR) - tty_flag = TTY_BREAK; - else if (line_status & UART_PARITY_ERROR) - tty_flag = TTY_PARITY; - else if (line_status & UART_FRAME_ERROR) - tty_flag = TTY_FRAME; - dev_dbg(&port->dev, "%s - tty_flag = %d\n", __func__, tty_flag); - - /* overrun is special, not associated with a char */ - if (line_status & UART_OVERRUN_ERROR) - tty_insert_flip_char(&port->port, 0, TTY_OVERRUN); - - if (port->port.console && port->sysrq) { - for (i = 0; i < urb->actual_length; ++i) - if (!usb_serial_handle_sysrq_char(port, data[i])) - tty_insert_flip_char(&port->port, data[i], - tty_flag); - } else { - tty_insert_flip_string_fixed_flag(&port->port, data, tty_flag, - urb->actual_length); + /* bulk-in data: [LSR(1Byte)+DATA(1Byte)][LSR(1Byte)+DATA(1Byte)]... */ + + for (i = 0; i < urb->actual_length; i += 2) { + tty_flag = TTY_NORMAL; + lsr = data[i]; + + if (lsr & UART_LSR_BRK_ERROR_BITS) { + if (lsr & UART_LSR_BI) { + tty_flag = TTY_BREAK; + port->icount.brk++; + usb_serial_handle_break(port); + } else if (lsr & UART_LSR_PE) { + tty_flag = TTY_PARITY; + port->icount.parity++; + } else if (lsr & UART_LSR_FE) { + tty_flag = TTY_FRAME; + port->icount.frame++; + } + + if (lsr & UART_LSR_OE) { + port->icount.overrun++; + tty_insert_flip_char(&port->port, 0, + TTY_OVERRUN); + } + } + + if (port->port.console && port->sysrq) { + if (usb_serial_handle_sysrq_char(port, data[i + 1])) + continue; + } + + tty_insert_flip_char(&port->port, data[i + 1], tty_flag); } tty_flip_buffer_push(&port->port); -- 1.9.1 -- 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
[PATCH v1 12/20] usb: dwc2: gadget: enable otg flag in dual role configuration
From: Gregory Herrero Signed-off-by: Gregory Herrero --- drivers/usb/dwc2/gadget.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index bb83826..2e27bfd 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -3524,6 +3524,9 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq) hsotg->gadget.max_speed = USB_SPEED_HIGH; hsotg->gadget.ops = &s3c_hsotg_gadget_ops; hsotg->gadget.name = dev_name(dev); +#if IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE) + hsotg->gadget.is_otg = 1; +#endif /* reset the system */ -- 1.9.1 -- 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
[PATCH V9 01/10] USB: f81232: rename private struct member name
Change private struct member name from line_status to modem_status. It will store MSR for some functions used Signed-off-by: Peter Hung --- drivers/usb/serial/f81232.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/usb/serial/f81232.c b/drivers/usb/serial/f81232.c index c5dc233..669a2f2 100644 --- a/drivers/usb/serial/f81232.c +++ b/drivers/usb/serial/f81232.c @@ -47,7 +47,7 @@ MODULE_DEVICE_TABLE(usb, id_table); struct f81232_private { spinlock_t lock; u8 line_control; - u8 line_status; + u8 modem_status; }; static void f81232_update_line_status(struct usb_serial_port *port, @@ -113,8 +113,8 @@ static void f81232_process_read_urb(struct urb *urb) /* update line status */ spin_lock_irqsave(&priv->lock, flags); - line_status = priv->line_status; - priv->line_status &= ~UART_STATE_TRANSIENT_MASK; + line_status = priv->modem_status; + priv->modem_status &= ~UART_STATE_TRANSIENT_MASK; spin_unlock_irqrestore(&priv->lock, flags); if (!urb->actual_length) @@ -241,7 +241,7 @@ static void f81232_dtr_rts(struct usb_serial_port *port, int on) static int f81232_carrier_raised(struct usb_serial_port *port) { struct f81232_private *priv = usb_get_serial_port_data(port); - if (priv->line_status & UART_DCD) + if (priv->modem_status & UART_DCD) return 1; return 0; } -- 1.9.1 -- 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
[PATCH V9 03/10] USB: f81232: change lock mechanism
The original driver lock with spin_lock_irqsave()/spin_unlock_irqrestore() because of it's maybe used in interrupt context f81232_process_read_urb(). We had remove it from previous patch "implement RX bulk-in EP", so we can change it from busying loop spin_lock to sleepable mutex_lock. Signed-off-by: Peter Hung --- drivers/usb/serial/f81232.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/usb/serial/f81232.c b/drivers/usb/serial/f81232.c index 6b83870b..61a6a1a 100644 --- a/drivers/usb/serial/f81232.c +++ b/drivers/usb/serial/f81232.c @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include #include @@ -46,7 +46,7 @@ MODULE_DEVICE_TABLE(usb, id_table); #define UART_CTS 0x80 struct f81232_private { - spinlock_t lock; + struct mutex lock; u8 line_control; u8 modem_status; }; @@ -231,17 +231,16 @@ static void f81232_close(struct usb_serial_port *port) static void f81232_dtr_rts(struct usb_serial_port *port, int on) { struct f81232_private *priv = usb_get_serial_port_data(port); - unsigned long flags; u8 control; - spin_lock_irqsave(&priv->lock, flags); + mutex_lock(&priv->lock); /* Change DTR and RTS */ if (on) priv->line_control |= (CONTROL_DTR | CONTROL_RTS); else priv->line_control &= ~(CONTROL_DTR | CONTROL_RTS); control = priv->line_control; - spin_unlock_irqrestore(&priv->lock, flags); + mutex_unlock(&priv->lock); set_control_lines(port->serial->dev, control); } @@ -285,7 +284,7 @@ static int f81232_port_probe(struct usb_serial_port *port) if (!priv) return -ENOMEM; - spin_lock_init(&priv->lock); + mutex_init(&priv->lock); usb_set_serial_port_data(port, priv); -- 1.9.1 -- 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
[PATCH V9 04/10] USB: f81232: implement read IIR/MSR with endpoint
The interrupt endpoint will report current IIR. If we got IIR with MSR changed , We will do read MSR with interrupt_work worker to do f81232_read_msr() function. Signed-off-by: Peter Hung --- drivers/usb/serial/f81232.c | 126 +--- 1 file changed, 118 insertions(+), 8 deletions(-) diff --git a/drivers/usb/serial/f81232.c b/drivers/usb/serial/f81232.c index 61a6a1a..1e1261f 100644 --- a/drivers/usb/serial/f81232.c +++ b/drivers/usb/serial/f81232.c @@ -31,6 +31,13 @@ static const struct usb_device_id id_table[] = { }; MODULE_DEVICE_TABLE(usb, id_table); +/* USB Control EP parameter */ +#define F81232_REGISTER_REQUEST0xa0 +#define F81232_GET_REGISTER0xc0 + +#define SERIAL_BASE_ADDRESS0x0120 +#define MODEM_STATUS_REGISTER (0x06 + SERIAL_BASE_ADDRESS) + #define CONTROL_DTR0x01 #define CONTROL_RTS0x02 @@ -49,19 +56,112 @@ struct f81232_private { struct mutex lock; u8 line_control; u8 modem_status; + struct work_struct interrupt_work; + struct usb_serial_port *port; }; +static int f81232_get_register(struct usb_serial_port *port, u16 reg, u8 *val) +{ + int status; + u8 *tmp; + struct usb_device *dev = port->serial->dev; + + tmp = kmalloc(sizeof(*val), GFP_KERNEL); + if (!tmp) + return -ENOMEM; + + status = usb_control_msg(dev, + usb_rcvctrlpipe(dev, 0), + F81232_REGISTER_REQUEST, + F81232_GET_REGISTER, + reg, + 0, + tmp, + sizeof(*val), + USB_CTRL_GET_TIMEOUT); + if (status != sizeof(*val)) { + dev_err(&port->dev, "%s failed status: %d\n", __func__, status); + + if (status < 0) + status = usb_translate_errors(status); + else + status = -EIO; + } else { + status = 0; + *val = *tmp; + } + + kfree(tmp); + return status; +} + +static void f81232_read_msr(struct usb_serial_port *port) +{ + int status; + u8 current_msr; + struct tty_struct *tty; + struct f81232_private *priv = usb_get_serial_port_data(port); + + mutex_lock(&priv->lock); + status = f81232_get_register(port, MODEM_STATUS_REGISTER, + ¤t_msr); + if (status) { + dev_err(&port->dev, "%s fail, status: %d\n", __func__, status); + mutex_unlock(&priv->lock); + return; + } + + if (!(current_msr & UART_MSR_ANY_DELTA)) { + mutex_unlock(&priv->lock); + return; + } + + priv->modem_status = current_msr; + + if (current_msr & UART_MSR_DCTS) + port->icount.cts++; + if (current_msr & UART_MSR_DDSR) + port->icount.dsr++; + if (current_msr & UART_MSR_TERI) + port->icount.rng++; + if (current_msr & UART_MSR_DDCD) { + port->icount.dcd++; + tty = tty_port_tty_get(&port->port); + if (tty) { + usb_serial_handle_dcd_change(port, tty, + current_msr & UART_MSR_DCD); + + tty_kref_put(tty); + } + } + + wake_up_interruptible(&port->port.delta_msr_wait); + mutex_unlock(&priv->lock); +} + static void f81232_update_line_status(struct usb_serial_port *port, unsigned char *data, - unsigned int actual_length) + size_t actual_length) { - /* -* FIXME: Update port->icount, and call -* -* wake_up_interruptible(&port->port.delta_msr_wait); -* -*on MSR changes. -*/ + struct f81232_private *priv = usb_get_serial_port_data(port); + + if (!actual_length) + return; + + switch (data[0] & 0x07) { + case 0x00: /* msr change */ + dev_dbg(&port->dev, "IIR: MSR Change: %02x\n", data[0]); + schedule_work(&priv->interrupt_work); + break; + case 0x02: /* tx-empty */ + break; + case 0x04: /* rx data available */ + break; + case 0x06: /* lsr change */ + /* we can forget it. the LSR will read from bulk-in */ + dev_dbg(&port->dev, "IIR: LSR Change: %02x\n", data[0]); + break; + } } static void f81232_read_int_callback(struct urb *urb) @@ -276,6 +376,14 @@ static int f81232_ioctl(struct tty_struct *tty, return -ENOIOCTLCMD; } +static void f81232_interrupt_work(struct w
Re: [PATCH] phy: omap-usb2: Fix missing clk_prepare call when using old dt name
+stable, v3.16+ On 11/03/15 03:41, Axel Lin wrote: > Current code does not call clk_prepare(phy->optclk) when using the old > usb_otg_ss_refclk960m name. Fix it. > > Signed-off-by: Axel Lin Acked-by: Roger Quadros cheers, -roger > --- > drivers/phy/phy-omap-usb2.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c > index 6f4aef3..dcdd850 100644 > --- a/drivers/phy/phy-omap-usb2.c > +++ b/drivers/phy/phy-omap-usb2.c > @@ -296,10 +296,11 @@ static int omap_usb2_probe(struct platform_device *pdev) > dev_warn(&pdev->dev, >"found usb_otg_ss_refclk960m, please fix > DTS\n"); > } > - } else { > - clk_prepare(phy->optclk); > } > > + if (!IS_ERR(phy->optclk)) > + clk_prepare(phy->optclk); > + > usb_add_phy_dev(&phy->phy); > > return 0; > -- 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/5] usb: chipidea: udc: add OTG status request handling
On Tue, Mar 17, 2015 at 10:06:44AM +0800, Peter Chen wrote: > On Mon, Mar 16, 2015 at 12:21:53PM -0500, Felipe Balbi wrote: > > On Mon, Mar 16, 2015 at 05:34:43PM +0800, Li Jun wrote: > > > On Mon, Mar 16, 2015 at 05:03:17PM +0800, Peter Chen wrote: > > > > On Mon, Mar 16, 2015 at 04:15:22PM +0800, Li Jun wrote: > > > > > On Mon, Mar 16, 2015 at 09:44:30AM +0800, Peter Chen wrote: > > > > > > On Fri, Mar 13, 2015 at 10:34:59AM -0500, Felipe Balbi wrote: > > > > > > > On Fri, Mar 13, 2015 at 11:13:11AM +0800, Peter Chen wrote: > > > > > > > > On Thu, Mar 12, 2015 at 11:04:09AM -0500, Felipe Balbi wrote: > > > > > > > > > > > > > > > > > > this could still be done generically in composite.c > > > > > > > > > > > > > > > > > > > > > > > > > I suggested it at v1, but after thinking more, we have handled > > > > > > > > DEVICE request type at individual udc driver, like remote > > > > > > > > wakeup, > > > > > > > > self-power support, so it is reasonable we handle get_status > > > > > > > > that > > > > > > > > if we support hnp polling at udc driver, since it is controller > > > > > > > > driver's capabilities. > > > > > > > > > > > > > > right, right.. it is controller's capabilities, but all > > > > > > > controller needs > > > > > > > to do is a set a flag in struct usb_gadget, which it already > > > > > > > does. Then, > > > > > > > every single udc will get free implementation after setting that > > > > > > > flag, > > > > > > > right ? > > > > > > > > > > > > > > > > > > > Great, then the udc driver which set b_hnp_enable can get the hnp > > > > > > polling capabilities automatically, in fact, hnp polling support > > > > > > is a software implement, I don't think it will affect old v1.3 otg > > > > > > driver. > > > > > > > > > > > > > > > > Existing flags in usb_gadget cannot exactly be used for judge if HNP > > > > > polling > > > > > is supported or not, support HNP does not necessarily means HNP > > > > > polling is > > > > > supported, in current code you can see b_hnp_enable is set for some > > > > > controllers > > > > > but they don't support HNP polling yet; > > > > > > > > Why HNP polling can't apply for all hnp enabled gadget? It is just a > > > > software feature, once the gadget is at device mode, it should be > > > > ready for hnp, meanwhile, you have already added host_request_flag > > > > at usb_gadget which the user can choose when to enable hnp polling. > > > > > > > > > > It can, just because in current code, some controllers support HNP but do > > > not > > > use OTG FSM driver, in this case I say they do not support HNP polling but > > > b_hnp_enable is set. > > > > then add a different flag, if you have to in order to maintain backwards > > compatibility. The fact that hnp polling is a completely SW > > implementation remains and we don't want to duplicate that all over the > > place. > > > > Felipe/Jun, since otg spec has changed, how about adding version check in code > first, it can avoid we add some feature selectors which is not defined > at otg spec, see: > > composite.c > > if (gadget_is_otg(gadget)) { > if (gadget_is_otg_13(gadget)) { > if (gadget->b_hnp_support) > gadget->host_requst_flag = true; > } else if (gadget_is_otg_20(gadget)) { > gadget->host_requst_flag = true; > } > } > > Then, every otg driver can use hnp polling, and 1.3 otg b device > can work with 2.0 otg a device well. > There is no need to impact existing OTG devices which do not use OTG fsm driver, they cannot benefit from HNP polling, OTG v2.0 A-device with HNP polling support should be able to work with OTG v1.3 B-device without HNP polling. I will follow Felipe's suggestion and send out v3. Li Jun > -- > > Best Regards, > Peter Chen -- 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: keyboard/trackpad combo unusable on MacBookPro4,1 with bcm5974.ko
On Mon, 2 Mar 2015, Alan Stern wrote: > On Fri, 27 Feb 2015, Christian Böhme wrote: > > > Alan Stern writes: > > > > > > Specifically, HID_QUIRK_IGNORE_MOUSE existed in 2.6.27 > > > > and was dealt with in drivers/hid/usbhid/hid-core.c:730, > > > > thereby somehow "fixing things". But those lines (and > > > > the symbol) disappeared after 2.6.27. Why were they > > > > removed? > > > > > > They weren't removed. The symbol was changed to APPLE_IGNORE_MOUSE and > > > the implementation was moved to drivers/hid/hid-apple.c. To get the > > > benefit, you have to enable CONFIG_HID_APPLE. > > … > > > It should have been working all along if your kernel configuration was > > > correct. > > > > $ uname -r > > 3.16.0-4-amd64 > > $ grep CONFIG_HID_APPLE /boot/config-3.16.0-4-amd64 > > CONFIG_HID_APPLE=m > > CONFIG_HID_APPLEIR=m > > $ lsmod | grep hid_apple > > hid_appleir12724 0 > > hid_apple 12596 0 > > hid 102264 4 hid_generic,usbhid,hid_appleir,hid_apple > > $ lsusb -d 05ac:0231 > > Bus 005 Device 020: ID 05ac:0231 Apple, Inc. Internal Keyboard/Trackpad \ > > (MacBook Pro 4,1) (ISO) > > Which matches the APPLE_WELLSPRING2_ISO entry in the device list. > > > Now, APPLE_IGNORE_MOUSE only appears in drivers/hid/hid-apple.c:28, where > > it is #define'd but never referenced, making it hard for me to see the > > connection. > > True enough. The hid-apple.c driver was separated out in commit > 8c19a51591d0 (HID: move apple quirks), at which time the > APPLE_IGNORE_MOUSE quirk was indeed used in the source code. > > However, the quirk was removed in commit b4d8e4736c94 (HID: fix > hidbus/appletouch device binding regression). For some reason that > commit failed to remove the APPLE_IGNORE_MOUSE #define, though. > > > However, while looking for uses of USB_DEVICE_ID_APPLE_WELLSPRING2_ISO, > > I found hid_mouse_ignore_list defined in drivers/hid/hid-core.c:2358 and > > referenced after the switch statement in drivers/hid/hid-core.c:2482 as an > > argument to hid_match_id(), which is executed only if the device's type in > > question is of HID_TYPE_USBMOUSE. > > Yes, that is the replacement code added by commit b4d8e4736c94. > > > If I had to venture a guess here I'd say > > that that is never the case. > > I agree. The problem is that the HID core now tests for hdev->type == > HID_TYPE_USBMOUSE, but it doesn't test for bInterfaceProtocol == > USB_INTERFACE_PROTOCOL_MOUSE like the older code did. > > This issue should be reported to the author of that second commit > (CC'ed). Has this been fixed yet? I came back to this old email today, and it turns out that usbhid_probe() already includes the following lines: if (intf->cur_altsetting->desc.bInterfaceProtocol == USB_INTERFACE_PROTOCOL_MOUSE) hid->type = HID_TYPE_USBMOUSE; This happens before hid_add_device() is called, so it should already be in effect when hid_ignore() runs. Maybe you can figure out what's wrong given these hints. Alan Stern -- 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
[PATCH v3 6/8] usb: chipidea: otg: set host_request_flag for gadget
Set host_request_flag if the current peripheral wants to take host role via changing a_bus_req or b_bus_req by user application. Signed-off-by: Li Jun --- drivers/usb/chipidea/otg_fsm.c | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c index 083acf4..2ec90dc 100644 --- a/drivers/usb/chipidea/otg_fsm.c +++ b/drivers/usb/chipidea/otg_fsm.c @@ -66,6 +66,11 @@ set_a_bus_req(struct device *dev, struct device_attribute *attr, return count; } ci->fsm.a_bus_req = 1; + if (ci->fsm.otg->state == OTG_STATE_A_PERIPHERAL) { + ci->gadget.host_request_flag = 1; + mutex_unlock(&ci->fsm.lock); + return count; + } } ci_otg_queue_work(ci); @@ -144,8 +149,14 @@ set_b_bus_req(struct device *dev, struct device_attribute *attr, mutex_lock(&ci->fsm.lock); if (buf[0] == '0') ci->fsm.b_bus_req = 0; - else if (buf[0] == '1') + else if (buf[0] == '1') { ci->fsm.b_bus_req = 1; + if (ci->fsm.otg->state == OTG_STATE_B_PERIPHERAL) { + ci->gadget.host_request_flag = 1; + mutex_unlock(&ci->fsm.lock); + return count; + } + } ci_otg_queue_work(ci); mutex_unlock(&ci->fsm.lock); -- 1.7.9.5 -- 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
[PATCH v3 3/8] usb: common: otg-fsm: add HNP polling support
Adds HNP polling timer when transits to host state, the OTG status request will be sent to peripheral after timeout, if host request flag is set, it will switch to peripheral state, otherwise it will repeat HNP polling every 1.5s and maintain the current session. Signed-off-by: Li Jun --- drivers/usb/common/usb-otg-fsm.c | 84 ++ include/linux/usb/otg-fsm.h | 13 ++ 2 files changed, 97 insertions(+) diff --git a/drivers/usb/common/usb-otg-fsm.c b/drivers/usb/common/usb-otg-fsm.c index 61d538a..1a1b5f4 100644 --- a/drivers/usb/common/usb-otg-fsm.c +++ b/drivers/usb/common/usb-otg-fsm.c @@ -78,6 +78,8 @@ static void otg_leave_state(struct otg_fsm *fsm, enum usb_otg_state old_state) fsm->b_srp_done = 0; break; case OTG_STATE_B_PERIPHERAL: + if (fsm->otg->gadget) + fsm->otg->gadget->host_request_flag = 0; break; case OTG_STATE_B_WAIT_ACON: otg_del_timer(fsm, B_ASE0_BRST); @@ -107,6 +109,8 @@ static void otg_leave_state(struct otg_fsm *fsm, enum usb_otg_state old_state) case OTG_STATE_A_PERIPHERAL: otg_del_timer(fsm, A_BIDL_ADIS); fsm->a_bidl_adis_tmout = 0; + if (fsm->otg->gadget) + fsm->otg->gadget->host_request_flag = 0; break; case OTG_STATE_A_WAIT_VFALL: otg_del_timer(fsm, A_WAIT_VFALL); @@ -120,6 +124,84 @@ static void otg_leave_state(struct otg_fsm *fsm, enum usb_otg_state old_state) } } +static void otg_hnp_polling_work(struct work_struct *work) +{ + struct otg_fsm *fsm = container_of(to_delayed_work(work), + struct otg_fsm, hnp_polling_work); + struct usb_device *udev; + u8 host_req_flag; + enum usb_otg_state state = fsm->otg->state; + int retval; + + if (state != OTG_STATE_A_HOST && state != OTG_STATE_B_HOST) + return; + + udev = usb_hub_find_child(fsm->otg->host->root_hub, 1); + if (!udev) { + dev_err(fsm->otg->host->controller, + "no usb dev connected, can't start HNP polling\n"); + return; + } + + /* Get host request flag from connected USB device */ + retval = usb_control_msg(udev, + usb_rcvctrlpipe(udev, 0), + USB_REQ_GET_STATUS, + USB_DIR_IN | USB_RECIP_DEVICE, + 0, + OTG_STS_SELECTOR, + &host_req_flag, + 1, + USB_CTRL_GET_TIMEOUT); + if (retval != 1) { + dev_err(&udev->dev, "Get one byte OTG status failed\n"); + return; + } + + if (host_req_flag == 0) { + /* Continue HNP polling */ + schedule_delayed_work(&fsm->hnp_polling_work, + msecs_to_jiffies(T_HOST_REQ_POLL)); + return; + } else if (host_req_flag != HOST_REQUEST_FLAG) { + dev_err(&udev->dev, "host request flag %d is invalid\n", + host_req_flag); + return; + } + + /* Host request flag is set */ + if (state == OTG_STATE_A_HOST) { + /* Set b_hnp_enable */ + if (!fsm->otg->host->b_hnp_enable) { + retval = usb_control_msg(udev, + usb_sndctrlpipe(udev, 0), + USB_REQ_SET_FEATURE, 0, + USB_DEVICE_B_HNP_ENABLE, + 0, NULL, 0, + USB_CTRL_SET_TIMEOUT); + if (retval < 0) { + dev_err(&udev->dev, + "can't enable HNP %d\n", retval); + return; + } + fsm->otg->host->b_hnp_enable = 1; + } + + fsm->a_bus_req = 0; + } else if (state == OTG_STATE_B_HOST) { + fsm->b_bus_req = 0; + } + + otg_statemachine(fsm); +} + +static void otg_start_hnp_polling(struct otg_fsm *fsm) +{ + INIT_DELAYED_WORK(&fsm->hnp_polling_work, otg_hnp_polling_work); + schedule_delayed_work(&fsm->hnp_polling_work, + msecs_to_jiffies(T_HOST_REQ_POLL)); +} + /* Called when entering a state */ static int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state) { @@ -169,6 +251,7 @@ static int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state) otg_set_protocol(fsm, PROTO_HOST); usb_bus_start_enum(fsm->otg->host,
[PATCH v3 4/8] usb: chipidea: udc: bypass otg status selector request handling to gadget driver
Since gadget driver will handle this request, so controller driver bypass it. Signed-off-by: Li Jun --- drivers/usb/chipidea/udc.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 4254792..a65cdaf 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -1014,7 +1014,8 @@ __acquires(ci->lock) } break; case USB_REQ_GET_STATUS: - if (type != (USB_DIR_IN|USB_RECIP_DEVICE) && + if ((type != (USB_DIR_IN|USB_RECIP_DEVICE) || + le16_to_cpu(req.wIndex) == OTG_STS_SELECTOR) && type != (USB_DIR_IN|USB_RECIP_ENDPOINT) && type != (USB_DIR_IN|USB_RECIP_INTERFACE)) goto delegate; -- 1.7.9.5 -- 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
[PATCH v3 5/8] usb: gadget: composite: handle otg status selector request from OTG host
If gadget with HNP polling support receives GetStatus request of otg status selector, it feedback to host with host request flag to indicate if it wants to take host role. Signed-off-by: Li Jun --- drivers/usb/gadget/composite.c | 25 + 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 13adfd1..1f73bd9 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -1594,15 +1594,24 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) *((u8 *)req->buf) = value; value = min(w_length, (u16) 1); break; - - /* -* USB 3.0 additions: -* Function driver should handle get_status request. If such cb -* wasn't supplied we respond with default value = 0 -* Note: function driver should supply such cb only for the first -* interface of the function -*/ case USB_REQ_GET_STATUS: + if (gadget_is_otg(gadget) && gadget->hnp_polling_support && + (w_index == OTG_STS_SELECTOR)) { + if (ctrl->bRequestType != (USB_DIR_IN | + USB_RECIP_DEVICE)) + goto unknown; + *((u8 *)req->buf) = gadget->host_request_flag; + value = 1; + break; + } + + /* +* USB 3.0 additions: +* Function driver should handle get_status request. If such cb +* wasn't supplied we respond with default value = 0 +* Note: function driver should supply such cb only for the +* first interface of the function +*/ if (!gadget_is_superspeed(gadget)) goto unknown; if (ctrl->bRequestType != (USB_DIR_IN | USB_RECIP_INTERFACE)) -- 1.7.9.5 -- 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
[PATCH v3 0/8] add HNP polling support for usb otg fsm
HNP polling is a mechanism which allows the OTG device currently acting as host to determine when the other attached OTG device wishes to take the host role. When an OTG host, which supports HNP, is connected to an OTG peripheral which also supports HNP it shall poll the peripheral regularly to determine whether it requires a role-swap and grant this at the earliest opportunity. changes for v3: - Move otg status selector definition from otg-fsm.h to ch9.h - Use delayed_work instead of timer work to avoid a workstruct - Add a new flag hnp_polling_support in usb_gadget to indicate if HNP polling is supported, which should be set by controller driver. - Add a new patch to enable hnp_polling_support for chipidea otg fsm drier. - Move otg status selector hanlding from chipidea udc driver to composite.c - Add a new patch to bypass otg status selector hanlding. changes for v2: - Move HNP polling timer from chipidea controller driver to usb-otg-fsm.c to make it more generically, then HNP polling can be fully handled by otg fsm driver. - Add comments for host_request_flag in patch: usb: gadget: add host_requestf_flag in usb_gadget for OTG HNP Li Jun (8): usb: gadget: add hnp_polling_support and host_request_flag in usb_gadget usb: add OTG status selector definition for HNP polling usb: common: otg-fsm: add HNP polling support usb: chipidea: udc: bypass otg status selector request handling to gadget driver usb: gadget: composite: handle otg status selector request from OTG host usb: chipidea: otg: set host_request_flag for gadget usb: chipidea: otg: enable HNP polling support for gadget Documentation: usb: chipidea: Update test procedure for HNP polling Documentation/usb/chipidea.txt |9 ++-- drivers/usb/chipidea/otg_fsm.c | 14 ++- drivers/usb/chipidea/udc.c |3 +- drivers/usb/common/usb-otg-fsm.c | 84 ++ drivers/usb/gadget/composite.c | 25 include/linux/usb/gadget.h |6 +++ include/linux/usb/otg-fsm.h | 13 ++ include/uapi/linux/usb/ch9.h |2 + 8 files changed, 141 insertions(+), 15 deletions(-) -- 1.7.9.5 -- 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
[PATCH v3 7/8] usb: chipidea: otg: enable HNP polling support for gadget
Enable HNP polling support for chipidea gadget when otg fsm init. Signed-off-by: Li Jun --- drivers/usb/chipidea/otg_fsm.c |1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c index 2ec90dc..82b1e23 100644 --- a/drivers/usb/chipidea/otg_fsm.c +++ b/drivers/usb/chipidea/otg_fsm.c @@ -792,6 +792,7 @@ int ci_hdrc_otg_fsm_init(struct ci_hdrc *ci) ci->fsm.id = hw_read_otgsc(ci, OTGSC_ID) ? 1 : 0; ci->fsm.otg->state = OTG_STATE_UNDEFINED; ci->fsm.ops = &ci_otg_ops; + ci->gadget.hnp_polling_support = 1; mutex_init(&ci->fsm.lock); -- 1.7.9.5 -- 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
[PATCH v3 1/8] usb: gadget: add hnp_polling_support and host_request_flag in usb_gadget
From: Li Jun Add 2 flags for USB OTG HNP polling, hnp_polling_support is to indicate if the gadget can support HNP polling, host_request_flag is used for gadget to store host request information from application, which can be used to respond to HNP polling from host. Signed-off-by: Li Jun --- include/linux/usb/gadget.h |6 ++ 1 file changed, 6 insertions(+) diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index e2f00fd..6c7dc43 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -521,6 +521,10 @@ struct usb_gadget_ops { * only supports HNP on a different root port. * @b_hnp_enable: OTG device feature flag, indicating that the A-Host * enabled HNP support. + * @hnp_polling_support: OTG device feature flag, indicating if the OTG device + * in peripheral mode can support HNP polling. + * @host_request_flag: OTG device feature flag, indicating if A-Peripheral + * or B-Peripheral wants to take host role. * @quirk_ep_out_aligned_size: epout requires buffer size to be aligned to * MaxPacketSize. * @is_selfpowered: if the gadget is self-powered. @@ -563,6 +567,8 @@ struct usb_gadget { unsignedb_hnp_enable:1; unsigneda_hnp_support:1; unsigneda_alt_hnp_support:1; + unsignedhnp_polling_support:1; + unsignedhost_request_flag:1; unsignedquirk_ep_out_aligned_size:1; unsignedis_selfpowered:1; }; -- 1.7.9.5 -- 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
[PATCH v3 8/8] Documentation: usb: chipidea: Update test procedure for HNP polling
From: Li Jun Update HNP test procedure as HNP polling is supported. Signed-off-by: Li Jun --- Documentation/usb/chipidea.txt |9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Documentation/usb/chipidea.txt b/Documentation/usb/chipidea.txt index 3f848c1..95d9170 100644 --- a/Documentation/usb/chipidea.txt +++ b/Documentation/usb/chipidea.txt @@ -26,14 +26,13 @@ cat /sys/kernel/debug/ci_hdrc.0/registers On B-device: echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req - if HNP polling is not supported, also need: - On A-device: - echo 0 > /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_req - B-device should take host role and enumrate A-device. 4) A-device switch back to host. - On B-device: + On A-device: + echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_req + + or, on B-device: echo 0 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req A-device should switch back to host and enumrate B-device. -- 1.7.9.5 -- 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
[PATCH v3 2/8] usb: add OTG status selector definition for HNP polling
A host is required to use the GetStatus command, with wIndex set to the OTG status selector(F000H) to request the Host request flag from the peripheral. Signed-off-by: Li Jun --- include/uapi/linux/usb/ch9.h |2 ++ 1 file changed, 2 insertions(+) diff --git a/include/uapi/linux/usb/ch9.h b/include/uapi/linux/usb/ch9.h index aa33fd1..a50ec5f 100644 --- a/include/uapi/linux/usb/ch9.h +++ b/include/uapi/linux/usb/ch9.h @@ -678,6 +678,8 @@ struct usb_otg_descriptor { #define USB_OTG_SRP(1 << 0) #define USB_OTG_HNP(1 << 1)/* swap host/device roles */ +#define OTG_STS_SELECTOR 0xF000 /* OTG status selector */ + /*-*/ /* USB_DT_DEBUG: for special highspeed devices, replacing serial console */ -- 1.7.9.5 -- 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: keyboard/trackpad combo unusable on MacBookPro4,1 with bcm5974.ko
On 03/17/2015, 03:20 PM, Alan Stern wrote: > On Mon, 2 Mar 2015, Alan Stern wrote: > >> On Fri, 27 Feb 2015, Christian Böhme wrote: >> >>> Alan Stern writes: >>> > Specifically, HID_QUIRK_IGNORE_MOUSE existed in 2.6.27 > and was dealt with in drivers/hid/usbhid/hid-core.c:730, > thereby somehow "fixing things". But those lines (and > the symbol) disappeared after 2.6.27. Why were they > removed? They weren't removed. The symbol was changed to APPLE_IGNORE_MOUSE and the implementation was moved to drivers/hid/hid-apple.c. To get the benefit, you have to enable CONFIG_HID_APPLE. >>> … It should have been working all along if your kernel configuration was correct. >>> >>> $ uname -r >>> 3.16.0-4-amd64 >>> $ grep CONFIG_HID_APPLE /boot/config-3.16.0-4-amd64 >>> CONFIG_HID_APPLE=m >>> CONFIG_HID_APPLEIR=m >>> $ lsmod | grep hid_apple >>> hid_appleir12724 0 >>> hid_apple 12596 0 >>> hid 102264 4 hid_generic,usbhid,hid_appleir,hid_apple >>> $ lsusb -d 05ac:0231 >>> Bus 005 Device 020: ID 05ac:0231 Apple, Inc. Internal Keyboard/Trackpad \ >>> (MacBook Pro 4,1) (ISO) >> >> Which matches the APPLE_WELLSPRING2_ISO entry in the device list. >> >>> Now, APPLE_IGNORE_MOUSE only appears in drivers/hid/hid-apple.c:28, where >>> it is #define'd but never referenced, making it hard for me to see the >>> connection. >> >> True enough. The hid-apple.c driver was separated out in commit >> 8c19a51591d0 (HID: move apple quirks), at which time the >> APPLE_IGNORE_MOUSE quirk was indeed used in the source code. >> >> However, the quirk was removed in commit b4d8e4736c94 (HID: fix >> hidbus/appletouch device binding regression). For some reason that >> commit failed to remove the APPLE_IGNORE_MOUSE #define, though. >> >>> However, while looking for uses of USB_DEVICE_ID_APPLE_WELLSPRING2_ISO, >>> I found hid_mouse_ignore_list defined in drivers/hid/hid-core.c:2358 and >>> referenced after the switch statement in drivers/hid/hid-core.c:2482 as an >>> argument to hid_match_id(), which is executed only if the device's type in >>> question is of HID_TYPE_USBMOUSE. >> >> Yes, that is the replacement code added by commit b4d8e4736c94. >> >>> If I had to venture a guess here I'd say >>> that that is never the case. >> >> I agree. The problem is that the HID core now tests for hdev->type == >> HID_TYPE_USBMOUSE, but it doesn't test for bInterfaceProtocol == >> USB_INTERFACE_PROTOCOL_MOUSE like the older code did. >> >> This issue should be reported to the author of that second commit >> (CC'ed). > > Has this been fixed yet? > > I came back to this old email today, and it turns out that > usbhid_probe() already includes the following lines: > > if (intf->cur_altsetting->desc.bInterfaceProtocol == > USB_INTERFACE_PROTOCOL_MOUSE) > hid->type = HID_TYPE_USBMOUSE; > > This happens before hid_add_device() is called, so it should already be > in effect when hid_ignore() runs. > > Maybe you can figure out what's wrong given these hints. Oh, I somehow missed the 1st e-mail. It would be helpful to see who is actually bound to the two interfaces of the device. What's the output of readlink /sys/bus/usb/devices/:1.*/driver for the corresponding ? The mouse should be handled by bcm5974, the other by usbhid (and by hid-apple one layer below). Do you have MOUSE_BCM5974 enabled? regards, -- js -- 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 1/1] usb: xhci: apply XHCI_AVOID_BEI quirk to all Intel xHCI controllers
On Mon, Mar 16, 2015 at 5:29 PM, Mathias Nyman wrote: > On 16.03.2015 17:21, Alistair Grant wrote: >> On Mon, Mar 16, 2015 at 3:47 PM, Mathias Nyman >> wrote: >>> On 16.03.2015 16:31, Alistair Grant wrote: On Mon, Mar 16, 2015 at 1:55 PM, Mathias Nyman wrote: > On 15.03.2015 21:18, Alistair Grant wrote: >> On Sun, Mar 15, 2015 at 3:54 PM, Alistair Grant >> wrote: >> ... >> It looks like I may have signed-off a little too soon. While the patch >> is >> working correctly if the Hauppauge Live2 is plugged in after the system >> has >> booted and settled down (my normal use case), it fails if the Live2 is >> plugged in while the system is booted up. >> >> Unplugging the Live2 after recording (which appears to succeed from the >> command line, but had no audio), executing lsusb just hangs. >> >> I've included what I think is the relevant portions of /var/log/syslog >> below. If you'd like the entire log file posted somewhere please let me >> know. > > Hi > > What kernel did you try this patch on? > > The output look a bit like the regression in 4.0-rc3 caused by: > commit 27082e2654dc148078b0abdfc3c8e5ccbde0ebfa > xhci: Clear the host side toggle manually when endpoint is 'soft > reset' > > which will be reverted (in 4.0-rc5 I hope). > > If you boot the same base kernel without the patch does it work then? > > -Mathias > Hi Mathias, This is on top of 3.19.1 with only the XHCI_AVOID_BEI quirk patch applied. If you'd like me to try it against 4.0-rc3, 4 or 5, please let me know. >>> >>> Thanks, no that's not needed. >>> But did the patch cause regression on top of 3.19.1? >>> I mean, did it make 3.19.1 worse, better or just different for you, while >>> booting with the device connected? >> >> Recording doesn't work at all with 3.19.1 without the patch. I've >> included an extract from syslog below of attempting to record with a >> clean 3.19.1 system (i.e. XHCI_AVOID_BEI quirk patch NOT applied, to >> state the obvious). >> >> I did mean to say in my original message that I would still release >> this patch even with the current known issue as it still improves the >> overall stability of the system. >> > > Ok, thanks > I'll add it to the queue Hi Mathias & Lu, FYI... I also tried booting with the Live2 plugged in with the following kernel: * 3.19.1 * usb: xhci: apply XHCI_AVOID_BEI quirk to all Intel xHCI controllers * xhci: Allocate correct amount of scratchpad buffers * xhci.h: Increase TRBS_PER_SEGMENT from 64 to 256 i.e. add the scratchpad buffers fix and increase TRBS_PER_SEGMENT, however the problem still occurs if the Live2 is plugged in during boot up. Thanks, Alistair -- 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: [Spice-devel] Questions on usbredir + XSpice
Hi, On 17-03-15 15:50, Jeremy White wrote: Hey Hans, I'm coming back around to this; we've been tasked to actually make this work. It seems as though adding usbredir support to the kernel, either as a flavor of usbip, or as a parallel solution is the best approach. But I realize I'm really ignorant, and I should do a lot of homework before I start asking stupid questions. I was wondering - do you have any good FMs I could go read? I see on the web that you once gave a presentation to the kernel guys - have any slide decks lying around that might help me? Seems like things are pretty stale on all fronts; I've got the usbip source (now in the kernel). I've got the usbredir source, which is less stale. Not seeing much on the usbip mailing list. Any other mailing list threads I should review? I'm afraid I do not have much help to offer, I do not know any books / presentations / mailinglist threads which are worthwhile to read here, I think you just need to start working on this, and then ask questions when necessary, when asking questions please Cc: linux-usb Regards, Hans -- 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: USB 3.0 storage keep reconnecting after safely removed
On 16.03.2015 22:17, Alan Stern wrote: > On Wed, 7 Jan 2015, Hans de Goede wrote: > >> Hi, >> >> On 07-01-15 16:19, Alan Stern wrote: >>> On Tue, 6 Jan 2015, Taegil Bae wrote: >>> Hi all, Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=90791 My machine is Thinkpad Yoga with Onelink dock attached. Onelink dock is a USB 3.0 dock functioning as a USB 3.0 hub. This has two USB 3.0 ports in front. I connected a USB HDD enclosure to one of those ports. After use, I safely removed the storage device. But immediately that storage is connected. There is no such issue for laptop body's USB 3.0 ports or Onelink dock's USB 2.0 ports. I've tested in GNOME GUI and i3 CUI environment. In GNOME, I used gnome-disk utility. In i3, I echo'ed 1 to that USB 3.0 enclosure device's sysfs entry 'remove'. There is no difference. Using Onelink dock's USB 3.0 port: 1월 05 22:25:51 rapunzel kernel: usb 3-3-port4: logical disconnect <-- safely remove 1월 05 22:25:51 rapunzel kernel: hub 3-3:1.0: state 7 ports 4 chg 0010 evt 1월 05 22:25:51 rapunzel kernel: usb 3-3-port4: status 02b0, change , 5.0 Gb/s 1월 05 22:25:51 rapunzel kernel: usb 3-3.4: USB disconnect, device number 4 1월 05 22:25:51 rapunzel kernel: usb 3-3.4: unregistering device 1월 05 22:25:51 rapunzel kernel: hub 3-3:1.0: state 7 ports 4 chg evt 0010 1월 05 22:25:51 rapunzel kernel: usb 3-3-port4: reset change 1월 05 22:25:51 rapunzel kernel: usb 3-3-port4: warm reset change 1월 05 22:25:51 rapunzel kernel: usb 3-3-port4: status 0203, change 0031, 5.0 Gb/s 1월 05 22:25:51 rapunzel kernel: usb 3-3-port4: debounce total 100ms stable 100ms status 0x203 1월 05 22:25:51 rapunzel kernel: usb 3-3.4: new SuperSpeed USB device number 5 using xhci_hcd <-- reconnecting 1월 05 22:25:51 rapunzel kernel: usb 3-3.4: udev 5, busnum 3, minor = 260 1월 05 22:25:51 rapunzel kernel: usb-storage 3-3.4:1.0: USB Mass Storage device detected 1월 05 22:25:51 rapunzel kernel: scsi host5: usb-storage 3-3.4:1.0 1월 05 22:25:51 rapunzel kernel: hub 3-3:1.0: state 7 ports 4 chg evt 0010 1월 05 22:25:52 rapunzel kernel: scsi 5:0:0:0: Direct-Access Corsair Force 3 SSD 5.07 PQ: 0 ANSI: 0 1월 05 22:25:52 rapunzel kernel: sd 5:0:0:0: [sdb] 234441648 512-byte logical blocks: (120 GB/111 GiB) 1월 05 22:25:52 rapunzel kernel: sd 5:0:0:0: [sdb] Write Protect is off 1월 05 22:25:52 rapunzel kernel: sd 5:0:0:0: [sdb] Mode Sense: 03 00 00 00 1월 05 22:25:52 rapunzel kernel: sd 5:0:0:0: [sdb] No Caching mode page found 1월 05 22:25:52 rapunzel kernel: sd 5:0:0:0: [sdb] Assuming drive cache: write through 1월 05 22:25:52 rapunzel kernel: sdb: unknown partition table 1월 05 22:25:52 rapunzel kernel: sd 5:0:0:0: [sdb] Attached SCSI disk 1월 05 22:25:53 rapunzel kernel: BTRFS info (device sdb): disk space caching is enabled 1월 05 22:25:53 rapunzel kernel: BTRFS: bdev /dev/sdb errs: wr 0, rd 1, flush 0, corrupt 0, gen 0 >>> >>> Clearly there's a bug in the SuperSpeed port-state logic in the hub >>> driver. Perhaps Hans can help fix the problems. If not, Mathias (the >>> xhci-hcd maintainer) may look at this after he gets back from vacation. >> >> I'm afraid that I already have too much work on my plate, and that I'm not >> 100% into the code in question, so this will have to wait till Mathias is >> back. > > Hans and Mathias: > > It appears that nobody has looked into this yet. What should Taegil do > to help track down the reason for the problem? > Missed this completely, I need to go though the logs in the bugreport first to see if I can spot anything xhci (or core/hub) related. -Mathias -- 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: cdc_mbim with Huawei E3372, nothing works
On Mon, Feb 23, 2015 at 11:59:14 +0100, Bjørn Mork wrote: > So my conclusion is that there is some higher level USB communication > problem here, not directly involving neither usbnet nor the minidriver. Do you have new ideas as to where the problem might be? I have now used the cdc_ether driver to transfer 1 TiB with zero rx/tx errors. I also noticed cdc_ether initialization or something does not work with kernel 4.0.0-rc4, I have to first setup it in 3.18.9 and then reboot to 4.0.0-rc4. -- Do what you love because life is too short for anything else. -- 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
[PATCH 5/5] ARM: at91/dt: remove useless usb clock
The ohci driver now calls clk_set_rate on the uhpck clock (which forwards set_rate requests to its parent: the usb clock). Remove useless references to usb clocks from ohci definitions. Signed-off-by: Boris Brezillon --- arch/arm/boot/dts/at91rm9200.dtsi | 4 ++-- arch/arm/boot/dts/at91sam9260.dtsi | 4 ++-- arch/arm/boot/dts/at91sam9261.dtsi | 4 ++-- arch/arm/boot/dts/at91sam9263.dtsi | 4 ++-- arch/arm/boot/dts/at91sam9g45.dtsi | 4 ++-- arch/arm/boot/dts/at91sam9n12.dtsi | 5 ++--- arch/arm/boot/dts/at91sam9x5.dtsi | 4 ++-- arch/arm/boot/dts/sama5d3.dtsi | 5 ++--- arch/arm/boot/dts/sama5d4.dtsi | 5 ++--- 9 files changed, 18 insertions(+), 21 deletions(-) diff --git a/arch/arm/boot/dts/at91rm9200.dtsi b/arch/arm/boot/dts/at91rm9200.dtsi index 21c2b50..31892a1 100644 --- a/arch/arm/boot/dts/at91rm9200.dtsi +++ b/arch/arm/boot/dts/at91rm9200.dtsi @@ -936,8 +936,8 @@ compatible = "atmel,at91rm9200-ohci", "usb-ohci"; reg = <0x0030 0x10>; interrupts = <23 IRQ_TYPE_LEVEL_HIGH 2>; - clocks = <&usb>, <&ohci_clk>, <&ohci_clk>, <&uhpck>; - clock-names = "usb_clk", "ohci_clk", "hclk", "uhpck"; + clocks = <&ohci_clk>, <&ohci_clk>, <&uhpck>; + clock-names = "ohci_clk", "hclk", "uhpck"; status = "disabled"; }; }; diff --git a/arch/arm/boot/dts/at91sam9260.dtsi b/arch/arm/boot/dts/at91sam9260.dtsi index e7f0a4a..2dabe77 100644 --- a/arch/arm/boot/dts/at91sam9260.dtsi +++ b/arch/arm/boot/dts/at91sam9260.dtsi @@ -1008,8 +1008,8 @@ compatible = "atmel,at91rm9200-ohci", "usb-ohci"; reg = <0x0050 0x10>; interrupts = <20 IRQ_TYPE_LEVEL_HIGH 2>; - clocks = <&usb>, <&ohci_clk>, <&ohci_clk>, <&uhpck>; - clock-names = "usb_clk", "ohci_clk", "hclk", "uhpck"; + clocks = <&ohci_clk>, <&ohci_clk>, <&uhpck>; + clock-names = "ohci_clk", "hclk", "uhpck"; status = "disabled"; }; }; diff --git a/arch/arm/boot/dts/at91sam9261.dtsi b/arch/arm/boot/dts/at91sam9261.dtsi index d55fdf2..db811f9 100644 --- a/arch/arm/boot/dts/at91sam9261.dtsi +++ b/arch/arm/boot/dts/at91sam9261.dtsi @@ -75,8 +75,8 @@ compatible = "atmel,at91rm9200-ohci", "usb-ohci"; reg = <0x0050 0x10>; interrupts = <20 IRQ_TYPE_LEVEL_HIGH 2>; - clocks = <&usb>, <&ohci_clk>, <&hclk0>, <&uhpck>; - clock-names = "usb_clk", "ohci_clk", "hclk", "uhpck"; + clocks = <&ohci_clk>, <&hclk0>, <&uhpck>; + clock-names = "ohci_clk", "hclk", "uhpck"; status = "disabled"; }; diff --git a/arch/arm/boot/dts/at91sam9263.dtsi b/arch/arm/boot/dts/at91sam9263.dtsi index fce301c..aa981cd 100644 --- a/arch/arm/boot/dts/at91sam9263.dtsi +++ b/arch/arm/boot/dts/at91sam9263.dtsi @@ -1010,8 +1010,8 @@ compatible = "atmel,at91rm9200-ohci", "usb-ohci"; reg = <0x00a0 0x10>; interrupts = <29 IRQ_TYPE_LEVEL_HIGH 2>; - clocks = <&usb>, <&ohci_clk>, <&ohci_clk>, <&uhpck>; - clock-names = "usb_clk", "ohci_clk", "hclk", "uhpck"; + clocks = <&ohci_clk>, <&ohci_clk>, <&uhpck>; + clock-names = "ohci_clk", "hclk", "uhpck"; status = "disabled"; }; }; diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi index a5895f3..644570e 100644 --- a/arch/arm/boot/dts/at91sam9g45.dtsi +++ b/arch/arm/boot/dts/at91sam9g45.dtsi @@ -1291,8 +1291,8 @@ compatible = "atmel,at91rm9200-ohci", "usb-ohci"; reg = <0x0070 0x10>; interrupts = <22 IRQ_TYPE_LEVEL_HIGH 2>; - clocks = <&usb>, <&uhphs_clk>, <&uhphs_clk>, <&uhpck>; - clock-names = "usb_clk", "ohci_clk", "hclk", "uhpck"; + clocks = <&uhphs_clk>, <&uhphs_clk>, <&uhpck>; + clock-names = "ohci_clk", "hclk", "uhpck"; status = "disabled"; }; diff --git a/arch/arm/boot/dts/at91sam9n12.dtsi b/arch/arm/boot/dts/at91sam9n12.dtsi index 0c53a37..8d4200d 100644 --- a/arch/arm/boot/dts/at91sam9n12.dtsi +++ b/arch/arm/boot/dts/at91sam9n12.dtsi @@ -940,9 +940,8 @@ compatible = "atmel,at91rm9200-ohci", "usb-ohci"; reg = <0x0050 0x0010>; interrupts = <22 IRQ_TYPE_LEVEL_HIGH 2>; - clocks = <&usb>, <&
[PATCH 4/5] ARM: at91/dt: remove useless uhpck clock references from ehci defintions
The uhpck is useless for High-Speed communications, remove the reference to this clock in all ehci definitions. Signed-off-by: Boris Brezillon --- arch/arm/boot/dts/at91sam9g45.dtsi | 4 ++-- arch/arm/boot/dts/at91sam9x5.dtsi | 4 ++-- arch/arm/boot/dts/sama5d3.dtsi | 4 ++-- arch/arm/boot/dts/sama5d4.dtsi | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi index 488af63..a5895f3 100644 --- a/arch/arm/boot/dts/at91sam9g45.dtsi +++ b/arch/arm/boot/dts/at91sam9g45.dtsi @@ -1300,8 +1300,8 @@ compatible = "atmel,at91sam9g45-ehci", "usb-ehci"; reg = <0x0080 0x10>; interrupts = <22 IRQ_TYPE_LEVEL_HIGH 2>; - clocks = <&utmi>, <&uhphs_clk>, <&uhphs_clk>, <&uhpck>; - clock-names = "usb_clk", "ehci_clk", "hclk", "uhpck"; + clocks = <&utmi>, <&uhphs_clk>; + clock-names = "usb_clk", "ehci_clk"; status = "disabled"; }; }; diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi index d221179..9a74a90 100644 --- a/arch/arm/boot/dts/at91sam9x5.dtsi +++ b/arch/arm/boot/dts/at91sam9x5.dtsi @@ -1185,8 +1185,8 @@ compatible = "atmel,at91sam9g45-ehci", "usb-ehci"; reg = <0x0070 0x10>; interrupts = <22 IRQ_TYPE_LEVEL_HIGH 2>; - clocks = <&utmi>, <&uhphs_clk>, <&uhpck>; - clock-names = "usb_clk", "ehci_clk", "uhpck"; + clocks = <&utmi>, <&uhphs_clk>; + clock-names = "usb_clk", "ehci_clk"; status = "disabled"; }; }; diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi index 367af53..a266a39 100644 --- a/arch/arm/boot/dts/sama5d3.dtsi +++ b/arch/arm/boot/dts/sama5d3.dtsi @@ -1415,8 +1415,8 @@ compatible = "atmel,at91sam9g45-ehci", "usb-ehci"; reg = <0x0070 0x10>; interrupts = <32 IRQ_TYPE_LEVEL_HIGH 2>; - clocks = <&utmi>, <&uhphs_clk>, <&uhpck>; - clock-names = "usb_clk", "ehci_clk", "uhpck"; + clocks = <&utmi>, <&uhphs_clk>; + clock-names = "usb_clk", "ehci_clk"; status = "disabled"; }; diff --git a/arch/arm/boot/dts/sama5d4.dtsi b/arch/arm/boot/dts/sama5d4.dtsi index 4303874..4bfe7c1 100644 --- a/arch/arm/boot/dts/sama5d4.dtsi +++ b/arch/arm/boot/dts/sama5d4.dtsi @@ -260,8 +260,8 @@ compatible = "atmel,at91sam9g45-ehci", "usb-ehci"; reg = <0x0060 0x10>; interrupts = <46 IRQ_TYPE_LEVEL_HIGH 2>; - clocks = <&utmi>, <&uhphs_clk>, <&uhpck>; - clock-names = "usb_clk", "ehci_clk", "uhpck"; + clocks = <&utmi>, <&uhphs_clk>; + clock-names = "usb_clk", "ehci_clk"; status = "disabled"; }; -- 1.9.1 -- 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
[PATCH 3/5] USB: atmel: update DT bindings documentation
Add documentation for the missing clocks, clock-names, reg and interrupts properties. Signed-off-by: Boris Brezillon --- .../devicetree/bindings/usb/atmel-usb.txt | 25 ++ 1 file changed, 25 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/atmel-usb.txt b/Documentation/devicetree/bindings/usb/atmel-usb.txt index e180d56..1be8d7a 100644 --- a/Documentation/devicetree/bindings/usb/atmel-usb.txt +++ b/Documentation/devicetree/bindings/usb/atmel-usb.txt @@ -5,6 +5,13 @@ OHCI Required properties: - compatible: Should be "atmel,at91rm9200-ohci" for USB controllers used in host mode. + - reg: Address and length of the register set for the device + - interrupts: Should contain ehci interrupt + - clocks: Should reference the peripheral, host and system clocks + - clock-names: Should contains two strings + "ohci_clk" for the peripheral clock + "hclk" for the host clock + "uhpck" for the system clock - num-ports: Number of ports. - atmel,vbus-gpio: If present, specifies a gpio that needs to be activated for the bus to be powered. @@ -14,6 +21,8 @@ Required properties: usb0: ohci@0050 { compatible = "atmel,at91rm9200-ohci", "usb-ohci"; reg = <0x0050 0x10>; + clocks = <&uhphs_clk>, <&uhphs_clk>, <&uhpck>; + clock-names = "ohci_clk", "hclk", "uhpck"; interrupts = <20 4>; num-ports = <2>; }; @@ -23,11 +32,19 @@ EHCI Required properties: - compatible: Should be "atmel,at91sam9g45-ehci" for USB controllers used in host mode. + - reg: Address and length of the register set for the device + - interrupts: Should contain ehci interrupt + - clocks: Should reference the peripheral and the UTMI clocks + - clock-names: Should contains two strings + "ehci_clk" for the peripheral clock + "usb_clk" for the UTMI clock usb1: ehci@0080 { compatible = "atmel,at91sam9g45-ehci", "usb-ehci"; reg = <0x0080 0x10>; interrupts = <22 4>; + clocks = <&utmi>, <&uhphs_clk>; + clock-names = "usb_clk", "ehci_clk"; }; AT91 USB device controller @@ -53,6 +70,8 @@ usb1: gadget@fffa4000 { compatible = "atmel,at91rm9200-udc"; reg = <0xfffa4000 0x4000>; interrupts = <10 4>; + clocks = <&udc_clk>, <&udpck>; + clock-names = "pclk", "hclk"; atmel,vbus-gpio = <&pioC 5 0>; }; @@ -65,6 +84,10 @@ Required properties: "sama5d3-udc" - reg: Address and length of the register set for the device - interrupts: Should contain usba interrupt + - clocks: Should reference the peripheral and host clocks + - clock-names: Should contains two strings + "pclk" for the peripheral clock + "hclk" for the host clock - ep childnode: To specify the number of endpoints and their properties. Optional properties: @@ -86,6 +109,8 @@ usb2: gadget@fff78000 { reg = <0x0060 0x8 0xfff78000 0x400>; interrupts = <27 4 0>; + clocks = <&utmi>, <&udphs_clk>; + clock-names = "hclk", "pclk"; atmel,vbus-gpio = <&pioB 19 0>; ep0 { -- 1.9.1 -- 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
[PATCH 1/5] USB: ehci-atmel: rework clk handling
The EHCI IP only needs the UTMI/UPLL (uclk) and the peripheral (iclk) clocks to work properly. Remove the useless system clock (fclk). Avoid calling set_rate on the fixed rate UTMI/IPLL clock and remove useless IS_ENABLED(CONFIG_COMMON_CLK) tests (all at91 platforms have been moved to the CCF). This patch also fixes a bug introduced by 3440ef1 (ARM: at91/dt: fix USB high-speed clock to select UTMI), which was leaving the usb clock uninitialized and preventing the OHCI driver from setting the usb clock rate to 48MHz. This bug was caused by several things: 1/ usb clock drivers set the CLK_SET_RATE_GATE flag, which means the rate cannot be changed once the clock is prepared 2/ The EHCI driver was retrieving and preparing/enabling the uhpck clock which was in turn preparing its parent clock (the usb clock), thus preventing any rate change because of 1/ Signed-off-by: Boris Brezillon --- drivers/usb/host/ehci-atmel.c | 30 +- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/drivers/usb/host/ehci-atmel.c b/drivers/usb/host/ehci-atmel.c index 663f790..be0964a 100644 --- a/drivers/usb/host/ehci-atmel.c +++ b/drivers/usb/host/ehci-atmel.c @@ -34,7 +34,6 @@ static const char hcd_name[] = "ehci-atmel"; struct atmel_ehci_priv { struct clk *iclk; - struct clk *fclk; struct clk *uclk; bool clocked; }; @@ -51,12 +50,9 @@ static void atmel_start_clock(struct atmel_ehci_priv *atmel_ehci) { if (atmel_ehci->clocked) return; - if (IS_ENABLED(CONFIG_COMMON_CLK)) { - clk_set_rate(atmel_ehci->uclk, 4800); - clk_prepare_enable(atmel_ehci->uclk); - } + + clk_prepare_enable(atmel_ehci->uclk); clk_prepare_enable(atmel_ehci->iclk); - clk_prepare_enable(atmel_ehci->fclk); atmel_ehci->clocked = true; } @@ -64,10 +60,9 @@ static void atmel_stop_clock(struct atmel_ehci_priv *atmel_ehci) { if (!atmel_ehci->clocked) return; - clk_disable_unprepare(atmel_ehci->fclk); + clk_disable_unprepare(atmel_ehci->iclk); - if (IS_ENABLED(CONFIG_COMMON_CLK)) - clk_disable_unprepare(atmel_ehci->uclk); + clk_disable_unprepare(atmel_ehci->uclk); atmel_ehci->clocked = false; } @@ -146,20 +141,13 @@ static int ehci_atmel_drv_probe(struct platform_device *pdev) retval = -ENOENT; goto fail_request_resource; } - atmel_ehci->fclk = devm_clk_get(&pdev->dev, "uhpck"); - if (IS_ERR(atmel_ehci->fclk)) { - dev_err(&pdev->dev, "Error getting function clock\n"); - retval = -ENOENT; + + atmel_ehci->uclk = devm_clk_get(&pdev->dev, "usb_clk"); + if (IS_ERR(atmel_ehci->uclk)) { + dev_err(&pdev->dev, "failed to get uclk\n"); + retval = PTR_ERR(atmel_ehci->uclk); goto fail_request_resource; } - if (IS_ENABLED(CONFIG_COMMON_CLK)) { - atmel_ehci->uclk = devm_clk_get(&pdev->dev, "usb_clk"); - if (IS_ERR(atmel_ehci->uclk)) { - dev_err(&pdev->dev, "failed to get uclk\n"); - retval = PTR_ERR(atmel_ehci->uclk); - goto fail_request_resource; - } - } ehci = hcd_to_ehci(hcd); /* registers start at offset 0x0 */ -- 1.9.1 -- 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
[PATCH 0/5] USB: atmel: rework clock handling
Hello, This series reworks clock handling in atmel USB host drivers, and while doing so fixes a regression introduced by 3440ef1 (ARM: at91/dt: fix USB high-speed clock to select UTMI). Best Regards, Boris Boris Brezillon (5): USB: ehci-atmel: rework clk handling USB: host: ohci-at91: remove useless uclk clock USB: atmel: update DT bindings documentation ARM: at91/dt: remove useless uhpck clock references from ehci defintions ARM: at91/dt: remove useless usb clock .../devicetree/bindings/usb/atmel-usb.txt | 25 ++ arch/arm/boot/dts/at91rm9200.dtsi | 4 +-- arch/arm/boot/dts/at91sam9260.dtsi | 4 +-- arch/arm/boot/dts/at91sam9261.dtsi | 4 +-- arch/arm/boot/dts/at91sam9263.dtsi | 4 +-- arch/arm/boot/dts/at91sam9g45.dtsi | 8 +++--- arch/arm/boot/dts/at91sam9n12.dtsi | 5 ++-- arch/arm/boot/dts/at91sam9x5.dtsi | 8 +++--- arch/arm/boot/dts/sama5d3.dtsi | 9 +++ arch/arm/boot/dts/sama5d4.dtsi | 9 +++ drivers/usb/host/ehci-atmel.c | 30 +++--- drivers/usb/host/ohci-at91.c | 18 +++-- 12 files changed, 63 insertions(+), 65 deletions(-) -- 1.9.1 -- 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
[PATCH 2/5] USB: host: ohci-at91: remove useless uclk clock
Now that the system clock driver is forwarding set_rate request to the parent clock, we can safely call clk_set_rate on the system clk and get rid of the uclk field. Signed-off-by: Boris Brezillon --- drivers/usb/host/ohci-at91.c | 18 +++--- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index 7cce85a..15df00c 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c @@ -39,7 +39,6 @@ struct ohci_at91_priv { struct clk *iclk; struct clk *fclk; - struct clk *uclk; struct clk *hclk; bool clocked; bool wakeup;/* Saved wake-up state for resume */ @@ -64,10 +63,8 @@ static void at91_start_clock(struct ohci_at91_priv *ohci_at91) { if (ohci_at91->clocked) return; - if (IS_ENABLED(CONFIG_COMMON_CLK)) { - clk_set_rate(ohci_at91->uclk, 4800); - clk_prepare_enable(ohci_at91->uclk); - } + + clk_set_rate(ohci_at91->fclk, 4800); clk_prepare_enable(ohci_at91->hclk); clk_prepare_enable(ohci_at91->iclk); clk_prepare_enable(ohci_at91->fclk); @@ -78,11 +75,10 @@ static void at91_stop_clock(struct ohci_at91_priv *ohci_at91) { if (!ohci_at91->clocked) return; + clk_disable_unprepare(ohci_at91->fclk); clk_disable_unprepare(ohci_at91->iclk); clk_disable_unprepare(ohci_at91->hclk); - if (IS_ENABLED(CONFIG_COMMON_CLK)) - clk_disable_unprepare(ohci_at91->uclk); ohci_at91->clocked = false; } @@ -191,14 +187,6 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver, retval = PTR_ERR(ohci_at91->hclk); goto err; } - if (IS_ENABLED(CONFIG_COMMON_CLK)) { - ohci_at91->uclk = devm_clk_get(dev, "usb_clk"); - if (IS_ERR(ohci_at91->uclk)) { - dev_err(dev, "failed to get uclk\n"); - retval = PTR_ERR(ohci_at91->uclk); - goto err; - } - } board = hcd->self.controller->platform_data; ohci = hcd_to_ohci(hcd); -- 1.9.1 -- 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
[PATCH 0/2] xhci features for usb-next
Hi Greg Two xhci patches for usb-next, one to add usb phy support to xhci-plat needed by Marvell Armada 385 AP to get its USB3 VBUS up. The other one is a tiny code consistency cleanup. -Mathias Lin Wang (1): xhci: unify cycle state toggling operation with 'XOR' Maxime Ripard (1): usb: xhci: plat: Add USB phy support drivers/usb/host/xhci-plat.c | 19 ++- drivers/usb/host/xhci-ring.c | 4 ++-- 2 files changed, 20 insertions(+), 3 deletions(-) -- 1.8.3.2 -- 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
[PATCH 1/2] xhci: unify cycle state toggling operation with 'XOR'
From: Lin Wang Some toggling operation in xHCI driver still use conditional toggling: ring->cycle_state = (ring->cycle_state ? 0 : 1); Use XOR to invert the cycle state instead of a conditional toggle to unify cycle state toggling operation in xHCI driver. Signed-off-by: Lin Wang Signed-off-by: Mathias Nyman --- drivers/usb/host/xhci-ring.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 5fb66db..da2ff50 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -238,7 +238,7 @@ static void inc_enq(struct xhci_hcd *xhci, struct xhci_ring *ring, /* Toggle the cycle bit after the last ring segment. */ if (last_trb_on_last_seg(xhci, ring, ring->enq_seg, next)) { - ring->cycle_state = (ring->cycle_state ? 0 : 1); + ring->cycle_state ^= 1; } } ring->enq_seg = ring->enq_seg->next; @@ -2809,7 +2809,7 @@ static int prepare_ring(struct xhci_hcd *xhci, struct xhci_ring *ep_ring, /* Toggle the cycle bit after the last ring segment. */ if (last_trb_on_last_seg(xhci, ring, ring->enq_seg, next)) { - ring->cycle_state = (ring->cycle_state ? 0 : 1); + ring->cycle_state ^= 1; } ring->enq_seg = ring->enq_seg->next; ring->enqueue = ring->enq_seg->trbs; -- 1.8.3.2 -- 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
[PATCH 2/2] usb: xhci: plat: Add USB phy support
From: Maxime Ripard The Marvell Armada 385 AP needs a dumb phy in order to enable the USB3 VBUS. Add a call to retrieve a USB PHY to XHCI plat in order to support this. Signed-off-by: Maxime Ripard Signed-off-by: Mathias Nyman --- drivers/usb/host/xhci-plat.c | 19 ++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 0e11d61..783e819 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -155,12 +156,27 @@ static int xhci_plat_probe(struct platform_device *pdev) if (HCC_MAX_PSA(xhci->hcc_params) >= 4) xhci->shared_hcd->can_do_streams = 1; + hcd->usb_phy = devm_usb_get_phy_by_phandle(&pdev->dev, "usb-phy", 0); + if (IS_ERR(hcd->usb_phy)) { + ret = PTR_ERR(hcd->usb_phy); + if (ret == -EPROBE_DEFER) + goto put_usb3_hcd; + hcd->usb_phy = NULL; + } else { + ret = usb_phy_init(hcd->usb_phy); + if (ret) + goto put_usb3_hcd; + } + ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED); if (ret) - goto put_usb3_hcd; + goto disable_usb_phy; return 0; +disable_usb_phy: + usb_phy_shutdown(hcd->usb_phy); + put_usb3_hcd: usb_put_hcd(xhci->shared_hcd); @@ -184,6 +200,7 @@ static int xhci_plat_remove(struct platform_device *dev) struct clk *clk = xhci->clk; usb_remove_hcd(xhci->shared_hcd); + usb_phy_shutdown(hcd->usb_phy); usb_put_hcd(xhci->shared_hcd); usb_remove_hcd(hcd); -- 1.8.3.2 -- 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 00/12] Remove mach-msm and associated code
On Fri, Mar 13, 2015 at 01:45:36PM -0700, Stephen Boyd wrote: > On 03/13/15 12:55, Arnd Bergmann wrote: > > On Friday 13 March 2015 11:09:33 Stephen Boyd wrote: > >> The maintainers for mach-msm no longer have any plans to support > >> or test the platforms supported by this architecture[1]. Most likely > >> there aren't any active users of this code anyway, so let's > >> delete it and the associated drivers/code. We should probably merge > >> this as one big series through arm-soc. Although some patches > >> should be fine to take through maintainers, some things like > >> mmc and usb have header file dependencies for platform_data. > >> > >> [1] http://lkml.kernel.org/r/20150307031212.ga8...@fifo99.com > >> > > As I wrote, I'd have a mild preference for doing the multiplatform > > conversion first and then removing the support in the following merge > > window, just in case someone wants that code back. > > > > If everyone wants to see that code die rather sooner than later, > > that's fine with me as well. > > I think everyone wants to see the code die now. They can always pull the > multi-platform patches from the list. I'll stash away my 7200 DT > conversion in case someone cares but I really doubt anybody does. I would say I want it to die , but it seems like you do .. It's fine with me tho .. Daniel -- 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 3/3] ARM: mvebu: armada-385-ap: Enable USB3 port
On Tue, Mar 17, 2015 at 06:34:21PM +0200, Mathias Nyman wrote: > On 17.03.2015 11:51, Maxime Ripard wrote: > > On Tue, Mar 03, 2015 at 06:12:44PM +0200, Mathias Nyman wrote: > >> On 03.03.2015 11:59, Maxime Ripard wrote: > >>> On Mon, Mar 02, 2015 at 08:23:37PM +0100, Gregory CLEMENT wrote: > Hi Maxime, > > On 19/01/2015 14:01, Maxime Ripard wrote: > > The Armada 385 AP board has a USB3 port exposed that uses a GPIO to > > drive the > > VBUS line. Enable the needed drivers to support this. > > > > it seems that this patch was not applied yet. Patch 1 is now in > linux-next and should be part of 4.0-rc. But what about patch 2? > >>> > >>> IIRC, Greg or Matthias said that Matthias would look into these > >>> patches after the merge window. > >>> > >>> It still didn't happen though. > >>> > >>> Maxime > >>> > >> > >> Hi > >> > >> I understood that you wanted the first fix patch in as soon as possible so > >> I sent it forward to Greg, and it's now in his usb-linus branch. > >> > >> The other two patches, 2/3 and 3/3 you said were "regual" patches (for > >> usb-next?), > >> Andrew said he can take 3/3 and wondered if 2/3 and 3/3 need to go > >> together? > >> > >> It doesn't matter for me, I can take 2/3 if you like, but I'd prefer if > >> someone > >> with more USB PHY insight could ack it first. > > > > There's been around two weeks, and we didn't have any additional > > reviews. How can we move forward on this? > > > > Added to my for-usb-next branch and sent forward to Greg (a second a go) Great, thanks! Maxime -- Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com signature.asc Description: Digital signature
Re: [PATCH v2 2/5] usb: chipidea: udc: add OTG status request handling
On Tue, Mar 17, 2015 at 10:06:44AM +0800, Peter Chen wrote: > On Mon, Mar 16, 2015 at 12:21:53PM -0500, Felipe Balbi wrote: > > On Mon, Mar 16, 2015 at 05:34:43PM +0800, Li Jun wrote: > > > On Mon, Mar 16, 2015 at 05:03:17PM +0800, Peter Chen wrote: > > > > On Mon, Mar 16, 2015 at 04:15:22PM +0800, Li Jun wrote: > > > > > On Mon, Mar 16, 2015 at 09:44:30AM +0800, Peter Chen wrote: > > > > > > On Fri, Mar 13, 2015 at 10:34:59AM -0500, Felipe Balbi wrote: > > > > > > > On Fri, Mar 13, 2015 at 11:13:11AM +0800, Peter Chen wrote: > > > > > > > > On Thu, Mar 12, 2015 at 11:04:09AM -0500, Felipe Balbi wrote: > > > > > > > > > > > > > > > > > > this could still be done generically in composite.c > > > > > > > > > > > > > > > > > > > > > > > > > I suggested it at v1, but after thinking more, we have handled > > > > > > > > DEVICE request type at individual udc driver, like remote > > > > > > > > wakeup, > > > > > > > > self-power support, so it is reasonable we handle get_status > > > > > > > > that > > > > > > > > if we support hnp polling at udc driver, since it is controller > > > > > > > > driver's capabilities. > > > > > > > > > > > > > > right, right.. it is controller's capabilities, but all > > > > > > > controller needs > > > > > > > to do is a set a flag in struct usb_gadget, which it already > > > > > > > does. Then, > > > > > > > every single udc will get free implementation after setting that > > > > > > > flag, > > > > > > > right ? > > > > > > > > > > > > > > > > > > > Great, then the udc driver which set b_hnp_enable can get the hnp > > > > > > polling capabilities automatically, in fact, hnp polling support > > > > > > is a software implement, I don't think it will affect old v1.3 otg > > > > > > driver. > > > > > > > > > > > > > > > > Existing flags in usb_gadget cannot exactly be used for judge if HNP > > > > > polling > > > > > is supported or not, support HNP does not necessarily means HNP > > > > > polling is > > > > > supported, in current code you can see b_hnp_enable is set for some > > > > > controllers > > > > > but they don't support HNP polling yet; > > > > > > > > Why HNP polling can't apply for all hnp enabled gadget? It is just a > > > > software feature, once the gadget is at device mode, it should be > > > > ready for hnp, meanwhile, you have already added host_request_flag > > > > at usb_gadget which the user can choose when to enable hnp polling. > > > > > > > > > > It can, just because in current code, some controllers support HNP but do > > > not > > > use OTG FSM driver, in this case I say they do not support HNP polling but > > > b_hnp_enable is set. > > > > then add a different flag, if you have to in order to maintain backwards > > compatibility. The fact that hnp polling is a completely SW > > implementation remains and we don't want to duplicate that all over the > > place. > > > > Felipe/Jun, since otg spec has changed, how about adding version check in code > first, it can avoid we add some feature selectors which is not defined > at otg spec, see: > > composite.c > > if (gadget_is_otg(gadget)) { > if (gadget_is_otg_13(gadget)) { > if (gadget->b_hnp_support) > gadget->host_requst_flag = true; > } else if (gadget_is_otg_20(gadget)) { > gadget->host_requst_flag = true; > } > } > > Then, every otg driver can use hnp polling, and 1.3 otg b device > can work with 2.0 otg a device well. sounds reasonable to me. But where would gadget_is_otg_13() be defined ? -- balbi signature.asc Description: Digital signature
Re: [PATCH v2 3/3] ARM: mvebu: armada-385-ap: Enable USB3 port
On 17.03.2015 11:51, Maxime Ripard wrote: > On Tue, Mar 03, 2015 at 06:12:44PM +0200, Mathias Nyman wrote: >> On 03.03.2015 11:59, Maxime Ripard wrote: >>> On Mon, Mar 02, 2015 at 08:23:37PM +0100, Gregory CLEMENT wrote: Hi Maxime, On 19/01/2015 14:01, Maxime Ripard wrote: > The Armada 385 AP board has a USB3 port exposed that uses a GPIO to drive > the > VBUS line. Enable the needed drivers to support this. > it seems that this patch was not applied yet. Patch 1 is now in linux-next and should be part of 4.0-rc. But what about patch 2? >>> >>> IIRC, Greg or Matthias said that Matthias would look into these >>> patches after the merge window. >>> >>> It still didn't happen though. >>> >>> Maxime >>> >> >> Hi >> >> I understood that you wanted the first fix patch in as soon as possible so >> I sent it forward to Greg, and it's now in his usb-linus branch. >> >> The other two patches, 2/3 and 3/3 you said were "regual" patches (for >> usb-next?), >> Andrew said he can take 3/3 and wondered if 2/3 and 3/3 need to go together? >> >> It doesn't matter for me, I can take 2/3 if you like, but I'd prefer if >> someone >> with more USB PHY insight could ack it first. > > There's been around two weeks, and we didn't have any additional > reviews. How can we move forward on this? > Added to my for-usb-next branch and sent forward to Greg (a second a go) -Mathias -- 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: Build failure: -next 20150316
On 3/16/2015 8:53 PM, Felipe Balbi wrote: > Hi, > > On Mon, Mar 16, 2015 at 07:59:04PM +, Alan Cox wrote: >> drivers/built-in.o: In function `dwc2_pci_remove': >> /rotating/Kernel/next/drivers/usb/dwc2/pci.c:70: undefined reference to >> `usb_phy_generic_unregister' drivers/built-in.o: In function >> `dwc2_pci_probe': /rotating/Kernel/next/drivers/usb/dwc2/pci.c:118: >> undefined reference to >> `usb_phy_generic_register' /rotating/Kernel/next/drivers/usb/dwc2/pci.c:141: >> undefined reference to `usb_phy_generic_unregister' Makefile:950: recipe >> for target 'vmlinux' failed make: *** [vmlinux] Error 1 > > I think I already a fix for this in my testing/next, just need to mergew > it into next after testing. > > Hi Felipe, I think it's different problem. I'll have a patch for you shortly. John -- 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: Build failure: -next 20150316
On Tue, Mar 17, 2015 at 10:41:52AM -0700, John Youn wrote: > On 3/16/2015 8:53 PM, Felipe Balbi wrote: > > Hi, > > > > On Mon, Mar 16, 2015 at 07:59:04PM +, Alan Cox wrote: > >> drivers/built-in.o: In function `dwc2_pci_remove': > >> /rotating/Kernel/next/drivers/usb/dwc2/pci.c:70: undefined reference to > >> `usb_phy_generic_unregister' drivers/built-in.o: In function > >> `dwc2_pci_probe': /rotating/Kernel/next/drivers/usb/dwc2/pci.c:118: > >> undefined reference to > >> `usb_phy_generic_register' > >> /rotating/Kernel/next/drivers/usb/dwc2/pci.c:141: > >> undefined reference to `usb_phy_generic_unregister' Makefile:950: recipe > >> for target 'vmlinux' failed make: *** [vmlinux] Error 1 > > > > I think I already a fix for this in my testing/next, just need to mergew > > it into next after testing. > > > > > > Hi Felipe, > > I think it's different problem. I'll have a patch for you > shortly. Thanks -- balbi signature.asc Description: Digital signature
[PATCH] usb: dwc2: pci: Correctly compile dwc2-pci as a module or built-in
The dwc2-pci driver should be compiled as a module when configured to do so. If the dwc2-pci is configured as a module but actually built-in, it can cause build errors due to the fact that the generic-phy will be allowed to compile as a module causing undefined references. Reported-by: Alan Cox Signed-off-by: John Youn --- drivers/usb/dwc2/Makefile | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/usb/dwc2/Makefile b/drivers/usb/dwc2/Makefile index 8f75267..f07b425 100644 --- a/drivers/usb/dwc2/Makefile +++ b/drivers/usb/dwc2/Makefile @@ -19,10 +19,8 @@ endif # mode. The PCI bus interface module will called dwc2_pci.ko and the platform # interface module will be called dwc2_platform.ko. -ifneq ($(CONFIG_USB_DWC2_PCI),) - obj-$(CONFIG_USB_DWC2) += dwc2_pci.o - dwc2_pci-y := pci.o -endif +obj-$(CONFIG_USB_DWC2_PCI) += dwc2_pci.o +dwc2_pci-y := pci.o obj-$(CONFIG_USB_DWC2_PLATFORM)+= dwc2_platform.o dwc2_platform-y:= platform.o -- 2.3.2 -- 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 1/5] USB: ehci-atmel: rework clk handling
On Tue, 17 Mar 2015, Boris Brezillon wrote: > The EHCI IP only needs the UTMI/UPLL (uclk) and the peripheral (iclk) > clocks to work properly. Remove the useless system clock (fclk). > > Avoid calling set_rate on the fixed rate UTMI/IPLL clock and remove > useless IS_ENABLED(CONFIG_COMMON_CLK) tests (all at91 platforms have been > moved to the CCF). > > This patch also fixes a bug introduced by 3440ef1 (ARM: at91/dt: fix USB > high-speed clock to select UTMI), which was leaving the usb clock > uninitialized and preventing the OHCI driver from setting the usb clock > rate to 48MHz. > This bug was caused by several things: > 1/ usb clock drivers set the CLK_SET_RATE_GATE flag, which means the rate >cannot be changed once the clock is prepared > 2/ The EHCI driver was retrieving and preparing/enabling the uhpck >clock which was in turn preparing its parent clock (the usb clock), >thus preventing any rate change because of 1/ > > Signed-off-by: Boris Brezillon Acked-by: Alan Stern -- 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 2/5] USB: host: ohci-at91: remove useless uclk clock
On Tue, 17 Mar 2015, Boris Brezillon wrote: > Now that the system clock driver is forwarding set_rate request to the > parent clock, we can safely call clk_set_rate on the system clk and get > rid of the uclk field. > > Signed-off-by: Boris Brezillon Acked-by: Alan Stern -- 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 0/2] usb: dwc2: add support for big-endian Lantiq SoCs
On 3/16/2015 7:24 PM, John Youn wrote: > On 3/12/2015 9:53 AM, Antti Seppälä wrote: >> Here are two patches needed to add support for mips based >> big-endian SoCs made by Lantiq to dwc2 driver. >> >> The first patch converts the readl/writel io-accessors of dwc2 to >> big-endian friendly versions and was discussed on the linux-usb ml >> already earlier. >> >> The second patch adds default fifo parameters for Lantiq SoCs to dwc2 >> which is needed to support devices equipped with smaller fifo sizes. >> >> Note: The only reason for the second patch to exist is that dynamic >> calculation algorithm in dwc2_calculate_dynamic_fifo does not cope well >> with fifo sizes below certain limit. >> >> Changes since previous version: >> * Patches updated to apply to latest dwc2 code >> * Fixing wrong comment style (as pointed out by Felipe Balbi) >> >> Antti Seppälä (2): >> usb: dwc2: Use platform endianness when accessing registers >> usb: dwc2: Add default fifo sizes for Lantiq SoCs >> >> Documentation/devicetree/bindings/usb/dwc2.txt | 1 + >> drivers/usb/dwc2/core.c| 341 >> + >> drivers/usb/dwc2/core.h| 29 ++- >> drivers/usb/dwc2/core_intr.c | 73 +++--- >> drivers/usb/dwc2/gadget.c | 312 +++--- >> drivers/usb/dwc2/hcd.c | 138 +- >> drivers/usb/dwc2/hcd.h | 15 +- >> drivers/usb/dwc2/hcd_ddma.c| 10 +- >> drivers/usb/dwc2/hcd_intr.c| 82 +++--- >> drivers/usb/dwc2/hcd_queue.c | 10 +- >> drivers/usb/dwc2/platform.c| 29 +++ >> 11 files changed, 545 insertions(+), 495 deletions(-) >> > > For this series: > > Acked-by: John Youn > Hi Felipe, Can you hold off on merging this series until we get Yousaf's latest changes reviewed and merged? I think it would be easier to redo this series than the other way around. Thanks, John -- 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: cdc_mbim with Huawei E3372, nothing works
Sami Farin writes: > On Mon, Feb 23, 2015 at 11:59:14 +0100, Bjørn Mork wrote: >> So my conclusion is that there is some higher level USB communication >> problem here, not directly involving neither usbnet nor the minidriver. > > Do you have new ideas as to where the problem might be? > I have now used the cdc_ether driver to transfer 1 TiB with zero rx/tx errors. OK, that is an indication that my wild guess was wrong. I have really no idea why this fails. We obviously do something the modem doesn't like, but I don't know what it is. Sorry > I also noticed cdc_ether initialization or something does not work with kernel > 4.0.0-rc4, I have to first setup it in 3.18.9 and then reboot to 4.0.0-rc4. That is unexpected and even more difficult to explain. There aren't many changes to usbnet or cdc_ether between v3.18 and v4.0-rc4: bjorn@nemi:/usr/local/src/git/linux$ git log --oneline v3.18..v4.0-rc4 -- drivers/net/usb/{usbnet,cdc_ether}.c 51487ae736fe usbnet: re-use native hex2bin() f46ad73ac696 cdc-ether: implement MULTICAST flag on the device 55b42b5ca2dc Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net I gues the only possibility is the multicast filter change, but it doesn't look like that should change anything by default. Any ideas on this one, Oliver? Bjørn -- 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
[PATCH v2] phy: Add a driver for dm816x USB PHY
Add a minimal driver for dm816x USB. This makes USB work on dm816x without any other changes needed as it can use the existing musb_dsps glue layer for the USB controller. Note that this phy is different from dm814x and am335x. Cc: Bin Liu Cc: Brian Hutchinson Cc: Felipe Balbi Cc: Matthijs van Duin Cc: Paul Bolle Cc: Rusty Russell Signed-off-by: Tony Lindgren --- .../devicetree/bindings/phy/dm816x-phy.txt | 24 ++ drivers/phy/Kconfig| 7 + drivers/phy/Makefile | 1 + drivers/phy/phy-dm816x-usb.c | 304 + 4 files changed, 336 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/dm816x-phy.txt create mode 100644 drivers/phy/phy-dm816x-usb.c diff --git a/Documentation/devicetree/bindings/phy/dm816x-phy.txt b/Documentation/devicetree/bindings/phy/dm816x-phy.txt new file mode 100644 index 000..2fe3d11 --- /dev/null +++ b/Documentation/devicetree/bindings/phy/dm816x-phy.txt @@ -0,0 +1,24 @@ +Device tree binding documentation for am816x USB PHY += + +Required properties: +- compatible : should be "ti,dm816x-usb-phy" +- reg : offset and length of the PHY register set. +- reg-names : name for the phy registers +- clocks : phandle to the clock +- clock-names : name of the clock +- syscon: phandle for the syscon node to access misc registers +- #phy-cells : from the generic PHY bindings, must be 1 +- syscon: phandle for the syscon node to access misc registers + +Example: + +usb_phy0: usb-phy@20 { + compatible = "ti,dm8168-usb-phy"; + reg = <0x20 0x8>; + reg-names = "phy"; + clocks = <&main_fapll 6>; + clock-names = "refclk"; + #phy-cells = <0>; + syscon = <&scm_conf>; +}; diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index 2962de2..c858c2b 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -35,6 +35,13 @@ config ARMADA375_USBCLUSTER_PHY depends on OF select GENERIC_PHY +config PHY_DM816X_USB + tristate "TI dm816x USB PHY driver" + depends on ARCH_OMAP2PLUS + select GENERIC_PHY + help + Enable this for dm81xx USB to work." + config PHY_EXYNOS_MIPI_VIDEO tristate "S5P/EXYNOS SoC series MIPI CSI-2/DSI PHY driver" depends on HAS_IOMEM diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index f080e1b..dab6665 100644 --- a/drivers/phy/Makefile +++ b/drivers/phy/Makefile @@ -5,6 +5,7 @@ obj-$(CONFIG_GENERIC_PHY) += phy-core.o obj-$(CONFIG_PHY_BERLIN_USB) += phy-berlin-usb.o obj-$(CONFIG_PHY_BERLIN_SATA) += phy-berlin-sata.o +obj-$(CONFIG_PHY_DM816X_USB) += phy-dm816x-usb.o obj-$(CONFIG_ARMADA375_USBCLUSTER_PHY) += phy-armada375-usb2.o obj-$(CONFIG_BCM_KONA_USB2_PHY)+= phy-bcm-kona-usb2.o obj-$(CONFIG_PHY_EXYNOS_DP_VIDEO) += phy-exynos-dp-video.o diff --git a/drivers/phy/phy-dm816x-usb.c b/drivers/phy/phy-dm816x-usb.c new file mode 100644 index 000..2fc276d --- /dev/null +++ b/drivers/phy/phy-dm816x-usb.c @@ -0,0 +1,304 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation version 2. + * + * This program is distributed "as is" WITHOUT ANY WARRANTY of any + * kind, whether express or implied; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +/* + * TRM has two sets of USB_CTRL registers.. The correct register bits + * are in TRM section 24.9.8.2 USB_CTRL Register. The TRM documents the + * phy as being SR70LX Synopsys USB 2.0 OTG nanoPHY. It also seems at + * least dm816x rev c ignores writes to USB_CTRL register, but the TI + * kernel is writing to those so it's possible that later revisions + * have worknig USB_CTRL register. + * + * Also note that At least USB_CTRL register seems to be dm816x specific + * according to the TRM. It's possible that USBPHY_CTRL is more generic, + * but that would have to be checked against the SR70LX documentation + * which does not seem to be publicly available. + * + * Finally, the phy on dm814x and am335x is different from dm816x. + */ +#define DM816X_USB_CTRL_PHYCLKSRC BIT(8) /* 1 = PLL ref clock */ +#define DM816X_USB_CTRL_PHYSLEEP1 BIT(1) /* Enable the first phy */ +#define DM816X_USB_CTRL_PHYSLEEP0 BIT(0) /* Enable the second phy */ + +#define DM816X_USBPHY_CTRL_TXRISETUNE 1 +#define DM816X_USBPHY_CTRL_TXVREFTUNE 0xc +#define DM816X_USBPHY_CTRL_TXPREEMTUNE 0x2 + +struct dm816x_usb_phy { + struct regmap *syscon; + struct device *dev; + unsigned int instance; + struct clk *r
Re: [PATCH v2 0/2] usb: dwc2: add support for big-endian Lantiq SoCs
On Tue, Mar 17, 2015 at 12:23:03PM -0700, John Youn wrote: > On 3/16/2015 7:24 PM, John Youn wrote: > > On 3/12/2015 9:53 AM, Antti Seppälä wrote: > >> Here are two patches needed to add support for mips based > >> big-endian SoCs made by Lantiq to dwc2 driver. > >> > >> The first patch converts the readl/writel io-accessors of dwc2 to > >> big-endian friendly versions and was discussed on the linux-usb ml > >> already earlier. > >> > >> The second patch adds default fifo parameters for Lantiq SoCs to dwc2 > >> which is needed to support devices equipped with smaller fifo sizes. > >> > >> Note: The only reason for the second patch to exist is that dynamic > >> calculation algorithm in dwc2_calculate_dynamic_fifo does not cope well > >> with fifo sizes below certain limit. > >> > >> Changes since previous version: > >> * Patches updated to apply to latest dwc2 code > >> * Fixing wrong comment style (as pointed out by Felipe Balbi) > >> > >> Antti Seppälä (2): > >> usb: dwc2: Use platform endianness when accessing registers > >> usb: dwc2: Add default fifo sizes for Lantiq SoCs > >> > >> Documentation/devicetree/bindings/usb/dwc2.txt | 1 + > >> drivers/usb/dwc2/core.c| 341 > >> + > >> drivers/usb/dwc2/core.h| 29 ++- > >> drivers/usb/dwc2/core_intr.c | 73 +++--- > >> drivers/usb/dwc2/gadget.c | 312 > >> +++--- > >> drivers/usb/dwc2/hcd.c | 138 +- > >> drivers/usb/dwc2/hcd.h | 15 +- > >> drivers/usb/dwc2/hcd_ddma.c| 10 +- > >> drivers/usb/dwc2/hcd_intr.c| 82 +++--- > >> drivers/usb/dwc2/hcd_queue.c | 10 +- > >> drivers/usb/dwc2/platform.c| 29 +++ > >> 11 files changed, 545 insertions(+), 495 deletions(-) > >> > > > > For this series: > > > > Acked-by: John Youn > > > > Hi Felipe, > > Can you hold off on merging this series until we get Yousaf's > latest changes reviewed and merged? I think it would be easier to > redo this series than the other way around. sure thing, dropping from my queue for now. -- balbi signature.asc Description: Digital signature
Re: [PATCH v2 2/5] usb: chipidea: udc: add OTG status request handling
On Tue, Mar 17, 2015 at 12:09:22PM -0500, Felipe Balbi wrote: > On Tue, Mar 17, 2015 at 10:06:44AM +0800, Peter Chen wrote: > > On Mon, Mar 16, 2015 at 12:21:53PM -0500, Felipe Balbi wrote: > > > On Mon, Mar 16, 2015 at 05:34:43PM +0800, Li Jun wrote: > > > > On Mon, Mar 16, 2015 at 05:03:17PM +0800, Peter Chen wrote: > > > > > On Mon, Mar 16, 2015 at 04:15:22PM +0800, Li Jun wrote: > > > > > > On Mon, Mar 16, 2015 at 09:44:30AM +0800, Peter Chen wrote: > > > > > > > On Fri, Mar 13, 2015 at 10:34:59AM -0500, Felipe Balbi wrote: > > > > > > > > On Fri, Mar 13, 2015 at 11:13:11AM +0800, Peter Chen wrote: > > > > > > > > > On Thu, Mar 12, 2015 at 11:04:09AM -0500, Felipe Balbi wrote: > > > > > > > > > > > > > > > > > > > > this could still be done generically in composite.c > > > > > > > > > > > > > > > > > > > > > > > > > > > > I suggested it at v1, but after thinking more, we have handled > > > > > > > > > DEVICE request type at individual udc driver, like remote > > > > > > > > > wakeup, > > > > > > > > > self-power support, so it is reasonable we handle get_status > > > > > > > > > that > > > > > > > > > if we support hnp polling at udc driver, since it is > > > > > > > > > controller > > > > > > > > > driver's capabilities. > > > > > > > > > > > > > > > > right, right.. it is controller's capabilities, but all > > > > > > > > controller needs > > > > > > > > to do is a set a flag in struct usb_gadget, which it already > > > > > > > > does. Then, > > > > > > > > every single udc will get free implementation after setting > > > > > > > > that flag, > > > > > > > > right ? > > > > > > > > > > > > > > > > > > > > > > Great, then the udc driver which set b_hnp_enable can get the hnp > > > > > > > polling capabilities automatically, in fact, hnp polling support > > > > > > > is a software implement, I don't think it will affect old v1.3 otg > > > > > > > driver. > > > > > > > > > > > > > > > > > > > Existing flags in usb_gadget cannot exactly be used for judge if > > > > > > HNP polling > > > > > > is supported or not, support HNP does not necessarily means HNP > > > > > > polling is > > > > > > supported, in current code you can see b_hnp_enable is set for some > > > > > > controllers > > > > > > but they don't support HNP polling yet; > > > > > > > > > > Why HNP polling can't apply for all hnp enabled gadget? It is just a > > > > > software feature, once the gadget is at device mode, it should be > > > > > ready for hnp, meanwhile, you have already added host_request_flag > > > > > at usb_gadget which the user can choose when to enable hnp polling. > > > > > > > > > > > > > It can, just because in current code, some controllers support HNP but > > > > do not > > > > use OTG FSM driver, in this case I say they do not support HNP polling > > > > but > > > > b_hnp_enable is set. > > > > > > then add a different flag, if you have to in order to maintain backwards > > > compatibility. The fact that hnp polling is a completely SW > > > implementation remains and we don't want to duplicate that all over the > > > place. > > > > > > > Felipe/Jun, since otg spec has changed, how about adding version check in > > code > > first, it can avoid we add some feature selectors which is not defined > > at otg spec, see: > > > > composite.c > > > > if (gadget_is_otg(gadget)) { > > if (gadget_is_otg_13(gadget)) { > > if (gadget->b_hnp_support) > > gadget->host_requst_flag = true; > > } else if (gadget_is_otg_20(gadget)) { > > gadget->host_requst_flag = true; > > } > > } > > > > Then, every otg driver can use hnp polling, and 1.3 otg b device > > can work with 2.0 otg a device well. > > sounds reasonable to me. But where would gadget_is_otg_13() be defined ? > gadget_is_otg_13 is another big topic. At otg 2.0 spec, it introduces bcdOTG entry at descriptor to indicate otg release number, bcdOTG should be controller driver property, some driver follows 1.3 spec, some may follow 2.0 spec or later. But currently, we define otg descriptor at gadget driver, and it defines bmAttributes as USB_OTG_SRP | USB_OTG_HNP unconditionally. From my point, both bmAttributes and bcdOTG should be decided by controller driver, we can have several entries at struct usb_gadget to indicate these, and fill the otg descriptor at gadget driver. I go back to review Jun's hnp polling patches, your suggestion (add hpn_polling_support flag at struct usb_gadget) is more suitable, the legacy otg device should stall polling request instead of responding it. -- Best Regards, Peter Chen -- 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 v3 2/8] usb: add OTG status selector definition for HNP polling
On Tue, Mar 17, 2015 at 10:37:46PM +0800, Li Jun wrote: > A host is required to use the GetStatus command, with wIndex set to the OTG > status selector(F000H) to request the Host request flag from the peripheral. Small comment, "Host request flag" you may use all words in capital letter or lower letter. Other than that: Acked-by: Peter Chen > > Signed-off-by: Li Jun > --- > include/uapi/linux/usb/ch9.h |2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/include/uapi/linux/usb/ch9.h b/include/uapi/linux/usb/ch9.h > index aa33fd1..a50ec5f 100644 > --- a/include/uapi/linux/usb/ch9.h > +++ b/include/uapi/linux/usb/ch9.h > @@ -678,6 +678,8 @@ struct usb_otg_descriptor { > #define USB_OTG_SRP (1 << 0) > #define USB_OTG_HNP (1 << 1)/* swap host/device roles */ > > +#define OTG_STS_SELECTOR 0xF000 /* OTG status selector */ > + > /*-*/ > > /* USB_DT_DEBUG: for special highspeed devices, replacing serial console */ > -- > 1.7.9.5 > -- Best Regards, Peter Chen -- 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 v3 1/8] usb: gadget: add hnp_polling_support and host_request_flag in usb_gadget
On Tue, Mar 17, 2015 at 10:37:45PM +0800, Li Jun wrote: > From: Li Jun > > Add 2 flags for USB OTG HNP polling, hnp_polling_support is to indicate if > the gadget can support HNP polling, host_request_flag is used for gadget > to store host request information from application, which can be used to > respond to HNP polling from host. > > Signed-off-by: Li Jun > --- > include/linux/usb/gadget.h |6 ++ > 1 file changed, 6 insertions(+) > > diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h > index e2f00fd..6c7dc43 100644 > --- a/include/linux/usb/gadget.h > +++ b/include/linux/usb/gadget.h > @@ -521,6 +521,10 @@ struct usb_gadget_ops { > * only supports HNP on a different root port. > * @b_hnp_enable: OTG device feature flag, indicating that the A-Host > * enabled HNP support. > + * @hnp_polling_support: OTG device feature flag, indicating if the OTG > device > + * in peripheral mode can support HNP polling. > + * @host_request_flag: OTG device feature flag, indicating if A-Peripheral > + * or B-Peripheral wants to take host role. > * @quirk_ep_out_aligned_size: epout requires buffer size to be aligned to > * MaxPacketSize. > * @is_selfpowered: if the gadget is self-powered. > @@ -563,6 +567,8 @@ struct usb_gadget { > unsignedb_hnp_enable:1; > unsigneda_hnp_support:1; > unsigneda_alt_hnp_support:1; > + unsignedhnp_polling_support:1; > + unsignedhost_request_flag:1; > unsignedquirk_ep_out_aligned_size:1; > unsignedis_selfpowered:1; > }; > -- > 1.7.9.5 > Acked-by: Peter Chen -- Best Regards, Peter Chen -- 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 v1 03/20] usb: dwc2: add controller hibernation support
On 3/17/2015 2:54 AM, Mian Yousaf Kaukab wrote: > From: Gregory Herrero > > When suspending usb bus, phy driver may disable controller power. > In this case, registers need to be saved on suspend and restored > on resume. > > Signed-off-by: Gregory Herrero > --- > drivers/usb/dwc2/core.c | 382 > > drivers/usb/dwc2/core.h | 84 +++ > 2 files changed, 466 insertions(+) > > diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c > index d5197d4..bf62d30 100644 > --- a/drivers/usb/dwc2/core.c > +++ b/drivers/usb/dwc2/core.c > @@ -56,6 +56,388 @@ > #include "core.h" > #include "hcd.h" > > +#if IS_ENABLED(CONFIG_USB_DWC2_HOST) || IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE) > +/** > + * dwc2_backup_host_registers() - Backup controller host registers. > + * When suspending usb bus, registers needs to be backuped > + * if controller power is disabled once suspended. > + * > + * @hsotg: Programming view of the DWC_otg controller > + */ > +static int dwc2_backup_host_registers(struct dwc2_hsotg *hsotg) > +{ > + struct dwc2_hregs_backup *hr; > + int i; > + > + dev_dbg(hsotg->dev, "%s\n", __func__); > + > + /* Backup Host regs */ > + hr = hsotg->hr_backup; > + if (!hr) { > + hr = kmalloc(sizeof(*hr), GFP_KERNEL); > + if (!hr) { > + dev_err(hsotg->dev, "%s: can't allocate host regs\n", > + __func__); > + return -ENOMEM; > + } > + > + hsotg->hr_backup = hr; > + } > + hr->hcfg = readl(hsotg->regs + HCFG); > + hr->haintmsk = readl(hsotg->regs + HAINTMSK); > + for (i = 0; i < hsotg->core_params->host_channels; ++i) > + hr->hcintmsk[i] = readl(hsotg->regs + HCINTMSK(i)); > + > + hr->hprt0 = readl(hsotg->regs + HPRT0); > + hr->hfir = readl(hsotg->regs + HFIR); > + return 0; > +} > + > +/** > + * dwc2_restore_host_registers() - Restore controller host registers. > + * When resuming usb bus, device registers needs to be restored > + * if controller power were disabled. > + * > + * @hsotg: Programming view of the DWC_otg controller > + */ > +static int dwc2_restore_host_registers(struct dwc2_hsotg *hsotg) > +{ > + struct dwc2_hregs_backup *hr; > + int i; > + > + dev_dbg(hsotg->dev, "%s\n", __func__); > + > + /* Restore host regs */ > + hr = hsotg->hr_backup; > + if (!hr) { > + dev_err(hsotg->dev, "%s: no host registers to restore\n", > + __func__); > + return -EINVAL; > + } > + > + writel(hr->hcfg, hsotg->regs + HCFG); > + writel(hr->haintmsk, hsotg->regs + HAINTMSK); > + > + for (i = 0; i < hsotg->core_params->host_channels; ++i) > + writel(hr->hcintmsk[i], hsotg->regs + HCINTMSK(i)); > + > + writel(hr->hprt0, hsotg->regs + HPRT0); > + writel(hr->hfir, hsotg->regs + HFIR); > + > + kfree(hsotg->hr_backup); Should NULL this out otherwise you will reuse free'd memory. Maybe better, you could just free this on remove. Just reuse the same buffer each time. Same with device/global registers. John -- 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 v1 12/20] usb: dwc2: gadget: enable otg flag in dual role configuration
On 3/17/2015 2:54 AM, Mian Yousaf Kaukab wrote: > From: Gregory Herrero > > Signed-off-by: Gregory Herrero > --- > drivers/usb/dwc2/gadget.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c > index bb83826..2e27bfd 100644 > --- a/drivers/usb/dwc2/gadget.c > +++ b/drivers/usb/dwc2/gadget.c > @@ -3524,6 +3524,9 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq) > hsotg->gadget.max_speed = USB_SPEED_HIGH; > hsotg->gadget.ops = &s3c_hsotg_gadget_ops; > hsotg->gadget.name = dev_name(dev); > +#if IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE) > + hsotg->gadget.is_otg = 1; > +#endif Should check dr_mode as well. It may be peripheral even though we are configured for DRD. John -- 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 v1 17/20] usb: dwc2: host: spinlock urb_enqueue
On 3/17/2015 2:54 AM, Mian Yousaf Kaukab wrote: > From: Gregory Herrero > > During urb_enqueue, if the urb can't be queued to the endpoint, > the urb is freed without any spinlock protection. > This leads to memory corruption when concurrent urb_dequeue try to free > same urb->hcpriv. > Thus, ensure the whole urb_enqueue in spinlocked. > > Signed-off-by: Gregory Herrero > --- > drivers/usb/dwc2/hcd.c | 9 ++--- > drivers/usb/dwc2/hcd_queue.c | 6 -- > 2 files changed, 2 insertions(+), 13 deletions(-) > > diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c > index 23a8f2f..fd2ad25 100644 > --- a/drivers/usb/dwc2/hcd.c > +++ b/drivers/usb/dwc2/hcd.c > @@ -354,7 +354,6 @@ static int dwc2_hcd_urb_enqueue(struct dwc2_hsotg *hsotg, > gfp_t mem_flags) > { > struct dwc2_qtd *qtd; > - unsigned long flags; > u32 intr_mask; > int retval; > int dev_speed; > @@ -405,11 +404,9 @@ static int dwc2_hcd_urb_enqueue(struct dwc2_hsotg *hsotg, >*/ > return 0; > > - spin_lock_irqsave(&hsotg->lock, flags); > tr_type = dwc2_hcd_select_transactions(hsotg); > if (tr_type != DWC2_TRANSACTION_NONE) > dwc2_hcd_queue_transactions(hsotg, tr_type); > - spin_unlock_irqrestore(&hsotg->lock, flags); > } > > return 0; > @@ -2504,7 +2501,6 @@ static int _dwc2_hcd_urb_enqueue(struct usb_hcd *hcd, > struct urb *urb, > > spin_lock_irqsave(&hsotg->lock, flags); > retval = usb_hcd_link_urb_to_ep(hcd, urb); > - spin_unlock_irqrestore(&hsotg->lock, flags); > if (retval) > goto fail1; Spinlock not unlocked in this condition. > > @@ -2513,17 +2509,16 @@ static int _dwc2_hcd_urb_enqueue(struct usb_hcd *hcd, > struct urb *urb, > goto fail2; > > if (alloc_bandwidth) { > - spin_lock_irqsave(&hsotg->lock, flags); > dwc2_allocate_bus_bandwidth(hcd, > dwc2_hcd_get_ep_bandwidth(hsotg, ep), > urb); > - spin_unlock_irqrestore(&hsotg->lock, flags); > } > > + spin_unlock_irqrestore(&hsotg->lock, flags); > + > return 0; > > fail2: > - spin_lock_irqsave(&hsotg->lock, flags); > dwc2_urb->priv = NULL; > usb_hcd_unlink_urb_from_ep(hcd, urb); > spin_unlock_irqrestore(&hsotg->lock, flags); > diff --git a/drivers/usb/dwc2/hcd_queue.c b/drivers/usb/dwc2/hcd_queue.c > index bb97838..02103b66 100644 > --- a/drivers/usb/dwc2/hcd_queue.c > +++ b/drivers/usb/dwc2/hcd_queue.c > @@ -777,7 +777,6 @@ int dwc2_hcd_qtd_add(struct dwc2_hsotg *hsotg, struct > dwc2_qtd *qtd, >struct dwc2_qh **qh, gfp_t mem_flags) Document spinlock must be held. > { > struct dwc2_hcd_urb *urb = qtd->urb; > - unsigned long flags; > int allocated = 0; > int retval; > > @@ -792,7 +791,6 @@ int dwc2_hcd_qtd_add(struct dwc2_hsotg *hsotg, struct > dwc2_qtd *qtd, > allocated = 1; > } > > - spin_lock_irqsave(&hsotg->lock, flags); > Extra newline introduced here. > retval = dwc2_hcd_qh_add(hsotg, *qh); > if (retval) > @@ -800,7 +798,6 @@ int dwc2_hcd_qtd_add(struct dwc2_hsotg *hsotg, struct > dwc2_qtd *qtd, > > qtd->qh = *qh; > list_add_tail(&qtd->qtd_list_entry, &(*qh)->qtd_list); > - spin_unlock_irqrestore(&hsotg->lock, flags); > > return 0; > > @@ -817,10 +814,7 @@ fail: >qtd_list_entry) > dwc2_hcd_qtd_unlink_and_free(hsotg, qtd2, qh_tmp); > > - spin_unlock_irqrestore(&hsotg->lock, flags); > dwc2_hcd_qh_free(hsotg, qh_tmp); > - } else { > - spin_unlock_irqrestore(&hsotg->lock, flags); > } > > return retval; > -- 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 v1 00/20] usb: third series of updates for dwc2 driver
On 3/17/2015 2:54 AM, Mian Yousaf Kaukab wrote: > Hi, > This patchset consists of some bug fixes and feature enhancements for > the dwc2 driver. All the patches are verified on dwc2 v3.0a with > dedicated fifos. Main focus of testing was with dma enabled. Although > basic testing without dma was also done. > > This is based on testing/next branch in Felipe's git. > > Thank you, > > Best regards, > Yousaf > Hi Yousaf, Patch 15 and 16 introduce regressions in two systems that I tested with. After patch 15, the host fails to work at all. After patch 16, the host works but the device fails enumeration whenever switching from an A to B cable, going from host to peripheral. After this fails, if you unplug and replug the B cable it will enumerate. But whenever you switch from A to B it always fails. Tested on a Synopsys (2.94a) and Altera (2.93a) system. I don't have any logs right now but I can get those tomorrow if you need them. John > History: > v1: > - Fixed comments from John Youn and Robert Baldyga > - Dropped all changes to pci.c due to >http://permalink.gmane.org/gmane.linux.usb.general/123411 > - Added patch to remove unnecessary EXPORT_SYMBOL_GPL calls > > Gregory Herrero (13): > usb: dwc2: add controller hibernation support > usb: dwc2: implement hibernation during bus suspend/resume > usb: dwc2: controller must update lx_state before releasing lock > usb: dwc2: add external_id_pin_ctl core parameter > usb: dwc2: gadget: use reset detect interrupt > usb: dwc2: gadget: ignore pm suspend/resume in L2 > usb: dwc2: gadget: prevent new request submission during suspend > usb: dwc2: gadget: powerup controller if needed > usb: dwc2: gadget: enable otg flag in dual role configuration > usb: dwc2: host: add bus_suspend/bus_resume callback > usb: dwc2: host: resume root hub on port connect > usb: dwc2: host: spinlock urb_enqueue > usb: dwc2: host: don't use dma_alloc_coherent with irqs disabled > > Jingwu Lin (1): > usb: dwc2: host: implement test mode > > Mian Yousaf Kaukab (6): > usb: dwc2: move debugfs code to a separate file > usb: dwc2: debugfs: add support for complete register dump > usb: dwc2: set parameter values in probe function > usb: dwc2: gadget: remove s3c_hsotg_ep_disable_force > usb: dwc2: host: register handle to the phy > usb: dwc2: remove dwc2_platform.ko > > drivers/usb/dwc2/Kconfig | 8 - > drivers/usb/dwc2/Makefile| 9 +- > drivers/usb/dwc2/core.c | 420 ++- > drivers/usb/dwc2/core.h | 113 ++- > drivers/usb/dwc2/core_intr.c | 44 ++- > drivers/usb/dwc2/debug.h | 27 ++ > drivers/usb/dwc2/debugfs.c | 770 > +++ > drivers/usb/dwc2/gadget.c| 459 +++--- > drivers/usb/dwc2/hcd.c | 86 +++-- > drivers/usb/dwc2/hcd.h | 7 +- > drivers/usb/dwc2/hcd_intr.c | 13 + > drivers/usb/dwc2/hcd_queue.c | 13 +- > drivers/usb/dwc2/platform.c | 23 +- > 13 files changed, 1491 insertions(+), 501 deletions(-) > create mode 100644 drivers/usb/dwc2/debug.h > create mode 100644 drivers/usb/dwc2/debugfs.c > -- 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 v1 02/20] usb: dwc2: debugfs: add support for complete register dump
On 3/17/2015 2:54 AM, Mian Yousaf Kaukab wrote: > Dump all registers to take a complete snapshot of dwc2 state. > Code is inspired by dwc3/debugfs.c > > Signed-off-by: Mian Yousaf Kaukab > --- > drivers/usb/dwc2/core.h| 1 + > drivers/usb/dwc2/debugfs.c | 356 > + > 2 files changed, 357 insertions(+) > > diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h > index 3695c6f..1fd8d2b 100644 > --- a/drivers/usb/dwc2/core.h > +++ b/drivers/usb/dwc2/core.h > @@ -615,6 +615,7 @@ struct dwc2_hsotg { > enum dwc2_lx_state lx_state; > > struct dentry *debug_root; > + struct debugfs_regset32 *regset; > > /* DWC OTG HW Release versions */ > #define DWC2_CORE_REV_2_71a 0x4f54271a > diff --git a/drivers/usb/dwc2/debugfs.c b/drivers/usb/dwc2/debugfs.c > index e57e554..2b9e1c2 100644 > --- a/drivers/usb/dwc2/debugfs.c > +++ b/drivers/usb/dwc2/debugfs.c > @@ -391,9 +391,344 @@ static inline void s3c_hsotg_create_debug(struct > dwc2_hsotg *hsotg) {} > > /* s3c_hsotg_delete_debug is removed as cleanup in done in dwc2_debugfs_exit > */ > > +#define dump_register(nm)\ > +{\ > + .name = #nm, \ > + .offset = nm, \ > +} > + > +static const struct debugfs_reg32 dwc2_regs[] = { > + /* > + * Accessing registers like this can trigger mode mismatch interrupt. > + * However, according to dwc2 databook, the register access, in this > + * case, is completed on the processor bus but is ignored by the core > + * and does not affect its operation. > + */ > + dump_register(GOTGCTL), > + dump_register(GOTGINT), > + dump_register(GAHBCFG), > + dump_register(GUSBCFG), > + dump_register(GRSTCTL), > + dump_register(GINTSTS), > + dump_register(GINTMSK), > + dump_register(GRXSTSR), > + dump_register(GRXSTSP), > + dump_register(GRXFSIZ), > + dump_register(GNPTXFSIZ), > + dump_register(GNPTXSTS), > + dump_register(GI2CCTL), > + dump_register(GPVNDCTL), > + dump_register(GGPIO), > + dump_register(GUID), > + dump_register(GSNPSID), > + dump_register(GHWCFG1), > + dump_register(GHWCFG2), > + dump_register(GHWCFG3), > + dump_register(GHWCFG4), > + dump_register(GLPMCFG), > + dump_register(GPWRDN), > + dump_register(GDFIFOCFG), > + dump_register(ADPCTL), > + dump_register(HPTXFSIZ), > + dump_register(DPTXFSIZN(1)), > + dump_register(DPTXFSIZN(2)), > + dump_register(DPTXFSIZN(3)), > + dump_register(DPTXFSIZN(4)), > + dump_register(DPTXFSIZN(5)), > + dump_register(DPTXFSIZN(6)), > + dump_register(DPTXFSIZN(7)), > + dump_register(DPTXFSIZN(8)), > + dump_register(DPTXFSIZN(9)), > + dump_register(DPTXFSIZN(10)), > + dump_register(DPTXFSIZN(11)), > + dump_register(DPTXFSIZN(12)), > + dump_register(DPTXFSIZN(13)), > + dump_register(DPTXFSIZN(14)), > + dump_register(DPTXFSIZN(15)), > + dump_register(DCFG), > + dump_register(DCTL), > + dump_register(DSTS), > + dump_register(DIEPMSK), > + dump_register(DOEPMSK), > + dump_register(DAINT), > + dump_register(DAINTMSK), > + dump_register(DTKNQR1), > + dump_register(DTKNQR2), > + dump_register(DTKNQR3), > + dump_register(DTKNQR4), > + dump_register(DVBUSDIS), > + dump_register(DVBUSPULSE), > + dump_register(DIEPCTL(0)), > + dump_register(DIEPCTL(1)), > + dump_register(DIEPCTL(2)), > + dump_register(DIEPCTL(3)), > + dump_register(DIEPCTL(4)), > + dump_register(DIEPCTL(5)), > + dump_register(DIEPCTL(6)), > + dump_register(DIEPCTL(7)), > + dump_register(DIEPCTL(8)), > + dump_register(DIEPCTL(9)), > + dump_register(DIEPCTL(10)), > + dump_register(DIEPCTL(11)), > + dump_register(DIEPCTL(12)), > + dump_register(DIEPCTL(13)), > + dump_register(DIEPCTL(14)), > + dump_register(DIEPCTL(15)), > + dump_register(DOEPCTL(0)), > + dump_register(DOEPCTL(1)), > + dump_register(DOEPCTL(2)), > + dump_register(DOEPCTL(3)), > + dump_register(DOEPCTL(4)), > + dump_register(DOEPCTL(5)), > + dump_register(DOEPCTL(6)), > + dump_register(DOEPCTL(7)), > + dump_register(DOEPCTL(8)), > + dump_register(DOEPCTL(9)), > + dump_register(DOEPCTL(10)), > + dump_register(DOEPCTL(11)), > + dump_register(DOEPCTL(12)), > + dump_register(DOEPCTL(13)), > + dump_register(DOEPCTL(14)), > + dump_register(DOEPCTL(15)), > + dump_register(DIEPINT(0)), > + dump_register(DIEPINT(1)), > + dump_register(DIEPINT(2)), > + dump_register(DIEPINT(3)), > + dump_register(DIEPINT(4)), > + dump_register(DIEPINT(5)), > + dump_register(DIEPINT(6)), > + dump_register(DIEPINT(7)), > + dump_register(DIEPINT(8)), > + dump_register(DIEPINT(9)), > + dump_register(DIEPINT(10)), > + dump_register(DIEPINT(11)), > + d
Re: [PATCH v3 3/8] usb: common: otg-fsm: add HNP polling support
On Tue, Mar 17, 2015 at 10:37:47PM +0800, Li Jun wrote: > Adds HNP polling timer when transits to host state, the OTG status request > will be sent to peripheral after timeout, if host request flag is set, it will > switch to peripheral state, otherwise it will repeat HNP polling every 1.5s > and > maintain the current session. > > Signed-off-by: Li Jun > --- > drivers/usb/common/usb-otg-fsm.c | 84 > ++ > include/linux/usb/otg-fsm.h | 13 ++ > 2 files changed, 97 insertions(+) > > diff --git a/drivers/usb/common/usb-otg-fsm.c > b/drivers/usb/common/usb-otg-fsm.c > index 61d538a..1a1b5f4 100644 > --- a/drivers/usb/common/usb-otg-fsm.c > +++ b/drivers/usb/common/usb-otg-fsm.c > @@ -78,6 +78,8 @@ static void otg_leave_state(struct otg_fsm *fsm, enum > usb_otg_state old_state) > fsm->b_srp_done = 0; > break; > case OTG_STATE_B_PERIPHERAL: > + if (fsm->otg->gadget) > + fsm->otg->gadget->host_request_flag = 0; > break; > case OTG_STATE_B_WAIT_ACON: > otg_del_timer(fsm, B_ASE0_BRST); > @@ -107,6 +109,8 @@ static void otg_leave_state(struct otg_fsm *fsm, enum > usb_otg_state old_state) > case OTG_STATE_A_PERIPHERAL: > otg_del_timer(fsm, A_BIDL_ADIS); > fsm->a_bidl_adis_tmout = 0; > + if (fsm->otg->gadget) > + fsm->otg->gadget->host_request_flag = 0; > break; > case OTG_STATE_A_WAIT_VFALL: > otg_del_timer(fsm, A_WAIT_VFALL); > @@ -120,6 +124,84 @@ static void otg_leave_state(struct otg_fsm *fsm, enum > usb_otg_state old_state) > } > } > > +static void otg_hnp_polling_work(struct work_struct *work) > +{ > + struct otg_fsm *fsm = container_of(to_delayed_work(work), > + struct otg_fsm, hnp_polling_work); > + struct usb_device *udev; > + u8 host_req_flag; > + enum usb_otg_state state = fsm->otg->state; > + int retval; > + > + if (state != OTG_STATE_A_HOST && state != OTG_STATE_B_HOST) > + return; > + > + udev = usb_hub_find_child(fsm->otg->host->root_hub, 1); > + if (!udev) { > + dev_err(fsm->otg->host->controller, > + "no usb dev connected, can't start HNP polling\n"); > + return; > + } > + > + /* Get host request flag from connected USB device */ > + retval = usb_control_msg(udev, > + usb_rcvctrlpipe(udev, 0), > + USB_REQ_GET_STATUS, > + USB_DIR_IN | USB_RECIP_DEVICE, > + 0, > + OTG_STS_SELECTOR, > + &host_req_flag, > + 1, > + USB_CTRL_GET_TIMEOUT); > + if (retval != 1) { > + dev_err(&udev->dev, "Get one byte OTG status failed\n"); > + return; > + } If I plug usb thumb device, it will print above message, any ways to hide it for non hnp-polling featured device? Others are ok Peter > + > + if (host_req_flag == 0) { > + /* Continue HNP polling */ > + schedule_delayed_work(&fsm->hnp_polling_work, > + msecs_to_jiffies(T_HOST_REQ_POLL)); > + return; > + } else if (host_req_flag != HOST_REQUEST_FLAG) { > + dev_err(&udev->dev, "host request flag %d is invalid\n", > + host_req_flag); > + return; > + } > + > + /* Host request flag is set */ > + if (state == OTG_STATE_A_HOST) { > + /* Set b_hnp_enable */ > + if (!fsm->otg->host->b_hnp_enable) { > + retval = usb_control_msg(udev, > + usb_sndctrlpipe(udev, 0), > + USB_REQ_SET_FEATURE, 0, > + USB_DEVICE_B_HNP_ENABLE, > + 0, NULL, 0, > + USB_CTRL_SET_TIMEOUT); > + if (retval < 0) { > + dev_err(&udev->dev, > + "can't enable HNP %d\n", retval); > + return; > + } > + fsm->otg->host->b_hnp_enable = 1; > + } > + > + fsm->a_bus_req = 0; > + } else if (state == OTG_STATE_B_HOST) { > + fsm->b_bus_req = 0; > + } > + > + otg_statemachine(fsm); > +} > + > +static void otg_start_hnp_polling(struct otg_fsm *fsm) > +{ > + INIT_DELAYED_WORK(&fsm->hnp_polling_work, otg_hnp_polling_work); > + schedule_delayed_work(&fsm->hnp_polling_work, > + msecs_to_jiffies(T_HOST_REQ_POLL)); > +} > + > /* Called when entering a state */ > sta
Re: [PATCH v3 4/8] usb: chipidea: udc: bypass otg status selector request handling to gadget driver
On Tue, Mar 17, 2015 at 10:37:48PM +0800, Li Jun wrote: > Since gadget driver will handle this request, so controller driver bypass it. > > Signed-off-by: Li Jun > --- > drivers/usb/chipidea/udc.c |3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c > index 4254792..a65cdaf 100644 > --- a/drivers/usb/chipidea/udc.c > +++ b/drivers/usb/chipidea/udc.c > @@ -1014,7 +1014,8 @@ __acquires(ci->lock) > } > break; > case USB_REQ_GET_STATUS: > - if (type != (USB_DIR_IN|USB_RECIP_DEVICE) && > + if ((type != (USB_DIR_IN|USB_RECIP_DEVICE) || > + le16_to_cpu(req.wIndex) == OTG_STS_SELECTOR) && > type != (USB_DIR_IN|USB_RECIP_ENDPOINT) && > type != (USB_DIR_IN|USB_RECIP_INTERFACE)) > goto delegate; > -- > 1.7.9.5 > Acked-by: Peter Chen -- Best Regards, Peter Chen -- 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 v3 5/8] usb: gadget: composite: handle otg status selector request from OTG host
On Tue, Mar 17, 2015 at 10:37:49PM +0800, Li Jun wrote: > If gadget with HNP polling support receives GetStatus request of otg status > selector, it feedback to host with host request flag to indicate if it wants > to take host role. > > Signed-off-by: Li Jun > --- > drivers/usb/gadget/composite.c | 25 + > 1 file changed, 17 insertions(+), 8 deletions(-) > > diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c > index 13adfd1..1f73bd9 100644 > --- a/drivers/usb/gadget/composite.c > +++ b/drivers/usb/gadget/composite.c > @@ -1594,15 +1594,24 @@ composite_setup(struct usb_gadget *gadget, const > struct usb_ctrlrequest *ctrl) > *((u8 *)req->buf) = value; > value = min(w_length, (u16) 1); > break; > - > - /* > - * USB 3.0 additions: > - * Function driver should handle get_status request. If such cb > - * wasn't supplied we respond with default value = 0 > - * Note: function driver should supply such cb only for the first > - * interface of the function > - */ > case USB_REQ_GET_STATUS: > + if (gadget_is_otg(gadget) && gadget->hnp_polling_support && > + (w_index == OTG_STS_SELECTOR)) { > + if (ctrl->bRequestType != (USB_DIR_IN | > + USB_RECIP_DEVICE)) Any cases the above conditions will be true? > + goto unknown; > + *((u8 *)req->buf) = gadget->host_request_flag; > + value = 1; > + break; > + } > + > + /* > + * USB 3.0 additions: > + * Function driver should handle get_status request. If such cb > + * wasn't supplied we respond with default value = 0 > + * Note: function driver should supply such cb only for the > + * first interface of the function > + */ > if (!gadget_is_superspeed(gadget)) > goto unknown; > if (ctrl->bRequestType != (USB_DIR_IN | USB_RECIP_INTERFACE)) > -- > 1.7.9.5 > -- Best Regards, Peter Chen -- 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 v3 6/8] usb: chipidea: otg: set host_request_flag for gadget
On Tue, Mar 17, 2015 at 10:37:50PM +0800, Li Jun wrote: > Set host_request_flag if the current peripheral wants to take host role > via changing a_bus_req or b_bus_req by user application. %s/changing/setting After changing avoid, add: Acked-by: Peter Chen > > Signed-off-by: Li Jun > --- > drivers/usb/chipidea/otg_fsm.c | 13 - > 1 file changed, 12 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c > index 083acf4..2ec90dc 100644 > --- a/drivers/usb/chipidea/otg_fsm.c > +++ b/drivers/usb/chipidea/otg_fsm.c > @@ -66,6 +66,11 @@ set_a_bus_req(struct device *dev, struct device_attribute > *attr, > return count; > } > ci->fsm.a_bus_req = 1; > + if (ci->fsm.otg->state == OTG_STATE_A_PERIPHERAL) { > + ci->gadget.host_request_flag = 1; > + mutex_unlock(&ci->fsm.lock); > + return count; > + } > } > > ci_otg_queue_work(ci); > @@ -144,8 +149,14 @@ set_b_bus_req(struct device *dev, struct > device_attribute *attr, > mutex_lock(&ci->fsm.lock); > if (buf[0] == '0') > ci->fsm.b_bus_req = 0; > - else if (buf[0] == '1') > + else if (buf[0] == '1') { > ci->fsm.b_bus_req = 1; > + if (ci->fsm.otg->state == OTG_STATE_B_PERIPHERAL) { > + ci->gadget.host_request_flag = 1; > + mutex_unlock(&ci->fsm.lock); > + return count; > + } > + } > > ci_otg_queue_work(ci); > mutex_unlock(&ci->fsm.lock); > -- > 1.7.9.5 > -- Best Regards, Peter Chen -- 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 v3 7/8] usb: chipidea: otg: enable HNP polling support for gadget
On Tue, Mar 17, 2015 at 10:37:51PM +0800, Li Jun wrote: > Enable HNP polling support for chipidea gadget when otg fsm init. > > Signed-off-by: Li Jun > --- > drivers/usb/chipidea/otg_fsm.c |1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c > index 2ec90dc..82b1e23 100644 > --- a/drivers/usb/chipidea/otg_fsm.c > +++ b/drivers/usb/chipidea/otg_fsm.c > @@ -792,6 +792,7 @@ int ci_hdrc_otg_fsm_init(struct ci_hdrc *ci) > ci->fsm.id = hw_read_otgsc(ci, OTGSC_ID) ? 1 : 0; > ci->fsm.otg->state = OTG_STATE_UNDEFINED; > ci->fsm.ops = &ci_otg_ops; > + ci->gadget.hnp_polling_support = 1; > > mutex_init(&ci->fsm.lock); > > -- > 1.7.9.5 > Acked-by: Peter Chen -- Best Regards, Peter Chen -- 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 v3 8/8] Documentation: usb: chipidea: Update test procedure for HNP polling
On Tue, Mar 17, 2015 at 10:37:52PM +0800, Li Jun wrote: > From: Li Jun > > Update HNP test procedure as HNP polling is supported. > > Signed-off-by: Li Jun > --- > Documentation/usb/chipidea.txt |9 - > 1 file changed, 4 insertions(+), 5 deletions(-) > > diff --git a/Documentation/usb/chipidea.txt b/Documentation/usb/chipidea.txt > index 3f848c1..95d9170 100644 > --- a/Documentation/usb/chipidea.txt > +++ b/Documentation/usb/chipidea.txt > @@ -26,14 +26,13 @@ cat /sys/kernel/debug/ci_hdrc.0/registers > On B-device: > echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req > > - if HNP polling is not supported, also need: > - On A-device: > - echo 0 > /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_req > - > B-device should take host role and enumrate A-device. > > 4) A-device switch back to host. > - On B-device: > + On A-device: > + echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_req > + > + or, on B-device: Would you explain how it affect by introducing HNP polling and add to comment, I have not found it at OTG A-device with HNP State Diagram at otg 2.0 spec. > echo 0 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req > > A-device should switch back to host and enumrate B-device. > -- > 1.7.9.5 > -- Best Regards, Peter Chen -- 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