Re: [alsa-devel] Fw: Isochronous transfer error on USB3

2014-01-09 Thread Clemens Ladisch
Mauro Carvalho Chehab wrote:
> I'm getting an weird behavior with em28xx, especially when the device
> is connected into an audio port.
>
>   
> http://git.linuxtv.org/mchehab/experimental.git/blob/refs/heads/em28xx-v4l2-v6:/drivers/media/usb/em28xx/em28xx-audio.c
>
> What happens is that, when I require xawtv3 to use any latency lower
> than 65 ms, the audio doesn't work, as it gets lots of underruns per
> second.

The driver uses five URBs with 64 frames each, so of course it
will not be able to properly handle periods smaller than that.

> FYI, em28xx works at a 48000 KHz sampling rate, and its PM capture Hw
> is described as:
>
> static struct snd_pcm_hardware snd_em28xx_hw_capture = {
>   .info = SNDRV_PCM_INFO_BLOCK_TRANSFER |
>   SNDRV_PCM_INFO_MMAP   |
>   SNDRV_PCM_INFO_INTERLEAVED|
>   SNDRV_PCM_INFO_BATCH  |
>   SNDRV_PCM_INFO_MMAP_VALID,
>
>   .formats = SNDRV_PCM_FMTBIT_S16_LE,
>
>   .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_KNOT,

This should be just SNDRV_PCM_RATE_48000.

>   .period_bytes_min = 64, /* 12544/2, */

This is wrong (if the driver doesn't install other constraints on the
period length, like the USB audio class driver does).


Regards,
Clemens
--
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 03/10] usb: chipidea: host:vbus control change for OTG HNP.

2014-01-09 Thread Peter Chen
A blank space between "host:" and "vbus"

Reply-To: 
In-Reply-To: <1389171985-9282-4-git-send-email-b47...@freescale.com>

On Wed, Jan 08, 2014 at 05:06:18PM +0800, Li Jun wrote:
> Leave vbus on/off hanlded by OTG fsm if in OTG mode, init OTG port number.
 ^and
What does the OTG port number mean? It is always 1?
If there are two OTG port, how about the value of the otg_port?

> 
> Signed-off-by: Li Jun 
> ---
>  drivers/usb/chipidea/host.c |   13 +
>  drivers/usb/chipidea/host.h |9 +
>  2 files changed, 18 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c
> index 526cd77..bba54c3 100644
> --- a/drivers/usb/chipidea/host.c
> +++ b/drivers/usb/chipidea/host.c
> @@ -66,7 +66,7 @@ static int host_start(struct ci_hdrc *ci)
>   ehci->has_hostpc = ci->hw_bank.lpm;
>   ehci->has_tdi_phy_lpm = ci->hw_bank.lpm;
>  
> - if (ci->platdata->reg_vbus) {
> + if ((ci->platdata->reg_vbus) && !ci_host_is_otg(ci)) {

The first () is not needed.
Any ways to unify the vbus controller for both OTG and non-OTG cases?

>   ret = regulator_enable(ci->platdata->reg_vbus);
>   if (ret) {
>   dev_err(ci->dev,
> @@ -79,8 +79,13 @@ static int host_start(struct ci_hdrc *ci)
>   ret = usb_add_hcd(hcd, 0, 0);
>   if (ret)
>   goto disable_reg;
> - else
> + else {
>   ci->hcd = hcd;
> + if (ci_host_is_otg(ci)) {
> + ci->transceiver->otg->host = &hcd->self;
> + ci->transceiver->otg->host->otg_port = 1;
> + }
> + }
>  
>   if (ci->platdata->flags & CI_HDRC_DISABLE_STREAMING)
>   hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS, USBMODE_CI_SDIS);
> @@ -88,7 +93,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:
> @@ -104,7 +109,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

CONFIG_USB_OTG?

> + return (ci->is_otg) && (ci->platdata->dr_mode == USB_DR_MODE_OTG);

Why ci->platdata->dr_mode == USB_DR_MODE_OTG is needed to judge if a
host port is OTG port?

Besides, if the user chooses dr_mode as non USB_DR_MODE_OTG, and kernel
configuration chooses CONFIG_USB_OTG, the port should responds as host
only port. DT entries can always override kernel configuration.

> +#else
> + return false;
> +#endif
> +}
> +
>  #else
>  
>  static inline int ci_hdrc_host_init(struct ci_hdrc *ci)
> -- 
> 1.7.8
> 
> 

-- 

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 04/10] usb: chipidea: udc:driver update for OTG HNP. ^

2014-01-09 Thread Peter Chen
Reply-To: 
In-Reply-To: <1389171985-9282-5-git-send-email-b47...@freescale.com>

On Wed, Jan 08, 2014 at 05:06:19PM +0800, Li Jun wrote:
> Add b_hnp_enable request handling and enable gadget->is_otg
> 
> Signed-off-by: Li Jun 
> ---
>  drivers/usb/chipidea/udc.c |   11 ++-
>  1 files changed, 10 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
> index 73a39ef..ccdc277 100644
> --- a/drivers/usb/chipidea/udc.c
> +++ b/drivers/usb/chipidea/udc.c
> @@ -20,6 +20,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  
>  #include "ci.h"
> @@ -1106,6 +1107,14 @@ __acquires(ci->lock)
>   default:
>   break;
>   }
> + break;
> + case USB_DEVICE_B_HNP_ENABLE:
> + if (gadget_is_otg(&ci->gadget)) {
> + ci->gadget.b_hnp_enable = 1;
> + err = isr_setup_status_phase(
> + ci);
> + }
> + break;
>   default:
>   goto delegate;
>   }
> @@ -1762,7 +1771,7 @@ static int udc_start(struct ci_hdrc *ci)
>   ci->gadget.ops  = &usb_gadget_ops;
>   ci->gadget.speed= USB_SPEED_UNKNOWN;
>   ci->gadget.max_speed= USB_SPEED_HIGH;
> - ci->gadget.is_otg   = 0;
> + ci->gadget.is_otg   = ci->is_otg ? 1 : 0;
>   ci->gadget.name = ci->platdata->name;
>  
>   INIT_LIST_HEAD(&ci->gadget.ep_list);
> -- 
> 1.7.8
> 
> 

-- 

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 05/10] usb: chipidea: add OTG fsm operation functions implemenation.

2014-01-09 Thread Peter Chen
On Wed, Jan 08, 2014 at 05:06:20PM +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|   11 ++
>  drivers/usb/chipidea/otg_fsm.c |  311 
> 
>  drivers/usb/chipidea/otg_fsm.h |8 +
>  3 files changed, 330 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/usb/chipidea/bits.h b/drivers/usb/chipidea/bits.h
> index a857131..4347414 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_CCS BIT(0)
> +#define PORTSC_CSC BIT(1)
> +#define PORTSC_PEC BIT(3)
> +#define PORTSC_OCC BIT(5)

They are not alignment at my mutt, maybe it is my editor problem.
Please make sure they are alignment with below lines.

>  #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 */
> @@ -55,6 +60,9 @@
>  #define PORTSC_PTWBIT(28)
>  #define PORTSC_STSBIT(29)
>  
> +#define PORTSC_W1C_BITS  \
> + (PORTSC_CSC | PORTSC_PEC | PORTSC_OCC)
> +
>  /* DEVLC */
>  #define DEVLC_PSPD(0x03UL << 25)
>  #define DEVLC_PSPD_HS (0x02UL << 25)
> @@ -69,7 +77,10 @@
>  #define PTS_HSIC  4
>  
>  /* OTGSC */
> +#define OTGSC_VD   BIT(0)
> +#define OTGSC_VC   BIT(1)
>  #define OTGSC_IDPU BIT(5)
> +#define OTGSC_HADP BIT(6)
>  #define OTGSC_ID   BIT(8)
>  #define OTGSC_AVV  BIT(9)
>  #define OTGSC_ASV  BIT(10)
> diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c
> index 1f8907d..31a046d 100644
> --- a/drivers/usb/chipidea/otg_fsm.c
> +++ b/drivers/usb/chipidea/otg_fsm.c
> @@ -19,12 +19,322 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  #include "ci.h"
>  #include "bits.h"
>  #include "otg.h"
>  #include "otg_fsm.h"
>  
> +static struct list_head active_timers;
> +
> +#define HA_DATA_PULSE 1
> +
> +/* FSM timers */
> +struct ci_otg_fsm_timer *a_wait_vrise_tmr, *a_wait_vfall_tmr, 
> *a_wait_bcon_tmr,
> + *a_aidl_bdis_tmr, *a_bidl_adis_tmr, *b_ase0_brst_tmr,
> + *b_se0_srp_tmr, *b_srp_fail_tmr, *b_data_pulse_tmr;
> +
> +/* Add timer to timer list */
> +void ci_otg_add_timer(struct ci_hdrc *ci, struct ci_otg_fsm_timer  *gtimer)

static?

> +{
> + struct ci_otg_fsm_timer *timer = gtimer;
> + struct ci_otg_fsm_timer *tmp_timer;
> +
> + /* 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 in otgsc */
> + if (!(hw_read(ci, OP_OTGSC, OTGSC_1MSIE))) {
> + hw_write(ci, OP_OTGSC, OTGSC_INT_STATUS_BITS | OTGSC_1MSIE,
> + OTGSC_1MSIE);
> + }
> +}
> +
> +static struct ci_otg_fsm_timer *ci_otg_get_timer(enum otg_fsm_timer t)
> +{
> + struct ci_otg_fsm_timer *timer;
> +
> + /* REVISIT: use array of pointers to timers instead */
> + switch (t) {
> + case A_WAIT_VRISE:
> + timer = a_wait_vrise_tmr;
> + break;
> + case A_WAIT_VFALL:
> + timer = a_wait_vfall_tmr;
> + break;
> + case A_WAIT_BCON:
> + timer = a_wait_bcon_tmr;
> + break;
> + case A_AIDL_BDIS:
> + timer = a_aidl_bdis_tmr;
> + break;
> + case A_BIDL_ADIS:
> + timer = a_bidl_adis_tmr;
> + break;
> + case B_ASE0_BRST:
> + timer = b_ase0_brst_tmr;
> + break;
> + case B_SE0_SRP:
> + timer = b_se0_srp_tmr;
> + break;
> + case B_SRP_FAIL:
> + timer = b_srp_fail_tmr;
> + break;
> + default:
> + timer = NULL;
> + }
> +
> + return timer;
> +}
> +
> +static void ci_otg_fsm_add_timer(struct otg_fsm *fsm, enum otg_fsm_timer t)
> +{
> + struct ci_otg_fsm_timer *timer;
> + struct ci_hdrc  *ci = container_of(fsm->otg->gadget,
> + struct ci_hdrc, gadget);
> +
> + timer = ci_otg_get_timer(t);
> + if (!timer)
> + return;
> +
> + ci_otg_add_tim

Re: [PATCH 06/10] usb: chipidea: OTG fsm timers initialization.

2014-01-09 Thread Peter Chen
On Wed, Jan 08, 2014 at 05:06:21PM +0800, Li Jun wrote:
> This patch adds OTG fsm timers initialization, which use controller's 1ms
> interrupt as time out counter, also adds some local timers which are not

timeout?

> in otg_fsm_timer list.
> 
> Signed-off-by: Li Jun 
> ---
>  drivers/usb/chipidea/otg_fsm.c |  111 
> +++-
>  drivers/usb/chipidea/otg_fsm.h |   65 +++
>  2 files changed, 175 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c
> index 31a046d..86bed68 100644
> --- a/drivers/usb/chipidea/otg_fsm.c
> +++ b/drivers/usb/chipidea/otg_fsm.c
> @@ -33,7 +33,23 @@ static struct list_head active_timers;
>  /* FSM timers */
>  struct ci_otg_fsm_timer *a_wait_vrise_tmr, *a_wait_vfall_tmr, 
> *a_wait_bcon_tmr,
>   *a_aidl_bdis_tmr, *a_bidl_adis_tmr, *b_ase0_brst_tmr,
> - *b_se0_srp_tmr, *b_srp_fail_tmr, *b_data_pulse_tmr;
> + *b_se0_srp_tmr, *b_srp_fail_tmr, *b_data_pulse_tmr,
> + *b_ssend_srp_tmr, *b_sess_vld_tmr;
> +
> +inline struct ci_otg_fsm_timer *otg_timer_initializer
> +(void (*function)(void *, unsigned long), unsigned long expires,
> + unsigned long data)
> +{
> + struct ci_otg_fsm_timer *timer;
> +
> + timer = kmalloc(sizeof(struct ci_otg_fsm_timer), GFP_KERNEL);

Does devm_kzalloc can be used?

Peter

> + if (!timer)
> + return NULL;
> + timer->function = function;
> + timer->expires = expires;
> + timer->data = data;
> + return timer;
> +}
>  
>  /* Add timer to timer list */
>  void ci_otg_add_timer(struct ci_hdrc *ci, struct ci_otg_fsm_timer  *gtimer)
> @@ -170,6 +186,89 @@ int ci_otg_tick_timer(struct ci_hdrc *ci)
>   return expired;
>  }
>  
> +/* The timeout callback function to set time out bit */
> +void set_tmout(void *ptr, unsigned long indicator)
> +{
> + *(int *)indicator = 1;
> +}
> +
> +/* Initialize timers */
> +int ci_otg_init_timers(struct otg_fsm *fsm)
> +{
> + /* FSM used timers */
> + a_wait_vrise_tmr = otg_timer_initializer(&set_tmout, TA_WAIT_VRISE,
> + (unsigned long)&fsm->a_wait_vrise_tmout);
> + if (a_wait_vrise_tmr == NULL)
> + return -ENOMEM;
> +
> + a_wait_vfall_tmr = otg_timer_initializer(&set_tmout,
> + TA_WAIT_VFALL, (unsigned long)&fsm->a_wait_vfall_tmout);
> + if (a_wait_vfall_tmr == NULL)
> + return -ENOMEM;
> +
> + a_wait_bcon_tmr = otg_timer_initializer(&set_tmout,
> + TA_WAIT_BCON, (unsigned long)&fsm->a_wait_bcon_tmout);
> + if (a_wait_bcon_tmr == NULL)
> + return -ENOMEM;
> +
> + a_aidl_bdis_tmr = otg_timer_initializer(&set_tmout,
> + TA_AIDL_BDIS, (unsigned long)&fsm->a_aidl_bdis_tmout);
> + if (a_aidl_bdis_tmr == NULL)
> + return -ENOMEM;
> +
> + a_bidl_adis_tmr = otg_timer_initializer(&set_tmout,
> + TA_BIDL_ADIS, (unsigned long)&fsm->a_bidl_adis_tmout);
> + if (a_bidl_adis_tmr == NULL)
> + return -ENOMEM;
> +
> + b_ase0_brst_tmr = otg_timer_initializer(&set_tmout, TB_ASE0_BRST,
> + (unsigned long)&fsm->b_ase0_brst_tmout);
> + if (b_ase0_brst_tmr == NULL)
> + return -ENOMEM;
> +
> + b_se0_srp_tmr = otg_timer_initializer(&set_tmout, TB_SE0_SRP,
> + (unsigned long)&fsm->b_se0_srp);
> + if (b_se0_srp_tmr == NULL)
> + return -ENOMEM;
> +
> + b_ssend_srp_tmr = otg_timer_initializer(&set_tmout,
> + TB_SSEND_SRP, (unsigned long)&fsm->b_ssend_srp);
> + if (b_ssend_srp_tmr == NULL)
> + return -ENOMEM;
> +
> + b_srp_fail_tmr = otg_timer_initializer(&set_tmout,
> + TB_SRP_FAIL, (unsigned long)&fsm->b_srp_done);
> + if (b_srp_fail_tmr == NULL)
> + return -ENOMEM;
> +
> + b_data_pulse_tmr = otg_timer_initializer(&set_tmout, TB_DATA_PLS, 0);
> + if (b_data_pulse_tmr == NULL)
> + return -ENOMEM;
> +
> + b_sess_vld_tmr = otg_timer_initializer(&set_tmout, TB_SESS_VLD, 0);
> + if (b_sess_vld_tmr == NULL)
> + return -ENOMEM;
> +
> + return 0;
> +}
> +
> +/* Uninitialize timers */
> +void ci_otg_uninit_timers(void)
> +{
> + /* FSM used timers */
> + kfree(a_wait_vrise_tmr);
> + kfree(a_wait_vfall_tmr);
> + kfree(a_wait_bcon_tmr);
> + kfree(a_aidl_bdis_tmr);
> + kfree(a_bidl_adis_tmr);
> + kfree(b_ase0_brst_tmr);
> + kfree(b_se0_srp_tmr);
> + kfree(b_ssend_srp_tmr);
> + kfree(b_srp_fail_tmr);
> + kfree(b_data_pulse_tmr);
> + kfree(b_sess_vld_tmr);
> +}
> +
>  /* -*/
>  /* Operations that will be called from OTG Finite State Machine */
>  
> @@ -337,6 +436,8 @@ static struct otg_fsm_

Re: [PATCH 07/10] usb: chipidea: OTG HNP and SRP fsm implementation.

2014-01-09 Thread Peter Chen
On Wed, Jan 08, 2014 at 05:06:22PM +0800, Li Jun wrote:
> USB OTG interrupt handling and fsm transition according to USB OTG
> spec 2.0, update otg timer time out handlers.

timeout

> 
> Signed-off-by: Li Jun 
> ---
>  drivers/usb/chipidea/bits.h|3 +
>  drivers/usb/chipidea/core.c|   10 ++-
>  drivers/usb/chipidea/otg.c |6 +
>  drivers/usb/chipidea/otg_fsm.c |  264 
> ++--
>  drivers/usb/chipidea/otg_fsm.h |   18 +++
>  5 files changed, 292 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/usb/chipidea/bits.h b/drivers/usb/chipidea/bits.h
> index 4347414..9a1c4c0 100644
> --- a/drivers/usb/chipidea/bits.h
> +++ b/drivers/usb/chipidea/bits.h
> @@ -33,6 +33,8 @@
>  #define USBCMD_ATDTW  BIT(14)
>  
>  /* USBSTS & USBINTR */
> +#define USBSTS_PCIBIT(2)
> +#define USBSTS_SLIBIT(8)
>  #define USBi_UI   BIT(0)
>  #define USBi_UEI  BIT(1)
>  #define USBi_PCI  BIT(2)
> @@ -81,6 +83,7 @@
>  #define OTGSC_VC   BIT(1)
>  #define OTGSC_IDPU BIT(5)
>  #define OTGSC_HADP BIT(6)
> +#define OTGSC_HABABIT(7)
>  #define OTGSC_ID   BIT(8)
>  #define OTGSC_AVV  BIT(9)
>  #define OTGSC_ASV  BIT(10)
> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> index 9a5ef20..2f29791 100644
> --- a/drivers/usb/chipidea/core.c
> +++ b/drivers/usb/chipidea/core.c
> @@ -73,6 +73,7 @@
>  #include "host.h"
>  #include "debug.h"
>  #include "otg.h"
> +#include "otg_fsm.h"
>  
>  /* Controller register map */
>  static uintptr_t ci_regs_nolpm[] = {
> @@ -356,8 +357,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(ci, OP_OTGSC, ~0);
> + ret = ci_otg_fsm_irq(ci);
> + if (ret == IRQ_HANDLED)
> + return ret;
> + }
>  
>   /*
>* Handle id change interrupt, it indicates device/host function
> @@ -659,6 +664,9 @@ static int ci_hdrc_probe(struct platform_device *pdev)
>   if (ret)
>   goto stop;
>  
> + if (ci->is_otg)
> + ci_hdrc_otg_fsm_start(ci);
> +
>   ret = dbg_create_files(ci);
>   if (!ret)
>   return 0;
> diff --git a/drivers/usb/chipidea/otg.c b/drivers/usb/chipidea/otg.c
> index 2e13f2f..5914c92 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"
>  
>  /**
>   * ci_otg_role - pick role based on ID pin state
> @@ -76,6 +77,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 86bed68..cfdfebd 100644
> --- a/drivers/usb/chipidea/otg_fsm.c
> +++ b/drivers/usb/chipidea/otg_fsm.c
> @@ -192,6 +192,60 @@ void set_tmout(void *ptr, unsigned long indicator)
>   *(int *)indicator = 1;
>  }
>  
> +void set_tmout_and_fsm(void *ptr, unsigned long indicator)
> +{
> + struct ci_hdrc *ci = (struct ci_hdrc *)ptr;
> +
> + set_tmout(ci, indicator);
> +
> + /* trans from a_wait_bcon to a_wait_vfall */
> + disable_irq_nosync(ci->irq);
> + queue_work(ci->wq, &ci->work);
> +}
> +
> +void b_ssend_srp_tmout_handler(void *ptr, unsigned long indicator)
> +{
> + struct ci_hdrc *ci = (struct ci_hdrc *)ptr;
> + set_tmout(ci, indicator);
> +
> + /* only vbus fall below B_sess_vld in b_idle state */
> + if (ci->transceiver->state == OTG_STATE_B_IDLE) {
> + disable_irq_nosync(ci->irq);
> + queue_work(ci->wq, &ci->work);
> + }
> +}
> +
> +void b_sess_vld_tmout_handler(void *ptr, unsigned long indicator)
> +{
> + struct ci_hdrc *ci = (struct ci_hdrc *)ptr;
> +
> + /* Check if A detached */
> + if (!(hw_read(ci, OP_OTGSC, OTGSC_BSV))) {
> + ci->fsm->b_sess_vld = 0;
> + ci_otg_add_timer(ci, b_ssend_srp_tmr);
> + disable_irq_nosync(ci->irq);
> + queue_work(ci->wq, &ci->work);
> + }
> +}
> +
> +void b_data_pulse_end(void *ptr, unsigned long indicator)
> +{
> + struct ci_hdrc *ci = (struct ci_hdrc *)ptr;
> +
> + ci->fsm->b_srp_done = 1;
> + ci->fsm->b_bus_req = 0;
> + if (ci->fsm->power_up)
> + ci->fsm->power_up = 0;
> +#ifdef HA_DATA_PULSE
> + hw_write(ci, OP_OTGSC, OTGSC_INT_STATUS_BITS | OTGSC_HABA, 0);
> +
> + disable_irq_nosync(ci->irq);
> + queue_work(ci->wq, &ci->work);
> +#else
> + ci_otg_loc_conn(ci->fsm, 0);
> +#endif
> +}
> +

Re: [PATCH 09/10] usb: chipidea: add sys inputs for OTG fsm input.

2014-01-09 Thread Peter Chen
On Wed, Jan 08, 2014 at 05:06:24PM +0800, Li Jun wrote:
> 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 |  204 
> 
>  drivers/usb/chipidea/otg_fsm.h |6 +
>  3 files changed, 211 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/usb/chipidea/otg.c b/drivers/usb/chipidea/otg.c
> index 5914c92..09099e5 100644
> --- a/drivers/usb/chipidea/otg.c
> +++ b/drivers/usb/chipidea/otg.c
> @@ -129,4 +129,5 @@ void ci_hdrc_otg_destroy(struct ci_hdrc *ci)
>   }
>   ci_disable_otg_interrupt(ci, OTGSC_INT_EN_BITS);
>   ci_clear_otg_interrupt(ci, 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 60465ab..8124a64 100644
> --- a/drivers/usb/chipidea/otg_fsm.c
> +++ b/drivers/usb/chipidea/otg_fsm.c
> @@ -27,6 +27,7 @@
>  #include "otg_fsm.h"
>  
>  static struct list_head active_timers;
> +static struct ci_hdrc *ci_hdrc_p;
>  
>  #define HA_DATA_PULSE 1
>  
> @@ -51,6 +52,195 @@ inline 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 = ci_hdrc_p;
> +
> + next = buf;
> + size = PAGE_SIZE;
> +
> + if (ci->transceiver && ci->transceiver->otg && ci->fsm) {
> + t = scnprintf(next, size, "%d", ci->fsm->a_bus_req);
> + size -= t;
> + next += t;
> + } else
> + dev_err(ci->dev, "error: otg setup is not completed!\n");
> +
> + 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 = ci_hdrc_p;
> +
> + if (count > 2)
> + return -1;
> +
> + mutex_lock(&ci->fsm->lock);
> + if (ci->transceiver && ci->transceiver->otg && ci->fsm) {
> + 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)
> + goto end;
> + ci->fsm->a_bus_req = 1;
> + if (ci->transceiver->state == OTG_STATE_A_PERIPHERAL) {
> + ci->gadget.host_request_flag = 1;
> + goto end;
> + }
> + }
> +
> + disable_irq_nosync(ci->irq);
> + queue_work(ci->wq, &ci->work);
> + } else
> + dev_err(ci->dev, "error: otg setup is not completed!\n");
> +end:
> + 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 = ci_hdrc_p;

it is ci dev? if it is, you can use ci = dev_get_drvdata(dev);

Peter

