Skip to contentSkip to conversation

usb: musb: Adding support for ti81xx

PATCH Superseded Ajay Kumar Gupta 6 participants 15 messages Sep 7, 2011 – Sep 8, 2011 5 messages not in the archive

Subsystems (7)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#2 lore raw

PATCH v2 1/6 omap: musb: Adding hwmod data for ti81xx

In reply to a message not in the archive

From: Ravi Babu <[email protected]>

The usb subsystem (usbss) in ti81xx has two musb interfaces. There are three irqs and three address spaces for usbss, musb0 and musb1 respectively. Created one hwmod with three irq and memory resources.

Cc Benoit Cousson <[email protected]>
Cc Keshava Munegowda <[email protected]>
---
 arch/arm/mach-omap2/omap_hwmod_81xx_data.c |   74 ++++++++++++++++++++++++++++
 1 files changed, 74 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/omap_hwmod_81xx_data.c +74 -0
index e73a4c6..e960d70 100644
@@ -194,6 +194,7 @@ static struct omap_hwmod ti81xx_timer4_hwmod;
 static struct omap_hwmod ti81xx_timer5_hwmod;
 static struct omap_hwmod ti81xx_timer6_hwmod;
 static struct omap_hwmod ti81xx_timer7_hwmod;
+static struct omap_hwmod ti81xx_usbss_hwmod;
 
 /* L4 SLOW -> TIMER1 interface */
 static struct omap_hwmod_addr_space ti81xx_timer1_addr_space[] = {
@@ -650,6 +651,78 @@ static struct omap_hwmod ti81xx_timer7_hwmod = {
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_TI816X | CHIP_IS_TI814X)
 };
 
+/* L3 SLOW -> USBSS interface */
+static struct omap_hwmod_addr_space ti81xx_usbss_addr_space[] = {
+	{
+		.name		= "usbss",
+		.pa_start	= 0x47400000,
+		.pa_end		= 0x47400000 + SZ_4K - 1,
+		.flags		= ADDR_TYPE_RT
+	},
+	{
+		.name		= "musb0",
+		.pa_start	= 0x47401000,
+		.pa_end		= 0x47401000 + SZ_2K - 1,
+		.flags		= ADDR_TYPE_RT
+	},
+	{
+		.name		= "musb1",
+		.pa_start	= 0x47401800,
+		.pa_end		= 0x47401800 + SZ_2K - 1,
+		.flags		= ADDR_TYPE_RT
+	},
+	{
+	},
+};
+
+static struct omap_hwmod_class_sysconfig ti81xx_usbhsotg_sysc = {
+	.rev_offs	= 0x0,
+	.sysc_offs	= 0x10,
+	.sysc_flags	= (SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET),
+	.idlemodes	= (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+	.sysc_fields	= &omap_hwmod_sysc_type2,
+};
+
+static struct omap_hwmod_class ti81xx_usbotg_class = {
+	.name = "usbotg",
+	.sysc = &ti81xx_usbhsotg_sysc,
+};
+
+static struct omap_hwmod_irq_info ti81xx_usbss_mpu_irqs[] = {
+	{ .name = "usbss-irq", .irq = 17, },
+	{ .name = "musb0-irq", .irq = 18, },
+	{ .name = "musb1-irq", .irq = 19, },
+	{ .irq = -1, },
+};
+
+static struct omap_hwmod_ocp_if ti81xx_l3_slow__usbss = {
+	.master		= &ti81xx_l3_slow_hwmod,
+	.slave		= &ti81xx_usbss_hwmod,
+	.clk		= "usbotg_ick",
+	.addr		= ti81xx_usbss_addr_space,
+	.user		= OCP_USER_MPU,
+	.flags		= OCPIF_SWSUP_IDLE,
+};
+
+static struct omap_hwmod_ocp_if *ti81xx_usbss_slaves[] = {
+	&ti81xx_l3_slow__usbss,
+};
+
+static struct omap_hwmod ti81xx_usbss_hwmod = {
+	.name		= "usb_otg_hs",
+	.mpu_irqs	= ti81xx_usbss_mpu_irqs,
+	.main_clk	= "usbotg_ick",
+	.clkdm_name	= "default_usb_clkdm",
+	.prcm		= {
+		.omap4 = {
+			.clkctrl_offs = TI816X_CM_DEFAULT_USB_CLKCTRL_OFFSET,
+		},
+	},
+	.slaves		= ti81xx_usbss_slaves,
+	.slaves_cnt	= ARRAY_SIZE(ti81xx_usbss_slaves),
+	.class		= &ti81xx_usbotg_class,
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_TI816X | CHIP_IS_TI814X)
+};
 
 static __initdata struct omap_hwmod *ti81xx_hwmods[] = {
 	&ti81xx_l3_fast_hwmod,
@@ -668,6 +741,7 @@ static __initdata struct omap_hwmod *ti81xx_hwmods[] = {
 	&ti81xx_timer5_hwmod,
 	&ti81xx_timer6_hwmod,
 	&ti81xx_timer7_hwmod,
+	&ti81xx_usbss_hwmod,
 	NULL,
 };
 
Signature · 6 lines
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#9 lore raw

PATCH v2 2/6 omap: musb: Adding support for ti81xx

In reply to a message not in the archive

From: Ravi Babu <[email protected]>

Added musb support for ti81xx platform which has two instances of musb interface and uses CPPI4.1 DMA. The current patch set adds support for single instance and in PIO mode only.

---
 arch/arm/mach-omap2/usb-musb.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/usb-musb.c +3 -0
index a65145b..8bceeca 100644
@@ -143,6 +143,9 @@ void __init usb_musb_init(struct omap_musb_board_data *musb_board_data)
 	if (cpu_is_omap3517() || cpu_is_omap3505()) {
 		oh_name = "am35x_otg_hs";
 		name = "musb-am35x";
+	} else if (cpu_is_ti81xx()) {
+		oh_name = "usb_otg_hs";
+		name = "musb-ti81xx";
 	} else {
 		oh_name = "usb_otg_hs";
 		name = "musb-omap2430";
Signature · 6 lines
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#10 lore raw

PATCH v2 6/6 usb: musb: Add support for ti81xx platform

In reply to a message not in the archive

From: Ravi Babu <[email protected]>

TI81XX platform has two musb interfaces and uses CPPI4.1 DMA engine. It has builtin USB PHYs as AM35x. The current set of patches adds support for one instance and only in PIO mode.

---
 drivers/usb/musb/Kconfig     |    6 +
 drivers/usb/musb/Makefile    |    1 +
 drivers/usb/musb/musb_core.c |    4 +-
 drivers/usb/musb/musb_dsps.c |  684 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 694 insertions(+), 1 deletions(-)
 create mode 100644 drivers/usb/musb/musb_dsps.c
drivers/usb/musb/Kconfig +6 -0
index 6192b45..444d106 100644
@@ -11,6 +11,7 @@ config USB_MUSB_HDRC
 	depends on USB && USB_GADGET
 	depends on (ARM || (BF54x && !BF544) || (BF52x && !BF522 && !BF523))
 	select NOP_USB_XCEIV if (ARCH_DAVINCI || MACH_OMAP3EVM || BLACKFIN)
+	select NOP_USB_XCEIV if SOC_OMAPTI81XX
 	select TWL4030_USB if MACH_OMAP_3430SDP
 	select TWL6030_USB if MACH_OMAP_4430SDP || MACH_OMAP4_PANDA
 	select USB_OTG_UTILS
@@ -57,6 +58,10 @@ config USB_MUSB_AM35X
 	tristate "AM35x"
 	depends on ARCH_OMAP
 
+config USB_MUSB_DSPS
+	tristate "TI DSPS platforms"
+	depends on SOC_OMAPTI81XX
+
 config USB_MUSB_BLACKFIN
 	tristate "Blackfin"
 	depends on (BF54x && !BF544) || (BF52x && ! BF522 && !BF523)
@@ -71,6 +76,7 @@ config MUSB_PIO_ONLY
 	bool 'Disable DMA (always use PIO)'
 	depends on USB_MUSB_HDRC
 	default USB_MUSB_TUSB6010 || USB_MUSB_DA8XX || USB_MUSB_AM35X
+	default SOC_OMAPTI81XX
 	help
 	  All data is copied between memory and FIFO by the CPU.
 	  DMA controllers are ignored.
drivers/usb/musb/Makefile +1 -0
index d8fd9d0..d92d110 100644
@@ -13,6 +13,7 @@ musb_hdrc-$(CONFIG_DEBUG_FS)			+= musb_debugfs.o
 # Hardware Glue Layer
 obj-$(CONFIG_USB_MUSB_OMAP2PLUS)		+= omap2430.o
 obj-$(CONFIG_USB_MUSB_AM35X)			+= am35x.o
+obj-$(CONFIG_USB_MUSB_DSPS)			+= musb_dsps.o
 obj-$(CONFIG_USB_MUSB_TUSB6010)			+= tusb6010.o
 obj-$(CONFIG_USB_MUSB_DAVINCI)			+= davinci.o
 obj-$(CONFIG_USB_MUSB_DA8XX)			+= da8xx.o
drivers/usb/musb/musb_core.c +3 -1
index 20a2873..b04790d 100644
@@ -1014,7 +1014,9 @@ static void musb_shutdown(struct platform_device *pdev)
 	|| defined(CONFIG_USB_MUSB_OMAP2PLUS)		\
 	|| defined(CONFIG_USB_MUSB_OMAP2PLUS_MODULE)	\
 	|| defined(CONFIG_USB_MUSB_AM35X)		\
-	|| defined(CONFIG_USB_MUSB_AM35X_MODULE)
+	|| defined(CONFIG_USB_MUSB_AM35X_MODULE)	\
+	|| defined(CONFIG_USB_MUSB_DSPS)		\
+	|| defined(CONFIG_USB_MUSB_DSPS_MODULE)
 static ushort __initdata fifo_mode = 4;
 #elif defined(CONFIG_USB_MUSB_UX500)			\
 	|| defined(CONFIG_USB_MUSB_UX500_MODULE)
drivers/usb/musb/musb_dsps.c new file +684 -0

684 lines not on this page · raw message

Signature · 6 lines
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#14 lore raw

PATCH v2 3/6 omap: musb: ti81xx: Add phy power function

In reply to Ajay Kumar Gupta

Adding ti81xx_musb_phy_power() which will be used by musb driver through its function pointer in board_data.

---
 arch/arm/mach-omap2/omap_phy_internal.c |   24 +++++++++++++++++++++++
 arch/arm/plat-omap/include/plat/usb.h   |   32 +++++++++++++++++++++++++++++++
 2 files changed, 56 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/omap_phy_internal.c +24 -0
index 58775e3..352b6af 100644
@@ -260,3 +260,27 @@ void am35x_set_mode(u8 musb_mode)
 
 	omap_ctrl_writel(devconf2, AM35XX_CONTROL_DEVCONF2);
 }
+
+void ti81xx_musb_phy_power(u8 on)
+{
+	u32 usbphycfg = omap_ctrl_readl(USBCTRL0);
+
+	if (on) {
+		if (cpu_is_ti816x()) {
+			usbphycfg |= TI816X_USBPHY0_NORMAL_MODE;
+			usbphycfg &= ~TI816X_USBPHY_REFCLK_OSC;
+		} else if (cpu_is_ti814x()) {
+			usbphycfg &= ~(USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN
+				| USBPHY_DPINPUT | USBPHY_DMINPUT);
+			usbphycfg |= (USBPHY_OTGVDET_EN | USBPHY_OTGSESSEND_EN
+				| USBPHY_DPOPBUFCTL | USBPHY_DPOPBUFCTL);
+		}
+	} else {
+		if (cpu_is_ti816x())
+			usbphycfg &= ~TI816X_USBPHY0_NORMAL_MODE;
+		else if (cpu_is_ti814x())
+			usbphycfg |= USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN;
+
+	}
+	omap_ctrl_writel(usbphycfg, USBCTRL0);
+}
arch/arm/plat-omap/include/plat/usb.h +32 -0
index 17d3c93..c616385 100644
@@ -114,6 +114,7 @@ extern void am35x_musb_reset(void);
 extern void am35x_musb_phy_power(u8 on);
 extern void am35x_musb_clear_irq(void);
 extern void am35x_set_mode(u8 musb_mode);
+extern void ti81xx_musb_phy_power(u8 on);
 
 /*
  * FIXME correct answer depends on hmc_mode,
@@ -273,6 +274,37 @@ static inline void omap2_usbfs_init(struct omap_usb_config *pdata)
 #define CONF2_OTGPWRDN		(1 << 2)
 #define CONF2_DATPOL		(1 << 1)
 
+/* TI81XX specific definitions */
+#define USBCTRL0	0x620
+#define USBSTAT0	0x624
+
+/* TI816X PHY controls bits */
+#define TI816X_USBPHY0_NORMAL_MODE	(1 << 0)
+#define TI816X_USBPHY_REFCLK_OSC	(1 << 8)
+
+/* TI814X PHY controls bits */
+#define USBPHY_CM_PWRDN		(1 << 0)
+#define USBPHY_OTG_PWRDN	(1 << 1)
+#define USBPHY_CHGDET_DIS	(1 << 2)
+#define USBPHY_CHGDET_RSTRT	(1 << 3)
+#define USBPHY_SRCONDM		(1 << 4)
+#define USBPHY_SINKONDP		(1 << 5)
+#define USBPHY_CHGISINK_EN	(1 << 6)
+#define USBPHY_CHGVSRC_EN	(1 << 7)
+#define USBPHY_DMPULLUP		(1 << 8)
+#define USBPHY_DPPULLUP		(1 << 9)
+#define USBPHY_CDET_EXTCTL	(1 << 10)
+#define USBPHY_GPIO_MODE	(1 << 12)
+#define USBPHY_DPOPBUFCTL	(1 << 13)
+#define USBPHY_DMOPBUFCTL	(1 << 14)
+#define USBPHY_DPINPUT		(1 << 15)
+#define USBPHY_DMINPUT		(1 << 16)
+#define USBPHY_DPGPIO_PD	(1 << 17)
+#define USBPHY_DMGPIO_PD	(1 << 18)
+#define USBPHY_OTGVDET_EN	(1 << 19)
+#define USBPHY_OTGSESSEND_EN	(1 << 20)
+#define USBPHY_DATA_POLARITY	(1 << 23)
+
 #if defined(CONFIG_ARCH_OMAP1) && defined(CONFIG_USB)
 u32 omap1_usb0_init(unsigned nwires, unsigned is_device);
 u32 omap1_usb1_init(unsigned nwires);
Signature · 1 line
1.6.2.4
#18 lore raw

PATCH v2 4/6 ti816evm: Add support for musb interface

In reply to Ajay Kumar Gupta

From: Ravi Babu <[email protected]>

Adding musb support in ti816 EVM board file.

---
 arch/arm/mach-omap2/board-ti8168evm.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/board-ti8168evm.c +9 -0
index e516a04..5a4a6c8 100644
@@ -23,6 +23,14 @@
 #include <plat/irqs.h>
 #include <plat/board.h>
 #include <plat/common.h>
+#include <plat/usb.h>
+
+static struct omap_musb_board_data musb_board_data = {
+	.set_phy_power	= ti81xx_musb_phy_power,
+	.interface_type	= MUSB_INTERFACE_ULPI,
+	.mode           = MUSB_OTG,
+	.power		= 500,
+};
 
 static struct omap_board_config_kernel ti8168_evm_config[] __initdata = {
 };
@@ -38,6 +46,7 @@ static void __init ti8168_evm_init(void)
 	omap_serial_init();
 	omap_board_config = ti8168_evm_config;
 	omap_board_config_size = ARRAY_SIZE(ti8168_evm_config);
+	usb_musb_init(&musb_board_data);
 }
 
 static void __init ti8168_evm_map_io(void)
