* [PATCH 3/3 v4] ARM: shmobile: bockw: add MMCIF support
@ 2013-06-12 2:12 Kuninori Morimoto
2013-06-12 14:08 ` Simon Horman
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: Kuninori Morimoto @ 2013-06-12 2:12 UTC (permalink / raw)
To: linux-sh
This patch enables CN26 MMCIF
Signed-off-by: Yusuke Goda <yusuke.goda.sx@renesas.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
v3 -> v4
- based on renesas-next-20130611v2
arch/arm/mach-shmobile/board-bockw.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/arch/arm/mach-shmobile/board-bockw.c b/arch/arm/mach-shmobile/board-bockw.c
index f0f9eaa..75ba061 100644
--- a/arch/arm/mach-shmobile/board-bockw.c
+++ b/arch/arm/mach-shmobile/board-bockw.c
@@ -41,6 +41,23 @@
* SW41 SCIF RCAN
*/
+/*
+ * MMC (CN26) pin
+ *
+ * SW6 (D2) 3 pin
+ * SW7 (D5) ON
+ * SW8 (D3) 3 pin
+ * SW10 (D4) 1 pin
+ * SW12 (CLK) 1 pin
+ * SW13 (D6) 3 pin
+ * SW14 (CMD) ON
+ * SW15 (D6) 1 pin
+ * SW16 (D0) ON
+ * SW17 (D1) ON
+ * SW18 (D7) 3 pin
+ * SW19 (MMC) 1 pin
+ */
+
/* Dummy supplies, where voltage doesn't matter */
static struct regulator_consumer_supply dummy_supplies[] = {
REGULATOR_SUPPLY("vddvario", "smsc911x"),
@@ -103,10 +120,24 @@ static struct spi_board_info spi_board_info[] __initdata = {
},
};
+/* MMC */
+static struct sh_mmcif_plat_data sh_mmcif_plat = {
+ .sup_pclk = 0,
+ .ocr = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
+ .caps = MMC_CAP_4_BIT_DATA |
+ MMC_CAP_8_BIT_DATA |
+ MMC_CAP_NEEDS_POLL,
+};
+
static const struct pinctrl_map bockw_pinctrl_map[] = {
/* HSPI0 */
PIN_MAP_MUX_GROUP_DEFAULT("sh-hspi.0", "pfc-r8a7778",
"hspi0_a", "hspi0"),
+ /* MMC */
+ PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif", "pfc-r8a7778",
+ "mmc_data8", "mmc"),
+ PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif", "pfc-r8a7778",
+ "mmc_ctrl", "mmc"),
/* SCIF0 */
PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.0", "pfc-r8a7778",
"scif0_data_a", "scif0"),
@@ -135,6 +166,7 @@ static void __init bockw_init(void)
r8a7778_add_usb_phy_device(&usb_phy_platform_data);
r8a7778_add_i2c_device(0);
r8a7778_add_hspi_device(0);
+ r8a7778_add_mmc_device(&sh_mmcif_plat);
i2c_register_board_info(0, i2c0_devices,
ARRAY_SIZE(i2c0_devices));
--
1.7.9.5
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 3/3 v4] ARM: shmobile: bockw: add MMCIF support
2013-06-12 2:12 [PATCH 3/3 v4] ARM: shmobile: bockw: add MMCIF support Kuninori Morimoto
@ 2013-06-12 14:08 ` Simon Horman
2013-08-05 0:43 ` [PATCH 3/3 v4] ARM: shmobile: bockw: add USB Function support Kuninori Morimoto
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Simon Horman @ 2013-06-12 14:08 UTC (permalink / raw)
To: linux-sh
On Tue, Jun 11, 2013 at 07:12:06PM -0700, Kuninori Morimoto wrote:
> This patch enables CN26 MMCIF
>
> Signed-off-by: Yusuke Goda <yusuke.goda.sx@renesas.com>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
> v3 -> v4
>
> - based on renesas-next-20130611v2
>
> arch/arm/mach-shmobile/board-bockw.c | 32 ++++++++++++++++++++++++++++++++
> 1 file changed, 32 insertions(+)
Thanks, queued up in the boards branch.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 3/3 v4] ARM: shmobile: bockw: add USB Function support
2013-06-12 2:12 [PATCH 3/3 v4] ARM: shmobile: bockw: add MMCIF support Kuninori Morimoto
2013-06-12 14:08 ` Simon Horman
@ 2013-08-05 0:43 ` Kuninori Morimoto
2013-08-21 8:44 ` Simon Horman
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Kuninori Morimoto @ 2013-08-05 0:43 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>
---
v3 -> v4
- no change
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
* Re: [PATCH 3/3 v4] ARM: shmobile: bockw: add USB Function support
2013-06-12 2:12 [PATCH 3/3 v4] ARM: shmobile: bockw: add MMCIF support Kuninori Morimoto
2013-06-12 14:08 ` Simon Horman
2013-08-05 0:43 ` [PATCH 3/3 v4] ARM: shmobile: bockw: add USB Function support Kuninori Morimoto
@ 2013-08-21 8:44 ` Simon Horman
2013-08-29 9:13 ` Magnus Damm
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Simon Horman @ 2013-08-21 8:44 UTC (permalink / raw)
To: linux-sh
On Sun, Aug 04, 2013 at 05:43:37PM -0700, Kuninori Morimoto wrote:
> 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>
> ---
> v3 -> v4
>
> - no change
>
> arch/arm/mach-shmobile/board-bockw.c | 81 ++++++++++++++++++++++++++++++++--
Magnus, could you review this?
> 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
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 3/3 v4] ARM: shmobile: bockw: add USB Function support
2013-06-12 2:12 [PATCH 3/3 v4] ARM: shmobile: bockw: add MMCIF support Kuninori Morimoto
` (2 preceding siblings ...)
2013-08-21 8:44 ` Simon Horman
@ 2013-08-29 9:13 ` Magnus Damm
2013-08-29 10:26 ` Laurent Pinchart
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Magnus Damm @ 2013-08-29 9:13 UTC (permalink / raw)
To: linux-sh
Hi Simon, Morimoto-san,
[CC Laurent]
On Wed, Aug 21, 2013 at 5:44 PM, Simon Horman <horms@verge.net.au> wrote:
> On Sun, Aug 04, 2013 at 05:43:37PM -0700, Kuninori Morimoto wrote:
>> 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>
>> ---
>> v3 -> v4
>>
>> - no change
>>
>> arch/arm/mach-shmobile/board-bockw.c | 81 ++++++++++++++++++++++++++++++++--
>
> Magnus, could you review this?
Sure, I can try. Just to be clear though - I think I know this board
and SoC as little as you do. =)
>> 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
Morimoto-san,
Thanks for your work on this. In this patch I understand that you
based on Kconfig select if ehci-platform or renesas-usbhs should be
used. I wonder how well that will work together with multiplatform
kernels in the future. Probably not so well. So we need to figure out
how to handle this in the future.
I propose that we accept this patch as-is today to enable the
hardware, but we should also investigate if we for instance could let
the PFC handle mutual exclusion of the hardware and use bind/unbind to
start/stop devices during run time. Paul Mundt and I talked about this
ages ago but I'm not sure if it is actually possible with pinctrl or
not. If possible would install both ehci-platform and renesas-usbhs
devices in parallel and instead dynamically select one of them through
sysfs.
Laurent, do you think it is possible to use pinctrl for mutual
exclusion control in the drivers somehow? Basically, if the requested
pins are already in use then the conflicting driver instance should
error out.
We also want to have DT bindings for USB drivers. Morimoto-san, can
you please work on adding USB support to Bock-W DT reference?
Cheers,
/ magnus
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 3/3 v4] ARM: shmobile: bockw: add USB Function support
2013-06-12 2:12 [PATCH 3/3 v4] ARM: shmobile: bockw: add MMCIF support Kuninori Morimoto
` (3 preceding siblings ...)
2013-08-29 9:13 ` Magnus Damm
@ 2013-08-29 10:26 ` Laurent Pinchart
2013-08-29 12:49 ` Sergei Shtylyov
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Laurent Pinchart @ 2013-08-29 10:26 UTC (permalink / raw)
To: linux-sh
Hi Magnus,
On Thursday 29 August 2013 18:13:09 Magnus Damm wrote:
> On Wed, Aug 21, 2013 at 5:44 PM, Simon Horman <horms@verge.net.au> wrote:
> > On Sun, Aug 04, 2013 at 05:43:37PM -0700, Kuninori Morimoto wrote:
> >> 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>
> >> ---
> >> v3 -> v4
> >>
> >> - no change
> >>
> >> arch/arm/mach-shmobile/board-bockw.c | 81
> >> ++++++++++++++++++++++++++++++++-->
> > Magnus, could you review this?
>
> Sure, I can try. Just to be clear though - I think I know this board
> and SoC as little as you do. =)
>
> >> 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
>
> Morimoto-san,
>
> Thanks for your work on this. In this patch I understand that you
> based on Kconfig select if ehci-platform or renesas-usbhs should be
> used. I wonder how well that will work together with multiplatform
> kernels in the future. Probably not so well. So we need to figure out
> how to handle this in the future.
>
> I propose that we accept this patch as-is today to enable the
> hardware, but we should also investigate if we for instance could let
> the PFC handle mutual exclusion of the hardware and use bind/unbind to
> start/stop devices during run time. Paul Mundt and I talked about this
> ages ago but I'm not sure if it is actually possible with pinctrl or
> not. If possible would install both ehci-platform and renesas-usbhs
> devices in parallel and instead dynamically select one of them through
> sysfs.
>
> Laurent, do you think it is possible to use pinctrl for mutual
> exclusion control in the drivers somehow? Basically, if the requested
> pins are already in use then the conflicting driver instance should
> error out.
That's a good question. The current driver core requests pins when devices are
probed, which then results in a probe failure. One option would be to manually
unbind the successfully probed device through sysfs, and then bind the other
one (I believe that should work but I haven't tested it). There will be a
little complexity involved with the fact that we can't know which device will
be probed successfully, but that shouldn't be a huge issue.
> We also want to have DT bindings for USB drivers. Morimoto-san, can
> you please work on adding USB support to Bock-W DT reference?
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 3/3 v4] ARM: shmobile: bockw: add USB Function support
2013-06-12 2:12 [PATCH 3/3 v4] ARM: shmobile: bockw: add MMCIF support Kuninori Morimoto
` (4 preceding siblings ...)
2013-08-29 10:26 ` Laurent Pinchart
@ 2013-08-29 12:49 ` Sergei Shtylyov
2013-08-30 0:13 ` Kuninori Morimoto
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Sergei Shtylyov @ 2013-08-29 12:49 UTC (permalink / raw)
To: linux-sh
Hello.
On 29-08-2013 13:13, Magnus Damm wrote:
> [CC Laurent]
>>> 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>
>>> ---
>>> v3 -> v4
>>> - no change
>>> arch/arm/mach-shmobile/board-bockw.c | 81 ++++++++++++++++++++++++++++++++--
>> Magnus, could you review this?
> Sure, I can try. Just to be clear though - I think I know this board
> and SoC as little as you do. =)
>>> 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
[...]
>>> @@ -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
> Morimoto-san,
> Thanks for your work on this. In this patch I understand that you
> based on Kconfig select if ehci-platform or renesas-usbhs should be
> used. I wonder how well that will work together with multiplatform
> kernels in the future. Probably not so well. So we need to figure out
> how to handle this in the future.
> I propose that we accept this patch as-is today to enable the
> hardware, but we should also investigate if we for instance could let
> the PFC handle mutual exclusion of the hardware
There is no mutual exclusion in this case -- host and device controllers
only compete for USB port 1, with host owning port 0 exclusively. So both host
and device drivers can be loaded and work concurrently.
> and use bind/unbind to
> start/stop devices during run time. Paul Mundt and I talked about this
> ages ago but I'm not sure if it is actually possible with pinctrl or
> not. If possible would install both ehci-platform and renesas-usbhs
> devices in parallel and instead dynamically select one of them through
> sysfs.
> Laurent, do you think it is possible to use pinctrl for mutual
> exclusion control in the drivers somehow? Basically, if the requested
> pins are already in use then the conflicting driver instance should
> error out.
I would think it's the natural thing to do, yet currently device core just
ignores the pin conflict IIRC.
> We also want to have DT bindings for USB drivers. Morimoto-san, can
> you please work on adding USB support to Bock-W DT reference?
DT bindings for EHCI/OHCI hosts are simply not possible due to using
procedural platform data. The same seems true for USB device controller.
Thus the only thing convertible to DT is USB common PHY and it's still on my
agenda.
> Cheers,
> / magnus
WBR, Sergei
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 3/3 v4] ARM: shmobile: bockw: add USB Function support
2013-06-12 2:12 [PATCH 3/3 v4] ARM: shmobile: bockw: add MMCIF support Kuninori Morimoto
` (5 preceding siblings ...)
2013-08-29 12:49 ` Sergei Shtylyov
@ 2013-08-30 0:13 ` Kuninori Morimoto
2013-09-06 7:09 ` Simon Horman
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Kuninori Morimoto @ 2013-08-30 0:13 UTC (permalink / raw)
To: linux-sh
Hi Magnus
> > Magnus, could you review this?
>
> Sure, I can try. Just to be clear though - I think I know this board
> and SoC as little as you do. =)
Thank you
> Thanks for your work on this. In this patch I understand that you
> based on Kconfig select if ehci-platform or renesas-usbhs should be
> used. I wonder how well that will work together with multiplatform
> kernels in the future. Probably not so well. So we need to figure out
> how to handle this in the future.
>
> I propose that we accept this patch as-is today to enable the
> hardware, but we should also investigate if we for instance could let
> the PFC handle mutual exclusion of the hardware and use bind/unbind to
> start/stop devices during run time. Paul Mundt and I talked about this
> ages ago but I'm not sure if it is actually possible with pinctrl or
> not. If possible would install both ehci-platform and renesas-usbhs
> devices in parallel and instead dynamically select one of them through
> sysfs.
>
> Laurent, do you think it is possible to use pinctrl for mutual
> exclusion control in the drivers somehow? Basically, if the requested
> pins are already in use then the conflicting driver instance should
> error out.
Thank you for your help, and I think it is good point.
bind/unbind control USB seems nice idea if pinctrl works well.
But, It has 2 issues on this run time exchange.
1) USB switching Host/Func needs dip-switch settings.
2) USB Host/Func switching needs USB-PHY re-settings
I guess it is a little bit difficult 2) case in bind/unbind control
Some boards are difficult to full-support on multiplatform ?
> We also want to have DT bindings for USB drivers. Morimoto-san, can
> you please work on adding USB support to Bock-W DT reference?
OK, I will try it
Best regards
---
Kuninori Morimoto
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 3/3 v4] ARM: shmobile: bockw: add USB Function support
2013-06-12 2:12 [PATCH 3/3 v4] ARM: shmobile: bockw: add MMCIF support Kuninori Morimoto
` (6 preceding siblings ...)
2013-08-30 0:13 ` Kuninori Morimoto
@ 2013-09-06 7:09 ` Simon Horman
2013-09-09 7:50 ` Magnus Damm
2013-09-09 16:47 ` Sergei Shtylyov
9 siblings, 0 replies; 11+ messages in thread
From: Simon Horman @ 2013-09-06 7:09 UTC (permalink / raw)
To: linux-sh
On Sun, Aug 04, 2013 at 05:43:37PM -0700, Kuninori Morimoto wrote:
> 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>
Thanks, I have queued this up for v3.13.
There was a bit of fuzz so could you please check that the following is
correct?
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
ARM: shmobile: bockw: add USB Function support
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>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
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 a835393..de621ed 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>
@@ -97,6 +98,16 @@ static void __iomem *fpga;
* # amixer set "LINEOUT Mixer DACL" on
*/
+/*
+ * 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"),
@@ -115,13 +126,71 @@ static struct resource smsc911x_resources[] __initdata = {
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 __initdata = {
@@ -425,7 +494,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",
@@ -537,6 +606,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,
@@ -547,5 +622,5 @@ DT_MACHINE_START(BOCKW_DT, "bockw")
.init_irq = r8a7778_init_irq_dt,
.init_machine = bockw_init,
.dt_compat = bockw_boards_compat_dt,
- .init_late = r8a7778_init_late,
+ .init_late = bockw_init_late,
MACHINE_END
--
1.8.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 3/3 v4] ARM: shmobile: bockw: add USB Function support
2013-06-12 2:12 [PATCH 3/3 v4] ARM: shmobile: bockw: add MMCIF support Kuninori Morimoto
` (7 preceding siblings ...)
2013-09-06 7:09 ` Simon Horman
@ 2013-09-09 7:50 ` Magnus Damm
2013-09-09 16:47 ` Sergei Shtylyov
9 siblings, 0 replies; 11+ messages in thread
From: Magnus Damm @ 2013-09-09 7:50 UTC (permalink / raw)
To: linux-sh
Hi Sergei,
On Thu, Aug 29, 2013 at 9:49 PM, Sergei Shtylyov
<sergei.shtylyov@cogentembedded.com> wrote:
> Hello.
>
> On 29-08-2013 13:13, Magnus Damm wrote:
>
>> [CC Laurent]
>
>
>>>> 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>
>>>> ---
>>>> v3 -> v4
>
>
>>>> - no change
>
>
>>>> arch/arm/mach-shmobile/board-bockw.c | 81
>>>> ++++++++++++++++++++++++++++++++--
>
>
>>> Magnus, could you review this?
>
>
>> Sure, I can try. Just to be clear though - I think I know this board
>> and SoC as little as you do. =)
>
>
>>>> 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
>
> [...]
>
>>>> @@ -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
>
>
>> Morimoto-san,
>
>
>> Thanks for your work on this. In this patch I understand that you
>> based on Kconfig select if ehci-platform or renesas-usbhs should be
>> used. I wonder how well that will work together with multiplatform
>> kernels in the future. Probably not so well. So we need to figure out
>> how to handle this in the future.
>
>
>> I propose that we accept this patch as-is today to enable the
>> hardware, but we should also investigate if we for instance could let
>> the PFC handle mutual exclusion of the hardware
>
>
> There is no mutual exclusion in this case -- host and device controllers
> only compete for USB port 1, with host owning port 0 exclusively. So both
> host and device drivers can be loaded and work concurrently.
So there is one host-only port and another host/gadget port. The
former seems easy enough, but I believe the latter one may be
problematic if the host is EHCI/OHCI and gadget is renesas_usbhs.
Regardless, unless I'm mistaken then using bind should allow us to
assign these during run-time.
>> and use bind/unbind to
>> start/stop devices during run time. Paul Mundt and I talked about this
>> ages ago but I'm not sure if it is actually possible with pinctrl or
>> not. If possible would install both ehci-platform and renesas-usbhs
>> devices in parallel and instead dynamically select one of them through
>> sysfs.
>
>
>> Laurent, do you think it is possible to use pinctrl for mutual
>> exclusion control in the drivers somehow? Basically, if the requested
>> pins are already in use then the conflicting driver instance should
>> error out.
>
>
> I would think it's the natural thing to do, yet currently device core
> just ignores the pin conflict IIRC.
Oh, well if that's the case then someone needs to fix that. =)
>> We also want to have DT bindings for USB drivers. Morimoto-san, can
>> you please work on adding USB support to Bock-W DT reference?
>
>
> DT bindings for EHCI/OHCI hosts are simply not possible due to using
> procedural platform data. The same seems true for USB device controller.
> Thus the only thing convertible to DT is USB common PHY and it's still on my
> agenda.
But this must be a driver design issue, no? So if the driver could be
reworked then I suspect it could be treated as any other DT device. Of
course, this may be quite difficult in practice..
Cheers,
/ magnus
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 3/3 v4] ARM: shmobile: bockw: add USB Function support
2013-06-12 2:12 [PATCH 3/3 v4] ARM: shmobile: bockw: add MMCIF support Kuninori Morimoto
` (8 preceding siblings ...)
2013-09-09 7:50 ` Magnus Damm
@ 2013-09-09 16:47 ` Sergei Shtylyov
9 siblings, 0 replies; 11+ messages in thread
From: Sergei Shtylyov @ 2013-09-09 16:47 UTC (permalink / raw)
To: linux-sh
Hello.
On 09/09/2013 11:50 AM, Magnus Damm wrote:
>>> [CC Laurent]
>>>>> 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>
>>>>> ---
>>>>> v3 -> v4
>>>>> - no change
>>>>> arch/arm/mach-shmobile/board-bockw.c | 81
>>>>> ++++++++++++++++++++++++++++++++--
>>>> Magnus, could you review this?
>>> Sure, I can try. Just to be clear though - I think I know this board
>>> and SoC as little as you do. =)
>>>>> 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
>> [...]
>>>>> @@ -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
>>> Morimoto-san,
>>> Thanks for your work on this. In this patch I understand that you
>>> based on Kconfig select if ehci-platform or renesas-usbhs should be
>>> used. I wonder how well that will work together with multiplatform
>>> kernels in the future. Probably not so well. So we need to figure out
>>> how to handle this in the future.
>>> I propose that we accept this patch as-is today to enable the
>>> hardware, but we should also investigate if we for instance could let
>>> the PFC handle mutual exclusion of the hardware
>> There is no mutual exclusion in this case -- host and device controllers
>> only compete for USB port 1, with host owning port 0 exclusively. So both
>> host and device drivers can be loaded and work concurrently.
> So there is one host-only port and another host/gadget port. The
No, 2nd port is either host or gadget, and currently it's determined by
the USB PHY platform data. The port is not runtime switchable.
> former seems easy enough, but I believe the latter one may be
> problematic if the host is EHCI/OHCI and gadget is renesas_usbhs.
> Regardless, unless I'm mistaken then using bind should allow us to
> assign these during run-time.
I doubt it since we need to reconfigure the common PHY.
>>> and use bind/unbind to
>>> start/stop devices during run time. Paul Mundt and I talked about this
>>> ages ago but I'm not sure if it is actually possible with pinctrl or
>>> not. If possible would install both ehci-platform and renesas-usbhs
>>> devices in parallel and instead dynamically select one of them through
>>> sysfs.
>>> Laurent, do you think it is possible to use pinctrl for mutual
>>> exclusion control in the drivers somehow? Basically, if the requested
>>> pins are already in use then the conflicting driver instance should
>>> error out.
>> I would think it's the natural thing to do, yet currently device core
>> just ignores the pin conflict IIRC.
> Oh, well if that's the case then someone needs to fix that. =)
I also maybe behind the reality on this one, need to double check.
>>> We also want to have DT bindings for USB drivers. Morimoto-san, can
>>> you please work on adding USB support to Bock-W DT reference?
>> DT bindings for EHCI/OHCI hosts are simply not possible due to using
>> procedural platform data. The same seems true for USB device controller.
>> Thus the only thing convertible to DT is USB common PHY and it's still on my
>> agenda.
> But this must be a driver design issue, no?
No, it's a question of using the dedicated drivers instead of generic
[eo]hci-platform drivers. We then would do things we're doing in the
platform-specific methods in the drivers themselves and DT binding should pose
no issues.
> So if the driver could be
> reworked then I suspect it could be treated as any other DT device. Of
> course, this may be quite difficult in practice..
Impossible even with the current drivers. Probably using these drivers was
a bad move from the start viewed from the DT POV.
> Cheers,
> / magnus
WBR, Sergei
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2013-09-09 16:47 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-12 2:12 [PATCH 3/3 v4] ARM: shmobile: bockw: add MMCIF support Kuninori Morimoto
2013-06-12 14:08 ` Simon Horman
2013-08-05 0:43 ` [PATCH 3/3 v4] ARM: shmobile: bockw: add USB Function support Kuninori Morimoto
2013-08-21 8:44 ` Simon Horman
2013-08-29 9:13 ` Magnus Damm
2013-08-29 10:26 ` Laurent Pinchart
2013-08-29 12:49 ` Sergei Shtylyov
2013-08-30 0:13 ` Kuninori Morimoto
2013-09-06 7:09 ` Simon Horman
2013-09-09 7:50 ` Magnus Damm
2013-09-09 16:47 ` Sergei Shtylyov
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).