All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH RFC 0/4] driver model bringup of xhci-omap on am437x sk evm
@ 2016-01-04 14:03 Mugunthan V N
  2016-01-04 14:03 ` [U-Boot] [PATCH RFC 1/4] configs: am43xx: enabled USB support for U-boot Mugunthan V N
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Mugunthan V N @ 2016-01-04 14:03 UTC (permalink / raw)
  To: u-boot

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(-)

-- 
2.7.0.rc3

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH RFC 1/4] configs: am43xx: enabled USB support for U-boot
  2016-01-04 14:03 [U-Boot] [PATCH RFC 0/4] driver model bringup of xhci-omap on am437x sk evm Mugunthan V N
@ 2016-01-04 14:03 ` Mugunthan V N
  2016-01-04 19:59   ` Tom Rini
  2016-01-04 14:03 ` [U-Boot] [PATCH RFC 2/4] drivers: usb: xhci-omap: convert driver to adopt driver model Mugunthan V N
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Mugunthan V N @ 2016-01-04 14:03 UTC (permalink / raw)
  To: 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.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
---
 include/configs/am43xx_evm.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/configs/am43xx_evm.h b/include/configs/am43xx_evm.h
index aac550a..31b3432 100644
--- a/include/configs/am43xx_evm.h
+++ b/include/configs/am43xx_evm.h
@@ -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
 
-- 
2.7.0.rc3

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH RFC 2/4] drivers: usb: xhci-omap: convert driver to adopt driver model
  2016-01-04 14:03 [U-Boot] [PATCH RFC 0/4] driver model bringup of xhci-omap on am437x sk evm Mugunthan V N
  2016-01-04 14:03 ` [U-Boot] [PATCH RFC 1/4] configs: am43xx: enabled USB support for U-boot Mugunthan V N
@ 2016-01-04 14:03 ` Mugunthan V N
  2016-01-08  3:34   ` Simon Glass
  2016-01-04 14:03 ` [U-Boot] [PATCH RFC 3/4] arm: dts: am4372: add xhci-omap compatible to host node Mugunthan V N
  2016-01-04 14:03 ` [U-Boot] [PATCH RFC 4/4] defconfig: am437x_sk_evm: enable usb driver model Mugunthan V N
  3 siblings, 1 reply; 9+ messages in thread
From: Mugunthan V N @ 2016-01-04 14:03 UTC (permalink / raw)
  To: u-boot

Adopt usb xhci-omap to driver model

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
---
 drivers/usb/host/xhci-omap.c | 77 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 77 insertions(+)

diff --git a/drivers/usb/host/xhci-omap.c b/drivers/usb/host/xhci-omap.c
index fd19f79..50ab16f 100644
--- a/drivers/usb/host/xhci-omap.c
+++ b/drivers/usb/host/xhci-omap.c
@@ -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 */
-- 
2.7.0.rc3

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH RFC 3/4] arm: dts: am4372: add xhci-omap compatible to host node
  2016-01-04 14:03 [U-Boot] [PATCH RFC 0/4] driver model bringup of xhci-omap on am437x sk evm Mugunthan V N
  2016-01-04 14:03 ` [U-Boot] [PATCH RFC 1/4] configs: am43xx: enabled USB support for U-boot Mugunthan V N
  2016-01-04 14:03 ` [U-Boot] [PATCH RFC 2/4] drivers: usb: xhci-omap: convert driver to adopt driver model Mugunthan V N
@ 2016-01-04 14:03 ` Mugunthan V N
  2016-01-08  3:34   ` Simon Glass
  2016-01-04 14:03 ` [U-Boot] [PATCH RFC 4/4] defconfig: am437x_sk_evm: enable usb driver model Mugunthan V N
  3 siblings, 1 reply; 9+ messages in thread
From: Mugunthan V N @ 2016-01-04 14:03 UTC (permalink / raw)
  To: u-boot

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.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
---
 arch/arm/dts/am4372.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/dts/am4372.dtsi b/arch/arm/dts/am4372.dtsi
index 3fffe1e..2fbe4d9 100644
--- a/arch/arm/dts/am4372.dtsi
+++ b/arch/arm/dts/am4372.dtsi
@@ -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>;
-- 
2.7.0.rc3

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH RFC 4/4] defconfig: am437x_sk_evm: enable usb driver model
  2016-01-04 14:03 [U-Boot] [PATCH RFC 0/4] driver model bringup of xhci-omap on am437x sk evm Mugunthan V N
                   ` (2 preceding siblings ...)
  2016-01-04 14:03 ` [U-Boot] [PATCH RFC 3/4] arm: dts: am4372: add xhci-omap compatible to host node Mugunthan V N
