linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@verge.net.au>
To: linux-sh@vger.kernel.org
Subject: Re: [PATCH 3/4 v2] RM: shmobile: r8a7778: add r8a7778_add_usb_func_device()
Date: Wed, 10 Jul 2013 07:45:42 +0000	[thread overview]
Message-ID: <20130710074541.GC7313@verge.net.au> (raw)
In-Reply-To: <87siznuozu.wl%kuninori.morimoto.gx@renesas.com>

On Tue, Jul 09, 2013 at 10:20:50PM -0700, Kuninori Morimoto wrote:
> 
> Hi Simon
> 
> This Subject is using "RM", but it should be "ARM"
> Can I send v3 ?

Yes, please do.

> > This patch adds USB Function (= renesas_usbhs) driver support.
> > r8a7778_add_usb_phy_device()  should be called from .init_machine,
> > r8a7778_add_usb_func_device() should be called from .init_late
> > when platform use it.
> > 
> > This r8a7778_add_usb_func_device() will fill
> > renesas_usbhs_platform_info::platform_callback.get_id and
> > renesas_usbhs_platform_info::platform_callback.power_ctrl
> > if these callbacks were NULL, since these don't depend
> > on platform basically.
> > 
> > Tested-by: Yusuke Goda <yusuke.goda.sx@renesas.com>
> > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > ---
> > v1 -> v2
> > 
> >  - no change
> > 
> >  arch/arm/mach-shmobile/clock-r8a7778.c        |    1 +
> >  arch/arm/mach-shmobile/include/mach/r8a7778.h |    2 ++
> >  arch/arm/mach-shmobile/setup-r8a7778.c        |   39 +++++++++++++++++++++++++
> >  3 files changed, 42 insertions(+)
> > 
> > diff --git a/arch/arm/mach-shmobile/clock-r8a7778.c b/arch/arm/mach-shmobile/clock-r8a7778.c
> > index 53798e5..0d34282 100644
> > --- a/arch/arm/mach-shmobile/clock-r8a7778.c
> > +++ b/arch/arm/mach-shmobile/clock-r8a7778.c
> > @@ -148,6 +148,7 @@ static struct clk_lookup lookups[] = {
> >  	CLKDEV_DEV_ID("sh-eth",	&mstp_clks[MSTP114]), /* Ether */
> >  	CLKDEV_DEV_ID("ehci-platform", &mstp_clks[MSTP100]), /* USB EHCI port0/1 */
> >  	CLKDEV_DEV_ID("ohci-platform", &mstp_clks[MSTP100]), /* USB OHCI port0/1 */
> > +	CLKDEV_DEV_ID("renesas_usbhs", &mstp_clks[MSTP100]), /* USB FUNC */
> >  	CLKDEV_DEV_ID("i2c-rcar.0", &mstp_clks[MSTP030]), /* I2C0 */
> >  	CLKDEV_DEV_ID("i2c-rcar.1", &mstp_clks[MSTP029]), /* I2C1 */
> >  	CLKDEV_DEV_ID("i2c-rcar.2", &mstp_clks[MSTP028]), /* I2C2 */
> > diff --git a/arch/arm/mach-shmobile/include/mach/r8a7778.h b/arch/arm/mach-shmobile/include/mach/r8a7778.h
> > index 54e0132..5d894fd 100644
> > --- a/arch/arm/mach-shmobile/include/mach/r8a7778.h
> > +++ b/arch/arm/mach-shmobile/include/mach/r8a7778.h
> > @@ -22,6 +22,7 @@
> >  #include <linux/mmc/sh_mobile_sdhi.h>
> >  #include <linux/sh_eth.h>
> >  #include <linux/platform_data/usb-rcar-phy.h>
> > +#include <linux/usb/renesas_usbhs.h>
> >  
> >  extern void r8a7778_add_standard_devices(void);
> >  extern void r8a7778_add_standard_devices_dt(void);
> > @@ -32,6 +33,7 @@ extern void r8a7778_add_hspi_device(int id);
> >  extern void r8a7778_add_mmc_device(struct sh_mmcif_plat_data *info);
> >  extern void r8a7778_add_usb_phy_device(struct rcar_phy_platform_data *pdata);
> >  extern void r8a7778_add_usb_host_device(void);
> > +extern void r8a7778_add_usb_func_device(struct renesas_usbhs_platform_info *info);
> >  
> >  extern void r8a7778_init_late(void);
> >  extern void r8a7778_init_delay(void);
> > diff --git a/arch/arm/mach-shmobile/setup-r8a7778.c b/arch/arm/mach-shmobile/setup-r8a7778.c
> > index 9ea1e25..b059ccd 100644
> > --- a/arch/arm/mach-shmobile/setup-r8a7778.c
> > +++ b/arch/arm/mach-shmobile/setup-r8a7778.c
> > @@ -153,6 +153,7 @@ static void usb_power_off(struct platform_device *pdev)
> >  	pm_runtime_disable(&pdev->dev);
> >  }
> >  
> > +/* USB HOST */
> >  static int ehci_init_internal_buffer(struct usb_hcd *hcd)
> >  {
> >  	/*
> > @@ -211,6 +212,44 @@ void __init r8a7778_add_usb_host_device(void)
> >  	platform_device_register_full(&ohci_info);
> >  }
> >  
> > +/* USB Func */
> > +static int usbhsf_get_id(struct platform_device *pdev)
> > +{
> > +	return USBHS_GADGET;
> > +}
> > +
> > +#define SUSPMODE	0x102
> > +static int usbhsf_power_ctrl(struct platform_device *pdev,
> > +			     void __iomem *base, int enable)
> > +{
> > +	enable = !!enable;
> > +
> > +	r8a7778_usb_phy_power(enable);
> > +
> > +	iowrite16(enable << 14, base + SUSPMODE);
> > +
> > +	return 0;
> > +}
> > +
> > +static struct resource usbhsf_resources[] __initdata = {
> > +	DEFINE_RES_MEM(0xffe60000, 0x110),
> > +	DEFINE_RES_IRQ(gic_iid(0x4f)),
> > +};
> > +
> > +void __init
> > +r8a7778_add_usb_func_device(struct renesas_usbhs_platform_info *info)
> > +{
> > +	if (!info->platform_callback.get_id)
> > +		info->platform_callback.get_id = usbhsf_get_id;
> > +	if (!info->platform_callback.power_ctrl)
> > +		info->platform_callback.power_ctrl = usbhsf_power_ctrl;
> > +
> > +	platform_device_register_resndata(&platform_bus, "renesas_usbhs", -1,
> > +					  usbhsf_resources,
> > +					  ARRAY_SIZE(usbhsf_resources),
> > +					  info, sizeof(*info));
> > +}
> > +
> >  /* Ether */
> >  static struct resource ether_resources[] __initdata = {
> >  	DEFINE_RES_MEM(0xfde00000, 0x400),
> > -- 
> > 1.7.9.5
> > 
> 
> 
> Best regards
> ---
> Kuninori Morimoto
> 

  parent reply	other threads:[~2013-07-10  7:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-10  2:29 [PATCH 3/4 v2] RM: shmobile: r8a7778: add r8a7778_add_usb_func_device() Kuninori Morimoto
2013-07-10  5:20 ` Kuninori Morimoto
2013-07-10  7:45 ` Simon Horman [this message]
2013-07-10 12:02 ` Sergei Shtylyov

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=20130710074541.GC7313@verge.net.au \
    --to=horms@verge.net.au \
    --cc=linux-sh@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).