SUPERH platform development
 help / color / mirror / Atom feed
* [PATCH 3/3 v3] ARM: shmobile: bockw: add pinctrl support
@ 2013-04-12  5:38 Kuninori Morimoto
  2013-04-16  3:10 ` Simon Horman
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: Kuninori Morimoto @ 2013-04-12  5:38 UTC (permalink / raw)
  To: linux-sh

SCIF0 support as 1st step

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 arch/arm/mach-shmobile/board-bockw.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/arch/arm/mach-shmobile/board-bockw.c b/arch/arm/mach-shmobile/board-bockw.c
index 3e0b641..88fcdb3 100644
--- a/arch/arm/mach-shmobile/board-bockw.c
+++ b/arch/arm/mach-shmobile/board-bockw.c
@@ -18,6 +18,7 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <linux/pinctrl/machine.h>
 #include <linux/platform_device.h>
 #include <linux/regulator/fixed.h>
 #include <linux/regulator/machine.h>
@@ -53,6 +54,14 @@ static struct resource smsc911x_resources[] = {
 	DEFINE_RES_IRQ(irq_pin(0)), /* IRQ 0 */
 };
 
+static const struct pinctrl_map bockw_pinctrl_map[] = {
+	/* SCIF0 */
+	PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.0", "pfc-r8a7778",
+				  "scif0_data_a", "scif0"),
+	PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.0", "pfc-r8a7778",
+				  "scif0_ctrl", "scif0"),
+};
+
 #define IRQ0MR	0x30
 static void __init bockw_init(void)
 {
@@ -62,6 +71,10 @@ static void __init bockw_init(void)
 	r8a7778_init_irq_extpin(1);
 	r8a7778_add_standard_devices();
 
+	pinctrl_register_mappings(bockw_pinctrl_map,
+				  ARRAY_SIZE(bockw_pinctrl_map));
+	r8a7778_pinmux_init();
+
 	fpga = ioremap_nocache(0x18200000, SZ_1M);
 	if (fpga) {
 		/*
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/3 v3] ARM: shmobile: bockw: add pinctrl support
  2013-04-12  5:38 [PATCH 3/3 v3] ARM: shmobile: bockw: add pinctrl support Kuninori Morimoto
@ 2013-04-16  3:10 ` Simon Horman
  2013-04-19  3:09 ` [PATCH 3/3 v3] ARM: shmobile: bockw: add SDHI0 support Kuninori Morimoto
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Simon Horman @ 2013-04-16  3:10 UTC (permalink / raw)
  To: linux-sh

On Thu, Apr 11, 2013 at 10:38:03PM -0700, Kuninori Morimoto wrote:
> SCIF0 support as 1st step
> 
> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Thanks.

I have merged the soc-r8a7778 branch into the boards-bockw branch and
queued-up this patch for v3.11 there.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 3/3 v3] ARM: shmobile: bockw: add SDHI0 support
  2013-04-12  5:38 [PATCH 3/3 v3] ARM: shmobile: bockw: add pinctrl support Kuninori Morimoto
  2013-04-16  3:10 ` Simon Horman
@ 2013-04-19  3:09 ` Kuninori Morimoto
  2013-04-22  5:24 ` Simon Horman
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Kuninori Morimoto @ 2013-04-19  3:09 UTC (permalink / raw)
  To: linux-sh

This patch is directly accessing to PUPR4 register which can
control SDHI0 CD/WP pin pull-up setting.
It should be replaced in the future.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
v2 -> v3

 - used new sdhi pinctrl

 arch/arm/mach-shmobile/board-bockw.c |   35 ++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/arch/arm/mach-shmobile/board-bockw.c b/arch/arm/mach-shmobile/board-bockw.c
index 4d65715..3958910 100644
--- a/arch/arm/mach-shmobile/board-bockw.c
+++ b/arch/arm/mach-shmobile/board-bockw.c
@@ -18,6 +18,8 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <linux/mfd/tmio.h>
+#include <linux/mmc/host.h>
 #include <linux/pinctrl/machine.h>
 #include <linux/platform_device.h>
 #include <linux/regulator/fixed.h>
@@ -54,16 +56,34 @@ static struct resource smsc911x_resources[] = {
 	DEFINE_RES_IRQ(irq_pin(0)), /* IRQ 0 */
 };
 
+/* SDHI */
+static struct sh_mobile_sdhi_info sdhi0_info = {
+	.tmio_caps	= MMC_CAP_SD_HIGHSPEED,
+	.tmio_ocr_mask	= MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
+	.tmio_flags	= TMIO_MMC_HAS_IDLE_WAIT,
+};
+
 static const struct pinctrl_map bockw_pinctrl_map[] = {
 	/* SCIF0 */
 	PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.0", "pfc-r8a7778",
 				  "scif0_data_a", "scif0"),
 	PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.0", "pfc-r8a7778",
 				  "scif0_ctrl", "scif0"),
+	/* SDHI0 */
+	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7778",
+				  "sdhi0_cd", "sdhi0"),
+	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7778",
+				  "sdhi0_ctrl", "sdhi0"),
+	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7778",
+				  "sdhi0_data4", "sdhi0"),
+	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7778",
+				  "sdhi0_wp", "sdhi0"),
 };
 
 #define FPGA	0x18200000
 #define IRQ0MR	0x30
+#define PFC	0xfffc0000
+#define PUPR4	0x110
 static void __init bockw_init(void)
 {
 	void __iomem *base;
@@ -76,6 +96,7 @@ static void __init bockw_init(void)
 				  ARRAY_SIZE(bockw_pinctrl_map));
 	r8a7778_pinmux_init();
 
+	/* for SMSC */
 	base = ioremap_nocache(FPGA, SZ_1M);
 	if (base) {
 		/*
@@ -98,6 +119,20 @@ static void __init bockw_init(void)
 			smsc911x_resources, ARRAY_SIZE(smsc911x_resources),
 			&smsc911x_data, sizeof(smsc911x_data));
 	}
+
+	/* for SDHI */
+	base = ioremap_nocache(PFC, 0x200);
+	if (base) {
+		/*
+		 * FIXME
+		 *
+		 * SDHI CD/WP pin needs pull-up
+		 */
+		iowrite32(ioread32(base + PUPR4) | (3 << 26), base + PUPR4);
+		iounmap(base);
+
+		r8a7778_sdhi_init(0, &sdhi0_info);
+	}
 }
 
 static const char *bockw_boards_compat_dt[] __initdata = {
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/3 v3] ARM: shmobile: bockw: add SDHI0 support
  2013-04-12  5:38 [PATCH 3/3 v3] ARM: shmobile: bockw: add pinctrl support Kuninori Morimoto
  2013-04-16  3:10 ` Simon Horman
  2013-04-19  3:09 ` [PATCH 3/3 v3] ARM: shmobile: bockw: add SDHI0 support Kuninori Morimoto
@ 2013-04-22  5:24 ` Simon Horman
  2013-04-22 10:11 ` Laurent Pinchart
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Simon Horman @ 2013-04-22  5:24 UTC (permalink / raw)
  To: linux-sh

On Thu, Apr 18, 2013 at 08:09:32PM -0700, Kuninori Morimoto wrote:
> This patch is directly accessing to PUPR4 register which can
> control SDHI0 CD/WP pin pull-up setting.
> It should be replaced in the future.
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
> v2 -> v3
> 
>  - used new sdhi pinctrl
> 
>  arch/arm/mach-shmobile/board-bockw.c |   35 ++++++++++++++++++++++++++++++++++
>  1 file changed, 35 insertions(+)

