Skip to contentSkip to conversation

driver model bringup of xhci-omap on am437x sk evm

RFC PATCH New Mugunthan V N 3 participants 9 messages Jan 4, 2016 – Jan 8, 2016

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover driver model bringup of xhci-omap on am437x sk evm

With the bringup patches, *usb start* leads to data abort in free() back trace below. The backtrace doesn't involve any of the code added in this series, but still I see a crash. Has anyone faced similar kind of issue? I see samsung xhci drivers is already converted to DM, was there any similar issue faced?

When I hacked free() to return without doing anything it passes and I am able to load kernel from a usb drive.
Pushed a branch [1] if any one interested in testing, my test logs [2]

free(void *)() at dlmalloc.c:2,462 OxBFF702F2
free_pipelist(struct pipe*, int)() at cli_hush.c:1,986 OxBFF62794 parse_stream_outer(struct in_str *, int)() at cli_hush.c:3,197 OxBFF63904 parsefile_outer() at cli_hush.c:3,281 OxBFF6397A
cli loop() at cli.c:207 OxBFF71A96
main_loop() at main.c:89 OxBFF62442
run_main_loop() at board_r.c:731 OxBFF63DB2
initcall_run_list(int (*)() *)() at initcall.c:32 OxBFF87E5E board_init_r(struct global_data *, unsigned long)() at board_r.c:976 OxBFF63EB8 OxBFF6194C (no symbols are defined for OxBFF6194C)

[1]: git://git.ti.com/~mugunthanvnm/ti-u-boot/mugunth-ti-u-boot.git dm-usb-rfc [2]: http://pastebin.ubuntu.com/14398751/

Mugunthan V N (4):
configs: am43xx: enabled USB support for U-boot
drivers: usb: xhci-omap: convert driver to adopt driver model
arm: dts: am4372: add xhci-omap compatible to host node
defconfig: am437x_sk_evm: enable usb driver model

 arch/arm/dts/am4372.dtsi        |  2 +-
 configs/am437x_sk_evm_defconfig |  2 ++
 drivers/usb/host/xhci-omap.c    | 77 +++++++++++++++++++++++++++++++++++++++++
 include/configs/am43xx_evm.h    |  3 +-
 4 files changed, 82 insertions(+), 2 deletions(-)
Signature · 1 line
2.7.0.rc3
#1 lore raw

RFC PATCH 1/4 configs: am43xx: enabled USB support for U-boot

Currently USB is enabled only when boot from USB host mode. Enable USB for U-boot so that Kernel/U-boot binaries can be loaded from USB for update or booting.

---
 include/configs/am43xx_evm.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/configs/am43xx_evm.h +2 -1
index aac550a..31b3432 100644
@@ -103,7 +103,8 @@
 #define CONFIG_SPL_LDSCRIPT		"$(CPUDIR)/omap-common/u-boot-spl.lds"
 
 /* SPL USB Support */
-#ifdef CONFIG_SPL_USB_HOST_SUPPORT
+#if !defined(CONFIG_SPL_BUILD) || \
+	defined(CONFIG_SPL_USB_HOST_SUPPORT)
 #define CONFIG_SPL_USB_SUPPORT
 #define CONFIG_SYS_USB_FAT_BOOT_PARTITION		1
 
Signature · 1 line
2.7.0.rc3
#2 lore raw

RFC PATCH 1/4 configs: am43xx: enabled USB support for U-boot

Quoted 5 lines · Mugunthan V N

Currently USB is enabled only when boot from USB host mode. Enable USB for U-boot so that Kernel/U-boot binaries can be loaded from USB for update or booting.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160104/86a8429c/attachment.sig>
#3 lore raw

RFC PATCH 2/4 drivers: usb: xhci-omap: convert driver to adopt driver model

In reply to Mugunthan V N

Adopt usb xhci-omap to driver model

---
 drivers/usb/host/xhci-omap.c | 77 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 77 insertions(+)
drivers/usb/host/xhci-omap.c +77 -0
index fd19f79..50ab16f 100644
@@ -20,6 +20,8 @@
 #include <linux/usb/dwc3.h>
 #include <linux/usb/xhci-omap.h>
 
+#include <dm.h>
+
 #include "xhci.h"
 
 /* Declare global data pointer */
@@ -98,3 +100,78 @@ void xhci_hcd_stop(int index)
 	omap_xhci_core_exit(ctx);
 	board_usb_cleanup(index, USB_INIT_HOST);
 }
+
+#ifdef CONFIG_DM_USB
+
+static int xhci_omap_ofdata_to_platdata(struct udevice *dev)
+{
+	struct omap_xhci *ctx = dev_get_priv(dev);
+	const void *fdt = gd->fdt_blob;
+	int usbnode;
+	int physnode;
+
+	usbnode = fdt_subnode_offset(fdt, dev->of_offset, "usb");
+
+	ctx->hcd = (struct xhci_hccr *)fdtdec_get_addr(fdt, usbnode, "reg");
+	ctx->dwc3_reg = (struct dwc3 *)((char *)(ctx->hcd) + DWC3_REG_OFFSET);
+
+	physnode = fdtdec_lookup_phandle(fdt, usbnode, "phys");
+	ctx->usb3_phy = (struct omap_usb3_phy *)fdtdec_get_addr(fdt, physnode,
+								"reg");
+
+	ctx->usb3_phy = (struct omap_usb3_phy *)OMAP_OCP1_SCP_BASE;
+	ctx->otg_wrapper = (struct omap_dwc_wrapper *)ctx->dwc3_reg;
+
+	return 0;
+}
+
+static int xhci_omap_probe(struct udevice *dev)
+{
+	struct omap_xhci *ctx = dev_get_priv(dev);
+	struct xhci_hcor *hcor;
+	int ret;
+
+	enable_usb_clocks(1);
+
+	hcor = (struct xhci_hcor *)((uint32_t)ctx->hcd +
+			HC_LENGTH(xhci_readl(&ctx->hcd->cr_capbase)));
+
+	ret = omap_xhci_core_init(ctx);
+	if (ret) {
+		puts("XHCI: failed to initialize controller\n");
+		return -EINVAL;
+	}
+
+	return xhci_register(dev, ctx->hcd, hcor);
+}
+
+static int xhci_omap_remove(struct udevice *dev)
+{
+	struct omap_xhci *ctx = dev_get_priv(dev);
+	int ret;
+
+	ret = xhci_deregister(dev);
+	if (ret)
+		return ret;
+	omap_xhci_core_exit(ctx);
+
+	return 0;
+}
+
+static const struct udevice_id xhci_omap_ids[] = {
+	{ .compatible = "ti,am437x-xhci" },
+	{ }
+};
+
+U_BOOT_DRIVER(usb_ehci) = {
+	.name	= "xhci_omap",
+	.id	= UCLASS_USB,
+	.of_match = xhci_omap_ids,
+	.ofdata_to_platdata = xhci_omap_ofdata_to_platdata,
+	.probe = xhci_omap_probe,
+	.remove = xhci_omap_remove,
+	.ops	= &xhci_usb_ops,
+	.priv_auto_alloc_size = sizeof(struct omap_xhci),
+	.flags	= DM_FLAG_ALLOC_PRIV_DMA,
+};
+#endif /* CONFIG_DM_USB */
Signature · 1 line
2.7.0.rc3
#5 lore raw

RFC PATCH 3/4 arm: dts: am4372: add xhci-omap compatible to host node

In reply to Mugunthan V N

since dwc3 node can support both host and device mode, but U-boot driver for host and device are separate driver, adding host compatible for host usb node.

---
 arch/arm/dts/am4372.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/dts/am4372.dtsi +1 -1
index 3fffe1e..2fbe4d9 100644
@@ -883,7 +883,7 @@
 		};
 
 		dwc3_2: omap_dwc3 at 483c0000 {
-			compatible = "ti,am437x-dwc3";
+			compatible = "ti,am437x-dwc3", "ti,am437x-xhci";
 			ti,hwmods = "usb_otg_ss1";
 			reg = <0x483c0000 0x10000>;
 			interrupts = <GIC_SPI 178 IRQ_TYPE_LEVEL_HIGH>;
Signature · 1 line
2.7.0.rc3
#6 lore raw

RFC PATCH 3/4 arm: dts: am4372: add xhci-omap compatible to host node

Quoted 8 lines · Mugunthan V N

since dwc3 node can support both host and device mode, but U-boot driver for host and device are separate driver, adding host compatible for host usb node.

---
 arch/arm/dts/am4372.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#7 lore raw

RFC PATCH 4/4 defconfig: am437x_sk_evm: enable usb driver model

In reply to Mugunthan V N

enable spi driver model for am437x_sk_evm as usb xhci-omap supports driver model

---
 configs/am437x_sk_evm_defconfig | 2 ++
 1 file changed, 2 insertions(+)
configs/am437x_sk_evm_defconfig +2 -0
index a9b6f52..866bb32 100644
@@ -18,3 +18,5 @@ CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_MACRONIX=y
 CONFIG_SYS_NS16550=y
 CONFIG_TI_QSPI=y
+CONFIG_USB=y
+CONFIG_DM_USB=y
Signature · 1 line
2.7.0.rc3