linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 5/6] arm: shmobile: lager: Add internal PCI support
@ 2013-10-01 18:30 Valentine Barshak
  2013-10-02  0:18 ` Kuninori Morimoto
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Valentine Barshak @ 2013-10-01 18:30 UTC (permalink / raw)
  To: linux-sh

This adds internal PCI/USB host support to Lager board.
There are 3 internal PCI bus controllers with only a EHCI/OHCI
device present on each one. This gives us 3 USB host channels.
Channel 0 is shared with the USBHS function module.
Channel 2 is shared with the USBSS (XHCI) device.

Currently no channel configuration is supported,
and the default settings are assumed:
Channel 0 - USBHS
Channel 1 - PCI/USB host
Channel 2 - PCI/USB host

Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
---
 arch/arm/mach-shmobile/board-lager.c | 41 +++++++++++++++++++++++++++++++++++-
 1 file changed, 40 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
index e408fc7..08236fb 100644
--- a/arch/arm/mach-shmobile/board-lager.c
+++ b/arch/arm/mach-shmobile/board-lager.c
@@ -303,6 +303,38 @@ static struct usbhs_private usbhs_priv __initdata = {
 #define lager_register_usbhs()
 #endif	/* CONFIG_USB_RENESAS_USBHS_UDC */
 
+/*
+ * Internal PCI
+ * There are 3 internal PCI bus controllers with only a EHCI/OHCI
+ * device present on each one. This gives us 3 USB host channels.
+ * Channel 0 is shared with the USBHS function module.
+ * Channel 2 is shared with the USBSS (XHCI) device.
+ */
+#if IS_ENABLED(CONFIG_PCI)
+static const struct resource pci_resources[] __initconst = {
+	/* Internal PCI0 */
+	DEFINE_RES_MEM_NAMED(0xee080000, 0x10000, "PCI0 MEM"),
+	DEFINE_RES_MEM_NAMED(0xee090000, 0x10000, "PCI0 CFG"),
+	DEFINE_RES_IRQ(gic_spi(108)),
+	/* Internal PCI1 */
+	DEFINE_RES_MEM_NAMED(0xee0a0000, 0x10000, "PCI1 MEM"),
+	DEFINE_RES_MEM_NAMED(0xee0b0000, 0x10000, "PCI1 CFG"),
+	DEFINE_RES_IRQ(gic_spi(112)),
+	/* Internal PCI2 */
+	DEFINE_RES_MEM_NAMED(0xee0c0000, 0x10000, "PCI2 MEM"),
+	DEFINE_RES_MEM_NAMED(0xee0d0000, 0x10000, "PCI2 CFG"),
+	DEFINE_RES_IRQ(gic_spi(113)),
+};
+
+#define lager_register_pci()						\
+	platform_device_register_simple("pci-rcar-gen2",		\
+					-1, pci_resources,		\
+					ARRAY_SIZE(pci_resources))
+}
+#else	/* CONFIG_PCI */
+#define lager_register_pci()
+#endif	/* CONFIG_PCI */
+
 static const struct pinctrl_map lager_pinctrl_map[] = {
 	/* DU (CN10: ARGB0, CN13: LVDS) */
 	PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7790", "pfc-r8a7790",
@@ -332,8 +364,14 @@ static const struct pinctrl_map lager_pinctrl_map[] = {
 	PIN_MAP_MUX_GROUP_DEFAULT("r8a7790-ether", "pfc-r8a7790",
 				  "intc_irq0", "intc"),
 	/* USB0 */
-	PIN_MAP_MUX_GROUP_DEFAULT("renesas_usbhs", "pfc-r8a7790",
+	PIN_MAP_MUX_GROUP_DEFAULT(LAGER_USB0_DEVNAME, "pfc-r8a7790",
 				  "usb0", "usb0"),
+	/* USB1 */
+	PIN_MAP_MUX_GROUP_DEFAULT("pci-rcar-gen2", "pfc-r8a7790",
+				  "usb1", "usb1"),
+	/* USB2 */
+	PIN_MAP_MUX_GROUP_DEFAULT("pci-rcar-gen2", "pfc-r8a7790",
+				  "usb2", "usb2"),
 };
 
 static void __init lager_add_standard_devices(void)
@@ -364,6 +402,7 @@ static void __init lager_add_standard_devices(void)
 
 	lager_add_du_device();
 	lager_register_usbhs();
+	lager_register_pci();
 }
 
 /*
-- 
1.8.3.1


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

* Re: [PATCH 5/6] arm: shmobile: lager: Add internal PCI support
  2013-10-01 18:30 [PATCH 5/6] arm: shmobile: lager: Add internal PCI support Valentine Barshak
@ 2013-10-02  0:18 ` Kuninori Morimoto
  2013-10-02  0:24 ` Magnus Damm
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Kuninori Morimoto @ 2013-10-02  0:18 UTC (permalink / raw)
  To: linux-sh


Hi Valentine

> This adds internal PCI/USB host support to Lager board.
> There are 3 internal PCI bus controllers with only a EHCI/OHCI
> device present on each one. This gives us 3 USB host channels.
> Channel 0 is shared with the USBHS function module.
> Channel 2 is shared with the USBSS (XHCI) device.
> 
> Currently no channel configuration is supported,
> and the default settings are assumed:
> Channel 0 - USBHS
> Channel 1 - PCI/USB host
> Channel 2 - PCI/USB host
> 
> Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
> ---
(snip)
>  	/* USB0 */
> -	PIN_MAP_MUX_GROUP_DEFAULT("renesas_usbhs", "pfc-r8a7790",
> +	PIN_MAP_MUX_GROUP_DEFAULT(LAGER_USB0_DEVNAME, "pfc-r8a7790",
>  				  "usb0", "usb0"),

I found definition of "LAGER_USB0_DEVNAME" on [6/6] patch,
but [5/6] patch is using it.

Best regards
---
Kuninori Morimoto

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

* Re: [PATCH 5/6] arm: shmobile: lager: Add internal PCI support
  2013-10-01 18:30 [PATCH 5/6] arm: shmobile: lager: Add internal PCI support Valentine Barshak
  2013-10-02  0:18 ` Kuninori Morimoto
