diff mbox

[U-Boot] dwc_ahsata: return failure for MX6 if not IMX6Q

Message ID 1399353758-1351-1-git-send-email-tharvey@gateworks.com
State Changes Requested
Delegated to: Stefano Babic
Headers show

Commit Message

Tim Harvey May 6, 2014, 5:22 a.m. UTC
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.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
---
 drivers/block/dwc_ahsata.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Stefano Babic May 6, 2014, 8:17 a.m. UTC | #1
Hi Tim,

On 06/05/2014 07:22, Tim Harvey wrote:
> 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 !

> Signed-off-by: Tim Harvey <tharvey@gateworks.com>
> ---
>  drivers/block/dwc_ahsata.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/block/dwc_ahsata.c b/drivers/block/dwc_ahsata.c
> index 3569214..638a585 100644
> --- a/drivers/block/dwc_ahsata.c
> +++ b/drivers/block/dwc_ahsata.c
> @@ -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");

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
Troy Kisky May 6, 2014, 7:55 p.m. UTC | #2
On 5/5/2014 10:22 PM, Tim Harvey wrote:
> 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.
> 
> Signed-off-by: Tim Harvey <tharvey@gateworks.com>
> ---
>  drivers/block/dwc_ahsata.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/block/dwc_ahsata.c b/drivers/block/dwc_ahsata.c
> index 3569214..638a585 100644
> --- a/drivers/block/dwc_ahsata.c
> +++ b/drivers/block/dwc_ahsata.c
> @@ -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)) {

&& !is_cpu_type(MXC_CPU_MX6D)


is needed too ?


Troy
Tim Harvey May 7, 2014, 3:55 a.m. UTC | #3
On Tue, May 6, 2014 at 12:55 PM, Troy Kisky
<troy.kisky@boundarydevices.com> wrote:
> On 5/5/2014 10:22 PM, Tim Harvey wrote:
>> 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.
>>
>> Signed-off-by: Tim Harvey <tharvey@gateworks.com>
>> ---
>>  drivers/block/dwc_ahsata.c | 7 +++++++
>>  1 file changed, 7 insertions(+)
>>
>> diff --git a/drivers/block/dwc_ahsata.c b/drivers/block/dwc_ahsata.c
>> index 3569214..638a585 100644
>> --- a/drivers/block/dwc_ahsata.c
>> +++ b/drivers/block/dwc_ahsata.c
>> @@ -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)) {
>
> && !is_cpu_type(MXC_CPU_MX6D)
>
>
> is needed too ?
>
>
> Troy

Troy,

Indeed - thanks for the reminder!

Tim
diff mbox

Patch

diff --git a/drivers/block/dwc_ahsata.c b/drivers/block/dwc_ahsata.c
index 3569214..638a585 100644
--- a/drivers/block/dwc_ahsata.c
+++ b/drivers/block/dwc_ahsata.c
@@ -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;