From patchwork Sun May 5 23:13:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1095624 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=denx.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44y1w13byLz9s4Y for ; Mon, 6 May 2019 09:16:33 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 27D39C21DA2; Sun, 5 May 2019 23:14:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id B1B60C21CB6; Sun, 5 May 2019 23:14:00 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 78D4CC21D72; Sun, 5 May 2019 23:13:58 +0000 (UTC) Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.10]) by lists.denx.de (Postfix) with ESMTPS id E1810C21DA2 for ; Sun, 5 May 2019 23:13:50 +0000 (UTC) Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 44y1rt5DBlz1rYX3; Mon, 6 May 2019 01:13:50 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 44y1rt4nr7z1rN3N; Mon, 6 May 2019 01:13:50 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id EJruocO6cZDX; Mon, 6 May 2019 01:13:49 +0200 (CEST) X-Auth-Info: t4LT8AG/aPW2nQLR0ORlk3pTjq8nAqN4FGKyxRoRPx4= Received: from kurokawa.lan (ip-86-49-110-70.net.upcbroadband.cz [86.49.110.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Mon, 6 May 2019 01:13:49 +0200 (CEST) From: Marek Vasut To: u-boot@lists.denx.de Date: Mon, 6 May 2019 01:13:34 +0200 Message-Id: <20190505231336.27698-4-marex@denx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190505231336.27698-1-marex@denx.de> References: <20190505231336.27698-1-marex@denx.de> MIME-Version: 1.0 Cc: Marek Vasut , Fabio Estevam , Vagrant Cascadian Subject: [U-Boot] [PATCH 4/6] ARM: imx: novena: Convert block devices to DM X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Enable DM block, DM MMC and DM SATA support on iMX6Q Novena convert board code to match the DM support. Signed-off-by: Marek Vasut Cc: Fabio Estevam Cc: Stefano Babic Cc: Vagrant Cascadian Tested-by: Vagrant Cascadian --- arch/arm/dts/imx6q-novena.dts | 5 ++ board/kosagi/novena/novena.c | 107 +++++++++++++++++----------------- configs/novena_defconfig | 3 + include/configs/novena.h | 5 -- 4 files changed, 61 insertions(+), 59 deletions(-) diff --git a/arch/arm/dts/imx6q-novena.dts b/arch/arm/dts/imx6q-novena.dts index 61347a545d..35383c9a2b 100644 --- a/arch/arm/dts/imx6q-novena.dts +++ b/arch/arm/dts/imx6q-novena.dts @@ -61,6 +61,11 @@ reg = <0x10000000 0>; }; + aliases { + mmc0 = &usdhc3; + mmc1 = &usdhc2; + }; + chosen { stdout-path = &uart2; }; diff --git a/board/kosagi/novena/novena.c b/board/kosagi/novena/novena.c index 0750c4667e..4b31e2961c 100644 --- a/board/kosagi/novena/novena.c +++ b/board/kosagi/novena/novena.c @@ -6,6 +6,9 @@ */ #include +#include +#include +#include #include #include #include @@ -20,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -101,60 +105,6 @@ int drv_keyboard_init(void) } #endif -/* - * SDHC - */ -#ifdef CONFIG_FSL_ESDHC -static struct fsl_esdhc_cfg usdhc_cfg[] = { - { USDHC3_BASE_ADDR, 0, 4 }, /* Micro SD */ - { USDHC2_BASE_ADDR, 0, 4 }, /* Big SD */ -}; - -int board_mmc_getcd(struct mmc *mmc) -{ - struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv; - - /* There is no CD for a microSD card, assume always present. */ - if (cfg->esdhc_base == USDHC3_BASE_ADDR) - return 1; - else - return !gpio_get_value(NOVENA_SD_CD); -} - -int board_mmc_getwp(struct mmc *mmc) -{ - struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv; - - /* There is no WP for a microSD card, assume always read-write. */ - if (cfg->esdhc_base == USDHC3_BASE_ADDR) - return 0; - else - return gpio_get_value(NOVENA_SD_WP); -} - - -int board_mmc_init(bd_t *bis) -{ - s32 status = 0; - int index; - - usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK); - usdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK); - - /* Big SD write-protect and card-detect */ - gpio_direction_input(NOVENA_SD_WP); - gpio_direction_input(NOVENA_SD_CD); - - for (index = 0; index < ARRAY_SIZE(usdhc_cfg); index++) { - status = fsl_esdhc_initialize(bis, &usdhc_cfg[index]); - if (status) - return status; - } - - return status; -} -#endif - int board_early_init_f(void) { #if defined(CONFIG_VIDEO_IPUV3) @@ -270,3 +220,52 @@ int misc_init_r(void) return ret; } + +#if CONFIG_IS_ENABLED(AHCI) +static int sata_imx_probe(struct udevice *dev) +{ + int i, err; + + for (i = 0; i < 10; i++) { + err = setup_sata(); + if (err) { + printf("SATA setup failed: %d\n", err); + return err; + } + + udelay(100); + + err = dwc_ahsata_probe(dev); + if (!err) + break; + + /* There is no device on the SATA port */ + if (sata_dm_port_status(0, 0) == 0) + break; + + /* There's a device, but link not established. Retry */ + device_remove(dev, DM_REMOVE_NORMAL); + } + + return 0; +} + +struct ahci_ops sata_imx_ops = { + .port_status = dwc_ahsata_port_status, + .reset = dwc_ahsata_bus_reset, + .scan = dwc_ahsata_scan, +}; + +static const struct udevice_id sata_imx_ids[] = { + { .compatible = "fsl,imx6q-ahci" }, + { } +}; + +U_BOOT_DRIVER(sata_imx) = { + .name = "dwc_ahci", + .id = UCLASS_AHCI, + .of_match = sata_imx_ids, + .ops = &sata_imx_ops, + .probe = sata_imx_probe, +}; +#endif /* AHCI */ diff --git a/configs/novena_defconfig b/configs/novena_defconfig index c74f635121..fa5fdea278 100644 --- a/configs/novena_defconfig +++ b/configs/novena_defconfig @@ -13,6 +13,7 @@ CONFIG_SPL=y CONFIG_SPL_FS_FAT=y CONFIG_SPL_LIBDISK_SUPPORT=y CONFIG_CMD_HDMIDETECT=y +CONFIG_AHCI=y CONFIG_DISTRO_DEFAULTS=y # CONFIG_SYS_MALLOC_F is not set CONFIG_FIT=y @@ -48,6 +49,7 @@ CONFIG_ENV_IS_IN_MMC=y CONFIG_DM=y CONFIG_DWC_AHSATA=y CONFIG_DM_GPIO=y +CONFIG_DM_MMC=y CONFIG_FSL_ESDHC=y CONFIG_PHYLIB=y CONFIG_PHY_MICREL=y @@ -56,6 +58,7 @@ CONFIG_MII=y CONFIG_PCI=y CONFIG_PINCTRL=y CONFIG_PINCTRL_IMX6=y +CONFIG_DM_SCSI=y CONFIG_USB=y CONFIG_USB_KEYBOARD=y CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP=y diff --git a/include/configs/novena.h b/include/configs/novena.h index bb5bf808c2..bc7383e957 100644 --- a/include/configs/novena.h +++ b/include/configs/novena.h @@ -102,12 +102,7 @@ #define CONFIG_POWER_PFUZE100_I2C_ADDR 0x08 /* SATA Configs */ -#ifdef CONFIG_CMD_SATA -#define CONFIG_SYS_SATA_MAX_DEVICE 1 -#define CONFIG_DWC_AHSATA_PORT_ID 0 -#define CONFIG_DWC_AHSATA_BASE_ADDR SATA_ARB_BASE_ADDR #define CONFIG_LBA48 -#endif /* UART */ #define CONFIG_MXC_UART