Re: [U-Boot] [PATCH v2 3/3] ahci: provide sunxi SATA driver using AHCI platform framework

2014-02-20 Thread Rob Herring
On Thu, Feb 20, 2014 at 8:48 AM, Ian Campbell  wrote:
> This enables the necessary clocks, in AHB0 and in PLL6_CFG. This is done
> for sun7i only since I don't have access to any other sunxi platforms
> with sata included.
>
> The bulk of the code is taken from the Linux ahci sunxi platform driver
> patches, adjusted for u-boot.
>
> This adds the "PORT_DMA" tweaks to the core driver, under a suitable
> ifdef.
>
> This option is enabled for Cubieboard, Cubieboard2, Cubietruck and
> Olinuxino Micro based on contents of Linux DTS files, including SATA
> power pin config taken from the DTS. All build tested, but runtime
> tested on cubietruck (FEL) only.
>
> Signed-off-by: Ian Campbell 
> ---
> v2:
>
> make AHCI configurable per board, enabled for cubieboard,
> cubieboard2, cubietruck and Olinuxino Micro.
> ---
>  arch/arm/cpu/armv7/sunxi/clock.c |  4 ++
>  boards.cfg   | 18 
>  drivers/block/Makefile   |  1 +
>  drivers/block/ahci.c | 15 ++-
>  drivers/block/ahci_sunxi.c   | 95 
> 
>  include/ahci.h   |  9 
>  include/configs/sunxi-common.h   | 12 +
>  7 files changed, 144 insertions(+), 10 deletions(-)
>  create mode 100644 drivers/block/ahci_sunxi.c
>
> diff --git a/arch/arm/cpu/armv7/sunxi/clock.c 
> b/arch/arm/cpu/armv7/sunxi/clock.c
> index 06bc283..2cc274b 100644
> --- a/arch/arm/cpu/armv7/sunxi/clock.c
> +++ b/arch/arm/cpu/armv7/sunxi/clock.c
> @@ -51,6 +51,10 @@ static void clock_init_safe(void)
>  #ifdef CONFIG_SUN7I
> writel(0x1 << 6 | readl(&ccm->ahb_gate0), &ccm->ahb_gate0);
> writel(0x1 << 31 | readl(&ccm->pll6_cfg), &ccm->pll6_cfg);
> +#ifdef CONFIG_SCSI_AHCI_SUNXI
> +   writel(0x1 << 25 |readl(&ccm->ahb_gate0), &ccm->ahb_gate0);
> +   writel(0x1 << 14 | readl(&ccm->pll6_cfg), &ccm->pll6_cfg);
> +#endif
>  #endif
>  }
>  #endif
> diff --git a/boards.cfg b/boards.cfg
> index 100acc8..987bc54 100644
> --- a/boards.cfg
> +++ b/boards.cfg
> @@ -354,8 +354,8 @@ Active  arm armv7  sunxi   -  
>  sunxi
>  Active  arm armv7  sunxi   -   sunxi 
>   A13-OLinuXinoM   
> sun5i:A13_OLINUXINOM,SPL,NO_AXP,STATUSLED=201,CONS_INDEX=2
> -
>  Active  arm armv7  sunxi   -   sunxi 
>   A13-OLinuXinoM_FEL   
> sun5i:A13_OLINUXINOM,SPL_FEL,NO_AXP,STATUSLED=201,CONS_INDEX=2
> -
>  Active  arm armv7  sunxi   -   sunxi 
>   A13_MID  sun5i:A13_MID,SPL,CONS_INDEX=2 
>   
>  -
> -Active  arm armv7  sunxi   -   sunxi 
>   A20-OLinuXino_MICRO  
> sun7i:A20_OLINUXINO_M,CONS_INDEX=1,STATUSLED=226,SPL,SUNXI_EMAC   
> -
> -Active  arm armv7  sunxi   -   sunxi 
>   A20-OLinuXino_MICRO_FEL  
> sun7i:A20_OLINUXINO_M,CONS_INDEX=1,STATUSLED=226,SPL_FEL,SUNXI_EMAC   
> -
> +Active  arm armv7  sunxi   -   sunxi 
>   A20-OLinuXino_MICRO  
> sun7i:A20_OLINUXINO_M,CONS_INDEX=1,STATUSLED=226,SPL,SUNXI_EMAC,AHCI,SATAPWR=SUNXI_GPB(8)
>-
> +Active  arm armv7  sunxi   -   sunxi 
>   A20-OLinuXino_MICRO_FEL  
> sun7i:A20_OLINUXINO_M,CONS_INDEX=1,STATUSLED=226,SPL_FEL,SUNXI_EMAC,AHCI,SATAPWR=SUNXI_GPB(8)
>-
>  Active  arm armv7  sunxi   -   sunxi 
>   Auxtek-T003  
> sun5i:AUXTEK_T003,SPL,AXP152_POWER,STATUSLED=34   
> -
>  Active  arm armv7  sunxi   -   sunxi 
>   Auxtek-T004  
> sun5i:AUXTEK_T004,SPL,AXP152_POWER,STATUSLED=34   
> -
>  Active  arm armv7  sunxi   -   sunxi 
>   ba10_tv_box  sun4i:BA10_TV_BOX,SPL,SUNXI_EMAC   
>   
>  -
> @@ -363,13 +363,13 @@ Active  arm armv7  sunxi   -
>sunxi
>  Active  arm armv7  sunxi   -   sunxi 
> 