I have merged the pinmux branch into the boards-bockw branch
and queued-up this patch for v3.11 there.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/3 v3] ARM: shmobile: bockw: add SDHI0 support
  2013-04-12  5:38 [PATCH 3/3 v3] ARM: shmobile: bockw: add pinctrl support Kuninori Morimoto
                   ` (2 preceding siblings ...)
  2013-04-22  5:24 ` Simon Horman
@ 2013-04-22 10:11 ` Laurent Pinchart
  2013-04-23  2:21 ` Simon Horman
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Laurent Pinchart @ 2013-04-22 10:11 UTC (permalink / raw)
  To: linux-sh

Hi Simon,

On Monday 22 April 2013 14:24:51 Simon Horman wrote:
> On Thu, Apr 18, 2013 at 08:09:32PM -0700, Kuninori Morimoto wrote:
> > This patch is directly accessing to PUPR4 register which can
> > control SDHI0 CD/WP pin pull-up setting.
> > It should be replaced in the future.
> > 
> > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > ---
> > v2 -> v3
> > 
> >  - used new sdhi pinctrl
> >  
> >  arch/arm/mach-shmobile/board-bockw.c |   35 +++++++++++++++++++++++++++++
> >  1 file changed, 35 insertions(+)
> 
> I have merged the pinmux branch into the boards-bockw branch
> and queued-up this patch for v3.11 there.

I'm afraid that was a bit too fast, 2/3 needs a v4.

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/3 v3] ARM: shmobile: bockw: add SDHI0 support
  2013-04-12  5:38 [PATCH 3/3 v3] ARM: shmobile: bockw: add pinctrl support Kuninori Morimoto
                   ` (3 preceding siblings ...)
  2013-04-22 10:11 ` Laurent Pinchart
@ 2013-04-23  2:21 ` Simon Horman
  2013-06-04 12:16 ` Simon Horman
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Simon Horman @ 2013-04-23  2:21 UTC (permalink / raw)
  To: linux-sh

On Mon, Apr 22, 2013 at 12:11:16PM +0200, Laurent Pinchart wrote:
> Hi Simon,
> 
> On Monday 22 April 2013 14:24:51 Simon Horman wrote:
> > On Thu, Apr 18, 2013 at 08:09:32PM -0700, Kuninori Morimoto wrote:
> > > This patch is directly accessing to PUPR4 register which can
> > > control SDHI0 CD/WP pin pull-up setting.
> > > It should be replaced in the future.
> > > 
> > > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > > ---
> > > v2 -> v3
> > > 
> > >  - used new sdhi pinctrl
> > >  
> > >  arch/arm/mach-shmobile/board-bockw.c |   35 +++++++++++++++++++++++++++++
> > >  1 file changed, 35 insertions(+)
> > 
> > I have merged the pinmux branch into the boards-bockw branch
> > and queued-up this patch for v3.11 there.
> 
> I'm afraid that was a bit too fast, 2/3 needs a v4.

Sorry about that.

However, I would prefer incremental changes rather than a v4.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/3 v3] ARM: shmobile: bockw: add SDHI0 support
  2013-04-12  5:38 [PATCH 3/3 v3] ARM: shmobile: bockw: add pinctrl support Kuninori Morimoto
                   ` (4 preceding siblings ...)
  2013-04-23  2:21 ` Simon Horman
@ 2013-06-04 12:16 ` Simon Horman
  2013-06-05  0:48 ` Kuninori Morimoto
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Simon Horman @ 2013-06-04 12:16 UTC (permalink / raw)
  To: linux-sh

On Mon, Apr 22, 2013 at 02:24:51PM +0900, Simon Horman wrote:
> On Thu, Apr 18, 2013 at 08:09:32PM -0700, Kuninori Morimoto wrote:
> > This patch is directly accessing to PUPR4 register which can
> > control SDHI0 CD/WP pin pull-up setting.
> > It should be replaced in the future.
> > 
> > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > ---
> > v2 -> v3
> > 
> >  - used new sdhi pinctrl
> > 
> >  arch/arm/mach-shmobile/board-bockw.c |   35 ++++++++++++++++++++++++++++++++++
> >  1 file changed, 35 insertions(+)
> 
> I have merged the pinmux branch into the boards-bockw branch
> and queued-up this patch for v3.11 there.

