diff options
author | Simon Glass <sjg@chromium.org> | 2017-06-14 21:28:26 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2017-07-11 10:08:19 -0600 |
commit | f2105c61821b67bc1d572304d901518e88ee007b (patch) | |
tree | f2c75cfe5e8861edb20861f1d2970eb70a6dbf96 /drivers | |
parent | 10e40d54b38b9b1916c35fc5c4ed2eff4b4bf117 (diff) | |
download | u-boot-f2105c61821b67bc1d572304d901518e88ee007b.tar.gz |
sata: Move drivers into new drivers/ata directory
At present we have the SATA and PATA drivers mixed up in the drivers/block
directory. It is better to split them out into their own place. Use
drivers/ata which is what Linux does.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/Kconfig | 2 | ||||
-rw-r--r-- | drivers/Makefile | 3 | ||||
-rw-r--r-- | drivers/ata/Kconfig | 62 | ||||
-rw-r--r-- | drivers/ata/Makefile | 22 | ||||
-rw-r--r-- | drivers/ata/ahci-uclass.c (renamed from drivers/block/ahci-uclass.c) | 0 | ||||
-rw-r--r-- | drivers/ata/ahci.c (renamed from drivers/block/ahci.c) | 0 | ||||
-rw-r--r-- | drivers/ata/dwc_ahci.c (renamed from drivers/block/dwc_ahci.c) | 0 | ||||
-rw-r--r-- | drivers/ata/dwc_ahsata.c (renamed from drivers/block/dwc_ahsata.c) | 0 | ||||
-rw-r--r-- | drivers/ata/dwc_ahsata.h (renamed from drivers/block/dwc_ahsata.h) | 0 | ||||
-rw-r--r-- | drivers/ata/fsl_sata.c (renamed from drivers/block/fsl_sata.c) | 0 | ||||
-rw-r--r-- | drivers/ata/fsl_sata.h (renamed from drivers/block/fsl_sata.h) | 0 | ||||
-rw-r--r-- | drivers/ata/libata.c (renamed from drivers/block/libata.c) | 0 | ||||
-rw-r--r-- | drivers/ata/mvsata_ide.c (renamed from drivers/block/mvsata_ide.c) | 0 | ||||
-rw-r--r-- | drivers/ata/mxc_ata.c (renamed from drivers/block/mxc_ata.c) | 0 | ||||
-rw-r--r-- | drivers/ata/sata.c | 117 | ||||
-rw-r--r-- | drivers/ata/sata_ceva.c (renamed from drivers/block/sata_ceva.c) | 0 | ||||
-rw-r--r-- | drivers/ata/sata_dwc.c (renamed from drivers/block/sata_dwc.c) | 0 | ||||
-rw-r--r-- | drivers/ata/sata_dwc.h (renamed from drivers/block/sata_dwc.h) | 0 | ||||
-rw-r--r-- | drivers/ata/sata_mv.c (renamed from drivers/block/sata_mv.c) | 0 | ||||
-rw-r--r-- | drivers/ata/sata_sandbox.c (renamed from drivers/block/sata_sandbox.c) | 0 | ||||
-rw-r--r-- | drivers/ata/sata_sil.c (renamed from drivers/block/sata_sil.c) | 0 | ||||
-rw-r--r-- | drivers/ata/sata_sil.h (renamed from drivers/block/sata_sil.h) | 0 | ||||
-rw-r--r-- | drivers/ata/sata_sil3114.c (renamed from drivers/block/sata_sil3114.c) | 0 | ||||
-rw-r--r-- | drivers/ata/sata_sil3114.h (renamed from drivers/block/sata_sil3114.h) | 0 | ||||
-rw-r--r-- | drivers/block/Kconfig | 45 | ||||
-rw-r--r-- | drivers/block/Makefile | 16 |
26 files changed, 206 insertions, 61 deletions
diff --git a/drivers/Kconfig b/drivers/Kconfig index a736386a0d..63e4034c56 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig @@ -6,6 +6,8 @@ source "drivers/core/Kconfig" source "drivers/adc/Kconfig" +source "drivers/ata/Kconfig" + source "drivers/block/Kconfig" source "drivers/clk/Kconfig" diff --git a/drivers/Makefile b/drivers/Makefile index 058bccb761..9bbcc7bf9c 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -45,7 +45,7 @@ obj-$(CONFIG_SPL_DFU_SUPPORT) += dfu/ obj-$(CONFIG_SPL_WATCHDOG_SUPPORT) += watchdog/ obj-$(CONFIG_SPL_USB_HOST_SUPPORT) += usb/host/ obj-$(CONFIG_OMAP_USB_PHY) += usb/phy/ -obj-$(CONFIG_SPL_SATA_SUPPORT) += block/ +obj-$(CONFIG_SPL_SATA_SUPPORT) += ata/ obj-$(CONFIG_SPL_USB_HOST_SUPPORT) += block/ obj-$(CONFIG_SPL_MMC_SUPPORT) += block/ endif @@ -66,6 +66,7 @@ endif ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),) obj-y += adc/ +obj-y += ata/ obj-$(CONFIG_DM_DEMO) += demo/ obj-$(CONFIG_BIOSEMU) += bios_emulator/ obj-y += block/ diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig new file mode 100644 index 0000000000..6427f1b94a --- /dev/null +++ b/drivers/ata/Kconfig @@ -0,0 +1,62 @@ +config AHCI + bool "Support SATA controllers with driver model" + depends on DM + help + This enables a uclass for disk controllers in U-Boot. Various driver + types can use this, such as AHCI/SATA. It does not provide any standard + operations at present. The block device interface has not been converted + to driver model. + +config SATA + bool "Support SATA controllers" + help + This enables support for SATA (Serial Advanced Technology + Attachment), a serial bus standard for connecting to hard drives and + other storage devices. + + SATA replaces PATA (originally just ATA), which stands for Parallel AT + Attachment, where AT refers to an IBM AT (Advanced Technology) + computer released in 1984. + + See also CMD_SATA which provides command-line support. + +config SCSI + bool "Support SCSI controllers" + help + This enables support for SCSI (Small Computer System Interface), + a parallel interface widely used with storage peripherals such as + hard drives and optical drives. The SCSI standards define physical + interfaces as well as protocols for controlling devices and + tranferring data. + +config DM_SCSI + bool "Support SCSI controllers with driver model" + depends on BLK + help + This option enables the SCSI (Small Computer System Interface) uclass + which supports SCSI and SATA HDDs. For every device configuration + (IDs/LUNs) a block device is created with RAW read/write and + filesystem support. + +menu "SATA/SCSI device support" + +config SATA_CEVA + bool "Ceva Sata controller" + depends on AHCI + depends on DM_SCSI + help + This option enables Ceva Sata controller hard IP available on Xilinx + ZynqMP. Support up to 2 external devices. Complient with SATA 3.1 and + AHCI 1.3 specifications with hot-plug detect feature. + + +config DWC_AHCI + bool "Enable Synopsys DWC AHCI driver support" + select SCSI_AHCI + select PHY + depends on DM_SCSI + help + Enable this driver to support Sata devices through + Synopsys DWC AHCI module. + +endmenu diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile new file mode 100644 index 0000000000..c48184c4c3 --- /dev/null +++ b/drivers/ata/Makefile @@ -0,0 +1,22 @@ +# +# (C) Copyright 2000-2007 +# Wolfgang Denk, DENX Software Engineering, wd@denx.de. +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-$(CONFIG_DWC_AHCI) += dwc_ahci.o +obj-$(CONFIG_AHCI) += ahci-uclass.o +obj-$(CONFIG_SCSI_AHCI) += ahci.o +obj-$(CONFIG_DWC_AHSATA) += dwc_ahsata.o +obj-$(CONFIG_FSL_SATA) += fsl_sata.o +obj-$(CONFIG_LIBATA) += libata.o +obj-$(CONFIG_MVSATA_IDE) += mvsata_ide.o +obj-$(CONFIG_MX51_PATA) += mxc_ata.o +obj-$(CONFIG_SATA) += sata.o +obj-$(CONFIG_SATA_CEVA) += sata_ceva.o +obj-$(CONFIG_SATA_DWC) += sata_dwc.o +obj-$(CONFIG_SATA_MV) += sata_mv.o +obj-$(CONFIG_SATA_SIL3114) += sata_sil3114.o +obj-$(CONFIG_SATA_SIL) += sata_sil.o +obj-$(CONFIG_SANDBOX) += sata_sandbox.o diff --git a/drivers/block/ahci-uclass.c b/drivers/ata/ahci-uclass.c index 7b8c32699f..7b8c32699f 100644 --- a/drivers/block/ahci-uclass.c +++ b/drivers/ata/ahci-uclass.c diff --git a/drivers/block/ahci.c b/drivers/ata/ahci.c index f4744718a8..f4744718a8 100644 --- a/drivers/block/ahci.c +++ b/drivers/ata/ahci.c diff --git a/drivers/block/dwc_ahci.c b/drivers/ata/dwc_ahci.c index 3f839bf987..3f839bf987 100644 --- a/drivers/block/dwc_ahci.c +++ b/drivers/ata/dwc_ahci.c diff --git a/drivers/block/dwc_ahsata.c b/drivers/ata/dwc_ahsata.c index c306e927db..c306e927db 100644 --- a/drivers/block/dwc_ahsata.c +++ b/drivers/ata/dwc_ahsata.c diff --git a/drivers/block/dwc_ahsata.h b/drivers/ata/dwc_ahsata.h index caa2e501f9..caa2e501f9 100644 --- a/drivers/block/dwc_ahsata.h +++ b/drivers/ata/dwc_ahsata.h diff --git a/drivers/block/fsl_sata.c b/drivers/ata/fsl_sata.c index 31f7fab8b4..31f7fab8b4 100644 --- a/drivers/block/fsl_sata.c +++ b/drivers/ata/fsl_sata.c diff --git a/drivers/block/fsl_sata.h b/drivers/ata/fsl_sata.h index 18d679e782..18d679e782 100644 --- a/drivers/block/fsl_sata.h +++ b/drivers/ata/fsl_sata.h diff --git a/drivers/block/libata.c b/drivers/ata/libata.c index d684270dcd..d684270dcd 100644 --- a/drivers/block/libata.c +++ b/drivers/ata/libata.c diff --git a/drivers/block/mvsata_ide.c b/drivers/ata/mvsata_ide.c index 7b6a1558d2..7b6a1558d2 100644 --- a/drivers/block/mvsata_ide.c +++ b/drivers/ata/mvsata_ide.c diff --git a/drivers/block/mxc_ata.c b/drivers/ata/mxc_ata.c index 44bb406f4d..44bb406f4d 100644 --- a/drivers/block/mxc_ata.c +++ b/drivers/ata/mxc_ata.c diff --git a/drivers/ata/sata.c b/drivers/ata/sata.c new file mode 100644 index 0000000000..42ff5c7755 --- /dev/null +++ b/drivers/ata/sata.c @@ -0,0 +1,117 @@ +/* + * Copyright (C) 2000-2005, DENX Software Engineering + * Wolfgang Denk <wd@denx.de> + * Copyright (C) Procsys. All rights reserved. + * Mushtaq Khan <mushtaq_k@procsys.com> + * <mushtaqk_921@yahoo.co.in> + * Copyright (C) 2008 Freescale Semiconductor, Inc. + * Dave Liu <daveliu@freescale.com> + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include <common.h> +#include <dm.h> +#include <sata.h> + +struct blk_desc sata_dev_desc[CONFIG_SYS_SATA_MAX_DEVICE]; + +#ifdef CONFIG_PARTITIONS +struct blk_desc *sata_get_dev(int dev) +{ + return (dev < CONFIG_SYS_SATA_MAX_DEVICE) ? &sata_dev_desc[dev] : NULL; +} +#endif + +#ifdef CONFIG_BLK +static unsigned long sata_bread(struct udevice *dev, lbaint_t start, + lbaint_t blkcnt, void *dst) +{ + return -ENOSYS; +} + +static unsigned long sata_bwrite(struct udevice *dev, lbaint_t start, + lbaint_t blkcnt, const void *buffer) +{ + return -ENOSYS; +} +#else +static unsigned long sata_bread(struct blk_desc *block_dev, lbaint_t start, + lbaint_t blkcnt, void *dst) +{ + return sata_read(block_dev->devnum, start, blkcnt, dst); +} + +static unsigned long sata_bwrite(struct blk_desc *block_dev, lbaint_t start, + lbaint_t blkcnt, const void *buffer) +{ + return sata_write(block_dev->devnum, start, blkcnt, buffer); +} +#endif + +int __sata_initialize(void) +{ + int rc, ret = -1; + int i; + + for (i = 0; i < CONFIG_SYS_SATA_MAX_DEVICE; i++) { + memset(&sata_dev_desc[i], 0, sizeof(struct blk_desc)); + sata_dev_desc[i].if_type = IF_TYPE_SATA; + sata_dev_desc[i].devnum = i; + sata_dev_desc[i].part_type = PART_TYPE_UNKNOWN; + sata_dev_desc[i].type = DEV_TYPE_HARDDISK; + sata_dev_desc[i].lba = 0; + sata_dev_desc[i].blksz = 512; + sata_dev_desc[i].log2blksz = LOG2(sata_dev_desc[i].blksz); +#ifndef CONFIG_BLK + sata_dev_desc[i].block_read = sata_bread; + sata_dev_desc[i].block_write = sata_bwrite; +#endif + rc = init_sata(i); + if (!rc) { + rc = scan_sata(i); + if (!rc && sata_dev_desc[i].lba > 0 && + sata_dev_desc[i].blksz > 0) { + part_init(&sata_dev_desc[i]); + ret = i; + } + } + } + + return ret; +} +int sata_initialize(void) __attribute__((weak, alias("__sata_initialize"))); + +__weak int __sata_stop(void) +{ + int i, err = 0; + + for (i = 0; i < CONFIG_SYS_SATA_MAX_DEVICE; i++) + err |= reset_sata(i); + + if (err) + printf("Could not reset some SATA devices\n"); + + return err; +} +int sata_stop(void) __attribute__((weak, alias("__sata_stop"))); + +#ifdef CONFIG_BLK +static const struct blk_ops sata_blk_ops = { + .read = sata_bread, + .write = sata_bwrite, +}; + +U_BOOT_DRIVER(sata_blk) = { + .name = "sata_blk", + .id = UCLASS_BLK, + .ops = &sata_blk_ops, +}; +#else +U_BOOT_LEGACY_BLK(sata) = { + .if_typename = "sata", + .if_type = IF_TYPE_SATA, + .max_devs = CONFIG_SYS_SATA_MAX_DEVICE, + .desc = sata_dev_desc, +}; +#endif diff --git a/drivers/block/sata_ceva.c b/drivers/ata/sata_ceva.c index 0c24fce8dc..0c24fce8dc 100644 --- a/drivers/block/sata_ceva.c +++ b/drivers/ata/sata_ceva.c diff --git a/drivers/block/sata_dwc.c b/drivers/ata/sata_dwc.c index a226ca2dec..a226ca2dec 100644 --- a/drivers/block/sata_dwc.c +++ b/drivers/ata/sata_dwc.c diff --git a/drivers/block/sata_dwc.h b/drivers/ata/sata_dwc.h index e2d9e0c1fc..e2d9e0c1fc 100644 --- a/drivers/block/sata_dwc.h +++ b/drivers/ata/sata_dwc.h diff --git a/drivers/block/sata_mv.c b/drivers/ata/sata_mv.c index 78e3da442d..78e3da442d 100644 --- a/drivers/block/sata_mv.c +++ b/drivers/ata/sata_mv.c diff --git a/drivers/block/sata_sandbox.c b/drivers/ata/sata_sandbox.c index bd967d290c..bd967d290c 100644 --- a/drivers/block/sata_sandbox.c +++ b/drivers/ata/sata_sandbox.c diff --git a/drivers/block/sata_sil.c b/drivers/ata/sata_sil.c index daff7d4ab5..daff7d4ab5 100644 --- a/drivers/block/sata_sil.c +++ b/drivers/ata/sata_sil.c diff --git a/drivers/block/sata_sil.h b/drivers/ata/sata_sil.h index 55954efdd6..55954efdd6 100644 --- a/drivers/block/sata_sil.h +++ b/drivers/ata/sata_sil.h diff --git a/drivers/block/sata_sil3114.c b/drivers/ata/sata_sil3114.c index 61ffb66a77..61ffb66a77 100644 --- a/drivers/block/sata_sil3114.c +++ b/drivers/ata/sata_sil3114.c diff --git a/drivers/block/sata_sil3114.h b/drivers/ata/sata_sil3114.h index 091fca1d40..091fca1d40 100644 --- a/drivers/block/sata_sil3114.h +++ b/drivers/ata/sata_sil3114.h diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig index ed7fa88bf5..1ddd6508e4 100644 --- a/drivers/block/Kconfig +++ b/drivers/block/Kconfig @@ -10,28 +10,6 @@ config BLK be partitioned into several areas, called 'partitions' in U-Boot. A filesystem can be placed in each partition. -config AHCI - bool "Support SATA controllers with driver model" - depends on DM - help - This enables a uclass for disk controllers in U-Boot. Various driver - types can use this, such as AHCI/SATA. It does not provide any standard - operations at present. The block device interface has not been converted - to driver model. - -config SATA - bool "Support SATA controllers" - help - This enables support for SATA (Serial Advanced Technology - Attachment), a serial bus standard for connecting to hard drives and - other storage devices. - - SATA replaces PATA (originally just ATA), which stands for Parallel AT - Attachment, where AT refers to an IBM AT (Advanced Technology) - computer released in 1984. - - See also CMD_SATA which provides command-line support. - config SCSI bool "Support SCSI controllers" help @@ -59,29 +37,6 @@ config BLOCK_CACHE it will prevent repeated reads from directory structures and other filesystem data structures. -menu "SATA/SCSI device support" - -config SATA_CEVA - bool "Ceva Sata controller" - depends on AHCI - depends on DM_SCSI - help - This option enables Ceva Sata controller hard IP available on Xilinx - ZynqMP. Support up to 2 external devices. Complient with SATA 3.1 and - AHCI 1.3 specifications with hot-plug detect feature. - - -config DWC_AHCI - bool "Enable Synopsys DWC AHCI driver support" - select SCSI_AHCI - select PHY - depends on DM_SCSI - help - Enable this driver to support Sata devices through - Synopsys DWC AHCI module. - -endmenu - config IDE bool "Support IDE controllers" help diff --git a/drivers/block/Makefile b/drivers/block/Makefile index 035e078f81..064c76fc98 100644 --- a/drivers/block/Makefile +++ b/drivers/block/Makefile @@ -11,22 +11,8 @@ ifndef CONFIG_BLK obj-y += blk_legacy.o endif -obj-$(CONFIG_DWC_AHCI) += dwc_ahci.o -obj-$(CONFIG_AHCI) += ahci-uclass.o -obj-$(CONFIG_DM_SCSI) += scsi-uclass.o -obj-$(CONFIG_SCSI_AHCI) += ahci.o -obj-$(CONFIG_DWC_AHSATA) += dwc_ahsata.o -obj-$(CONFIG_FSL_SATA) += fsl_sata.o obj-$(CONFIG_IDE) += ide.o obj-$(CONFIG_IDE_FTIDE020) += ftide020.o -obj-$(CONFIG_LIBATA) += libata.o -obj-$(CONFIG_MVSATA_IDE) += mvsata_ide.o -obj-$(CONFIG_MX51_PATA) += mxc_ata.o -obj-$(CONFIG_SATA_CEVA) += sata_ceva.o -obj-$(CONFIG_SATA_DWC) += sata_dwc.o -obj-$(CONFIG_SATA_MV) += sata_mv.o -obj-$(CONFIG_SATA_SIL3114) += sata_sil3114.o -obj-$(CONFIG_SATA_SIL) += sata_sil.o -obj-$(CONFIG_SANDBOX) += sandbox.o sandbox_scsi.o sata_sandbox.o +obj-$(CONFIG_SANDBOX) += sandbox.o sandbox_scsi.o obj-$(CONFIG_SYSTEMACE) += systemace.o obj-$(CONFIG_BLOCK_CACHE) += blkcache.o |