> +
> + next = buf;
> + size = PAGE_SIZE;
> + if (ci->transceiver && ci->transceiver->otg && ci->fsm) {
> + t = scnprintf(next, size, "%d", ci->fsm->a_bus_drop);
> + size -= t;
> + next += t;
> + } else
> + dev_err(ci->dev, "error: otg setup is not completed!\n");
> +
> + 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 = ci_hdrc_p;
> +
> + if (count > 2)
> + return -1;
> +
> + mutex_lock(&ci->fsm->lock);
> + if (ci->transceiver && ci->transceiver->otg && ci->fsm) {
> + 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*

RE: [PATCH 4/8] usb: ehci: add freescale imx28 special write register method

2014-01-09 Thread David Laight
> From: Peter Chen
...
> > > >> +#ifdef CONFIG_SOC_IMX28
> > > >> +static inline void imx28_ehci_writel(const unsigned int val,
> > > >> +  volatile __u32 __iomem *addr)
> > > >> +{
> > > >> +  __asm__ ("swp %0, %0, [%1]" : : "r"(val), "r"(addr));
> > > >> +}
> > > >> +#else
> > > >> +static inline void imx28_ehci_writel(const unsigned int val,
> > > >> +  volatile __u32 __iomem *addr)
> > > >> +{
> > > >> +}
> > > >> +#endif

If you replace the above with:
#define imx28_ehci_writel(v, a) writel(v, a)

> > > >>  static inline void ehci_writel(const struct ehci_hcd *ehci,
> > > >>const unsigned int val, __u32 __iomem *regs)
> > > >>  {
> > > >> @@ -736,7 +749,10 @@ static inline void ehci_writel(const struct 
> > > >> ehci_hcd *ehci,
> > > >>writel_be(val, regs) :
> > > >>writel(val, regs);
> > > >>  #else
> > > >> -  writel(val, regs);
> > > >> +  if (IS_ENABLED(CONFIG_SOC_IMX28) && ehci->imx28_write_fix)
> > > >> +  imx28_ehci_writel(val, regs);
> > > >> +  else
> > > >> +  writel(val, regs);
> > > >>  #endif
> > > >
> > > > This IS_ENABLED() isn't needed at all, so please remove it.
> > >
> > > It's an optimisation for the hot path, if kernel isn't build for a mx28
> > > the newly added if() is completely optimized out. The same argument
> > > applies to the next patch.
> >
> > If the kernel isn't built for mx28 then the if statment goes away
> > without the IS_ENABLED() call as well, due to the empty inline
> > function, right?
> >
> 
> With IS_ENABLED(), the non-imx28 platform don't need to judge the
> condition of ehci->imx28_write_fix, if you don't think we need
> to care one or two instructions for every other platforms, I can
> delete it.

I think the compiler might optimise out the conditional (because the
then and else clauses are identical.

Also the earlier #if - for big-endian - can be removed.
The compiler already collapses it down.

David



--
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 4/8] usb: ehci: add freescale imx28 special write register method

2014-01-09 Thread Marc Kleine-Budde
On 01/09/2014 04:22 AM, Greg KH wrote:
> On Thu, Jan 09, 2014 at 09:36:09AM +0800, Peter Chen wrote:
>> On Tue, Jan 07, 2014 at 04:20:25PM -0800, Greg KH wrote:
>>> On Mon, Jan 06, 2014 at 09:42:26AM +0100, Marc Kleine-Budde wrote:
 Hello Peter and Greg,

 On 01/06/2014 03:10 AM, Peter Chen wrote:
> According to Freescale imx28 Errata, "ENGR119653 USB: ARM to USB
> register error issue", All USB register write operations must
> use the ARM SWP instruction. So, we implement a special ehci_write
> for imx28.
>
> Discussion for it at below:
> http://marc.info/?l=linux-usb&m=137996395529294&w=2
>
> Signed-off-by: Peter Chen 
> Acked-by: Alan Stern 
> Signed-off-by: Marc Kleine-Budde 
> Tested-by: Marc Kleine-Budde 

 please add stable on Cc for this and the next two patches:

 [PATCH 4/8] usb: ehci: add freescale imx28 special write register method
 [PATCH 5/8] usb: chipidea: add freescale imx28 special write register 
 method
 [PATCH 6/8] usb: chipidea: imx: set CI_HDRC_IMX28_WRITE_FIX for imx28
>>>
>>> How do those patches meet the Documentation/stable_kernel_rules.txt
>>> guidelines?
>>>
>>>
>>
>> - It must be obviously correct and tested.
>> It has Marc Kleine-Budde's tested-by tag.
>>
>> - It cannot be bigger than 100 lines, with context.
>> I think it is.
>>
>> - It must fix only one thing.
>> It only fixes the imx28 special write problem.
>>
>> - It must fix a real bug that bothers people (not a, "This could be a
>> problem..." type thing).
>> Robert Hodaszi reported this problem at below link:
>> http://marc.info/?l=linux-usb&m=137996395529294&w=2
> 
> You are adding new functionality for something that never worked before
> (i.e. new features), which is not ok for stable kernel patches, with the
> exception of new quirks or device ids.
> 
> sorry, this is something new, not a stable kernel patch.

Without this fix, the mx28 works...most of the time. However under
certain load scenarios the driver breaks. This is, IMHO, a fix.

Marc

-- 
Pengutronix e.K.  | Marc Kleine-Budde   |
Industrial Linux Solutions| Phone: +49-231-2826-924 |
Vertretung West/Dortmund  | Fax:   +49-5121-206917- |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |



signature.asc
Description: OpenPGP digital signature


RE: [PATCH 1/2] xhci: Avoid infinite loop when sg urb requires too many trbs

2014-01-09 Thread David Laight
> From: Sarah Sharp
> Currently prepare_ring() returns -ENOMEM if the urb won't fit into a
> single ring segment.  usb_sg_wait() treats this error as a temporary
> condition and will keep retrying until something else goes wrong.

Even if it were a temporary condition then an immediate retry
is rather pointless.
Retry after a slight delay might make some sense.

Of course, if this is the pagedaemon trying to write out
pages in order to generate some free kernel memory all is lost
as soon as the usb subsystem need to allocate memory in order
to perform a transfer.

David



--
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 3.12 033/118] usb: xhci: Link TRB must not occur within a USB payload burst

2014-01-09 Thread David Laight
> From: walt
...
> I'm still wondering if I'm suffering from hardware quirks.  From the
> first day I installed my usb3 adapter card and the usb3 disk docking
> station I've noticed some quirky behavior.

Ah - this isn't an 'on chip' usb3 adapter.
Some kind of PCIe card ?

> e.g. I boot the machine with the docking station powered-off, and then
> later I power it on, the usb3 disk is not detected at all -- until I
> reboot the machine with the docking station still powered on.

That will be something completely different to failures when running.

David

N�r��yb�X��ǧv�^�)޺{.n�+{��^n�r���z���h�&���G���h�(�階�ݢj"���m��z�ޖ���f���h���~�m�

[PATCH 3/6] usb: gadget: gr_udc: Use platform_get_irq instead of irq_of_parse_and_map

2014-01-09 Thread Andreas Larsson
Use platform_get_irq as no mapping needs to be done. No functional difference
for SPARC which is the typical environment for the driver though. Suggested by
Mark Rutland.

Signed-off-by: Andreas Larsson 
---
 drivers/usb/gadget/gr_udc.c |   14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/gadget/gr_udc.c b/drivers/usb/gadget/gr_udc.c
index e66dcf0..e471db3 100644
--- a/drivers/usb/gadget/gr_udc.c
+++ b/drivers/usb/gadget/gr_udc.c
@@ -2114,20 +2114,22 @@ static int gr_probe(struct platform_device *pdev)
if (IS_ERR(regs))
return PTR_ERR(regs);
 
-   dev->irq = irq_of_parse_and_map(dev->dev->of_node, 0);
-   if (!dev->irq) {
+   dev->irq = platform_get_irq(pdev, 0);
+   if (dev->irq <= 0) {
dev_err(dev->dev, "No irq found\n");
return -ENODEV;
}
 
/* Some core configurations has separate irqs for IN and OUT events */
-   dev->irqi = irq_of_parse_and_map(dev->dev->of_node, 1);
-   if (dev->irqi) {
-   dev->irqo = irq_of_parse_and_map(dev->dev->of_node, 2);
-   if (!dev->irqo) {
+   dev->irqi = platform_get_irq(pdev, 1);
+   if (dev->irqi > 0) {
+   dev->irqo = platform_get_irq(pdev, 2);
+   if (dev->irqo <= 0) {
dev_err(dev->dev, "Found irqi but not irqo\n");
return -ENODEV;
}
+   } else {
+   dev->irqi = 0;
}
 
dev->gadget.name = driver_name;
-- 
1.7.10.4

--
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/6] usb: gadget: gr_udc: OF and ep.maxpacket_limit related improvements

2014-01-09 Thread Andreas Larsson
This patchset adds some OF related improvements suggested by Mark
Rutland.

This patchset also adds ep.maxpacket_limit to the debugfs file and adds
a check if gr_ep_enable is called with a maxpacket value greater than
ep.maxpacket_limit.

Andreas Larsson (6):
  usb: gadget: gr_udc: Make struct platform_device variable name
clearer
  usb: gadget: gr_udc: Expand devicetree documentation
  usb: gadget: gr_udc: Use platform_get_irq instead of
irq_of_parse_and_map
  usb: gadget: gr_udc: Use of_property_read_u32_index to access arrays
  usb: gadget: gr_udc: Add ep.maxpacket_limit to debugfs information
  usb: gadget: gr_udc: Return error code when trying to set
ep.maxpacket > ep.maxpacket_limit

 Documentation/devicetree/bindings/usb/gr-udc.txt |   22 ++
 drivers/usb/gadget/gr_udc.c  |   49 --
 2 files changed, 40 insertions(+), 31 deletions(-)

-- 
1.7.10.4

--
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/6] usb: gadget: gr_udc: Expand devicetree documentation

2014-01-09 Thread Andreas Larsson
Provide more information on the two different interrupt cases and more
information of endpoint buffer sizes. Suggested by Mark Rutland.

Signed-off-by: Andreas Larsson 
---
 Documentation/devicetree/bindings/usb/gr-udc.txt |   22 ++
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/gr-udc.txt 
b/Documentation/devicetree/bindings/usb/gr-udc.txt
index 0c5118f..e944522 100644
--- a/Documentation/devicetree/bindings/usb/gr-udc.txt
+++ b/Documentation/devicetree/bindings/usb/gr-udc.txt
@@ -12,17 +12,23 @@ Required properties:
 
 - reg : Address and length of the register set for the device
 
-- interrupts : Interrupt numbers for this device
+- interrupts : Interrupt numbers for this device. Either one interrupt number
+   for all interrupts, or one for status related interrupts, one for IN
+   endpoint related interrupts and one for OUT endpoint related interrupts.
 
 Optional properties:
 
-- epobufsizes : An array of buffer sizes for OUT endpoints. If the property is
-   not present, or for endpoints outside of the array, 1024 is assumed by
-   the driver.
-
-- epibufsizes : An array of buffer sizes for IN endpoints. If the property is
-   not present, or for endpoints outside of the array, 1024 is assumed by
-   the driver.
+- epobufsizes : Array of buffer sizes for OUT endpoints when they differ
+   from the default size of 1024. The array is indexed by the OUT endpoint
+   number. If the property is present it typically contains one entry for
+   each OUT endpoint of the core. Fewer entries overrides the default sizes
+   only for as many endpoints as the array contains.
+
+- epibufsizes : Array of buffer sizes for IN endpoints when they differ
+   from the default size of 1024. The array is indexed by the IN endpoint
+   number. If the property is present it typically contains one entry for
+   each IN endpoint of the core. Fewer entries overrides the default sizes
+   only for as many endpoints as the array contains.
 
 For further information look in the documentation for the GLIB IP core library:
 http://www.gaisler.com/products/grlib/grip.pdf
-- 
1.7.10.4

--
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/6] usb: gadget: gr_udc: Make struct platform_device variable name clearer

2014-01-09 Thread Andreas Larsson
Rename struct platform_device pointers from ofdev to pdev for clarity.
Suggested by Mark Rutland.

Signed-off-by: Andreas Larsson 
---
 drivers/usb/gadget/gr_udc.c |   18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/gadget/gr_udc.c b/drivers/usb/gadget/gr_udc.c
index 914cbd8..e66dcf0 100644
--- a/drivers/usb/gadget/gr_udc.c
+++ b/drivers/usb/gadget/gr_udc.c
@@ -2071,9 +2071,9 @@ static int gr_udc_init(struct gr_udc *dev)
return 0;
 }
 
-static int gr_remove(struct platform_device *ofdev)
+static int gr_remove(struct platform_device *pdev)
 {
-   struct gr_udc *dev = dev_get_drvdata(&ofdev->dev);
+   struct gr_udc *dev = dev_get_drvdata(&pdev->dev);
 
if (dev->added)
usb_del_gadget_udc(&dev->gadget); /* Shuts everything down */
@@ -2083,7 +2083,7 @@ static int gr_remove(struct platform_device *ofdev)
gr_dfs_delete(dev);
if (dev->desc_pool)
dma_pool_destroy(dev->desc_pool);
-   dev_set_drvdata(&ofdev->dev, NULL);
+   dev_set_drvdata(&pdev->dev, NULL);
 
gr_free_request(&dev->epi[0].ep, &dev->ep0reqi->req);
gr_free_request(&dev->epo[0].ep, &dev->ep0reqo->req);
@@ -2096,7 +2096,7 @@ static int gr_request_irq(struct gr_udc *dev, int irq)
 IRQF_SHARED, driver_name, dev);
 }
 
-static int gr_probe(struct platform_device *ofdev)
+static int gr_probe(struct platform_device *pdev)
 {
struct gr_udc *dev;
struct resource *res;
@@ -2104,12 +2104,12 @@ static int gr_probe(struct platform_device *ofdev)
int retval;
u32 status;
 
-   dev = devm_kzalloc(&ofdev->dev, sizeof(*dev), GFP_KERNEL);
+   dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL);
if (!dev)
return -ENOMEM;
-   dev->dev = &ofdev->dev;
+   dev->dev = &pdev->dev;
 
-   res = platform_get_resource(ofdev, IORESOURCE_MEM, 0);
+   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
regs = devm_ioremap_resource(dev->dev, res);
if (IS_ERR(regs))
return PTR_ERR(regs);
@@ -2138,7 +2138,7 @@ static int gr_probe(struct platform_device *ofdev)
spin_lock_init(&dev->lock);
dev->regs = regs;
 
-   dev_set_drvdata(&ofdev->dev, dev);
+   dev_set_drvdata(&pdev->dev, dev);
 
/* Determine number of endpoints and data interface mode */
status = gr_read32(&dev->regs->status);
@@ -2210,7 +2210,7 @@ out:
spin_unlock(&dev->lock);
 
if (retval)
-   gr_remove(ofdev);
+   gr_remove(pdev);
 
return retval;
 }
-- 
1.7.10.4

--
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


USB-modem not working correctly

2014-01-09 Thread Linus Gasser

Hi list,

I'm trying to get an USB-modem running on a Smileplug, which is some 
Arm7-device, using it with the kernel 3.12-6. As far as I can tell it's 
an USB3-port. It works well with harddisks, but when I plug in 
USB-modems, it always fails sooner or later.


Is there anything that I can do to track down the bug? I attach the 
syslog (journal - it's archlinux) when I plug in the modem, start pppd, 
then try to do a ping. Sometimes some succeed, but very fast it fails.


I compiled the kernel using usb-debug option, but I'm at a loss to turn 
it on. I don't get any more messages than without that option.


Thanks for any help,

Linus

PS: flame me if you don't like log-files in attachements - I just 
thought it's more readable...
Jan 08 22:03:47 Profeda-new kernel: usb 3-1: new high-speed USB device number 6 
using xhci_hcd
Jan 08 22:03:47 Profeda-new kernel: usb-storage 3-1:1.0: USB Mass Storage 
device detected
Jan 08 22:03:47 Profeda-new kernel: scsi4 : usb-storage 3-1:1.0
Jan 08 22:03:47 Profeda-new kernel: usb-storage 3-1:1.1: USB Mass Storage 
device detected
Jan 08 22:03:47 Profeda-new kernel: scsi5 : usb-storage 3-1:1.1
Jan 08 22:03:48 Profeda-new usb_modeswitch[902]: switch device 12d1:14fe on 
003/006
Jan 08 22:03:48 Profeda-new kernel: usb 3-1: USB disconnect, device number 6
Jan 08 22:03:54 Profeda-new kernel: usb 3-1: new high-speed USB device number 7 
using xhci_hcd
Jan 08 22:03:56 Profeda-new kernel: option 3-1:1.0: GSM modem (1-port) 
converter detected
Jan 08 22:03:56 Profeda-new kernel: usb 3-1: GSM modem (1-port) converter now 
attached to ttyUSB0
Jan 08 22:03:56 Profeda-new kernel: usb 3-1: MAC-Address: 58:2c:80:13:92:63
Jan 08 22:03:56 Profeda-new kernel: cdc_ncm 3-1:1.1 wwan0: register 'cdc_ncm' 
at usb-:02:00.0-1, Mobile Broadband Network Device, 58:2c:80:13:92:63
Jan 08 22:03:56 Profeda-new kernel: option 3-1:1.2: GSM modem (1-port) 
converter detected
Jan 08 22:03:56 Profeda-new kernel: usb 3-1: GSM modem (1-port) converter now 
attached to ttyUSB1
Jan 08 22:03:56 Profeda-new kernel: option 3-1:1.3: GSM modem (1-port) 
converter detected
Jan 08 22:03:56 Profeda-new kernel: usb 3-1: GSM modem (1-port) converter now 
attached to ttyUSB2
Jan 08 22:03:56 Profeda-new kernel: usb-storage 3-1:1.4: USB Mass Storage 
device detected
Jan 08 22:03:56 Profeda-new kernel: scsi6 : usb-storage 3-1:1.4
Jan 08 22:03:56 Profeda-new kernel: usb-storage 3-1:1.5: USB Mass Storage 
device detected
Jan 08 22:03:56 Profeda-new kernel: scsi7 : usb-storage 3-1:1.5
Jan 08 22:03:57 Profeda-new kernel: scsi 6:0:0:0: CD-ROMHUAWEI   
Mass Storage 2.31 PQ: 0 ANSI: 2
Jan 08 22:03:57 Profeda-new kernel: scsi 7:0:0:0: Direct-Access HUAWEI   SD 
Storage   2.31 PQ: 0 ANSI: 2
Jan 08 22:03:57 Profeda-new kernel: sr0: scsi-1 drive
Jan 08 22:03:57 Profeda-new kernel: sr 6:0:0:0: Attached scsi CD-ROM sr0
Jan 08 22:03:57 Profeda-new kernel: sr 6:0:0:0: Attached scsi generic sg0 type 5
Jan 08 22:03:57 Profeda-new kernel: sd 7:0:0:0: [sda] Attached SCSI removable 
disk
Jan 08 22:03:57 Profeda-new kernel: sd 7:0:0:0: Attached scsi generic sg1 type 0
Jan 08 22:04:06 Profeda-new pppd[958]: pppd 2.4.5 started by root, uid 0
Jan 08 22:04:07 Profeda-new chat[959]: abort on (BUSY)
Jan 08 22:04:07 Profeda-new chat[959]: abort on (VOICE)
Jan 08 22:04:07 Profeda-new chat[959]: abort on (NO CARRIER)
Jan 08 22:04:07 Profeda-new chat[959]: abort on (NO DIALTONE)
Jan 08 22:04:07 Profeda-new chat[959]: abort on (NO DIAL TONE)
Jan 08 22:04:07 Profeda-new chat[959]: abort on (NO ANSWER)
Jan 08 22:04:07 Profeda-new chat[959]: abort on (DELAYED)
Jan 08 22:04:07 Profeda-new chat[959]: abort on (ERROR)
Jan 08 22:04:07 Profeda-new chat[959]: abort on (+CGATT: 0)
Jan 08 22:04:07 Profeda-new chat[959]: send (AT^M)
Jan 08 22:04:07 Profeda-new chat[959]: timeout set to 12 seconds
Jan 08 22:04:07 Profeda-new chat[959]: expect (OK)
Jan 08 22:04:07 Profeda-new chat[959]: AT^M^M
Jan 08 22:04:07 Profeda-new chat[959]: OK
Jan 08 22:04:07 Profeda-new chat[959]: -- got it
Jan 08 22:04:07 Profeda-new chat[959]: send (ATH^M)
Jan 08 22:04:07 Profeda-new chat[959]: expect (OK)
Jan 08 22:04:07 Profeda-new chat[959]: ^M
Jan 08 22:04:07 Profeda-new chat[959]: ATH^M^M
Jan 08 22:04:07 Profeda-new chat[959]: OK
Jan 08 22:04:07 Profeda-new chat[959]: -- got it
Jan 08 22:04:07 Profeda-new chat[959]: send (ATE1^M)
Jan 08 22:04:07 Profeda-new chat[959]: expect (OK)
Jan 08 22:04:07 Profeda-new chat[959]: ^M
Jan 08 22:04:07 Profeda-new chat[959]: ATE1^M^M
Jan 08 22:04:07 Profeda-new chat[959]: OK
Jan 08 22:04:07 Profeda-new chat[959]: -- got it
Jan 08 22:04:07 Profeda-new chat[959]: send (AT+CFUN=1^M)
Jan 08 22:04:07 Profeda-new chat[959]: expect (OK)
Jan 08 22:04:07 Profeda-new chat[959]: ^M
Jan 08 22:04:07 Profeda-new chat[959]: AT+CFUN=1^M^M
Jan 08 22:04:07 Profeda-new chat[959]: OK
Jan 08 22:04:07 Profeda-new chat[959]: -- got it
Jan 08 22:04:07 Profeda-new chat[959]: send 
(AT+CGDCONT=1,"IP","wap.millicom.com"^M)
Jan 08 22:04:07 Profeda-

[PATCH 5/6] usb: gadget: gr_udc: Add ep.maxpacket_limit to debugfs information

2014-01-09 Thread Andreas Larsson
Add information on ep.maxpacket_limit for each endpoint in the debugfs
information.

Signed-off-by: Andreas Larsson 
---
 drivers/usb/gadget/gr_udc.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/gadget/gr_udc.c b/drivers/usb/gadget/gr_udc.c
index 8df35fc..55757fc 100644
--- a/drivers/usb/gadget/gr_udc.c
+++ b/drivers/usb/gadget/gr_udc.c
@@ -143,6 +143,7 @@ static void gr_seq_ep_show(struct seq_file *seq, struct 
gr_ep *ep)
seq_printf(seq, "  wedged = %d\n", ep->wedged);
seq_printf(seq, "  callback = %d\n", ep->callback);
seq_printf(seq, "  maxpacket = %d\n", ep->ep.maxpacket);
+   seq_printf(seq, "  maxpacket_limit = %d\n", ep->ep.maxpacket_limit);
seq_printf(seq, "  bytes_per_buffer = %d\n", ep->bytes_per_buffer);
if (mode == 1 || mode == 3)
seq_printf(seq, "  nt = %d\n",
-- 
1.7.10.4

--
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 6/6] usb: gadget: gr_udc: Return error code when trying to set ep.maxpacket > ep.maxpacket_limit

2014-01-09 Thread Andreas Larsson
Make gr_ep_enable fail properly when a call requests a larger ep.maxpacket than
ep.maxpacket_limit.

Signed-off-by: Andreas Larsson 
---
 drivers/usb/gadget/gr_udc.c |4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/usb/gadget/gr_udc.c b/drivers/usb/gadget/gr_udc.c
index 55757fc..5423391 100644
--- a/drivers/usb/gadget/gr_udc.c
+++ b/drivers/usb/gadget/gr_udc.c
@@ -1548,6 +1548,10 @@ static int gr_ep_enable(struct usb_ep *_ep,
} else if (max == 0) {
dev_err(dev->dev, "Max payload cannot be set to 0\n");
return -EINVAL;
+   } else if (max > ep->ep.maxpacket_limit) {
+   dev_err(dev->dev, "Requested max payload %d > limit %d\n",
+   max, ep->ep.maxpacket_limit);
+   return -EINVAL;
}
 
spin_lock(&ep->dev->lock);
-- 
1.7.10.4

--
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 4/6] usb: gadget: gr_udc: Use of_property_read_u32_index to access arrays

2014-01-09 Thread Andreas Larsson
Use an appropriate accessor function for property arrays to make the code nicer
and make the code correct if it would ever run on little endian architectures.
Suggested by Mark Rutland.

Signed-off-by: Andreas Larsson 
---
 drivers/usb/gadget/gr_udc.c |   12 
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/gadget/gr_udc.c b/drivers/usb/gadget/gr_udc.c
index e471db3..8df35fc 100644
--- a/drivers/usb/gadget/gr_udc.c
+++ b/drivers/usb/gadget/gr_udc.c
@@ -2026,9 +2026,7 @@ static int gr_udc_init(struct gr_udc *dev)
u32 dmactrl_val;
int i;
int ret = 0;
-   u32 *bufsizes;
u32 bufsize;
-   int len;
 
gr_set_address(dev, 0);
 
@@ -2039,19 +2037,17 @@ static int gr_udc_init(struct gr_udc *dev)
INIT_LIST_HEAD(&dev->ep_list);
gr_set_ep0state(dev, GR_EP0_DISCONNECT);
 
-   bufsizes = (u32 *)of_get_property(np, "epobufsizes", &len);
-   len /= sizeof(u32);
for (i = 0; i < dev->nepo; i++) {
-   bufsize = (bufsizes && i < len) ? bufsizes[i] : 1024;
+   if (of_property_read_u32_index(np, "epobufsizes", i, &bufsize))
+   bufsize = 1024;
ret = gr_ep_init(dev, i, 0, bufsize);
if (ret)
return ret;
}
 
-   bufsizes = (u32 *)of_get_property(np, "epibufsizes", &len);
-   len /= sizeof(u32);
for (i = 0; i < dev->nepi; i++) {
-   bufsize = (bufsizes && i < len) ? bufsizes[i] : 1024;
+   if (of_property_read_u32_index(np, "epibufsizes", i, &bufsize))
+   bufsize = 1024;
ret = gr_ep_init(dev, i, 1, bufsize);
if (ret)
return ret;
-- 
1.7.10.4

--
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 0/5] USB Host support for OMAP5 uEVM (for 3.14)

2014-01-09 Thread Roger Quadros
Hi Michele,

Did you enable CONFIG_USB_EHCI_HCD_OMAP in the kernel config?
It is not enabled by default in omap2plus_defconfig.

cheers,
-roger

On 01/09/2014 04:34 PM, Michele Paolino wrote:
> Hello Roger,
> 
> I'm testing your patch on an OMAP5430 EVM board. The ethernet is not working 
> in my case. The kernel I'm using is (Tero Kristo's repo - branch 
> 3.13-rc7-dt-clks-v13). Is there something that I'm missing?
> 
> Here below you can find more info about my configuration:
> 
> boot error messages:
> eth0: ERROR while getting interface flags: No such device
> SIOCSIFADDR: No such device
> eth0: ERROR while getting interface flags: No such device
> SIOCADDRT: Network is unreachable
> 
> root@OMAP5:~# /usr/lib/klibc/bin/ipconfig eth0  
> ipconfig: eth0: SIOCGIFINDEX: No such device
> /usr/lib/klibc/bin/ipconfig: no devices to configure
> 
> root@OMAP5:~# uname -a
> Linux OMAP5 3.13.0-rc7-g2a4526d-dirty #0 SMP Wed Jan 8 10:41:48 CET 2014x
> 
> root@OMAP5:~# dmesg | grep eth
> [1.661434] usbcore: registered new interface driver cdc_ether
> 
> Regards,
> 
> 
> On 08/01/2014 07:15, Roger Quadros wrote:
>> Hi Benoit & Tony,
>>
>> This patchset brings up USB Host ports and Ethernet port on
>> the OMAP5 uEVM board.
>>
>> It depends on the TI Clock DT conversion patches [1] and is based
>> on 3.13-rc7
>>
>> [1] - http://article.gmane.org/gmane.linux.ports.arm.kernel/289895
>>
>> Changelog:
>>
>> v4:
>> - Updated DT binding document for clock binding
>>
>> v3:
>> - Rebased on top of 3.13-rc7
>>
>> cheers,
>> -roger
>>
>> Roger Quadros (5):
>>   mfd: omap-usb-host: Update DT clock binding information
>>   ARM: dts: OMAP5: Add 60MHz clock reference to USB Host module
>>   ARM: dts: omap4-panda: Provide USB PHY clock
>>   ARM: dts: omap5-uevm: Provide USB PHY clock
>>   ARM: OMAP2+: Remove legacy_init_ehci_clk()
>>
>>  Documentation/devicetree/bindings/mfd/omap-usb-host.txt |  4 
>>  arch/arm/boot/dts/omap4-panda-common.dtsi   |  8 ++--
>>  arch/arm/boot/dts/omap5-uevm.dts|  8 ++--
>>  arch/arm/boot/dts/omap5.dtsi|  2 ++
>>  arch/arm/mach-omap2/pdata-quirks.c  | 16 
>> 
>>  5 files changed, 10 insertions(+), 28 deletions(-)
>>
> 
> 
> -- 
> *Michele Paolino*, Virtualization R&D Engineer
> Virtual Open Systems
> /Open Source  KVM  Virtualization  Developments/
> /Multicore Systems Virtualization Porting Services/
> Web/:/ www.virtualopensystems. com 
> 
> 
> 

--
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 0/5] USB Host support for OMAP5 uEVM (for 3.14)