[U-Boot] [PATCH v2 3/3] ahci: provide sunxi SATA driver using AHCI platform framework

2014-02-20 Thread Ian Campbell
This enables the necessary clocks, in AHB0 and in PLL6_CFG. This is done
for sun7i only since I don't have access to any other sunxi platforms
with sata included.

The bulk of the code is taken from the Linux ahci sunxi platform driver
patches, adjusted for u-boot.

This adds the "PORT_DMA" tweaks to the core driver, under a suitable
ifdef.

This option is enabled for Cubieboard, Cubieboard2, Cubietruck and
Olinuxino Micro based on contents of Linux DTS files, including SATA
power pin config taken from the DTS. All build tested, but runtime
tested on cubietruck (FEL) only.

Signed-off-by: Ian Campbell 
---
v2:

make AHCI configurable per board, enabled for cubieboard,
cubieboard2, cubietruck and Olinuxino Micro.
---
 arch/arm/cpu/armv7/sunxi/clock.c |  4 ++
 boards.cfg   | 18 
 drivers/block/Makefile   |  1 +
 drivers/block/ahci.c | 15 ++-
 drivers/block/ahci_sunxi.c   | 95 
 include/ahci.h   |  9 
 include/configs/sunxi-common.h   | 12 +
 7 files changed, 144 insertions(+), 10 deletions(-)
 create mode 100644 drivers/block/ahci_sunxi.c

diff --git a/arch/arm/cpu/armv7/sunxi/clock.c b/arch/arm/cpu/armv7/sunxi/clock.c
index 06bc283..2cc274b 100644
--- a/arch/arm/cpu/armv7/sunxi/clock.c
+++ b/arch/arm/cpu/armv7/sunxi/clock.c
@@ -51,6 +51,10 @@ static void clock_init_safe(void)
 #ifdef CONFIG_SUN7I
writel(0x1 << 6 | readl(&ccm->ahb_gate0), &ccm->ahb_gate0);
writel(0x1 << 31 | readl(&ccm->pll6_cfg), &ccm->pll6_cfg);
+#ifdef CONFIG_SCSI_AHCI_SUNXI
+   writel(0x1 << 25 |readl(&ccm->ahb_gate0), &ccm->ahb_gate0);
+   writel(0x1 << 14 | readl(&ccm->pll6_cfg), &ccm->pll6_cfg);
+#endif
 #endif
 }
 #endif
diff --git a/boards.cfg b/boards.cfg
index 100acc8..987bc54 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -354,8 +354,8 @@ Active  arm armv7  sunxi   -
   sunxi
 Active  arm armv7  sunxi   -   sunxi   
A13-OLinuXinoM   
sun5i:A13_OLINUXINOM,SPL,NO_AXP,STATUSLED=201,CONS_INDEX=2  
  -
 Active  arm armv7  sunxi   -   sunxi   
A13-OLinuXinoM_FEL   
sun5i:A13_OLINUXINOM,SPL_FEL,NO_AXP,STATUSLED=201,CONS_INDEX=2  
  -
 Active  arm armv7  sunxi   -   sunxi   
A13_MID  sun5i:A13_MID,SPL,CONS_INDEX=2 

   -
-Active  arm armv7  sunxi   -   sunxi   
A20-OLinuXino_MICRO  
sun7i:A20_OLINUXINO_M,CONS_INDEX=1,STATUSLED=226,SPL,SUNXI_EMAC 
  -
-Active  arm armv7  sunxi   -   sunxi   
A20-OLinuXino_MICRO_FEL  
sun7i:A20_OLINUXINO_M,CONS_INDEX=1,STATUSLED=226,SPL_FEL,SUNXI_EMAC 
  -
+Active  arm armv7  sunxi   -   sunxi   
A20-OLinuXino_MICRO  
sun7i:A20_OLINUXINO_M,CONS_INDEX=1,STATUSLED=226,SPL,SUNXI_EMAC,AHCI,SATAPWR=SUNXI_GPB(8)
   -
+Active  arm armv7  sunxi   -   sunxi   
A20-OLinuXino_MICRO_FEL  
sun7i:A20_OLINUXINO_M,CONS_INDEX=1,STATUSLED=226,SPL_FEL,SUNXI_EMAC,AHCI,SATAPWR=SUNXI_GPB(8)
   -
 Active  arm armv7  sunxi   -   sunxi   
Auxtek-T003  
sun5i:AUXTEK_T003,SPL,AXP152_POWER,STATUSLED=34 
  -
 Active  arm armv7  sunxi   -   sunxi   
Auxtek-T004  
sun5i:AUXTEK_T004,SPL,AXP152_POWER,STATUSLED=34 
  -
 Active  arm armv7  sunxi   -   sunxi   
ba10_tv_box  sun4i:BA10_TV_BOX,SPL,SUNXI_EMAC   

   -
@@ -363,13 +363,13 @@ Active  arm armv7  sunxi   -  
 sunxi
 Active  arm armv7  sunxi   -   sunxi   
Coby_MID8042 sun4i:COBY_MID8042,SPL 

   -
 Active  arm armv7  sunxi   -   sunxi