diff options
author | Tom Rini <trini@konsulko.com> | 2017-07-11 20:28:46 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2017-07-11 20:28:46 -0400 |
commit | 8d3a25685e4aac7070365a2b3c53c2c81b27930f (patch) | |
tree | 7956bf5e00e3490169a7fc41c42a4416da8db51f /include | |
parent | d43ef73bf26614af9b01fd57baa1a1fcf24bfade (diff) | |
parent | 8c9eaadaaad888e0cd77512553d0d02d476b4dde (diff) |
Merge git://git.denx.de/u-boot-dm
Diffstat (limited to 'include')
77 files changed, 331 insertions, 114 deletions
diff --git a/include/ahci.h b/include/ahci.h index 4876b41e901..818f34464e2 100644 --- a/include/ahci.h +++ b/include/ahci.h @@ -144,13 +144,25 @@ struct ahci_ioports { u32 rx_fis; }; -struct ahci_probe_ent { +/** + * struct ahci_uc_priv - information about an AHCI controller + * + * When driver model is used, this is accessible using dev_get_uclass_priv(dev) + * where dev is the controller (although at present it sometimes stands alone). + */ +struct ahci_uc_priv { #if defined(CONFIG_DM_PCI) || defined(CONFIG_DM_SCSI) + /* + * TODO(sjg@chromium.org): Drop this once this structure is only used + * in a driver-model context (i.e. attached to a device with + * dev_get_uclass_priv() + */ struct udevice *dev; #else pci_dev_t dev; #endif struct ahci_ioports port[AHCI_MAX_PORTS]; + u16 *ataid[AHCI_MAX_PORTS]; u32 n_ports; u32 hard_port_no; u32 host_flags; @@ -167,4 +179,47 @@ struct ahci_probe_ent { int ahci_init(void __iomem *base); int ahci_reset(void __iomem *base); +/** + * achi_init_one_dm() - set up a single AHCI port + * + * @dev: Controller to init + */ +int achi_init_one_dm(struct udevice *dev); + +/** + * achi_start_ports_dm() - start all AHCI ports for a controller + * + * @dev: Controller containing ports to start + */ +int achi_start_ports_dm(struct udevice *dev); + +/** + * ahci_init_dm() - init AHCI for a controller, finding all ports + * + * @dev: Device to init + */ +int ahci_init_dm(struct udevice *dev, void __iomem *base); + +/** + * ahci_bind_scsi() - bind a new SCSI bus as a child + * + * Note that the SCSI bus device will itself bind block devices + * + * @ahci_dev: AHCI parent device + * @devp: Returns new SCSI bus device + * @return 0 if OK, -ve on error + */ +int ahci_bind_scsi(struct udevice *ahci_dev, struct udevice **devp); + +/** + * ahci_probe_scsi() - probe and scan the attached SCSI bus + * + * Note that the SCSI device will itself bind block devices for any storage + * devices it finds. + * + * @ahci_dev: AHCI parent device + * @return 0 if OK, -ve on error + */ +int ahci_probe_scsi(struct udevice *ahci_dev); + #endif diff --git a/include/config_cmd_all.h b/include/config_cmd_all.h index b1f41abf4f2..2874a7850da 100644 --- a/include/config_cmd_all.h +++ b/include/config_cmd_all.h @@ -25,7 +25,6 @@ #define CONFIG_CMD_READ /* Read data from partition */ #define CONFIG_CMD_SANDBOX /* sb command to access sandbox features */ #define CONFIG_CMD_SAVES /* save S record dump */ -#define CONFIG_SCSI /* SCSI Support */ #define CONFIG_CMD_SDRAM /* SDRAM DIMM SPD info printout */ #define CONFIG_CMD_TERMINAL /* built-in Serial Terminal */ #define CONFIG_CMD_UBIFS /* UBIFS Support */ diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h index 4b2c493ae30..d8dab8e46a4 100644 --- a/include/config_distro_bootcmd.h +++ b/include/config_distro_bootcmd.h @@ -149,16 +149,16 @@ #define SCAN_DEV_FOR_EFI #endif -#ifdef CONFIG_CMD_SATA +#ifdef CONFIG_SATA #define BOOTENV_SHARED_SATA BOOTENV_SHARED_BLKDEV(sata) #define BOOTENV_DEV_SATA BOOTENV_DEV_BLKDEV #define BOOTENV_DEV_NAME_SATA BOOTENV_DEV_NAME_BLKDEV #else #define BOOTENV_SHARED_SATA #define BOOTENV_DEV_SATA \ - BOOT_TARGET_DEVICES_references_SATA_without_CONFIG_CMD_SATA + BOOT_TARGET_DEVICES_references_SATA_without_CONFIG_SATA #define BOOTENV_DEV_NAME_SATA \ - BOOT_TARGET_DEVICES_references_SATA_without_CONFIG_CMD_SATA + BOOT_TARGET_DEVICES_references_SATA_without_CONFIG_SATA #endif #ifdef CONFIG_SCSI diff --git a/include/config_fallbacks.h b/include/config_fallbacks.h index 2656c75b300..d1411f05508 100644 --- a/include/config_fallbacks.h +++ b/include/config_fallbacks.h @@ -48,7 +48,7 @@ /* Rather than repeat this expression each time, add a define for it */ #if defined(CONFIG_IDE) || \ - defined(CONFIG_CMD_SATA) || \ + defined(CONFIG_SATA) || \ defined(CONFIG_SCSI) || \ defined(CONFIG_CMD_USB) || \ defined(CONFIG_CMD_PART) || \ diff --git a/include/configs/MPC8315ERDB.h b/include/configs/MPC8315ERDB.h index fbe033afb13..522f12ceeca 100644 --- a/include/configs/MPC8315ERDB.h +++ b/include/configs/MPC8315ERDB.h @@ -415,7 +415,6 @@ #ifdef CONFIG_FSL_SATA #define CONFIG_LBA48 -#define CONFIG_CMD_SATA #endif /* diff --git a/include/configs/MPC8349ITX.h b/include/configs/MPC8349ITX.h index 46f09d6b60f..53e089a82a1 100644 --- a/include/configs/MPC8349ITX.h +++ b/include/configs/MPC8349ITX.h @@ -485,10 +485,6 @@ boards, we say we have two, but don't display a message if we find only one. */ #define CONFIG_SUPPORT_VFAT #endif -#ifdef CONFIG_SATA_SIL3114 - #define CONFIG_CMD_SATA -#endif - #if defined(CONFIG_SATA_SIL3114) || defined(CONFIG_USB_STORAGE) #endif diff --git a/include/configs/MPC837XEMDS.h b/include/configs/MPC837XEMDS.h index fcced0eb86c..459efb560c2 100644 --- a/include/configs/MPC837XEMDS.h +++ b/include/configs/MPC837XEMDS.h @@ -436,7 +436,6 @@ extern int board_pci_host_broken(void); #ifdef CONFIG_FSL_SATA #define CONFIG_LBA48 -#define CONFIG_CMD_SATA #endif /* diff --git a/include/configs/MPC837XERDB.h b/include/configs/MPC837XERDB.h index 607b9266d2f..7afbc9096f5 100644 --- a/include/configs/MPC837XERDB.h +++ b/include/configs/MPC837XERDB.h @@ -449,7 +449,6 @@ #ifdef CONFIG_FSL_SATA #define CONFIG_LBA48 -#define CONFIG_CMD_SATA #endif /* diff --git a/include/configs/MPC8536DS.h b/include/configs/MPC8536DS.h index 18b6b4e13e6..470bb72fcb2 100644 --- a/include/configs/MPC8536DS.h +++ b/include/configs/MPC8536DS.h @@ -522,7 +522,6 @@ #ifdef CONFIG_FSL_SATA #define CONFIG_LBA48 -#define CONFIG_CMD_SATA #endif #if defined(CONFIG_TSEC_ENET) diff --git a/include/configs/MPC8544DS.h b/include/configs/MPC8544DS.h index 3b62449ea5f..ffa8796407c 100644 --- a/include/configs/MPC8544DS.h +++ b/include/configs/MPC8544DS.h @@ -352,7 +352,6 @@ extern unsigned long get_board_sys_clk(unsigned long dummy); #if defined(CONFIG_PCI) #define CONFIG_CMD_PCI - #define CONFIG_SCSI #endif /* diff --git a/include/configs/MPC8572DS.h b/include/configs/MPC8572DS.h index 79e11bb6f8c..d8e0dfd8070 100644 --- a/include/configs/MPC8572DS.h +++ b/include/configs/MPC8572DS.h @@ -551,7 +551,6 @@ #if defined(CONFIG_PCI) #define CONFIG_CMD_PCI -#define CONFIG_SCSI #endif /* diff --git a/include/configs/MPC8610HPCD.h b/include/configs/MPC8610HPCD.h index 2014450be83..1db3a633ef3 100644 --- a/include/configs/MPC8610HPCD.h +++ b/include/configs/MPC8610HPCD.h @@ -430,7 +430,6 @@ #if defined(CONFIG_PCI) #define CONFIG_CMD_PCI -#define CONFIG_SCSI #endif #define CONFIG_WATCHDOG /* watchdog enabled */ diff --git a/include/configs/MPC8641HPCN.h b/include/configs/MPC8641HPCN.h index 7ec36eb6081..e87b11180a4 100644 --- a/include/configs/MPC8641HPCN.h +++ b/include/configs/MPC8641HPCN.h @@ -591,7 +591,6 @@ extern unsigned long get_board_sys_clk(unsigned long dummy); #if defined(CONFIG_PCI) #define CONFIG_CMD_PCI - #define CONFIG_SCSI #endif #undef CONFIG_WATCHDOG /* watchdog disabled */ diff --git a/include/configs/P1010RDB.h b/include/configs/P1010RDB.h index 220b07040e5..0dc062a0944 100644 --- a/include/configs/P1010RDB.h +++ b/include/configs/P1010RDB.h @@ -657,7 +657,6 @@ extern unsigned long get_sdram_size(void); #define CONFIG_SYS_SATA2 CONFIG_SYS_MPC85xx_SATA2_ADDR #define CONFIG_SYS_SATA2_FLAGS FLAGS_DMA -#define CONFIG_CMD_SATA #define CONFIG_LBA48 #endif /* #ifdef CONFIG_FSL_SATA */ diff --git a/include/configs/P1022DS.h b/include/configs/P1022DS.h index 3d12c84ce98..2ee6c6442f7 100644 --- a/include/configs/P1022DS.h +++ b/include/configs/P1022DS.h @@ -497,7 +497,6 @@ #ifdef CONFIG_FSL_SATA #define CONFIG_LBA48 -#define CONFIG_CMD_SATA #endif #ifdef CONFIG_MMC diff --git a/include/configs/P2041RDB.h b/include/configs/P2041RDB.h index b008e3d9e28..967c83c53ba 100644 --- a/include/configs/P2041RDB.h +++ b/include/configs/P2041RDB.h @@ -548,7 +548,6 @@ unsigned long get_board_sys_clk(unsigned long dummy); #define CONFIG_SYS_SATA2_FLAGS FLAGS_DMA #define CONFIG_LBA48 -#define CONFIG_CMD_SATA #endif #ifdef CONFIG_FMAN_ENET diff --git a/include/configs/P4080DS.h b/include/configs/P4080DS.h index a6fa6a8e264..f192181c084 100644 --- a/include/configs/P4080DS.h +++ b/include/configs/P4080DS.h @@ -12,7 +12,6 @@ #define CONFIG_PCIE3 -#define CONFIG_CMD_SATA #define CONFIG_SATA_SIL #define CONFIG_SYS_SATA_MAX_DEVICE 2 #define CONFIG_LIBATA diff --git a/include/configs/T102xQDS.h b/include/configs/T102xQDS.h index 2209cfdb96c..2e3a8c1184c 100644 --- a/include/configs/T102xQDS.h +++ b/include/configs/T102xQDS.h @@ -628,7 +628,6 @@ unsigned long get_board_ddr_clk(void); #define CONFIG_SYS_SATA1 CONFIG_SYS_MPC85xx_SATA1_ADDR #define CONFIG_SYS_SATA1_FLAGS FLAGS_DMA #define CONFIG_LBA48 -#define CONFIG_CMD_SATA #endif /* diff --git a/include/configs/T1040QDS.h b/include/configs/T1040QDS.h index 3953145030f..86f7880ff18 100644 --- a/include/configs/T1040QDS.h +++ b/include/configs/T1040QDS.h @@ -518,7 +518,6 @@ unsigned long get_board_ddr_clk(void); #define CONFIG_SYS_SATA2_FLAGS FLAGS_DMA #define CONFIG_LBA48 -#define CONFIG_CMD_SATA #endif /* diff --git a/include/configs/T104xRDB.h b/include/configs/T104xRDB.h index 0035e67544b..350dacaa388 100644 --- a/include/configs/T104xRDB.h +++ b/include/configs/T104xRDB.h @@ -628,7 +628,6 @@ $(SRCTREE)/board/freescale/t104xrdb/t1042d4_sd_rcw.cfg #define CONFIG_SYS_SATA1_FLAGS FLAGS_DMA #define CONFIG_LBA48 -#define CONFIG_CMD_SATA #endif /* diff --git a/include/configs/T208xQDS.h b/include/configs/T208xQDS.h index e792ec5c9dd..9edf19081c5 100644 --- a/include/configs/T208xQDS.h +++ b/include/configs/T208xQDS.h @@ -695,7 +695,6 @@ unsigned long get_board_ddr_clk(void); #define CONFIG_SYS_SATA2 CONFIG_SYS_MPC85xx_SATA2_ADDR #define CONFIG_SYS_SATA2_FLAGS FLAGS_DMA #define CONFIG_LBA48 -#define CONFIG_CMD_SATA #endif /* diff --git a/include/configs/T208xRDB.h b/include/configs/T208xRDB.h index fdafeeb38f8..0e70aa83ea6 100644 --- a/include/configs/T208xRDB.h +++ b/include/configs/T208xRDB.h @@ -645,7 +645,6 @@ unsigned long get_board_ddr_clk(void); #define CONFIG_SYS_SATA2 CONFIG_SYS_MPC85xx_SATA2_ADDR #define CONFIG_SYS_SATA2_FLAGS FLAGS_DMA #define CONFIG_LBA48 -#define CONFIG_CMD_SATA #endif /* diff --git a/include/configs/T4240QDS.h b/include/configs/T4240QDS.h index dc3ebfa7fab..f69746b4da8 100644 --- a/include/configs/T4240QDS.h +++ b/include/configs/T4240QDS.h @@ -489,7 +489,6 @@ unsigned long get_board_ddr_clk(void); #define CONFIG_SYS_SATA2_FLAGS FLAGS_DMA #define CONFIG_LBA48 -#define CONFIG_CMD_SATA #endif #ifdef CONFIG_FMAN_ENET diff --git a/include/configs/T4240RDB.h b/include/configs/T4240RDB.h index 0d9cdfb510e..ed3b0f7202f 100644 --- a/include/configs/T4240RDB.h +++ b/include/configs/T4240RDB.h @@ -254,7 +254,6 @@ #define CONFIG_SYS_SATA2_FLAGS FLAGS_DMA #define CONFIG_LBA48 -#define CONFIG_CMD_SATA #endif #ifdef CONFIG_FMAN_ENET @@ -671,7 +670,6 @@ unsigned long get_board_ddr_clk(void); #define CONFIG_SYS_SATA2_FLAGS FLAGS_DMA #define CONFIG_LBA48 -#define CONFIG_CMD_SATA #endif #ifdef CONFIG_FMAN_ENET diff --git a/include/configs/UCP1020.h b/include/configs/UCP1020.h index 8579290e81d..9a7aa811963 100644 --- a/include/configs/UCP1020.h +++ b/include/configs/UCP1020.h @@ -118,7 +118,6 @@ #define CONFIG_ENV_OVERWRITE -#define CONFIG_CMD_SATA #define CONFIG_SATA_SIL #define CONFIG_SYS_SATA_MAX_DEVICE 2 #define CONFIG_LIBATA diff --git a/include/configs/advantech_dms-ba16.h b/include/configs/advantech_dms-ba16.h index f320792cfd4..66ee167f96b 100644 --- a/include/configs/advantech_dms-ba16.h +++ b/include/configs/advantech_dms-ba16.h @@ -39,7 +39,6 @@ #define CONFIG_MXC_OCOTP /* SATA Configs */ -#define CONFIG_CMD_SATA #define CONFIG_DWC_AHSATA #define CONFIG_SYS_SATA_MAX_DEVICE 1 #define CONFIG_DWC_AHSATA_PORT_ID 0 diff --git a/include/configs/am57xx_evm.h b/include/configs/am57xx_evm.h index 7a42d79647f..98ce6c52daf 100644 --- a/include/configs/am57xx_evm.h +++ b/include/configs/am57xx_evm.h @@ -99,7 +99,6 @@ #define CONFIG_OMAP_USB3PHY1_HOST /* SATA */ -#define CONFIG_SCSI #define CONFIG_LIBATA #define CONFIG_SCSI_AHCI #define CONFIG_SCSI_AHCI_PLAT diff --git a/include/configs/apalis_imx6.h b/include/configs/apalis_imx6.h index 8be586b51f8..b4006a37e0f 100644 --- a/include/configs/apalis_imx6.h +++ b/include/configs/apalis_imx6.h @@ -67,10 +67,6 @@ #define CONFIG_SUPPORT_EMMC_BOOT /* eMMC specific */ #define CONFIG_BOUNCE_BUFFER -#ifdef CONFIG_MX6Q -#define CONFIG_CMD_SATA -#endif - /* * SATA Configs */ diff --git a/include/configs/cgtqmx6eval.h b/include/configs/cgtqmx6eval.h index cad1357f5cf..5d797b4403b 100644 --- a/include/configs/cgtqmx6eval.h +++ b/include/configs/cgtqmx6eval.h @@ -95,7 +95,6 @@ #define CONFIG_IMX_HDMI /* SATA */ -#define CONFIG_CMD_SATA #define CONFIG_DWC_AHSATA #define CONFIG_SYS_SATA_MAX_DEVICE 1 #define CONFIG_DWC_AHSATA_PORT_ID 0 diff --git a/include/configs/cm_fx6.h b/include/configs/cm_fx6.h index dd8010cd485..1d9c1650d55 100644 --- a/include/configs/cm_fx6.h +++ b/include/configs/cm_fx6.h @@ -224,7 +224,6 @@ #define CONFIG_SYS_I2C_EEPROM_BUS 2 /* SATA */ -#define CONFIG_CMD_SATA #define CONFIG_SYS_SATA_MAX_DEVICE 1 #define CONFIG_LIBATA #define CONFIG_LBA48 diff --git a/include/configs/cm_t54.h b/include/configs/cm_t54.h index 14042ada7d0..36475734fcc 100644 --- a/include/configs/cm_t54.h +++ b/include/configs/cm_t54.h @@ -49,7 +49,6 @@ #define CONFIG_SPL_SATA_BOOT_DEVICE 0 #define CONFIG_SYS_SATA_FAT_BOOT_PARTITION 1 -#define CONFIG_SCSI #define CONFIG_LIBATA #define CONFIG_SCSI_AHCI #define CONFIG_SCSI_AHCI_PLAT diff --git a/include/configs/controlcenterd.h b/include/configs/controlcenterd.h index 6641408fcbb..072650dfaec 100644 --- a/include/configs/controlcenterd.h +++ b/include/configs/controlcenterd.h @@ -248,7 +248,6 @@ */ #define CONFIG_LIBATA #define CONFIG_LBA48 -#define CONFIG_CMD_SATA #define CONFIG_FSL_SATA #define CONFIG_SYS_SATA_MAX_DEVICE 2 diff --git a/include/configs/controlcenterdc.h b/include/configs/controlcenterdc.h index a04af31284e..f10cddafe0f 100644 --- a/include/configs/controlcenterdc.h +++ b/include/configs/controlcenterdc.h @@ -51,7 +51,6 @@ * SATA/SCSI/AHCI configuration */ #define CONFIG_LIBATA -#define CONFIG_SCSI #define CONFIG_SCSI_AHCI #define CONFIG_SCSI_AHCI_PLAT #define CONFIG_SYS_SCSI_MAX_SCSI_ID 2 diff --git a/include/configs/corenet_ds.h b/include/configs/corenet_ds.h index 7bbe31ceea0..92e6ee0033d 100644 --- a/include/configs/corenet_ds.h +++ b/include/configs/corenet_ds.h @@ -562,7 +562,6 @@ #define CONFIG_SYS_SATA2_FLAGS FLAGS_DMA #define CONFIG_LBA48 -#define CONFIG_CMD_SATA #endif #ifdef CONFIG_FMAN_ENET diff --git a/include/configs/cyrus.h b/include/configs/cyrus.h index a23da191ab2..6079540bc95 100644 --- a/include/configs/cyrus.h +++ b/include/configs/cyrus.h @@ -392,7 +392,6 @@ #define CONFIG_SYS_SATA2_FLAGS FLAGS_DMA #define CONFIG_LBA48 -#define CONFIG_CMD_SATA #endif #ifdef CONFIG_FMAN_ENET diff --git a/include/configs/db-88f6820-gp.h b/include/configs/db-88f6820-gp.h index 0890a4db622..292bfb8f7df 100644 --- a/include/configs/db-88f6820-gp.h +++ b/include/configs/db-88f6820-gp.h @@ -25,7 +25,6 @@ * Commands configuration */ #define CONFIG_CMD_PCI -#define CONFIG_SCSI /* I2C */ #define CONFIG_SYS_I2C diff --git a/include/configs/db-mv784mp-gp.h b/include/configs/db-mv784mp-gp.h index 821aa9dec14..187ead3e4b7 100644 --- a/include/configs/db-mv784mp-gp.h +++ b/include/configs/db-mv784mp-gp.h @@ -27,7 +27,6 @@ */ #define CONFIG_CMD_NAND #define CONFIG_CMD_PCI -#define CONFIG_CMD_SATA /* I2C */ #define CONFIG_SYS_I2C diff --git a/include/configs/dra7xx_evm.h b/include/configs/dra7xx_evm.h index d6c4a71ab20..d2f7c7cfff8 100644 --- a/include/configs/dra7xx_evm.h +++ b/include/configs/dra7xx_evm.h @@ -162,7 +162,6 @@ #define CONFIG_OMAP_USB2PHY2_HOST /* SATA */ -#define CONFIG_SCSI #define CONFIG_LIBATA #define CONFIG_SCSI_AHCI #define CONFIG_SCSI_AHCI_PLAT diff --git a/include/configs/efi-x86.h b/include/configs/efi-x86.h index 5626061e2ee..9dcb4817077 100644 --- a/include/configs/efi-x86.h +++ b/include/configs/efi-x86.h @@ -16,7 +16,6 @@ #undef CONFIG_ENV_IS_IN_SPI_FLASH #define CONFIG_ENV_IS_NOWHERE #undef CONFIG_SCSI_AHCI -#undef CONFIG_SCSI #undef CONFIG_INTEL_ICH6_GPIO #undef CONFIG_USB_EHCI_PCI diff --git a/include/configs/galileo.h b/include/configs/galileo.h index dcbaade54e1..00c5434125c 100644 --- a/include/configs/galileo.h +++ b/include/configs/galileo.h @@ -24,7 +24,6 @@ /* SATA is not supported in Quark SoC */ #undef CONFIG_SCSI_AHCI -#undef CONFIG_SCSI /* 10/100M Ethernet support */ #define CONFIG_DESIGNWARE_ETH diff --git a/include/configs/gw_ventana.h b/include/configs/gw_ventana.h index 2227eead62b..de08f2c7ccf 100644 --- a/include/configs/gw_ventana.h +++ b/include/configs/gw_ventana.h @@ -109,7 +109,6 @@ /* * SATA Configs */ -#define CONFIG_CMD_SATA #ifdef CONFIG_CMD_SATA #define CONFIG_DWC_AHSATA #define CONFIG_SYS_SATA_MAX_DEVICE 1 diff --git a/include/configs/highbank.h b/include/configs/highbank.h index e15b572e411..533d3e3f826 100644 --- a/include/configs/highbank.h +++ b/include/configs/highbank.h @@ -46,7 +46,6 @@ /* * Command line configuration. */ -#define CONFIG_SCSI #define CONFIG_BOOT_RETRY_TIME -1 #define CONFIG_RESET_TO_RETRY diff --git a/include/configs/ls1012aqds.h b/include/configs/ls1012aqds.h index 5b8500b91ba..9e6c7a797cb 100644 --- a/include/configs/ls1012aqds.h +++ b/include/configs/ls1012aqds.h @@ -135,7 +135,6 @@ /* SATA */ #define CONFIG_LIBATA -#define CONFIG_SCSI #define CONFIG_SCSI_AHCI #define CONFIG_SCSI_AHCI_PLAT #define CONFIG_CMD_SCSI diff --git a/include/configs/ls1012ardb.h b/include/configs/ls1012ardb.h index 276fe1050cf..0705bc5f684 100644 --- a/include/configs/ls1012ardb.h +++ b/include/configs/ls1012ardb.h @@ -51,7 +51,6 @@ /* SATA */ #define CONFIG_LIBATA -#define CONFIG_SCSI #define CONFIG_SCSI_AHCI #define CONFIG_SCSI_AHCI_PLAT #define CONFIG_CMD_SCSI diff --git a/include/configs/ls1043aqds.h b/include/configs/ls1043aqds.h index 04d74acdeb0..87ca36a8e9d 100644 --- a/include/configs/ls1043aqds.h +++ b/include/configs/ls1043aqds.h @@ -98,7 +98,6 @@ unsigned long get_board_ddr_clk(void); #define CONFIG_LIBATA #define CONFIG_SCSI_AHCI #define CONFIG_SCSI_AHCI_PLAT -#define CONFIG_SCSI /* EEPROM */ #define CONFIG_ID_EEPROM diff --git a/include/configs/ls1046aqds.h b/include/configs/ls1046aqds.h index 5d2e819e786..77619ab3241 100644 --- a/include/configs/ls1046aqds.h +++ b/include/configs/ls1046aqds.h @@ -153,7 +153,6 @@ unsigned long get_board_ddr_clk(void); #define CONFIG_LIBATA #define CONFIG_SCSI_AHCI #define CONFIG_SCSI_AHCI_PLAT -#define CONFIG_SCSI /* EEPROM */ #define CONFIG_ID_EEPROM diff --git a/include/configs/ls1046ardb.h b/include/configs/ls1046ardb.h index 6f649a62232..8a6b4e63786 100644 --- a/include/configs/ls1046ardb.h +++ b/include/configs/ls1046ardb.h @@ -233,7 +233,6 @@ #define CONFIG_LIBATA #define CONFIG_SCSI_AHCI #define CONFIG_SCSI_AHCI_PLAT -#define CONFIG_SCSI #define CONFIG_SYS_SATA AHCI_BASE_ADDR diff --git a/include/configs/ls2080aqds.h b/include/configs/ls2080aqds.h index 8a8ee9d351f..5e1867d81ef 100644 --- a/include/configs/ls2080aqds.h +++ b/include/configs/ls2080aqds.h @@ -50,7 +50,6 @@ unsigned long get_board_ddr_clk(void); #define CONFIG_LIBATA #define CONFIG_SCSI_AHCI #define CONFIG_SCSI_AHCI_PLAT -#define CONFIG_SCSI #define CONFIG_SYS_SATA1 AHCI_BASE_ADDR1 #define CONFIG_SYS_SATA2 AHCI_BASE_ADDR2 diff --git a/include/configs/ls2080ardb.h b/include/configs/ls2080ardb.h index 2dab065be1a..e8aacd3dcd2 100644 --- a/include/configs/ls2080ardb.h +++ b/include/configs/ls2080ardb.h @@ -68,7 +68,6 @@ unsigned long get_board_sys_clk(void); #define CONFIG_LIBATA #define CONFIG_SCSI_AHCI #define CONFIG_SCSI_AHCI_PLAT -#define CONFIG_SCSI #define CONFIG_SYS_SATA1 AHCI_BASE_ADDR1 #define CONFIG_SYS_SATA2 AHCI_BASE_ADDR2 diff --git a/include/configs/m53evk.h b/include/configs/m53evk.h index 51812257e19..a92c2283348 100644 --- a/include/configs/m53evk.h +++ b/include/configs/m53evk.h @@ -22,7 +22,6 @@ */ #define CONFIG_CMD_NAND #define CONFIG_CMD_NAND_TRIMFFS -#define CONFIG_CMD_SATA /* * Memory configurations diff --git a/include/configs/mvebu_armada-37xx.h b/include/configs/mvebu_armada-37xx.h index 5408490dc6c..eb80ac5b48e 100644 --- a/include/configs/mvebu_armada-37xx.h +++ b/include/configs/mvebu_armada-37xx.h @@ -113,7 +113,6 @@ /* * SATA/SCSI/AHCI configuration */ -#define CONFIG_SCSI #define CONFIG_SCSI_AHCI #define CONFIG_SCSI_AHCI_PLAT #define CONFIG_LIBATA diff --git a/include/configs/mvebu_armada-8k.h b/include/configs/mvebu_armada-8k.h index 9d3aeefcd0b..ac116edf31a 100644 --- a/include/configs/mvebu_armada-8k.h +++ b/include/configs/mvebu_armada-8k.h @@ -119,7 +119,6 @@ /* * SATA/SCSI/AHCI configuration */ -#define CONFIG_SCSI #define CONFIG_SCSI_AHCI #define CONFIG_SCSI_AHCI_PLAT #define CONFIG_LIBATA diff --git a/include/configs/mx53loco.h b/include/configs/mx53loco.h index 1b6d868d044..c82e426a61c 100644 --- a/include/configs/mx53loco.h +++ b/include/configs/mx53loco.h @@ -189,7 +189,6 @@ #define CONFIG_ENV_IS_IN_MMC #define CONFIG_SYS_MMC_ENV_DEV 0 -#define CONFIG_CMD_SATA #ifdef CONFIG_CMD_SATA #define CONFIG_DWC_AHSATA #define CONFIG_SYS_SATA_MAX_DEVICE 1 diff --git a/include/configs/nitrogen6x.h b/include/configs/nitrogen6x.h index 00b84f757a4..576b7b07db6 100644 --- a/include/configs/nitrogen6x.h +++ b/include/configs/nitrogen6x.h @@ -47,10 +47,6 @@ #define CONFIG_SYS_FSL_ESDHC_ADDR 0 #define CONFIG_SYS_FSL_USDHC_NUM 2 -#ifdef CONFIG_MX6Q -#define CONFIG_CMD_SATA -#endif - /* * SATA Configs */ diff --git a/include/configs/novena.h b/include/configs/novena.h index 1f1bf15af7b..041159806b8 100644 --- a/include/configs/novena.h +++ b/include/configs/novena.h @@ -18,7 +18,6 @@ /* U-Boot Commands */ #define CONFIG_CMD_PCI -#define CONFIG_CMD_SATA /* U-Boot general configurations */ diff --git a/include/configs/omap5_uevm.h b/include/configs/omap5_uevm.h index e7fac6d1e1e..15d06bbe458 100644 --- a/include/configs/omap5_uevm.h +++ b/include/configs/omap5_uevm.h @@ -66,7 +66,6 @@ #define CONSOLEDEV "ttyO2" -#define CONFIG_SCSI #define CONFIG_LIBATA #define CONFIG_SCSI_AHCI #define CONFIG_SCSI_AHCI_PLAT diff --git a/include/configs/ot1200.h b/include/configs/ot1200.h index 0582fa36883..7aeae7b1fdc 100644 --- a/include/configs/ot1200.h +++ b/include/configs/ot1200.h @@ -57,10 +57,6 @@ #define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW) #define CONFIG_USB_MAX_CONTROLLER_COUNT 2 -#ifdef CONFIG_MX6Q -#define CONFIG_CMD_SATA -#endif - /* * SATA Configs */ diff --git a/include/configs/p1_p2_rdb_pc.h b/include/configs/p1_p2_rdb_pc.h index 71b4f40921f..a72a57c9046 100644 --- a/include/configs/p1_p2_rdb_pc.h +++ b/include/configs/p1_p2_rdb_pc.h @@ -270,7 +270,6 @@ #define CONFIG_TSEC_ENET /* tsec ethernet support */ #define CONFIG_ENV_OVERWRITE -#define CONFIG_CMD_SATA #define CONFIG_SATA_SIL #define CONFIG_SYS_SATA_MAX_DEVICE 2 #define CONFIG_LIBATA diff --git a/include/configs/p1_twr.h b/include/configs/p1_twr.h index fd644f22da1..dffb15aea91 100644 --- a/include/configs/p1_twr.h +++ b/include/configs/p1_twr.h @@ -50,7 +50,6 @@ #define CONFIG_TSEC_ENET /* tsec ethernet support */ #define CONFIG_ENV_OVERWRITE -#define CONFIG_CMD_SATA #define CONFIG_SATA_SIL3114 #define CONFIG_SYS_SATA_MAX_DEVICE 2 #define CONFIG_LIBATA diff --git a/include/configs/qemu-x86.h b/include/configs/qemu-x86.h index 3509c2f6595..05eb5ebf912 100644 --- a/include/configs/qemu-x86.h +++ b/include/configs/qemu-x86.h @@ -39,7 +39,6 @@ #define CONFIG_ATAPI #undef CONFIG_SCSI_AHCI -#undef CONFIG_SCSI #else #define CONFIG_SCSI_DEV_LIST \ {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_AHCI} diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h index 31ceb5402f7..1e8404cbdf2 100644 --- a/include/configs/sandbox.h +++ b/include/configs/sandbox.h @@ -41,6 +41,7 @@ #define CONFIG_SYS_LONGHELP /* #undef to save memory */ #define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buffer Size */ +#define CONFIG_DISPLAY_BOARDINFO_LATE /* Print Buffer Size */ #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16) @@ -157,13 +158,11 @@ #define CONFIG_SYS_ATA_STRIDE 4 #endif -#define CONFIG_SCSI #define CONFIG_SCSI_AHCI_PLAT #define CONFIG_SYS_SCSI_MAX_DEVICE 2 #define CONFIG_SYS_SCSI_MAX_SCSI_ID 8 #define CONFIG_SYS_SCSI_MAX_LUN 4 -#define CONFIG_CMD_SATA #define CONFIG_SYS_SATA_MAX_DEVICE 2 #define CONFIG_SYSTEMACE diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h index 9b514ff37ac..fefd58f7697 100644 --- a/include/configs/sunxi-common.h +++ b/include/configs/sunxi-common.h @@ -122,7 +122,6 @@ #define CONFIG_SYS_SCSI_MAX_LUN 1 #define CONFIG_SYS_SCSI_MAX_DEVICE (CONFIG_SYS_SCSI_MAX_SCSI_ID * \ CONFIG_SYS_SCSI_MAX_LUN) -#define CONFIG_SCSI #endif #define CONFIG_SETUP_MEMORY_TAGS diff --git a/include/configs/t4qds.h b/include/configs/t4qds.h index 260cdee0011..6d8c78f76b0 100644 --- a/include/configs/t4qds.h +++ b/include/configs/t4qds.h @@ -223,7 +223,6 @@ #define CONFIG_SYS_SATA2_FLAGS FLAGS_DMA #define CONFIG_LBA48 -#define CONFIG_CMD_SATA #endif #ifdef CONFIG_FMAN_ENET diff --git a/include/configs/tbs2910.h b/include/configs/tbs2910.h index 84ca1c443e4..79f6b162f7f 100644 --- a/include/configs/tbs2910.h +++ b/include/configs/tbs2910.h @@ -80,7 +80,6 @@ #endif /* SATA */ -#define CONFIG_CMD_SATA #ifdef CONFIG_CMD_SATA #define CONFIG_DWC_AHSATA #define CONFIG_SYS_SATA_MAX_DEVICE 1 diff --git a/include/configs/theadorable.h b/include/configs/theadorable.h index 27cae9d5283..94e207c8c4b 100644 --- a/include/configs/theadorable.h +++ b/include/configs/theadorable.h @@ -23,7 +23,6 @@ /* * Commands configuration */ -#define CONFIG_CMD_SATA /* * The debugging version enables USB support via defconfig. diff --git a/include/configs/udoo.h b/include/configs/udoo.h index d84aa1679eb..aef4563eded 100644 --- a/include/configs/udoo.h +++ b/include/configs/udoo.h @@ -24,7 +24,6 @@ /* SATA Configs */ -#define CONFIG_CMD_SATA #ifdef CONFIG_CMD_SATA #define CONFIG_DWC_AHSATA #define CONFIG_SYS_SATA_MAX_DEVICE 1 diff --git a/include/configs/wandboard.h b/include/configs/wandboard.h index 2a6c6fbb703..afc5edf33b4 100644 --- a/include/configs/wandboard.h +++ b/include/configs/wandboard.h @@ -24,7 +24,6 @@ /* SATA Configs */ -#define CONFIG_CMD_SATA #ifdef CONFIG_CMD_SATA #define CONFIG_DWC_AHSATA #define CONFIG_SYS_SATA_MAX_DEVICE 1 diff --git a/include/configs/x86-common.h b/include/configs/x86-common.h index a5ed85236e8..d104449e3b0 100644 --- a/include/configs/x86-common.h +++ b/include/configs/x86-common.h @@ -71,7 +71,6 @@ * Command line configuration. */ #define CONFIG_CMD_PCI -#define CONFIG_SCSI #define CONFIG_CMD_ZBOOT diff --git a/include/configs/xilinx_zynqmp.h b/include/configs/xilinx_zynqmp.h index 86a4579fbdb..c7fcd86dd5c 100644 --- a/include/configs/xilinx_zynqmp.h +++ b/include/configs/xilinx_zynqmp.h @@ -190,7 +190,6 @@ #define CONFIG_SYS_SCSI_MAX_LUN 1 #define CONFIG_SYS_SCSI_MAX_DEVICE (CONFIG_SYS_SCSI_MAX_SCSI_ID * \ CONFIG_SYS_SCSI_MAX_LUN) -#define CONFIG_SCSI #endif #define CONFIG_SYS_BOOTM_LEN (60 * 1024 * 1024) diff --git a/include/console.h b/include/console.h index 3d37f6a53bf..cea29ed6dc4 100644 --- a/include/console.h +++ b/include/console.h @@ -42,6 +42,18 @@ void console_record_reset(void); */ void console_record_reset_enable(void); +/** + * console_announce_r() - print a U-Boot console on non-serial consoles + * + * When U-Boot starts up with a display it generally does not announce itself + * on the display. The banner is instead emitted on the UART before relocation. + * This function prints a banner on devices which (we assume) did not receive + * it before relocation. + * + * @return 0 (meaning no errors) + */ +int console_announce_r(void); + /* * CONSOLE multiplexing. */ diff --git a/include/display_options.h b/include/display_options.h index ac44c459b3b..d9c8f6dbd4a 100644 --- a/include/display_options.h +++ b/include/display_options.h @@ -56,4 +56,23 @@ int print_buffer(ulong addr, const void *data, uint width, uint count, */ int display_options(void); +/* Suggested length of the buffer to pass to display_options_get_banner() */ +#define DISPLAY_OPTIONS_BANNER_LENGTH 200 + +/** + * display_options_get_banner() - Get the U-Boot banner as a string + * + * This returns the U-Boot banner string + * + * @newlines: true to include two newlines at the start + * @buf: place to put string + * @size: Size of buf (string is truncated to fit) + * @return buf + */ +char *display_options_get_banner(bool newlines, char *buf, int size); + +/* This function is used for testing only */ +char *display_options_get_banner_priv(bool newlines, const char *build_tag, + char *buf, int size); + #endif diff --git a/include/dm/of_access.h b/include/dm/of_access.h index 142f0f43c93..c5ea391aec1 100644 --- a/include/dm/of_access.h +++ b/include/dm/of_access.h @@ -61,6 +61,26 @@ int of_n_addr_cells(const struct device_node *np); int of_n_size_cells(const struct device_node *np); /** + * of_simple_addr_cells() - Get the address cells property in a node + * + * This function matches fdt_address_cells(). + * + * @np: Node pointer to check + * @return value of #address-cells property in this node, or 2 if none + */ +int of_simple_addr_cells(const struct device_node *np); + +/** + * of_simple_size_cells() - Get the size cells property in a node + * + * This function matches fdt_size_cells(). + * + * @np: Node pointer to check + * @return value of #size-cells property in this node, or 2 if none + */ +int of_simple_size_cells(const struct device_node *np); + +/** * of_find_property() - find a property in a node * * @np: Pointer to device node holding property @@ -261,6 +281,24 @@ static inline int of_property_read_string_index(const struct device_node *np, } /** + * of_property_count_strings() - Find and return the number of strings from a + * multiple strings property. + * @np: device node from which the property value is to be read. + * @propname: name of the property to be searched. + * + * Search for a property in a device tree node and retrieve the number of null + * terminated string contain in it. Returns the number of strings on + * success, -EINVAL if the property does not exist, -ENODATA if property + * does not have a value, and -EILSEQ if the string is not null-terminated + * within the length of the property data. + */ +static inline int of_property_count_strings(const struct device_node *np, + const char *propname) +{ + return of_property_read_string_helper(np, propname, NULL, 0, 0); +} + +/** * of_parse_phandle - Resolve a phandle property to a device_node pointer * @np: Pointer to device node holding phandle property * @phandle_name: Name of property holding a phandle value diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h index 149622a0b2c..15ad5199c2f 100644 --- a/include/dm/ofnode.h +++ b/include/dm/ofnode.h @@ -359,7 +359,7 @@ int ofnode_stringlist_search(ofnode node, const char *propname, const char *string); /** - * fdt_stringlist_get() - obtain the string at a given index in a string list + * ofnode_read_string_index() - obtain an indexed string from a string list * * Note that this will successfully extract strings from properties with * non-NUL-terminated values. For example on small-valued cell properties @@ -380,6 +380,16 @@ int ofnode_read_string_index(ofnode node, const char *propname, int index, const char **outp); /** + * ofnode_read_string_count() - find the number of strings in a string list + * + * @node: node to check + * @propname: name of the property containing the string list + * @return: + * number of strings in the list, or -ve error value if not found + */ +int ofnode_read_string_count(ofnode node, const char *property); + +/** * ofnode_parse_phandle_with_args() - Find a node pointed by phandle in a list * * This function is useful to parse lists of phandles and their arguments. @@ -463,14 +473,14 @@ int ofnode_decode_display_timing(ofnode node, int index, struct display_timing *config); /** - * ofnode_read_prop()- - read a node property + * ofnode_get_property()- - get a pointer to the value of a node property * * @node: node to read * @propname: property to read * @lenp: place to put length on success * @return pointer to property, or NULL if not found */ -const u32 *ofnode_read_prop(ofnode node, const char *propname, int *lenp); +const void *ofnode_get_property(ofnode node, const char *propname, int *lenp); /** * ofnode_is_available() - check if a node is marked available @@ -552,6 +562,26 @@ int ofnode_read_addr_cells(ofnode node); int ofnode_read_size_cells(ofnode node); /** + * ofnode_read_simple_addr_cells() - Get the address cells property in a node + * + * This function matches fdt_address_cells(). + * + * @np: Node pointer to check + * @return value of #address-cells property in this node, or 2 if none + */ +int ofnode_read_simple_addr_cells(ofnode node); + +/** + * ofnode_read_simple_size_cells() - Get the size cells property in a node + * + * This function matches fdt_size_cells(). + * + * @np: Node pointer to check + * @return value of #size-cells property in this node, or 2 if none + */ +int ofnode_read_simple_size_cells(ofnode node); + +/** * ofnode_pre_reloc() - check if a node should be bound before relocation * * Device tree nodes can be marked as needing-to-be-bound in the loader stages diff --git a/include/dm/read.h b/include/dm/read.h index 8c9846eaf26..b86a2f5fece 100644 --- a/include/dm/read.h +++ b/include/dm/read.h @@ -14,6 +14,8 @@ #include <dm/ofnode.h> #include <dm/uclass.h> +struct resource; + #if CONFIG_IS_ENABLED(OF_LIVE) static inline const struct device_node *dev_np(struct udevice *dev) { @@ -42,6 +44,16 @@ static inline bool dev_of_valid(struct udevice *dev) return ofnode_valid(dev_ofnode(dev)); } +/** + * dev_read_resource() - obtain an indexed resource from a device. + * + * @dev: devuce to examine + * @index index of the resource to retrieve (0 = first) + * @res returns the resource + * @return 0 if ok, negative on error + */ +int dev_read_resource(struct udevice *dev, uint index, struct resource *res); + #ifndef CONFIG_DM_DEV_READ_INLINE /** * dev_read_u32_default() - read a 32-bit integer from a device's DT property @@ -219,6 +231,26 @@ int dev_read_addr_cells(struct udevice *dev); int dev_read_size_cells(struct udevice *dev); /** + * dev_read_addr_cells() - Get the address cells property in a node + * + * This function matches fdt_address_cells(). + * + * @dev: devioe to check + * @return number of address cells this node uses + */ +int dev_read_simple_addr_cells(struct udevice *dev); + +/** + * dev_read_size_cells() - Get the size cells property in a node + * + * This function matches fdt_size_cells(). + * + * @dev: devioe to check + * @return number of size cells this node uses + */ +int dev_read_simple_size_cells(struct udevice *dev); + +/** * dev_read_phandle() - Get the phandle from a device * * @dev: device to check @@ -303,6 +335,19 @@ ofnode dev_read_next_subnode(ofnode node); const uint8_t *dev_read_u8_array_ptr(struct udevice *dev, const char *propname, size_t sz); +/** + * dev_read_enabled() - check whether a node is enabled + * + * This looks for a 'status' property. If this exists, then returns 1 if + * the status is 'ok' and 0 otherwise. If there is no status property, + * it returns 1 on the assumption that anything mentioned should be enabled + * by default. + * + * @dev: device to examine + * @return integer value 0 (not enabled) or 1 (enabled) + */ +int dev_read_enabled(struct udevice *dev); + #else /* CONFIG_DM_DEV_READ_INLINE is enabled */ static inline int dev_read_u32_default(struct udevice *dev, @@ -373,11 +418,23 @@ static inline int dev_read_phandle_with_args(struct udevice *dev, static inline int dev_read_addr_cells(struct udevice *dev) { + /* NOTE: this call should walk up the parent stack */ return fdt_address_cells(gd->fdt_blob, dev_of_offset(dev)); } static inline int dev_read_size_cells(struct udevice *dev) { + /* NOTE: this call should walk up the parent stack */ + return fdt_size_cells(gd->fdt_blob, dev_of_offset(dev)); +} + +static inline int dev_read_simple_addr_cells(struct udevice *dev) +{ + return fdt_address_cells(gd->fdt_blob, dev_of_offset(dev)); +} + +static inline int dev_read_simple_size_cells(struct udevice *dev) +{ return fdt_size_cells(gd->fdt_blob, dev_of_offset(dev)); } @@ -389,7 +446,7 @@ static inline int dev_read_phandle(struct udevice *dev) static inline const u32 *dev_read_prop(struct udevice *dev, const char *propname, int *lenp) { - return ofnode_read_prop(dev_ofnode(dev), propname, lenp); + return ofnode_get_property(dev_ofnode(dev), propname, lenp); } static inline int dev_read_alias_seq(struct udevice *dev, int *devnump) @@ -420,6 +477,11 @@ static inline const uint8_t *dev_read_u8_array_ptr(struct udevice *dev, return ofnode_read_u8_array_ptr(dev_ofnode(dev), propname, sz); } +static inline int dev_read_enabled(struct udevice *dev) +{ + return fdtdec_get_is_enabled(gd->fdt_blob, dev_of_offset(dev)); +} + #endif /* CONFIG_DM_DEV_READ_INLINE */ /** diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h index 1f7e32c31ff..2e6498b7dcd 100644 --- a/include/dm/uclass-id.h +++ b/include/dm/uclass-id.h @@ -18,6 +18,7 @@ enum uclass_id { UCLASS_TEST, UCLASS_TEST_FDT, UCLASS_TEST_BUS, + UCLASS_TEST_PROBE, UCLASS_SPI_EMUL, /* sandbox SPI device emulator */ UCLASS_I2C_EMUL, /* sandbox I2C device emulator */ UCLASS_PCI_EMUL, /* sandbox PCI device emulator */ diff --git a/include/dm/uclass.h b/include/dm/uclass.h index 7f5a1304b5c..18188497c27 100644 --- a/include/dm/uclass.h +++ b/include/dm/uclass.h @@ -241,8 +241,13 @@ int uclass_get_device_by_driver(enum uclass_id id, const struct driver *drv, * * The device returned is probed if necessary, and ready for use * + * This function is useful to start iterating through a list of devices which + * are functioning correctly and can be probed. + * * @id: Uclass ID to look up - * @devp: Returns pointer to the first device in that uclass, or NULL if none + * @devp: Returns pointer to the first device in that uclass if no error + * occurred, or NULL if there is no first device, or an error occurred with + * that device. * @return 0 if OK (found or not found), other -ve on error */ int uclass_first_device(enum uclass_id id, struct udevice **devp); @@ -263,13 +268,48 @@ int uclass_first_device_err(enum uclass_id id, struct udevice **devp); * * The device returned is probed if necessary, and ready for use * + * This function is useful to start iterating through a list of devices which + * are functioning correctly and can be probed. + * * @devp: On entry, pointer to device to lookup. On exit, returns pointer - * to the next device in the same uclass, or NULL if none + * to the next device in the uclass if no error occurred, or NULL if there is + * no next device, or an error occurred with that next device. * @return 0 if OK (found or not found), other -ve on error */ int uclass_next_device(struct udevice **devp); /** + * uclass_first_device() - Get the first device in a uclass + * + * The device returned is probed if necessary, and ready for use + * + * This function is useful to start iterating through a list of devices which + * are functioning correctly and can be probed. + * + * @id: Uclass ID to look up + * @devp: Returns pointer to the first device in that uclass, or NULL if there + * is no first device + * @return 0 if OK (found or not found), other -ve on error. If an error occurs + * it is still possible to move to the next device. + */ +int uclass_first_device_check(enum uclass_id id, struct udevice **devp); + +/** + * uclass_next_device() - Get the next device in a uclass + * + * The device returned is probed if necessary, and ready for use + * + * This function is useful to start iterating through a list of devices which + * are functioning correctly and can be probed. + * + * @devp: On entry, pointer to device to lookup. On exit, returns pointer + * to the next device in the uclass if any + * @return 0 if OK (found or not found), other -ve on error. If an error occurs + * it is still possible to move to the next device. + */ +int uclass_next_device_check(struct udevice **devp); + +/** * uclass_resolve_seq() - Resolve a device's sequence number * * On entry dev->seq is -1, and dev->req_seq may be -1 (to allocate a diff --git a/include/scsi.h b/include/scsi.h index 190dacd0f2e..7173912de4a 100644 --- a/include/scsi.h +++ b/include/scsi.h @@ -7,7 +7,7 @@ #ifndef _SCSI_H #define _SCSI_H -typedef struct SCSI_cmd_block{ +struct scsi_cmd { unsigned char cmd[16]; /* command */ /* for request sense */ unsigned char sense_buf[64] @@ -27,7 +27,7 @@ typedef struct SCSI_cmd_block{ unsigned long trans_bytes; /* tranfered bytes */ unsigned int priv; -}ccb; +}; /*----------------------------------------------------------- ** @@ -158,27 +158,6 @@ typedef struct SCSI_cmd_block{ #define SCSI_WRITE_LONG 0x3F /* Write Long (O) */ #define SCSI_WRITE_SAME 0x41 /* Write Same (O) */ - -/**************************************************************************** - * decleration of functions which have to reside in the LowLevel Part Driver - */ - -void scsi_print_error(ccb *pccb); -int scsi_exec(ccb *pccb); -void scsi_bus_reset(void); -#if !defined(CONFIG_DM_SCSI) -void scsi_low_level_init(int busdevfunc); -#else -void scsi_low_level_init(int busdevfunc, struct udevice *dev); -#endif - -/*************************************************************************** - * functions residing inside cmd_scsi.c - */ -void scsi_init(void); -int scsi_scan(int mode); - -#if defined(CONFIG_DM_SCSI) /** * struct scsi_platdata - stores information about SCSI controller * @@ -191,6 +170,66 @@ struct scsi_platdata { unsigned long max_lun; unsigned long max_id; }; + +/* Operations for SCSI */ +struct scsi_ops { + /** + * exec() - execute a command + * + * @dev: SCSI bus + * @cmd: Command to execute + * @return 0 if OK, -ve on error + */ + int (*exec)(struct udevice *dev, struct scsi_cmd *cmd); + + /** + * bus_reset() - reset the bus + * + * @dev: SCSI bus to reset + * @return 0 if OK, -ve on error + */ + int (*bus_reset)(struct udevice *dev); +}; + +#define scsi_get_ops(dev) ((struct scsi_ops *)(dev)->driver->ops) + +extern struct scsi_ops scsi_ops; + +/** + * scsi_exec() - execute a command + * + * @dev: SCSI bus + * @cmd: Command to execute + * @return 0 if OK, -ve on error + */ +int scsi_exec(struct udevice *dev, struct scsi_cmd *cmd); + +/** + * scsi_bus_reset() - reset the bus + * + * @dev: SCSI bus to reset + * @return 0 if OK, -ve on error + */ +int scsi_bus_reset(struct udevice *dev); + +/** + * scsi_scan() - Scan all SCSI controllers for available devices + * + * @vebose: true to show information about each device found + */ +int scsi_scan(bool verbose); + +/** + * scsi_scan_dev() - scan a SCSI bus and create devices + * + * @dev: SCSI bus + * @verbose: true to show information about each device found + */ +int scsi_scan_dev(struct udevice *dev, bool verbose); + +#ifndef CONFIG_DM_SCSI +void scsi_low_level_init(int busdevfunc); +void scsi_init(void); #endif #define SCSI_IDENTIFY 0xC0 /* not used */ |