Skip to contentSkip to conversation

ARM: shmobile: lager: Add internal USB PCI support

PATCH New Magnus Damm 3 participants 5 messages Feb 14, 2014 – Feb 17, 2014

Subsystems (4)
lore
Share & tools
lore

Magnus Damm

author maintainer
#0 lore raw

PATCH 1/1 ARM: shmobile: lager: Add internal USB PCI support

From: Valentine Barshak <[email protected]>

This adds internal PCI USB host devices to R-Car H2 Lager board.

[damm at opensource.se: Rebased and reworked to only include USB1 and USB2]

---

Written against renesas-devel-v3.14-rc2-20140213

 arch/arm/mach-shmobile/board-lager.c |   50 ++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
arch/arm/mach-shmobile/board-lager.c +50 -0
@@ -638,6 +638,48 @@ static struct resource sdhi2_resources[]
 	DEFINE_RES_IRQ(gic_spi(167)),
 };
 
+/* Internal PCI1 */
+static const struct resource pci1_resources[] __initconst = {
+	DEFINE_RES_MEM(0xee0b0000, 0x10000),	/* CFG */
+	DEFINE_RES_MEM(0xee0a0000, 0x10000),	/* MEM */
+	DEFINE_RES_IRQ(gic_spi(112)),
+};
+
+static const struct platform_device_info pci1_info __initconst = {
+	.parent		= &platform_bus,
+	.name		= "pci-rcar-gen2",
+	.id		= 1,
+	.res		= pci1_resources,
+	.num_res	= ARRAY_SIZE(pci1_resources),
+	.dma_mask	= DMA_BIT_MASK(32),
+};
+
+static void __init lager_add_usb1_device(void)
+{
+	platform_device_register_full(&pci1_info);
+}
+
+/* Internal PCI2 */
+static const struct resource pci2_resources[] __initconst = {
+	DEFINE_RES_MEM(0xee0d0000, 0x10000),	/* CFG */
+	DEFINE_RES_MEM(0xee0c0000, 0x10000),	/* MEM */
+	DEFINE_RES_IRQ(gic_spi(113)),
+};
+
+static const struct platform_device_info pci2_info __initconst = {
+	.parent		= &platform_bus,
+	.name		= "pci-rcar-gen2",
+	.id		= 2,
+	.res		= pci2_resources,
+	.num_res	= ARRAY_SIZE(pci2_resources),
+	.dma_mask	= DMA_BIT_MASK(32),
+};
+
+static void __init lager_add_usb2_device(void)
+{
+	platform_device_register_full(&pci2_info);
+}
+
 static const struct pinctrl_map lager_pinctrl_map[] = {
 	/* DU (CN10: ARGB0, CN13: LVDS) */
 	PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7790", "pfc-r8a7790",
@@ -716,6 +758,12 @@ static const struct pinctrl_map lager_pi
 	/* USB0 */
 	PIN_MAP_MUX_GROUP_DEFAULT("renesas_usbhs", "pfc-r8a7790",
 				  "usb0_ovc_vbus", "usb0"),
+	/* USB1 */
+	PIN_MAP_MUX_GROUP_DEFAULT("pci-rcar-gen2.1", "pfc-r8a7790",
+				  "usb1", "usb1"),
+	/* USB2 */
+	PIN_MAP_MUX_GROUP_DEFAULT("pci-rcar-gen2.2", "pfc-r8a7790",
+				  "usb2", "usb2"),
 };
 
 static void __init lager_add_standard_devices(void)
@@ -776,6 +824,8 @@ static void __init lager_add_standard_de
 					  &usbhs_phy_pdata,
 					  sizeof(usbhs_phy_pdata));
 	lager_register_usbhs();
+	lager_add_usb1_device();
+	lager_add_usb2_device();
 
 	lager_add_rsnd_device();
 
#1 lore raw

PATCH 1/1 ARM: shmobile: lager: Add internal USB PCI support

Hello.

Quoted 27 lines · Magnus Damm

From: Valentine Barshak <[email protected]>

This adds internal PCI USB host devices to R-Car H2 Lager board.

[damm at opensource.se: Rebased and reworked to only include USB1 and USB2]

---

Written against renesas-devel-v3.14-rc2-20140213

  arch/arm/mach-shmobile/board-lager.c |   50 ++++++++++++++++++++++++++++++++++
  1 file changed, 50 insertions(+)
arch/arm/mach-shmobile/board-lager.c +7 -0
@@ -638,6 +638,48 @@ static struct resource sdhi2_resources[]
  	DEFINE_RES_IRQ(gic_spi(167)),
  };
 
+/* Internal PCI1 */
+static const struct resource pci1_resources[] __initconst = {
+	DEFINE_RES_MEM(0xee0b0000, 0x10000),	/* CFG */
+	DEFINE_RES_MEM(0xee0a0000, 0x10000),	/* MEM */
+	DEFINE_RES_IRQ(gic_spi(112)),
+};
+

arch/arm/mach-shmobile/board-lager.c static struct resource sdhi2_resources[] · line 657