Signature · 1 line
1.6.2.4
#0 lore raw

v2 cover usb: musb: Adding support for ti81xx

This patch set adds support for musb interface for TI81XX platforms and are dependent on recent patch series from Hemant Pedanekar at [1] and [2].

TI81XX platform has dual musb instances, uses CPPI4.1 DMA and has built in usb PHY. The current set of patches supports only the first interface and in PIO mode.

[1] http://marc.info/?l=linux-omap&m=131247989220300&w=2
[2] http://marc.info/?l=linux-omap&m=131411961308438&w=2

Changes from v1:
- cleaned up #ifdefs of CONFIG_USB_MUSB_HDRC_HCD and CONFIG_USB_GADGET_MUSB_HDRC
- Fixed the full name of author
- Renamed ti81xx.c to musb_dsps.c
- Used platform_device_id table
- created dsps_glue_wrapper structure and used the same

Ajay Kumar Gupta (1):
omap: musb: ti81xx: Add phy power function

Ravi Babu (5):
omap: musb: Adding hwmod data for ti81xx
omap: musb: Adding support for ti81xx
ti816evm: Add support for musb interface
ti814evm: Add support for musb interface
usb: musb: Add support for ti81xx platform

 arch/arm/mach-omap2/board-ti8148evm.c      |    9 +
 arch/arm/mach-omap2/board-ti8168evm.c      |    9 +
 arch/arm/mach-omap2/omap_hwmod_81xx_data.c |   74 +++
 arch/arm/mach-omap2/omap_phy_internal.c    |   24 +
 arch/arm/mach-omap2/usb-musb.c             |    3 +
 arch/arm/plat-omap/include/plat/usb.h      |   32 ++
 drivers/usb/musb/Kconfig                   |    6 +
 drivers/usb/musb/Makefile                  |    1 +
 drivers/usb/musb/musb_core.c               |    4 +-
 drivers/usb/musb/musb_dsps.c               |  684 ++++++++++++++++++++++++++++
 10 files changed, 845 insertions(+), 1 deletions(-)
 create mode 100644 drivers/usb/musb/musb_dsps.c
#19 lore raw

PATCH v2 5/6 ti814evm: Add support for musb interface

From: Ravi Babu <[email protected]>

Adding musb support in ti814 EVM board file.

---
 arch/arm/mach-omap2/board-ti8148evm.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/board-ti8148evm.c +9 -0
index 588d6b7..7dbf115 100644
@@ -23,6 +23,14 @@
 #include <plat/irqs.h>
 #include <plat/board.h>
 #include <plat/common.h>
+#include <plat/usb.h>
+
+static struct omap_musb_board_data musb_board_data = {
+	.set_phy_power	= ti81xx_musb_phy_power,
+	.interface_type	= MUSB_INTERFACE_ULPI,
+	.mode           = MUSB_OTG,
+	.power		= 500,
+};
 
 static struct omap_board_config_kernel ti8148_evm_config[] __initdata = {
 };
@@ -38,6 +46,7 @@ static void __init ti8148_evm_init(void)
 	omap_serial_init();
 	omap_board_config = ti8148_evm_config;
 	omap_board_config_size = ARRAY_SIZE(ti8148_evm_config);
+	usb_musb_init(&musb_board_data);
 }
 
 static void __init ti8148_evm_map_io(void)
Signature · 1 line
1.6.2.4
#12 lore raw

Re: [PATCH 6/6 v2] usb: musb: Add support for ti81xx platform

In reply to a message not in the archive

Hi,

Quoted 17 lines · Ajay Kumar Gupta
drivers/usb/musb/musb_dsps.c new file +17 -0
+static int __devinit dsps_probe(struct platform_device *pdev)
+{
+	const struct platform_device_id *id = platform_get_device_id(pdev);
+	const struct dsps_musb_wrapper *wrp =
+				(struct dsps_musb_wrapper *)id->driver_data;
+	struct dsps_glue *glue;
+	struct resource *iomem;
+	int ret;
+
+	/* allocate glue */
+	glue = kzalloc(sizeof(*glue), GFP_KERNEL);
+	if (!glue) {
+		dev_err(&pdev->dev, "unable to allocate glue memory\n");
+		ret = -ENOMEM;
+		goto err0;
+	}
+

drivers/usb/musb/musb_dsps.c line 558

Quoted 10 lines
drivers/usb/musb/musb_dsps.c new file +10 -0
+	/* get memory resource */
+	iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!iomem) {
+		dev_err(&pdev->dev, "failed to get usbss mem resourse\n");
+		ret = -ENODEV;
+		goto err1;
+	}
+
+	glue->dev = &pdev->dev;
+	glue->wrp = wrp;

wrp is marked __devinitconst, so I guess you need to copy it here, instead of just pointing to it.

Signature · 1 line
balbi
#3 lore raw

Re: [PATCH 1/6 v2] omap: musb: Adding hwmod data for ti81xx

In reply to Ajay Kumar Gupta
Quoted 114 lines · Ajay Kumar Gupta

From: Ravi Babu <[email protected]>

The usb subsystem (usbss) in ti81xx has two musb interfaces. There are three irqs and three address spaces for usbss, musb0 and musb1 respectively. Created one hwmod with three irq and memory resources.

