Skip to contentSkip to conversation

mucmc52, uc101: delete ata@3a00 node, if no CF card is detected

PATCH Superseded Heiko Schocher 6 participants 18 messages Sep 9, 2009 – Sep 14, 2009

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 mucmc52, uc101: delete ata@3a00 node, if no CF card is detected

---
 board/mucmc52/mucmc52.c |   15 +++++++++++++++
 board/uc101/uc101.c     |   15 +++++++++++++++
 2 files changed, 30 insertions(+), 0 deletions(-)
board/mucmc52/mucmc52.c +15 -0
index bac49be..950798a 100644
@@ -400,8 +400,23 @@ void pci_init_board (void)
 #endif
 
 #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
+#include <libfdt.h>
 void ft_board_setup(void *blob, bd_t *bd)
 {
+	extern block_dev_desc_t ide_dev_desc[CONFIG_SYS_IDE_MAXDEVICE];
+
 	ft_cpu_setup(blob, bd);
+	if (ide_dev_desc[0].type == DEV_TYPE_UNKNOWN) {
+		/* NO CF card detected -> delete ata node in DTS */
+		int nodeoffset = 0;
+		char nodename[] = "/soc5200 at f0000000/ata at 3a00";
+
+		nodeoffset = fdt_path_offset (blob, nodename);
+		if (nodeoffset >= 0) {
+			fdt_del_node(blob, nodeoffset);
+		} else
+			printf("%s: cannot find %s node err:%s\n",
+				__func__, nodename, fdt_strerror(nodeoffset));
+	}
 }
 #endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */
board/uc101/uc101.c +15 -0
index 4030b9d..4d39a08 100644
@@ -373,8 +373,23 @@ void hw_watchdog_reset(void)
 #endif
 
 #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
+#include <libfdt.h>
 void ft_board_setup(void *blob, bd_t *bd)
 {
+	extern block_dev_desc_t ide_dev_desc[CONFIG_SYS_IDE_MAXDEVICE];
+
 	ft_cpu_setup(blob, bd);
+	if (ide_dev_desc[0].type == DEV_TYPE_UNKNOWN) {
+		/* NO CF card detected -> delete ata node in DTS */
+		int nodeoffset = 0;
+		char nodename[] = "/soc5200 at f0000000/ata at 3a00";
+
+		nodeoffset = fdt_path_offset (blob, nodename);
+		if (nodeoffset >= 0) {
+			fdt_del_node(blob, nodeoffset);
+		} else
+			printf("%s: cannot find %s node err:%s\n",
+				__func__, nodename, fdt_strerror(nodeoffset));
+	}
 }
 #endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */
Signature · 5 lines
1.6.0.6

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#1 lore raw

PATCH 2/2 mucmc52, uc101: delete ata@3a00 node, if no CF card is detected

Dear Heiko Schocher,

Quoted 5 lines · In message <[email protected]> you wrote:
---
 board/mucmc52/mucmc52.c |   15 +++++++++++++++
 board/uc101/uc101.c     |   15 +++++++++++++++
 2 files changed, 30 insertions(+), 0 deletions(-)

Hmm... that looks like duplicated identical code to me. Maybe we can move this into a central location instead?

Best regards,

Wolfgang Denk

Signature · 4 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
To be a winner, all you need to give is all you have.
#3 lore raw

PATCH 2/2 mucmc52, uc101: delete ata@3a00 node, if no CF card is detected

In reply to Heiko Schocher

Dear Heiko Schocher,

Quoted 7 lines · In message <[email protected]> you wrote:
Quoted 3 lines

Hmm... that looks like duplicated identical code to me. Maybe we can move this into a central location instead?

Hmm.. you are right, maybe cpu/mpc5xxx/cpu.c ft_cpu_setup() is a better place for it. And we can activate this through an CONFIG_OF_IDE_FIXUP define.

Sounds like a good idea to me, as I think that other boards may suffer from the same problem. The suggested solution would keep the common code unchanged and still allow all boards that need this to activate it by a simple #define in the board config file.

The patch should then
- document the new CONFIG_ variable in the README, and
- add a description of the problem that you are fixing to the commit message and the README, so others who look for solutions for the same problem can find it.

Thanks.

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
Der Horizont vieler Menschen ist ein Kreis mit Radius Null --
und das nennen sie ihren Standpunkt.
#2 lore raw

PATCH 2/2 mucmc52, uc101: delete ata@3a00 node, if no CF card is detected

In reply to Wolfgang Denk

Hello Wolfgang,

Quoted 9 lines · Wolfgang Denk
Quoted 5 lines · In message <[email protected]> you wrote:
---
 board/mucmc52/mucmc52.c |   15 +++++++++++++++
 board/uc101/uc101.c     |   15 +++++++++++++++
 2 files changed, 30 insertions(+), 0 deletions(-)

