From patchwork Wed Nov 30 20:48:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 701196 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3tTXYz1yGlz9t1T for ; Thu, 1 Dec 2016 07:48:23 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.b="b/BMRm4j"; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C9CB0A75E9; Wed, 30 Nov 2016 21:48:21 +0100 (CET) X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aavxXguWUAV8; Wed, 30 Nov 2016 21:48:21 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4FC2AA75B7; Wed, 30 Nov 2016 21:48:21 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CB656A75B7 for ; Wed, 30 Nov 2016 21:48:17 +0100 (CET) X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Oa3efnOdCfED for ; Wed, 30 Nov 2016 21:48:17 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by theia.denx.de (Postfix) with ESMTPS id 81DFDA7550 for ; Wed, 30 Nov 2016 21:48:17 +0100 (CET) Received: by mail-wm0-f68.google.com with SMTP id m203so31125022wma.3 for ; Wed, 30 Nov 2016 12:48:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=E/01FFYGeTatSnjleLtJVJkezp5kZGL0AyDG+I43qFo=; b=b/BMRm4jdusQRUJoXiWl/JUdTH+1X4gKrQHetc5WeZK6xvR9GnrkixKq2DtBm9b4JD RNOHBctcIUFQCeCH3rqroJjr0D1DJY4AlFj/y71iDTeL5azvAY3J8D6zu1iQqR5fcEzg kirkHWguLbG9+JRjToQFeNy5ht1QqLw4ulm8jIoj9Xj0KSpOAYBFMNaMZooCyoM6Qt5Q ZUq+H/xz8/ow/ei9eEnv7wqDroo+j7eb4JB09VC0cC7MGKpMaetxAPZ8WOyp4jbPjPn0 KYuAiO3XWNkN9muBM0W5tj7JAzp7BBFjC0Ebd447gyogP9DP2ah1Xq0GjipoljPcKI65 7New== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:in-reply-to:references; bh=E/01FFYGeTatSnjleLtJVJkezp5kZGL0AyDG+I43qFo=; b=T4C1JL59gTYzWSzTQKG5jXPx4hPFHGKtP2rwjoA/rc4sjGTBBxTXCgN0aGnpiVEsE2 u6qF3fdAqbM9ciqRxbci4z91Y33CAI6XYiCfhCpnvCPdtJ+x5U/h/pFE4CNjNS5KaKKU /JsXDIIFkzVTXiiuaHWhEW407QzBz1p2pWGzMaiLPjEZTG1FVYPOY3CK18VCSzbj3ijL cZBC8FLSqbqTuosR91H1UVNNi46bz0LXUyHF5pvLLar+hu6Vk/0zgepST96pFYUFAShH ChktNQE0DrZpBIpufK8CvZhqmsshKyrtGZ/+V6fS0+ycL3NX3+DMAOLQj028dsoqch9K pq+w== X-Gm-Message-State: AKaTC02a8S+/KZc1evU1ggYBPqrsml+0KyNVGoRtq1LE3Y3LOYVzYLpiOZgt4NomI3c8JQ== X-Received: by 10.28.91.141 with SMTP id p135mr1965489wmb.128.1480538897020; Wed, 30 Nov 2016 12:48:17 -0800 (PST) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id w7sm9710088wmd.24.2016.11.30.12.48.16 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 30 Nov 2016 12:48:16 -0800 (PST) From: Michal Simek To: Simon Glass , agraf@suse.de Date: Wed, 30 Nov 2016 21:48:12 +0100 Message-Id: <8ecaa5d0bb90c080cfb10b2c9b505a6f62eabee3.1480538887.git.michal.simek@xilinx.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <6ab653be6633e3c670c9dfd7486e632a49489a32.1480538887.git.michal.simek@xilinx.com> References: <6ab653be6633e3c670c9dfd7486e632a49489a32.1480538887.git.michal.simek@xilinx.com> In-Reply-To: <6ab653be6633e3c670c9dfd7486e632a49489a32.1480538887.git.michal.simek@xilinx.com> References: <6ab653be6633e3c670c9dfd7486e632a49489a32.1480538887.git.michal.simek@xilinx.com> Cc: u-boot@lists.denx.de, Albert Aribaud Subject: [U-Boot] [PATCH v3 2/2] block: Move ceva driver to DM X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This patch also includes ARM64 zynqmp changes: - Remove platform non DM initialization - Remove hardcoded sata base address Signed-off-by: Michal Simek Reviewed-by: Simon Glass --- Changes in v3: - Extend Kconfig help description - sort dm.h - Remove SPL undefinition from board file - Fix Kconfig dependecies Changes in v2: - make ceva_init_sata static - Move SATA_CEVA to defconfig - Initalized max_lun and max_id platdata arch/arm/include/asm/arch-zynqmp/hardware.h | 2 -- board/xilinx/zynqmp/zynqmp.c | 11 -------- configs/xilinx_zynqmp_ep_defconfig | 2 ++ configs/xilinx_zynqmp_zcu102_defconfig | 2 ++ configs/xilinx_zynqmp_zcu102_revB_defconfig | 2 ++ drivers/block/Kconfig | 9 +++++++ drivers/block/sata_ceva.c | 41 +++++++++++++++++++++++++++-- include/configs/xilinx_zynqmp.h | 1 - include/configs/xilinx_zynqmp_ep.h | 1 - include/configs/xilinx_zynqmp_zcu102.h | 2 -- 10 files changed, 54 insertions(+), 19 deletions(-) diff --git a/arch/arm/include/asm/arch-zynqmp/hardware.h b/arch/arm/include/asm/arch-zynqmp/hardware.h index e7738faaf896..d1970953e234 100644 --- a/arch/arm/include/asm/arch-zynqmp/hardware.h +++ b/arch/arm/include/asm/arch-zynqmp/hardware.h @@ -18,8 +18,6 @@ #define ARASAN_NAND_BASEADDR 0xFF100000 -#define ZYNQMP_SATA_BASEADDR 0xFD0C0000 - #define ZYNQMP_USB0_XHCI_BASEADDR 0xFE200000 #define ZYNQMP_USB1_XHCI_BASEADDR 0xFE300000 diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c index cef1f6a13aee..a23c38acd99d 100644 --- a/board/xilinx/zynqmp/zynqmp.c +++ b/board/xilinx/zynqmp/zynqmp.c @@ -311,17 +311,6 @@ void reset_cpu(ulong addr) { } -#ifdef CONFIG_SCSI_AHCI_PLAT -void scsi_init(void) -{ -#if defined(CONFIG_SATA_CEVA) - init_sata(0); -#endif - ahci_init((void __iomem *)ZYNQMP_SATA_BASEADDR); - scsi_scan(1); -} -#endif - int board_late_init(void) { u32 reg = 0; diff --git a/configs/xilinx_zynqmp_ep_defconfig b/configs/xilinx_zynqmp_ep_defconfig index f3cdf90c1f73..8d6a6cf5701e 100644 --- a/configs/xilinx_zynqmp_ep_defconfig +++ b/configs/xilinx_zynqmp_ep_defconfig @@ -49,6 +49,8 @@ CONFIG_OF_EMBED=y CONFIG_NET_RANDOM_ETHADDR=y CONFIG_SPL_DM=y CONFIG_SPL_DM_SEQ_ALIAS=y +CONFIG_DM_SCSI=y +CONFIG_SATA_CEVA=y CONFIG_DFU_RAM=y CONFIG_FPGA_XILINX=y CONFIG_FPGA_ZYNQMPPL=y diff --git a/configs/xilinx_zynqmp_zcu102_defconfig b/configs/xilinx_zynqmp_zcu102_defconfig index fa6d6692040e..7e5e83fdc043 100644 --- a/configs/xilinx_zynqmp_zcu102_defconfig +++ b/configs/xilinx_zynqmp_zcu102_defconfig @@ -41,6 +41,8 @@ CONFIG_OF_EMBED=y CONFIG_NET_RANDOM_ETHADDR=y CONFIG_SPL_DM=y CONFIG_SPL_DM_SEQ_ALIAS=y +CONFIG_DM_SCSI=y +CONFIG_SATA_CEVA=y CONFIG_DFU_RAM=y CONFIG_FPGA_XILINX=y CONFIG_FPGA_ZYNQMPPL=y diff --git a/configs/xilinx_zynqmp_zcu102_revB_defconfig b/configs/xilinx_zynqmp_zcu102_revB_defconfig index a4af8024e454..f57705b2cba9 100644 --- a/configs/xilinx_zynqmp_zcu102_revB_defconfig +++ b/configs/xilinx_zynqmp_zcu102_revB_defconfig @@ -41,6 +41,8 @@ CONFIG_OF_EMBED=y CONFIG_NET_RANDOM_ETHADDR=y CONFIG_SPL_DM=y CONFIG_SPL_DM_SEQ_ALIAS=y +CONFIG_DM_SCSI=y +CONFIG_SATA_CEVA=y CONFIG_DFU_RAM=y CONFIG_FPGA_XILINX=y CONFIG_FPGA_ZYNQMPPL=y diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig index ecca1ef44636..0bbb377993bc 100644 --- a/drivers/block/Kconfig +++ b/drivers/block/Kconfig @@ -38,4 +38,13 @@ config BLOCK_CACHE 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 diff --git a/drivers/block/sata_ceva.c b/drivers/block/sata_ceva.c index dcc3b90b17f1..9b5466483aa4 100644 --- a/drivers/block/sata_ceva.c +++ b/drivers/block/sata_ceva.c @@ -5,6 +5,7 @@ * SPDX-License-Identifier: GPL-2.0+ */ #include +#include #include #include #include @@ -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), +}; diff --git a/include/configs/xilinx_zynqmp.h b/include/configs/xilinx_zynqmp.h index 7452e92ff8da..dcb2b2c3a368 100644 --- a/include/configs/xilinx_zynqmp.h +++ b/include/configs/xilinx_zynqmp.h @@ -185,7 +185,6 @@ #ifdef CONFIG_SATA_CEVA #define CONFIG_LIBATA #define CONFIG_SCSI_AHCI -#define CONFIG_SCSI_AHCI_PLAT #define CONFIG_SYS_SCSI_MAX_SCSI_ID 2 #define CONFIG_SYS_SCSI_MAX_LUN 1 #define CONFIG_SYS_SCSI_MAX_DEVICE (CONFIG_SYS_SCSI_MAX_SCSI_ID * \ diff --git a/include/configs/xilinx_zynqmp_ep.h b/include/configs/xilinx_zynqmp_ep.h index d0ce768e6e14..3a572b7a6c2f 100644 --- a/include/configs/xilinx_zynqmp_ep.h +++ b/include/configs/xilinx_zynqmp_ep.h @@ -16,7 +16,6 @@ #define CONFIG_ZYNQ_SDHCI_MAX_FREQ 52000000 #define CONFIG_ZYNQ_SDHCI_MIN_FREQ (CONFIG_ZYNQ_SDHCI_MAX_FREQ >> 9) #define CONFIG_ZYNQ_EEPROM -#define CONFIG_SATA_CEVA #define CONFIG_ZYNQMP_XHCI_LIST {ZYNQMP_USB0_XHCI_BASEADDR, \ ZYNQMP_USB1_XHCI_BASEADDR} diff --git a/include/configs/xilinx_zynqmp_zcu102.h b/include/configs/xilinx_zynqmp_zcu102.h index adf2321c5d4f..8d018da23e34 100644 --- a/include/configs/xilinx_zynqmp_zcu102.h +++ b/include/configs/xilinx_zynqmp_zcu102.h @@ -41,8 +41,6 @@ #define CONFIG_CMD_PCA953X #define CONFIG_CMD_PCA953X_INFO -#define CONFIG_SATA_CEVA - #define CONFIG_ZYNQMP_XHCI_LIST {ZYNQMP_USB0_XHCI_BASEADDR} #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1