2014-01-09 Thread Michele Paolino

On 09/01/2014 12:08, Roger Quadros wrote:

Hi Michele,

Did you enable CONFIG_USB_EHCI_HCD_OMAP in the kernel config?
It is not enabled by default in omap2plus_defconfig.

Indeed it works.  Thank you!



cheers,
-roger

On 01/09/2014 04:34 PM, Michele Paolino wrote:

Hello Roger,

I'm testing your patch on an OMAP5430 EVM board. The ethernet is not working in 
my case. The kernel I'm using is (Tero Kristo's repo - branch 
3.13-rc7-dt-clks-v13). Is there something that I'm missing?

Here below you can find more info about my configuration:

boot error messages:
eth0: ERROR while getting interface flags: No such device
SIOCSIFADDR: No such device
eth0: ERROR while getting interface flags: No such device
SIOCADDRT: Network is unreachable

root@OMAP5:~# /usr/lib/klibc/bin/ipconfig eth0
ipconfig: eth0: SIOCGIFINDEX: No such device
/usr/lib/klibc/bin/ipconfig: no devices to configure

root@OMAP5:~# uname -a
Linux OMAP5 3.13.0-rc7-g2a4526d-dirty #0 SMP Wed Jan 8 10:41:48 CET 2014x

root@OMAP5:~# dmesg | grep eth
[1.661434] usbcore: registered new interface driver cdc_ether

Regards,


On 08/01/2014 07:15, Roger Quadros wrote:

Hi Benoit & Tony,

This patchset brings up USB Host ports and Ethernet port on
the OMAP5 uEVM board.

It depends on the TI Clock DT conversion patches [1] and is based
on 3.13-rc7

[1] - http://article.gmane.org/gmane.linux.ports.arm.kernel/289895

Changelog:

v4:
- Updated DT binding document for clock binding

v3:
- Rebased on top of 3.13-rc7

cheers,
-roger

Roger Quadros (5):
   mfd: omap-usb-host: Update DT clock binding information
   ARM: dts: OMAP5: Add 60MHz clock reference to USB Host module
   ARM: dts: omap4-panda: Provide USB PHY clock
   ARM: dts: omap5-uevm: Provide USB PHY clock
   ARM: OMAP2+: Remove legacy_init_ehci_clk()

  Documentation/devicetree/bindings/mfd/omap-usb-host.txt |  4 
  arch/arm/boot/dts/omap4-panda-common.dtsi   |  8 ++--
  arch/arm/boot/dts/omap5-uevm.dts|  8 ++--
  arch/arm/boot/dts/omap5.dtsi|  2 ++
  arch/arm/mach-omap2/pdata-quirks.c  | 16 
  5 files changed, 10 insertions(+), 28 deletions(-)



--
*Michele Paolino*, Virtualization R&D Engineer
Virtual Open Systems
/Open Source  KVM  Virtualization  Developments/
/Multicore Systems Virtualization Porting Services/
Web/:/ www.virtualopensystems. com 




--
Michele Paolino, Virtualization R&D Engineer
Virtual Open Systems
--
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: [alsa-devel] Fw: Isochronous transfer error on USB3

2014-01-09 Thread Mauro Carvalho Chehab
Em Thu, 09 Jan 2014 09:17:13 +0100
Clemens Ladisch  escreveu:

> Mauro Carvalho Chehab wrote:
> > I'm getting an weird behavior with em28xx, especially when the device
> > is connected into an audio port.
> >
> > 
> > http://git.linuxtv.org/mchehab/experimental.git/blob/refs/heads/em28xx-v4l2-v6:/drivers/media/usb/em28xx/em28xx-audio.c
> >
> > What happens is that, when I require xawtv3 to use any latency lower
> > than 65 ms, the audio doesn't work, as it gets lots of underruns per
> > second.
> 
> The driver uses five URBs with 64 frames each, so of course it
> will not be able to properly handle periods smaller than that.
> 
> > FYI, em28xx works at a 48000 KHz sampling rate, and its PM capture Hw
> > is described as:
> >
> > static struct snd_pcm_hardware snd_em28xx_hw_capture = {
> > .info = SNDRV_PCM_INFO_BLOCK_TRANSFER |
> > SNDRV_PCM_INFO_MMAP   |
> > SNDRV_PCM_INFO_INTERLEAVED|
> > SNDRV_PCM_INFO_BATCH  |
> > SNDRV_PCM_INFO_MMAP_VALID,
> >
> > .formats = SNDRV_PCM_FMTBIT_S16_LE,
> >
> > .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_KNOT,
> 
> This should be just SNDRV_PCM_RATE_48000.

Ok.

> 
> > .period_bytes_min = 64, /* 12544/2, */
> 
> This is wrong (if the driver doesn't install other constraints on the
> period length, like the USB audio class driver does).

Ok, how should it be estimated? Those values here were simply glued from
the USB audio class driver a long time ago without a further analysis.

I changed it to 188 (the minimum URB size I experimentally noticed with
the current settings) and it is now working fine with both xHCI and EHCI.

Regards,
Mauro
--
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: [alsa-devel] Fw: Isochronous transfer error on USB3

2014-01-09 Thread Mauro Carvalho Chehab
Em Thu, 9 Jan 2014 09:29:57 -0200
Mauro Carvalho Chehab  escreveu:

> Em Thu, 09 Jan 2014 09:17:13 +0100
> Clemens Ladisch  escreveu:
> 
> > Mauro Carvalho Chehab wrote:
> > > I'm getting an weird behavior with em28xx, especially when the device
> > > is connected into an audio port.
> > >
> > >   
> > > http://git.linuxtv.org/mchehab/experimental.git/blob/refs/heads/em28xx-v4l2-v6:/drivers/media/usb/em28xx/em28xx-audio.c
> > >
> > > What happens is that, when I require xawtv3 to use any latency lower
> > > than 65 ms, the audio doesn't work, as it gets lots of underruns per
> > > second.
> > 
> > The driver uses five URBs with 64 frames each, so of course it
> > will not be able to properly handle periods smaller than that.
> > 
> > > FYI, em28xx works at a 48000 KHz sampling rate, and its PM capture Hw
> > > is described as:
> > >
> > > static struct snd_pcm_hardware snd_em28xx_hw_capture = {
> > >   .info = SNDRV_PCM_INFO_BLOCK_TRANSFER |
> > >   SNDRV_PCM_INFO_MMAP   |
> > >   SNDRV_PCM_INFO_INTERLEAVED|
> > >   SNDRV_PCM_INFO_BATCH  |
> > >   SNDRV_PCM_INFO_MMAP_VALID,
> > >
> > >   .formats = SNDRV_PCM_FMTBIT_S16_LE,
> > >
> > >   .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_KNOT,
> > 
> > This should be just SNDRV_PCM_RATE_48000.
> 
> Ok.
> 
> > 
> > >   .period_bytes_min = 64, /* 12544/2, */
> > 
> > This is wrong (if the driver doesn't install other constraints on the
> > period length, like the USB audio class driver does).
> 
> Ok, how should it be estimated? Those values here were simply glued from
> the USB audio class driver a long time ago without a further analysis.
> 
> I changed it to 188 (the minimum URB size I experimentally noticed with
> the current settings) and it is now working fine with both xHCI and EHCI.

PS.: using 188 there, the URBs now have a total actual size of 24 bytes.

Regards,
-- 

Cheers,
Mauro
--
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 v5 7/9] ARM: dts: omap4-panda: Provide USB PHY clock

2014-01-09 Thread Roger Quadros
The USB PHY gets its clock from AUXCLK3. Provide this
information.

Signed-off-by: Roger Quadros 
---
 arch/arm/boot/dts/omap4-panda-common.dtsi | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/arch/arm/boot/dts/omap4-panda-common.dtsi 
b/arch/arm/boot/dts/omap4-panda-common.dtsi
index 88c6a05..50b72966 100644
--- a/arch/arm/boot/dts/omap4-panda-common.dtsi
+++ b/arch/arm/boot/dts/omap4-panda-common.dtsi
@@ -83,12 +83,8 @@
compatible = "usb-nop-xceiv";
reset-gpios = <&gpio2 30 GPIO_ACTIVE_LOW>;   /* gpio_62 */
vcc-supply = <&hsusb1_power>;
-   /**
-* FIXME:
-* put the right clock phandle here when available
-*  clocks = <&auxclk3>;
-*  clock-names = "main_clk";
-*/
+   clocks = <&auxclk3_ck>;
+   clock-names = "main_clk";
clock-frequency = <1920>;
};
 
-- 
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 v5 5/9] ARM: dts: omap4: Update omap-usb-host node

2014-01-09 Thread Roger Quadros
The omap-usb-host driver expects a certain name for internal
and external reference clocks. Provide these clocks.

Signed-off-by: Roger Quadros 
---
 arch/arm/boot/dts/omap4.dtsi | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index d3f8a6e..39a05ce 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -697,6 +697,12 @@
#address-cells = <1>;
#size-cells = <1>;
ranges;
+   clocks = <&init_60m_fclk>,
+<&xclk60mhsp1_ck>,
+<&xclk60mhsp2_ck>;
+   clock-names = "refclk_60m_int",
+ "refclk_60m_ext_p1",
+ "refclk_60m_ext_p2";
 
usbhsohci: ohci@4a064800 {
compatible = "ti,ohci-omap3", "usb-ohci";
-- 
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 v5 9/9] ARM: OMAP2+: Remove legacy_init_ehci_clk()

2014-01-09 Thread Roger Quadros
The necessary clock phandle for the EHCI clock is now provided
via device tree so we no longer need this legacy method.

Signed-off-by: Roger Quadros 
---
 arch/arm/mach-omap2/pdata-quirks.c | 16 
 1 file changed, 16 deletions(-)

diff --git a/arch/arm/mach-omap2/pdata-quirks.c 
b/arch/arm/mach-omap2/pdata-quirks.c
index 39f020c..6a4e2d1 100644
--- a/arch/arm/mach-omap2/pdata-quirks.c
+++ b/arch/arm/mach-omap2/pdata-quirks.c
@@ -26,20 +26,6 @@ struct pdata_init {
void (*fn)(void);
 };
 
-/*
- * Create alias for USB host PHY clock.
- * Remove this when clock phandle can be provided via DT
- */
-static void __init __used legacy_init_ehci_clk(char *clkname)
-{
-   int ret;
-
-   ret = clk_add_alias("main_clk", NULL, clkname, NULL);
-   if (ret)
-   pr_err("%s:Failed to add main_clk alias to %s :%d\n",
-  __func__, clkname, ret);
-}
-
 #if IS_ENABLED(CONFIG_WL12XX)
 
 static struct wl12xx_platform_data wl12xx __initdata;
@@ -105,7 +91,6 @@ static void __init omap4_sdp_legacy_init(void)
 static void __init omap4_panda_legacy_init(void)
 {
omap4_panda_display_init_of();
-   legacy_init_ehci_clk("auxclk3_ck");
legacy_init_wl12xx(WL12XX_REFCLOCK_38, 0, 53);
 }
 #endif
@@ -113,7 +98,6 @@ static void __init omap4_panda_legacy_init(void)
 #ifdef CONFIG_SOC_OMAP5
 static void __init omap5_uevm_legacy_init(void)
 {
-   legacy_init_ehci_clk("auxclk1_ck");
 }
 #endif
 
-- 
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 v5 2/9] mfd: omap-usb-host: Get clocks based on hardware revision

2014-01-09 Thread Roger Quadros
Not all revisions have all the clocks so get the necessary clocks
based on hardware revision.

This should avoid un-necessary clk_get failure messages that were
observed earlier.

Be more strict and always fail on clk_get() error.

CC: Lee Jones 
CC: Samuel Ortiz 
Signed-off-by: Roger Quadros 
---
 drivers/mfd/omap-usb-host.c | 93 +++--
 1 file changed, 64 insertions(+), 29 deletions(-)

diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index 1c9bca2..7202cc6 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -92,7 +92,6 @@
 #define is_ehci_tll_mode(x)(x == OMAP_EHCI_PORT_MODE_TLL)
 #define is_ehci_hsic_mode(x)   (x == OMAP_EHCI_PORT_MODE_HSIC)
 
-
 struct usbhs_hcd_omap {
int nports;
struct clk  **utmi_clk;
@@ -665,22 +664,41 @@ static int usbhs_omap_probe(struct platform_device *pdev)
goto err_mem;
}
 
-   need_logic_fck = false;
+   /* Set all clocks as invalid to begin with */
+   omap->ehci_logic_fck = omap->init_60m_fclk = ERR_PTR(-EINVAL);
+   omap->utmi_p1_gfclk = omap->utmi_p2_gfclk = ERR_PTR(-EINVAL);
+   omap->xclk60mhsp1_ck = omap->xclk60mhsp2_ck = ERR_PTR(-EINVAL);
+
for (i = 0; i < omap->nports; i++) {
-   if (is_ehci_phy_mode(i) || is_ehci_tll_mode(i) ||
-   is_ehci_hsic_mode(i))
-   need_logic_fck |= true;
+   omap->utmi_clk[i] = ERR_PTR(-EINVAL);
+   omap->hsic480m_clk[i] = ERR_PTR(-EINVAL);
+   omap->hsic60m_clk[i] = ERR_PTR(-EINVAL);
}
 