I have dropped this patch as it currently seems to be causing a build failure.
Please resolve this and re-post.

  CC      arch/arm/mach-shmobile/board-bockw.o
arch/arm/mach-shmobile/board-bockw.c:60: error: variable ‘sdhi0_info’ has initializer but incomplete type
arch/arm/mach-shmobile/board-bockw.c:61: error: unknown field ‘tmio_caps’ specified in initializer
arch/arm/mach-shmobile/board-bockw.c:61: warning: excess elements in struct initializer
arch/arm/mach-shmobile/board-bockw.c:61: warning: (near initialization for ‘sdhi0_info’)
arch/arm/mach-shmobile/board-bockw.c:62: error: unknown field ‘tmio_ocr_mask’ specified in initializer
arch/arm/mach-shmobile/board-bockw.c:62: warning: excess elements in struct initializer
arch/arm/mach-shmobile/board-bockw.c:62: warning: (near initialization for ‘sdhi0_info’)
arch/arm/mach-shmobile/board-bockw.c:63: error: unknown field ‘tmio_flags’ specified in initializer
arch/arm/mach-shmobile/board-bockw.c:63: warning: excess elements in struct initializer
arch/arm/mach-shmobile/board-bockw.c:63: warning: (near initialization for ‘sdhi0_info’)
arch/arm/mach-shmobile/board-bockw.c: In function ‘bockw_init’:
arch/arm/mach-shmobile/board-bockw.c:134: error: implicit declaration of function ‘r8a7778_sdhi_init’


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/3 v3] ARM: shmobile: bockw: add SDHI0 support
  2013-04-12  5:38 [PATCH 3/3 v3] ARM: shmobile: bockw: add pinctrl support Kuninori Morimoto
                   ` (5 preceding siblings ...)
  2013-06-04 12:16 ` Simon Horman
@ 2013-06-05  0:48 ` Kuninori Morimoto
  2013-06-05  2:03 ` Simon Horman
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Kuninori Morimoto @ 2013-06-05  0:48 UTC (permalink / raw)
  To: linux-sh


Hi Simon

Thank you for your reply

> > > This patch is directly accessing to PUPR4 register which can
> > > control SDHI0 CD/WP pin pull-up setting.
> > > It should be replaced in the future.
> > > 
> > > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > > ---
(snip)
> 
> I have dropped this patch as it currently seems to be causing a build failure.
> Please resolve this and re-post.
> 
>   CC      arch/arm/mach-shmobile/board-bockw.o
> arch/arm/mach-shmobile/board-bockw.c:60: error: variable ‘sdhi0_info’ has initializer but incomplete type
> arch/arm/mach-shmobile/board-bockw.c:61: error: unknown field ‘tmio_caps’ specified in initializer
> arch/arm/mach-shmobile/board-bockw.c:61: warning: excess elements in struct initializer
> arch/arm/mach-shmobile/board-bockw.c:61: warning: (near initialization for ‘sdhi0_info’)
> arch/arm/mach-shmobile/board-bockw.c:62: error: unknown field ‘tmio_ocr_mask’ specified in initializer
> arch/arm/mach-shmobile/board-bockw.c:62: warning: excess elements in struct initializer
> arch/arm/mach-shmobile/board-bockw.c:62: warning: (near initialization for ‘sdhi0_info’)
> arch/arm/mach-shmobile/board-bockw.c:63: error: unknown field ‘tmio_flags’ specified in initializer
> arch/arm/mach-shmobile/board-bockw.c:63: warning: excess elements in struct initializer
> arch/arm/mach-shmobile/board-bockw.c:63: warning: (near initialization for ‘sdhi0_info’)
> arch/arm/mach-shmobile/board-bockw.c: In function ‘bockw_init’:
> arch/arm/mach-shmobile/board-bockw.c:134: error: implicit declaration of function ‘r8a7778_sdhi_init’