Cc Benoit Cousson <[email protected]>
Cc Keshava Munegowda <[email protected]>

---
 arch/arm/mach-omap2/omap_hwmod_81xx_data.c |   74 ++++++++++++++++++++++++++++

 1 files changed, 74 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/omap_hwmod_81xx_data.c +74 -1
index e73a4c6..e960d70 100644
@@ -194,6 +194,7 @@ static struct omap_hwmod ti81xx_timer4_hwmod;
  static struct omap_hwmod ti81xx_timer5_hwmod;
  static struct omap_hwmod ti81xx_timer6_hwmod;
  static struct omap_hwmod ti81xx_timer7_hwmod;
+static struct omap_hwmod ti81xx_usbss_hwmod;
 
  /* L4 SLOW -> TIMER1 interface */
  static struct omap_hwmod_addr_space ti81xx_timer1_addr_space[] = {
@@ -650,6 +651,78 @@ static struct omap_hwmod ti81xx_timer7_hwmod = {
        .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_TI816X | CHIP_IS_TI814X)
  };
 
+/* L3 SLOW -> USBSS interface */
+static struct omap_hwmod_addr_space ti81xx_usbss_addr_space[] = {
+       {
+               .name           = "usbss",
+               .pa_start       = 0x47400000,
+               .pa_end         = 0x47400000 + SZ_4K - 1,
+               .flags          = ADDR_TYPE_RT
+       },
+       {
+               .name           = "musb0",
+               .pa_start       = 0x47401000,
+               .pa_end         = 0x47401000 + SZ_2K - 1,
+               .flags          = ADDR_TYPE_RT
+       },
+       {
+               .name           = "musb1",
+               .pa_start       = 0x47401800,
+               .pa_end         = 0x47401800 + SZ_2K - 1,
+               .flags          = ADDR_TYPE_RT
+       },
+       {
+       },
+};
+
+static struct omap_hwmod_class_sysconfig ti81xx_usbhsotg_sysc = {
+       .rev_offs       = 0x0,
+       .sysc_offs      = 0x10,
+       .sysc_flags     = (SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET),
+       .idlemodes      = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+       .sysc_fields    = &omap_hwmod_sysc_type2,
+};
+
+static struct omap_hwmod_class ti81xx_usbotg_class = {
+       .name = "usbotg",
+       .sysc = &ti81xx_usbhsotg_sysc,
+};
+
+static struct omap_hwmod_irq_info ti81xx_usbss_mpu_irqs[] = {
+       { .name = "usbss-irq", .irq = 17, },
+       { .name = "musb0-irq", .irq = 18, },
+       { .name = "musb1-irq", .irq = 19, },
+       { .irq = -1, },
+};
+
+static struct omap_hwmod_ocp_if ti81xx_l3_slow__usbss = {
+       .master         = &ti81xx_l3_slow_hwmod,
+       .slave          = &ti81xx_usbss_hwmod,
+       .clk            = "usbotg_ick",
+       .addr           = ti81xx_usbss_addr_space,
+       .user           = OCP_USER_MPU,
+       .flags          = OCPIF_SWSUP_IDLE,
+};
+
+static struct omap_hwmod_ocp_if *ti81xx_usbss_slaves[] = {
+       &ti81xx_l3_slow__usbss,
+};
+
+static struct omap_hwmod ti81xx_usbss_hwmod = {
+       .name           = "usb_otg_hs",
+       .mpu_irqs       = ti81xx_usbss_mpu_irqs,
+       .main_clk       = "usbotg_ick",
+       .clkdm_name     = "default_usb_clkdm",
+       .prcm           = {
+               .omap4 = {
+                       .clkctrl_offs = TI816X_CM_DEFAULT_USB_CLKCTRL_OFFSET,
+               },
+       },
+       .slaves         = ti81xx_usbss_slaves,
+       .slaves_cnt     = ARRAY_SIZE(ti81xx_usbss_slaves),
+       .class          = &ti81xx_usbotg_class,
+       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_TI816X | CHIP_IS_TI814X)
+};
 
  static __initdata struct omap_hwmod *ti81xx_hwmods[] = {
        &ti81xx_l3_fast_hwmod,
@@ -668,6 +741,7 @@ static __initdata struct omap_hwmod *ti81xx_hwmods[] = {
        &ti81xx_timer5_hwmod,
        &ti81xx_timer6_hwmod,
        &ti81xx_timer7_hwmod,
+       &ti81xx_usbss_hwmod,
        NULL,
  };
 
--
Quoted 1 line

1.6.2.4

looks good to me.

keshava
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw

Re: [PATCH 1/6 v2] omap: musb: Adding hwmod data for ti81xx

In reply to a message not in the archive

Hi,

Quoted 114 lines · Keshava
Quoted 113 lines · Ajay Kumar Gupta

From: Ravi Babu <[email protected]>

The usb subsystem (usbss) in ti81xx has two musb interfaces. There are three irqs and three address spaces for usbss, musb0 and musb1 respectively. Created one hwmod with three irq and memory resources.

Cc Benoit Cousson <[email protected]>
Cc Keshava Munegowda <[email protected]>

---
 arch/arm/mach-omap2/omap_hwmod_81xx_data.c |   74 ++++++++++++++++++++++++++++

 1 files changed, 74 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/omap_hwmod_81xx_data.c +74 -0
index e73a4c6..e960d70 100644
@@ -194,6 +194,7 @@ static struct omap_hwmod ti81xx_timer4_hwmod;
  static struct omap_hwmod ti81xx_timer5_hwmod;
  static struct omap_hwmod ti81xx_timer6_hwmod;
  static struct omap_hwmod ti81xx_timer7_hwmod;
+static struct omap_hwmod ti81xx_usbss_hwmod;
 
  /* L4 SLOW -> TIMER1 interface */
  static struct omap_hwmod_addr_space ti81xx_timer1_addr_space[] = {
@@ -650,6 +651,78 @@ static struct omap_hwmod ti81xx_timer7_hwmod = {
        .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_TI816X | CHIP_IS_TI814X)
  };
 
+/* L3 SLOW -> USBSS interface */
+static struct omap_hwmod_addr_space ti81xx_usbss_addr_space[] = {
+       {
+               .name           = "usbss",
+               .pa_start       = 0x47400000,
+               .pa_end         = 0x47400000 + SZ_4K - 1,
+               .flags          = ADDR_TYPE_RT
+       },
+       {
+               .name           = "musb0",
+               .pa_start       = 0x47401000,
+               .pa_end         = 0x47401000 + SZ_2K - 1,
+               .flags          = ADDR_TYPE_RT
+       },
+       {
+               .name           = "musb1",
+               .pa_start       = 0x47401800,
+               .pa_end         = 0x47401800 + SZ_2K - 1,
+               .flags          = ADDR_TYPE_RT
+       },
+       {
+       },
+};
+
+static struct omap_hwmod_class_sysconfig ti81xx_usbhsotg_sysc = {
+       .rev_offs       = 0x0,
+       .sysc_offs      = 0x10,
+       .sysc_flags     = (SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET),
+       .idlemodes      = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+       .sysc_fields    = &omap_hwmod_sysc_type2,
+};
+
+static struct omap_hwmod_class ti81xx_usbotg_class = {
+       .name = "usbotg",
+       .sysc = &ti81xx_usbhsotg_sysc,
+};
+
+static struct omap_hwmod_irq_info ti81xx_usbss_mpu_irqs[] = {
+       { .name = "usbss-irq", .irq = 17, },
+       { .name = "musb0-irq", .irq = 18, },
+       { .name = "musb1-irq", .irq = 19, },
+       { .irq = -1, },
+};
+
+static struct omap_hwmod_ocp_if ti81xx_l3_slow__usbss = {
+       .master         = &ti81xx_l3_slow_hwmod,
+       .slave          = &ti81xx_usbss_hwmod,
+       .clk            = "usbotg_ick",
+       .addr           = ti81xx_usbss_addr_space,
+       .user           = OCP_USER_MPU,
+       .flags          = OCPIF_SWSUP_IDLE,
+};
+
+static struct omap_hwmod_ocp_if *ti81xx_usbss_slaves[] = {
+       &ti81xx_l3_slow__usbss,
+};
+
+static struct omap_hwmod ti81xx_usbss_hwmod = {
+       .name           = "usb_otg_hs",
+       .mpu_irqs       = ti81xx_usbss_mpu_irqs,
+       .main_clk       = "usbotg_ick",
+       .clkdm_name     = "default_usb_clkdm",
+       .prcm           = {
+               .omap4 = {
+                       .clkctrl_offs = TI816X_CM_DEFAULT_USB_CLKCTRL_OFFSET,
+               },
+       },
+       .slaves         = ti81xx_usbss_slaves,
+       .slaves_cnt     = ARRAY_SIZE(ti81xx_usbss_slaves),
+       .class          = &ti81xx_usbotg_class,
+       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_TI816X | CHIP_IS_TI814X)
+};
 
  static __initdata struct omap_hwmod *ti81xx_hwmods[] = {
        &ti81xx_l3_fast_hwmod,
@@ -668,6 +741,7 @@ static __initdata struct omap_hwmod *ti81xx_hwmods[] = {
        &ti81xx_timer5_hwmod,
        &ti81xx_timer6_hwmod,
        &ti81xx_timer7_hwmod,
+       &ti81xx_usbss_hwmod,
        NULL,
  };
 
Quoted 4 lines
Quoted 2 lines

--
1.6.2.4

looks good to me.

how about you reply with your Acked-by then ?

Signature · 1 line
balbi
#7 lore raw

Re: [PATCH 1/6 v2] omap: musb: Adding hwmod data for ti81xx

In reply to a message not in the archive
Quoted 122 lines · Felipe Balbi

Hi,

Quoted 114 lines · Keshava
Quoted 113 lines · Ajay Kumar Gupta

From: Ravi Babu <[email protected]>

The usb subsystem (usbss) in ti81xx has two musb interfaces. There are three irqs and three address spaces for usbss, musb0 and musb1 respectively. Created one hwmod with three irq and memory resources.

Cc Benoit Cousson <[email protected]>
Cc Keshava Munegowda <[email protected]>

---
 arch/arm/mach-omap2/omap_hwmod_81xx_data.c |   74 ++++++++++++++++++++++++++++

 1 files changed, 74 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/omap_hwmod_81xx_data.c +74 -0
index e73a4c6..e960d70 100644
@@ -194,6 +194,7 @@ static struct omap_hwmod ti81xx_timer4_hwmod;
  static struct omap_hwmod ti81xx_timer5_hwmod;
  static struct omap_hwmod ti81xx_timer6_hwmod;
  static struct omap_hwmod ti81xx_timer7_hwmod;
+static struct omap_hwmod ti81xx_usbss_hwmod;
 
  /* L4 SLOW -> TIMER1 interface */
  static struct omap_hwmod_addr_space ti81xx_timer1_addr_space[] = {
@@ -650,6 +651,78 @@ static struct omap_hwmod ti81xx_timer7_hwmod = {
        .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_TI816X | CHIP_IS_TI814X)
  };
 
+/* L3 SLOW -> USBSS interface */
+static struct omap_hwmod_addr_space ti81xx_usbss_addr_space[] = {
+       {
+               .name           = "usbss",
+               .pa_start       = 0x47400000,
+               .pa_end         = 0x47400000 + SZ_4K - 1,
+               .flags          = ADDR_TYPE_RT
+       },
+       {
+               .name           = "musb0",
+               .pa_start       = 0x47401000,
+               .pa_end         = 0x47401000 + SZ_2K - 1,
+               .flags          = ADDR_TYPE_RT
+       },
+       {
+               .name           = "musb1",
+               .pa_start       = 0x47401800,
+               .pa_end         = 0x47401800 + SZ_2K - 1,
+               .flags          = ADDR_TYPE_RT
+       },
+       {
+       },
+};
+
+static struct omap_hwmod_class_sysconfig ti81xx_usbhsotg_sysc = {
+       .rev_offs       = 0x0,
+       .sysc_offs      = 0x10,
+       .sysc_flags     = (SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET),
+       .idlemodes      = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+       .sysc_fields    = &omap_hwmod_sysc_type2,
+};
+
+static struct omap_hwmod_class ti81xx_usbotg_class = {
+       .name = "usbotg",
+       .sysc = &ti81xx_usbhsotg_sysc,
+};
+
+static struct omap_hwmod_irq_info ti81xx_usbss_mpu_irqs[] = {
+       { .name = "usbss-irq", .irq = 17, },
+       { .name = "musb0-irq", .irq = 18, },
+       { .name = "musb1-irq", .irq = 19, },
+       { .irq = -1, },
+};
+
+static struct omap_hwmod_ocp_if ti81xx_l3_slow__usbss = {
+       .master         = &ti81xx_l3_slow_hwmod,
+       .slave          = &ti81xx_usbss_hwmod,
+       .clk            = "usbotg_ick",
+       .addr           = ti81xx_usbss_addr_space,
+       .user           = OCP_USER_MPU,
+       .flags          = OCPIF_SWSUP_IDLE,
+};
+
+static struct omap_hwmod_ocp_if *ti81xx_usbss_slaves[] = {
+       &ti81xx_l3_slow__usbss,
+};
+
+static struct omap_hwmod ti81xx_usbss_hwmod = {
+       .name           = "usb_otg_hs",
+       .mpu_irqs       = ti81xx_usbss_mpu_irqs,
+       .main_clk       = "usbotg_ick",
+       .clkdm_name     = "default_usb_clkdm",
+       .prcm           = {
+               .omap4 = {
+                       .clkctrl_offs = TI816X_CM_DEFAULT_USB_CLKCTRL_OFFSET,
+               },
+       },
+       .slaves         = ti81xx_usbss_slaves,
+       .slaves_cnt     = ARRAY_SIZE(ti81xx_usbss_slaves),
+       .class          = &ti81xx_usbotg_class,
+       .omap_chip      = OMAP_CHIP_INIT(CHIP_IS_TI816X | CHIP_IS_TI814X)
+};
 
  static __initdata struct omap_hwmod *ti81xx_hwmods[] = {
        &ti81xx_l3_fast_hwmod,
@@ -668,6 +741,7 @@ static __initdata struct omap_hwmod *ti81xx_hwmods[] = {
        &ti81xx_timer5_hwmod,
        &ti81xx_timer6_hwmod,
        &ti81xx_timer7_hwmod,
+       &ti81xx_usbss_hwmod,
        NULL,
  };
 
Quoted 4 lines
Quoted 2 lines

--
1.6.2.4

looks good to me.

Quoted 4 lines

how about you reply with your Acked-by then ?

--
balbi

yes balbi,
here it is

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#15 lore raw

Re: [PATCH 3/6 v2] omap: musb: ti81xx: Add phy power function

In reply to Ajay Kumar Gupta

Hello.

Quoted 22 lines · Ajay Kumar Gupta

Adding ti81xx_musb_phy_power() which will be used by musb driver through its function pointer in board_data.

---
  arch/arm/mach-omap2/omap_phy_internal.c |   24 +++++++++++++++++++++++
  arch/arm/plat-omap/include/plat/usb.h   |   32 +++++++++++++++++++++++++++++++
  2 files changed, 56 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/omap_phy_internal.c +4 -0
index 58775e3..352b6af 100644
@@ -260,3 +260,27 @@ void am35x_set_mode(u8 musb_mode)
 
  	omap_ctrl_writel(devconf2, AM35XX_CONTROL_DEVCONF2);
  }
+
+void ti81xx_musb_phy_power(u8 on)
+{
+	u32 usbphycfg = omap_ctrl_readl(USBCTRL0);

arch/arm/mach-omap2/omap_phy_internal.c void am35x_set_mode(u8 musb_mode) · line 276

Quoted 10 lines
arch/arm/mach-omap2/omap_phy_internal.c +10 -0
+
+	if (on) {
+		if (cpu_is_ti816x()) {
+			usbphycfg |= TI816X_USBPHY0_NORMAL_MODE;
+			usbphycfg &= ~TI816X_USBPHY_REFCLK_OSC;
+		} else if (cpu_is_ti814x()) {
+			usbphycfg&= ~(USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN
+				| USBPHY_DPINPUT | USBPHY_DMINPUT);
+			usbphycfg |= (USBPHY_OTGVDET_EN | USBPHY_OTGSESSEND_EN
+				| USBPHY_DPOPBUFCTL | USBPHY_DPOPBUFCTL);

Same #define repeated twice?

WBR, Sergei

#17 lore raw

RE: [PATCH 3/6 v2] omap: musb: ti81xx: Add phy power function

In reply to a message not in the archive

Hi,

Quoted 38 lines · Ajay Kumar Gupta
Quoted 2 lines

Adding ti81xx_musb_phy_power() which will be used by musb driver

through

Quoted 6 lines

its function pointer in board_data.

---
  arch/arm/mach-omap2/omap_phy_internal.c |   24

+++++++++++++++++++++++

Quoted 1 line
  arch/arm/plat-omap/include/plat/usb.h   |   32

+++++++++++++++++++++++++++++++

arch/arm/mach-

Quoted 3 lines
  2 files changed, 56 insertions(+), 0 deletions(-)
arch/arm/mach- renamed from arch/arm/mach-omap2/omap_phy_internal.c +0 -0

omap2/omap_phy_internal.c

Quoted 10 lines

index 58775e3..352b6af 100644

arch/arm/mach-omap2/omap_phy_internal.c +3 -0
@@ -260,3 +260,27 @@ void am35x_set_mode(u8 musb_mode)
 
  	omap_ctrl_writel(devconf2, AM35XX_CONTROL_DEVCONF2);
  }
+
+void ti81xx_musb_phy_power(u8 on)
+{

arch/arm/mach-omap2/omap_phy_internal.c void am35x_set_mode(u8 musb_mode) · line 275

Quoted 10 lines
arch/arm/mach-omap2/omap_phy_internal.c +10 -0
+	u32 usbphycfg = omap_ctrl_readl(USBCTRL0);
+
+	if (on) {
+		if (cpu_is_ti816x()) {
+			usbphycfg |= TI816X_USBPHY0_NORMAL_MODE;
+			usbphycfg &= ~TI816X_USBPHY_REFCLK_OSC;
+		} else if (cpu_is_ti814x()) {
+			usbphycfg&= ~(USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN
+				| USBPHY_DPINPUT | USBPHY_DMINPUT);
+			usbphycfg |= (USBPHY_OTGVDET_EN |

USBPHY_OTGSESSEND_EN

Quoted 3 lines

arch/arm/mach-omap2/omap_phy_internal.c void am35x_set_mode(u8 musb_mode) · line 276

Quoted 1 line
arch/arm/mach-omap2/omap_phy_internal.c +1 -0
+				| USBPHY_DPOPBUFCTL | USBPHY_DPOPBUFCTL);

Same #define repeated twice?

Good catch.. thanks. One of them should be USBPHY_DMOPBUFCTL, will fix in v3.

Ajay

Quoted 2 lines

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#8 lore raw

RE: [PATCH 1/6 v2] omap: musb: Adding hwmod data for ti81xx

In reply to Munegowda, Keshava

Hi,

Quoted 1 line

<[email protected]> wrote:

[...]

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

--
1.6.2.4

looks good to me.

how about you reply with your Acked-by then ?

Quoted 7 lines
Quoted 2 lines

--
balbi

yes balbi,
here it is

Tony and Benoit,

Please review this patch and provide your input on this.

Thanks,
Ajay

#13 lore raw

RE: [PATCH 6/6 v2] usb: musb: Add support for ti81xx platform

In reply to Felipe Balbi

Hi,

Quoted 22 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+static int __devinit dsps_probe(struct platform_device *pdev) {
+	const struct platform_device_id *id =

platform_get_device_id(pdev);

Quoted 19 lines
drivers/usb/musb/musb_dsps.c new file +19 -0
+	const struct dsps_musb_wrapper *wrp =
+				(struct dsps_musb_wrapper *)id->driver_data;
+	struct dsps_glue *glue;
+	struct resource *iomem;
+	int ret;
+
+	/* allocate glue */
+	glue = kzalloc(sizeof(*glue), GFP_KERNEL);
+	if (!glue) {
+		dev_err(&pdev->dev, "unable to allocate glue memory\n");
+		ret = -ENOMEM;
+		goto err0;
+	}
+
+	/* get memory resource */
+	iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!iomem) {
+		dev_err(&pdev->dev, "failed to get usbss mem resourse\n");
+		ret = -ENODEV;
Quoted 8 lines

drivers/usb/musb/musb_dsps.c line 558

Quoted 5 lines
drivers/usb/musb/musb_dsps.c new file +5 -0
+		goto err1;
+	}
+
+	glue->dev = &pdev->dev;
+	glue->wrp = wrp;

wrp is marked __devinitconst, so I guess you need to copy it here, instead of just pointing to it.

Will fix in v3.

Thanks,
Ajay

Quoted 3 lines

--
balbi