Hmm... that looks like duplicated identical code to me. Maybe we can move this into a central location instead?

Hmm.. you are right, maybe cpu/mpc5xxx/cpu.c ft_cpu_setup() is a better place for it. And we can activate this through an CONFIG_OF_IDE_FIXUP define.

Comments?

bye
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#4 lore raw

PATCH v2 2/2 mucmc52, uc101: delete ata@3a00 node, if no CF card is detected

In reply to Wolfgang Denk

U-Boot can detect, if a ide device is present or not. If not and this new config option is activated, u-boot removes the ata node from the DTS before booting Linux, so the Linux IDE driver didn;t crashs, when probing the device. This is needed for buggy hardware (uc101) where no pull down resistor is connected to the signal IDE5V_DD7.

---
changes since v1:
- added comment from Wolfgang Denk, to move this to a more common place, so others can also use it, and made it therefore per CONFIG_OF_IDE_FIXUP selectable.

 README            |    9 +++++++++
 cpu/mpc5xxx/cpu.c |   18 ++++++++++++++++++
 2 files changed, 27 insertions(+), 0 deletions(-)
README +9 -0
index ff4ed8b..b9364bf 100644
@@ -386,6 +386,15 @@ The following options need to be configured:
 		This define fills in the correct boot CPU in the boot
 		param header, the default value is zero if undefined.
 
+		CONFIG_OF_IDE_FIXUP
+
+		U-Boot can detect, if a ide device is present or not.
+		If not and this config option is activated, u-boot
+		removes the ata node from the DTS before booting Linux,
+		so the Linux IDE driver didn;t crashs, when probing the
+		device. This is needed for buggy hardware (uc101) where
+		no pull down resistor is connected to the signal IDE5V_DD7.
+
 - vxWorks boot parameters:
 
 		bootvx constructs a valid bootline using the following
cpu/mpc5xxx/cpu.c +18 -0
index f6258c7..a2fc323 100644
@@ -125,6 +125,9 @@ void ft_cpu_setup(void *blob, bd_t *bd)
 	uchar enetaddr[6];
 	char * eth_path = "/" OF_SOC "/ethernet at 3000";
 #endif
+#if defined(CONFIG_OF_IDE_FIXUP)
+	extern block_dev_desc_t ide_dev_desc[CONFIG_SYS_IDE_MAXDEVICE];
+#endif
 
 	do_fixup_by_path_u32(blob, cpu_path, "timebase-frequency", OF_TBCLK, 1);
 	do_fixup_by_path_u32(blob, cpu_path, "bus-frequency", bd->bi_busfreq, 1);
@@ -137,6 +140,21 @@ void ft_cpu_setup(void *blob, bd_t *bd)
 	do_fixup_by_path(blob, eth_path, "mac-address", enetaddr, 6, 0);
 	do_fixup_by_path(blob, eth_path, "local-mac-address", enetaddr, 6, 0);
 #endif
+#if defined(CONFIG_OF_IDE_FIXUP)
+	if (ide_dev_desc[0].type == DEV_TYPE_UNKNOWN) {
+		/* NO CF card detected -> delete ata node in DTS */
+		int nodeoffset = 0;
+		char nodename[] = "/soc5200 at f0000000/ata at 3a00";
+
+		nodeoffset = fdt_path_offset (blob, nodename);
+		if (nodeoffset >= 0) {
+			fdt_del_node(blob, nodeoffset);
+		} else
+			printf("%s: cannot find %s node err:%s\n",
+				__func__, nodename, fdt_strerror(nodeoffset));
+	}
+
+#endif
 }
 #endif
 
Signature · 1 line
1.6.0.6
#5 lore raw

PATCH v2 2/2 mucmc52, uc101: delete ata@3a00 node, if no CF card is detected

Hi Heiko,

Quoted 4 lines

U-Boot can detect, if a ide device is present or not. If not and this new config option is activated, u-boot removes the ata node from the DTS before booting Linux, so the Linux IDE driver didn;t crashs, when probing the

does not crash

The same below in the actual README.

[...]

Quoted 1 line
README +0 -0

[...]

README The following options need to be configured: · line 394

Quoted 1 line
README +1 -0
+		so the Linux IDE driver didn;t crashs, when probing the

Here.

Cheers
Detlev

Signature · 5 lines
Who is General Failure and why is he reading my hard disk?
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de
#7 lore raw

PATCH v4 2/2 mucmc52, uc101: delete ata@3a00 node, if no CF card is detected

In reply to Heiko Schocher

Hi Heiko,