@ 2013-10-02  0:24 ` Magnus Damm
  2013-10-02 12:17 ` Valentine
  2013-10-02 12:36 ` Valentine
  3 siblings, 0 replies; 5+ messages in thread
From: Magnus Damm @ 2013-10-02  0:24 UTC (permalink / raw)
  To: linux-sh

Hi again Valentine,

Thanks for your efforts.

On Wed, Oct 2, 2013 at 3:30 AM, Valentine Barshak
<valentine.barshak@cogentembedded.com> wrote:
> This adds internal PCI/USB host support to Lager board.
> There are 3 internal PCI bus controllers with only a EHCI/OHCI
> device present on each one. This gives us 3 USB host channels.
> Channel 0 is shared with the USBHS function module.
> Channel 2 is shared with the USBSS (XHCI) device.
>
> Currently no channel configuration is supported,
> and the default settings are assumed:
> Channel 0 - USBHS
> Channel 1 - PCI/USB host
> Channel 2 - PCI/USB host
>
> Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
> ---
>  arch/arm/mach-shmobile/board-lager.c | 41 +++++++++++++++++++++++++++++++++++-
>  1 file changed, 40 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
> index e408fc7..08236fb 100644
> --- a/arch/arm/mach-shmobile/board-lager.c
> +++ b/arch/arm/mach-shmobile/board-lager.c
> @@ -303,6 +303,38 @@ static struct usbhs_private usbhs_priv __initdata = {
>  #define lager_register_usbhs()
>  #endif /* CONFIG_USB_RENESAS_USBHS_UDC */
>
> +/*
> + * Internal PCI
> + * There are 3 internal PCI bus controllers with only a EHCI/OHCI
> + * device present on each one. This gives us 3 USB host channels.
> + * Channel 0 is shared with the USBHS function module.
> + * Channel 2 is shared with the USBSS (XHCI) device.
> + */
> +#if IS_ENABLED(CONFIG_PCI)

Usually we don't wrap any platform devices in #Ifdefs, what's the
reason for that in this case?

> +static const struct resource pci_resources[] __initconst = {
> +       /* Internal PCI0 */
> +       DEFINE_RES_MEM_NAMED(0xee080000, 0x10000, "PCI0 MEM"),
> +       DEFINE_RES_MEM_NAMED(0xee090000, 0x10000, "PCI0 CFG"),
> +       DEFINE_RES_IRQ(gic_spi(108)),
> +       /* Internal PCI1 */
> +       DEFINE_RES_MEM_NAMED(0xee0a0000, 0x10000, "PCI1 MEM"),
> +       DEFINE_RES_MEM_NAMED(0xee0b0000, 0x10000, "PCI1 CFG"),
> +       DEFINE_RES_IRQ(gic_spi(112)),
> +       /* Internal PCI2 */
> +       DEFINE_RES_MEM_NAMED(0xee0c0000, 0x10000, "PCI2 MEM"),
> +       DEFINE_RES_MEM_NAMED(0xee0d0000, 0x10000, "PCI2 CFG"),
> +       DEFINE_RES_IRQ(gic_spi(113)),
> +};
> +
> +#define lager_register_pci()                                           \
> +       platform_device_register_simple("pci-rcar-gen2",                \
> +                                       -1, pci_resources,              \
> +                                       ARRAY_SIZE(pci_resources))
> +}
> +#else  /* CONFIG_PCI */
> +#define lager_register_pci()
> +#endif /* CONFIG_PCI */

Also, I doubt that these PCI bits have anything to do with Lager. They
must be more of a r8a7790 SoC specific property. So they should most
likely go into setup-r8a7790.c instead of board-lager.c.

I would also like to hear if you have any plans for DT bindings for
the USB and/or PCI drivers, please let me know.

Thanks,

/ magnus

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

* Re: [PATCH 5/6] arm: shmobile: lager: Add internal PCI support
  2013-10-01 18:30 [PATCH 5/6] arm: shmobile: lager: Add internal PCI support Valentine Barshak
  2013-10-02  0:18 ` Kuninori Morimoto
  2013-10-02  0:24 ` Magnus Damm
@ 2013-10-02 12:17 ` Valentine
  2013-10-02 12:36 ` Valentine
  3 siblings, 0 replies; 5+ messages in thread
From: Valentine @ 2013-10-02 12:17 UTC (permalink / raw)
  To: linux-sh

On 10/02/2013 04:18 AM, Kuninori Morimoto wrote:
>
> Hi Valentine

Hi Morimoto-san,
>
>> This adds internal PCI/USB host support to Lager board.
>> There are 3 internal PCI bus controllers with only a EHCI/OHCI
>> device present on each one. This gives us 3 USB host channels.
>> Channel 0 is shared with the USBHS function module.
>> Channel 2 is shared with the USBSS (XHCI) device.
>>
>> Currently no channel configuration is supported,
>> and the default settings are assumed:
>> Channel 0 - USBHS
>> Channel 1 - PCI/USB host
>> Channel 2 - PCI/USB host
>>
>> Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
>> ---
> (snip)
>>   	/* USB0 */
>> -	PIN_MAP_MUX_GROUP_DEFAULT("renesas_usbhs", "pfc-r8a7790",
>> +	PIN_MAP_MUX_GROUP_DEFAULT(LAGER_USB0_DEVNAME, "pfc-r8a7790",
>>   				  "usb0", "usb0"),
>
> I found definition of "LAGER_USB0_DEVNAME" on [6/6] patch,
> but [5/6] patch is using it.
>
Good catch. Thanks!

> Best regards
> ---
> Kuninori Morimoto
>

Thanks,
Val.

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

* Re: [PATCH 5/6] arm: shmobile: lager: Add internal PCI support
  2013-10-01 18:30 [PATCH 5/6] arm: shmobile: lager: Add internal PCI support Valentine Barshak
                   ` (2 preceding siblings ...)
  2013-10-02 12:17 ` Valentine
@ 2013-10-02 12:36 ` Valentine
  3 siblings, 0 replies; 5+ messages in thread
