void spl_sata_load_image(void) { int err; block_dev_desc_t *stor_dev; err = init_sata(CONFIG_SPL_SATA_BOOT_DEVICE); if (err) { #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT printf("spl: sata init failed: err - %d\n", err); #endif hang(); } else { /* try to recognize storage devices immediately */ scsi_scan(0); stor_dev = scsi_get_dev(0); } #ifdef CONFIG_SPL_OS_BOOT if (spl_start_uboot() || spl_load_image_fat_os(stor_dev, CONFIG_SYS_SATA_FAT_BOOT_PARTITION)) #endif err = spl_load_image_fat(stor_dev, CONFIG_SYS_SATA_FAT_BOOT_PARTITION, CONFIG_SPL_FS_LOAD_PAYLOAD_NAME); if (err) { puts("Error loading sata device\n"); hang(); } }
void scsi_init(void) { #if defined(CONFIG_SATA_CEVA) init_sata(0); #endif ahci_init((void __iomem *)ZYNQMP_SATA_BASEADDR); scsi_scan(1); }
void scsi_init(void) { u32 reg = readl(HB_SREG_A9_PWRDOM_STAT); if (reg & PWRDOM_STAT_SATA) { ahci_init(HB_AHCI_BASE); scsi_scan(1); } }
void scsi_init(void) { int busdevfunc = -1; int i; /* * Find a device from the list, this driver will support a single * controller. */ for (i = 0; i < ARRAY_SIZE(scsi_device_list); i++) { /* get PCI Device ID */ #ifdef CONFIG_DM_PCI struct udevice *dev; int ret; ret = dm_pci_find_device(scsi_device_list[i].vendor, scsi_device_list[i].device, 0, &dev); if (!ret) { busdevfunc = dm_pci_get_bdf(dev); break; } #else busdevfunc = pci_find_device(scsi_device_list[i].vendor, scsi_device_list[i].device, 0); #endif if (busdevfunc != -1) break; } if (busdevfunc == -1) { printf("Error: SCSI Controller(s) "); for (i = 0; i < ARRAY_SIZE(scsi_device_list); i++) { printf("%04X:%04X ", scsi_device_list[i].vendor, scsi_device_list[i].device); } printf("not found\n"); return; } #ifdef DEBUG else { printf("SCSI Controller (%04X,%04X) found (%d:%d:%d)\n", scsi_device_list[i].vendor, scsi_device_list[i].device, (busdevfunc >> 16) & 0xFF, (busdevfunc >> 11) & 0x1F, (busdevfunc >> 8) & 0x7); } #endif bootstage_start(BOOTSTAGE_ID_ACCUM_SCSI, "ahci"); scsi_low_level_init(busdevfunc); scsi_scan(true); bootstage_accum(BOOTSTAGE_ID_ACCUM_SCSI); }
static ssize_t store_scan(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct Scsi_Host *shost = class_to_shost(dev); int res; res = scsi_scan(shost, buf); if (res == 0) res = count; return res; };
int exynos5_sata_init(const void *blob) { if (exynos5_sata_enable_power(blob) == 0) { exynos5_enable_clock_gates(); if (exynos5_ahci_init((void *)SATA_AHCI_AXI)) { ahci_init(SATA_AHCI_AXI); scsi_scan(1); return 0; } } return -ENODEV; }
int sata_init(void) { struct ccsr_ahci __iomem *ccsr_ahci = (void *)CONFIG_SYS_SATA; out_le32(&ccsr_ahci->ppcfg, AHCI_PORT_PHY_1_CFG); out_le32(&ccsr_ahci->pp2c, AHCI_PORT_PHY_2_CFG); out_le32(&ccsr_ahci->pp3c, AHCI_PORT_PHY_3_CFG); out_le32(&ccsr_ahci->ptc, AHCI_PORT_TRANS_CFG); ahci_init((void __iomem *)CONFIG_SYS_SATA); scsi_scan(0); return 0; }
void scsi_init(void) { /* * Find a device from the list, this driver will support a single * controller. */ #ifdef CONFIG_SCSI_6820 board_ahci_init(); #endif #if defined CONFIG_SCSI_MV94XX int busdevfunc; if ((busdevfunc = pci_find_devices (mv94xx_pci_ids, 0)) < 0) { printf("MV94XX controller not present\n"); return; } if (scsi_curr_dev == -1) scsi_low_level_init(busdevfunc); else scsi_bus_reset(); /*mult-time "scsi init", no need re-assign resource"*/ #else int i, busdevfunc, index = 0; for (;;) { busdevfunc = pci_find_devices(scsi_device_list, index); if (busdevfunc == -1) { if (index == 0) { printf("Error: SCSI Controller(s) "); for (i = 0; i < ARRAY_SIZE(scsi_device_list) - 1; i++) { printf("%04X:%04X ", scsi_device_list[i].vendor, scsi_device_list[i].device); } printf("not found\n"); } break; } #ifdef DEBUG else { printf("SCSI Controller found (%d:%d:%d)\n", (busdevfunc >> 16) & 0xFF, (busdevfunc >> 11) & 0x1F, (busdevfunc >> 8) & 0x7); } #endif scsi_low_level_init(busdevfunc); index++; } #endif scsi_scan(1); }
int sata_init(void) { struct ccsr_ahci __iomem *ccsr_ahci = (void *)CONFIG_SYS_SATA; #ifdef CONFIG_ARCH_LS1046A /* Disable SATA ECC */ out_le32((void *)CONFIG_SYS_DCSR_DCFG_ADDR + 0x520, 0x80000000); #endif out_le32(&ccsr_ahci->ppcfg, AHCI_PORT_PHY_1_CFG); out_le32(&ccsr_ahci->ptc, AHCI_PORT_TRANS_CFG); out_le32(&ccsr_ahci->axicc, AHCI_PORT_AXICC_CFG); ahci_init((void __iomem *)CONFIG_SYS_SATA); scsi_scan(0); return 0; }
void scsi_init(void) { int busdevfunc; busdevfunc=pci_find_device(SCSI_VEND_ID,SCSI_DEV_ID,0); /* get PCI Device ID */ if(busdevfunc==-1) { printf("Error SCSI Controller (%04X,%04X) not found\n",SCSI_VEND_ID,SCSI_DEV_ID); return; } #ifdef DEBUG else { printf("SCSI Controller (%04X,%04X) found (%d:%d:%d)\n",SCSI_VEND_ID,SCSI_DEV_ID,(busdevfunc>>16)&0xFF,(busdevfunc>>11)&0x1F,(busdevfunc>>8)&0x7); } #endif scsi_low_level_init(busdevfunc); scsi_scan(1); }
int ls1021a_sata_init(void) { struct ccsr_ahci __iomem *ccsr_ahci = (void *)AHCI_BASE_ADDR; #ifdef CONFIG_SYS_FSL_ERRATUM_A008407 out_le32((void *)SATA_ECC_REG_ADDR, SATA_ECC_DISABLE); #endif out_le32(&ccsr_ahci->ppcfg, AHCI_PORT_PHY_1_CFG); out_le32(&ccsr_ahci->pp2c, AHCI_PORT_PHY_2_CFG); out_le32(&ccsr_ahci->pp3c, AHCI_PORT_PHY_3_CFG); out_le32(&ccsr_ahci->pp4c, AHCI_PORT_PHY_4_CFG); out_le32(&ccsr_ahci->pp5c, AHCI_PORT_PHY_5_CFG); out_le32(&ccsr_ahci->ptc, AHCI_PORT_TRANS_CFG); ahci_init((void __iomem *)AHCI_BASE_ADDR); scsi_scan(false); return 0; }
int misc_init_r(void) { char envbuffer[16]; u32 boot_choice; u32 reg = readl(HB_SREG_A9_PWRDOM_STAT); if (reg & PWRDOM_STAT_SATA) { ahci_init(0xffe08000); scsi_scan(1); } boot_choice = readl(HB_SREG_A9_BOOT_SRC_STAT) & 0xff; sprintf(envbuffer, "bootcmd%d", boot_choice); if (getenv(envbuffer)) { sprintf(envbuffer, "run bootcmd%d", boot_choice); setenv("bootcmd", envbuffer); } else setenv("bootcmd", ""); return 0; }
void scsi_init(void) { int busdevfunc; int i; /* * Find a device from the list, this driver will support a single * controller. */ for (i = 0; i < ARRAY_SIZE(scsi_device_list); i++) { /* get PCI Device ID */ busdevfunc = pci_find_device(scsi_device_list[i].scsi_vendor_id, scsi_device_list[i].scsi_dev_id, 0); if (busdevfunc != -1) break; } if (busdevfunc == -1) { printf("Error: SCSI Controller(s) "); for (i = 0; i < ARRAY_SIZE(scsi_device_list); i++) { printf("%04X:%04X ", scsi_device_list[i].scsi_vendor_id, scsi_device_list[i].scsi_dev_id); } printf("not found\n"); return; } #ifdef DEBUG else { printf("SCSI Controller (%04X,%04X) found (%d:%d:%d)\n", scsi_device_list[i].scsi_vendor_id, scsi_device_list[i].scsi_dev_id, (busdevfunc >> 16) & 0xFF, (busdevfunc >> 11) & 0x1F, (busdevfunc >> 8) & 0x7); } #endif scsi_low_level_init(busdevfunc); scsi_scan(1); }
static int spl_sata_load_image(struct spl_image_info *spl_image, struct spl_boot_device *bootdev) { int err; struct blk_desc *stor_dev; err = init_sata(CONFIG_SPL_SATA_BOOT_DEVICE); if (err) { #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT printf("spl: sata init failed: err - %d\n", err); #endif return err; } else { /* try to recognize storage devices immediately */ scsi_scan(0); stor_dev = blk_get_devnum_by_type(IF_TYPE_SCSI, 0); if (!stor_dev) return -ENODEV; } #ifdef CONFIG_SPL_OS_BOOT if (spl_start_uboot() || spl_load_image_fat_os(spl_image, stor_dev, CONFIG_SYS_SATA_FAT_BOOT_PARTITION)) #endif { err = spl_load_image_fat(spl_image, stor_dev, CONFIG_SYS_SATA_FAT_BOOT_PARTITION, CONFIG_SPL_FS_LOAD_PAYLOAD_NAME); } if (err) { puts("Error loading sata device\n"); return err; } return 0; }
/********************************************************************************* * scsi command intepreter */ int do_scsi (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { switch (argc) { case 0: case 1: return CMD_RET_USAGE; case 2: if (strncmp(argv[1],"res",3) == 0) { printf("\nReset SCSI\n"); scsi_bus_reset(); scsi_scan(1); return 0; } if (strncmp(argv[1],"inf",3) == 0) { int i; for (i=0; i<CONFIG_SYS_SCSI_MAX_DEVICE; ++i) { if(scsi_dev_desc[i].type==DEV_TYPE_UNKNOWN) continue; /* list only known devices */ printf ("SCSI dev. %d: ", i); dev_print(&scsi_dev_desc[i]); } return 0; } if (strncmp(argv[1],"dev",3) == 0) { if ((scsi_curr_dev < 0) || (scsi_curr_dev >= CONFIG_SYS_SCSI_MAX_DEVICE)) { printf("\nno SCSI devices available\n"); return 1; } printf ("\n Device %d: ", scsi_curr_dev); dev_print(&scsi_dev_desc[scsi_curr_dev]); return 0; } if (strncmp(argv[1],"scan",4) == 0) { scsi_scan(1); return 0; } if (strncmp(argv[1],"part",4) == 0) { int dev, ok; for (ok=0, dev=0; dev<CONFIG_SYS_SCSI_MAX_DEVICE; ++dev) { if (scsi_dev_desc[dev].type!=DEV_TYPE_UNKNOWN) { ok++; if (dev) printf("\n"); debug ("print_part of %x\n",dev); print_part(&scsi_dev_desc[dev]); } } if (!ok) printf("\nno SCSI devices available\n"); return 1; } return CMD_RET_USAGE; case 3: if (strncmp(argv[1],"dev",3) == 0) { int dev = (int)simple_strtoul(argv[2], NULL, 10); printf ("\nSCSI device %d: ", dev); if (dev >= CONFIG_SYS_SCSI_MAX_DEVICE) { printf("unknown device\n"); return 1; } printf ("\n Device %d: ", dev); dev_print(&scsi_dev_desc[dev]); if(scsi_dev_desc[dev].type == DEV_TYPE_UNKNOWN) { return 1; } scsi_curr_dev = dev; printf("... is now current device\n"); return 0; } if (strncmp(argv[1],"part",4) == 0) { int dev = (int)simple_strtoul(argv[2], NULL, 10); if(scsi_dev_desc[dev].type != DEV_TYPE_UNKNOWN) { print_part(&scsi_dev_desc[dev]); } else { printf ("\nSCSI device %d not available\n", dev); } return 1; } return CMD_RET_USAGE; default: /* at least 4 args */ if (strcmp(argv[1],"read") == 0) { ulong addr = simple_strtoul(argv[2], NULL, 16); ulong blk = simple_strtoul(argv[3], NULL, 16); ulong cnt = simple_strtoul(argv[4], NULL, 16); ulong n; printf ("\nSCSI read: device %d block # %ld, count %ld ... ", scsi_curr_dev, blk, cnt); n = scsi_read(scsi_curr_dev, blk, cnt, (ulong *)addr); printf ("%ld blocks read: %s\n",n,(n==cnt) ? "OK" : "ERROR"); return 0; } else if (strcmp(argv[1], "write") == 0) { ulong addr = simple_strtoul(argv[2], NULL, 16); ulong blk = simple_strtoul(argv[3], NULL, 16); ulong cnt = simple_strtoul(argv[4], NULL, 16); ulong n; printf("\nSCSI write: device %d block # %ld, " "count %ld ... ", scsi_curr_dev, blk, cnt); n = scsi_write(scsi_curr_dev, blk, cnt, (ulong *)addr); printf("%ld blocks written: %s\n", n, (n == cnt) ? "OK" : "ERROR"); return 0; } } /* switch */ return CMD_RET_USAGE; }
/* On OMAP platforms SATA provides the SCSI subsystem */ void scsi_init(void) { init_sata(0); scsi_scan(1); }