Hmm... strange.
I couldn't get this error/warning.
I used renesas-next-20130604v2 + above patch,
but no error

---- my git log -----------------
commit c01ca82e8e49063135d6f6d44135716b04417a94
Author: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date:   Thu Apr 18 20:09:32 2013 -0700

    ARM: shmobile: bockw: add SDHI0 support
    
    This patch is directly accessing to PUPR4 register which can
    control SDHI0 CD/WP pin pull-up setting.
    It should be replaced in the future.
    
    Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

commit 58e3e8accf4f2e5f14a632dd51f5146de416524c
Merge: 2e05645 993b0e4
Author: Simon Horman <horms+renesas@verge.net.au>
Date:   Tue Jun 4 21:47:42 2013 +0900

    Merge branch 'heads/soc' into next
    
    Conflicts:
        arch/arm/mach-shmobile/Kconfig
        arch/arm/mach-shmobile/include/mach/r8a7778.h
        arch/arm/mach-shmobile/setup-r8a7778.c





Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/3 v3] ARM: shmobile: bockw: add SDHI0 support
  2013-04-12  5:38 [PATCH 3/3 v3] ARM: shmobile: bockw: add pinctrl support Kuninori Morimoto
                   ` (6 preceding siblings ...)
  2013-06-05  0:48 ` Kuninori Morimoto
@ 2013-06-05  2:03 ` Simon Horman
  2013-06-05  2:22 ` Kuninori Morimoto
  2013-08-02  1:03 ` [PATCH 3/3 v3] ARM: shmobile: bockw: add USB Function support Kuninori Morimoto
  9 siblings, 0 replies; 11+ messages in thread
From: Simon Horman @ 2013-06-05  2:03 UTC (permalink / raw)
  To: linux-sh

On Tue, Jun 04, 2013 at 05:48:18PM -0700, Kuninori Morimoto wrote:
> 
> Hi Simon
> 
> Thank you for your reply
> 
> > > > This patch is directly accessing to PUPR4 register which can
> > > > control SDHI0 CD/WP pin pull-up setting.
> > > > It should be replaced in the future.
> > > > 
> > > > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > > > ---
> (snip)
> > 
> > I have dropped this patch as it currently seems to be causing a build failure.
> > Please resolve this and re-post.
> > 
> >   CC      arch/arm/mach-shmobile/board-bockw.o
> > arch/arm/mach-shmobile/board-bockw.c:60: error: variable ‘sdhi0_info’ has initializer but incomplete type
> > arch/arm/mach-shmobile/board-bockw.c:61: error: unknown field ‘tmio_caps’ specified in initializer
> > arch/arm/mach-shmobile/board-bockw.c:61: warning: excess elements in struct initializer
> > arch/arm/mach-shmobile/board-bockw.c:61: warning: (near initialization for ‘sdhi0_info’)
> > arch/arm/mach-shmobile/board-bockw.c:62: error: unknown field ‘tmio_ocr_mask’ specified in initializer
> > arch/arm/mach-shmobile/board-bockw.c:62: warning: excess elements in struct initializer
> > arch/arm/mach-shmobile/board-bockw.c:62: warning: (near initialization for ‘sdhi0_info’)
> > arch/arm/mach-shmobile/board-bockw.c:63: error: unknown field ‘tmio_flags’ specified in initializer
> > arch/arm/mach-shmobile/board-bockw.c:63: warning: excess elements in struct initializer
> > arch/arm/mach-shmobile/board-bockw.c:63: warning: (near initialization for ‘sdhi0_info’)
> > arch/arm/mach-shmobile/board-bockw.c: In function ‘bockw_init’:
> > arch/arm/mach-shmobile/board-bockw.c:134: error: implicit declaration of function ‘r8a7778_sdhi_init’
> 
> Hmm... strange.
> I couldn't get this error/warning.
> I used renesas-next-20130604v2 + above patch,
> but no error

Thanks.

The problem that I was seeing was that I was missing some SoC patches.
I have resolved that and re-queued-up your patch

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/3 v3] ARM: shmobile: bockw: add SDHI0 support
  2013-04-12  5:38 [PATCH 3/3 v3] ARM: shmobile: bockw: add pinctrl support Kuninori Morimoto
                   ` (7 preceding siblings ...)
  2013-06-05  2:03 ` Simon Horman
@ 2013-06-05  2:22 ` Kuninori Morimoto
  2013-08-02  1:03 ` [PATCH 3/3 v3] ARM: shmobile: bockw: add USB Function support Kuninori Morimoto
  9 siblings, 0 replies; 11+ messages in thread
From: Kuninori Morimoto @ 2013-06-05  2:22 UTC (permalink / raw)
  To: linux-sh


Hi Simon

> > Hmm... strange.
> > I couldn't get this error/warning.
> > I used renesas-next-20130604v2 + above patch,
> > but no error
> 
> Thanks.
> 
> The problem that I was seeing was that I was missing some SoC patches.
> I have resolved that and re-queued-up your patch

Thank you !


Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 3/3 v3] ARM: shmobile: bockw: add USB Function support
  2013-04-12  5:38 [PATCH 3/3 v3] ARM: shmobile: bockw: add pinctrl support Kuninori Morimoto
                   ` (8 preceding siblings ...)
  2013-06-05  2:22 ` Kuninori Morimoto
@ 2013-08-02  1:03 ` Kuninori Morimoto
  9 siblings, 0 replies; 11+ messages in thread
From: Kuninori Morimoto @ 2013-08-02  1:03 UTC (permalink / raw)
  To: linux-sh

Bock-W USB1 (CN29) can be USB Host/Func by SW98/SW99 settings.
USB Func will be enabled if CONFIG_USB_RENESAS_USBHS_UDC[_MODULE]
was selected on this patch

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
v2 -> v3

 - pdata had __initdata
 - ADD_USB_FUNC_DEVICE_IF_POSSIBLE -> ADD_USB_FUNC_DEVICE_IF_POSSIBLE()

 arch/arm/mach-shmobile/board-bockw.c |   81 ++++++++++++++++++++++++++++++++--
 1 file changed, 78 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-shmobile/board-bockw.c b/arch/arm/mach-shmobile/board-bockw.c
index 07009f5..8094803 100644
--- a/arch/arm/mach-shmobile/board-bockw.c
+++ b/arch/arm/mach-shmobile/board-bockw.c
@@ -31,6 +31,7 @@
 #include <linux/smsc911x.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/flash.h>
+#include <linux/usb/renesas_usbhs.h>
 #include <mach/common.h>
 #include <mach/irqs.h>
 #include <mach/r8a7778.h>
@@ -61,6 +62,16 @@
  * SW19	(MMC)	1 pin
  */
 
+/*
+ * USB
+ *
+ * USB1 (CN29) can be Host/Function
+ *
+ *		Host	Func
+ * SW98		1	2
+ * SW99		1	3
+ */
+
 /* Dummy supplies, where voltage doesn't matter */
 static struct regulator_consumer_supply dummy_supplies[] = {
 	REGULATOR_SUPPLY("vddvario", "smsc911x"),
@@ -79,13 +90,71 @@ static struct resource smsc911x_resources[] = {
 	DEFINE_RES_IRQ(irq_pin(0)), /* IRQ 0 */
 };
 
+#if IS_ENABLED(CONFIG_USB_RENESAS_USBHS_UDC)
+/*
+ * When USB1 is 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)),
+};
+
+static struct renesas_usbhs_platform_info usbhs_info __initdata = {
+	.platform_callback = {
+		.get_id		= usbhsf_get_id,
+		.power_ctrl	= usbhsf_power_ctrl,
+	},
+	.driver_param = {
+		.buswait_bwait	= 4,
+	},
+};
+
+#define USB_PHY_SETTING {.port1_func = 1, .ovc_pin[1].active_high = 1,}
+#define USB1_DEVICE	"renesas_usbhs"
+#define ADD_USB_FUNC_DEVICE_IF_POSSIBLE()			\
+	platform_device_register_resndata(			\
+		&platform_bus, "renesas_usbhs", -1,		\
+		usbhsf_resources,				\
+		ARRAY_SIZE(usbhsf_resources),			\
+		&usbhs_info, sizeof(struct renesas_usbhs_platform_info))
+
+#else
+/*
+ * When USB1 is Host
+ */
+#define USB_PHY_SETTING { }
+#define USB1_DEVICE	"ehci-platform"
+#define ADD_USB_FUNC_DEVICE_IF_POSSIBLE()
+
+#endif
+
 /* USB */
 static struct resource usb_phy_resources[] __initdata = {
 	DEFINE_RES_MEM(0xffe70800, 0x100),
 	DEFINE_RES_MEM(0xffe76000, 0x100),
 };
 
-static struct rcar_phy_platform_data usb_phy_platform_data __initdata;
+static struct rcar_phy_platform_data usb_phy_platform_data __initdata +	USB_PHY_SETTING;
+
 
 /* SDHI */
 static struct sh_mobile_sdhi_info sdhi0_info = {
@@ -181,7 +250,7 @@ static const struct pinctrl_map bockw_pinctrl_map[] = {
 	/* USB */
 	PIN_MAP_MUX_GROUP_DEFAULT("ehci-platform", "pfc-r8a7778",
 				  "usb0", "usb0"),
-	PIN_MAP_MUX_GROUP_DEFAULT("ehci-platform", "pfc-r8a7778",
+	PIN_MAP_MUX_GROUP_DEFAULT(USB1_DEVICE, "pfc-r8a7778",
 				  "usb1", "usb1"),
 	/* SDHI0 */
 	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7778",
@@ -270,6 +339,12 @@ static void __init bockw_init(void)
 	}
 }
 
+static void __init bockw_init_late(void)
+{
+	r8a7778_init_late();
+	ADD_USB_FUNC_DEVICE_IF_POSSIBLE();
+}
+
 static const char *bockw_boards_compat_dt[] __initdata = {
 	"renesas,bockw",
 	NULL,
@@ -281,5 +356,5 @@ DT_MACHINE_START(BOCKW_DT, "bockw")
 	.init_machine	= bockw_init,
 	.init_time	= shmobile_timer_init,
 	.dt_compat	= bockw_boards_compat_dt,
-	.init_late      = r8a7778_init_late,
+	.init_late      = bockw_init_late,
 MACHINE_END
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-08-02  1:03 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-12  5:38 [PATCH 3/3 v3] ARM: shmobile: bockw: add pinctrl support Kuninori Morimoto
2013-04-16  3:10 ` Simon Horman
2013-04-19  3:09 ` [PATCH 3/3 v3] ARM: shmobile: bockw: add SDHI0 support Kuninori Morimoto
2013-04-22  5:24 ` Simon Horman
2013-04-22 10:11 ` Laurent Pinchart
2013-04-23  2:21 ` Simon Horman
2013-06-04 12:16 ` Simon Horman
2013-06-05  0:48 ` Kuninori Morimoto
2013-06-05  2:03 ` Simon Horman
2013-06-05  2:22 ` Kuninori Morimoto
2013-08-02  1:03 ` [PATCH 3/3 v3] ARM: shmobile: bockw: add USB Function support Kuninori Morimoto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox