@ -168,7 +168,7 @@ int ahci_reset(void __iomem *base)
static int ahci_host_init ( struct ahci_probe_ent * probe_ent )
static int ahci_host_init ( struct ahci_probe_ent * probe_ent )
{
{
# ifndef CONFIG_SCSI_AHCI_PLAT
# if !defined(CONFIG_SCSI_AHCI_PLAT) && !defined(CONFIG_DM_SCSI)
# ifdef CONFIG_DM_PCI
# ifdef CONFIG_DM_PCI
struct udevice * dev = probe_ent - > dev ;
struct udevice * dev = probe_ent - > dev ;
struct pci_child_platdata * pplat = dev_get_parent_platdata ( dev ) ;
struct pci_child_platdata * pplat = dev_get_parent_platdata ( dev ) ;
@ -198,7 +198,7 @@ static int ahci_host_init(struct ahci_probe_ent *probe_ent)
writel ( cap_save , mmio + HOST_CAP ) ;
writel ( cap_save , mmio + HOST_CAP ) ;
writel_with_flush ( 0xf , mmio + HOST_PORTS_IMPL ) ;
writel_with_flush ( 0xf , mmio + HOST_PORTS_IMPL ) ;
# ifndef CONFIG_SCSI_AHCI_PLAT
# if !defined(CONFIG_SCSI_AHCI_PLAT) && !defined(CONFIG_DM_SCSI)
# ifdef CONFIG_DM_PCI
# ifdef CONFIG_DM_PCI
if ( pplat - > vendor = = PCI_VENDOR_ID_INTEL ) {
if ( pplat - > vendor = = PCI_VENDOR_ID_INTEL ) {
u16 tmp16 ;
u16 tmp16 ;
@ -327,6 +327,7 @@ static int ahci_host_init(struct ahci_probe_ent *probe_ent)
writel ( tmp | HOST_IRQ_EN , mmio + HOST_CTL ) ;
writel ( tmp | HOST_IRQ_EN , mmio + HOST_CTL ) ;
tmp = readl ( mmio + HOST_CTL ) ;
tmp = readl ( mmio + HOST_CTL ) ;
debug ( " HOST_CTL 0x%x \n " , tmp ) ;
debug ( " HOST_CTL 0x%x \n " , tmp ) ;
# if !defined(CONFIG_DM_SCSI)
# ifndef CONFIG_SCSI_AHCI_PLAT
# ifndef CONFIG_SCSI_AHCI_PLAT
# ifdef CONFIG_DM_PCI
# ifdef CONFIG_DM_PCI
dm_pci_read_config16 ( dev , PCI_COMMAND , & tmp16 ) ;
dm_pci_read_config16 ( dev , PCI_COMMAND , & tmp16 ) ;
@ -338,14 +339,15 @@ static int ahci_host_init(struct ahci_probe_ent *probe_ent)
pci_write_config_word ( pdev , PCI_COMMAND , tmp16 ) ;
pci_write_config_word ( pdev , PCI_COMMAND , tmp16 ) ;
# endif
# endif
# endif
# endif
# endif
return 0 ;
return 0 ;
}
}
static void ahci_print_info ( struct ahci_probe_ent * probe_ent )
static void ahci_print_info ( struct ahci_probe_ent * probe_ent )
{
{
# ifndef CONFIG_SCSI_AHCI_PLAT
# if !defined(CONFIG_SCSI_AHCI_PLAT) && !defined(CONFIG_DM_SCSI)
# ifdef CONFIG_DM_PCI
# if defined(CONFIG_DM_PCI)
struct udevice * dev = probe_ent - > dev ;
struct udevice * dev = probe_ent - > dev ;
# else
# else
pci_dev_t pdev = probe_ent - > dev ;
pci_dev_t pdev = probe_ent - > dev ;
@ -372,7 +374,7 @@ static void ahci_print_info(struct ahci_probe_ent *probe_ent)
else
else
speed_s = " ? " ;
speed_s = " ? " ;
# ifdef CONFIG_SCSI_AHCI_PLAT
# if defined(CONFIG_SCSI_AHCI_PLAT) || defined(CONFIG_DM_SCSI)
scc_s = " SATA " ;
scc_s = " SATA " ;
# else
# else
# ifdef CONFIG_DM_PCI
# ifdef CONFIG_DM_PCI
@ -424,13 +426,15 @@ static void ahci_print_info(struct ahci_probe_ent *probe_ent)
}
}
# ifndef CONFIG_SCSI_AHCI_PLAT
# ifndef CONFIG_SCSI_AHCI_PLAT
# ifdef CONFIG_DM_PCI
# if defined(CONFIG_DM_PCI) || defined(CONFIG_DM_SCSI)
static int ahci_init_one ( struct udevice * dev )
static int ahci_init_one ( struct udevice * dev )
# else
# else
static int ahci_init_one ( pci_dev_t dev )
static int ahci_init_one ( pci_dev_t dev )
# endif
# endif
{
{
# if !defined(CONFIG_DM_SCSI)
u16 vendor ;
u16 vendor ;
# endif
int rc ;
int rc ;
probe_ent = malloc ( sizeof ( struct ahci_probe_ent ) ) ;
probe_ent = malloc ( sizeof ( struct ahci_probe_ent ) ) ;
@ -450,6 +454,7 @@ static int ahci_init_one(pci_dev_t dev)
probe_ent - > pio_mask = 0x1f ;
probe_ent - > pio_mask = 0x1f ;
probe_ent - > udma_mask = 0x7f ; /*Fixme,assume to support UDMA6 */
probe_ent - > udma_mask = 0x7f ; /*Fixme,assume to support UDMA6 */
# if !defined(CONFIG_DM_SCSI)
# ifdef CONFIG_DM_PCI
# ifdef CONFIG_DM_PCI
probe_ent - > mmio_base = dm_pci_map_bar ( dev , PCI_BASE_ADDRESS_5 ,
probe_ent - > mmio_base = dm_pci_map_bar ( dev , PCI_BASE_ADDRESS_5 ,
PCI_REGION_MEM ) ;
PCI_REGION_MEM ) ;
@ -473,6 +478,10 @@ static int ahci_init_one(pci_dev_t dev)
if ( vendor = = 0x197b )
if ( vendor = = 0x197b )
pci_write_config_byte ( dev , 0x41 , 0xa1 ) ;
pci_write_config_byte ( dev , 0x41 , 0xa1 ) ;
# endif
# endif
# else
struct scsi_platdata * plat = dev_get_platdata ( dev ) ;
probe_ent - > mmio_base = ( void * ) plat - > base ;
# endif
debug ( " ahci mmio_base=0x%p \n " , probe_ent - > mmio_base ) ;
debug ( " ahci mmio_base=0x%p \n " , probe_ent - > mmio_base ) ;
/* initialize adapter */
/* initialize adapter */
@ -954,14 +963,17 @@ int scsi_exec(ccb *pccb)
}
}
# if defined(CONFIG_DM_SCSI)
void scsi_low_level_init ( int busdevfunc , struct udevice * dev )
# else
void scsi_low_level_init ( int busdevfunc )
void scsi_low_level_init ( int busdevfunc )
# endif
{
{
int i ;
int i ;
u32 linkmap ;
u32 linkmap ;
# ifndef CONFIG_SCSI_AHCI_PLAT
# ifndef CONFIG_SCSI_AHCI_PLAT
# ifdef CONFIG_DM_PCI
# if defined(CONFIG_DM_PCI)
struct udevice * dev ;
struct udevice * dev ;
int ret ;
int ret ;
@ -969,6 +981,8 @@ void scsi_low_level_init(int busdevfunc)
if ( ret )
if ( ret )
return ;
return ;
ahci_init_one ( dev ) ;
ahci_init_one ( dev ) ;
# elif defined(CONFIG_DM_SCSI)
ahci_init_one ( dev ) ;
# else
# else
ahci_init_one ( busdevfunc ) ;
ahci_init_one ( busdevfunc ) ;
# endif
# endif