-   omap->ehci_logic_fck = ERR_PTR(-EINVAL);
-   if (need_logic_fck) {
-   omap->ehci_logic_fck = devm_clk_get(dev, "ehci_logic_fck");
-   if (IS_ERR(omap->ehci_logic_fck)) {
-   ret = PTR_ERR(omap->ehci_logic_fck);
-   dev_dbg(dev, "ehci_logic_fck failed:%d\n", ret);
+   /* for OMAP3 i.e. USBHS REV1 */
+   if (omap->usbhs_rev == OMAP_USBHS_REV1) {
+   need_logic_fck = false;
+   for (i = 0; i < omap->nports; i++) {
+   if (is_ehci_phy_mode(pdata->port_mode[i]) ||
+   is_ehci_tll_mode(pdata->port_mode[i]) ||
+   is_ehci_hsic_mode(pdata->port_mode[i]))
+
+   need_logic_fck |= true;
+   }
+
+   if (need_logic_fck) {
+   omap->ehci_logic_fck = clk_get(dev, "usbhost_120m_fck");
+   if (IS_ERR(omap->ehci_logic_fck)) {
+   ret = PTR_ERR(omap->ehci_logic_fck);
+   dev_err(dev, "usbhost_120m_fck failed:%d\n",
+   ret);
+   goto err_mem;
+   }
}
+   goto initialize;
}
 
+   /* for OMAP4+ i.e. USBHS REV2+ */
omap->utmi_p1_gfclk = devm_clk_get(dev, "utmi_p1_gfclk");
if (IS_ERR(omap->utmi_p1_gfclk)) {
ret = PTR_ERR(omap->utmi_p1_gfclk);
@@ -728,54 +746,71 @@ static int usbhs_omap_probe(struct platform_device *pdev)
 * them
 */
omap->utmi_clk[i] = devm_clk_get(dev, clkname);
-   if (IS_ERR(omap->utmi_clk[i]))
-   dev_dbg(dev, "Failed to get clock : %s : %ld\n",
-   clkname, PTR_ERR(omap->utmi_clk[i]));
+   if (IS_ERR(omap->utmi_clk[i])) {
+   ret = PTR_ERR(omap->utmi_clk[i]);
+   dev_err(dev, "Failed to get clock : %s : %d\n",
+   clkname, ret);
+   goto err_mem;
+   }
 
snprintf(clkname, sizeof(clkname),
"usb_host_hs_hsic480m_p%d_clk", i + 1);
omap->hsic480m_clk[i] = devm_clk_get(dev, clkname);
-   if (IS_ERR(omap->hsic480m_clk[i]))
-   dev_dbg(dev, "Failed to get clock : %s : %ld\n",
-   clkname, PTR_ERR(omap->hsic480m_clk[i]));
+   if (IS_ERR(omap->hsic480m_clk[i])) {
+   ret = PTR_ERR(omap->hsic480m_clk[i]);
+   dev_err(dev, "Failed to get clock : %s : %d\n",
+   clkname, ret);
+   goto err_mem;
+   }
 
snprintf(clkname, sizeof(clkname),
"usb_host_hs_hsic60m_p%d_clk", i + 1);
omap->hsic60m_clk[i] = devm_clk_get(dev, clkname);
-   if (IS_ERR(omap->hsic60m_clk[i]))
-   dev_dbg(dev, "Failed to get clock : %s : %ld\n",
-   clkname, PTR_ERR(omap->hsic60m_clk[i]));
+   if (IS_ERR(omap->hsic60m_clk[i])) {
+  

[PATCH v5 3/9] mfd: omap-usb-host: Update DT clock binding information

2014-01-09 Thread Roger Quadros
The omap-usb-host driver expects certained named clocks.
Add this information to the DT binding document.

Use clock names as per function for reference clocks.

CC: Lee Jones 
CC: Samuel Ortiz 
Signed-off-by: Roger Quadros 
---
 .../devicetree/bindings/mfd/omap-usb-host.txt  | 23 ++
 drivers/mfd/omap-usb-host.c|  6 +++---
 2 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/mfd/omap-usb-host.txt 
b/Documentation/devicetree/bindings/mfd/omap-usb-host.txt
index b381fa6..4721b2d 100644
--- a/Documentation/devicetree/bindings/mfd/omap-usb-host.txt
+++ b/Documentation/devicetree/bindings/mfd/omap-usb-host.txt
@@ -32,6 +32,29 @@ Optional properties:
 - single-ulpi-bypass: Must be present if the controller contains a single
   ULPI bypass control bit. e.g. OMAP3 silicon <= ES2.1
 
+- clocks: a list of phandles and clock-specifier pairs, one for each entry in
+  clock-names.
+
+- clock-names: should include:
+  For OMAP3
+  * "usbhost_120m_fck" - 120MHz Functional clock.
+
+  For OMAP4+
+  * "refclk_60m_int" - 60MHz internal reference clock for UTMI clock mux
+  * "refclk_60m_ext_p1" - 60MHz external ref. clock for Port 1's UTMI clock 
mux.
+  * "refclk_60m_ext_p2" - 60MHz external ref. clock for Port 2's UTMI clock mux
+  * "utmi_p1_gfclk" - Port 1 UTMI clock mux.
+  * "utmi_p2_gfclk" - Port 2 UTMI clock mux.
+  * "usb_host_hs_utmi_p1_clk" - Port 1 UTMI clock gate.
+  * "usb_host_hs_utmi_p2_clk" - Port 2 UTMI clock gate.
+  * "usb_host_hs_utmi_p3_clk" - Port 3 UTMI clock gate.
+  * "usb_host_hs_hsic480m_p1_clk" - Port 1 480MHz HSIC clock gate.
+  * "usb_host_hs_hsic480m_p2_clk" - Port 2 480MHz HSIC clock gate.
+  * "usb_host_hs_hsic480m_p3_clk" - Port 3 480MHz HSIC clock gate.
+  * "usb_host_hs_hsic60m_p1_clk" - Port 1 60MHz HSIC clock gate.
+  * "usb_host_hs_hsic60m_p2_clk" - Port 2 60MHz HSIC clock gate.
+  * "usb_host_hs_hsic60m_p3_clk" - Port 3 60MHz HSIC clock gate.
+
 Required properties if child node exists:
 
 - #address-cells: Must be 1
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index 7202cc6..eeea6e6 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -713,21 +713,21 @@ static int usbhs_omap_probe(struct platform_device *pdev)
goto err_mem;
}
 
-   omap->xclk60mhsp1_ck = devm_clk_get(dev, "xclk60mhsp1_ck");
+   omap->xclk60mhsp1_ck = devm_clk_get(dev, "refclk_60m_ext_p1");
if (IS_ERR(omap->xclk60mhsp1_ck)) {
ret = PTR_ERR(omap->xclk60mhsp1_ck);
dev_err(dev, "xclk60mhsp1_ck failed error:%d\n", ret);
goto err_mem;
}
 
-   omap->xclk60mhsp2_ck = devm_clk_get(dev, "xclk60mhsp2_ck");
+   omap->xclk60mhsp2_ck = devm_clk_get(dev, "refclk_60m_ext_p2");
if (IS_ERR(omap->xclk60mhsp2_ck)) {
ret = PTR_ERR(omap->xclk60mhsp2_ck);
dev_err(dev, "xclk60mhsp2_ck failed error:%d\n", ret);
goto err_mem;
}
 
-   omap->init_60m_fclk = devm_clk_get(dev, "init_60m_fclk");
+   omap->init_60m_fclk = devm_clk_get(dev, "refclk_60m_int");
if (IS_ERR(omap->init_60m_fclk)) {
ret = PTR_ERR(omap->init_60m_fclk);
dev_err(dev, "init_60m_fclk failed error:%d\n", ret);
-- 
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: [alsa-devel] Fw: Isochronous transfer error on USB3

2014-01-09 Thread Clemens Ladisch
Mauro Carvalho Chehab wrote:
> Clemens Ladisch  escreveu:
>> Mauro Carvalho Chehab wrote:
>>> .period_bytes_min = 64, /* 12544/2, */
>>
>> This is wrong (if the driver doesn't install other constraints on the
>> period length, like the USB audio class driver does).
>
> Ok, how should it be estimated?

This value specifies how fast the driver can report period interrupts,
i.e., how often it can call snd_pcm_period_elapsed().  In other words,
if the application configures the device for this minimum period size,
but if it is possible for this amount of bytes to be transferred
_without_ triggering an interrupt (by reaching the end of the URB), then
this value was too low.

The em28xx driver uses a fixed URB size, so actual interrupts happen
every 64 frames, so this value should be at least the number of bytes
that can be transferred in 64 ms (assuming a full-speed device).

Because you do not know the exact number of samples that will be sent
per frame, it is possible that the USB interrupt happens up to 63 ms
after the point where the period interrupt should actually have
happened.  This jitter could be reduced by using shorter URBs.

In any case, this driver does not need the integer constraint on the
period count.


Regards,
Clemens
--
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 v5 4/9] mfd: omap-usb-tll: Update DT clock binding information

2014-01-09 Thread Roger Quadros
The omap-usb-tll driver needs one clock for each TLL channel.
Add this information to the DT binding document.

CC: Lee Jones 
CC: Samuel Ortiz 
Signed-off-by: Roger Quadros 
---
 Documentation/devicetree/bindings/mfd/omap-usb-tll.txt | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/Documentation/devicetree/bindings/mfd/omap-usb-tll.txt 
b/Documentation/devicetree/bindings/mfd/omap-usb-tll.txt
index 62fe697..c58d704 100644
--- a/Documentation/devicetree/bindings/mfd/omap-usb-tll.txt
+++ b/Documentation/devicetree/bindings/mfd/omap-usb-tll.txt
@@ -7,6 +7,16 @@ Required properties:
 - interrupts : should contain the TLL module's interrupt
 - ti,hwmod : must contain "usb_tll_hs"
 
+Optional properties:
+
+- clocks: a list of phandles and clock-specifier pairs, one for each entry in
+  clock-names.
+
+- clock-names: should include:
+  * "usb_tll_hs_usb_ch0_clk" - USB TLL channel 0 clock
+  * "usb_tll_hs_usb_ch1_clk" - USB TLL channel 1 clock
+  * "usb_tll_hs_usb_ch2_clk" - USB TLL channel 2 clock
+
 Example:
 
usbhstll: usbhstll@4a062000 {
-- 
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 v5 6/9] ARM: dts: omap5: Update omap-usb-host node

2014-01-09 Thread Roger Quadros
The omap-usb-host driver expects a certain name for internal
and external reference clocks. Provide these clocks.

Signed-off-by: Roger Quadros 
---
 arch/arm/boot/dts/omap5.dtsi | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
index 2f12a47..0f82ecf 100644
--- a/arch/arm/boot/dts/omap5.dtsi
+++ b/arch/arm/boot/dts/omap5.dtsi
@@ -765,6 +765,12 @@
#address-cells = <1>;
#size-cells = <1>;
ranges;
+   clocks = <&l3init_60m_fclk>,
+<&xclk60mhsp1_ck>,
+<&xclk60mhsp2_ck>;
+   clock-names = "refclk_60m_int",
+ "refclk_60m_ext_p1",
+ "refclk_60m_ext_p2";
 
usbhsohci: ohci@4a064800 {
compatible = "ti,ohci-omap3", "usb-ohci";
-- 
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 v5 8/9] ARM: dts: omap5-uevm: Provide USB PHY clock

2014-01-09 Thread Roger Quadros
The HS USB 2 PHY gets its clock from AUXCLK1. Provide this
information.

Signed-off-by: Roger Quadros 
---
 arch/arm/boot/dts/omap5-uevm.dts | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/arch/arm/boot/dts/omap5-uevm.dts b/arch/arm/boot/dts/omap5-uevm.dts
index 002fa70..3b99ec2 100644
--- a/arch/arm/boot/dts/omap5-uevm.dts
+++ b/arch/arm/boot/dts/omap5-uevm.dts
@@ -31,12 +31,8 @@
hsusb2_phy: hsusb2_phy {
compatible = "usb-nop-xceiv";
reset-gpios = <&gpio3 16 GPIO_ACTIVE_LOW>; /* gpio3_80 
HUB_NRESET */
-   /**
- * FIXME
- * Put the right clock phandle here when available
- * clocks = <&auxclk1>;
- * clock-names = "main_clk";
- */
+   clocks = <&auxclk1_ck>;
+   clock-names = "main_clk";
clock-frequency = <1920>;
};
 
-- 
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 v5 0/9] USB Host support for OMAP5 uEVM (for 3.14)

2014-01-09 Thread Roger Quadros
Hi Benoit & Tony,

This patchset brings up USB Host ports and Ethernet port on
the OMAP5 uEVM board.

It depends on the TI Clock DT conversion patches [1] and is based
on 3.13-rc7

[1] - http://article.gmane.org/gmane.linux.ports.arm.kernel/289895

NOTE: I've tested this only on the OMAP5 uEVM board. Since the patchset
changes could affect OMAP3/4, it must be verified at least on
a Beagleboard and a Panda board before being pulled in.
I request someone to verify this on OMAP3/4 since I don't have access
to those boards at the moment. Thanks.

Changelog:

v5:
- Expose all clocks in the DT binding document for mfd:omap-usb-host
and mfd:omap-usb-tll

v4:
- Updated DT binding document for clock binding

v3:
- Rebased on top of 3.13-rc7

cheers,
-roger

Roger Quadros (9):
  mfd: omap-usb-host: Use resource managed clk_get()
  mfd: omap-usb-host: Get clocks based on hardware revision
  mfd: omap-usb-host: Update DT clock binding information
  mfd: omap-usb-tll: Update DT clock binding information
  ARM: dts: omap4: Update omap-usb-host node
  ARM: dts: omap5: Update omap-usb-host node
  ARM: dts: omap4-panda: Provide USB PHY clock
  ARM: dts: omap5-uevm: Provide USB PHY clock
  ARM: OMAP2+: Remove legacy_init_ehci_clk()

 .../devicetree/bindings/mfd/omap-usb-host.txt  |  23 +++
 .../devicetree/bindings/mfd/omap-usb-tll.txt   |  10 ++
 arch/arm/boot/dts/omap4-panda-common.dtsi  |   8 +-
 arch/arm/boot/dts/omap4.dtsi   |   6 +
 arch/arm/boot/dts/omap5-uevm.dts   |   8 +-
 arch/arm/boot/dts/omap5.dtsi   |   6 +
 arch/arm/mach-omap2/pdata-quirks.c |  16 --
 drivers/mfd/omap-usb-host.c| 172 ++---
 8 files changed, 128 insertions(+), 121 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 v5 1/9] mfd: omap-usb-host: Use resource managed clk_get()

2014-01-09 Thread Roger Quadros
Use devm_clk_get() instead of clk_get().

CC: Lee Jones 
CC: Samuel Ortiz 
Signed-off-by: Roger Quadros 
---
 drivers/mfd/omap-usb-host.c | 81 +
 1 file changed, 16 insertions(+), 65 deletions(-)

diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index 142650f..1c9bca2 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -674,46 +674,46 @@ static int usbhs_omap_probe(struct platform_device *pdev)
 
omap->ehci_logic_fck = ERR_PTR(-EINVAL);
if (need_logic_fck) {
-   omap->ehci_logic_fck = clk_get(dev, "ehci_logic_fck");
+   omap->ehci_logic_fck = devm_clk_get(dev, "ehci_logic_fck");
if (IS_ERR(omap->ehci_logic_fck)) {
ret = PTR_ERR(omap->ehci_logic_fck);
dev_dbg(dev, "ehci_logic_fck failed:%d\n", ret);
}
}
 
-   omap->utmi_p1_gfclk = clk_get(dev, "utmi_p1_gfclk");
+   omap->utmi_p1_gfclk = devm_clk_get(dev, "utmi_p1_gfclk");
if (IS_ERR(omap->utmi_p1_gfclk)) {
ret = PTR_ERR(omap->utmi_p1_gfclk);
dev_err(dev, "utmi_p1_gfclk failed error:%d\n", ret);
-   goto err_p1_gfclk;
+   goto err_mem;
}
 
-   omap->utmi_p2_gfclk = clk_get(dev, "utmi_p2_gfclk");
+   omap->utmi_p2_gfclk = devm_clk_get(dev, "utmi_p2_gfclk");
if (IS_ERR(omap->utmi_p2_gfclk)) {
ret = PTR_ERR(omap->utmi_p2_gfclk);
dev_err(dev, "utmi_p2_gfclk failed error:%d\n", ret);
-   goto err_p2_gfclk;
+   goto err_mem;
}
 
-   omap->xclk60mhsp1_ck = clk_get(dev, "xclk60mhsp1_ck");
+   omap->xclk60mhsp1_ck = devm_clk_get(dev, "xclk60mhsp1_ck");
if (IS_ERR(omap->xclk60mhsp1_ck)) {
ret = PTR_ERR(omap->xclk60mhsp1_ck);
dev_err(dev, "xclk60mhsp1_ck failed error:%d\n", ret);
-   goto err_xclk60mhsp1;
+   goto err_mem;
}
 
-   omap->xclk60mhsp2_ck = clk_get(dev, "xclk60mhsp2_ck");
+   omap->xclk60mhsp2_ck = devm_clk_get(dev, "xclk60mhsp2_ck");
if (IS_ERR(omap->xclk60mhsp2_ck)) {
ret = PTR_ERR(omap->xclk60mhsp2_ck);
dev_err(dev, "xclk60mhsp2_ck failed error:%d\n", ret);
-   goto err_xclk60mhsp2;
+   goto err_mem;
}
 
-   omap->init_60m_fclk = clk_get(dev, "init_60m_fclk");
+   omap->init_60m_fclk = devm_clk_get(dev, "init_60m_fclk");
if (IS_ERR(omap->init_60m_fclk)) {
ret = PTR_ERR(omap->init_60m_fclk);
dev_err(dev, "init_60m_fclk failed error:%d\n", ret);
-   goto err_init60m;
+   goto err_mem;
}
 
for (i = 0; i < omap->nports; i++) {
@@ -727,21 +727,21 @@ static int usbhs_omap_probe(struct platform_device *pdev)
 * platforms have all clocks and we can function without
 * them
 */
-   omap->utmi_clk[i] = clk_get(dev, clkname);
+   omap->utmi_clk[i] = devm_clk_get(dev, clkname);
if (IS_ERR(omap->utmi_clk[i]))
dev_dbg(dev, "Failed to get clock : %s : %ld\n",
clkname, PTR_ERR(omap->utmi_clk[i]));
 
snprintf(clkname, sizeof(clkname),
"usb_host_hs_hsic480m_p%d_clk", i + 1);
-   omap->hsic480m_clk[i] = clk_get(dev, clkname);
+   omap->hsic480m_clk[i] = devm_clk_get(dev, clkname);
if (IS_ERR(omap->hsic480m_clk[i]))
dev_dbg(dev, "Failed to get clock : %s : %ld\n",
clkname, PTR_ERR(omap->hsic480m_clk[i]));
 
snprintf(clkname, sizeof(clkname),
"usb_host_hs_hsic60m_p%d_clk", i + 1);
-   omap->hsic60m_clk[i] = clk_get(dev, clkname);
+   omap->hsic60m_clk[i] = devm_clk_get(dev, clkname);
if (IS_ERR(omap->hsic60m_clk[i]))
dev_dbg(dev, "Failed to get clock : %s : %ld\n",
clkname, PTR_ERR(omap->hsic60m_clk[i]));
@@ -784,7 +784,7 @@ static int usbhs_omap_probe(struct platform_device *pdev)
 
if (ret) {
dev_err(dev, "Failed to create DT children: %d\n", ret);
-   goto err_alloc;
+   goto err_mem;
}
 
} else {
@@ -792,40 +792,12 @@ static int usbhs_omap_probe(struct platform_device *pdev)
if (ret) {
dev_err(dev, "omap_usbhs_alloc_children failed: %d\n",
ret);
-   goto err_alloc;
+   goto err_mem;
}
}
 
return 0;
 
-err_alloc:
-   for (i = 0; i < omap->nports; i++) {
-  

Re: [PATCH v2 2/2] ehci-platform: Add support for clks and phy passed through devicetree

2014-01-09 Thread Hans de Goede

Hi,

On 01/08/2014 07:16 PM, Maxime Ripard wrote:

On Wed, Jan 08, 2014 at 05:30:08PM +0100, Hans de Goede wrote:

Currently ehci-platform is only used in combination with devicetree when used
with some via socs. By extending it to (optionally) get clks and a phy from
devicetree, and enabling / disabling those on power_on / off, it can be used
more generically. Specifically after this commit it can be used for the
ehci controller on Allwinner sunxi SoCs.

Somehow we've ended up with 2 device-bindings documents for ehci-platform.c,
this patch renames and updates one to platform-ehci.txt to reflect that this
is a generic platform driver, and removes the other.

Signed-off-by: Hans de Goede 
---
  .../devicetree/bindings/usb/platform-ehci.txt  |  25 
  .../devicetree/bindings/usb/via,vt8500-ehci.txt|  15 ---
  .../devicetree/bindings/usb/vt8500-ehci.txt|  12 --
  drivers/usb/host/ehci-platform.c   | 126 +
  4 files changed, 131 insertions(+), 47 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/usb/platform-ehci.txt
  delete mode 100644 Documentation/devicetree/bindings/usb/via,vt8500-ehci.txt
  delete mode 100644 Documentation/devicetree/bindings/usb/vt8500-ehci.txt

diff --git a/Documentation/devicetree/bindings/usb/platform-ehci.txt 
b/Documentation/devicetree/bindings/usb/platform-ehci.txt
new file mode 100644
index 000..56c478d
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/platform-ehci.txt
@@ -0,0 +1,25 @@
+Generic Platform EHCI controller
+
+Required properties:
+- compatible : "via,vt8500-ehci" or "wm,prizm-ehci"
+- reg : ehci controller register range (address and length)
+- interrupts : ehci controller interrupt
+
+Optional properties:
+- clocks : a list of phandle + clock specifier pairs, one for each entry
+   in clock-names.
+- clock-names : "clk0", "clk1", ...
+- phys : phy
+- phy-names : "phy0"
+
+Example:
+
+   ehci@d8007900 {
+   compatible = "via,vt8500-ehci";
+   reg = <0xd8007900 0x200>;
+   interrupts = <43>;
+   clocks = <&usb_clk 6>, <&ahb_gates 2>;
+   clock-names = "clk0", "clk1";


I'm really not convinced by this either. It prevents you from doing
anything useful out of these clocks, and the only thing you can
actually do with it is calling clk_get, and that's pretty much it.

What if you some platform needs to adjust the rate of one of the two?


Then it needs its own driver. This is intended as a binding for a
*generic* driver, which is meant to cover simple straight forward
non-pci ohci cases. For more complex cases a separate driver will
need to be written.

I must say I'm becoming a bit unhappy with how the reviews of devicetree
bindings are being done. In one case it is not generic enough (ahci-sunxi).

If I then try to make it more generic in a case where that can actually
be done as the hardware is pretty straight forward, it is not specific enough.
You can simply not have both!


Or wants to cut one but not the other for any reason?


This is another example of non generic behavior, requiring a separate
(small using the existing ohci core) platform glue driver, like the *19* we
already have.

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-modem not working correctly

2014-01-09 Thread Bjørn Mork
Linus Gasser  writes:

> I'm trying to get an USB-modem running on a Smileplug, which is some
> Arm7-device, using it with the kernel 3.12-6. As far as I can tell
> it's an USB3-port. It works well with harddisks, but when I plug in
> USB-modems, it always fails sooner or later.

Do you have this problem with different modems?

> Jan 08 22:04:18 Profeda-new pppd[958]: local  IP address 10.6.27.36
> Jan 08 22:04:18 Profeda-new pppd[958]: remote IP address 10.64.64.64
> Jan 08 22:04:33 Profeda-new kernel: option1 ttyUSB0: option_instat_callback: 
> error -108
> Jan 08 22:04:33 Profeda-new kernel: option1 ttyUSB0: usb_wwan_indat_callback: 
> resubmit read urb failed. (-2)
> Jan 08 22:04:33 Profeda-new kernel: option1 ttyUSB0: usb_wwan_indat_callback: 
> resubmit read urb failed. (-2)
> Jan 08 22:04:33 Profeda-new pppd[958]: Hangup (SIGHUP)
> Jan 08 22:04:33 Profeda-new pppd[958]: Modem hangup
> Jan 08 22:04:33 Profeda-new pppd[958]: Connect time 0.3 minutes.
> Jan 08 22:04:33 Profeda-new pppd[958]: Sent 504 bytes, received 84 bytes.
> Jan 08 22:04:33 Profeda-new pppd[958]: Connection terminated.
> Jan 08 22:04:33 Profeda-new kernel: option1 ttyUSB0: usb_wwan_indat_callback: 
> resubmit read urb failed. (-2)
> Jan 08 22:04:33 Profeda-new kernel: option1 ttyUSB0: GSM modem (1-port) 
> converter now disconnected from ttyUSB0
> Jan 08 22:04:33 Profeda-new kernel: option 3-1:1.0: device disconnected
> Jan 08 22:04:33 Profeda-new kernel: cdc_ncm 3-1:1.1 wwan0: unregister 
> 'cdc_ncm' usb-:02:00.0-1, Mobile Broadband Network Device
> Jan 08 22:04:33 Profeda-new kernel: option1 ttyUSB1: GSM modem (1-port) 
> converter now disconnected from ttyUSB1
> Jan 08 22:04:33 Profeda-new kernel: option 3-1:1.2: device disconnected
> Jan 08 22:04:33 Profeda-new kernel: option1 ttyUSB2: GSM modem (1-port) 
> converter now disconnected from ttyUSB2
> Jan 08 22:04:33 Profeda-new kernel: option 3-1:1.3: device disconnected

The modem disconnected from the bus. There isn't much you can do about
this on the host side. Either the firmware crashed, or the device
powered down for some other reason.

You could try a powered hub to eliminate any power related problems.
But if the port can power a harddisk spinning up, then I guess it should
handle the 3G modem power spikes too.  Anyway, a hub is a cheap and
simple test.


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


Re: [PATCH v2 1/2] ohci-platform: Add support for devicetree instantiation

2014-01-09 Thread Hans de Goede

Hi,

On 01/08/2014 09:36 PM, Florian Fainelli wrote:

Hello,

2014/1/8 Hans de Goede :

Add support for ohci-platform instantiation from devicetree, including
optionally getting clks and a phy from devicetree, and enabling / disabling
those on power_on / off.

This should allow using ohci-platform from devicetree in various cases.
Specifically after this commit it can be used for the ohci controller found
on Allwinner sunxi SoCs.

Signed-off-by: Hans de Goede 
---
  .../devicetree/bindings/usb/platform-ohci.txt  |  25 
  drivers/usb/host/ohci-platform.c   | 148 ++---
  2 files changed, 153 insertions(+), 20 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/usb/platform-ohci.txt

diff --git a/Documentation/devicetree/bindings/usb/platform-ohci.txt 
b/Documentation/devicetree/bindings/usb/platform-ohci.txt
new file mode 100644
index 000..44bfa57
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/platform-ohci.txt


ohci-mmio might be a better name than platform maybe?


We already have platform-uhci too, and this matches the name of
the .c file so that people can actually correlate the 2.



[snip]


+static int ohci_platform_power_on(struct platform_device *dev)
+{
+   struct usb_hcd *hcd = platform_get_drvdata(dev);
+   struct ohci_platform_priv *priv =
+   (struct ohci_platform_priv *)hcd_to_ohci(hcd)->priv;
+   int clk, ret;
+
+   for (clk = 0; priv->clks[clk] && clk < OHCI_MAX_CLKS; clk++) {
+   ret = clk_prepare_enable(priv->clks[clk]);
+   if (ret)
+   goto err_disable_clks;
+   }


Do we really need to cap this to OHCI_MAX_CLKS, the next driver which
has 4 clocks will have to bump this, so maybe a linked-list would be
best?


I can make OHCI_MAX_CLKS 4 or 8 if that makes you happy, other then
that I greatly prefer to keep this KISS. Devices with 3 clks are already
quite rare, so its not like we're going to need to bump this every other
week a linked list where a simple array suffices is just overkill and
unnecessarily complicates things.




+
+   if (priv->phy) {
+   ret = phy_init(priv->phy);
+   if (ret)
+   goto err_disable_clks;
+
+   ret = phy_power_on(priv->phy);
+   if (ret)
+   goto err_exit_phy;
+   }


Although I do value the idea of having DT probing for ohci-platform,
ehci-platform et al, I am not sure if this really belongs in the
generic OHCI platform driver, or if we should rather have small glue
drivers which register the ohci-platform driver and which provides all
the platform-specific power_on, power_off, suspend callbacks to the
ohci platform driver? Such glue driver would be the one which gets
probed based off a specific compatible string a


This can already be done by having a platform driver with its own
compatible string providing platform data with the hooks. The whole idea
here is to avoid having to write such a glue driver for every other soc,
so cover the common simple case, and use glue drivers for more complicated
scenarios.


At first glance it does look like this covers 80% of the existing OHCI
drivers out there, so this is good. We might also want to support
clock pointers provided via platform_data so we can remove ohci-at91,
ohci-ep93xx, ohci-spear and friends in the future.


Lets first get the generic devicetree support merged as is, if after
that people want to extend it, so that (more) existing ohci drivers can
be removed, they are very much welcome to do so. Preferably people
with access to the hardware, so that they can actually test the changes.


ohci-ppc-of could also probably be removed once we add quirks and
endian properties parsing to ohci-platform?


Add-on patches extending my initial work are welcome. Again probably
best done by people who actually have access to the relevant hw.

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: [PATCH 05/10] usb: chipidea: add OTG fsm operation functions implemenation.

2014-01-09 Thread Marc Kleine-Budde
On 01/08/2014 10:06 AM, 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|   11 ++
>  drivers/usb/chipidea/otg_fsm.c |  311 
> 
>  drivers/usb/chipidea/otg_fsm.h |8 +
>  3 files changed, 330 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/usb/chipidea/bits.h b/drivers/usb/chipidea/bits.h
> index a857131..4347414 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_CCS BIT(0)
> +#define PORTSC_CSC BIT(1)
> +#define PORTSC_PEC BIT(3)
> +#define PORTSC_OCC BIT(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 */
> @@ -55,6 +60,9 @@
>  #define PORTSC_PTWBIT(28)
>  #define PORTSC_STSBIT(29)
>  
> +#define PORTSC_W1C_BITS  \
> + (PORTSC_CSC | PORTSC_PEC | PORTSC_OCC)
> +
>  /* DEVLC */
>  #define DEVLC_PSPD(0x03UL << 25)
>  #define DEVLC_PSPD_HS (0x02UL << 25)
> @@ -69,7 +77,10 @@
>  #define PTS_HSIC  4
>  
>  /* OTGSC */
> +#define OTGSC_VD   BIT(0)
> +#define OTGSC_VC   BIT(1)
>  #define OTGSC_IDPU BIT(5)
> +#define OTGSC_HADP BIT(6)
>  #define OTGSC_ID   BIT(8)
>  #define OTGSC_AVV  BIT(9)
>  #define OTGSC_ASV  BIT(10)
> diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c
> index 1f8907d..31a046d 100644
> --- a/drivers/usb/chipidea/otg_fsm.c
> +++ b/drivers/usb/chipidea/otg_fsm.c
> @@ -19,12 +19,322 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  #include "ci.h"
>  #include "bits.h"
>  #include "otg.h"
>  #include "otg_fsm.h"
>  
> +static struct list_head active_timers;
> +
> +#define HA_DATA_PULSE 1
> +
> +/* FSM timers */
> +struct ci_otg_fsm_timer *a_wait_vrise_tmr, *a_wait_vfall_tmr, 
> *a_wait_bcon_tmr,
> + *a_aidl_bdis_tmr, *a_bidl_adis_tmr, *b_ase0_brst_tmr,
> + *b_se0_srp_tmr, *b_srp_fail_tmr, *b_data_pulse_tmr;

IIRC the USB spec says there is only one OTG port per machine, but I
think you shouldn't add new code that uses so many global variables,
better embed these into a per device struct.

Marc

-- 
Pengutronix e.K.  | Marc Kleine-Budde   |
Industrial Linux Solutions| Phone: +49-231-2826-924 |
Vertretung West/Dortmund  | Fax:   +49-5121-206917- |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |



signature.asc
Description: OpenPGP digital signature


Re: [PATCH] USB: chipidea: fix up coding style issues

2014-01-09 Thread Rahul Bedarkar
On Thu, Jan 9, 2014 at 4:38 AM, Greg Kroah-Hartman
 wrote:
> On Wed, Jan 08, 2014 at 10:04:04PM +0530, Rahul Bedarkar wrote:
>>
>> Signed-off-by: Rahul Bedarkar 
>> ---
>>  drivers/usb/chipidea/ci_hdrc_imx.c | 3 ++-
>>  drivers/usb/chipidea/core.c| 9 +
>>  drivers/usb/chipidea/host.c| 3 ++-
>>  drivers/usb/chipidea/udc.c | 9 ++---
>>  4 files changed, 15 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c 
>> b/drivers/usb/chipidea/ci_hdrc_imx.c
>> index bb5d976..4573cb9 100644
>> --- a/drivers/usb/chipidea/ci_hdrc_imx.c
>> +++ b/drivers/usb/chipidea/ci_hdrc_imx.c
>> @@ -53,7 +53,8 @@ static struct imx_usbmisc_data 
>> *usbmisc_get_init_data(struct device *dev)
>>   ret = of_parse_phandle_with_args(np, "fsl,usbmisc", "#index-cells",
>>   0, &args);
>>   if (ret) {
>> - dev_err(dev, "Failed to parse property fsl,usbmisc, errno 
>> %d\n",
>> + dev_err(dev,
>> + "Failed to parse property fsl,usbmisc, errno %d\n",
>
> Why did you make this change?  It's ok to use the 80th column.

cleanfile script reported line exceeds 79 characters. I was not sure
if it is ok to use the 80th column.

thanks,
Rahul

>
> thanks,
>
> 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] USB: c67x00: fix up line break coding style issues

2014-01-09 Thread Rahul Bedarkar
On Thu, Jan 9, 2014 at 4:35 AM, Greg Kroah-Hartman
 wrote:
> On Wed, Jan 08, 2014 at 10:01:54PM +0530, Rahul Bedarkar wrote:
>>
>> Signed-off-by: Rahul Bedarkar 
>> ---
>>  drivers/usb/c67x00/c67x00-drv.c|  3 ++-
>>  drivers/usb/c67x00/c67x00-hcd.h|  2 +-
>>  drivers/usb/c67x00/c67x00-ll-hpi.c | 21 +-
>>  drivers/usb/c67x00/c67x00-sched.c  | 44 
>> --
>>  drivers/usb/c67x00/c67x00.h|  4 ++--
>>  5 files changed, 39 insertions(+), 35 deletions(-)
>
> Why are these changes made?  checkpatch doesn't seem to complain to
> require these, so what am I missing?
cleanfile script reported line exceeds 79 characters.

thanks,
Rahul
>
> thanks,
>
> 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: BUG: usb: obex in g_nokia.ko causing kernel panic

2014-01-09 Thread Pali Rohár
On Wednesday 27 November 2013 18:39:04 Felipe Balbi wrote:
> Hi,
> 
> On Wed, Nov 27, 2013 at 05:40:42PM +0100, Pali Rohár wrote:
> > > > > > @@ -282,10 +284,12 @@ static void
> > > > > > obex_disconnect(struct gserial *g) if
> > > > > > (!obex->can_activate)
> > > > > > 
> > > > > > return;
> > > > > > 
> > > > > > +#if 0
> > > > > > 
> > > > > > status = usb_function_deactivate(&g->func);
> > > > > > if (status)
> > > > > > 
> > > > > > DBG(cdev, "obex ttyGS%d function deactivate -->
> > > > > > %d\n",
> > > > > > 
> > > > > > obex->port_num, status);
> > > > > > 
> > > > > > +#endif
> > > > > > 
> > > > > >  }
> > > > > >  
> > > > > >  /*-
> > > > > >   --
> > > > > > 
> > > > > > --*/ @@ -372,6 +376,7 @@ static int
> > > > > > obex_bind(struct usb_configuration *c, struct
> > > > > > usb_function *f) if (status)
> > > > > > 
> > > > > > goto fail;
> > > > > > 
> > > > > > +#if 0
> > > > > > 
> > > > > > /* Avoid letting this gadget enumerate until the
> > > > > > userspace
> > > > > > 
> > > > > >  * OBEX server is active.
> > > > > >  */
> > > > > > 
> > > > > > @@ -381,6 +386,7 @@ static int obex_bind(struct
> > > > > > usb_configuration *c, struct usb_function *f)
> > > > > > obex->port_num, status);
> > > > > > 
> > > > > > else
> > > > > > 
> > > > > > obex->can_activate = true;
> > > > > > 
> > > > > > +#endif
> > > > > > 
> > > > > > DBG(cdev, "obex ttyGS%d: %s speed IN/%s OUT/%s\n",
> > > > > 
> > > > > Hi, with above patch g_nokia.ko working and not
> > > > > crashing.
> > > > 
> > > > yeah, makes sense. We shouldn't call phy operations in
> > > > atomic context. I'll see how easy it would be to fix
> > > > that. Real patch coming soon(-ish).
> > > 
> > > I think we could send diff below for the -rc cycle and
> > > figure out a better to handle this for the merge window.
> > > Can you check if it also works with patch below ?
> > > 
> > > diff --git a/drivers/usb/musb/omap2430.c
> > > b/drivers/usb/musb/omap2430.c index 2a408cd..8aa59a2
> > > 100644 --- a/drivers/usb/musb/omap2430.c
> > > +++ b/drivers/usb/musb/omap2430.c
> > > @@ -659,7 +659,6 @@ static int
> > > omap2430_runtime_suspend(struct device *dev)
> > > OTG_INTERFSEL);
> > > 
> > >   omap2430_low_level_exit(musb);
> > > 
> > > - phy_power_off(musb->phy);
> > > 
> > >   }
> > >   
> > >   return 0;
> > > 
> > > @@ -674,7 +673,6 @@ static int
> > > omap2430_runtime_resume(struct device *dev)
> > > omap2430_low_level_init(musb);
> > > 
> > >   musb_writel(musb->mregs, OTG_INTERFSEL,
> > >   
> > >   musb->context.otg_interfsel);
> > > 
> > > - phy_power_on(musb->phy);
> > > 
> > >   }
> > >   
> > >   return 0;
> > 
> > Hi, I applied similar patch (commented usb_phy_set_suspend
> > instead phy_power_on/off) on 3.12-rc5 and it working too, no
> > crash. I do not have rebased n900 patches on top of 3.13
> > tree, so I cannot check it. But I think phy_power_on/off
> > doing same as usb_phy_set_suspend in 3.12.
> 
> cool, I'll send this during the -rc and Cc stable, then I'll
> manually backport it to stable later.

PING!

I still do not see this patch in linus tree. What happened?

-- 
Pali Rohár
pali.ro...@gmail.com


signature.asc
Description: This is a digitally signed message part.


Re: [PATCH] USB: chipidea: fix up coding style issues

2014-01-09 Thread Greg Kroah-Hartman
On Thu, Jan 09, 2014 at 07:40:46PM +0530, Rahul Bedarkar wrote:
> On Thu, Jan 9, 2014 at 4:38 AM, Greg Kroah-Hartman
>  wrote:
> > On Wed, Jan 08, 2014 at 10:04:04PM +0530, Rahul Bedarkar wrote:
> >>
> >> Signed-off-by: Rahul Bedarkar 
> >> ---
> >>  drivers/usb/chipidea/ci_hdrc_imx.c | 3 ++-
> >>  drivers/usb/chipidea/core.c| 9 +
> >>  drivers/usb/chipidea/host.c| 3 ++-
> >>  drivers/usb/chipidea/udc.c | 9 ++---
> >>  4 files changed, 15 insertions(+), 9 deletions(-)
> >>
> >> diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c 
> >> b/drivers/usb/chipidea/ci_hdrc_imx.c
> >> index bb5d976..4573cb9 100644
> >> --- a/drivers/usb/chipidea/ci_hdrc_imx.c
> >> +++ b/drivers/usb/chipidea/ci_hdrc_imx.c
> >> @@ -53,7 +53,8 @@ static struct imx_usbmisc_data 
> >> *usbmisc_get_init_data(struct device *dev)
> >>   ret = of_parse_phandle_with_args(np, "fsl,usbmisc", "#index-cells",
> >>   0, &args);
> >>   if (ret) {
> >> - dev_err(dev, "Failed to parse property fsl,usbmisc, errno 
> >> %d\n",
> >> + dev_err(dev,
> >> + "Failed to parse property fsl,usbmisc, errno %d\n",
> >
> > Why did you make this change?  It's ok to use the 80th column.
> 
> cleanfile script reported line exceeds 79 characters. I was not sure
> if it is ok to use the 80th column.

What is "cleanfile"?  checkpatch.pl sure doesn't complain about it, so
please don't "fix" something that's not needed.

thanks,

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 3.12 033/118] usb: xhci: Link TRB must not occur within a USB payload burst

2014-01-09 Thread walt
On 01/09/2014 02:05 AM, David Laight wrote:
>> From: walt
> ...
>> I'm still wondering if I'm suffering from hardware quirks.  From the
>> first day I installed my usb3 adapter card and the usb3 disk docking
>> station I've noticed some quirky behavior.
> 
> Ah - this isn't an 'on chip' usb3 adapter.
> Some kind of PCIe card ?

This one:

http://www.sabrent.com/category/controller-cards/PCIX-USB3/
 

--
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/2] xhci: Avoid infinite loop when sg urb requires too many trbs

2014-01-09 Thread Alan Stern
On Thu, 9 Jan 2014, David Laight wrote:

> > From: Sarah Sharp
> > Currently prepare_ring() returns -ENOMEM if the urb won't fit into a
> > single ring segment.  usb_sg_wait() treats this error as a temporary
> > condition and will keep retrying until something else goes wrong.
> 
> Even if it were a temporary condition then an immediate retry
> is rather pointless.
> Retry after a slight delay might make some sense.

There is a yield().  It could be changed to something longer.

> Of course, if this is the pagedaemon trying to write out
> pages in order to generate some free kernel memory all is lost
> as soon as the usb subsystem need to allocate memory in order
> to perform a transfer.

That never happens, because all memory allocation requests on the 
storage I/O pathway are done using GFP_NOIO.

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 1/2] xhci: Avoid infinite loop when sg urb requires too many trbs

2014-01-09 Thread David Laight
From: Alan Stern
> On Thu, 9 Jan 2014, David Laight wrote:
> 
> > > From: Sarah Sharp
> > > Currently prepare_ring() returns -ENOMEM if the urb won't fit into a
> > > single ring segment.  usb_sg_wait() treats this error as a temporary
> > > condition and will keep retrying until something else goes wrong.
> >
> > Even if it were a temporary condition then an immediate retry
> > is rather pointless.
> > Retry after a slight delay might make some sense.
> 
> There is a yield().  It could be changed to something longer.

Will yield allow low priority processes to run?
 
> > Of course, if this is the pagedaemon trying to write out
> > pages in order to generate some free kernel memory all is lost
> > as soon as the usb subsystem need to allocate memory in order
> > to perform a transfer.
> 
> That never happens, because all memory allocation requests on the
> storage I/O pathway are done using GFP_NOIO.

Picking hairs - not the ones in the xhci driver if, for example,
it has to extend the rings.

David



--
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/2] ehci-platform: Add support for clks and phy passed through devicetree

2014-01-09 Thread Alan Stern
On Thu, 9 Jan 2014, Hans de Goede wrote:

> >> +Optional properties:
> >> +- clocks : a list of phandle + clock specifier pairs, one for each entry
> >> +   in clock-names.
> >> +- clock-names : "clk0", "clk1", ...
> >> +- phys : phy
> >> +- phy-names : "phy0"
> >> +
> >> +Example:
> >> +
> >> +  ehci@d8007900 {
> >> +  compatible = "via,vt8500-ehci";
> >> +  reg = <0xd8007900 0x200>;
> >> +  interrupts = <43>;
> >> +  clocks = <&usb_clk 6>, <&ahb_gates 2>;
> >> +  clock-names = "clk0", "clk1";
> >
> > I'm really not convinced by this either. It prevents you from doing
> > anything useful out of these clocks, and the only thing you can
> > actually do with it is calling clk_get, and that's pretty much it.
> >
> > What if you some platform needs to adjust the rate of one of the two?
> 
> Then it needs its own driver. This is intended as a binding for a
> *generic* driver, which is meant to cover simple straight forward
> non-pci ohci cases. For more complex cases a separate driver will
> need to be written.
> 
> I must say I'm becoming a bit unhappy with how the reviews of devicetree
> bindings are being done. In one case it is not generic enough (ahci-sunxi).
> 
> If I then try to make it more generic in a case where that can actually
> be done as the hardware is pretty straight forward, it is not specific enough.
> You can simply not have both!
> 
> > Or wants to cut one but not the other for any reason?
> 
> This is another example of non generic behavior, requiring a separate
> (small using the existing ohci core) platform glue driver, like the *19* we
> already have.

Would DT allow ehci-platform.c to access the clocks by their index in
the array, rather than by name?  After all, you don't really care about
the names at all, since the driver knows nothing about the clocks' 
functions.

The same is true of the phy entry.

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 1/2] xhci: Avoid infinite loop when sg urb requires too many trbs

2014-01-09 Thread Alan Stern
On Thu, 9 Jan 2014, David Laight wrote:

> From: Alan Stern
> > On Thu, 9 Jan 2014, David Laight wrote:
> > 
> > > > From: Sarah Sharp
> > > > Currently prepare_ring() returns -ENOMEM if the urb won't fit into a
> > > > single ring segment.  usb_sg_wait() treats this error as a temporary
> > > > condition and will keep retrying until something else goes wrong.
> > >
> > > Even if it were a temporary condition then an immediate retry
> > > is rather pointless.
> > > Retry after a slight delay might make some sense.
> > 
> > There is a yield().  It could be changed to something longer.
> 
> Will yield allow low priority processes to run?

No (depending to some extent on the scheduler).

> > > Of course, if this is the pagedaemon trying to write out
> > > pages in order to generate some free kernel memory all is lost
> > > as soon as the usb subsystem need to allocate memory in order
> > > to perform a transfer.
> > 
> > That never happens, because all memory allocation requests on the
> > storage I/O pathway are done using GFP_NOIO.
> 
> Picking hairs - not the ones in the xhci driver if, for example,
> it has to extend the rings.

If that is true, it is a bug in xhci-hcd.

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] staging: usbip: userspace: add support for viewing imported devices