sorry for the late review, but I just noticed some minor issues.

Quoted 52 lines · On Monday 14 September 2009 17:06:46 Heiko Schocher wrote:

U-Boot can detect, if a ide device is present or not. If not and this new config option is activated, u-boot removes the ata node from the DTS before booting Linux, so the Linux IDE driver does not crash, when probing the device. This is needed for buggy hardware (uc101) where no pull down resistor is connected to the signal IDE5V_DD7.

---

changes since v1:
- added comment from Wolfgang Denk, to move this to a more common place, so others can also use it, and made it therefore per CONFIG_OF_IDE_FIXUP selectable.

changes since v2:
- add CONFIG_OF_IDE_FIXUP to mpc5200-common.h

changes since v3
- correct spelling in README and commit message, as Detlev suggested

 README                                     |    9 +++++++++
 cpu/mpc5xxx/cpu.c                          |   18 ++++++++++++++++++
 include/configs/manroland/mpc5200-common.h |    1 +
 3 files changed, 28 insertions(+), 0 deletions(-)
README +9 -0
index ff4ed8b..191a122 100644
@@ -386,6 +386,15 @@ The following options need to be configured:
 		This define fills in the correct boot CPU in the boot
 		param header, the default value is zero if undefined.
 
+		CONFIG_OF_IDE_FIXUP
+
+		U-Boot can detect, if a ide device is present or not.
+		If not and this config option is activated, u-boot
+		removes the ata node from the DTS before booting Linux,
+		so the Linux IDE driver does not crash, when probing the
+		device. This is needed for buggy hardware (uc101) where
+		no pull down resistor is connected to the signal IDE5V_DD7.
+
 - vxWorks boot parameters:
 
 		bootvx constructs a valid bootline using the following
cpu/mpc5xxx/cpu.c +0 -0
index f6258c7..a2fc323 100644

cpu/mpc5xxx/cpu.c void ft_cpu_setup(void *blob, bd_t *bd) · line 130

Quoted 6 lines
cpu/mpc5xxx/cpu.c +3 -0
@@ -125,6 +125,9 @@ void ft_cpu_setup(void *blob, bd_t *bd)
 	uchar enetaddr[6];
 	char * eth_path = "/" OF_SOC "/ethernet at 3000";
 #endif
+#if defined(CONFIG_OF_IDE_FIXUP)
+	extern block_dev_desc_t ide_dev_desc[CONFIG_SYS_IDE_MAXDEVICE];
+#endif

Why do you declare this global variable inside of the function? Perhaps it would be better to move this declaration into some header.

Quoted 8 lines
cpu/mpc5xxx/cpu.c +2 -0
 	do_fixup_by_path_u32(blob, cpu_path, "timebase-frequency", OF_TBCLK, 1);
 	do_fixup_by_path_u32(blob, cpu_path, "bus-frequency", bd->bi_busfreq, 1);
@@ -137,6 +140,21 @@ void ft_cpu_setup(void *blob, bd_t *bd)
 	do_fixup_by_path(blob, eth_path, "mac-address", enetaddr, 6, 0);
 	do_fixup_by_path(blob, eth_path, "local-mac-address", enetaddr, 6, 0);
 #endif