@ 2016-01-04 14:03 ` Mugunthan V N
  2016-01-08  3:34   ` Simon Glass
  3 siblings, 1 reply; 9+ messages in thread
From: Mugunthan V N @ 2016-01-04 14:03 UTC (permalink / raw)
  To: u-boot

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

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
---
 configs/am437x_sk_evm_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/am437x_sk_evm_defconfig b/configs/am437x_sk_evm_defconfig
index a9b6f52..866bb32 100644
--- a/configs/am437x_sk_evm_defconfig
+++ b/configs/am437x_sk_evm_defconfig
@@ -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
-- 
2.7.0.rc3

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH RFC 1/4] configs: am43xx: enabled USB support for U-boot
  2016-01-04 14:03 ` [U-Boot] [PATCH RFC 1/4] configs: am43xx: enabled USB support for U-boot Mugunthan V N
@ 2016-01-04 19:59   ` Tom Rini
  0 siblings, 0 replies; 9+ messages in thread
From: Tom Rini @ 2016-01-04 19:59 UTC (permalink / raw)
  To: u-boot

On Mon, Jan 04, 2016 at 07:33:50PM +0530, Mugunthan V N wrote:

> 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.
> 
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>

Reviewed-by: Tom Rini <trini@konsulko.com>

-- 
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>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH RFC 2/4] drivers: usb: xhci-omap: convert driver to adopt driver model
  2016-01-04 14:03 ` [U-Boot] [PATCH RFC 2/4] drivers: usb: xhci-omap: convert driver to adopt driver model Mugunthan V N
@ 2016-01-08  3:34   ` Simon Glass
  0 siblings, 0 replies; 9+ messages in thread
From: Simon Glass @ 2016-01-08  3:34 UTC (permalink / raw)
  To: u-boot

On 4 January 2016 at 07:03, Mugunthan V N <mugunthanvnm@ti.com> wrote:
> Adopt usb xhci-omap to driver model
>
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
> ---
>  drivers/usb/host/xhci-omap.c | 77 ++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 77 insertions(+)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH RFC 3/4] arm: dts: am4372: add xhci-omap compatible to host node
  2016-01-04 14:03 ` [U-Boot] [PATCH RFC 3/4] arm: dts: am4372: add xhci-omap compatible to host node Mugunthan V N
@ 2016-01-08  3:34   ` Simon Glass
  0 siblings, 0 replies; 9+ messages in thread
From: Simon Glass @ 2016-01-08  3:34 UTC (permalink / raw)
  To: u-boot

On 4 January 2016 at 07:03, Mugunthan V N <mugunthanvnm@ti.com> wrote:
> 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.
>
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
> ---
>  arch/arm/dts/am4372.dtsi | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH RFC 4/4] defconfig: am437x_sk_evm: enable usb driver model
  2016-01-04 14:03 ` [U-Boot] [PATCH RFC 4/4] defconfig: am437x_sk_evm: enable usb driver model Mugunthan V N
@ 2016-01-08  3:34   ` Simon Glass
  0 siblings, 0 replies; 9+ messages in thread
From: Simon Glass @ 2016-01-08  3:34 UTC (permalink / raw)
  To: u-boot

On 4 January 2016 at 07:03, Mugunthan V N <mugunthanvnm@ti.com> wrote:
> enable spi driver model for am437x_sk_evm as usb xhci-omap
> supports driver model
>
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
> ---
>  configs/am437x_sk_evm_defconfig | 2 ++
>  1 file changed, 2 insertions(+)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-01-08  3:34 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-04 14:03 [U-Boot] [PATCH RFC 0/4] driver model bringup of xhci-omap on am437x sk evm Mugunthan V N
2016-01-04 14:03 ` [U-Boot] [PATCH RFC 1/4] configs: am43xx: enabled USB support for U-boot Mugunthan V N
2016-01-04 19:59   ` Tom Rini
2016-01-04 14:03 ` [U-Boot] [PATCH RFC 2/4] drivers: usb: xhci-omap: convert driver to adopt driver model Mugunthan V N
2016-01-08  3:34   ` Simon Glass
2016-01-04 14:03 ` [U-Boot] [PATCH RFC 3/4] arm: dts: am4372: add xhci-omap compatible to host node Mugunthan V N
2016-01-08  3:34   ` Simon Glass
2016-01-04 14:03 ` [U-Boot] [PATCH RFC 4/4] defconfig: am437x_sk_evm: enable usb driver model Mugunthan V N
2016-01-08  3:34   ` Simon Glass

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.