SATA support for omap5_uevm and dra7_evm
Subsystems (2)
v2 cover SATA support for omap5_uevm and dra7_evm
Hi,
This series adds SATA support for OMAP5 uevm and DRA7 evm.
Patches are also availabe at
git at github.com:rogerq/u-boot.git sata
v2:
- Address review comments in the RFC series
- Fix cache align error in the ahci driver
- Added dra7 support
cheers,
-roger
Roger Quadros (8):
ahci: Error out with message on malloc() failure
ahci: Fix cache align error messages
ARM: OMAP5: Add Pipe3 PHY driver
ARM: OMAP5: Add PRCM and Control information for SATA
ARM: OMAP5: Add SATA platform glue
ARM: omap5_uevm: Add SATA support
ARM: DRA7xx: Add PRCM and Control information for SATA
ARM: dra7_evm: Add SATA support
arch/arm/cpu/armv7/omap-common/Makefile | 5 + arch/arm/cpu/armv7/omap-common/pipe3-phy.c | 233 +++++++++++++++++++++++++++++ arch/arm/cpu/armv7/omap-common/pipe3-phy.h | 36 +++++ arch/arm/cpu/armv7/omap-common/sata.c | 75 ++++++++++ arch/arm/cpu/armv7/omap5/prcm-regs.c | 7 + arch/arm/include/asm/arch-omap5/clock.h | 3 + arch/arm/include/asm/arch-omap5/omap.h | 3 + arch/arm/include/asm/arch-omap5/sata.h | 48 ++++++ arch/arm/include/asm/omap_common.h | 2 + board/ti/dra7xx/evm.c | 7 + board/ti/omap5_uevm/evm.c | 7 + drivers/block/ahci.c | 18 ++- include/configs/dra7xx_evm.h | 11 ++ include/configs/omap5_uevm.h | 10 ++ 14 files changed, 459 insertions(+), 6 deletions(-) create mode 100644 arch/arm/cpu/armv7/omap-common/pipe3-phy.c create mode 100644 arch/arm/cpu/armv7/omap-common/pipe3-phy.h create mode 100644 arch/arm/cpu/armv7/omap-common/sata.c create mode 100644 arch/arm/include/asm/arch-omap5/sata.h
Signature · 1 line
1.8.3.2
PATCH v2 1/8 ahci: Error out with message on malloc() failure
If malloc() fails, we don't want to continue in ahci_init() and ahci_init_one(). Also print a more informative error message on malloc() failures.
--- drivers/block/ahci.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/block/ahci.c +14 -2
@@ -379,6 +379,11 @@ static int ahci_init_one(pci_dev_t pdev)int rc; probe_ent =malloc (sizeof (struct ahci_probe_ent )); +if (!probe_ent) { +printf ("%s: No memory for probe_ent\n" , __func__); +return -ENOMEM ; + } +memset (probe_ent,0 ,sizeof (struct ahci_probe_ent )); probe_ent->dev = pdev;
@@ -503,7 +508,7 @@ static int ahci_port_start(u8 port) mem = (u32 )malloc (AHCI_PORT_PRIV_DMA_SZ +2048 );if (!mem) {free (pp); -printf ("No mem for table!\n" ); +printf ("%s: No mem for table!\n" , __func__);return -ENOMEM ; }
@@ -638,8 +643,10 @@ static int ata_scsiop_inquiry(ccb *pccb)/* Read id from sata */ port = pccb->target; tmpid =malloc (ATA_ID_WORDS *2 ); -if (!tmpid) +if (!tmpid) { +printf ("%s: No memory for tmpid\n" , __func__);return -ENOMEM ; + }if (ahci_device_data_io (port, (u8 *) &fis,sizeof (fis), (u8 *)tmpid,ATA_ID_WORDS *2 ,0 )) {
@@ -889,6 +896,11 @@ int ahci_init(u32 base)u32 linkmap; probe_ent =malloc (sizeof (struct ahci_probe_ent )); +if (!probe_ent) { +printf ("%s: No memory for probe_ent\n" , __func__); +return -ENOMEM ; + } +memset (probe_ent,0 ,sizeof (struct ahci_probe_ent )); probe_ent->host_flags =ATA_FLAG_SATA
Signature · 1 line
1.8.3.2
PATCH v2 2/8 ahci: Fix cache align error messages
In reply to Roger QuadrosAlign the ATA ID buffer to the cache-line boundary. This gets rid of the below error mesages on ARM v7 platforms.
scanning bus for devices...
ERROR: v7_dcache_inval_range - start address is not aligned - 0xfee48618
ERROR: v7_dcache_inval_range - stop address is not aligned - 0xfee48818
--- drivers/block/ahci.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/block/ahci.c +1 -7
@@ -623,7 +623,7 @@ static int ata_scsiop_inquiry(ccb *pccb) 95 - 4, };u8 fis[20 ]; -u16 *tmpid; +ALLOC_CACHE_ALIGN_BUFFER (u16, tmpid,ATA_ID_WORDS );u8 port;/* Clean ccb data buffer */
@@ -642,16 +642,10 @@ static int ata_scsiop_inquiry(ccb *pccb)/* Read id from sata */ port = pccb->target; - tmpid =malloc (ATA_ID_WORDS *2 ); -if (!tmpid) { -printf ("%s: No memory for tmpid\n" , __func__); -return -ENOMEM ; - }if (ahci_device_data_io (port, (u8 *) &fis,sizeof (fis), (u8 *)tmpid,ATA_ID_WORDS *2 ,0 )) {debug ("scsi_ahci: SCSI inquiry command failure.\n" ); -free (tmpid);return -EIO ; }
Signature · 1 line
1.8.3.2
PATCH v2 3/8 ARM: OMAP5: Add Pipe3 PHY driver
In reply to Roger QuadrosPipe3 PHY is used by SATA, USB3 and PCIe modules. This is a driver for the Pipe3 PHY.
--- arch/arm/cpu/armv7/omap-common/Makefile | 4 + arch/arm/cpu/armv7/omap-common/pipe3-phy.c | 233 +++++++++++++++++++++++++++++ arch/arm/cpu/armv7/omap-common/pipe3-phy.h | 36 +++++ 3 files changed, 273 insertions(+) create mode 100644 arch/arm/cpu/armv7/omap-common/pipe3-phy.c create mode 100644 arch/arm/cpu/armv7/omap-common/pipe3-phy.h
arch/arm/cpu/armv7/omap-common/Makefile +4 -0
@@ -17,6 +17,10 @@ obj-y += vc.o obj-y += abb.o endif +ifneq ($(CONFIG_OMAP54XX),) +COBJS += pipe3-phy.o +endif + ifeq ($(CONFIG_OMAP34XX),) obj-y += boot-common.o obj-y += lowlevel_init.o
arch/arm/cpu/armv7/omap-common/pipe3-phy.c new file +233 -0
233 lines not on this page · raw message
arch/arm/cpu/armv7/omap-common/pipe3-phy.h new file +36 -0
@@ -0,0 +1,36 @@ +/* +* TI PIPE3 PHY +* +* (C) Copyright 2013 +* Texas Instruments, <www.ti.com> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __OMAP_PIPE3_PHY_H +#define __OMAP_PIPE3_PHY_H + +struct pipe3_dpll_params { +u16 m; +u8 n; +u8 freq:3 ; +u8 sd; +u32 mf; +}; + +struct pipe3_dpll_map { +unsigned long rate; +struct pipe3_dpll_params params; +}; + +struct omap_pipe3 { +void __iomem *pll_ctrl_base; +void __iomem *power_reg; +struct pipe3_dpll_map *dpll_map; +}; + + +int phy_pipe3_power_on (struct omap_pipe3 *phy); +int phy_pipe3_power_off (struct omap_pipe3 *pipe3); + +#endif /* __OMAP_PIPE3_PHY_H */
Signature · 1 line
1.8.3.2
PATCH v2 4/8 ARM: OMAP5: Add PRCM and Control information for SATA
In reply to Roger QuadrosAdds the necessary PRCM and Control register information for SATA on OMAP5.
--- arch/arm/cpu/armv7/omap5/prcm-regs.c | 4 ++++ arch/arm/include/asm/arch-omap5/clock.h | 3 +++ arch/arm/include/asm/arch-omap5/omap.h | 3 +++ arch/arm/include/asm/omap_common.h | 2 ++ 4 files changed, 12 insertions(+)
arch/arm/cpu/armv7/omap5/prcm-regs.c +4 -0
@@ -203,8 +203,10 @@ struct prcm_regs const omap5_es1_prcm = { .cm_l3init_hsusbotg_clkctrl = 0x4a009360, .cm_l3init_hsusbtll_clkctrl = 0x4a009368, .cm_l3init_p1500_clkctrl = 0x4a009378, + .cm_l3init_sata_clkctrl = 0x4a009388, .cm_l3init_fsusb_clkctrl = 0x4a0093d0, .cm_l3init_ocp2scp1_clkctrl = 0x4a0093e0, + .cm_l3init_ocp2scp3_clkctrl = 0x4a0093e8,/* cm2.l4per */ .cm_l4per_clkstctrl = 0x4a009400,
@@ -296,6 +298,7 @@ struct omap_sys_ctrl_regs const omap5_ctrl = { .control_status = 0x4A002134, .control_std_fuse_opp_vdd_mpu_2 = 0x4A0021B4, .control_phy_power_usb = 0x4A002370, + .control_phy_power_sata = 0x4A002374, .control_padconf_core_base = 0x4A002800, .control_paconf_global = 0x4A002DA0, .control_paconf_mode = 0x4A002DA4,
@@ -698,6 +701,7 @@ struct prcm_regs const omap5_es2_prcm = { .cm_l3init_hsusbotg_clkctrl = 0x4a009660, .cm_l3init_hsusbtll_clkctrl = 0x4a009668, .cm_l3init_p1500_clkctrl = 0x4a009678, + .cm_l3init_sata_clkctrl = 0x4a009688, .cm_l3init_fsusb_clkctrl = 0x4a0096d0, .cm_l3init_ocp2scp1_clkctrl = 0x4a0096e0, .cm_l3init_ocp2scp3_clkctrl = 0x4a0096e8,
arch/arm/include/asm/arch-omap5/clock.h +3 -0
@@ -137,6 +137,9 @@#define HSMMC_CLKCTRL_CLKSEL_MASK (1 << 24)#define HSMMC_CLKCTRL_CLKSEL_DIV_MASK (1 << 25) +/* CM_L3INIT_SATA_CLKCTRL */ +#define SATA_CLKCTRL_OPTFCLKEN_MASK (1 << 8) +/* CM_WKUP_GPTIMER1_CLKCTRL */ #define GPTIMER1_CLKCTRL_CLKSEL_MASK (1 << 24)
arch/arm/include/asm/arch-omap5/omap.h +3 -0
@@ -64,6 +64,9 @@/* QSPI */ #define QSPI_BASE 0x4B300000 +/* SATA */ +#define DWC_AHSATA_BASE 0x4A140000 +/* * Hardware Register Details */
arch/arm/include/asm/omap_common.h +2 -0
@@ -226,6 +226,7 @@ struct prcm_regs {u32 cm_l3init_hsusbotg_clkctrl;u32 cm_l3init_hsusbtll_clkctrl;u32 cm_l3init_p1500_clkctrl; +u32 cm_l3init_sata_clkctrl;u32 cm_l3init_fsusb_clkctrl;u32 cm_l3init_ocp2scp1_clkctrl;u32 cm_l3init_ocp2scp3_clkctrl;
@@ -366,6 +367,7 @@ struct omap_sys_ctrl_regs {u32 control_ldosram_mpu_voltage_ctrl;u32 control_ldosram_core_voltage_ctrl;u32 control_usbotghs_ctrl; +u32 control_phy_power_sata;u32 control_padconf_core_base;u32 control_paconf_global;u32 control_paconf_mode;
Signature · 1 line
1.8.3.2
PATCH v2 5/8 ARM: OMAP5: Add SATA platform glue
In reply to Roger QuadrosAdd platform glue logic for the SATA controller.
--- arch/arm/cpu/armv7/omap-common/Makefile | 1 + arch/arm/cpu/armv7/omap-common/sata.c | 75 +++++++++++++++++++++++++++++++++ arch/arm/include/asm/arch-omap5/sata.h | 48 +++++++++++++++++++++ 3 files changed, 124 insertions(+) create mode 100644 arch/arm/cpu/armv7/omap-common/sata.c create mode 100644 arch/arm/include/asm/arch-omap5/sata.h
arch/arm/cpu/armv7/omap-common/Makefile +1 -0
@@ -19,6 +19,7 @@ endif ifneq ($(CONFIG_OMAP54XX),) COBJS += pipe3-phy.o +obj-$(CONFIG_SCSI_AHCI_PLAT) += sata.o endif ifeq ($(CONFIG_OMAP34XX),)
arch/arm/cpu/armv7/omap-common/sata.c new file +75 -0
75 lines not on this page · raw message
arch/arm/include/asm/arch-omap5/sata.h new file +48 -0
48 lines not on this page · raw message
Signature · 1 line
1.8.3.2
PATCH v2 6/8 ARM: omap5_uevm: Add SATA support
In reply to Roger QuadrosThe uevm has a SATA port. Inititialize the SATA controller.
--- board/ti/omap5_uevm/evm.c | 7 +++++++ include/configs/omap5_uevm.h | 10 ++++++++++ 2 files changed, 17 insertions(+)
board/ti/omap5_uevm/evm.c +7 -0
@@ -20,6 +20,7 @@#include <asm/arch/clock.h> #include <asm/arch/ehci.h> #include <asm/ehci-omap.h> +#include <asm/arch/sata.h> #define DIE_ID_REG_BASE (OMAP54XX_L4_CORE_BASE + 0x2000)#define DIE_ID_REG_OFFSET 0x200
@@ -67,6 +68,12 @@ int board_init(void)return 0 ; } +int board_late_init (void ) +{ +omap_sata_init (); +return 0 ; +} +int board_eth_init (bd_t *bis) {return 0 ;
include/configs/omap5_uevm.h +10 -0
@@ -69,4 +69,14 @@/* Max time to hold reset on this board, see doc/README.omap-reset-time */ #define CONFIG_OMAP_PLATFORM_RESET_TIME_MAX_USEC 16296 +#define CONFIG_BOARD_LATE_INIT +#define CONFIG_CMD_SCSI +#define CONFIG_LIBATA +#define CONFIG_SCSI_AHCI +#define CONFIG_SCSI_AHCI_PLAT +#define CONFIG_SYS_SCSI_MAX_SCSI_ID 1 +#define CONFIG_SYS_SCSI_MAX_LUN 1 +#define CONFIG_SYS_SCSI_MAX_DEVICE (CONFIG_SYS_SCSI_MAX_SCSI_ID * \ + CONFIG_SYS_SCSI_MAX_LUN) +#endif /* __CONFIG_OMAP5_EVM_H */
Signature · 1 line
1.8.3.2
PATCH v2 7/8 ARM: DRA7xx: Add PRCM and Control information for SATA
In reply to Roger QuadrosAdds the necessary PRCM and Control register information for SATA on DRA7xx.
--- arch/arm/cpu/armv7/omap5/prcm-regs.c | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/cpu/armv7/omap5/prcm-regs.c +3 -0
@@ -376,6 +376,7 @@ struct omap_sys_ctrl_regs const omap5_ctrl = {struct omap_sys_ctrl_regs const dra7xx_ctrl = { .control_status =0x4A002134 , + .control_phy_power_sata =0x4A002374 , .control_core_mac_id_0_lo =0x4A002514 , .control_core_mac_id_0_hi =0x4A002518 , .control_core_mac_id_1_lo =0x4A00251C ,
@@ -895,9 +896,11 @@ struct prcm_regs const dra7xx_prcm = { .cm_l3init_hsusbhost_clkctrl = 0x4a009340, .cm_l3init_hsusbotg_clkctrl = 0x4a009348, .cm_l3init_hsusbtll_clkctrl = 0x4a009350, + .cm_l3init_sata_clkctrl = 0x4a009388, .cm_gmac_clkstctrl = 0x4a0093c0, .cm_gmac_gmac_clkctrl = 0x4a0093d0, .cm_l3init_ocp2scp1_clkctrl = 0x4a0093e0, + .cm_l3init_ocp2scp3_clkctrl = 0x4a0093e8,/* cm2.l4per */ .cm_l4per_clkstctrl = 0x4a009700,
Signature · 1 line
1.8.3.2
PATCH v2 8/8 ARM: dra7_evm: Add SATA support
In reply to Roger QuadrosThe evm has a SATA port. Enable SATA configuration and inititialize the SATA controller.
--- board/ti/dra7xx/evm.c | 7 +++++++ include/configs/dra7xx_evm.h | 11 +++++++++++ 2 files changed, 18 insertions(+)
board/ti/dra7xx/evm.c +7 -0
@@ -14,6 +14,7 @@#include <palmas.h> #include <asm/arch/sys_proto.h> #include <asm/arch/mmc_host_def.h> +#include <asm/arch/sata.h> #include "mux_data.h"
@@ -77,6 +78,12 @@ int board_init(void)return 0 ; } +int board_late_init (void ) +{ +omap_sata_init (); +return 0 ; +} +/** * @brief misc_init_r - Configure EVM board specific configurations * such as power configurations, ethernet initialization as phase2 of
include/configs/dra7xx_evm.h +11 -0
@@ -78,4 +78,15 @@#define CONFIG_OMAP_USB_PHY #define CONFIG_OMAP_USB2PHY2_HOST +/* SATA */ +#define CONFIG_BOARD_LATE_INIT +#define CONFIG_CMD_SCSI +#define CONFIG_LIBATA +#define CONFIG_SCSI_AHCI +#define CONFIG_SCSI_AHCI_PLAT +#define CONFIG_SYS_SCSI_MAX_SCSI_ID 1 +#define CONFIG_SYS_SCSI_MAX_LUN 1 +#define CONFIG_SYS_SCSI_MAX_DEVICE (CONFIG_SYS_SCSI_MAX_SCSI_ID * \ + CONFIG_SYS_SCSI_MAX_LUN) +#endif /* __CONFIG_DRA7XX_EVM_H */
Signature · 1 line
1.8.3.2
PATCH v2 2/8 ahci: Fix cache align error messages
In reply to Roger QuadrosQuoted 23 lines · Roger Quadros
Align the ATA ID buffer to the cache-line boundary. This gets rid of the below error mesages on ARM v7 platforms.
scanning bus for devices...
ERROR:v7_dcache_inval_range- start address is not aligned -0xfee48618
ERROR:v7_dcache_inval_range- stop address is not aligned -0xfee48818CC Aneesh V <[email protected]>Signed-off-by Roger Quadros <[email protected]>--- drivers/block/ahci.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)drivers/block/ahci.c +1
-1@@ -623,7 +623,7 @@ static int ata_scsiop_inquiry(ccb *pccb) 95 - 4, };u8 fis[20 ]; -u16 *tmpid; +ALLOC_CACHE_ALIGN_BUFFER (u16, tmpid,ATA_ID_WORDS );
[snip]
drivers/block/ahci.c static int ata_scsiop_inquiry(ccb *pccb) · line 647
Quoted 8 lines
drivers/block/ahci.c +0
-5- tmpid =malloc (ATA_ID_WORDS *2 ); -if (!tmpid) { -printf ("%s: No memory for tmpid\n" , __func__); -return -ENOMEM ; - }if (ahci_device_data_io (port, (u8 *) &fis,sizeof (fis), (u8 *)tmpid,ATA_ID_WORDS *2 ,0 )) {
We should be calling ALLOC_CACHE_ALIGN_BUFFER with ATA_ID_WORDS * 2, right?
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20131111/bd4736b4/attachment.pgp>
PATCH v2 2/8 ahci: Fix cache align error messages
Quoted 31 lines · Tom Rini
Quoted 23 lines · Roger Quadros
Align the ATA ID buffer to the cache-line boundary. This gets rid of the below error mesages on ARM v7 platforms.
scanning bus for devices...
ERROR:v7_dcache_inval_range- start address is not aligned -0xfee48618
ERROR:v7_dcache_inval_range- stop address is not aligned -0xfee48818CC Aneesh V <[email protected]>Signed-off-by Roger Quadros <[email protected]>--- drivers/block/ahci.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)drivers/block/ahci.c +1
-1@@ -623,7 +623,7 @@ static int ata_scsiop_inquiry(ccb *pccb) 95 - 4, };u8 fis[20 ]; -u16 *tmpid; +ALLOC_CACHE_ALIGN_BUFFER (u16, tmpid,ATA_ID_WORDS );[snip]
Quoted 6 lines
drivers/block/ahci.c +0
-5- tmpid =malloc (ATA_ID_WORDS *2 ); -if (!tmpid) { -printf ("%s: No memory for tmpid\n" , __func__); -return -ENOMEM ; - }
Quoted 6 lines
drivers/block/ahci.c static int ata_scsiop_inquiry(ccb *pccb) · line 647
Quoted 2 lines
drivers/block/ahci.c +0
-0if (ahci_device_data_io (port, (u8 *) &fis,sizeof (fis), (u8 *)tmpid,ATA_ID_WORDS *2 ,0 )) {We should be calling
ALLOC_CACHE_ALIGN_BUFFERwithATA_ID_WORDS* 2, right?
No, as is u16.
cheers,
-roger
v2 cover SATA support for omap5_uevm and dra7_evm
In reply to Roger QuadrosQuoted 11 lines · Roger Quadros
Hi,
This series adds SATA support for OMAP5 uevm and DRA7 evm.
Patches are also availabe at
git at github.com:rogerq/u-boot.git satav2:
- Address review comments in the RFC series
- Fix cache align error in the ahci driver
- Added dra7 support
Please run ./tools/checkpatch.pl over the series and correct the issues there, thanks.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20131111/0a08f2ae/attachment.pgp>