2014-01-09 Thread Greg KH
On Tue, Jan 07, 2014 at 09:05:56PM +0200, Valentina Manea wrote:
> As of Matt Mooney's major refactoring in 2011, usbip port
> option was left out. Add support for this option in
> a manner similar to the old implementation.
> 
> Sample output:
> 
> Imported USB devices
> 
> Port 00:  at Full Speed(12Mbps)
>unknown vendor : unknown product (1687:6211)
>2-1 -> usbip://192.168.122.152:3240/1-1
>-> remote bus/dev 001/002
> 
> Signed-off-by: Valentina Manea 
> Reviewed-by: Ilija Hadzic 

This is a resend of v3, right?  Please be more specific when sending
multiple versions of a patch so that I know which one I should take.

> Resubmitting this patch as I still didn't get any reply from Greg
> after 2 weeks.

Greg was on vacation for 2 weeks :)

thanks,

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: USB-modem not working correctly

2014-01-09 Thread Linus Gasser

Le 09/01/14 14:27, Bjørn Mork a écrit :

Linus Gasser  writes:


I'm trying to get an USB-modem running on a Smileplug, which is some
Arm7-device, using it with the kernel 3.12-6. As far as I can tell
it's an USB3-port. It works well with harddisks, but when I plug in
USB-modems, it always fails sooner or later.


Do you have this problem with different modems?
You could try a powered hub to eliminate any power related problems.
But if the port can power a harddisk spinning up, then I guess it should
handle the 3G modem power spikes too.  Anyway, a hub is a cheap and
simple test.


I tried again - one modem seems to work fine, while the other quits with 
a lot of


Jan 09 18:02:58 Profeda-new kernel: option1 ttyUSB0: 
option_instat_callback: error -71


But it doesn't disconnect! They also run in an ethernet-mode (using 
cdc_ether), I'll also try that one (but it lacks some functions I need, 
like sending USSD-codes).


So if you have some debugging advice, I'd like to do it...

Linus
--
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: [linux-sunxi] Re: [PATCH v2 2/2] ehci-platform: Add support for clks and phy passed through devicetree

2014-01-09 Thread Hans de Goede

Hi,

On 01/09/2014 04:47 PM, Alan Stern wrote:

On Thu, 9 Jan 2014, Hans de Goede wrote:


+Optional properties:
+- clocks : a list of phandle + clock specifier pairs, one for each entry
+   in clock-names.
+- clock-names : "clk0", "clk1", ...
+- phys : phy
+- phy-names : "phy0"
+
+Example:
+
+   ehci@d8007900 {
+   compatible = "via,vt8500-ehci";
+   reg = <0xd8007900 0x200>;
+   interrupts = <43>;
+   clocks = <&usb_clk 6>, <&ahb_gates 2>;
+   clock-names = "clk0", "clk1";


I'm really not convinced by this either. It prevents you from doing
anything useful out of these clocks, and the only thing you can
actually do with it is calling clk_get, and that's pretty much it.

What if you some platform needs to adjust the rate of one of the two?


Then it needs its own driver. This is intended as a binding for a
*generic* driver, which is meant to cover simple straight forward
non-pci ohci cases. For more complex cases a separate driver will
need to be written.

I must say I'm becoming a bit unhappy with how the reviews of devicetree
bindings are being done. In one case it is not generic enough (ahci-sunxi).

If I then try to make it more generic in a case where that can actually
be done as the hardware is pretty straight forward, it is not specific enough.
You can simply not have both!


Or wants to cut one but not the other for any reason?


This is another example of non generic behavior, requiring a separate
(small using the existing ohci core) platform glue driver, like the *19* we
already have.


Would DT allow ehci-platform.c to access the clocks by their index in
the array, rather than by name?  After all, you don't really care about
the names at all, since the driver knows nothing about the clocks'
functions.


Yes, actually I've been discussing this with Maxime on irc and I'm
just done preparing a v3 doing exactly that. I was just checking mail
for any more review comments before pushing out v3 :)


The same is true of the phy entry.


The phy entry must have a name, this is specified in the phy bindings
in Documentation/devicetree/bindings/phy/phy-bindings.txt:

"""
PHY user node
=

Required Properties:
phys : the phandle for the PHY device (used by the PHY subsystem)
phy-names : the names of the PHY corresponding to the PHYs present in the
*phys* phandle
"""

Now that I've dropped the clock-names, I've changed the ugly "phy0" name
to "usb" as the phy pointed to is supposed to be an usb phy.

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


[PATCH v3 0/2] ohci and ehci-platform clks, phy and dt support

2014-01-09 Thread Hans de Goede
Hi All,

Here is v3 of my ohci and ehci-platform clks, phy and dt support patch-set.

This version is mostly the result of some discussions on irc with Maxime to
improve the dt-bindings. This has resulted in 2 changes:

1) Drop the clock-names from the dt-bindings, instead get clocks by index.

Since the intend is to be a generic ohci / ehci driver, the code does not
give any special meaning to any of the clocks, so simply just get as many
clocks as there are by index.

2) Change the compatible string to "mmio-ohci" resp. "mmio-ehci"

v2 was using allwinner,sun4i-ohci as compat string to avoid having to come
up with a generic name, but in retrospect this is the wrong thing to do. This
will likely lead to dts files for non allwinner boards using compatible =
"allwinner,sun4i-ohci", and if we then ever need to do some allwinner specific
quirks, these boards end up getting these quirks applied too.

dts files should use the generic mmio-ehci compatible as least prefered option,
ie: compatible = "allwinner,sun7i-a20-ehci", "mmio-ehci";

This will allow use of the generic driver while leaving the option open to
later add soc specific quirks without needing dt changes.

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


[PATCH v3 2/2] ehci-platform: Add support for clks and phy passed through devicetree

2014-01-09 Thread Hans de Goede
Currently ehci-platform is only used in combination with devicetree when used
with some Via socs. By extending it to (optionally) get clks and a phy from
devicetree, and enabling / disabling those on power_on / off, it can be used
more generically. Specifically after this commit it can be used for the
ehci controller on Allwinner sunxi SoCs.

Somehow we've ended up with 2 device-bindings documents for ehci-platform.c,
this patch renames and updates one to mmio-ehci.txt to reflect that this
is a generic ehci driver, and removes the other.

Signed-off-by: Hans de Goede 
---
 .../devicetree/bindings/usb/mmio-ehci.txt  |  22 
 .../devicetree/bindings/usb/via,vt8500-ehci.txt|  15 ---
 .../devicetree/bindings/usb/vt8500-ehci.txt|  12 --
 drivers/usb/host/ehci-platform.c   | 129 +
 4 files changed, 131 insertions(+), 47 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/mmio-ehci.txt
 delete mode 100644 Documentation/devicetree/bindings/usb/via,vt8500-ehci.txt
 delete mode 100644 Documentation/devicetree/bindings/usb/vt8500-ehci.txt

diff --git a/Documentation/devicetree/bindings/usb/mmio-ehci.txt 
b/Documentation/devicetree/bindings/usb/mmio-ehci.txt
new file mode 100644
index 000..bc0f967
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/mmio-ehci.txt
@@ -0,0 +1,22 @@
+Generic MMIO EHCI controller
+
+Required properties:
+- compatible : "via,vt8500-ehci", "wm,prizm-ehci", or "mmio-ehci"
+- reg : ehci controller register range (address and length)
+- interrupts : ehci controller interrupt
+
+Optional properties:
+- clocks : a list of phandle + clock specifier pairs
+- phys : phandle + phy specifier pair
+- phy-names : "usb"
+
+Example:
+
+   ehci@d8007900 {
+   compatible = "via,vt8500-ehci", "mmio-ehci";
+   reg = <0xd8007900 0x200>;
+   interrupts = <43>;
+   clocks = <&usb_clk 6>, <&ahb_gates 2>;
+   phys = <&usbphy 1>;
+   phy-names = "usb";
+   };
diff --git a/Documentation/devicetree/bindings/usb/via,vt8500-ehci.txt 
b/Documentation/devicetree/bindings/usb/via,vt8500-ehci.txt
deleted file mode 100644
index 17b3ad1..000
--- a/Documentation/devicetree/bindings/usb/via,vt8500-ehci.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-VIA/Wondermedia VT8500 EHCI Controller
--
-
-Required properties:
-- compatible : "via,vt8500-ehci"
-- reg : Should contain 1 register ranges(address and length)
-- interrupts : ehci controller interrupt
-
-Example:
-
-   ehci@d8007900 {
-   compatible = "via,vt8500-ehci";
-   reg = <0xd8007900 0x200>;
-   interrupts = <43>;
-   };
diff --git a/Documentation/devicetree/bindings/usb/vt8500-ehci.txt 
b/Documentation/devicetree/bindings/usb/vt8500-ehci.txt
deleted file mode 100644
index 5fb8fd6..000
--- a/Documentation/devicetree/bindings/usb/vt8500-ehci.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-VIA VT8500 and Wondermedia WM8xxx SoC USB controllers.
-
-Required properties:
- - compatible: Should be "via,vt8500-ehci" or "wm,prizm-ehci".
- - reg: Address range of the ehci registers. size should be 0x200
- - interrupts: Should contain the ehci interrupt.
-
-usb: ehci@D8007100 {
-   compatible = "wm,prizm-ehci", "usb-ehci";
-   reg = <0xD8007100 0x200>;
-   interrupts = <1>;
-};
diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c
index 7f30b71..c7adcf5 100644
--- a/drivers/usb/host/ehci-platform.c
+++ b/drivers/usb/host/ehci-platform.c
@@ -3,6 +3,7 @@
  *
  * Copyright 2007 Steven Brown 
  * Copyright 2010-2012 Hauke Mehrtens 
+ * Copyright 2014 Hans de Goede 
  *
  * Derived from the ohci-ssb driver
  * Copyright 2007 Michael Buesch 
@@ -18,6 +19,7 @@
  *
  * Licensed under the GNU/GPL. See COPYING for details.
  */
+#include 
 #include 
 #include 
 #include 
@@ -25,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -34,6 +37,12 @@
 
 #define DRIVER_DESC "EHCI generic platform driver"
 
+#define EHCI_MAX_CLKS 3
+struct ehci_platform_priv {
+   struct clk *clks[EHCI_MAX_CLKS];
+   struct phy *phy;
+};
+
 static const char hcd_name[] = "ehci-platform";
 
 static int ehci_platform_reset(struct usb_hcd *hcd)
@@ -64,28 +73,84 @@ static int ehci_platform_reset(struct usb_hcd *hcd)
return 0;
 }
 