From: Valentine @ 2013-10-02 12:36 UTC (permalink / raw)
  To: linux-sh

On 10/02/2013 04:24 AM, Magnus Damm wrote:
> Hi again Valentine,

Hi,

>
> Thanks for your efforts.

Thanks!

>
> On Wed, Oct 2, 2013 at 3:30 AM, Valentine Barshak
> <valentine.barshak@cogentembedded.com> wrote:
>> This adds internal PCI/USB host support to Lager board.
>> There are 3 internal PCI bus controllers with only a EHCI/OHCI
>> device present on each one. This gives us 3 USB host channels.
>> Channel 0 is shared with the USBHS function module.
>> Channel 2 is shared with the USBSS (XHCI) device.
>>
>> Currently no channel configuration is supported,
>> and the default settings are assumed:
>> Channel 0 - USBHS
>> Channel 1 - PCI/USB host
>> Channel 2 - PCI/USB host
>>
>> Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
>> ---
>>   arch/arm/mach-shmobile/board-lager.c | 41 +++++++++++++++++++++++++++++++++++-
>>   1 file changed, 40 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
>> index e408fc7..08236fb 100644
>> --- a/arch/arm/mach-shmobile/board-lager.c
>> +++ b/arch/arm/mach-shmobile/board-lager.c
>> @@ -303,6 +303,38 @@ static struct usbhs_private usbhs_priv __initdata = {
>>   #define lager_register_usbhs()
>>   #endif /* CONFIG_USB_RENESAS_USBHS_UDC */
>>
>> +/*
>> + * Internal PCI
>> + * There are 3 internal PCI bus controllers with only a EHCI/OHCI
>> + * device present on each one. This gives us 3 USB host channels.
>> + * Channel 0 is shared with the USBHS function module.
>> + * Channel 2 is shared with the USBSS (XHCI) device.
>> + */
>> +#if IS_ENABLED(CONFIG_PCI)
>
> Usually we don't wrap any platform devices in #Ifdefs, what's the
> reason for that in this case?

No particular reason, other than probably just to save some bits
and make it look the same as the USBHS stuff.

>
>> +static const struct resource pci_resources[] __initconst = {
>> +       /* Internal PCI0 */
>> +       DEFINE_RES_MEM_NAMED(0xee080000, 0x10000, "PCI0 MEM"),
>> +       DEFINE_RES_MEM_NAMED(0xee090000, 0x10000, "PCI0 CFG"),
>> +       DEFINE_RES_IRQ(gic_spi(108)),
>> +       /* Internal PCI1 */
>> +       DEFINE_RES_MEM_NAMED(0xee0a0000, 0x10000, "PCI1 MEM"),
>> +       DEFINE_RES_MEM_NAMED(0xee0b0000, 0x10000, "PCI1 CFG"),
>> +       DEFINE_RES_IRQ(gic_spi(112)),
>> +       /* Internal PCI2 */
>> +       DEFINE_RES_MEM_NAMED(0xee0c0000, 0x10000, "PCI2 MEM"),
>> +       DEFINE_RES_MEM_NAMED(0xee0d0000, 0x10000, "PCI2 CFG"),
>> +       DEFINE_RES_IRQ(gic_spi(113)),
>> +};
>> +
>> +#define lager_register_pci()                                           \
>> +       platform_device_register_simple("pci-rcar-gen2",                \
>> +                                       -1, pci_resources,              \
>> +                                       ARRAY_SIZE(pci_resources))
>> +}
>> +#else  /* CONFIG_PCI */
>> +#define lager_register_pci()
>> +#endif /* CONFIG_PCI */
>
> Also, I doubt that these PCI bits have anything to do with Lager. They
> must be more of a r8a7790 SoC specific property. So they should most
> likely go into setup-r8a7790.c instead of board-lager.c.

OK, I'll move it to setup-r8a7790.c

BTW, the PCI resources on r8a7791 look almost the same (according to 
RCAR M2 manual), apart that IRQ 112 is marked "reserved" and there seems 
to be no interrupt for PCI1 for some reason.

>
> I would also like to hear if you have any plans for DT bindings for
> the USB and/or PCI drivers, please let me know.

Probably later when non-DT version is pulled in.
USBHS DT bindings would involve some driver changes as well.

>
> Thanks,
>
> / magnus
>

Thanks,
Val.

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

end of thread, other threads:[~2013-10-02 12:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-01 18:30 [PATCH 5/6] arm: shmobile: lager: Add internal PCI support Valentine Barshak
2013-10-02  0:18 ` Kuninori Morimoto
2013-10-02  0:24 ` Magnus Damm
2013-10-02 12:17 ` Valentine
2013-10-02 12:36 ` Valentine

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