All of lore.kernel.org
 help / color / mirror / Atom feed
From: peter.chen@freescale.com (Peter Chen)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 05/12] usb: chipidea: introduce ci_platform_config
Date: Fri, 20 Mar 2015 10:36:33 +0800	[thread overview]
Message-ID: <20150320023632.GB7537@shlinux2> (raw)
In-Reply-To: <20150319101929.GC9894@pengutronix.de>

On Thu, Mar 19, 2015 at 11:19:29AM +0100, Michael Grzeschik wrote:
> On Thu, Mar 19, 2015 at 09:19:16AM +0800, Peter Chen wrote:
> > It is used to configure controller parameters according to
> > platform data, like speed, interrupt threshold, stream mode, etc.
> > 
> > Signed-off-by: Peter Chen <peter.chen@freescale.com>
> > ---
> >  drivers/usb/chipidea/ci.h   |  2 ++
> >  drivers/usb/chipidea/core.c | 57 +++++++++++++++++++++++++++++++--------------
> >  drivers/usb/chipidea/host.c |  6 +----
> >  3 files changed, 43 insertions(+), 22 deletions(-)
> > 
> > diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
> > index aeec5f0..888606b 100644
> > --- a/drivers/usb/chipidea/ci.h
> > +++ b/drivers/usb/chipidea/ci.h
> > @@ -426,4 +426,6 @@ u8 hw_port_test_get(struct ci_hdrc *ci);
> >  int hw_wait_reg(struct ci_hdrc *ci, enum ci_hw_regs reg, u32 mask,
> >  				u32 value, unsigned int timeout_ms);
> >  
> > +void ci_platform_config(struct ci_hdrc *ci, int usb_mode);
> > +
> >  #endif	/* __DRIVERS_USB_CHIPIDEA_CI_H */
> > diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> > index 4d79392..f713e32 100644
> > --- a/drivers/usb/chipidea/core.c
> > +++ b/drivers/usb/chipidea/core.c
> > @@ -403,6 +403,44 @@ static int ci_usb_phy_init(struct ci_hdrc *ci)
> >  	return ret;
> >  }
> >  
> > +
> > +/**
> > + * ci_platform_config: do controller configure
> > + * @ci: the controller
> > + * @usb_mode: the usb mode
> > + *
> > + */
> > +void ci_platform_config(struct ci_hdrc *ci, int usb_mode)
> > +{
> > +	if (usb_mode == USBMODE_CM_DC) {
> > +		if (ci->platdata->flags & CI_HDRC_DISABLE_DEVICE_STREAMING)
> > +			hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS,
> > +					USBMODE_CI_SDIS);
> > +
> > +		/*
> > +		 * Set interrupt interval for device mode
> > +		 * host set ITC according to ehci-hcd module
> > +		 * parameter log2_irq_thresh
> > +		 */
> > +		hw_write(ci, OP_USBCMD, 0xff0000,
> > +			ci->platdata->gadget_itc_setting << 16);
> > +	} else if (usb_mode == USBMODE_CM_HC) {
> > +		if (ci->platdata->flags & CI_HDRC_DISABLE_HOST_STREAMING)
> > +			hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS,
> > +					USBMODE_CI_SDIS);
> > +	} else {
> > +		dev_warn(ci->dev, "USB mode in still not set\n");
> > +	}
> > +
> > +	if (ci->platdata->flags & CI_HDRC_FORCE_FULLSPEED) {
> > +		if (ci->hw_bank.lpm)
> > +			hw_write(ci, OP_DEVLC, DEVLC_PFSC, DEVLC_PFSC);
> > +		else
> > +			hw_write(ci, OP_PORTSC, PORTSC_PFSC, PORTSC_PFSC);
> > +	}
> > +
> > +}
> > +
> >  /**
> >   * hw_controller_reset: do controller reset
> >   * @ci: the controller
> > @@ -447,35 +485,20 @@ int hw_device_reset(struct ci_hdrc *ci)
> >  		ci->platdata->notify_event(ci,
> >  			CI_HDRC_CONTROLLER_RESET_EVENT);
> >  
> > -	if (ci->platdata->flags & CI_HDRC_DISABLE_DEVICE_STREAMING)
> > -		hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS, USBMODE_CI_SDIS);
> > -
> > -	if (ci->platdata->flags & CI_HDRC_FORCE_FULLSPEED) {
> > -		if (ci->hw_bank.lpm)
> > -			hw_write(ci, OP_DEVLC, DEVLC_PFSC, DEVLC_PFSC);
> > -		else
> > -			hw_write(ci, OP_PORTSC, PORTSC_PFSC, PORTSC_PFSC);
> > -	}
> > -
> >  	/* USBMODE should be configured step by step */
> >  	hw_write(ci, OP_USBMODE, USBMODE_CM, USBMODE_CM_IDLE);
> >  	hw_write(ci, OP_USBMODE, USBMODE_CM, USBMODE_CM_DC);
> >  	/* HW >= 2.3 */
> >  	hw_write(ci, OP_USBMODE, USBMODE_SLOM, USBMODE_SLOM);
> >  
> > -	/*
> > -	 * Set interrupt interval for device mode
> > -	 * host set ITC according to ehci-hcd module parameter log2_irq_thresh
> > -	 */
> > -	hw_write(ci, OP_USBCMD, 0xff0000,
> > -		ci->platdata->gadget_itc_setting << 16);
> > -
> 
> This codepath was added by patch 02 "usb: chipidea: set ITC to 0 for
> device mode". You should add it after this one, so this code gets added
> directly to its final position.
> 

Thanks, I will add ITC tuning as the first user for ci_platform_config

Peter
> >  	if (hw_read(ci, OP_USBMODE, USBMODE_CM) != USBMODE_CM_DC) {
> >  		pr_err("cannot enter in %s device mode", ci_role(ci)->name);
> >  		pr_err("lpm = %i", ci->hw_bank.lpm);
> >  		return -ENODEV;
> >  	}
> >  
> > +	ci_platform_config(ci, USBMODE_CM_DC);
> > +
> >  	return 0;
> >  }
> >  
> > diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c
> > index b262c1c..c4f76b7 100644
> > --- a/drivers/usb/chipidea/host.c
> > +++ b/drivers/usb/chipidea/host.c
> > @@ -141,11 +141,7 @@ static int host_start(struct ci_hdrc *ci)
> >  		}
> >  	}
> >  
> > -	if (ci->platdata->flags & CI_HDRC_FORCE_FULLSPEED)
> > -		hw_write(ci, OP_PORTSC, PORTSC_PFSC, PORTSC_PFSC);
> > -
> > -	if (ci->platdata->flags & CI_HDRC_DISABLE_HOST_STREAMING)
> > -		hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS, USBMODE_CI_SDIS);
> > +	ci_platform_config(ci, USBMODE_CM_HC);
> >  
> >  	return ret;
> >  
> > -- 
> > 1.9.1
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> > the body of a message to majordomo at vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > 
> 
> -- 
> 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-5555 |

-- 

Best Regards,
Peter Chen

WARNING: multiple messages have this Message-ID (diff)
From: Peter Chen <peter.chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
To: Michael Grzeschik <mgr-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Cc: shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	pawel.moll-5wv7dgnIgG8@public.gmane.org,
	mark.rutland-5wv7dgnIgG8@public.gmane.org
Subject: Re: [PATCH 05/12] usb: chipidea: introduce ci_platform_config
Date: Fri, 20 Mar 2015 10:36:33 +0800	[thread overview]
Message-ID: <20150320023632.GB7537@shlinux2> (raw)
In-Reply-To: <20150319101929.GC9894-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

On Thu, Mar 19, 2015 at 11:19:29AM +0100, Michael Grzeschik wrote:
> On Thu, Mar 19, 2015 at 09:19:16AM +0800, Peter Chen wrote:
> > It is used to configure controller parameters according to
> > platform data, like speed, interrupt threshold, stream mode, etc.
> > 
> > Signed-off-by: Peter Chen <peter.chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
> > ---
> >  drivers/usb/chipidea/ci.h   |  2 ++
> >  drivers/usb/chipidea/core.c | 57 +++++++++++++++++++++++++++++++--------------
> >  drivers/usb/chipidea/host.c |  6 +----
> >  3 files changed, 43 insertions(+), 22 deletions(-)
> > 
> > diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
> > index aeec5f0..888606b 100644
> > --- a/drivers/usb/chipidea/ci.h
> > +++ b/drivers/usb/chipidea/ci.h
> > @@ -426,4 +426,6 @@ u8 hw_port_test_get(struct ci_hdrc *ci);
> >  int hw_wait_reg(struct ci_hdrc *ci, enum ci_hw_regs reg, u32 mask,
> >  				u32 value, unsigned int timeout_ms);
> >  
> > +void ci_platform_config(struct ci_hdrc *ci, int usb_mode);
> > +
> >  #endif	/* __DRIVERS_USB_CHIPIDEA_CI_H */
> > diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> > index 4d79392..f713e32 100644
> > --- a/drivers/usb/chipidea/core.c
> > +++ b/drivers/usb/chipidea/core.c
> > @@ -403,6 +403,44 @@ static int ci_usb_phy_init(struct ci_hdrc *ci)
> >  	return ret;
> >  }
> >  
> > +
> > +/**
> > + * ci_platform_config: do controller configure
> > + * @ci: the controller
> > + * @usb_mode: the usb mode
> > + *
> > + */
> > +void ci_platform_config(struct ci_hdrc *ci, int usb_mode)
> > +{
> > +	if (usb_mode == USBMODE_CM_DC) {
> > +		if (ci->platdata->flags & CI_HDRC_DISABLE_DEVICE_STREAMING)
> > +			hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS,
> > +					USBMODE_CI_SDIS);
> > +
> > +		/*
> > +		 * Set interrupt interval for device mode
> > +		 * host set ITC according to ehci-hcd module
> > +		 * parameter log2_irq_thresh
> > +		 */
> > +		hw_write(ci, OP_USBCMD, 0xff0000,
> > +			ci->platdata->gadget_itc_setting << 16);
> > +	} else if (usb_mode == USBMODE_CM_HC) {
> > +		if (ci->platdata->flags & CI_HDRC_DISABLE_HOST_STREAMING)
> > +			hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS,
> > +					USBMODE_CI_SDIS);
> > +	} else {
> > +		dev_warn(ci->dev, "USB mode in still not set\n");
> > +	}
> > +
> > +	if (ci->platdata->flags & CI_HDRC_FORCE_FULLSPEED) {
> > +		if (ci->hw_bank.lpm)
> > +			hw_write(ci, OP_DEVLC, DEVLC_PFSC, DEVLC_PFSC);
> > +		else
> > +			hw_write(ci, OP_PORTSC, PORTSC_PFSC, PORTSC_PFSC);
> > +	}
> > +
> > +}
> > +
> >  /**
> >   * hw_controller_reset: do controller reset
> >   * @ci: the controller
> > @@ -447,35 +485,20 @@ int hw_device_reset(struct ci_hdrc *ci)
> >  		ci->platdata->notify_event(ci,
> >  			CI_HDRC_CONTROLLER_RESET_EVENT);
> >  
> > -	if (ci->platdata->flags & CI_HDRC_DISABLE_DEVICE_STREAMING)
> > -		hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS, USBMODE_CI_SDIS);
> > -
> > -	if (ci->platdata->flags & CI_HDRC_FORCE_FULLSPEED) {
> > -		if (ci->hw_bank.lpm)
> > -			hw_write(ci, OP_DEVLC, DEVLC_PFSC, DEVLC_PFSC);
> > -		else
> > -			hw_write(ci, OP_PORTSC, PORTSC_PFSC, PORTSC_PFSC);
> > -	}
> > -
> >  	/* USBMODE should be configured step by step */
> >  	hw_write(ci, OP_USBMODE, USBMODE_CM, USBMODE_CM_IDLE);
> >  	hw_write(ci, OP_USBMODE, USBMODE_CM, USBMODE_CM_DC);
> >  	/* HW >= 2.3 */
> >  	hw_write(ci, OP_USBMODE, USBMODE_SLOM, USBMODE_SLOM);
> >  
> > -	/*
> > -	 * Set interrupt interval for device mode
> > -	 * host set ITC according to ehci-hcd module parameter log2_irq_thresh
> > -	 */
> > -	hw_write(ci, OP_USBCMD, 0xff0000,
> > -		ci->platdata->gadget_itc_setting << 16);
> > -
> 
> This codepath was added by patch 02 "usb: chipidea: set ITC to 0 for
> device mode". You should add it after this one, so this code gets added
> directly to its final position.
> 

Thanks, I will add ITC tuning as the first user for ci_platform_config

Peter
> >  	if (hw_read(ci, OP_USBMODE, USBMODE_CM) != USBMODE_CM_DC) {
> >  		pr_err("cannot enter in %s device mode", ci_role(ci)->name);
> >  		pr_err("lpm = %i", ci->hw_bank.lpm);
> >  		return -ENODEV;
> >  	}
> >  
> > +	ci_platform_config(ci, USBMODE_CM_DC);
> > +
> >  	return 0;
> >  }
> >  
> > diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c
> > index b262c1c..c4f76b7 100644
> > --- a/drivers/usb/chipidea/host.c
> > +++ b/drivers/usb/chipidea/host.c
> > @@ -141,11 +141,7 @@ static int host_start(struct ci_hdrc *ci)
> >  		}
> >  	}
> >  
> > -	if (ci->platdata->flags & CI_HDRC_FORCE_FULLSPEED)
> > -		hw_write(ci, OP_PORTSC, PORTSC_PFSC, PORTSC_PFSC);
> > -
> > -	if (ci->platdata->flags & CI_HDRC_DISABLE_HOST_STREAMING)
> > -		hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS, USBMODE_CI_SDIS);
> > +	ci_platform_config(ci, USBMODE_CM_HC);
> >  
> >  	return ret;
> >  
> > -- 
> > 1.9.1
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> > the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > 
> 
> -- 
> 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-5555 |

-- 

Best Regards,
Peter Chen
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2015-03-20  2:36 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-19  1:19 [PATCH 00/12] USB: chipidea: patchset for performance improvement Peter Chen
2015-03-19  1:19 ` Peter Chen
2015-03-19  1:19 ` [PATCH 01/12] Doc: usb: ci-hdrc-imx: add gadget-itc-setting for binding doc Peter Chen
2015-03-19  1:19   ` Peter Chen
2015-03-19  1:19 ` [PATCH 02/12] usb: chipidea: set ITC to 0 for device mode Peter Chen
2015-03-19  1:19   ` Peter Chen
2015-03-19  1:19 ` [PATCH 03/12] usb: chipidea: define stream mode disable for both roles Peter Chen
2015-03-19  1:19   ` Peter Chen
2015-03-19  1:19 ` [PATCH 04/12] usb: chipidea: imx: add stream mode enable for device mode at imx6sl/imx6sx Peter Chen
2015-03-19  1:19   ` Peter Chen
2015-03-19  1:19 ` [PATCH 05/12] usb: chipidea: introduce ci_platform_config Peter Chen
2015-03-19  1:19   ` Peter Chen
2015-03-19 10:19   ` Michael Grzeschik
2015-03-19 10:19     ` Michael Grzeschik
2015-03-20  2:36     ` Peter Chen [this message]
2015-03-20  2:36       ` Peter Chen
2015-03-19  1:19 ` [PATCH 06/12] Doc: usb: ci-hdrc-imx: add ahb-burst-config for binding doc Peter Chen
2015-03-19  1:19   ` Peter Chen
2015-03-19  1:19 ` [PATCH 07/12] ARM: imx6: set ahb-burst-config as 0 for USB Peter Chen
2015-03-19  1:19   ` Peter Chen
2015-03-19  1:19 ` [PATCH 08/12] usb: chipidea: add ahb burst configuration Peter Chen
2015-03-19  1:19   ` Peter Chen
2015-03-19  1:19 ` [PATCH 09/12] usb: chipidea: usbmisc_imx: add unburst setting for imx6 Peter Chen
2015-03-19  1:19   ` Peter Chen
2015-03-19  1:19 ` [PATCH 10/12] Doc: usb: ci-hdrc-imx: add tx(rx)-burst-config-dword for binding doc Peter Chen
2015-03-19  1:19   ` Peter Chen
2015-03-19  1:19 ` [PATCH 11/12] ARM: imx6: change default burst size for USB Peter Chen
2015-03-19  1:19   ` Peter Chen
2015-03-19  1:19 ` [PATCH 12/12] usb: chipidea: add burst size configuration interface Peter Chen
2015-03-19  1:19   ` Peter Chen
2015-03-19 10:36 ` [PATCH 00/12] USB: chipidea: patchset for performance improvement Jean-Christophe PLAGNIOL-VILLARD
2015-03-19 10:36   ` Jean-Christophe PLAGNIOL-VILLARD
2015-03-20  2:33   ` Peter Chen
2015-03-20  2:33     ` Peter Chen
2015-03-24 10:32 ` victorascroft at gmail.com
2015-03-24 10:32   ` victorascroft-Re5JQEeQqe8AvxtiuMwx3w
2015-03-24 12:21   ` Peter Chen
2015-03-24 12:21     ` Peter Chen
2015-03-26  8:34     ` victorascroft at gmail.com
2015-03-26  8:34       ` victorascroft-Re5JQEeQqe8AvxtiuMwx3w

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150320023632.GB7537@shlinux2 \
    --to=peter.chen@freescale.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.