+static int ehci_platform_power_on(struct platform_device *dev)
+{
+   struct usb_hcd *hcd = platform_get_drvdata(dev);
+   struct ehci_platform_priv *priv =
+   (struct ehci_platform_priv *)hcd_to_ehci(hcd)->priv;
+   int clk, ret;
+
+   for (clk = 0; priv->clks[clk] && clk < EHCI_MAX_CLKS; clk++) {
+   ret = clk_prepare_enable(priv->clks[clk]);
+   if (ret)
+   goto err_disable_clks;
+   }
+
+   if (priv->phy) {
+   ret = phy_init(priv->phy);
+   if (ret

Re: [PATCH v3 1/2] ohci-platform: Add support for devicetree instantiation

2014-01-09 Thread Arnd Bergmann
On Thursday 09 January 2014 18:57:05 Hans de Goede wrote:
> +   if (pdata == &ohci_platform_defaults && dev->dev.of_node) {
> +   priv->phy = devm_phy_get(&dev->dev, "usb");
> +   if (IS_ERR(priv->phy)) {
> +   err = PTR_ERR(priv->phy);
> +   if (err == -EPROBE_DEFER)
> +   goto err_put_hcd;
> +   priv->phy = NULL;
> +   }
> +
> +   for (clk = 0; clk < OHCI_MAX_CLKS; clk++) {
> +   priv->clks[clk] = of_clk_get(dev->dev.of_node, clk);
> +   if (IS_ERR(priv->clks[clk])) {
> +   err = PTR_ERR(priv->clks[clk]);
> +   if (err == -EPROBE_DEFER)
> +   goto err_put_clks;
> +   priv->clks[clk] = NULL;
> +   break;
> +   }
> +   }
> +   }

Ah, very nice! This way it will actually work to replace a number
of older drivers that require a specific clock name.

I still think we should change the phy subsystem to allow the
same, that would make it more consistent here, and avoid the
need for coming up with a number of bogus phy names for random
drivers that can only ever have one phy.

Arnd
--
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/2] ohci-platform: Add support for devicetree instantiation

2014-01-09 Thread Hans de Goede
Add support for ohci-platform instantiation from devicetree, including
optionally getting clks and a phy from devicetree, and enabling / disabling
those on power_on / off.

This should allow using ohci-platform from devicetree in various cases.
Specifically after this commit it can be used for the ohci controller found
on Allwinner sunxi SoCs.

Signed-off-by: Hans de Goede 
---
 .../devicetree/bindings/usb/mmio-ohci.txt  |  22 +++
 drivers/usb/host/ohci-platform.c   | 150 ++---
 2 files changed, 152 insertions(+), 20 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/mmio-ohci.txt

diff --git a/Documentation/devicetree/bindings/usb/mmio-ohci.txt 
b/Documentation/devicetree/bindings/usb/mmio-ohci.txt
new file mode 100644
index 000..9c776ed
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/mmio-ohci.txt
@@ -0,0 +1,22 @@
+Generic MMIO OHCI controller
+
+Required properties:
+- compatible : "mmio-ohci"
+- reg : ohci controller register range (address and length)
+- interrupts : ohci controller interrupt
+
+Optional properties:
+- clocks : a list of phandle + clock specifier pairs
+- phys : phandle + phy specifier pair
+- phy-names : "usb"
+
+Example:
+
+   ohci0: ohci@0x01c14400 {
+   compatible = "mmio-ohci";
+   reg = <0x01c14400 0x100>;
+   interrupts = <64>;
+   clocks = <&usb_clk 6>, <&ahb_gates 2>;
+   phys = <&usbphy 1>;
+   phy-names = "usb";
+   };
diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
index f351ff5..a46d7ac 100644
--- a/drivers/usb/host/ohci-platform.c
+++ b/drivers/usb/host/ohci-platform.c
@@ -3,6 +3,7 @@
  *
  * Copyright 2007 Michael Buesch 
  * Copyright 2011-2012 Hauke Mehrtens 
+ * Copyright 2014 Hans de Goede 
  *
  * Derived from the OCHI-SSB driver
  * Derived from the OHCI-PCI driver
@@ -14,11 +15,14 @@
  * Licensed under the GNU/GPL. See COPYING for details.
  */
 
+#include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -28,6 +32,12 @@
 
 #define DRIVER_DESC "OHCI generic platform driver"
 
+#define OHCI_MAX_CLKS 3
+struct ohci_platform_priv {
+   struct clk *clks[OHCI_MAX_CLKS];
+   struct phy *phy;
+};
+
 static const char hcd_name[] = "ohci-platform";
 
 static int ohci_platform_reset(struct usb_hcd *hcd)
@@ -48,11 +58,69 @@ static int ohci_platform_reset(struct usb_hcd *hcd)
return ohci_setup(hcd);
 }
 
+static int ohci_platform_power_on(struct platform_device *dev)
+{
+   struct usb_hcd *hcd = platform_get_drvdata(dev);
+   struct ohci_platform_priv *priv =
+   (struct ohci_platform_priv *)hcd_to_ohci(hcd)->priv;
+   int clk, ret;
+
+   for (clk = 0; priv->clks[clk] && clk < OHCI_MAX_CLKS; clk++) {
+   ret = clk_prepare_enable(priv->clks[clk]);
+   if (ret)
+   goto err_disable_clks;
+   }
+
+   if (priv->phy) {
+   ret = phy_init(priv->phy);
+   if (ret)
+   goto err_disable_clks;
+
+   ret = phy_power_on(priv->phy);
+   if (ret)
+   goto err_exit_phy;
+   }
+
+   return 0;
+
+err_exit_phy:
+   phy_exit(priv->phy);
+err_disable_clks:
+   while (--clk >= 0)
+   clk_disable_unprepare(priv->clks[clk]);
+
+   return ret;
+}
+
+static void ohci_platform_power_off(struct platform_device *dev)
+{
+   struct usb_hcd *hcd = platform_get_drvdata(dev);
+   struct ohci_platform_priv *priv =
+   (struct ohci_platform_priv *)hcd_to_ohci(hcd)->priv;
+   int clk;
+
+   if (priv->phy) {
+   phy_power_off(priv->phy);
+   phy_exit(priv->phy);
+   }
+
+   for (clk = OHCI_MAX_CLKS - 1; clk >= 0; clk--)
+   if (priv->clks[clk])
+   clk_disable_unprepare(priv->clks[clk]);
+}
+
 static struct hc_driver __read_mostly ohci_platform_hc_driver;
 
 static const struct ohci_driver_overrides platform_overrides __initconst = {
-   .product_desc = "Generic Platform OHCI controller",
-   .reset =ohci_platform_reset,
+   .product_desc = "Generic Platform OHCI controller",
+   .reset =ohci_platform_reset,
+   .extra_priv_size =  sizeof(struct ohci_platform_priv),
+};
+
+static struct usb_ohci_pdata ohci_platform_defaults = {
+   .power_on = ohci_platform_power_on,
+   .power_suspend =ohci_platform_power_off,
+   .power_off =ohci_platform_power_off,
 };
 
 static int ohci_platform_probe(struct platform_device *dev)
@@ -60,12 +128,24 @@ static int ohci_platform_probe(struct platform_device *dev)
struct usb_hcd *hcd;
struct resource *res_mem;
struct usb_ohci_pdata *pdata = dev_get_platdata(&dev->dev);
-   int irq;
-   int err = -ENO

Re: [PATCH 1/2] xhci: Avoid infinite loop when sg urb requires too many trbs

2014-01-09 Thread Sarah Sharp
On Thu, Jan 09, 2014 at 10:56:44AM -0500, Alan Stern wrote:
> On Thu, 9 Jan 2014, David Laight wrote:
> 
> > From: Alan Stern
> > > On Thu, 9 Jan 2014, David Laight wrote:
> > > 
> > > > > From: Sarah Sharp
> > > > > Currently prepare_ring() returns -ENOMEM if the urb won't fit into a
> > > > > single ring segment.  usb_sg_wait() treats this error as a temporary
> > > > > condition and will keep retrying until something else goes wrong.
> > > >
> > > > Even if it were a temporary condition then an immediate retry
> > > > is rather pointless.
> > > > Retry after a slight delay might make some sense.
> > > 
> > > There is a yield().  It could be changed to something longer.
> > 
> > Will yield allow low priority processes to run?
> 
> No (depending to some extent on the scheduler).
> 
> > > > Of course, if this is the pagedaemon trying to write out
> > > > pages in order to generate some free kernel memory all is lost
> > > > as soon as the usb subsystem need to allocate memory in order
> > > > to perform a transfer.
> > > 
> > > That never happens, because all memory allocation requests on the
> > > storage I/O pathway are done using GFP_NOIO.
> > 
> > Picking hairs - not the ones in the xhci driver if, for example,
> > it has to extend the rings.
> 
> If that is true, it is a bug in xhci-hcd.

The xHCI driver passes down GFP_ATOMIC to the URB queueing mechanisms,
since they're called while holding the xhci spinlock, and that will be
used in ring expansion.  I believe that's the correct memory flag.

Sarah Sharp
--
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] xhci_suspend optimized for hibernate

2014-01-09 Thread Oliver Neukum
On Tue, 2013-12-17 at 18:23 -0800, Todd E Brandt wrote:

> cleanup. On resume from suspend, the registers, pages, and dequeue
> pointers
> are restored. On hibernate, we also save state. However, xhci_suspend
> is
> called after the hibernate memory image is created, so any memory
> writes
> (e.g. to zero rings or save dequeue pointers) will be lost on resume.
> On
> resume from hibernate, we basically wipe out any changes in the host
> and
> driver, and re-initialize from scratch. So it's useless to save state
> when
> xhci_suspend is called as part of the hibernate state. - Sarah Sharp

Hi,

sorry for being late. To express the problem in a short sentence:
How do you make sure there's no error aborting the hibernation after
you've nuked the state of the HC?

Regards
Oliver


--
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/2] ohci-platform: Add support for devicetree instantiation

2014-01-09 Thread Hans de Goede

Hi,

On 01/09/2014 07:07 PM, Arnd Bergmann wrote:

On Thursday 09 January 2014 18:57:05 Hans de Goede wrote:

+   if (pdata == &ohci_platform_defaults && dev->dev.of_node) {
+   priv->phy = devm_phy_get(&dev->dev, "usb");
+   if (IS_ERR(priv->phy)) {
+   err = PTR_ERR(priv->phy);
+   if (err == -EPROBE_DEFER)
+   goto err_put_hcd;
+   priv->phy = NULL;
+   }
+
+   for (clk = 0; clk < OHCI_MAX_CLKS; clk++) {
+   priv->clks[clk] = of_clk_get(dev->dev.of_node, clk);
+   if (IS_ERR(priv->clks[clk])) {
+   err = PTR_ERR(priv->clks[clk]);
+   if (err == -EPROBE_DEFER)
+   goto err_put_clks;
+   priv->clks[clk] = NULL;
+   break;
+   }
+   }
+   }


Ah, very nice! This way it will actually work to replace a number
of older drivers that require a specific clock name.


I'm glad you like it.


I still think we should change the phy subsystem to allow the
same, that would make it more consistent here, and avoid the
need for coming up with a number of bogus phy names for random
drivers that can only ever have one phy.


I'm not disagreeing, but that will have to be a battle for
another day. Currently the dt-bindings for phy actually
make phy-names mandatory at the bindings-description level, so
someone would first need to change the specification.

Documentation/devicetree/bindings/phy/phy-bindings.txt:

"""
PHY user node
=

Required Properties:
phys : the phandle for the PHY device (used by the PHY subsystem)
phy-names : the names of the PHY corresponding to the PHYs present in the
*phys* phandle
"""

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: [PATCH] usb: Skip U1/U2 LPM disable if device is disconnected.

2014-01-09 Thread Sarah Sharp
On Wed, Jan 08, 2014 at 09:20:41AM +, Venkatesh Murthy, HemanthX wrote:
> We tried pulling this commit to our tree, we still see below errors multiple 
> times.

That's expected.  The device disconnect causes the port to go into the
Inactive state and the host *must* handle that.

> Should hub_port_reset also be avoided in Inactive state.
> 
> 7>[  181.542976] hub 2-0:1.0: port 2 not reset yet, waiting 50ms
> <7>[  181.593907] hub 2-0:1.0: port 2 not reset yet, waiting 200ms
> <7>[  181.794881] hub 2-0:1.0: port 2 not reset yet, waiting 200ms
> <7>[  181.995826] hub 2-0:1.0: port 2 not reset yet, waiting 200ms
> <7>[  182.196746] hub 2-0:1.0: port 2 not reset yet, waiting 200ms
> <7>[  182.196766] hub 2-0:1.0: port_wait_reset: err = -16

No, it cannot be avoided.  The port will remain in the Inactive state
unless the USB core issues a warm port reset on the port.

Sarah Sharp
--
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/2] ohci-platform: Add support for devicetree instantiation

2014-01-09 Thread Sergei Shtylyov

Hello.

On 01/09/2014 08:57 PM, Hans de Goede wrote:


Add support for ohci-platform instantiation from devicetree, including
optionally getting clks and a phy from devicetree, and enabling / disabling
those on power_on / off.



This should allow using ohci-platform from devicetree in various cases.
Specifically after this commit it can be used for the ohci controller found
on Allwinner sunxi SoCs.



Signed-off-by: Hans de Goede 
---
  .../devicetree/bindings/usb/mmio-ohci.txt  |  22 +++
  drivers/usb/host/ohci-platform.c   | 150 ++---
  2 files changed, 152 insertions(+), 20 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/usb/mmio-ohci.txt



diff --git a/Documentation/devicetree/bindings/usb/mmio-ohci.txt 
b/Documentation/devicetree/bindings/usb/mmio-ohci.txt
new file mode 100644
index 000..9c776ed
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/mmio-ohci.txt
@@ -0,0 +1,22 @@
+Generic MMIO OHCI controller


   OHCI controller always uses MMIO, and likewise EHCI. You don't need to 
specifically mention it.



+
+Required properties:
+- compatible : "mmio-ohci"


   Likewise, it's not a good name. Why not call it "platform-ohci"?


+- reg : ohci controller register range (address and length)
+- interrupts : ohci controller interrupt
+
+Optional properties:
+- clocks : a list of phandle + clock specifier pairs
+- phys : phandle + phy specifier pair
+- phy-names : "usb"
+
+Example:
+
+   ohci0: ohci@0x01c14400 {
+   compatible = "mmio-ohci";
+   reg = <0x01c14400 0x100>;
+   interrupts = <64>;
+   clocks = <&usb_clk 6>, <&ahb_gates 2>;
+   phys = <&usbphy 1>;
+   phy-names = "usb";
+   };


WBR, Sergei

--
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/2] ohci-platform: Add support for devicetree instantiation

2014-01-09 Thread Hans de Goede

Hi,

On 01/09/2014 09:14 PM, Sergei Shtylyov wrote:

Hello.

On 01/09/2014 08:57 PM, Hans de Goede wrote:


Add support for ohci-platform instantiation from devicetree, including
optionally getting clks and a phy from devicetree, and enabling / disabling
those on power_on / off.



This should allow using ohci-platform from devicetree in various cases.
Specifically after this commit it can be used for the ohci controller found
on Allwinner sunxi SoCs.



Signed-off-by: Hans de Goede 
---
  .../devicetree/bindings/usb/mmio-ohci.txt  |  22 +++
  drivers/usb/host/ohci-platform.c   | 150 ++---
  2 files changed, 152 insertions(+), 20 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/usb/mmio-ohci.txt



diff --git a/Documentation/devicetree/bindings/usb/mmio-ohci.txt 
b/Documentation/devicetree/bindings/usb/mmio-ohci.txt
new file mode 100644
index 000..9c776ed
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/mmio-ohci.txt
@@ -0,0 +1,22 @@
+Generic MMIO OHCI controller


OHCI controller always uses MMIO, and likewise EHCI. You don't need to 
specifically mention it.


Right, I'm only using it here because it is also used in the compatible string.




+
+Required properties:
+- compatible : "mmio-ohci"


Likewise, it's not a good name. Why not call it "platform-ohci"?


Because, as you would have known had you read the entire thread, people objected
against exactly that name because the "platform" bus thing is a Linux invention,
and other operating systems don't use the platform nomenclature for non pci
busses.

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: [PATCH v3 1/2] ohci-platform: Add support for devicetree instantiation

2014-01-09 Thread Sergei Shtylyov

On 01/09/2014 10:48 PM, Hans de Goede wrote:

Hi,

On 01/09/2014 09:14 PM, Sergei Shtylyov wrote:

Hello.

On 01/09/2014 08:57 PM, Hans de Goede wrote:


Add support for ohci-platform instantiation from devicetree, including
optionally getting clks and a phy from devicetree, and enabling / disabling
those on power_on / off.



This should allow using ohci-platform from devicetree in various cases.
Specifically after this commit it can be used for the ohci controller found
on Allwinner sunxi SoCs.



Signed-off-by: Hans de Goede 
---
  .../devicetree/bindings/usb/mmio-ohci.txt  |  22 +++
  drivers/usb/host/ohci-platform.c   | 150
++---
  2 files changed, 152 insertions(+), 20 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/usb/mmio-ohci.txt



diff --git a/Documentation/devicetree/bindings/usb/mmio-ohci.txt
b/Documentation/devicetree/bindings/usb/mmio-ohci.txt
new file mode 100644
index 000..9c776ed
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/mmio-ohci.txt
@@ -0,0 +1,22 @@
+Generic MMIO OHCI controller



OHCI controller always uses MMIO, and likewise EHCI. You don't need to
specifically mention it.



Right, I'm only using it here because it is also used in the compatible string.


   Please drop it.


+
+Required properties:
+- compatible : "mmio-ohci"



Likewise, it's not a good name. Why not call it "platform-ohci"?



Because, as you would have known had you read the entire thread, people objected
against exactly that name because the "platform" bus thing is a Linux invention,
and other operating systems don't use the platform nomenclature for non pci
busses.


   I wonder where were all those people when "xhci-platform" compatible got 
adopted in drivers/usb/host/xhci-plat.c? :-P


   Anyway, I want to suggest "usb-[eo]hci" of which "usb-ehci" binding has 
even already documented in Documentation/devicetree/bindings/usb/usb-ehci.txt.
Both these "compatible" values are used as backups in the multiple described 
bindings of the platform-specific [EO]HCI controllers. I really don't see why 
you should invent anything new (and so poorly named).



Regards,



Hans


WBR, Sergei

--
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/2] ohci-platform: Add support for devicetree instantiation

2014-01-09 Thread Alan Stern
On Thu, 9 Jan 2014, Hans de Goede wrote:

> Add support for ohci-platform instantiation from devicetree, including
> optionally getting clks and a phy from devicetree, and enabling / disabling
> those on power_on / off.
> 
> This should allow using ohci-platform from devicetree in various cases.
> Specifically after this commit it can be used for the ohci controller found
> on Allwinner sunxi SoCs.
> 
> Signed-off-by: Hans de Goede 

Looking pretty good.  Still a couple of things to address...

> +static struct usb_ohci_pdata ohci_platform_defaults = {
> + .power_on = ohci_platform_power_on,
> + .power_suspend =ohci_platform_power_off,
> + .power_off =ohci_platform_power_off,
>  };

I wonder if these routines couldn't be shared with non-DT setups.  We
could add an array of 3 struct clk pointers to the usb_ohci_pdata
structure.  Then if any of them are set, store these routines in the
power_* pointers.  (And likewise for ehci-platform.)  Something to
consider for a future patch...

> @@ -60,12 +128,24 @@ static int ohci_platform_probe(struct platform_device 
> *dev)
>   struct usb_hcd *hcd;
>   struct resource *res_mem;
>   struct usb_ohci_pdata *pdata = dev_get_platdata(&dev->dev);
> - int irq;
> - int err = -ENOMEM;
> + struct ohci_platform_priv *priv;
> + int clk, irq, err;
>  
> + /*
> +  * Use reasonable defaults so platforms don't have to provide these
> +  * with DT probing on ARM.
> +  */
>   if (!pdata) {
> - WARN_ON(1);
> - return -ENODEV;
> + pdata = dev->dev.platform_data = &ohci_platform_defaults;

This has a subtle bug.  Consider what will happen if ohci-platform is 
loaded, then unloaded and loaded again.

The existing ehci-platform driver has this same bug.  I definitely 
remember discussing at once or twice in the past, but evidently it has 
never been fixed.

> + /*
> +  * Right now device-tree probed devices don't get dma_mask set.
> +  * Since shared usb code relies on it, set it here for now.
> +  * Once we have dma capability bindings this can go away.
> +  */
> + err = dma_coerce_mask_and_coherent(&dev->dev,
> +DMA_BIT_MASK(32));
> + if (err)
> + return err;

The ehci-platform driver does this even when platform data is present.  
I guess you should do the same thing here (and lose the comment).

(Also, I dislike this alignment of the continuation line.  IMO it's a 
bad idea to match up with some particular element of the preceding 
line.  The style used in most of the USB stack is to indent 
continuation lines by two tab stops.)

>   }
>  
>   if (usb_disabled())

This test belongs at the start of the function.  It is more fundamental 
than the stuff you inserted.

> @@ -83,17 +163,39 @@ static int ohci_platform_probe(struct platform_device 
> *dev)
>   return -ENXIO;
>   }
>  
> + hcd = usb_create_hcd(&ohci_platform_hc_driver, &dev->dev,
> + dev_name(&dev->dev));
> + if (!hcd)
> + return -ENOMEM;
> +
> + priv = (struct ohci_platform_priv *)hcd_to_ohci(hcd)->priv;

Please define an inline routine or a macro for this messy computation.

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] xhci: make warnings greppable

2014-01-09 Thread Sarah Sharp
Hi Oliver,

This looks fine, but it will have to wait until after the merge window,
as my tree is closed to cleanups/features right now.  This will be
queued for 3.15.

Sarah Sharp

On Wed, Jan 08, 2014 at 05:13:11PM +0100, oli...@neukum.org wrote:
> From: Oliver Neukum 
> 
> This changes debug messages and warnings in xhci-ring.c
> to be on a single line so grep can find them. grep must
> have precedence over the 80 column limit.
> 
> Signed-off-by: Oliver Neukum 
> ---
>  drivers/usb/host/xhci-ring.c | 21 -
>  1 file changed, 8 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
> index 09b2b55..34dce53 100644
> --- a/drivers/usb/host/xhci-ring.c
> +++ b/drivers/usb/host/xhci-ring.c
> @@ -1081,8 +1081,7 @@ static void xhci_handle_cmd_set_deq(struct xhci_hcd 
> *xhci, int slot_id,
>  
>   ep_ring = xhci_stream_id_to_ring(dev, ep_index, stream_id);
>   if (!ep_ring) {
> - xhci_warn(xhci, "WARN Set TR deq ptr command for "
> - "freed stream ID %u\n",
> + xhci_warn(xhci, "WARN Set TR deq ptr command for freed stream 
> ID %u\n",
>   stream_id);
>   /* XXX: Harmless??? */
>   dev->eps[ep_index].ep_state &= ~SET_DEQ_PENDING;
> @@ -1098,12 +1097,10 @@ static void xhci_handle_cmd_set_deq(struct xhci_hcd 
> *xhci, int slot_id,
>  
>   switch (cmd_comp_code) {
>   case COMP_TRB_ERR:
> - xhci_warn(xhci, "WARN Set TR Deq Ptr cmd invalid 
> because "
> - "of stream ID configuration\n");
> + xhci_warn(xhci, "WARN Set TR Deq Ptr cmd invalid 
> because of stream ID configuration\n");
>   break;
>   case COMP_CTX_STATE:
> - xhci_warn(xhci, "WARN Set TR Deq Ptr cmd failed due "
> - "to incorrect slot or ep state.\n");
> + xhci_warn(xhci, "WARN Set TR Deq Ptr cmd failed due to 
> incorrect slot or ep state.\n");
>   ep_state = le32_to_cpu(ep_ctx->ep_info);
>   ep_state &= EP_STATE_MASK;
>   slot_state = le32_to_cpu(slot_ctx->dev_state);
> @@ -1113,13 +1110,12 @@ static void xhci_handle_cmd_set_deq(struct xhci_hcd 
> *xhci, int slot_id,
>   slot_state, ep_state);
>   break;
>   case COMP_EBADSLT:
> - xhci_warn(xhci, "WARN Set TR Deq Ptr cmd failed because 
> "
> - "slot %u was not enabled.\n", slot_id);
> + xhci_warn(xhci, "WARN Set TR Deq Ptr cmd failed because 
> slot "
> + "%u was not enabled.\n", slot_id);
>   break;
>   default:
> - xhci_warn(xhci, "WARN Set TR Deq Ptr cmd with unknown "
> - "completion code of %u.\n",
> -   cmd_comp_code);
> + xhci_warn(xhci, "WARN Set TR Deq Ptr cmd with unknown 
> completion code of "
> + "%u.\n", cmd_comp_code);
>   break;
>   }
>   /* OK what do we do now?  The endpoint state is hosed, and we
> @@ -1141,8 +1137,7 @@ static void xhci_handle_cmd_set_deq(struct xhci_hcd 
> *xhci, int slot_id,
>   update_ring_for_set_deq_completion(xhci, dev,
>   ep_ring, ep_index);
>   } else {
> - xhci_warn(xhci, "Mismatch between completed Set TR Deq "
> - "Ptr command & xHCI internal state.\n");
> + xhci_warn(xhci, "Mismatch between completed Set TR Deq 
> Ptr command & xHCI internal state.\n");
>   xhci_warn(xhci, "ep deq seg = %p, deq ptr = %p\n",
>   dev->eps[ep_index].queued_deq_seg,
>   dev->eps[ep_index].queued_deq_ptr);
> -- 
> 1.8.4
> 
--
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] xhci: make warnings greppable

2014-01-09 Thread Sergei Shtylyov

Hello.

On 01/08/2014 07:13 PM, oli...@neukum.org wrote:


From: Oliver Neukum 



This changes debug messages and warnings in xhci-ring.c
to be on a single line so grep can find them. grep must
have precedence over the 80 column limit.


   In the eyes of checkpatch.pl, it has been having precedence for quite a 
while already, even so that it found some of your line breaks premature. :-)



Signed-off-by: Oliver Neukum 



---
  drivers/usb/host/xhci-ring.c | 21 -
  1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 09b2b55..34dce53 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c

[...]

@@ -1113,13 +1110,12 @@ static void xhci_handle_cmd_set_deq(struct xhci_hcd 
*xhci, int slot_id,
slot_state, ep_state);
break;
case COMP_EBADSLT:
-   xhci_warn(xhci, "WARN Set TR Deq Ptr cmd failed because 
"
-   "slot %u was not enabled.\n", slot_id);
+   xhci_warn(xhci, "WARN Set TR Deq Ptr cmd failed because slot 
"
+   "%u was not enabled.\n", slot_id);
break;
default:
-   xhci_warn(xhci, "WARN Set TR Deq Ptr cmd with unknown "
-   "completion code of %u.\n",
- cmd_comp_code);
+   xhci_warn(xhci, "WARN Set TR Deq Ptr cmd with unknown 
completion code of "
+   "%u.\n", cmd_comp_code);
break;
}
/* OK what do we do now?  The endpoint state is hosed, and we


$ scripts/checkpatch.pl ~/patches/xhci-make-warnings-greppable.patch
WARNING: quoted string split across lines
#48: FILE: drivers/usb/host/xhci-ring.c:1114:
+   xhci_warn(xhci, "WARN Set TR Deq Ptr cmd failed because slot 
"
+   "%u was not enabled.\n", slot_id);

WARNING: quoted string split across lines
#55: FILE: drivers/usb/host/xhci-ring.c:1118:
+   xhci_warn(xhci, "WARN Set TR Deq Ptr cmd with unknown 
completion code of "
+   "%u.\n", cmd_comp_code);

total: 0 errors, 2 warnings, 49 lines checked

/home/headless/patches/xhci-make-warnings-greppable.patch has style problems, 
please review.


If any of these errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.

PS: Sarah, sorry for speaking up on xHCI patches again but I was sure the 
patch won't pass checkpatch.pl, so decided to report this...


WBR, Sergei

--
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 3.12 033/118] usb: xhci: Link TRB must not occur within a USB payload burst

2014-01-09 Thread Sarah Sharp
[Walt, please use reply-all to keep the list in the loop, thanks.]

On Wed, Jan 08, 2014 at 04:09:14PM +, David Laight wrote:
> > From: Sarah Sharp
> > On Tue, Jan 07, 2014 at 03:57:00PM -0800, walt wrote:
> > > On 01/07/2014 01:21 PM, Sarah Sharp wrote:
> > >
> > > > Can you please try the attached patch, on top of the previous three
> > > > patches, and send me dmesg?
> > >
> > > Hi Sarah, I just now finished running 0001-More-debugging.patch for the
> > > first time.  The previous dmesg didn't include that patch, but this one
> > > does.
> > >
> > > I read through this dmesg but I nodded off somewhere around line 500.
> > > I hope you can stay awake :)
> > 
> > Well, it has all the info I need, but the results don't make me too
> > happy.  Everything I've checked seems consistent, and I don't know why
> > the host stopped.  The link TRBs are intact, the dequeue pointer for the
> > endpoint was pointing to the transfer that timed out and it had the
> > cycle bit set correctly, etc.  Perhaps the no-op TRBs are really the
> > issue.
> > 
> > I'll have to take a look at the log again tomorrow.  I posted the dmesg
> > on pastebin if David wants to check it out as well:
> > http://pastebin.com/a4AUpsL1
> 
> I can't see anything obvious either.
> However there is no response to the 'stop endpoint' command.
> Section 4.6.9 (page 107 of rev1.0) states that the controller will complete
> any USB IN or OUT transaction before raising the command completion event.
> Possibly it is too 'stuck' to complete the transaction?

The host has to stop processing the transaction, it can't "wait" for the
transaction to finish.  "The Stop Endpoint Command is expected to stop
endpoint activity as soon as possible, which may mean that it stops in
the middle of a TRB."

Usually when hosts get into this kind of mode, something has seriously
gone wrong, like bus error when it issues a bad memory access.

> The endpoint status is also still '1' (running).
> This also means that the 'TR dequeue pointer' is undefined - so the
> controller could easily be processing a later TRB.
> This field might even still contain the ring base address written by
> the driver much earlier.
> 
> This might mean that something 'catastrophic' has happened earlier.
> Maybe the controller isn't actually seeing any doorbell writes at all.
> Maybe the base addresses it has for the rings have all got corrupted.
> At least this looks like amd64 - so there aren't memory coherency issues.
> 
> Some hacks that might help isolate the problem:
> 1) Request an interrupt from the last nop data TRB.
> 2) Put a command nop (decimal 23) TRB into the command ring before
>the 'stop endpoint'.
> 3) Comment out the code that adds the nop data TRBs.
> The first two might need code adding to handle the responses.
> 
> Do we know the actual xhci device?
> I think it reports version 0x96.
> (Sarah - it might be useful if that version were in one of the trace
> messages that is output by default.)

You mean print the PCI device and vendor ID?  Perhaps Subsystem vendor
as well?

On Tue, Jan 07, 2014 at 05:26:37PM -0800, walt wrote:
> On 01/07/2014 04:47 PM, Sarah Sharp wrote:
>  
> > Can you send me the output of `sudo lspci -vvv -n`?  Maybe we can just
> > turn off scatter-gather for your host controller until we get a proper
> > fix in that uses link TRBs instead of no-op TRBs.
> 
> The aftermarket usb3 adapter card and the usb3 outboard hard-drive docking
> station are the only two usb3 devices I have.
> 
> I've wondered if my xhci problems might be caused by hardware quirks, and
> wondering why I seem to be the only one who has this problem.
> 
> Maybe I could "take one for the team" by buying new hardware toys that I
> don't really need but I could use to test the xhci driver?  (I do enjoy
> buying new toys, necessary, or, um, maybe not :)

It would be appreciated if you could see if your device causes other
host controllers to fail.  Who am I to keep a geek from new toys? ;)

In the meantime, try this patch, which is something of a long shot.

Sarah Sharp
>From 19e2ab85ac2cc0d84f56247dcf29bdce14bd70d5 Mon Sep 17 00:00:00 2001
From: Sarah Sharp 
Date: Thu, 9 Jan 2014 15:46:04 -0800
Subject: [PATCH] xhci: Enable Link TRB quirk for 0.96 ASMedia host.

A recent bug fix commit causes an ASMedia host to stop responding to
commands.  See if it needs the link TRB quirk.  This was generally only
necessary for 0.95 hosts, but maybe this 0.96 host needs it.

Signed-off-by: Sarah Sharp 
---
 drivers/usb/host/xhci-pci.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index 3c898c12a06b..8196ac2289e4 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -92,6 +92,8 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
 		xhci->quirks |= XHCI_TRUST_TX_LENGTH;
 	}
 
+	if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && pdev->device == 1042)
+		xhci->quirks |= XHCI_LINK_TRB_QUIRK;
 	

Re: [PATCH 05/10] usb: chipidea: add OTG fsm operation functions implemenation.

2014-01-09 Thread Peter Chen
On Thu, Jan 09, 2014 at 02:45:24PM +0100, Marc Kleine-Budde wrote:
> On 01/08/2014 10:06 AM, 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|   11 ++
> >  drivers/usb/chipidea/otg_fsm.c |  311 
> > 
> >  drivers/usb/chipidea/otg_fsm.h |8 +
> >  3 files changed, 330 insertions(+), 0 deletions(-)
> > 
> > diff --git a/drivers/usb/chipidea/bits.h b/drivers/usb/chipidea/bits.h
> > index a857131..4347414 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_CCS   BIT(0)
> > +#define PORTSC_CSC   BIT(1)
> > +#define PORTSC_PEC   BIT(3)
> > +#define PORTSC_OCC   BIT(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 */
> > @@ -55,6 +60,9 @@
> >  #define PORTSC_PTWBIT(28)
> >  #define PORTSC_STSBIT(29)
> >  
> > +#define PORTSC_W1C_BITS\
> > +   (PORTSC_CSC | PORTSC_PEC | PORTSC_OCC)
> > +
> >  /* DEVLC */
> >  #define DEVLC_PSPD(0x03UL << 25)
> >  #define DEVLC_PSPD_HS (0x02UL << 25)
> > @@ -69,7 +77,10 @@
> >  #define PTS_HSIC  4
> >  
> >  /* OTGSC */
> > +#define OTGSC_VD BIT(0)
> > +#define OTGSC_VC BIT(1)
> >  #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/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c
> > index 1f8907d..31a046d 100644
> > --- a/drivers/usb/chipidea/otg_fsm.c
> > +++ b/drivers/usb/chipidea/otg_fsm.c
> > @@ -19,12 +19,322 @@
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> >  
> >  #include "ci.h"
> >  #include "bits.h"
> >  #include "otg.h"
> >  #include "otg_fsm.h"
> >  
> > +static struct list_head active_timers;
> > +
> > +#define HA_DATA_PULSE 1
> > +
> > +/* FSM timers */
> > +struct ci_otg_fsm_timer *a_wait_vrise_tmr, *a_wait_vfall_tmr, 
> > *a_wait_bcon_tmr,
> > +   *a_aidl_bdis_tmr, *a_bidl_adis_tmr, *b_ase0_brst_tmr,
> > +   *b_se0_srp_tmr, *b_srp_fail_tmr, *b_data_pulse_tmr;
> 
> IIRC the USB spec says there is only one OTG port per machine, but I
> think you shouldn't add new code that uses so many global variables,
> better embed these into a per device struct.
> 

Hi Marc, would you please list the spec (or link) that there is only
one OTG port per machine?

-- 

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 4/8] usb: ehci: add freescale imx28 special write register method

2014-01-09 Thread Peter Chen
On Thu, Jan 09, 2014 at 10:53:45AM +0100, Marc Kleine-Budde wrote:
> On 01/09/2014 04:22 AM, Greg KH wrote:
> > On Thu, Jan 09, 2014 at 09:36:09AM +0800, Peter Chen wrote:
> >> On Tue, Jan 07, 2014 at 04:20:25PM -0800, Greg KH wrote:
> >>> On Mon, Jan 06, 2014 at 09:42:26AM +0100, Marc Kleine-Budde wrote:
>  Hello Peter and Greg,
> 
>  On 01/06/2014 03:10 AM, Peter Chen wrote:
> > According to Freescale imx28 Errata, "ENGR119653 USB: ARM to USB
> > register error issue", All USB register write operations must
> > use the ARM SWP instruction. So, we implement a special ehci_write
> > for imx28.
> >
> > Discussion for it at below:
> > http://marc.info/?l=linux-usb&m=137996395529294&w=2
> >
> > Signed-off-by: Peter Chen 
> > Acked-by: Alan Stern 
> > Signed-off-by: Marc Kleine-Budde 
> > Tested-by: Marc Kleine-Budde 
> 
>  please add stable on Cc for this and the next two patches:
> 
>  [PATCH 4/8] usb: ehci: add freescale imx28 special write register method
>  [PATCH 5/8] usb: chipidea: add freescale imx28 special write register 
>  method
>  [PATCH 6/8] usb: chipidea: imx: set CI_HDRC_IMX28_WRITE_FIX for imx28
> >>>
> >>> How do those patches meet the Documentation/stable_kernel_rules.txt
> >>> guidelines?
> >>>
> >>>
> >>
> >> - It must be obviously correct and tested.
> >> It has Marc Kleine-Budde's tested-by tag.
> >>
> >> - It cannot be bigger than 100 lines, with context.
> >> I think it is.
> >>
> >> - It must fix only one thing.
> >> It only fixes the imx28 special write problem.
> >>
> >> - It must fix a real bug that bothers people (not a, "This could be a
> >> problem..." type thing).
> >> Robert Hodaszi reported this problem at below link:
> >> http://marc.info/?l=linux-usb&m=137996395529294&w=2
> > 
> > You are adding new functionality for something that never worked before
> > (i.e. new features), which is not ok for stable kernel patches, with the
> > exception of new quirks or device ids.
> > 
> > sorry, this is something new, not a stable kernel patch.
> 
> Without this fix, the mx28 works...most of the time. However under
> certain load scenarios the driver breaks. This is, IMHO, a fix.
> 

Without this patcheset, imx28 works unstable at high AHB bus loading.
If the bus loading is not high, the imx28 usb can work well at the most
of time. There is a IC errata for this problem, usually, we consider
IC errata is a problem not a new feature, and this workaround is needed
for that. 

We need three patches to fix this problem for both host and peripheral
mode and limits this fix is only for imx28, so there are some changes.
Greg, can this patchset is in -stable?

-- 

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 7/8] usb: chipidea: Fix Internal error: : 808 [#1] ARM related to STS flag

2014-01-09 Thread Peter Chen
 
> 
> On Tue, Jan 07, 2014 at 04:27:30PM -0800, Greg KH wrote:
> > On Mon, Jan 06, 2014 at 10:10:44AM +0800, Peter Chen wrote:
> > > From: Chris Ruehl 
> > >
> > > * init the sts flag to 0 (missed)
> > > * fix write the real bit not sts value
> > > * Set PORTCS_STS and DEVLC_STS only if sts = 1
> > >
> > > Signed-off-by: Chris Ruehl 
> > > Signed-off-by: Peter Chen 
> > > ---
> > >  drivers/usb/chipidea/core.c |8 +---
> > >  1 files changed, 5 insertions(+), 3 deletions(-)
> >
> > Why isn't this patch ok for the -stable trees?
> >
> 
> The usb code for the platform which this problem occurs is
> just in your usb-next tree [3.14], the same for PATCH 8/8.
> 

Greg, do I need to re-send these two patches (7/8, 8/8) with
other chipidea 3.14 patches?

Peter
--
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 4/8] usb: ehci: add freescale imx28 special write register method

2014-01-09 Thread Greg KH
On Fri, Jan 10, 2014 at 10:31:05AM +0800, Peter Chen wrote:
> On Thu, Jan 09, 2014 at 10:53:45AM +0100, Marc Kleine-Budde wrote:
> > On 01/09/2014 04:22 AM, Greg KH wrote:
> > > On Thu, Jan 09, 2014 at 09:36:09AM +0800, Peter Chen wrote:
> > >> On Tue, Jan 07, 2014 at 04:20:25PM -0800, Greg KH wrote:
> > >>> On Mon, Jan 06, 2014 at 09:42:26AM +0100, Marc Kleine-Budde wrote:
> >  Hello Peter and Greg,
> > 
> >  On 01/06/2014 03:10 AM, Peter Chen wrote:
> > > According to Freescale imx28 Errata, "ENGR119653 USB: ARM to USB
> > > register error issue", All USB register write operations must
> > > use the ARM SWP instruction. So, we implement a special ehci_write
> > > for imx28.
> > >
> > > Discussion for it at below:
> > > http://marc.info/?l=linux-usb&m=137996395529294&w=2
> > >
> > > Signed-off-by: Peter Chen 
> > > Acked-by: Alan Stern 
> > > Signed-off-by: Marc Kleine-Budde 
> > > Tested-by: Marc Kleine-Budde 
> > 
> >  please add stable on Cc for this and the next two patches:
> > 
> >  [PATCH 4/8] usb: ehci: add freescale imx28 special write register 
> >  method
> >  [PATCH 5/8] usb: chipidea: add freescale imx28 special write register 
> >  method
> >  [PATCH 6/8] usb: chipidea: imx: set CI_HDRC_IMX28_WRITE_FIX for imx28
> > >>>
> > >>> How do those patches meet the Documentation/stable_kernel_rules.txt
> > >>> guidelines?
> > >>>
> > >>>
> > >>
> > >> - It must be obviously correct and tested.
> > >> It has Marc Kleine-Budde's tested-by tag.
> > >>
> > >> - It cannot be bigger than 100 lines, with context.
> > >> I think it is.
> > >>
> > >> - It must fix only one thing.
> > >> It only fixes the imx28 special write problem.
> > >>
> > >> - It must fix a real bug that bothers people (not a, "This could be a
> > >> problem..." type thing).
> > >> Robert Hodaszi reported this problem at below link:
> > >> http://marc.info/?l=linux-usb&m=137996395529294&w=2
> > > 
> > > You are adding new functionality for something that never worked before
> > > (i.e. new features), which is not ok for stable kernel patches, with the
> > > exception of new quirks or device ids.
> > > 
> > > sorry, this is something new, not a stable kernel patch.
> > 
> > Without this fix, the mx28 works...most of the time. However under
> > certain load scenarios the driver breaks. This is, IMHO, a fix.
> > 
> 
> Without this patcheset, imx28 works unstable at high AHB bus loading.
> If the bus loading is not high, the imx28 usb can work well at the most
> of time. There is a IC errata for this problem, usually, we consider
> IC errata is a problem not a new feature, and this workaround is needed
> for that. 
> 
> We need three patches to fix this problem for both host and peripheral
> mode and limits this fix is only for imx28, so there are some changes.
> Greg, can this patchset is in -stable?

Ok, but please put this information in the patches otherwise I'll forget
why these are allowed in the -stable tree.

thanks,

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 7/8] usb: chipidea: Fix Internal error: : 808 [#1] ARM related to STS flag

2014-01-09 Thread Greg KH
On Fri, Jan 10, 2014 at 03:25:56AM +, Peter Chen wrote:
>  
> > 
> > On Tue, Jan 07, 2014 at 04:27:30PM -0800, Greg KH wrote:
> > > On Mon, Jan 06, 2014 at 10:10:44AM +0800, Peter Chen wrote:
> > > > From: Chris Ruehl 
> > > >
> > > > * init the sts flag to 0 (missed)
> > > > * fix write the real bit not sts value
> > > > * Set PORTCS_STS and DEVLC_STS only if sts = 1
> > > >
> > > > Signed-off-by: Chris Ruehl 
> > > > Signed-off-by: Peter Chen 
> > > > ---
> > > >  drivers/usb/chipidea/core.c |8 +---
> > > >  1 files changed, 5 insertions(+), 3 deletions(-)
> > >
> > > Why isn't this patch ok for the -stable trees?
> > >
> > 
> > The usb code for the platform which this problem occurs is
> > just in your usb-next tree [3.14], the same for PATCH 8/8.
> > 
> 
> Greg, do I need to re-send these two patches (7/8, 8/8) with
> other chipidea 3.14 patches?

Yes, please resend any outstanding patches, my queue is now empty.

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: 3.13-rc2 phy-twl4030-usb.c - Timeout setting T2 HSUSB PHY DPLL

2014-01-09 Thread Kishon Vijay Abraham I
Hi,

On Thursday 09 January 2014 10:54 AM, Roger Quadros wrote:
> Hi Marek,
> 
> I have no idea what is happening there. Have you tried using device tree boot?
> Board file boot support would be dropped eventually.
> 
> Did you try if I2C read write to the twl4030 device works and all necessary 
> clocks/supplies are
> present?
> 
> Kishon, do you know what is causing the USB DPLL failure there?

Not sure what's causing those failures :-s

-Kishon

> 
> cheers,
> -roger
> 
> On 01/09/2014 02:31 AM, Belisko Marek wrote:
>> Any pointers? Still present in 3.13-rc7.
>>
>> On Wed, Dec 4, 2013 at 1:22 PM, Roger Quadros  wrote:
>>> +Kishon
>>>
>>> On 12/03/2013 11:33 PM, Belisko Marek wrote:
 Hi,

 current 3.13-rcX break usb support on gta04 board (similar to
 beagleboard) when booting via board file.

 In console we can see messages:
  [ 5227.287841] twl4030_usb twl4030_usb: Timeout setting T2 HSUSB PHY DPLL 
 clock
 [ 5232.936096] omap_musb_mailbox: musb core is not yet ready
 [ 5233.958160] twl4030_usb twl4030_usb: Timeout setting T2 HSUSB PHY DPLL 
 clock
 [ 5235.058227] twl4030_usb twl4030_usb: Timeout setting T2 HSUSB PHY DPLL 
 clock

 Any pointer what could cause that? (in 3.12 usb works fine)

 BR,

 marek

>>>
>>
>> BR,
>>
>> marek
>>
> 

--
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-modem not working correctly

2014-01-09 Thread Lars Melin

On 2014-01-09 17:50, Linus Gasser wrote:

Hi list,

I'm trying to get an USB-modem running on a Smileplug, which is some 
Arm7-device, using it with the kernel 3.12-6. As far as I can tell 
it's an USB3-port. It works well with harddisks, but when I plug in 
USB-modems, it always fails sooner or later.


Is there anything that I can do to track down the bug? I attach the 
syslog (journal - it's archlinux) when I plug in the modem, start 
pppd, then try to do a ping. Sometimes some succeed, but very fast it 
fails.


I compiled the kernel using usb-debug option, but I'm at a loss to 
turn it on. I don't get any more messages than without that option.


Thanks for any help,

Linus

PS: flame me if you don't like log-files in attachements - I just 
thought it's more readable...



This is a dongle ( Huawei E3131-s2 ?) with both ncm direct ethernet 
interface and serial ppp interface, don't load the cdc_ncm driver if you 
use it in serial ppp mode.
I've seen the same callback error and dongle firmware crash in the past 
when both protocols are active.

--
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: Alcatel usb modem

2014-01-09 Thread Lars Melin

On 2014-01-09 00:17, Greg KH wrote:

On Wed, Jan 08, 2014 at 10:45:43PM +0700, Lars Melin wrote:

On 2014-01-02 23:59, Dan Williams wrote:

On Sun, 2013-12-29 at 15:35 +0700, Lars Melin wrote:

On 2013-12-29 00:55, Greg KH wrote:

On Sat, Dec 28, 2013 at 02:13:08PM +, thomas.takacs.a...@gmail.com wrote:

Hi,
I've seen this message: tell linux-usb... to add your device to a proper device.
My USB modem is Alcatel One Touch X080C.
Please kindly add it or inform me how can I fix it.

What is the full message that is printed out?  What is the vendor and
device id of this device?  You are using the module parameters to add a
device id to the usb-serial module, we can add the id to the proper
driver if we know the ids of it.

thanks,

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

Alcatel X085C  1bbb:0012

%DEVICE1BBB0012% = Modem6k, USB\VID_1BBB&PID_0012&MI_00
%DEVICE1BBB0012% = OEMportInstall6k, USB\VID_1BBB&PID_0012&MI_01
%DEVICE1BBB0012% = OEMportInstall6k, USB\VID_1BBB&PID_0012&MI_02
%DEVICE1BBB0012% = OEMportInstallSound, USB\VID_1BBB&PID_0012&MI_03

The "6k" indicates that it's likely a Qualcomm-based device like other
Alcatel/TCT.  I would add the Modem, Service, and AT ports to the
'option' driver using USB inteface numbers (eg,
USB_DEVICE_INTERFACE_NUMBER using the MI_0x number).  Don't bind the
"Voice" port since it's likely not a serial port.


DEVICE1BBB0012 = "ALCATEL CDMA Modem USB Modem"
DEVICE1BBB0012 = "ALCATEL CDMA Modem Service Port"
DEVICE1BBB0012 = "ALCATEL CDMA Modem AT Port"
DEVICE1BBB0012 = "ALCATEL CDMA Modem Voice Port"


Alcatel X080C 1bbb:00ca

%DEVICE1BBB00CA% = Modem6k, USB\VID_1BBB&PID_00CA&MI_00
%DEVICE1BBB00CA% = OEMportInstall6k, USB\VID_1BBB&PID_00CA&MI_01
%DEVICE1BBB00CA% = OEMportInstall6k, USB\VID_1BBB&PID_00CA&MI_02
%DEVICE1BBB00CA% = OEMportInstallSound, USB\VID_1BBB&PID_00CA&MI_03

DEVICE1BBB00CA = "Modem X080C CDMA Modem USB Modem"
DEVICE1BBB00CA = "Modem X080C CDMA Modem Service Port"  (Diag)
DEVICE1BBB00CA = "Modem X080C CDMA Modem AT Port"
DEVICE1BBB00CA = "Modem X080C CDMA Modem Voice Port"

Same here.  Bind 'option' to the device's Modem, Service, and AT ports
by USB interface number but leave Voice alone.

Dan


--
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

The Voice Port is afaik serialised PCM data and the interface is present in
other option supported
Alcatel dongles made by T&A Mobile Phones without being blacklisted.
It's up to you or Greg K-H to decide, the info from Windows .inf file I
posted above was in response
to his request for more info which the reporter couldn't provide.

Can you convert the above information into a patch for the option driver
that people could test out and I could possibly apply?

thanks,

greg k-h
Sorry, no I can't at the moment. If I could then you would had got a 
patch instead of info only.

--
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/7] usb: chipidea: imx: set CI_HDRC_IMX28_WRITE_FIX for imx28

2014-01-09 Thread Peter Chen
Due to imx28 needs ARM swp instruction for writing, we set
CI_HDRC_IMX28_WRITE_FIX for imx28.

This patch is needed for stable tree 3.11+

Cc: sta...@vger.kernel.org
Cc: robert.hoda...@digi.com
Signed-off-by: Peter Chen 
Signed-off-by: Marc Kleine-Budde 
Tested-by: Marc Kleine-Budde 
---
 drivers/usb/chipidea/ci_hdrc_imx.c |   32 ++--
 1 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c 
b/drivers/usb/chipidea/ci_hdrc_imx.c
index bb5d976..c00f772 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.c
+++ b/drivers/usb/chipidea/ci_hdrc_imx.c
@@ -23,6 +23,26 @@
 #include "ci.h"
 #include "ci_hdrc_imx.h"
 
+#define CI_HDRC_IMX_IMX28_WRITE_FIX BIT(0)
+
+struct ci_hdrc_imx_platform_flag {
+   unsigned int flags;
+};
+
+static const struct ci_hdrc_imx_platform_flag imx27_usb_data = {
+};
+
+static const struct ci_hdrc_imx_platform_flag imx28_usb_data = {
+   .flags = CI_HDRC_IMX_IMX28_WRITE_FIX,
+};
+
+static const struct of_device_id ci_hdrc_imx_dt_ids[] = {
+   { .compatible = "fsl,imx28-usb", .data = &imx28_usb_data},
+   { .compatible = "fsl,imx27-usb", .data = &imx27_usb_data},
+   { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, ci_hdrc_imx_dt_ids);
+
 struct ci_hdrc_imx_data {
struct usb_phy *phy;
struct platform_device *ci_pdev;
@@ -82,6 +102,9 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
  CI_HDRC_DISABLE_STREAMING,
};
int ret;
+   const struct of_device_id *of_id =
+   of_match_device(ci_hdrc_imx_dt_ids, &pdev->dev);
+   const struct ci_hdrc_imx_platform_flag *imx_platform_flag = of_id->data;
 
data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
if (!data) {
@@ -115,6 +138,9 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
 
pdata.phy = data->phy;
 
+   if (imx_platform_flag->flags & CI_HDRC_IMX_IMX28_WRITE_FIX)
+   pdata.flags |= CI_HDRC_IMX28_WRITE_FIX;
+
ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
if (ret)
goto err_clk;
@@ -173,12 +199,6 @@ static int ci_hdrc_imx_remove(struct platform_device *pdev)
return 0;
 }
 
-static const struct of_device_id ci_hdrc_imx_dt_ids[] = {
-   { .compatible = "fsl,imx27-usb", },
-   { /* sentinel */ }
-};
-MODULE_DEVICE_TABLE(of, ci_hdrc_imx_dt_ids);
-
 static struct platform_driver ci_hdrc_imx_driver = {
.probe = ci_hdrc_imx_probe,
.remove = ci_hdrc_imx_remove,
-- 
1.7.8


--
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/7] usb: ehci: add freescale imx28 special write register method

2014-01-09 Thread Peter Chen
According to Freescale imx28 Errata, "ENGR119653 USB: ARM to USB
register error issue", All USB register write operations must
use the ARM SWP instruction. So, we implement a special ehci_write
for imx28.

Discussion for it at below:
http://marc.info/?l=linux-usb&m=137996395529294&w=2

Without this patcheset, imx28 works unstable at high AHB bus loading.
If the bus loading is not high, the imx28 usb can work well at the most
of time. There is a IC errata for this problem, usually, we consider
IC errata is a problem not a new feature, and this workaround is needed
for that, so we need to add them to stable tree 3.11+.

Cc: sta...@vger.kernel.org
Cc: robert.hoda...@digi.com
Signed-off-by: Peter Chen 
Acked-by: Alan Stern 
Signed-off-by: Marc Kleine-Budde 
Tested-by: Marc Kleine-Budde 
---
 drivers/usb/host/ehci.h |   18 +-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index c35a6e2b..9dfc6c1 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -225,6 +225,7 @@ struct ehci_hcd {   /* one per controller */
unsignedhas_synopsys_hc_bug:1; /* Synopsys HC */
unsignedframe_index_bug:1; /* MosChip (AKA NetMos) */
unsignedneed_oc_pp_cycle:1; /* MPC834X port power */
+   unsignedimx28_write_fix:1; /* For Freescale i.MX28 */
 
/* required for usb32 quirk */
#define OHCI_CTRL_HCFS  (3 << 6)
@@ -728,6 +729,18 @@ static inline unsigned int ehci_readl(const struct 
ehci_hcd *ehci,
 #endif
 }
 
+#ifdef CONFIG_SOC_IMX28
+static inline void imx28_ehci_writel(const unsigned int val,
+   volatile __u32 __iomem *addr)
+{
+   __asm__ ("swp %0, %0, [%1]" : : "r"(val), "r"(addr));
+}
+#else
+static inline void imx28_ehci_writel(const unsigned int val,
+   volatile __u32 __iomem *addr)
+{
+}
+#endif
 static inline void ehci_writel(const struct ehci_hcd *ehci,
const unsigned int val, __u32 __iomem *regs)
 {
@@ -736,7 +749,10 @@ static inline void ehci_writel(const struct ehci_hcd *ehci,
writel_be(val, regs) :
writel(val, regs);
 #else
-   writel(val, regs);
+   if (ehci->imx28_write_fix)
+   imx28_ehci_writel(val, regs);
+   else
+   writel(val, regs);
 #endif
 }
 
-- 
1.7.8


--
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 6/7] usb: chipidea: need to mask INT_STATUS when write otgsc

2014-01-09 Thread Peter Chen
For otgsc, both enable bits and status bits are in it. So we need
to make sure the status bits are not be cleared when write enable
bits. It can fix one bug that we plug in/out Micro AB cable fast,
and sometimes, the IDIS will be cleared wrongly when handle last
ID interrupt (ID 0->1), so the current interrupt will not occur.

For stable tree: 3.12+

Cc: sta...@vger.kernel.org
Signed-off-by: Peter Chen 
---
 drivers/usb/chipidea/otg.h |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/chipidea/otg.h b/drivers/usb/chipidea/otg.h
index 2d9f090..449bee0 100644
--- a/drivers/usb/chipidea/otg.h
+++ b/drivers/usb/chipidea/otg.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Freescale Semiconductor, Inc.
+ * Copyright (C) 2013-2014 Freescale Semiconductor, Inc.
  *
  * Author: Peter Chen
  *
@@ -19,12 +19,12 @@ static inline void ci_clear_otg_interrupt(struct ci_hdrc 
*ci, u32 bits)
 
 static inline void ci_enable_otg_interrupt(struct ci_hdrc *ci, u32 bits)
 {
-   hw_write(ci, OP_OTGSC, bits, bits);
+   hw_write(ci, OP_OTGSC, bits | OTGSC_INT_STATUS_BITS, bits);
 }
 
 static inline void ci_disable_otg_interrupt(struct ci_hdrc *ci, u32 bits)
 {
-   hw_write(ci, OP_OTGSC, bits, 0);
+   hw_write(ci, OP_OTGSC, bits | OTGSC_INT_STATUS_BITS, 0);
 }
 
 int ci_hdrc_otg_init(struct ci_hdrc *ci);
-- 
1.7.8


--
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/7] usb: chipidea: put hw_phymode_configure before ci_usb_phy_init

2014-01-09 Thread Peter Chen
From: Chris Ruehl 

hw_phymode_configure configures the PORTSC registers and allow the
following phy_inits to operate on the right parameters. This fix a problem
where the UPLI (ISP1504) could not be detected, because the Viewport was not
available and read the viewport return 0's only.

Signed-off-by: Chris Ruehl 
Signed-off-by: Peter Chen 
---
 drivers/usb/chipidea/core.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index edeec36..33f22bc 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -559,6 +559,8 @@ static int ci_hdrc_probe(struct platform_device *pdev)
return -ENODEV;
}
 
+   hw_phymode_configure(ci);
+
ret = ci_usb_phy_init(ci);
if (ret) {
dev_err(dev, "unable to init phy: %d\n", ret);
@@ -576,8 +578,6 @@ static int ci_hdrc_probe(struct platform_device *pdev)
 
ci_get_otg_capable(ci);
 
-   hw_phymode_configure(ci);
-
dr_mode = ci->platdata->dr_mode;
/* initialize role(s) before the interrupt is requested */
if (dr_mode == USB_DR_MODE_OTG || dr_mode == USB_DR_MODE_HOST) {
-- 
1.7.8


--
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/7] usb: chipidea: add freescale imx28 special write register method

2014-01-09 Thread Peter Chen
According to Freescale imx28 Errata, "ENGR119653 USB: ARM to USB
register error issue", All USB register write operations must
use the ARM SWP instruction. So, we implement special hw_write
and hw_test_and_clear for imx28.

Discussion for it at below:
http://marc.info/?l=linux-usb&m=137996395529294&w=2

This patch is needed for stable tree 3.11+.

Cc: sta...@vger.kernel.org
Cc: robert.hoda...@digi.com
Signed-off-by: Peter Chen 
Signed-off-by: Marc Kleine-Budde 
Tested-by: Marc Kleine-Budde 
---
 drivers/usb/chipidea/ci.h|   26 --
 drivers/usb/chipidea/core.c  |2 ++
 drivers/usb/chipidea/host.c  |1 +
 include/linux/usb/chipidea.h |1 +
 4 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
index a71dc1c..88b80f7 100644
--- a/drivers/usb/chipidea/ci.h
+++ b/drivers/usb/chipidea/ci.h
@@ -164,6 +164,7 @@ struct hw_bank {
  * @id_event: indicates there is an id event, and handled at ci_otg_work
  * @b_sess_valid_event: indicates there is a vbus event, and handled
  * at ci_otg_work
+ * @imx28_write_fix: Freescale imx28 needs swp instruction for writing
  */
 struct ci_hdrc {
struct device   *dev;
@@ -202,6 +203,7 @@ struct ci_hdrc {
struct dentry   *debugfs;
boolid_event;
boolb_sess_valid_event;
+   boolimx28_write_fix;
 };
 
 static inline struct ci_role_driver *ci_role(struct ci_hdrc *ci)
@@ -250,6 +252,26 @@ static inline u32 hw_read(struct ci_hdrc *ci, enum 
ci_hw_regs reg, u32 mask)
return ioread32(ci->hw_bank.regmap[reg]) & mask;
 }
 
+#ifdef CONFIG_SOC_IMX28
+static inline void imx28_ci_writel(u32 val, volatile void __iomem *addr)
+{
+   __asm__ ("swp %0, %0, [%1]" : : "r"(val), "r"(addr));
+}
+#else
+static inline void imx28_ci_writel(u32 val, volatile void __iomem *addr)
+{
+}
+#endif
+
+static inline void __hw_write(struct ci_hdrc *ci, u32 val,
+   void __iomem *addr)
+{
+   if (ci->imx28_write_fix)
+   imx28_ci_writel(val, addr);
+   else
+   iowrite32(val, addr);
+}
+
 /**
  * hw_write: writes to a hw register
  * @reg:  register index
@@ -263,7 +285,7 @@ static inline void hw_write(struct ci_hdrc *ci, enum 
ci_hw_regs reg,
data = (ioread32(ci->hw_bank.regmap[reg]) & ~mask)
| (data & mask);
 
-   iowrite32(data, ci->hw_bank.regmap[reg]);
+   __hw_write(ci, data, ci->hw_bank.regmap[reg]);
 }
 
 /**
@@ -278,7 +300,7 @@ static inline u32 hw_test_and_clear(struct ci_hdrc *ci, 
enum ci_hw_regs reg,
 {
u32 val = ioread32(ci->hw_bank.regmap[reg]) & mask;
 
-   iowrite32(val, ci->hw_bank.regmap[reg]);
+   __hw_write(ci, val, ci->hw_bank.regmap[reg]);
return val;
 }
 
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 458d8e4..0ead0b4 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -548,6 +548,8 @@ static int ci_hdrc_probe(struct platform_device *pdev)
 
ci->dev = dev;
ci->platdata = dev->platform_data;
+   ci->imx28_write_fix = !!(ci->platdata->flags &
+   CI_HDRC_IMX28_WRITE_FIX);
 
ret = hw_device_init(ci, base);
if (ret < 0) {
diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c
index 526cd77..a8ac6c1 100644
--- a/drivers/usb/chipidea/host.c
+++ b/drivers/usb/chipidea/host.c
@@ -65,6 +65,7 @@ static int host_start(struct ci_hdrc *ci)
ehci->caps = ci->hw_bank.cap;
ehci->has_hostpc = ci->hw_bank.lpm;
ehci->has_tdi_phy_lpm = ci->hw_bank.lpm;
+   ehci->imx28_write_fix = ci->imx28_write_fix;
 
if (ci->platdata->reg_vbus) {
ret = regulator_enable(ci->platdata->reg_vbus);
diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h
index 7d39967..708bd11 100644
--- a/include/linux/usb/chipidea.h
+++ b/include/linux/usb/chipidea.h
@@ -24,6 +24,7 @@ struct ci_hdrc_platform_data {
 * but otg is not supported (no register otgsc).
 */
 #define CI_HDRC_DUAL_ROLE_NOT_OTG  BIT(4)
+#define CI_HDRC_IMX28_WRITE_FIXBIT(5)
enum usb_dr_modedr_mode;
 #define CI_HDRC_CONTROLLER_RESET_EVENT 0
 #define CI_HDRC_CONTROLLER_STOPPED_EVENT   1
-- 
1.7.8


--
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 4/7] usb: chipidea: Fix Internal error: : 808 [#1] ARM related to STS flag

2014-01-09 Thread Peter Chen
From: Chris Ruehl 

* init the sts flag to 0 (missed)
* fix write the real bit not sts value
* Set PORTCS_STS and DEVLC_STS only if sts = 1

[Peter Chen: This one and the next patch fix the problem occurred imx27
and imx31, and imx27 and imx31 usb support are enabled until 3.14, so
these two patches isn't needed for -stable]

Signed-off-by: Chris Ruehl 
Signed-off-by: Peter Chen 
---
 drivers/usb/chipidea/core.c |8 +---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 0ead0b4..edeec36 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -236,7 +236,7 @@ static int hw_device_init(struct ci_hdrc *ci, void __iomem 
*base)
 
 static void hw_phymode_configure(struct ci_hdrc *ci)
 {
-   u32 portsc, lpm, sts;
+   u32 portsc, lpm, sts = 0;
 
switch (ci->platdata->phy_mode) {
case USBPHY_INTERFACE_MODE_UTMI:
@@ -266,10 +266,12 @@ static void hw_phymode_configure(struct ci_hdrc *ci)
 
if (ci->hw_bank.lpm) {
hw_write(ci, OP_DEVLC, DEVLC_PTS(7) | DEVLC_PTW, lpm);
-   hw_write(ci, OP_DEVLC, DEVLC_STS, sts);
+   if (sts)
+   hw_write(ci, OP_DEVLC, DEVLC_STS, DEVLC_STS);
} else {
hw_write(ci, OP_PORTSC, PORTSC_PTS(7) | PORTSC_PTW, portsc);
-   hw_write(ci, OP_PORTSC, PORTSC_STS, sts);
+   if (sts)
+   hw_write(ci, OP_PORTSC, PORTSC_STS, PORTSC_STS);
}
 }
 
-- 
1.7.8


--
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 7/7] usb: chipidea: udc: using MultO at TD as real mult value for ISO-TX

2014-01-09 Thread Peter Chen
We have met a bug that the high bandwidth ISO-TX transfer has failed
at the last packet if it is less than 1024, the TD status shows it
is "Transaction Error".

The root cause of this problem is: the mult value at qh is not correct
for current TD's transfer length. We use TD list to queue un-transfer
TDs, and change mult for new adding TDs. If new adding TDs transfer length
less than 1024, but the queued un-transfer TDs transfer length is larger
than 1024, the transfer error will occur, and vice versa.
Usually, this problem occurs at the last packet, and the first packet for
new frame.

We fixed this problem by setting Mult at QH as the largest value (3), and
set MultO (Multiplier Override) at TD according to every transfer length.
It can cover both hardware version less than 2.3 (the real mult is MultO
if it is not 0) and 2.3+ (the real mult is min(qh.mult, td.multo)).

Since the MultO bits are only existed at TX TD, we keep the ISO-RX behavior
unchanged.

For stable tree: 3.11+.

Cc: stable 
Cc: Michael Grzeschik 
Reported-by: Matthieu Vanin 
Tested-by: Matthieu Vanin 
Signed-off-by: Peter Chen 
---
 drivers/usb/chipidea/udc.c |   19 +--
 1 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index 73a39ef..80de2f8 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -393,6 +393,14 @@ static int add_td_to_list(struct ci_hw_ep *hwep, struct 
ci_hw_req *hwreq,
node->ptr->token = cpu_to_le32(length << __ffs(TD_TOTAL_BYTES));
node->ptr->token &= cpu_to_le32(TD_TOTAL_BYTES);
node->ptr->token |= cpu_to_le32(TD_STATUS_ACTIVE);
+   if (hwep->type == USB_ENDPOINT_XFER_ISOC && hwep->dir == TX) {
+   u32 mul = hwreq->req.length / hwep->ep.maxpacket;
+
+   if (hwreq->req.length == 0
+   || hwreq->req.length % hwep->ep.maxpacket)
+   mul++;
+   node->ptr->token |= mul << __ffs(TD_MULTO);
+   }
 
temp = (u32) (hwreq->req.dma + hwreq->req.actual);
if (length) {
@@ -515,10 +523,11 @@ static int _hardware_enqueue(struct ci_hw_ep *hwep, 
struct ci_hw_req *hwreq)
hwep->qh.ptr->td.token &=
cpu_to_le32(~(TD_STATUS_HALTED|TD_STATUS_ACTIVE));
 
-   if (hwep->type == USB_ENDPOINT_XFER_ISOC) {
+   if (hwep->type == USB_ENDPOINT_XFER_ISOC && hwep->dir == RX) {
u32 mul = hwreq->req.length / hwep->ep.maxpacket;
 
-   if (hwreq->req.length % hwep->ep.maxpacket)
+   if (hwreq->req.length == 0
+   || hwreq->req.length % hwep->ep.maxpacket)
mul++;
hwep->qh.ptr->cap |= mul << __ffs(QH_MULT);
}
@@ -1173,6 +1182,12 @@ static int ep_enable(struct usb_ep *ep,
if (hwep->num)
cap |= QH_ZLT;
cap |= (hwep->ep.maxpacket << __ffs(QH_MAX_PKT)) & QH_MAX_PKT;
+   /*
+* For ISO-TX, we set mult at QH as the largest value, and use
+* MultO at TD as real mult value.
+*/
+   if (hwep->type == USB_ENDPOINT_XFER_ISOC && hwep->dir == TX)
+   cap |= 3 << __ffs(QH_MULT);
 
hwep->qh.ptr->cap = cpu_to_le32(cap);
 
-- 
1.7.8


--
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/7] USB Chipidea Patchset for 3.14

2014-01-09 Thread Peter Chen
Hi Greg,

This patchset add your comment that do not add IS_ENABLED for
imx28 special write patch [1/7, 2/7], the first five patches
have sent before, and the last two patches are bug fixes for
chipidea core.

Chris Ruehl (2):
  usb: chipidea: Fix Internal error: : 808 [#1] ARM related to STS flag
  usb: chipidea: put hw_phymode_configure before ci_usb_phy_init

Peter Chen (5):
  usb: ehci: add freescale imx28 special write register method
  usb: chipidea: add freescale imx28 special write register method
  usb: chipidea: imx: set CI_HDRC_IMX28_WRITE_FIX for imx28
  usb: chipidea: need to mask INT_STATUS when write otgsc
  usb: chipidea: udc: using MultO at TD as real mult value for ISO-TX

 drivers/usb/chipidea/ci.h  |   26 --
 drivers/usb/chipidea/ci_hdrc_imx.c |   32 ++--
 drivers/usb/chipidea/core.c|   14 +-
 drivers/usb/chipidea/host.c|1 +
 drivers/usb/chipidea/otg.h |6 +++---
 drivers/usb/chipidea/udc.c |   19 +--
 drivers/usb/host/ehci.h|   18 +-
 include/linux/usb/chipidea.h   |1 +
 8 files changed, 98 insertions(+), 19 deletions(-)

-- 
1.7.8


--
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: 3.13-rc2 phy-twl4030-usb.c - Timeout setting T2 HSUSB PHY DPLL

2014-01-09 Thread Belisko Marek
Hi,

On Fri, Jan 10, 2014 at 6:25 AM, Kishon Vijay Abraham I  wrote:
> Hi,
>
> On Thursday 09 January 2014 10:54 AM, Roger Quadros wrote:
>> Hi Marek,
>>
>> I have no idea what is happening there. Have you tried using device tree 
>> boot?
>> Board file boot support would be dropped eventually.
>>
>> Did you try if I2C read write to the twl4030 device works and all necessary 
>> clocks/supplies are
>> present?
>>
>> Kishon, do you know what is causing the USB DPLL failure there?
Issue was fixed. There was in 3.13-rc7 issue with unable to find phy
(phy was twl4030_usb). After that
issue is gone.
>
> Not sure what's causing those failures :-s
>
> -Kishon
>
>>
>> cheers,
>> -roger
>>
>> On 01/09/2014 02:31 AM, Belisko Marek wrote:
>>> Any pointers? Still present in 3.13-rc7.
>>>
>>> On Wed, Dec 4, 2013 at 1:22 PM, Roger Quadros  wrote:
 +Kishon

 On 12/03/2013 11:33 PM, Belisko Marek wrote:
> Hi,
>
> current 3.13-rcX break usb support on gta04 board (similar to
> beagleboard) when booting via board file.
>
> In console we can see messages:
>  [ 5227.287841] twl4030_usb twl4030_usb: Timeout setting T2 HSUSB PHY 
> DPLL clock
> [ 5232.936096] omap_musb_mailbox: musb core is not yet ready
> [ 5233.958160] twl4030_usb twl4030_usb: Timeout setting T2 HSUSB PHY DPLL 
> clock
> [ 5235.058227] twl4030_usb twl4030_usb: Timeout setting T2 HSUSB PHY DPLL 
> clock
>
> Any pointer what could cause that? (in 3.12 usb works fine)
>
> BR,
>
> marek
>

>>>
>>> BR,
>>>
>>> marek
>>>
>>
>

BR,

marek

-- 
as simple and primitive as possible
-
Marek Belisko - OPEN-NANDRA
Freelance Developer

Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
twitter: #opennandra
web: http://open-nandra.com
--
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-modem not working correctly

2014-01-09 Thread Bjørn Mork

Quoting Linus Gasser :


Le 09/01/14 14:27, Bjørn Mork a écrit :

Linus Gasser  writes:


I'm trying to get an USB-modem running on a Smileplug, which is some
Arm7-device, using it with the kernel 3.12-6. As far as I can tell
it's an USB3-port. It works well with harddisks, but when I plug in
USB-modems, it always fails sooner or later.


Do you have this problem with different modems?
You could try a powered hub to eliminate any power related problems.
But if the port can power a harddisk spinning up, then I guess it should
handle the 3G modem power spikes too.  Anyway, a hub is a cheap and
simple test.


I tried again - one modem seems to work fine,


That's good.  Modems crashing is unfortunately common, but
several different modems with extreme stability problems is still
somewhat unlikely.


while the other quits with a lot of

Jan 09 18:02:58 Profeda-new kernel: option1 ttyUSB0:  
option_instat_callback: error -71


But it doesn't disconnect!


-71 is -EPROTO, which tells us that the modem side of the USB transfer
failed.  I believe this only happens if the modem dies without disconnecting
from the bus.

So I think this is another type of firmware crash, unless there is some
other really weird stuff going on here.

They also run in an ethernet-mode (using cdc_ether), I'll also try  
that one (but it lacks some functions I need, like sending  
USSD-codes).


So if you have some debugging advice, I'd like to do it...



Sorry, I don't have any other suggestion than using the modems/firmwares
you have found to be working.


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