1 // SPDX-License-Identifier: GPL-2.0+ 2 /* 3 * Copyright 2015 Freescale Semiconductor, Inc. 4 */ 5 #include <common.h> 6 #include <asm/io.h> 7 #include <asm/arch/immap_ls102xa.h> 8 #include <ahci.h> 9 #include <scsi.h> 10 11 /* port register default value */ 12 #define AHCI_PORT_PHY_1_CFG 0xa003fffe 13 #define AHCI_PORT_PHY_2_CFG 0x28183414 14 #define AHCI_PORT_PHY_3_CFG 0x0e080e06 15 #define AHCI_PORT_PHY_4_CFG 0x064a080b 16 #define AHCI_PORT_PHY_5_CFG 0x2aa86470 17 #define AHCI_PORT_TRANS_CFG 0x08000029 18 19 #define SATA_ECC_REG_ADDR 0x20220520 20 #define SATA_ECC_DISABLE 0x00020000 21 ls1021a_sata_init(void)22int ls1021a_sata_init(void) 23 { 24 struct ccsr_ahci __iomem *ccsr_ahci = (void *)AHCI_BASE_ADDR; 25 26 #ifdef CONFIG_SYS_FSL_ERRATUM_A008407 27 out_le32((void *)SATA_ECC_REG_ADDR, SATA_ECC_DISABLE); 28 #endif 29 30 out_le32(&ccsr_ahci->ppcfg, AHCI_PORT_PHY_1_CFG); 31 out_le32(&ccsr_ahci->pp2c, AHCI_PORT_PHY_2_CFG); 32 out_le32(&ccsr_ahci->pp3c, AHCI_PORT_PHY_3_CFG); 33 out_le32(&ccsr_ahci->pp4c, AHCI_PORT_PHY_4_CFG); 34 out_le32(&ccsr_ahci->pp5c, AHCI_PORT_PHY_5_CFG); 35 out_le32(&ccsr_ahci->ptc, AHCI_PORT_TRANS_CFG); 36 37 ahci_init((void __iomem *)AHCI_BASE_ADDR); 38 scsi_scan(false); 39 40 return 0; 41 } 42