+#if defined(CONFIG_OF_IDE_FIXUP)
+	if (ide_dev_desc[0].type == DEV_TYPE_UNKNOWN) {

cpu/mpc5xxx/cpu.c void ft_cpu_setup(void *blob, bd_t *bd) · line 154

Quoted 10 lines
cpu/mpc5xxx/cpu.c +10 -0
+		/* NO CF card detected -> delete ata node in DTS */
+		int nodeoffset = 0;
+		char nodename[] = "/soc5200 at f0000000/ata at 3a00";
+
+		nodeoffset = fdt_path_offset (blob, nodename);
+		if (nodeoffset >= 0) {
+			fdt_del_node(blob, nodeoffset);
+		} else
+			printf("%s: cannot find %s node err:%s\n",
+				__func__, nodename, fdt_strerror(nodeoffset));

Incorrect multi-line parentheses:

		if (nodeoffset >= 0) {
			fdt_del_node(blob, nodeoffset);
		} else {
			printf("%s: cannot find %s node err:%s\n",
				__func__, nodename, fdt_strerror(nodeoffset));
		}

Cheers,
Stefan

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de

#17 lore raw

PATCH v2 2/2 mucmc52, uc101: delete ata@3a00 node, if no CF card is detected

In reply to Detlev Zundel

Hello Detlev,

Quoted 7 lines · Detlev Zundel
Quoted 4 lines

U-Boot can detect, if a ide device is present or not. If not and this new config option is activated, u-boot removes the ata node from the DTS before booting Linux, so the Linux IDE driver didn;t crashs, when probing the

does not crash

The same below in the actual README.

Thanks for detecting this, patch follow

bye
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#6 lore raw

PATCH v4 2/2 mucmc52, uc101: delete ata@3a00 node, if no CF card is detected

In reply to Detlev Zundel

U-Boot can detect, if a ide device is present or not. If not and this new config option is activated, u-boot removes the ata node from the DTS before booting Linux, so the Linux IDE driver does not crash, when probing the device. This is needed for buggy hardware (uc101) where no pull down resistor is connected to the signal IDE5V_DD7.

---

changes since v1:
- added comment from Wolfgang Denk, to move this to a more common place, so others can also use it, and made it therefore per CONFIG_OF_IDE_FIXUP selectable.

changes since v2:
- add CONFIG_OF_IDE_FIXUP to mpc5200-common.h

changes since v3
- correct spelling in README and commit message, as Detlev suggested

 README                                     |    9 +++++++++
 cpu/mpc5xxx/cpu.c                          |   18 ++++++++++++++++++
 include/configs/manroland/mpc5200-common.h |    1 +
 3 files changed, 28 insertions(+), 0 deletions(-)
README +9 -0
index ff4ed8b..191a122 100644
@@ -386,6 +386,15 @@ The following options need to be configured:
 		This define fills in the correct boot CPU in the boot
 		param header, the default value is zero if undefined.
 
+		CONFIG_OF_IDE_FIXUP
+
+		U-Boot can detect, if a ide device is present or not.
+		If not and this config option is activated, u-boot
+		removes the ata node from the DTS before booting Linux,
+		so the Linux IDE driver does not crash, when probing the
+		device. This is needed for buggy hardware (uc101) where
+		no pull down resistor is connected to the signal IDE5V_DD7.
+
 - vxWorks boot parameters:
 
 		bootvx constructs a valid bootline using the following
cpu/mpc5xxx/cpu.c +18 -0
index f6258c7..a2fc323 100644
@@ -125,6 +125,9 @@ void ft_cpu_setup(void *blob, bd_t *bd)
 	uchar enetaddr[6];
 	char * eth_path = "/" OF_SOC "/ethernet at 3000";
 #endif
+#if defined(CONFIG_OF_IDE_FIXUP)
+	extern block_dev_desc_t ide_dev_desc[CONFIG_SYS_IDE_MAXDEVICE];
+#endif
 
 	do_fixup_by_path_u32(blob, cpu_path, "timebase-frequency", OF_TBCLK, 1);
 	do_fixup_by_path_u32(blob, cpu_path, "bus-frequency", bd->bi_busfreq, 1);
@@ -137,6 +140,21 @@ void ft_cpu_setup(void *blob, bd_t *bd)
 	do_fixup_by_path(blob, eth_path, "mac-address", enetaddr, 6, 0);
 	do_fixup_by_path(blob, eth_path, "local-mac-address", enetaddr, 6, 0);
 #endif
+#if defined(CONFIG_OF_IDE_FIXUP)
+	if (ide_dev_desc[0].type == DEV_TYPE_UNKNOWN) {
+		/* NO CF card detected -> delete ata node in DTS */
+		int nodeoffset = 0;
+		char nodename[] = "/soc5200 at f0000000/ata at 3a00";
+
+		nodeoffset = fdt_path_offset (blob, nodename);
+		if (nodeoffset >= 0) {
+			fdt_del_node(blob, nodeoffset);
+		} else
+			printf("%s: cannot find %s node err:%s\n",
+				__func__, nodename, fdt_strerror(nodeoffset));
+	}
+
+#endif
 }
 #endif
 
include/configs/manroland/mpc5200-common.h +1 -0
index 2f092b1..b29ef9b 100644
@@ -225,5 +225,6 @@
 #define OF_SOC			"soc5200 at f0000000"
 #define OF_TBCLK		(bd->bi_busfreq / 4)
 #define OF_STDOUT_PATH		"/soc5200 at f0000000/serial at 2000"
+#define CONFIG_OF_IDE_FIXUP
 
 #endif /* __MANROLAND_MPC52XX__COMMON_H */
Signature · 5 lines
1.6.0.6

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#13 lore raw

PATCH v4 2/2 mucmc52, uc101: delete ata@3a00 node, if no CF card is detected

Hi Heiko,

and another nitpicking comment below:

On Monday 14 September 2009 17:06:46 Heiko Schocher wrote:

<snip>

Quoted 15 lines
cpu/mpc5xxx/cpu.c +3 -0
index f6258c7..a2fc323 100644
@@ -125,6 +125,9 @@ void ft_cpu_setup(void *blob, bd_t *bd)
 	uchar enetaddr[6];
 	char * eth_path = "/" OF_SOC "/ethernet at 3000";
 #endif