Quoted 10 lines
arch/arm/mach-shmobile/board-lager.c +10 -0
+static const struct platform_device_info pci1_info __initconst = {
+	.parent		= &platform_bus,
+	.name		= "pci-rcar-gen2",
+	.id		= 1,
+	.res		= pci1_resources,
+	.num_res	= ARRAY_SIZE(pci1_resources),
+	.dma_mask	= DMA_BIT_MASK(32),
+};
+
+static void __init lager_add_usb1_device(void)

Actually, this adds PCI device, not USB, so the name is strange.
Also, I doubt that such functions are really necessary.

Quoted 10 lines
arch/arm/mach-shmobile/board-lager.c +10 -0
+{
+	platform_device_register_full(&pci1_info);
+}
+
+/* Internal PCI2 */
+static const struct resource pci2_resources[] __initconst = {
+	DEFINE_RES_MEM(0xee0d0000, 0x10000),	/* CFG */
+	DEFINE_RES_MEM(0xee0c0000, 0x10000),	/* MEM */
+	DEFINE_RES_IRQ(gic_spi(113)),
+};

arch/arm/mach-shmobile/board-lager.c static struct resource sdhi2_resources[] · line 677

Quoted 10 lines
arch/arm/mach-shmobile/board-lager.c +10 -0
+
+static const struct platform_device_info pci2_info __initconst = {
+	.parent		= &platform_bus,
+	.name		= "pci-rcar-gen2",
+	.id		= 2,
+	.res		= pci2_resources,
+	.num_res	= ARRAY_SIZE(pci2_resources),
+	.dma_mask	= DMA_BIT_MASK(32),
+};
+

I suspect the PCI resources and info could be wrapped by macros and then
instantiated by using only 2 lines.

WBR, Sergei

author maintainer
#2 lore raw

PATCH 1/1 ARM: shmobile: lager: Add internal USB PCI support

Hi Sergei,

Quoted 45 lines · Sergei Shtylyov

Hello.

Quoted 40 lines · Magnus Damm

From: Valentine Barshak <[email protected]>

This adds internal PCI USB host devices to R-Car H2 Lager board.

[damm at opensource.se: Rebased and reworked to only include USB1 and USB2]

---

Written against renesas-devel-v3.14-rc2-20140213

  arch/arm/mach-shmobile/board-lager.c |   50
++++++++++++++++++++++++++++++++++
  1 file changed, 50 insertions(+)
arch/arm/mach-shmobile/board-lager.c 2014-02-14 renamed from arch/arm/mach-shmobile/board-lager.c +0 -0

12:16:26.000000000 +0900

arch/arm/mach-shmobile/board-lager.c 2014-02-14 renamed from arch/arm/mach-shmobile/board-lager.c +13 -0
@@ -638,6 +638,48 @@ static struct resource sdhi2_resources[]
        DEFINE_RES_IRQ(gic_spi(167)),
  };
 
+/* Internal PCI1 */
+static const struct resource pci1_resources[] __initconst = {
+       DEFINE_RES_MEM(0xee0b0000, 0x10000),    /* CFG */
+       DEFINE_RES_MEM(0xee0a0000, 0x10000),    /* MEM */
+       DEFINE_RES_IRQ(gic_spi(112)),
+};
+
+static const struct platform_device_info pci1_info __initconst = {
+       .parent         = &platform_bus,
+       .name           = "pci-rcar-gen2",
+       .id             = 1,
+       .res            = pci1_resources,
+       .num_res        = ARRAY_SIZE(pci1_resources),
Quoted 8 lines

arch/arm/mach-shmobile/board-lager.c 2014-02-14 static struct resource sdhi2_resources[] · line 657

Quoted 4 lines
arch/arm/mach-shmobile/board-lager.c 2014-02-14 renamed from arch/arm/mach-shmobile/board-lager.c +4 -0
+       .dma_mask       = DMA_BIT_MASK(32),
+};
+
+static void __init lager_add_usb1_device(void)

Actually, this adds PCI device, not USB, so the name is strange.
Also, I doubt that such functions are really necessary.

Well there are only USB devices hanging off the PCI devices on the actual silicon, so this naming discussion seems like splitting hairs?

Quoted 16 lines
Quoted 16 lines
arch/arm/mach-shmobile/board-lager.c 2014-02-14 renamed from arch/arm/mach-shmobile/board-lager.c +16 -0
+{
+       platform_device_register_full(&pci1_info);
+}
+
+/* Internal PCI2 */
+static const struct resource pci2_resources[] __initconst = {
+       DEFINE_RES_MEM(0xee0d0000, 0x10000),    /* CFG */
+       DEFINE_RES_MEM(0xee0c0000, 0x10000),    /* MEM */
+       DEFINE_RES_IRQ(gic_spi(113)),
+};
+
+static const struct platform_device_info pci2_info __initconst = {
+       .parent         = &platform_bus,
+       .name           = "pci-rcar-gen2",
+       .id             = 2,
+       .res            = pci2_resources,
Quoted 8 lines

arch/arm/mach-shmobile/board-lager.c 2014-02-14 static struct resource sdhi2_resources[] · line 677

Quoted 4 lines
arch/arm/mach-shmobile/board-lager.c 2014-02-14 renamed from arch/arm/mach-shmobile/board-lager.c +4 -0
+       .num_res        = ARRAY_SIZE(pci2_resources),
+       .dma_mask       = DMA_BIT_MASK(32),
+};
+

