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

2014-01-16 Thread b47...@freescale.com
-Original Message-
From: Michael Grzeschik [mailto:m...@pengutronix.de] 
Sent: Friday, January 10, 2014 9:48 PM
To: Li Jun-B47624
Cc: ba...@ti.com; Chen Peter-B29397; linux-usb@vger.kernel.org
Subject: Re: [PATCH 06/10] usb: chipidea: OTG fsm timers initialization.

Hi Li Jun,

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 in otg_fsm_timer list.
 
 Signed-off-by: Li Jun b47...@freescale.com
 ---
  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;
 +

One patch should not change code that another patch in that same series is 
introducing. These hunk seems to belong to the previous patch.
[Li Jun] You are right, I will re-split my patch set to resolve this, thanks!


-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |


--
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 06/10] usb: chipidea: OTG fsm timers initialization.

2014-01-16 Thread David Cohen
 Hi Li Jun,

Hi Li Jun,

 
 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 in otg_fsm_timer list.
  
  Signed-off-by: Li Jun b47...@freescale.com
  ---
   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;
  +
 
 One patch should not change code that another patch in that same series is 
 introducing. These hunk seems to belong to the previous patch.
 [Li Jun] You are right, I will re-split my patch set to resolve this, thanks!

It's difficult to read the e-mails you reply. Please, consider to quote
the text messages you're replying to.

Br, David Cohen

--
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 06/10] usb: chipidea: OTG fsm timers initialization.

2014-01-10 Thread Michael Grzeschik
Hi Li Jun,

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
 in otg_fsm_timer list.
 
 Signed-off-by: Li Jun b47...@freescale.com
 ---
  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;
 +

One patch should not change code that another patch
in that same series is introducing. These hunk seems to
belong to the previous patch.

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
--
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 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 b47...@freescale.com
 ---
  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_ops ci_otg_ops = {
  
  int ci_hdrc_otg_fsm_init(struct ci_hdrc *ci)
  {
 + int retval = 0;
 +
   if (ci-transceiver == NULL)