Merge branch 'master' of git://www.denx.de/git/u-boot-microblaze
This commit is contained in:
@@ -19,6 +19,15 @@ config AHCI
|
||||
operations at present. The block device interface has not been converted
|
||||
to driver model.
|
||||
|
||||
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.
|
||||
|
||||
config BLOCK_CACHE
|
||||
bool "Use block device cache"
|
||||
default n
|
||||
@@ -27,3 +36,16 @@ config BLOCK_CACHE
|
||||
This is most useful when accessing filesystems under U-Boot since
|
||||
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.
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -12,6 +12,7 @@ obj-y += blk_legacy.o
|
||||
endif
|
||||
|
||||
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
|
||||
|
||||
+22
-8
@@ -168,7 +168,7 @@ int ahci_reset(void __iomem *base)
|
||||
|
||||
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
|
||||
struct udevice *dev = probe_ent->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_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
|
||||
if (pplat->vendor == PCI_VENDOR_ID_INTEL) {
|
||||
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);
|
||||
tmp = readl(mmio + HOST_CTL);
|
||||
debug("HOST_CTL 0x%x\n", tmp);
|
||||
#if !defined(CONFIG_DM_SCSI)
|
||||
#ifndef CONFIG_SCSI_AHCI_PLAT
|
||||
# ifdef CONFIG_DM_PCI
|
||||
dm_pci_read_config16(dev, PCI_COMMAND, &tmp16);
|
||||
@@ -337,6 +338,7 @@ static int ahci_host_init(struct ahci_probe_ent *probe_ent)
|
||||
tmp |= PCI_COMMAND_MASTER;
|
||||
pci_write_config_word(pdev, PCI_COMMAND, tmp16);
|
||||
# endif
|
||||
#endif
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
@@ -344,8 +346,8 @@ static int ahci_host_init(struct ahci_probe_ent *probe_ent)
|
||||
|
||||
static void ahci_print_info(struct ahci_probe_ent *probe_ent)
|
||||
{
|
||||
#ifndef CONFIG_SCSI_AHCI_PLAT
|
||||
# ifdef CONFIG_DM_PCI
|
||||
#if !defined(CONFIG_SCSI_AHCI_PLAT) && !defined(CONFIG_DM_SCSI)
|
||||
# if defined(CONFIG_DM_PCI)
|
||||
struct udevice *dev = probe_ent->dev;
|
||||
# else
|
||||
pci_dev_t pdev = probe_ent->dev;
|
||||
@@ -372,7 +374,7 @@ static void ahci_print_info(struct ahci_probe_ent *probe_ent)
|
||||
else
|
||||
speed_s = "?";
|
||||
|
||||
#ifdef CONFIG_SCSI_AHCI_PLAT
|
||||
#if defined(CONFIG_SCSI_AHCI_PLAT) || defined(CONFIG_DM_SCSI)
|
||||
scc_s = "SATA";
|
||||
#else
|
||||
# ifdef CONFIG_DM_PCI
|
||||
@@ -424,13 +426,15 @@ static void ahci_print_info(struct ahci_probe_ent *probe_ent)
|
||||
}
|
||||
|
||||
#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)
|
||||
# else
|
||||
static int ahci_init_one(pci_dev_t dev)
|
||||
# endif
|
||||
{
|
||||
#if !defined(CONFIG_DM_SCSI)
|
||||
u16 vendor;
|
||||
#endif
|
||||
int rc;
|
||||
|
||||
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->udma_mask = 0x7f; /*Fixme,assume to support UDMA6 */
|
||||
|
||||
#if !defined(CONFIG_DM_SCSI)
|
||||
#ifdef CONFIG_DM_PCI
|
||||
probe_ent->mmio_base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_5,
|
||||
PCI_REGION_MEM);
|
||||
@@ -473,6 +478,10 @@ static int ahci_init_one(pci_dev_t dev)
|
||||
if (vendor == 0x197b)
|
||||
pci_write_config_byte(dev, 0x41, 0xa1);
|
||||
#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);
|
||||
/* 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)
|
||||
#endif
|
||||
{
|
||||
int i;
|
||||
u32 linkmap;
|
||||
|
||||
#ifndef CONFIG_SCSI_AHCI_PLAT
|
||||
# ifdef CONFIG_DM_PCI
|
||||
# if defined(CONFIG_DM_PCI)
|
||||
struct udevice *dev;
|
||||
int ret;
|
||||
|
||||
@@ -969,6 +981,8 @@ void scsi_low_level_init(int busdevfunc)
|
||||
if (ret)
|
||||
return;
|
||||
ahci_init_one(dev);
|
||||
# elif defined(CONFIG_DM_SCSI)
|
||||
ahci_init_one(dev);
|
||||
# else
|
||||
ahci_init_one(busdevfunc);
|
||||
# endif
|
||||
|
||||
@@ -26,7 +26,7 @@ static const char *if_typename_str[IF_TYPE_COUNT] = {
|
||||
|
||||
static enum uclass_id if_type_uclass_id[IF_TYPE_COUNT] = {
|
||||
[IF_TYPE_IDE] = UCLASS_INVALID,
|
||||
[IF_TYPE_SCSI] = UCLASS_INVALID,
|
||||
[IF_TYPE_SCSI] = UCLASS_SCSI,
|
||||
[IF_TYPE_ATAPI] = UCLASS_INVALID,
|
||||
[IF_TYPE_USB] = UCLASS_MASS_STORAGE,
|
||||
[IF_TYPE_DOC] = UCLASS_INVALID,
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
#include <common.h>
|
||||
#include <dm.h>
|
||||
#include <netdev.h>
|
||||
#include <ahci.h>
|
||||
#include <scsi.h>
|
||||
@@ -73,10 +74,9 @@
|
||||
#define DRV_NAME "ahci-ceva"
|
||||
#define CEVA_FLAG_BROKEN_GEN2 1
|
||||
|
||||
int init_sata(int dev)
|
||||
static int ceva_init_sata(ulong mmio)
|
||||
{
|
||||
ulong tmp;
|
||||
ulong mmio = ZYNQMP_SATA_BASEADDR;
|
||||
int i;
|
||||
|
||||
/*
|
||||
@@ -111,3 +111,40 @@ int init_sata(int dev)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sata_ceva_probe(struct udevice *dev)
|
||||
{
|
||||
struct scsi_platdata *plat = dev_get_platdata(dev);
|
||||
|
||||
ceva_init_sata(plat->base);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct udevice_id sata_ceva_ids[] = {
|
||||
{ .compatible = "ceva,ahci-1v84" },
|
||||
{ }
|
||||
};
|
||||
|
||||
static int sata_ceva_ofdata_to_platdata(struct udevice *dev)
|
||||
{
|
||||
struct scsi_platdata *plat = dev_get_platdata(dev);
|
||||
|
||||
plat->base = dev_get_addr(dev);
|
||||
if (plat->base == FDT_ADDR_T_NONE)
|
||||
return -EINVAL;
|
||||
|
||||
/* Hardcode number for ceva sata controller */
|
||||
plat->max_lun = 1; /* Actually two but untested */
|
||||
plat->max_id = 2;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
U_BOOT_DRIVER(ceva_host_blk) = {
|
||||
.name = "ceva_sata",
|
||||
.id = UCLASS_SCSI,
|
||||
.of_match = sata_ceva_ids,
|
||||
.probe = sata_ceva_probe,
|
||||
.ofdata_to_platdata = sata_ceva_ofdata_to_platdata,
|
||||
.platdata_auto_alloc_size = sizeof(struct scsi_platdata),
|
||||
};
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) 2015 Google, Inc
|
||||
* Written by Simon Glass <sjg@chromium.org>
|
||||
* Copyright (c) 2016 Xilinx, Inc
|
||||
* Written by Michal Simek
|
||||
*
|
||||
* Based on ahci-uclass.c
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <dm.h>
|
||||
#include <scsi.h>
|
||||
|
||||
static int scsi_post_probe(struct udevice *dev)
|
||||
{
|
||||
debug("%s: device %p\n", __func__, dev);
|
||||
scsi_low_level_init(0, dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
UCLASS_DRIVER(scsi) = {
|
||||
.id = UCLASS_SCSI,
|
||||
.name = "scsi",
|
||||
.post_probe = scsi_post_probe,
|
||||
};
|
||||
@@ -325,7 +325,6 @@ static const struct dm_gpio_ops gpio_zynq_ops = {
|
||||
.get_value = zynq_gpio_get_value,
|
||||
.set_value = zynq_gpio_set_value,
|
||||
.get_function = zynq_gpio_get_function,
|
||||
|
||||
};
|
||||
|
||||
static const struct udevice_id zynq_gpio_ids[] = {
|
||||
|
||||
@@ -648,9 +648,8 @@ static int axi_emac_probe(struct udevice *dev)
|
||||
priv->bus->read = axiemac_miiphy_read;
|
||||
priv->bus->write = axiemac_miiphy_write;
|
||||
priv->bus->priv = priv;
|
||||
strcpy(priv->bus->name, "axi_emac");
|
||||
|
||||
ret = mdio_register(priv->bus);
|
||||
ret = mdio_register_seq(priv->bus, dev->seq);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
||||
@@ -566,9 +566,8 @@ static int emaclite_probe(struct udevice *dev)
|
||||
emaclite->bus->read = emaclite_miiphy_read;
|
||||
emaclite->bus->write = emaclite_miiphy_write;
|
||||
emaclite->bus->priv = emaclite;
|
||||
strcpy(emaclite->bus->name, "emaclite");
|
||||
|
||||
ret = mdio_register(emaclite->bus);
|
||||
ret = mdio_register_seq(emaclite->bus, dev->seq);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
||||
@@ -647,9 +647,8 @@ static int zynq_gem_probe(struct udevice *dev)
|
||||
priv->bus->read = zynq_gem_miiphy_read;
|
||||
priv->bus->write = zynq_gem_miiphy_write;
|
||||
priv->bus->priv = priv;
|
||||
strcpy(priv->bus->name, "gem");
|
||||
|
||||
ret = mdio_register(priv->bus);
|
||||
ret = mdio_register_seq(priv->bus, dev->seq);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user