I suspect the PCI resources and info could be wrapped by macros and then
instantiated by using only 2 lines.

I suspect anything can be done. =) As you may know, I'm not the original author of this patch. At this point in time I'm mainly focusing on getting device support merged, so please feel free to send either incremental patches or pick up this one and fix it yourself. I'm beyond caring.

Thanks,

/ magnus

#3 lore raw

PATCH 1/1 ARM: shmobile: lager: Add internal USB PCI support

Hello.

Quoted 43 lines · Magnus Damm
Quoted 34 lines
Quoted 34 lines

From: Valentine Barshak <[email protected]>

This adds internal PCI USB host devices to R-Car H2 Lager board.

[[email protected]: Rebased and reworked to only include USB1 and USB2]

---

Written against renesas-devel-v3.14-rc2-20140213

   arch/arm/mach-shmobile/board-lager.c |   50
++++++++++++++++++++++++++++++++++
   1 file changed, 50 insertions(+)
arch/arm/mach-shmobile/board-lager.c 2014-02-14 renamed from arch/arm/mach-shmobile/board-lager.c +0 -0

12:16:26.000000000 +0900

arch/arm/mach-shmobile/board-lager.c 2014-02-14 renamed from arch/arm/mach-shmobile/board-lager.c +12 -0
@@ -638,6 +638,48 @@ static struct resource sdhi2_resources[]
         DEFINE_RES_IRQ(gic_spi(167)),
   };
 
+/* Internal PCI1 */
+static const struct resource pci1_resources[] __initconst = {
+       DEFINE_RES_MEM(0xee0b0000, 0x10000),    /* CFG */
+       DEFINE_RES_MEM(0xee0a0000, 0x10000),    /* MEM */
+       DEFINE_RES_IRQ(gic_spi(112)),
+};
+
+static const struct platform_device_info pci1_info __initconst = {
+       .parent         = &platform_bus,
+       .name           = "pci-rcar-gen2",
+       .id             = 1,
+       .res            = pci1_resources,
Quoted 8 lines

arch/arm/mach-shmobile/board-lager.c 2014-02-14 static struct resource sdhi2_resources[] · line 657

Quoted 5 lines
arch/arm/mach-shmobile/board-lager.c 2014-02-14 renamed from arch/arm/mach-shmobile/board-lager.c +5 -0
+       .num_res        = ARRAY_SIZE(pci1_resources),
+       .dma_mask       = DMA_BIT_MASK(32),
+};
+
+static void __init lager_add_usb1_device(void)

Actually, this adds PCI device, not USB, so the name is strange.
Also, I doubt that such functions are really necessary.

Quoted 2 lines

Well there are only USB devices hanging off the PCI devices on the actual silicon, so this naming discussion seems like splitting hairs?

I'm actually against introducing these functions in general. They're only
wasting the LOCs.

Quoted 24 lines
Quoted 15 lines
Quoted 15 lines
arch/arm/mach-shmobile/board-lager.c 2014-02-14 renamed from arch/arm/mach-shmobile/board-lager.c +15 -0
+{
+       platform_device_register_full(&pci1_info);
+}
+
+/* Internal PCI2 */
+static const struct resource pci2_resources[] __initconst = {
+       DEFINE_RES_MEM(0xee0d0000, 0x10000),    /* CFG */
+       DEFINE_RES_MEM(0xee0c0000, 0x10000),    /* MEM */
+       DEFINE_RES_IRQ(gic_spi(113)),
+};
+
+static const struct platform_device_info pci2_info __initconst = {
+       .parent         = &platform_bus,
+       .name           = "pci-rcar-gen2",
+       .id             = 2,
Quoted 8 lines

arch/arm/mach-shmobile/board-lager.c 2014-02-14 static struct resource sdhi2_resources[] · line 677

Quoted 5 lines
arch/arm/mach-shmobile/board-lager.c 2014-02-14 renamed from arch/arm/mach-shmobile/board-lager.c +5 -0
+       .res            = pci2_resources,
+       .num_res        = ARRAY_SIZE(pci2_resources),
+       .dma_mask       = DMA_BIT_MASK(32),
+};
+

I suspect the PCI resources and info could be wrapped by macros and then
instantiated by using only 2 lines.

Quoted 1 line

I suspect anything can be done. =) As you may know, I'm not the

You're too optimistic. :-)

Quoted 4 lines

original author of this patch. At this point in time I'm mainly focusing on getting device support merged, so please feel free to send either incremental patches or pick up this one and fix it yourself. I'm beyond caring.

OK, I'll see what I can do when I have a time.

Quoted 3 lines

Thanks,

/ magnus

WBR, Sergei