+#if defined(CONFIG_OF_IDE_FIXUP)
+	extern block_dev_desc_t ide_dev_desc[CONFIG_SYS_IDE_MAXDEVICE];
+#endif
 
 	do_fixup_by_path_u32(blob, cpu_path, "timebase-frequency", OF_TBCLK, 1);
 	do_fixup_by_path_u32(blob, cpu_path, "bus-frequency", bd->bi_busfreq, 1);

cpu/mpc5xxx/cpu.c void ft_cpu_setup(void *blob, bd_t *bd) · line 149

Quoted 10 lines
cpu/mpc5xxx/cpu.c +7 -0
@@ -137,6 +140,21 @@ void ft_cpu_setup(void *blob, bd_t *bd)
 	do_fixup_by_path(blob, eth_path, "mac-address", enetaddr, 6, 0);
 	do_fixup_by_path(blob, eth_path, "local-mac-address", enetaddr, 6, 0);
 #endif
+#if defined(CONFIG_OF_IDE_FIXUP)
+	if (ide_dev_desc[0].type == DEV_TYPE_UNKNOWN) {
+		/* NO CF card detected -> delete ata node in DTS */
+		int nodeoffset = 0;
+		char nodename[] = "/soc5200 at f0000000/ata at 3a00";
+
+		nodeoffset = fdt_path_offset (blob, nodename);

Please use consistent styles in one file, in this case func() without a space before the "(".

Thanks.

Cheers,
Stefan

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de

#15 lore raw

PATCH v4 2/2 mucmc52, uc101: delete ata@3a00 node, if no CF card is detected

In reply to Heiko Schocher
Quoted 6 lines · Heiko Schocher

U-Boot can detect, if a ide device is present or not. If not and this new config option is activated, u-boot removes the ata node from the DTS before booting Linux, so the Linux IDE driver does not crash, when probing the device. This is needed for buggy hardware (uc101) where no pull down resistor is connected to the signal IDE5V_DD7.

Nitpicking your commit comment...

U-Boot can detect if an IDE device is present or not. If not, and this new config option is activated, U-Boot removes the ATA node from the DTS before booting Linux so the Linux IDE driver does not probe the device and crash. This is needed for buggy hardware (uc101) where no pull down resistor is connected to the signal IDE5V_DD7.

Thanks,
gvb

[snip]

#8 lore raw

PATCH v4 2/2 mucmc52, uc101: delete ata@3a00 node, if no CF card is detected

In reply to Stefan Roese

Hello Stefan,

Quoted 3 lines · Stefan Roese

Hi Heiko,

sorry for the late review, but I just noticed some minor issues.

No problem, thanks for reviewing.

Quoted 47 lines · On Monday 14 September 2009 17:06:46 Heiko Schocher wrote:
Quoted 46 lines

U-Boot can detect, if a ide device is present or not. If not and this new config option is activated, u-boot removes the ata node from the DTS before booting Linux, so the Linux IDE driver does not crash, when probing the device. This is needed for buggy hardware (uc101) where no pull down resistor is connected to the signal IDE5V_DD7.

---

changes since v1:
- added comment from Wolfgang Denk, to move this to a more common place, so others can also use it, and made it therefore per CONFIG_OF_IDE_FIXUP selectable.

changes since v2:
- add CONFIG_OF_IDE_FIXUP to mpc5200-common.h

changes since v3
- correct spelling in README and commit message, as Detlev suggested

 README                                     |    9 +++++++++
 cpu/mpc5xxx/cpu.c                          |   18 ++++++++++++++++++
 include/configs/manroland/mpc5200-common.h |    1 +
 3 files changed, 28 insertions(+), 0 deletions(-)
README +9 -0
index ff4ed8b..191a122 100644
@@ -386,6 +386,15 @@ The following options need to be configured:
 		This define fills in the correct boot CPU in the boot
 		param header, the default value is zero if undefined.
 
+		CONFIG_OF_IDE_FIXUP
+
+		U-Boot can detect, if a ide device is present or not.
+		If not and this config option is activated, u-boot
+		removes the ata node from the DTS before booting Linux,
+		so the Linux IDE driver does not crash, when probing the
+		device. This is needed for buggy hardware (uc101) where
+		no pull down resistor is connected to the signal IDE5V_DD7.
+
 - vxWorks boot parameters:
 
Quoted 15 lines

cpu/mpc5xxx/cpu.c void ft_cpu_setup(void *blob, bd_t *bd) · line 130

Quoted 12 lines
README +0 -0
 		bootvx constructs a valid bootline using the following
cpu/mpc5xxx/cpu.c +3 -0
index f6258c7..a2fc323 100644
@@ -125,6 +125,9 @@ void ft_cpu_setup(void *blob, bd_t *bd)
 	uchar enetaddr[6];
 	char * eth_path = "/" OF_SOC "/ethernet at 3000";
 #endif
+#if defined(CONFIG_OF_IDE_FIXUP)
+	extern block_dev_desc_t ide_dev_desc[CONFIG_SYS_IDE_MAXDEVICE];
+#endif

Why do you declare this global variable inside of the function? Perhaps it would be better to move this declaration into some header.

include/ide.h would be the right place for it I think, or?

Quoted 21 lines
Quoted 8 lines
cpu/mpc5xxx/cpu.c +2 -0
 	do_fixup_by_path_u32(blob, cpu_path, "timebase-frequency", OF_TBCLK, 1);
 	do_fixup_by_path_u32(blob, cpu_path, "bus-frequency", bd->bi_busfreq, 1);
@@ -137,6 +140,21 @@ void ft_cpu_setup(void *blob, bd_t *bd)
 	do_fixup_by_path(blob, eth_path, "mac-address", enetaddr, 6, 0);
 	do_fixup_by_path(blob, eth_path, "local-mac-address", enetaddr, 6, 0);
 #endif
+#if defined(CONFIG_OF_IDE_FIXUP)
+	if (ide_dev_desc[0].type == DEV_TYPE_UNKNOWN) {

cpu/mpc5xxx/cpu.c void ft_cpu_setup(void *blob, bd_t *bd) · line 154

Quoted 10 lines
cpu/mpc5xxx/cpu.c +10 -0
+		/* NO CF card detected -> delete ata node in DTS */
+		int nodeoffset = 0;
+		char nodename[] = "/soc5200 at f0000000/ata at 3a00";
+
+		nodeoffset = fdt_path_offset (blob, nodename);
+		if (nodeoffset >= 0) {
+			fdt_del_node(blob, nodeoffset);
+		} else
+			printf("%s: cannot find %s node err:%s\n",
+				__func__, nodename, fdt_strerror(nodeoffset));

Incorrect multi-line parentheses:

Quoted 7 lines
		if (nodeoffset >= 0) {
			fdt_del_node(blob, nodeoffset);
		} else {
			printf("%s: cannot find %s node err:%s\n",
				__func__, nodename, fdt_strerror(nodeoffset));
		}

if (nodeoffset >= 0)
fdt_del_node(blob, nodeoffset);
else
printf("%s: cannot find %s node err:%s\n",
__func__, nodename, fdt_strerror(nodeoffset));

Should be right, or?

bye
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#9 lore raw

PATCH v4 2/2 mucmc52, uc101: delete ata@3a00 node, if no CF card is detected

Quoted 12 lines · On Monday 14 September 2009 17:26:45 Heiko Schocher wrote:
Quoted 11 lines

cpu/mpc5xxx/cpu.c void ft_cpu_setup(void *blob, bd_t *bd) · line 130

Quoted 8 lines

+++ b/cpu/mpc5xxx/cpu.c

cpu/mpc5xxx/cpu.c +3 -0
@@ -125,6 +125,9 @@ void ft_cpu_setup(void *blob, bd_t *bd)
 	uchar enetaddr[6];
 	char * eth_path = "/" OF_SOC "/ethernet at 3000";
 #endif
+#if defined(CONFIG_OF_IDE_FIXUP)
+	extern block_dev_desc_t ide_dev_desc[CONFIG_SYS_IDE_MAXDEVICE];
+#endif

Why do you declare this global variable inside of the function? Perhaps it would be better to move this declaration into some header.

Quoted 1 line

include/ide.h would be the right place for it I think, or?

Yes, I think so too.

Quoted 29 lines
Quoted 22 lines
Quoted 9 lines
(quoted diff) +0 -0
 	do_fixup_by_path_u32(blob, cpu_path, "timebase-frequency", OF_TBCLK,
 1); do_fixup_by_path_u32(blob, cpu_path, "bus-frequency",
 bd->bi_busfreq, 1); @@ -137,6 +140,21 @@ void ft_cpu_setup(void *blob,

bd_t *bd)

cpu/mpc5xxx/cpu.c +2 -0
 	do_fixup_by_path(blob, eth_path, "mac-address", enetaddr, 6, 0);
 	do_fixup_by_path(blob, eth_path, "local-mac-address", enetaddr, 6, 0);
 #endif
+#if defined(CONFIG_OF_IDE_FIXUP)
+	if (ide_dev_desc[0].type == DEV_TYPE_UNKNOWN) {

cpu/mpc5xxx/cpu.c void ft_cpu_setup(void *blob, bd_t *bd) · line 154

Quoted 10 lines
cpu/mpc5xxx/cpu.c +10 -0
+		/* NO CF card detected -> delete ata node in DTS */
+		int nodeoffset = 0;
+		char nodename[] = "/soc5200 at f0000000/ata at 3a00";
+
+		nodeoffset = fdt_path_offset (blob, nodename);
+		if (nodeoffset >= 0) {
+			fdt_del_node(blob, nodeoffset);
+		} else
+			printf("%s: cannot find %s node err:%s\n",
+				__func__, nodename, fdt_strerror(nodeoffset));

Incorrect multi-line parentheses:

Quoted 6 lines
		if (nodeoffset >= 0) {
			fdt_del_node(blob, nodeoffset);
		} else {
			printf("%s: cannot find %s node err:%s\n",
				__func__, nodename, fdt_strerror(nodeoffset));
		}
Quoted 8 lines

if (nodeoffset >= 0)
fdt_del_node(blob, nodeoffset);
else
printf("%s: cannot find %s node err:%s\n",
__func__, nodename,
fdt_strerror(nodeoffset));

Should be right, or?

No. IIRC, then when one of the statements is a multi-line statement, both statements of the if/else struct should have the parentheses.

Cheers,
Stefan

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de

#14 lore raw

PATCH v4 2/2 mucmc52, uc101: delete ata@3a00 node, if no CF card is detected

In reply to Stefan Roese

Hello Stefan,

Quoted 20 lines · Stefan Roese

Hi Heiko,

and another nitpicking comment below:

On Monday 14 September 2009 17:06:46 Heiko Schocher wrote:

<snip>

Quoted 12 lines
cpu/mpc5xxx/cpu.c +3 -0
index f6258c7..a2fc323 100644
@@ -125,6 +125,9 @@ void ft_cpu_setup(void *blob, bd_t *bd)
 	uchar enetaddr[6];
 	char * eth_path = "/" OF_SOC "/ethernet at 3000";
 #endif
+#if defined(CONFIG_OF_IDE_FIXUP)
+	extern block_dev_desc_t ide_dev_desc[CONFIG_SYS_IDE_MAXDEVICE];
+#endif
 
Quoted 16 lines

cpu/mpc5xxx/cpu.c void ft_cpu_setup(void *blob, bd_t *bd) · line 149

Quoted 13 lines
cpu/mpc5xxx/cpu.c +7 -0
 	do_fixup_by_path_u32(blob, cpu_path, "timebase-frequency", OF_TBCLK, 1);
 	do_fixup_by_path_u32(blob, cpu_path, "bus-frequency", bd->bi_busfreq, 1);
@@ -137,6 +140,21 @@ void ft_cpu_setup(void *blob, bd_t *bd)
 	do_fixup_by_path(blob, eth_path, "mac-address", enetaddr, 6, 0);
 	do_fixup_by_path(blob, eth_path, "local-mac-address", enetaddr, 6, 0);
 #endif
+#if defined(CONFIG_OF_IDE_FIXUP)
+	if (ide_dev_desc[0].type == DEV_TYPE_UNKNOWN) {
+		/* NO CF card detected -> delete ata node in DTS */
+		int nodeoffset = 0;
+		char nodename[] = "/soc5200 at f0000000/ata at 3a00";
+
+		nodeoffset = fdt_path_offset (blob, nodename);

Please use consistent styles in one file, in this case func() without a space before the "(".

Fixed, thanks.

bye
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#16 lore raw

PATCH v4 2/2 mucmc52, uc101: delete ata@3a00 node, if no CF card is detected

In reply to Jerry Van Baren

Hello Jerry,

Quoted 8 lines · Jerry Van Baren
Quoted 6 lines · Heiko Schocher

U-Boot can detect, if a ide device is present or not. If not and this new config option is activated, u-boot removes the ata node from the DTS before booting Linux, so the Linux IDE driver does not crash, when probing the device. This is needed for buggy hardware (uc101) where no pull down resistor is connected to the signal IDE5V_DD7.

Quoted 8 lines

Nitpicking your commit comment...

U-Boot can detect if an IDE device is present or not. If not, and this new config option is activated, U-Boot removes the ATA node from the DTS before booting Linux so the Linux IDE driver does not probe the device and crash. This is needed for buggy hardware (uc101) where no pull down resistor is connected to the signal IDE5V_DD7.

Fixed, thanks!

bye
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#11 lore raw

PATCH v4 2/2 mucmc52, uc101: delete ata@3a00 node, if no CF card is detected

In reply to Heiko Schocher
Quoted 16 lines · On Monday 14 September 2009 17:55:01 Heiko Schocher wrote:
Quoted 16 lines
Quoted 16 lines
Quoted 8 lines

Incorrect multi-line parentheses:

		if (nodeoffset >= 0) {
			fdt_del_node(blob, nodeoffset);
		} else {
			printf("%s: cannot find %s node err:%s\n",
				__func__, nodename, fdt_strerror(nodeoffset));
		}

if (nodeoffset >= 0)
fdt_del_node(blob, nodeoffset);
else
printf("%s: cannot find %s node err:%s\n",
__func__, nodename,
fdt_strerror(nodeoffset));

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Should be right, or?

No. IIRC, then when one of the statements is a multi-line statement, both statements of the if/else struct should have the parentheses.

I see only one statement in the if and the else case ...

Yes, but it spans over multiple (2) lines. So it's a multi-line statement. At least that's how I understand the coding-style docs.

Cheers,
Stefan

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de

#10 lore raw

PATCH v4 2/2 mucmc52, uc101: delete ata@3a00 node, if no CF card is detected

In reply to Stefan Roese

Hello Stefan,

Quoted 1 line · Stefan Roese

On Monday 14 September 2009 17:26:45 Heiko Schocher wrote:

[...]

Quoted 34 lines
Quoted 34 lines
Quoted 21 lines
Quoted 9 lines

do_fixup_by_path_u32(blob, cpu_path, "timebase-frequency", OF_TBCLK,
1); do_fixup_by_path_u32(blob, cpu_path, "bus-frequency", bd->bi_busfreq, 1); @@ -137,6 +140,21 @@ void ft_cpu_setup(void *blob, bd_t *bd)

cpu/mpc5xxx/cpu.c +2 -0
 	do_fixup_by_path(blob, eth_path, "mac-address", enetaddr, 6, 0);
 	do_fixup_by_path(blob, eth_path, "local-mac-address", enetaddr, 6, 0);
 #endif
+#if defined(CONFIG_OF_IDE_FIXUP)
+	if (ide_dev_desc[0].type == DEV_TYPE_UNKNOWN) {

cpu/mpc5xxx/cpu.c void ft_cpu_setup(void *blob, bd_t *bd) · line 154

Quoted 10 lines
cpu/mpc5xxx/cpu.c +10 -0
+		/* NO CF card detected -> delete ata node in DTS */
+		int nodeoffset = 0;
+		char nodename[] = "/soc5200 at f0000000/ata at 3a00";
+
+		nodeoffset = fdt_path_offset (blob, nodename);
+		if (nodeoffset >= 0) {
+			fdt_del_node(blob, nodeoffset);
+		} else
+			printf("%s: cannot find %s node err:%s\n",
+				__func__, nodename, fdt_strerror(nodeoffset));

Incorrect multi-line parentheses:

Quoted 6 lines
		if (nodeoffset >= 0) {
			fdt_del_node(blob, nodeoffset);
		} else {
			printf("%s: cannot find %s node err:%s\n",
				__func__, nodename, fdt_strerror(nodeoffset));
		}

if (nodeoffset >= 0)
fdt_del_node(blob, nodeoffset);
else
printf("%s: cannot find %s node err:%s\n",
__func__, nodename,
fdt_strerror(nodeoffset));

Quoted 4 lines
Quoted 1 line

Should be right, or?

No. IIRC, then when one of the statements is a multi-line statement, both statements of the if/else struct should have the parentheses.

I see only one statement in the if and the else case ...

bye
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#12 lore raw

PATCH v4 2/2 mucmc52, uc101: delete ata@3a00 node, if no CF card is detected

In reply to Stefan Roese

Hello Stefan,

Quoted 16 lines · Stefan Roese
Quoted 15 lines · On Monday 14 September 2009 17:55:01 Heiko Schocher wrote:
Quoted 15 lines
Quoted 15 lines
Quoted 8 lines

Incorrect multi-line parentheses:

		if (nodeoffset >= 0) {
			fdt_del_node(blob, nodeoffset);
		} else {
			printf("%s: cannot find %s node err:%s\n",
				__func__, nodename, fdt_strerror(nodeoffset));
		}

if (nodeoffset >= 0)
fdt_del_node(blob, nodeoffset);
else
printf("%s: cannot find %s node err:%s\n",
__func__, nodename,
fdt_strerror(nodeoffset));

Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
Quoted 1 line

Should be right, or?

No. IIRC, then when one of the statements is a multi-line statement, both statements of the if/else struct should have the parentheses.

I see only one statement in the if and the else case ...

Yes, but it spans over multiple (2) lines. So it's a multi-line statement. At least that's how I understand the coding-style docs.

Ah, okay, fixed it.

tschuess
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany