Skip to contentSkip to conversation

qoriq/p1_p2_rdb: USB device-tree fixups for P1020

PATCH Superseded Ramneek Mehresh 2 participants 2 messages May 10, 2011

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qoriq/p1_p2_rdb: USB device-tree fixups for P1020

Resolve P1020 second USB controller multiplexing with eLBC
- mandatory to mention USB2 in hwconfig string to select it over eLBC, otherwise USB2 node is removed
- works only for SPI and SD boot

---
Applies on git://git.am.freescale.net/mirrors/u-boot.git
(branch master)

 board/freescale/p1_p2_rdb/p1_p2_rdb.c |   54 +++++++++++++++++++++++++++++++++
 1 files changed, 54 insertions(+), 0 deletions(-)
board/freescale/p1_p2_rdb/p1_p2_rdb.c +54 -0
index d66b130..14ad895 100644
@@ -37,6 +37,7 @@
 #include <netdev.h>
 #include <rtc.h>
 #include <i2c.h>
+#include <hwconfig.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -247,6 +248,11 @@ extern void ft_pci_board_setup(void *blob);
 
 void ft_board_setup(void *blob, bd_t *bd)
 {
+#if defined(CONFIG_SDCARD) || defined(CONFIG_SPIFLASH)
+	const char *soc_elbc_compat = "fsl,p1020-elbc";
+#endif
+	const char *soc_usb_compat = "fsl-usb2-dr";
+	int off, err, usb1_off, usb2_off;
 	phys_addr_t base;
 	phys_size_t size;
 
@@ -260,5 +266,53 @@ void ft_board_setup(void *blob, bd_t *bd)
 #endif /* #if defined(CONFIG_PCI) */
 
 	fdt_fixup_memory(blob, (u64)base, (u64)size);
+
+	fdt_fixup_dr_usb(blob, bd);
+
+#if defined(CONFIG_SDCARD) || defined(CONFIG_SPIFLASH)
+	/* Delete eLBC node as it is muxed with USB2 controller */
+	if (hwconfig("usb2")) {
+		off = fdt_node_offset_by_compatible(blob, -1,
+			soc_elbc_compat);
+		if (off < 0) {
+			printf("WARNING: could not find compatible node"
+				" %s: %s.\n", soc_elbc_compat,
+				fdt_strerror(off));
+				return;
+		}
+		err = fdt_del_node(blob, off);
+		if (err < 0) {
+			printf("WARNING: could not remove %s: %s.\n",
+				soc_elbc_compat, fdt_strerror(err));
+				return;
+		}
+	} else {
+#endif
+		/* Delete USB2 node as it is muxed with eLBC */
+		usb1_off = fdt_node_offset_by_compatible(blob, -1,
+			soc_usb_compat);
+		if (usb1_off < 0) {
+			printf("WARNING: could not find compatible node"
+				" %s: %s.\n", soc_usb_compat,
+				fdt_strerror(usb1_off));
+			return;
+		}
+		usb2_off = fdt_node_offset_by_compatible(blob, usb1_off,
+				 soc_usb_compat);
+		if (usb2_off < 0) {
+			printf("WARNING: could not find compatible node"
+				" %s: %s.\n", soc_usb_compat,
+				fdt_strerror(usb2_off));
+			return;
+		}
+		err = fdt_del_node(blob, usb2_off);
+		if (err < 0) {
+			printf("WARNING: could not remove %s: %s.\n",
+				soc_usb_compat, fdt_strerror(err));
+			return;
+		}
+#if defined(CONFIG_SDCARD) || defined(CONFIG_SPIFLASH)
+	}
+#endif
 }
 #endif
Signature · 1 line
1.6.1
#1 lore raw

PATCH 1/1 qoriq/p1_p2_rdb: USB device-tree fixups for P1020

Dear Ramneek Mehresh,

Quoted 9 lines · In message <[email protected]>…

Resolve P1020 second USB controller multiplexing with eLBC
- mandatory to mention USB2 in hwconfig string to select it over eLBC, otherwise USB2 node is removed
- works only for SPI and SD boot

---
Applies on git://git.am.freescale.net/mirrors/u-boot.git
(branch master)

Forget it. It is a mandatory requirement that patches are submitted
against the master branch of the master repository.

