Skip to contentSkip to conversation

dwc_ahsata: return failure for MX6 if not IMX6Q

PATCH New Tim Harvey 3 participants 11 messages May 6, 2014 – Jun 6, 2014

Subsystems (3)
lore
Share & tools
lore

Tim Harvey

author
#0 lore raw

PATCH 1/1 dwc_ahsata: return failure for MX6 if not IMX6Q

The IMX6QUAD/DUAL have SATA, but the IMX6SOLO/DL do not. Return an error indicating no such port instead of attempting a memory access that results in a data abort and reset. This dynamic detection is necessary for bootloaders that support multiple variants of the IMX6 SoC.

---
 drivers/block/dwc_ahsata.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/block/dwc_ahsata.c +7 -0
index 3569214..638a585 100644
@@ -17,6 +17,7 @@
 #include <asm/io.h>
 #include <linux/bitops.h>
 #include <asm/arch/clock.h>
+#include <asm/arch/sys_proto.h>
 #include "dwc_ahsata.h"
 
 struct sata_port_regs {
@@ -558,6 +559,12 @@ int init_sata(int dev)
 	u32 linkmap;
 	struct ahci_probe_ent *probe_ent = NULL;
 
+#if defined(CONFIG_MX6)
+	if (!is_cpu_type(MXC_CPU_MX6Q)) {
+		printf("No device detected!\n");
+		return 1;
+	}
+#endif
 	if (dev < 0 || dev > (CONFIG_SYS_SATA_MAX_DEVICE - 1)) {
 		printf("The sata index %d is out of ranges\n\r", dev);
 		return -1;
Signature · 1 line
1.8.3.2
#1 lore raw

PATCH 1/1 dwc_ahsata: return failure for MX6 if not IMX6Q

Hi Tim,

Quoted 5 lines · Tim Harvey

The IMX6QUAD/DUAL have SATA, but the IMX6SOLO/DL do not. Return an error indicating no such port instead of attempting a memory access that results in a data abort and reset. This dynamic detection is necessary for bootloaders that support multiple variants of the IMX6 SoC.

Right !

Quoted 18 lines
---
 drivers/block/dwc_ahsata.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/block/dwc_ahsata.c +1 -0
index 3569214..638a585 100644
@@ -17,6 +17,7 @@
 #include <asm/io.h>
 #include <linux/bitops.h>
 #include <asm/arch/clock.h>
+#include <asm/arch/sys_proto.h>
 #include "dwc_ahsata.h"
 
 struct sata_port_regs {

drivers/block/dwc_ahsata.c int init_sata(int dev) · line 564

Quoted 6 lines
drivers/block/dwc_ahsata.c +3 -0
@@ -558,6 +559,12 @@ int init_sata(int dev)
 	u32 linkmap;
 	struct ahci_probe_ent *probe_ent = NULL;
 
+#if defined(CONFIG_MX6)
+	if (!is_cpu_type(MXC_CPU_MX6Q)) {
+		printf("No device detected!\n");

Change only printf with puts. We use puts() in u-boot when we print a fixed string.
Really I had drop the whole line. It is not that a SATA device is not attached or not detected, but it is that a SATA is not possible at all. It is like this is an error, but it is not: it is the real use case.

Best regards,
Stefano Babic

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-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#2 lore raw

PATCH 1/1 dwc_ahsata: return failure for MX6 if not IMX6Q

In reply to Tim Harvey
Quoted 23 lines · Tim Harvey

The IMX6QUAD/DUAL have SATA, but the IMX6SOLO/DL do not. Return an error indicating no such port instead of attempting a memory access that results in a data abort and reset. This dynamic detection is necessary for bootloaders that support multiple variants of the IMX6 SoC.

---
 drivers/block/dwc_ahsata.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/block/dwc_ahsata.c +1 -0
index 3569214..638a585 100644
@@ -17,6 +17,7 @@
 #include <asm/io.h>
 #include <linux/bitops.h>
 #include <asm/arch/clock.h>
+#include <asm/arch/sys_proto.h>
 #include "dwc_ahsata.h"
 
 struct sata_port_regs {

drivers/block/dwc_ahsata.c int init_sata(int dev) · line 563

Quoted 5 lines
drivers/block/dwc_ahsata.c +2 -0
@@ -558,6 +559,12 @@ int init_sata(int dev)
 	u32 linkmap;
 	struct ahci_probe_ent *probe_ent = NULL;
 
+#if defined(CONFIG_MX6)
+	if (!is_cpu_type(MXC_CPU_MX6Q)) {

&& !is_cpu_type(MXC_CPU_MX6D)

is needed too ?

Troy

author
#3 lore raw

PATCH 1/1 dwc_ahsata: return failure for MX6 if not IMX6Q

Quoted 33 lines · Troy Kisky
Quoted 23 lines · Tim Harvey

The IMX6QUAD/DUAL have SATA, but the IMX6SOLO/DL do not. Return an error indicating no such port instead of attempting a memory access that results in a data abort and reset. This dynamic detection is necessary for bootloaders that support multiple variants of the IMX6 SoC.

---
 drivers/block/dwc_ahsata.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/block/dwc_ahsata.c +1 -0
index 3569214..638a585 100644
@@ -17,6 +17,7 @@
 #include <asm/io.h>
 #include <linux/bitops.h>
 #include <asm/arch/clock.h>
+#include <asm/arch/sys_proto.h>
 #include "dwc_ahsata.h"
 
 struct sata_port_regs {

drivers/block/dwc_ahsata.c int init_sata(int dev) · line 563

Quoted 5 lines
drivers/block/dwc_ahsata.c +2 -0
@@ -558,6 +559,12 @@ int init_sata(int dev)
      u32 linkmap;
      struct ahci_probe_ent *probe_ent = NULL;
 
+#if defined(CONFIG_MX6)
+     if (!is_cpu_type(MXC_CPU_MX6Q)) {

&& !is_cpu_type(MXC_CPU_MX6D)

Quoted 4 lines

is needed too ?

Troy

Troy,

Indeed - thanks for the reminder!

Tim

author
#4 lore raw

PATCH v2 1/1 dwc_ahsata: return failure for MX6 if not IMX6Q/IMX6D

In reply to Tim Harvey

The IMX6QUAD/DUAL have SATA, but the IMX6SOLO/DL do not. Return failure instead of attempting a memory access that results in a data abort and reset.

---
v2:
- remove print as this condition isn't really an error just something not possible

---
 drivers/block/dwc_ahsata.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/block/dwc_ahsata.c +5 -0
index 3569214..15d65d7 100644
@@ -17,6 +17,7 @@
 #include <asm/io.h>
 #include <linux/bitops.h>
 #include <asm/arch/clock.h>
+#include <asm/arch/sys_proto.h>
 #include "dwc_ahsata.h"
 
 struct sata_port_regs {
@@ -558,6 +559,10 @@ int init_sata(int dev)
 	u32 linkmap;
 	struct ahci_probe_ent *probe_ent = NULL;
 
+#if defined(CONFIG_MX6)
+	if (!is_cpu_type(MXC_CPU_MX6Q) && !is_cpu_type(MXC_CPU_MX6D))
+		return 1;
+#endif
 	if (dev < 0 || dev > (CONFIG_SYS_SATA_MAX_DEVICE - 1)) {
 		printf("The sata index %d is out of ranges\n\r", dev);
 		return -1;
Signature · 1 line
1.8.3.2
author
#5 lore raw

PATCH v2 1/1 dwc_ahsata: return failure for MX6 if not IMX6Q/IMX6D

Quoted 36 lines · Tim Harvey

The IMX6QUAD/DUAL have SATA, but the IMX6SOLO/DL do not. Return failure instead of attempting a memory access that results in a data abort and reset.

---
v2:
- remove print as this condition isn't really an error just something not possible

---
 drivers/block/dwc_ahsata.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/block/dwc_ahsata.c +5 -1
index 3569214..15d65d7 100644
@@ -17,6 +17,7 @@
 #include <asm/io.h>
 #include <linux/bitops.h>
 #include <asm/arch/clock.h>
+#include <asm/arch/sys_proto.h>
 #include "dwc_ahsata.h"
 
 struct sata_port_regs {
@@ -558,6 +559,10 @@ int init_sata(int dev)
        u32 linkmap;
        struct ahci_probe_ent *probe_ent = NULL;
 
+#if defined(CONFIG_MX6)
+       if (!is_cpu_type(MXC_CPU_MX6Q) && !is_cpu_type(MXC_CPU_MX6D))
+               return 1;
+#endif
        if (dev < 0 || dev > (CONFIG_SYS_SATA_MAX_DEVICE - 1)) {
                printf("The sata index %d is out of ranges\n\r", dev);
                return -1;
--
Quoted 2 lines

1.8.3.2

Stefano,

Any comments or does anyone else need to review this?

Regards,

Tim

#6 lore raw

PATCH v2 1/1 dwc_ahsata: return failure for MX6 if not IMX6Q/IMX6D

In reply to Tim Harvey
Quoted 9 lines · Tim Harvey

The IMX6QUAD/DUAL have SATA, but the IMX6SOLO/DL do not. Return failure instead of attempting a memory access that results in a data abort and reset.

---
v2:
- remove print as this condition isn't really an error just something not possible
---

Applied to u-boot-imx, thanks !

Best regards,
Stefano Babic

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-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#7 lore raw

PATCH 1/1 imx: sata: return failure if not IMX6Q/IMX6D

In reply to Tim Harvey

The IMX6QUAD/DUAL have SATA, but the IMX6SOLO/DL do not. Return instead of configuring the SATA clock and GPR13 registers.

---
 arch/arm/imx-common/sata.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
arch/arm/imx-common/sata.c +6 -1
index 2e69486..c10dd28 100644
@@ -8,13 +8,18 @@
 #include <asm/arch/iomux.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
+#include <asm/arch/sys_proto.h>
 
 int setup_sata(void)
 {
 	struct iomuxc_base_regs *const iomuxc_regs
 		= (struct iomuxc_base_regs *)IOMUXC_BASE_ADDR;
+	int ret;
 
-	int ret = enable_sata_clock();
+	if (!is_cpu_type(MXC_CPU_MX6Q) && !is_cpu_type(MXC_CPU_MX6D))
+		return 1;
+
+	ret = enable_sata_clock();
 	if (ret)
 		return ret;
 
Signature · 1 line
1.8.3.2
author
#8 lore raw

PATCH 1/1 imx: sata: return failure if not IMX6Q/IMX6D

Quoted 33 lines · Tim Harvey

The IMX6QUAD/DUAL have SATA, but the IMX6SOLO/DL do not. Return instead of configuring the SATA clock and GPR13 registers.

---
 arch/arm/imx-common/sata.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
arch/arm/imx-common/sata.c +6 -2
index 2e69486..c10dd28 100644
@@ -8,13 +8,18 @@
 #include <asm/arch/iomux.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
+#include <asm/arch/sys_proto.h>
 
 int setup_sata(void)
 {
        struct iomuxc_base_regs *const iomuxc_regs
                = (struct iomuxc_base_regs *)IOMUXC_BASE_ADDR;
+       int ret;
 
-       int ret = enable_sata_clock();
+       if (!is_cpu_type(MXC_CPU_MX6Q) && !is_cpu_type(MXC_CPU_MX6D))
+               return 1;
+
+       ret = enable_sata_clock();
        if (ret)
                return ret;
 
--
Quoted 2 lines

1.8.3.2

Stefano,

Any comments?

Regards,

Tim

#9 lore raw

PATCH 1/1 imx: sata: return failure if not IMX6Q/IMX6D

Hi Tim,

Quoted 33 lines · Tim Harvey
Quoted 32 lines · Tim Harvey

The IMX6QUAD/DUAL have SATA, but the IMX6SOLO/DL do not. Return instead of configuring the SATA clock and GPR13 registers.

---
 arch/arm/imx-common/sata.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
arch/arm/imx-common/sata.c +6 -1
index 2e69486..c10dd28 100644
@@ -8,13 +8,18 @@
 #include <asm/arch/iomux.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
+#include <asm/arch/sys_proto.h>
 
 int setup_sata(void)
 {
        struct iomuxc_base_regs *const iomuxc_regs
                = (struct iomuxc_base_regs *)IOMUXC_BASE_ADDR;
+       int ret;
 
-       int ret = enable_sata_clock();
+       if (!is_cpu_type(MXC_CPU_MX6Q) && !is_cpu_type(MXC_CPU_MX6D))
+               return 1;
+
+       ret = enable_sata_clock();
        if (ret)
                return ret;
 
Quoted 8 lines
Quoted 3 lines

--
1.8.3.2

Stefano,

Any comments?

No comments. In my queue it is ready-to-be-applied. I will do it after the whole SPL series. My plan is to apply them until the end of the week.

Best regards,
Stefano Babic

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-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#10 lore raw

PATCH 1/1 imx: sata: return failure if not IMX6Q/IMX6D

In reply to Tim Harvey

Hi Tim,

Quoted 33 lines · Tim Harvey
Quoted 32 lines · Tim Harvey

The IMX6QUAD/DUAL have SATA, but the IMX6SOLO/DL do not. Return instead of configuring the SATA clock and GPR13 registers.

---
 arch/arm/imx-common/sata.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
arch/arm/imx-common/sata.c +6 -1
index 2e69486..c10dd28 100644
@@ -8,13 +8,18 @@
 #include <asm/arch/iomux.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
+#include <asm/arch/sys_proto.h>
 
 int setup_sata(void)
 {
        struct iomuxc_base_regs *const iomuxc_regs
                = (struct iomuxc_base_regs *)IOMUXC_BASE_ADDR;
+       int ret;
 
-       int ret = enable_sata_clock();
+       if (!is_cpu_type(MXC_CPU_MX6Q) && !is_cpu_type(MXC_CPU_MX6D))
+               return 1;
+
+       ret = enable_sata_clock();
        if (ret)
                return ret;
 
Quoted 8 lines
Quoted 3 lines

--
1.8.3.2

Stefano,

Any comments?

Yes: applied to u-boot-imx, thanks !

Regards,
Stefano

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-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================