Re: [PATCH] USB:pl2303: add ids for Hewlett-Packard HP POS pole displays
On Fri, Mar 28, 2014 at 06:29:36PM +, Sanders, Aaron wrote: > Add device ids to pl2303 for the Hewlett-Packard HP POS pole displays: > LD960: 03f0:0B39 > LCM220: 03f0:3139 > LCM960: 03f0:3239 > > Signed-off-by: Aaron Sanders > > diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c That's better, but now the diff is messed up below. Also, please add a space between "USB:" and "pl2303:" in your subject. > index 3b5ba4f..4d70809 100644 > --- a/drivers/usb/serial/pl2303.c > +++ b/drivers/usb/serial/pl2303.c > @@ -82,6 +82,9 @@ static const struct usb_device_id id_table[] = { > { USB_DEVICE(YCCABLE_VENDOR_ID, YCCABLE_PRODUCT_ID) }, > { USB_DEVICE(SUPERIAL_VENDOR_ID, SUPERIAL_PRODUCT_ID) }, > { USB_DEVICE(HP_VENDOR_ID, HP_LD220_PRODUCT_ID) }, > + { USB_DEVICE(HP_VENDOR_ID, HP_LD960_PRODUCT_ID) }, > + { USB_DEVICE(HP_VENDOR_ID, HP_LCM220_PRODUCT_ID) }, > + { USB_DEVICE(HP_VENDOR_ID, HP_LCM960_PRODUCT_ID) }, > { USB_DEVICE(CRESSI_VENDOR_ID, CRESSI_EDY_PRODUCT_ID) }, > { USB_DEVICE(ZEAGLE_VENDOR_ID, ZEAGLE_N2ITION3_PRODUCT_ID) }, > { USB_DEVICE(SONY_VENDOR_ID, SONY_QN3USB_PRODUCT_ID) }, > diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h > index c38b8c0..ec183d1 100644 > --- a/drivers/usb/serial/pl2303.h > +++ b/drivers/usb/serial/pl2303.h > @@ -121,9 +121,12 @@ > #define SUPERIAL_VENDOR_ID 0x5372 > #define SUPERIAL_PRODUCT_ID 0x2303 > > -/* Hewlett-Packard LD220-HP POS Pole Display */ > -#define HP_VENDOR_ID 0x03f0 > -#define HP_LD220_PRODUCT_ID 0x3524 > +//* Hewlett-Packard POS Pole Displays */ > + #define HP_VENDOR_ID0x03f0 > + #define HP_LD220_PRODUCT_ID 0x3524 > + #define HP_LD960_PRODUCT_ID 0x0B39 > + #define HP_LCM220_PRODUCT_ID0x3139 > + #define HP_LCM960_PRODUCT_ID0x3239 Why are you modifying existing lines? The indentation was correct (none) and now there's also a stray '/' turning that comment into a c99 one (which we do not use). You should run any submissions through scripts/checkpatch.pl which would at least have caught the c99-comment mistake. > /* Cressi Edy (diving computer) PC interface */ > #define CRESSI_VENDOR_ID 0x04b8 Care to give it one more try? Thanks, Johan -- 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/serial/io_ti.c broken on BE systems
On Fri, Mar 28, 2014 at 07:27:33PM +0100, ldro...@debian.org wrote: > > At least if > > you can verify that it still works on an LE system. > > Yes your patch works on a LE system (tested on 3.2.55) > > Thanks! Great, thanks for testing. I'll revisit and resend the fix in a few days. Johan -- 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 00/11] Add USB OTG HNP and SRP support on Chipidea usb driver
On Tue, Mar 25, 2014 at 06:15:02PM +0800, Chen Peter-B29397 wrote: > > > Changes since v3: > > - Move out 2 patches from this patchset, as which are not directly > > related to > > otg fsm. > > - Add a new file chipidea.txt under Documentation/usb/ to show how to > > test > > OTG HNP and SRP. > > - Directly embed struct otg_fsm into ci_hdrc instead of pointer of > > otg_fsm. > > - Remove flag check in ci_otg_del_timer(). > > - Remove ADP related code and comments since ADP is not supported by chip. > > If you are implementing SoC independent code, but your chip does not support > ADP, you can add ADP support in TODO list, see drivers/usb/chipidea/core.c. > okay, I will TODO list in otg_fsm.c > > - Start OTG fsm before request_irq. > > - For B-device, do not do OTG fsm transitions when gadget driver > > is not registered, and start OTG fsm in register gadget driver. > > - Directly call ci_otg_fsm_work() in ci_hdrc_otg_fsm_start(). > > - Enable data pulse when a_wait_vfall timer time out. > > - Update a_wait_vrise time out function. > > - UPdate comments of OTG time macro definitions in otg_fsm.h according to > > OTG and EH 2.0. > > - Some typo correction and comments format changes. > > > > Changes since v2: > > - Add ABI document for sysfs input files description: > > Documentation/ABI/testing/sysfs-platform-chipidea-usb-otg > > - Add a debug file for show some USB registers value. > > - Split host driver change to be 2 patches, one for otg_port number init; > > the other one for vbus control change. > > - Export interrupt enable and status read functions from udc driver. > > - Only enable AVV irq in otg fsm init. > > - Remove duplicated USBSTS bits definitions. > > - Add HowTo demo role switch with 2 Freescale i.MX6Q sabre SD boards > > in cover letter. > > - typo correction. > > > > Changes since v1: > > - Move out HNP polling patch from this series, which will be a seperated > > patchset > > followed this one > > - Change fsm timers global variables to be a structure embeded in ci_hdrc, > > to make multiple OTG instances can exist in one system > > - Change some otg fsm functions to be static > > - Re-split timer init patch to avoid a later patch changing a previous > > one > > in the same series > > - Change timer structure memory allocation to be devm_kzalloc > > - Update some format alignment and spelling errors > > > > Li Jun (11): > > usb: chipidea: usb OTG fsm initialization. > > usb: chipidea: host: vbus control change for OTG HNP. > > usb: chipidea: host: init otg port number. > > usb: chipidea: udc: driver update for OTG HNP. > > usb: chipidea: add OTG fsm operation functions implemenation. > > usb: chipidea: OTG fsm timers initialization. > > usb: chipidea: OTG HNP and SRP fsm implementation. > > usb: chipidea: add sys inputs for OTG fsm input. > > usb: chipidea: debug: add debug file for OTG variables > > Documentation: ABI: usb: chipidea USB OTG HNP sysfs > > Documentation: usb: add chipidea.txt for how to demo usb OTG HNP and > > SRP > > > > .../ABI/testing/sysfs-platform-chipidea-usb-otg| 56 ++ > > Documentation/usb/chipidea.txt | 69 ++ > > drivers/usb/chipidea/Makefile |1 + > > drivers/usb/chipidea/bits.h| 11 +- > > drivers/usb/chipidea/ci.h |3 + > > drivers/usb/chipidea/core.c| 10 +- > > drivers/usb/chipidea/debug.c | 84 ++ > > drivers/usb/chipidea/host.c| 13 +- > > drivers/usb/chipidea/host.h|9 + > > drivers/usb/chipidea/otg.c | 17 +- > > drivers/usb/chipidea/otg_fsm.c | 852 > > > > drivers/usb/chipidea/otg_fsm.h | 122 +++ > > drivers/usb/chipidea/udc.c | 17 +- > > 13 files changed, 1255 insertions(+), 9 deletions(-) > > create mode 100644 Documentation/ABI/testing/sysfs-platform-chipidea- > > usb-otg > > create mode 100644 Documentation/usb/chipidea.txt > > create mode 100644 drivers/usb/chipidea/otg_fsm.c > > create mode 100644 drivers/usb/chipidea/otg_fsm.h > > > > -- > > 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: [PATCH v4 01/11] usb: chipidea: usb OTG fsm initialization.
On Wed, Mar 26, 2014 at 09:51:02AM +0800, Peter Chen wrote: > On Wed, Mar 19, 2014 at 06:01:34PM +0800, Li Jun wrote: > > This patch adds OTG fsm related initialization when do otg init, > > add a seperate file for OTG fsm related utilities. > > > > Signed-off-by: Li Jun > > --- > > drivers/usb/chipidea/Makefile |1 + > > drivers/usb/chipidea/ci.h |2 ++ > > drivers/usb/chipidea/otg.c |7 + > > drivers/usb/chipidea/otg_fsm.c | 60 > > > > drivers/usb/chipidea/otg_fsm.h | 29 +++ > > 5 files changed, 99 insertions(+) > > > > diff --git a/drivers/usb/chipidea/Makefile b/drivers/usb/chipidea/Makefile > > index 480bd4d..2f099c7 100644 > > --- a/drivers/usb/chipidea/Makefile > > +++ b/drivers/usb/chipidea/Makefile > > @@ -6,6 +6,7 @@ ci_hdrc-y := core.o otg.o > > ci_hdrc-$(CONFIG_USB_CHIPIDEA_UDC) += udc.o > > ci_hdrc-$(CONFIG_USB_CHIPIDEA_HOST)+= host.o > > ci_hdrc-$(CONFIG_USB_CHIPIDEA_DEBUG) += debug.o > > +ci_hdrc-$(CONFIG_USB_OTG_FSM) += otg_fsm.o > > > > # Glue/Bridge layers go here > > > > diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h > > index 7ae8cb6..4491c43 100644 > > --- a/drivers/usb/chipidea/ci.h > > +++ b/drivers/usb/chipidea/ci.h > > @@ -17,6 +17,7 @@ > > #include > > #include > > #include > > +#include > > > > > > /** > > * DEFINE > > @@ -174,6 +175,7 @@ struct ci_hdrc { > > struct ci_role_driver *roles[CI_ROLE_END]; > > enum ci_rolerole; > > boolis_otg; > > + struct otg_fsm fsm; > > struct work_struct work; > > struct workqueue_struct *wq; > > > > diff --git a/drivers/usb/chipidea/otg.c b/drivers/usb/chipidea/otg.c > > index c694340..3082b52 100644 > > --- a/drivers/usb/chipidea/otg.c > > +++ b/drivers/usb/chipidea/otg.c > > @@ -22,6 +22,7 @@ > > #include "ci.h" > > #include "bits.h" > > #include "otg.h" > > +#include "otg_fsm.h" > > > > /** > > * hw_read_otgsc returns otgsc register bits value. > > @@ -109,6 +110,12 @@ static void ci_otg_work(struct work_struct *work) > > */ > > int ci_hdrc_otg_init(struct ci_hdrc *ci) > > { > > + int retval = 0; > > + > > + retval = ci_hdrc_otg_fsm_init(ci); > > You can use int retval = ci_hdrc_otg_fsm_init(ci); directly. > I will change. > > + if (retval) > > + return retval; > > + > > INIT_WORK(&ci->work, ci_otg_work); > > ci->wq = create_singlethread_workqueue("ci_otg"); > > if (!ci->wq) { > > diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c > > new file mode 100644 > > index 000..fbe63f0 > > --- /dev/null > > +++ b/drivers/usb/chipidea/otg_fsm.c > > @@ -0,0 +1,60 @@ > > +/* > > + * otg_fsm.c - ChipIdea USB IP core OTG FSM driver > > + * > > + * Copyright (C) 2014 Freescale Semiconductor, Inc. > > + * > > + * Author: Jun Li > > + * > > + * This program is free software; you can redistribute it and/or modify > > + * it under the terms of the GNU General Public License version 2 as > > + * published by the Free Software Foundation. > > + */ > > + > > +/* > > + * This file mainly handles OTG fsm, it includes OTG fsm operations > > + * for HNP and SRP. > > + */ > > + > > +#include > > +#include > > +#include > > + > > +#include "ci.h" > > +#include "bits.h" > > +#include "otg.h" > > +#include "otg_fsm.h" > > + > > +int ci_hdrc_otg_fsm_init(struct ci_hdrc *ci) > > +{ > > + if (ci->platdata->dr_mode != USB_DR_MODE_OTG) > > + return 0; > > + > > + ci->transceiver->otg = devm_kzalloc(ci->dev, > > + sizeof(struct usb_otg), GFP_KERNEL); > > + if (!ci->transceiver->otg) { > > + dev_err(ci->dev, > > + "Failed to allocate usb_otg structure for ci hdrc otg!\n"); > > + return -ENOMEM; > > + } > > + > > + ci->fsm.power_up = 1; > > + ci->fsm.id = hw_read_otgsc(ci, OTGSC_ID); > > + ci->fsm.otg = ci->transceiver->otg; > > + ci->fsm.otg->phy = ci->transceiver; > > + ci->fsm.otg->gadget = &ci->gadget; > > + ci->transceiver->state = OTG_STATE_UNDEFINED; > > + > > + mutex_init(&ci->fsm.lock); > > + > > + /* Enable A vbus valid irq */ > > + hw_write_otgsc(ci, OTGSC_AVVIE, OTGSC_AVVIE); > > + > > + if (ci->fsm.id) { > > + ci->fsm.b_ssend_srp = > > + hw_read_otgsc(ci, OTGSC_BSV) ? 0 : 1; > > + ci->fsm.b_sess_vld = > > + hw_read_otgsc(ci, OTGSC_BSV) ? 1 : 0; > > + } > > + > > + return 0; > > +} > > diff --git a/drivers/usb/chipidea/otg_fsm.h b/drivers/usb/chipidea/otg_fsm.h > > new file mode 100644 > > index 000..cf27253 > > --- /dev/null > > +++ b/drivers/usb/chipidea/otg_fsm.h > > @@ -0,0 +1,29 @@ > > +/* > > + * Copyright (C) 2014 Freescale Semiconductor, Inc. > > + * > > + * Au
Re: [PATCH v4 02/11] usb: chipidea: host: vbus control change for OTG HNP.
On Wed, Mar 26, 2014 at 10:14:31AM +0800, Peter Chen wrote: > On Wed, Mar 19, 2014 at 06:01:35PM +0800, Li Jun wrote: > > Leave vbus on/off hanlded by OTG fsm if in OTG mode. > > > > Signed-off-by: Li Jun > > --- > > drivers/usb/chipidea/host.c |6 +++--- > > drivers/usb/chipidea/host.h |9 + > > 2 files changed, 12 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c > > index a8ac6c1..4b609bc 100644 > > --- a/drivers/usb/chipidea/host.c > > +++ b/drivers/usb/chipidea/host.c > > @@ -67,7 +67,7 @@ static int host_start(struct ci_hdrc *ci) > > ehci->has_tdi_phy_lpm = ci->hw_bank.lpm; > > ehci->imx28_write_fix = ci->imx28_write_fix; > > > > - if (ci->platdata->reg_vbus) { > > + if (ci->platdata->reg_vbus && !ci_host_is_otg(ci)) { > > ret = regulator_enable(ci->platdata->reg_vbus); > > if (ret) { > > dev_err(ci->dev, > > @@ -89,7 +89,7 @@ static int host_start(struct ci_hdrc *ci) > > return ret; > > > > disable_reg: > > - if (ci->platdata->reg_vbus) > > + if (ci->platdata->reg_vbus && !ci_host_is_otg(ci)) > > regulator_disable(ci->platdata->reg_vbus); > > > > put_hcd: > > @@ -105,7 +105,7 @@ static void host_stop(struct ci_hdrc *ci) > > if (hcd) { > > usb_remove_hcd(hcd); > > usb_put_hcd(hcd); > > - if (ci->platdata->reg_vbus) > > + if (ci->platdata->reg_vbus && !ci_host_is_otg(ci)) > > regulator_disable(ci->platdata->reg_vbus); > > } > > } > > diff --git a/drivers/usb/chipidea/host.h b/drivers/usb/chipidea/host.h > > index 5707bf3..f98d084 100644 > > --- a/drivers/usb/chipidea/host.h > > +++ b/drivers/usb/chipidea/host.h > > @@ -6,6 +6,15 @@ > > int ci_hdrc_host_init(struct ci_hdrc *ci); > > void ci_hdrc_host_destroy(struct ci_hdrc *ci); > > > > +static inline bool ci_host_is_otg(struct ci_hdrc *ci) > > +{ > > +#ifdef CONFIG_USB_OTG_FSM > > + return (ci->is_otg) && (ci->platdata->dr_mode == USB_DR_MODE_OTG); > > +#else > > + return false; > > +#endif > > +} > > + > > #else > > I talked at last round email, we need to use below condition to stand > for OTG condition: > > > static inline bool ci_host_is_otg(struct ci_hdrc *ci) > { > #ifdef CONFIG_USB_OTG_FSM > return ci->is_otg && ci->roles[CI_ROLE_HOST] && > ci->roles[CI_ROLE_GADGET]; > #else > return false; > #endif > } > > The user may only choose host or gadget support at configuration menu. > To be more robust with many configurations, this is a good suggestion, I will use this runtime check, thanks! > > > > static inline int ci_hdrc_host_init(struct ci_hdrc *ci) > > -- > > 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 v4 05/11] usb: chipidea: add OTG fsm operation functions implemenation.
On Wed, Mar 26, 2014 at 12:52:57PM +0800, Peter Chen wrote: > On Wed, Mar 19, 2014 at 06:01:38PM +0800, Li Jun wrote: > > Add OTG HNP and SRP operation functions implementation: > > - charge vbus > > - drive vbus > > - connection signaling > > - drive sof > > - start data pulse > > - add fsm timer > > - delete fsm timer > > - start host > > - start gadget > > > > Signed-off-by: Li Jun > > --- > > drivers/usb/chipidea/bits.h| 10 +- > > drivers/usb/chipidea/ci.h |1 + > > drivers/usb/chipidea/otg_fsm.c | 203 > > > > drivers/usb/chipidea/otg_fsm.h | 23 + > > 4 files changed, 236 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/usb/chipidea/bits.h b/drivers/usb/chipidea/bits.h > > index 83d06c1..9e95378 100644 > > --- a/drivers/usb/chipidea/bits.h > > +++ b/drivers/usb/chipidea/bits.h > > @@ -44,9 +44,14 @@ > > #define DEVICEADDR_USBADR (0x7FUL << 25) > > > > /* PORTSC */ > > +#define PORTSC_CCSBIT(0) > > +#define PORTSC_CSCBIT(1) > > +#define PORTSC_PECBIT(3) > > +#define PORTSC_OCCBIT(5) > > #define PORTSC_FPRBIT(6) > > #define PORTSC_SUSP BIT(7) > > #define PORTSC_HSPBIT(9) > > +#define PORTSC_PP BIT(12) > > #define PORTSC_PTC(0x0FUL << 16) > > #define PORTSC_PHCD(d) ((d) ? BIT(22) : BIT(23)) > > /* PTS and PTW for non lpm version only */ > > @@ -56,6 +61,9 @@ > > #define PORTSC_PTWBIT(28) > > #define PORTSC_STSBIT(29) > > > > +#define PORTSC_W1C_BITS\ > > + (PORTSC_CSC | PORTSC_PEC | PORTSC_OCC) > > + > > /* DEVLC */ > > #define DEVLC_PFSCBIT(23) > > #define DEVLC_PSPD(0x03UL << 25) > > @@ -69,9 +77,9 @@ > > #define PTS_ULPI 2 > > #define PTS_SERIAL3 > > #define PTS_HSIC 4 > > - > > Do we really need to delete this blank line between two registers? > I will remove this change. > > /* OTGSC */ > > #define OTGSC_IDPU BIT(5) > > +#define OTGSC_HADP BIT(6) > > #define OTGSC_ID BIT(8) > > #define OTGSC_AVVBIT(9) > > #define OTGSC_ASVBIT(10) > > diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h > > index 4491c43..cece7e2 100644 > > --- a/drivers/usb/chipidea/ci.h > > +++ b/drivers/usb/chipidea/ci.h > > @@ -176,6 +176,7 @@ struct ci_hdrc { > > enum ci_rolerole; > > boolis_otg; > > struct otg_fsm fsm; > > + struct ci_otg_fsm_timer_list*fsm_timer; > > struct work_struct work; > > struct workqueue_struct *wq; > > > > diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c > > index fbe63f0..f0e50fd 100644 > > --- a/drivers/usb/chipidea/otg_fsm.c > > +++ b/drivers/usb/chipidea/otg_fsm.c > > @@ -18,12 +18,214 @@ > > #include > > #include > > #include > > +#include > > > > #include "ci.h" > > #include "bits.h" > > #include "otg.h" > > #include "otg_fsm.h" > > > > +/* > > + * Add timer to active timer list > > + */ > > +static void ci_otg_add_timer(struct ci_hdrc *ci, enum > > ci_otg_fsm_timer_index t) > > +{ > > + struct ci_otg_fsm_timer *tmp_timer; > > + struct ci_otg_fsm_timer *timer = ci->fsm_timer->timer_list[t]; > > + struct list_head *active_timers = &ci->fsm_timer->active_timers; > > + > > + if (t >= NUM_CI_OTG_FSM_TIMERS) > > + return; > > + > > + /* > > +* Check if the timer is already in the active list, > > +* if so update timer count > > +*/ > > + list_for_each_entry(tmp_timer, active_timers, list) > > + if (tmp_timer == timer) { > > + timer->count = timer->expires; > > + return; > > + } > > + > > + timer->count = timer->expires; > > + list_add_tail(&timer->list, active_timers); > > + > > + /* Enable 1ms irq */ > > + if (!(hw_read_otgsc(ci, OTGSC_1MSIE))) > > + hw_write_otgsc(ci, OTGSC_1MSIE, OTGSC_1MSIE); > > +} > > + > > +/* > > + * Remove timer from active timer list > > + */ > > +static void ci_otg_del_timer(struct ci_hdrc *ci, enum > > ci_otg_fsm_timer_index t) > > +{ > > + struct ci_otg_fsm_timer *tmp_timer, *del_tmp; > > + struct ci_otg_fsm_timer *timer = ci->fsm_timer->timer_list[t]; > > + struct list_head *active_timers = &ci->fsm_timer->active_timers; > > + > > + if (t >= NUM_CI_OTG_FSM_TIMERS) > > + return; > > + > > + list_for_each_entry_safe(tmp_timer, del_tmp, active_timers, list) > > + if (tmp_timer == timer) > > + list_del(&timer->list); > > + > > + /* Disable 1ms irq if there is no any active timer */ > > + if (list_empty(active_timers)) > > + hw_write_otgsc(ci, OTGSC_1MSIE, 0); > > +} > > + > > +/* -*/ > > +/
Re: [PATCH v4 07/11] usb: chipidea: OTG HNP and SRP fsm implementation.
On Wed, Mar 26, 2014 at 01:16:40PM +0800, Peter Chen wrote: > On Wed, Mar 19, 2014 at 06:01:40PM +0800, Li Jun wrote: > > From: Li Jun > > > > USB OTG interrupt handling and fsm transitions according to USB OTG > > and EH 2.0. > > > > Signed-off-by: Li Jun > > --- > > drivers/usb/chipidea/core.c| 10 +- > > drivers/usb/chipidea/otg.c |9 +- > > drivers/usb/chipidea/otg_fsm.c | 235 > > +++- > > drivers/usb/chipidea/otg_fsm.h | 18 +++ > > drivers/usb/chipidea/udc.c |6 + > > 5 files changed, 270 insertions(+), 8 deletions(-) > > > > diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c > > index ff38cf3..c0eacf4 100644 > > --- a/drivers/usb/chipidea/core.c > > +++ b/drivers/usb/chipidea/core.c > > @@ -74,6 +74,7 @@ > > #include "host.h" > > #include "debug.h" > > #include "otg.h" > > +#include "otg_fsm.h" > > > > /* Controller register map */ > > static const u8 ci_regs_nolpm[] = { > > @@ -412,8 +413,12 @@ static irqreturn_t ci_irq(int irq, void *data) > > irqreturn_t ret = IRQ_NONE; > > u32 otgsc = 0; > > > > - if (ci->is_otg) > > + if (ci->is_otg) { > > otgsc = hw_read_otgsc(ci, ~0); > > + ret = ci_otg_fsm_irq(ci); > > + if (ret == IRQ_HANDLED) > > + return ret; > > + } > > > > /* > > * Handle id change interrupt, it indicates device/host function > > @@ -697,6 +702,9 @@ static int ci_hdrc_probe(struct platform_device *pdev) > > goto stop; > > } > > > > + if (ci->is_otg) > > + ci_hdrc_otg_fsm_start(ci); > > + > > platform_set_drvdata(pdev, ci); > > ret = request_irq(ci->irq, ci_irq, IRQF_SHARED, ci->platdata->name, > > ci); > > diff --git a/drivers/usb/chipidea/otg.c b/drivers/usb/chipidea/otg.c > > index 3082b52..5098982 100644 > > --- a/drivers/usb/chipidea/otg.c > > +++ b/drivers/usb/chipidea/otg.c > > @@ -11,8 +11,8 @@ > > */ > > > > /* > > - * This file mainly handles otgsc register, it may include OTG operation > > - * in the future. > > + * This file mainly handles otgsc register, OTG fsm operations for HNP and > > SRP > > + * are also included. > > */ > > > > #include > > @@ -91,6 +91,11 @@ static void ci_otg_work(struct work_struct *work) > > { > > struct ci_hdrc *ci = container_of(work, struct ci_hdrc, work); > > > > + if (!ci_otg_fsm_work(ci)) { > > + enable_irq(ci->irq); > > + return; > > + } > > + > > if (ci->id_event) { > > ci->id_event = false; > > ci_handle_id_switch(ci); > > diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c > > index 1fcb2b0..569f208 100644 > > --- a/drivers/usb/chipidea/otg_fsm.c > > +++ b/drivers/usb/chipidea/otg_fsm.c > > @@ -92,6 +92,33 @@ static void ci_otg_del_timer(struct ci_hdrc *ci, enum > > ci_otg_fsm_timer_index t) > > hw_write_otgsc(ci, OTGSC_1MSIE, 0); > > } > > > > +/* > > + * Reduce timer count by 1, and find timeout conditions. > > + * Called by otg 1ms timer interrupt > > + */ > > +static inline int ci_otg_tick_timer(struct ci_hdrc *ci) > > +{ > > + struct ci_otg_fsm_timer *tmp_timer, *del_tmp; > > + struct list_head *active_timers = &ci->fsm_timer->active_timers; > > + int expired = 0; > > + > > + list_for_each_entry_safe(tmp_timer, del_tmp, active_timers, list) { > > + tmp_timer->count--; > > + /* check if timer expires */ > > + if (!tmp_timer->count) { > > + list_del(&tmp_timer->list); > > + tmp_timer->function(ci, tmp_timer->data); > > + expired = 1; > > + } > > + } > > + > > + /* disable 1ms irq if there is no any timer active */ > > + if ((expired == 1) && list_empty(active_timers)) > > + hw_write_otgsc(ci, OTGSC_1MSIE, 0); > > + > > + return expired; > > +} > > + > > /* The timeout callback function to set time out bit */ > > static void set_tmout(void *ptr, unsigned long indicator) > > { > > @@ -297,11 +324,6 @@ static void ci_otg_drv_vbus(struct otg_fsm *fsm, int > > on) > > regulator_disable(ci->platdata->reg_vbus); > > /* Disable port power */ > > hw_write(ci, OP_PORTSC, PORTSC_W1C_BITS | PORTSC_PP, 0); > > - > > - /* Clear exsiting DP irq */ > > - hw_write_otgsc(ci, OTGSC_DPIS, OTGSC_DPIS); > > - /* Enable data pulse irq */ > > - hw_write_otgsc(ci, OTGSC_DPIE, OTGSC_DPIE); > > Why the above changes are at this patch? > Sorry, my mistake in patch split, I will correct this. > > } > > } > > > > @@ -397,6 +419,209 @@ static struct otg_fsm_ops ci_otg_ops = { > > .start_gadget = ci_otg_start_gadget, > > }; > > > > +int ci_otg_fsm_work(struct ci_hdrc *ci) > > +{ > > + if (!ci->transceiver->otg) > > + return -ENODEV; > > + > > + /* > > +* Don't do fsm transition for B devic
Re: [PATCH v4 08/11] usb: chipidea: add sys inputs for OTG fsm input.
On Wed, Mar 26, 2014 at 01:19:51PM +0800, Peter Chen wrote: > On Wed, Mar 19, 2014 at 06:01:41PM +0800, Li Jun wrote: > > From: Li Jun > > > > This patch adds sys input to control and show OTG fsm inputs by application, > > user can do host and preipheral role switch by change these inputs. > > > > Signed-off-by: Li Jun > > --- > > drivers/usb/chipidea/otg.c |1 + > > drivers/usb/chipidea/otg_fsm.c | 174 > > > > drivers/usb/chipidea/otg_fsm.h |6 ++ > > 3 files changed, 181 insertions(+) > > > > diff --git a/drivers/usb/chipidea/otg.c b/drivers/usb/chipidea/otg.c > > index 5098982..6de2f76 100644 > > --- a/drivers/usb/chipidea/otg.c > > +++ b/drivers/usb/chipidea/otg.c > > @@ -144,4 +144,5 @@ void ci_hdrc_otg_destroy(struct ci_hdrc *ci) > > /* Disable all OTG irq and clear status */ > > hw_write_otgsc(ci, OTGSC_INT_EN_BITS | OTGSC_INT_STATUS_BITS, > > OTGSC_INT_STATUS_BITS); > > + ci_hdrc_otg_fsm_remove(ci); > > } > > diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c > > index 569f208..fc0c6ce 100644 > > --- a/drivers/usb/chipidea/otg_fsm.c > > +++ b/drivers/usb/chipidea/otg_fsm.c > > @@ -41,6 +41,167 @@ static struct ci_otg_fsm_timer *otg_timer_initializer > > return timer; > > } > > > > +/* Add for otg: interact with user space app */ > > +static ssize_t > > +get_a_bus_req(struct device *dev, struct device_attribute *attr, char *buf) > > +{ > > + char*next; > > + unsignedsize, t; > > + struct ci_hdrc *ci = dev_get_drvdata(dev); > > + > > + next = buf; > > + size = PAGE_SIZE; > > + t = scnprintf(next, size, "%d\n", ci->fsm.a_bus_req); > > + size -= t; > > + next += t; > > + > > + return PAGE_SIZE - size; > > +} > > + > > +static ssize_t > > +set_a_bus_req(struct device *dev, struct device_attribute *attr, > > + const char *buf, size_t count) > > +{ > > + struct ci_hdrc *ci = dev_get_drvdata(dev); > > + > > + if (count > 2) > > + return -1; > > + > > + mutex_lock(&ci->fsm.lock); > > + if (buf[0] == '0') { > > + ci->fsm.a_bus_req = 0; > > + } else if (buf[0] == '1') { > > + /* If a_bus_drop is TRUE, a_bus_req can't be set */ > > + if (ci->fsm.a_bus_drop) { > > + mutex_unlock(&ci->fsm.lock); > > + return count; > > + } > > + ci->fsm.a_bus_req = 1; > > + } > > + > > + disable_irq_nosync(ci->irq); > > + queue_work(ci->wq, &ci->work); > > + mutex_unlock(&ci->fsm.lock); > > + > > + return count; > > +} > > +static DEVICE_ATTR(a_bus_req, S_IRUGO | S_IWUSR, get_a_bus_req, > > set_a_bus_req); > > + > > +static ssize_t > > +get_a_bus_drop(struct device *dev, struct device_attribute *attr, char > > *buf) > > +{ > > + char*next; > > + unsignedsize, t; > > + struct ci_hdrc *ci = dev_get_drvdata(dev); > > + > > + next = buf; > > + size = PAGE_SIZE; > > + t = scnprintf(next, size, "%d\n", ci->fsm.a_bus_drop); > > + size -= t; > > + next += t; > > + > > + return PAGE_SIZE - size; > > +} > > + > > +static ssize_t > > +set_a_bus_drop(struct device *dev, struct device_attribute *attr, > > + const char *buf, size_t count) > > +{ > > + struct ci_hdrc *ci = dev_get_drvdata(dev); > > + > > + if (count > 2) > > + return -1; > > + > > + mutex_lock(&ci->fsm.lock); > > + if (buf[0] == '0') { > > + ci->fsm.a_bus_drop = 0; > > + } else if (buf[0] == '1') { > > + ci->fsm.a_bus_drop = 1; > > + ci->fsm.a_bus_req = 0; > > + } > > + > > + disable_irq_nosync(ci->irq); > > + queue_work(ci->wq, &ci->work); > > + mutex_unlock(&ci->fsm.lock); > > + > > + return count; > > +} > > +static DEVICE_ATTR(a_bus_drop, S_IRUGO | S_IWUSR, get_a_bus_drop, > > + set_a_bus_drop); > > + > > +static ssize_t > > +get_b_bus_req(struct device *dev, struct device_attribute *attr, char *buf) > > +{ > > + char*next; > > + unsignedsize, t; > > + struct ci_hdrc *ci = dev_get_drvdata(dev); > > + > > + next = buf; > > + size = PAGE_SIZE; > > + t = scnprintf(next, size, "%d\n", ci->fsm.b_bus_req); > > + size -= t; > > + next += t; > > + > > + return PAGE_SIZE - size; > > +} > > + > > +static ssize_t > > +set_b_bus_req(struct device *dev, struct device_attribute *attr, > > + const char *buf, size_t count) > > +{ > > + struct ci_hdrc *ci = dev_get_drvdata(dev); > > + > > + if (count > 2) > > + return -1; > > + > > + mutex_lock(&ci->fsm.lock); > > + if (buf[0] == '0') > > + ci->fsm.b_bus_req = 0; > > + else if (buf[0] == '1') > > + ci->fsm.b_bus_req = 1; > > + > > + disable_irq_nosync(ci->irq); > > + queue_work(ci->wq, &ci->work); > > + mutex_unlo
Re: [PATCH v4 00/11] Add USB OTG HNP and SRP support on Chipidea usb driver
On Thu, Mar 27, 2014 at 12:48:11PM +0800, Peter Chen wrote: > On Wed, Mar 26, 2014 at 03:00:55PM +0800, Peter Chen wrote: > > On Wed, Mar 19, 2014 at 06:01:33PM +0800, Li Jun wrote: > > > From: Li Jun > > > > > > This patchset adds USB OTG HNP and SRP support on chipidea usb driver, > > > existing OTG port role swtich function by ID pin status kept unchanged, > > > based on that, if select CONFIG_USB_OTG_FSM, OTG HNP and SRP will be > > > supported. > > > > > > Reference to: > > > "On-The-Go and Embedded Host Supplement to the USB Revision 2.0 > > > Specification July 27, 2012 > > > Revision 2.0 version 1.1a" > > > > > > > Please fix below build warning using default configuration > > (CONFIG_USB_OTG is not enabled) > > > > /home/b29397/work/projects/upstream/usb/usb/drivers/usb/chipidea/otg_fsm.h:95:12: > > warning: 'ci_hdrc_otg_fsm_init' defined but not used [-Wunused-function] > > /home/b29397/work/projects/upstream/usb/usb/drivers/usb/chipidea/otg_fsm.h:115:13: > > warning: 'ci_hdrc_otg_fsm_remove' defined but not used > > [-Wunused-function] > > CC drivers/usb/chipidea/udc.o > > > > /home/b29397/work/projects/upstream/usb/usb/drivers/usb/chipidea/otg_fsm.h:110:13: > > warning: 'ci_hdrc_otg_fsm_start' defined but not used > > [-Wunused-function] > > CC fs/ubifs/debug.o > > CC drivers/usb/chipidea/host.o > > /home/b29397/work/projects/upstream/usb/usb/drivers/usb/chipidea/otg_fsm.h:95:12: > > warning: 'ci_hdrc_otg_fsm_init' defined but not used > > [-Wunused-function] > > /home/b29397/work/projects/upstream/usb/usb/drivers/usb/chipidea/otg_fsm.h:115:13: > > warning: 'ci_hdrc_otg_fsm_remove' defined but not used > > [-Wunused-function] > > > > Move comments after reviewing your patchset: > > - We have two ci_hdrc_otg_fsm_start called, one at core.c > one at udc.c, if controller works at peripheral mode, it > will be called two times, I suggested one at host.c and > one at udc.c. I will try to put this in host.c > - At ci_otg_fsm_irq, the ci->is_otg doesn't need to be checked > since the ci_otg_fsm_irq can only be called when ci->is_otg is 1. This problem does not exist with new otg check applied. > - Update TODO list at core.c, since the otg has supported with your > patchset. I will update. > - Typo: otg_fsm.c, line 463. %s/regulater/regulator/ I will update. > - Please add comment at host.c that the vbus has controlled by > otg fsm for otg operation. I will add comments for it. > > The functions are tested for both OTG and non-OTG supported. > > Peter > > > Peter > > > > > Changes since v3: > > > - Move out 2 patches from this patchset, as which are not directly > > > related to > > > otg fsm. > > > - Add a new file chipidea.txt under Documentation/usb/ to show how to test > > > OTG HNP and SRP. > > > - Directly embed struct otg_fsm into ci_hdrc instead of pointer of > > > otg_fsm. > > > - Remove flag check in ci_otg_del_timer(). > > > - Remove ADP related code and comments since ADP is not supported by chip. > > > - Start OTG fsm before request_irq. > > > - For B-device, do not do OTG fsm transitions when gadget driver > > > is not registered, and start OTG fsm in register gadget driver. > > > - Directly call ci_otg_fsm_work() in ci_hdrc_otg_fsm_start(). > > > - Enable data pulse when a_wait_vfall timer time out. > > > - Update a_wait_vrise time out function. > > > - UPdate comments of OTG time macro definitions in otg_fsm.h according to > > > OTG and EH 2.0. > > > - Some typo correction and comments format changes. > > > > > > Changes since v2: > > > - Add ABI document for sysfs input files description: > > > Documentation/ABI/testing/sysfs-platform-chipidea-usb-otg > > > - Add a debug file for show some USB registers value. > > > - Split host driver change to be 2 patches, one for otg_port number init; > > > the other one for vbus control change. > > > - Export interrupt enable and status read functions from udc driver. > > > - Only enable AVV irq in otg fsm init. > > > - Remove duplicated USBSTS bits definitions. > > > - Add HowTo demo role switch with 2 Freescale i.MX6Q sabre SD boards > > > in cover letter. > > > - typo correction. > > > > > > Changes since v1: > > > - Move out HNP polling patch from this series, which will be a seperated > > > patchset > > > followed this one > > > - Change fsm timers global variables to be a structure embeded in ci_hdrc, > > > to make multiple OTG instances can exist in one system > > > - Change some otg fsm functions to be static > > > - Re-split timer init patch to avoid a later patch changing a previous one > > > in the same series > > > - Change timer structure memory allocation to be devm_kzalloc > > > - Update some format alignment and spelling errors > > > > > > Li Jun (11): > > > usb: chipidea: usb OTG fsm initialization. > > > usb: chipidea: host: vbus control change for OTG HNP. > > > usb: chipidea: host: init otg port number. > > > usb: chipidea: udc: driver update for OTG
[PATCH] USB: serial: ftdi_sio: add id for Brainboxes serial cards
Custom VID/PIDs for Brainboxes cards as reported in https://bugzilla.redhat.com/show_bug.cgi?id=1071914 Signed-off-by: Michele Baldessari --- drivers/usb/serial/ftdi_sio.c | 34 ++ drivers/usb/serial/ftdi_sio_ids.h | 38 ++ 2 files changed, 72 insertions(+) diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 44ab12986805..ccfa3c55212c 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c @@ -909,6 +909,40 @@ static const struct usb_device_id id_table_combined[] = { { USB_DEVICE(FTDI_VID, FTDI_Z3X_PID) }, /* Cressi Devices */ { USB_DEVICE(FTDI_VID, FTDI_CRESSI_PID) }, + /* Brainbox Devices */ + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_VX_001_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_VX_001_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_VX_012_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_VX_023_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_VX_034_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_101_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_257_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_313_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_324_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_357_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_1_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_2_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_3_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_4_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_5_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_6_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_7_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_8_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_279_1_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_279_2_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_279_3_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_279_4_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_346_1_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_346_2_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_606_1_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_606_2_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_606_3_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_701_1_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_701_2_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_1_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_2_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_3_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_4_PID) }, { } /* Terminating entry */ }; diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index e599fbfcde5f..84d351e70f9c 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h @@ -1326,3 +1326,41 @@ * Manufacturer: Cressi */ #define FTDI_CRESSI_PID0x87d0 + +/* + * Product: Brainboxes devices + * Manufacturer: Brainboxes + */ +#define BRAINBOXES_VID 0x05d1 +#define BRAINBOXES_VX_001_PID 0x1001 /* VX-001 ExpressCard 1 Port RS232 */ +#define BRAINBOXES_VX_012_PID 0x1002 /* VX-012 ExpressCard 2 Port RS232 */ +#define BRAINBOXES_VX_023_PID 0x1003 /* VX-023 ExpressCard 1 Port RS422/485 */ +#define BRAINBOXES_VX_034_PID 0x1004 /* VX-034 ExpressCard 2 Port RS422/485 */ +#define BRAINBOXES_US_101_PID 0x1011 /* US-101 1xRS232 */ +#define BRAINBOXES_US_257_PID 0x5001 /* US-257 2xRS232 1Mbaud */ +#define BRAINBOXES_US_313_PID 0x6001 /* US-313 2xRS422/485 1Mbaud */ +#define BRAINBOXES_US_324_PID 0x1013 /* US-324 1xRS422/485 1Mbaud */ +#define BRAINBOXES_US_357_PID 0x7001 /* US_357 1xRS232/422/485 */ +#define BRAINBOXES_US_160_1_PID0x9001 /* US-160 16xRS232 1Mbaud Port 1 and 2 */ +#define BRAINBOXES_US_160_2_PID0x9002 /* US-160 16xRS232 1Mbaud Port 3 and 4 */ +#define BRAINBOXES_US_160_3_PID0x9003 /* US-160 16xRS232 1Mbaud Port 5 and 6 */ +#define BRAINBOXES_US_160_4_PID0x9004 /* US-160 16xRS232 1Mbaud Port 7 and 8 */ +#define BRAINBOXES_US_160_5_PID0x9005 /* US-160 16xRS232 1Mbaud Port 9 and 10 */ +#define BRAINBOXES_US_160_6_PID0x9006 /* US-160 16xRS232 1Mbaud Port 11 and 12 */ +#define BRAINBOXES_US_160_7_PID0x9007 /* US-160 16xRS232 1Mbaud Port 13 and 14 */ +#define BRAINBOXES_US_160_8_PID0x9008 /* US-160 16xRS232 1Mbaud Port 15 and 16 */ +#define BRAINBOXES_US_279_1_PID0x2021 /* US-279 8xRS422 1Mbaud Port 1 and 2