NAK, without even looking further.

Quoted 41 lines
 board/freescale/p1_p2_rdb/p1_p2_rdb.c |   54 +++++++++++++++++++++++++++++++++
 1 files changed, 54 insertions(+), 0 deletions(-)
board/freescale/p1_p2_rdb/p1_p2_rdb.c +16 -0
index d66b130..14ad895 100644
@@ -37,6 +37,7 @@
 #include <netdev.h>
 #include <rtc.h>
 #include <i2c.h>
+#include <hwconfig.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -247,6 +248,11 @@ extern void ft_pci_board_setup(void *blob);
 
 void ft_board_setup(void *blob, bd_t *bd)
 {
+#if defined(CONFIG_SDCARD) || defined(CONFIG_SPIFLASH)
+	const char *soc_elbc_compat = "fsl,p1020-elbc";
+#endif
+	const char *soc_usb_compat = "fsl-usb2-dr";
+	int off, err, usb1_off, usb2_off;
 	phys_addr_t base;
 	phys_size_t size;
 
@@ -260,5 +266,53 @@ void ft_board_setup(void *blob, bd_t *bd)
 #endif /* #if defined(CONFIG_PCI) */
 
 	fdt_fixup_memory(blob, (u64)base, (u64)size);
+
+	fdt_fixup_dr_usb(blob, bd);
+
+#if defined(CONFIG_SDCARD) || defined(CONFIG_SPIFLASH)
+	/* Delete eLBC node as it is muxed with USB2 controller */
+	if (hwconfig("usb2")) {
+		off = fdt_node_offset_by_compatible(blob, -1,
+			soc_elbc_compat);
+		if (off < 0) {
+			printf("WARNING: could not find compatible node"

board/freescale/p1_p2_rdb/p1_p2_rdb.c void ft_board_setup(void *blob, bd_t *bd) · line 288

Quoted 10 lines
board/freescale/p1_p2_rdb/p1_p2_rdb.c +10 -0
+				" %s: %s.\n", soc_elbc_compat,
+				fdt_strerror(off));
+				return;
+		}
+		err = fdt_del_node(blob, off);
+		if (err < 0) {
+			printf("WARNING: could not remove %s: %s.\n",
+				soc_elbc_compat, fdt_strerror(err));
+				return;
+		}

Move the return; from oneline above here.

board/freescale/p1_p2_rdb/p1_p2_rdb.c void ft_board_setup(void *blob, bd_t *bd) · line 290

Quoted 2 lines
board/freescale/p1_p2_rdb/p1_p2_rdb.c +2 -0
+	} else {
+#endif

Then you can get rid of this "else {" part, and indentation will become correct. As is, it's ugly at best.

Quoted 16 lines
board/freescale/p1_p2_rdb/p1_p2_rdb.c +16 -0
+		/* Delete USB2 node as it is muxed with eLBC */
+		usb1_off = fdt_node_offset_by_compatible(blob, -1,
+			soc_usb_compat);
+		if (usb1_off < 0) {
+			printf("WARNING: could not find compatible node"
+				" %s: %s.\n", soc_usb_compat,
+				fdt_strerror(usb1_off));
+			return;
+		}
+		usb2_off = fdt_node_offset_by_compatible(blob, usb1_off,
+				 soc_usb_compat);
+		if (usb2_off < 0) {
+			printf("WARNING: could not find compatible node"
+				" %s: %s.\n", soc_usb_compat,
+				fdt_strerror(usb2_off));
+			return;

board/freescale/p1_p2_rdb/p1_p2_rdb.c void ft_board_setup(void *blob, bd_t *bd) · line 316

Quoted 10 lines
board/freescale/p1_p2_rdb/p1_p2_rdb.c +10 -0
+		}
+		err = fdt_del_node(blob, usb2_off);
+		if (err < 0) {
+			printf("WARNING: could not remove %s: %s.\n",
+				soc_usb_compat, fdt_strerror(err));
+			return;
+		}
+#if defined(CONFIG_SDCARD) || defined(CONFIG_SPIFLASH)
+	}
+#endif

This #if will then disappear, too.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
A committee is a life form with six or more legs and no brain.
                              -- Lazarus Long, "Time Enough For Love"