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>
This commit is contained in:
parent
1f52c65975
commit
81a0d9062d
|
@ -32,6 +32,7 @@
|
||||||
#include <linux/smsc911x.h>
|
#include <linux/smsc911x.h>
|
||||||
#include <linux/spi/spi.h>
|
#include <linux/spi/spi.h>
|
||||||
#include <linux/spi/flash.h>
|
#include <linux/spi/flash.h>
|
||||||
|
#include <linux/usb/renesas_usbhs.h>
|
||||||
#include <media/soc_camera.h>
|
#include <media/soc_camera.h>
|
||||||
#include <mach/common.h>
|
#include <mach/common.h>
|
||||||
#include <mach/irqs.h>
|
#include <mach/irqs.h>
|
||||||
|
@ -99,6 +100,16 @@ static void __iomem *fpga;
|
||||||
* # amixer set "LINEOUT Mixer DACL" on
|
* # 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 */
|
/* Dummy supplies, where voltage doesn't matter */
|
||||||
static struct regulator_consumer_supply dummy_supplies[] = {
|
static struct regulator_consumer_supply dummy_supplies[] = {
|
||||||
REGULATOR_SUPPLY("vddvario", "smsc911x"),
|
REGULATOR_SUPPLY("vddvario", "smsc911x"),
|
||||||
|
@ -117,13 +128,71 @@ static struct resource smsc911x_resources[] __initdata = {
|
||||||
DEFINE_RES_IRQ(irq_pin(0)), /* IRQ 0 */
|
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 */
|
/* USB */
|
||||||
static struct resource usb_phy_resources[] __initdata = {
|
static struct resource usb_phy_resources[] __initdata = {
|
||||||
DEFINE_RES_MEM(0xffe70800, 0x100),
|
DEFINE_RES_MEM(0xffe70800, 0x100),
|
||||||
DEFINE_RES_MEM(0xffe76000, 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 */
|
/* SDHI */
|
||||||
static struct sh_mobile_sdhi_info sdhi0_info __initdata = {
|
static struct sh_mobile_sdhi_info sdhi0_info __initdata = {
|
||||||
|
@ -445,7 +514,7 @@ static const struct pinctrl_map bockw_pinctrl_map[] = {
|
||||||
/* USB */
|
/* USB */
|
||||||
PIN_MAP_MUX_GROUP_DEFAULT("ehci-platform", "pfc-r8a7778",
|
PIN_MAP_MUX_GROUP_DEFAULT("ehci-platform", "pfc-r8a7778",
|
||||||
"usb0", "usb0"),
|
"usb0", "usb0"),
|
||||||
PIN_MAP_MUX_GROUP_DEFAULT("ehci-platform", "pfc-r8a7778",
|
PIN_MAP_MUX_GROUP_DEFAULT(USB1_DEVICE, "pfc-r8a7778",
|
||||||
"usb1", "usb1"),
|
"usb1", "usb1"),
|
||||||
/* SDHI0 */
|
/* SDHI0 */
|
||||||
PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7778",
|
PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7778",
|
||||||
|
@ -583,6 +652,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 = {
|
static const char *bockw_boards_compat_dt[] __initdata = {
|
||||||
"renesas,bockw",
|
"renesas,bockw",
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -593,5 +668,5 @@ DT_MACHINE_START(BOCKW_DT, "bockw")
|
||||||
.init_irq = r8a7778_init_irq_dt,
|
.init_irq = r8a7778_init_irq_dt,
|
||||||
.init_machine = bockw_init,
|
.init_machine = bockw_init,
|
||||||
.dt_compat = bockw_boards_compat_dt,
|
.dt_compat = bockw_boards_compat_dt,
|
||||||
.init_late = r8a7778_init_late,
|
.init_late = bockw_init_late,
|
||||||
MACHINE_END
|
MACHINE_END
|
||||||
|
|
Loading…
Reference in New Issue