From patchwork Tue Sep 3 14:38:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 1157051 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 46N8pP1Vv5z9sDB for ; Wed, 4 Sep 2019 00:43:41 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id D21F2C21E1B; Tue, 3 Sep 2019 14:41:35 +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 27BCEC21E26; Tue, 3 Sep 2019 14:41:33 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 40436C21DFA; Tue, 3 Sep 2019 14:39:24 +0000 (UTC) Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.9]) by lists.denx.de (Postfix) with ESMTPS id AD54BC21E0F for ; Tue, 3 Sep 2019 14:39:21 +0000 (UTC) Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 46N8jP3d2Mz1rLlZ; Tue, 3 Sep 2019 16:39:21 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 46N8jP2LPrz1qqkP; Tue, 3 Sep 2019 16:39:21 +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 QIumt9X8Cwwq; Tue, 3 Sep 2019 16:39:19 +0200 (CEST) X-Auth-Info: sHjmr9R74cAExGJPZHdbHKolyCynETLjEP1YPxUA6b4= Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (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; Tue, 3 Sep 2019 16:39:19 +0200 (CEST) From: Lukasz Majewski To: u-boot@lists.denx.de, Stefano Babic Date: Tue, 3 Sep 2019 16:38:43 +0200 Message-Id: <20190903143850.9824-8-lukma@denx.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190903143850.9824-1-lukma@denx.de> References: <20190903143850.9824-1-lukma@denx.de> Cc: Marek Vasut , Fabio Berton , Parthiban Nallathambi , Otavio Salvador , Martyn Welch , "NXP i.MX U-Boot Team" Subject: [U-Boot] [PATCH v2 07/14] DM: SPI: Convert display5 to use SPI with DM/DTS (but no in SPL) 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: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The DM/DTS support for SPI is disabled on purpose for SPL, as it is not supported as of time of this conversion. Signed-off-by: Lukasz Majewski --- Changes in v2: - Use dm_gpio_* instead of legacy gpio_* functions arch/arm/mach-imx/mx6/Kconfig | 1 + board/liebherr/display5/common.c | 18 ------------------ board/liebherr/display5/common.h | 1 - board/liebherr/display5/display5.c | 37 ++++++++++++------------------------- configs/display5_defconfig | 3 +++ include/configs/display5.h | 7 +++++-- 6 files changed, 21 insertions(+), 46 deletions(-) diff --git a/arch/arm/mach-imx/mx6/Kconfig b/arch/arm/mach-imx/mx6/Kconfig index aef18726702b..f0786b5ffb40 100644 --- a/arch/arm/mach-imx/mx6/Kconfig +++ b/arch/arm/mach-imx/mx6/Kconfig @@ -190,6 +190,7 @@ config TARGET_DISPLAY5 select DM_ETH select DM_I2C select DM_MMC + select DM_SPI select DM_GPIO select DM_SERIAL select SUPPORT_SPL diff --git a/board/liebherr/display5/common.c b/board/liebherr/display5/common.c index 754c442427f8..d2d174beaa0d 100644 --- a/board/liebherr/display5/common.c +++ b/board/liebherr/display5/common.c @@ -45,18 +45,6 @@ void displ5_set_iomux_misc_spl(void) } #ifdef CONFIG_MXC_SPI -iomux_v3_cfg_t const ecspi_pads[] = { - /* SPI3 */ - MX6_PAD_DISP0_DAT2__ECSPI3_MISO | MUX_PAD_CTRL(SPI_PAD_CTRL), - MX6_PAD_DISP0_DAT1__ECSPI3_MOSI | MUX_PAD_CTRL(SPI_PAD_CTRL), - MX6_PAD_DISP0_DAT0__ECSPI3_SCLK | MUX_PAD_CTRL(SPI_PAD_CTRL), - MX6_PAD_DISP0_DAT3__ECSPI3_SS0 | MUX_PAD_CTRL(NO_PAD_CTRL), - MX6_PAD_DISP0_DAT4__ECSPI3_SS1 | MUX_PAD_CTRL(NO_PAD_CTRL), - MX6_PAD_DISP0_DAT5__ECSPI3_SS2 | MUX_PAD_CTRL(NO_PAD_CTRL), - MX6_PAD_DISP0_DAT6__ECSPI3_SS3 | MUX_PAD_CTRL(NO_PAD_CTRL), - MX6_PAD_DISP0_DAT7__ECSPI3_RDY | MUX_PAD_CTRL(NO_PAD_CTRL), -}; - iomux_v3_cfg_t const ecspi2_pads[] = { /* SPI2, NOR Flash nWP, CS0 */ MX6_PAD_CSI0_DAT10__ECSPI2_MISO | MUX_PAD_CTRL(SPI_PAD_CTRL), @@ -79,14 +67,8 @@ void displ5_set_iomux_ecspi_spl(void) SETUP_IOMUX_PADS(ecspi2_pads); } -void displ5_set_iomux_ecspi(void) -{ - SETUP_IOMUX_PADS(ecspi_pads); -} - #else void displ5_set_iomux_ecspi_spl(void) {} -void displ5_set_iomux_ecspi(void) {} #endif #ifdef CONFIG_FSL_ESDHC_IMX diff --git a/board/liebherr/display5/common.h b/board/liebherr/display5/common.h index 231cefc96009..2bbd934e7a70 100644 --- a/board/liebherr/display5/common.h +++ b/board/liebherr/display5/common.h @@ -34,7 +34,6 @@ void displ5_set_iomux_uart_spl(void); void displ5_set_iomux_uart(void); void displ5_set_iomux_ecspi_spl(void); -void displ5_set_iomux_ecspi(void); void displ5_set_iomux_usdhc_spl(void); void displ5_set_iomux_misc_spl(void); diff --git a/board/liebherr/display5/display5.c b/board/liebherr/display5/display5.c index e008ea9a3fb8..541e3e94a5eb 100644 --- a/board/liebherr/display5/display5.c +++ b/board/liebherr/display5/display5.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -28,11 +27,6 @@ #include #include -#ifndef CONFIG_MXC_SPI -#error "CONFIG_SPI must be set for this board" -#error "Please check your config file" -#endif - #include "common.h" DECLARE_GLOBAL_DATA_PTR; @@ -140,21 +134,6 @@ iomux_v3_cfg_t const misc_pads[] = { MX6_PAD_EIM_D29__GPIO3_IO29 | MUX_PAD_CTRL(NO_PAD_CTRL), }; -static void displ5_setup_ecspi(void) -{ - int ret; - - displ5_set_iomux_ecspi(); - - ret = gpio_request(IMX_GPIO_NR(5, 29), "spi2_cs0"); - if (!ret) - gpio_direction_output(IMX_GPIO_NR(5, 29), 1); - - ret = gpio_request(IMX_GPIO_NR(7, 0), "spi2_#wp"); - if (!ret) - gpio_direction_output(IMX_GPIO_NR(7, 0), 1); -} - /* * Do not overwrite the console * Always use serial for U-Boot console @@ -188,7 +167,7 @@ int board_phy_config(struct phy_device *phydev) int board_init(void) { - struct gpio_desc phy_int_gbe; + struct gpio_desc phy_int_gbe, spi2_wp; int ret; debug("board init\n"); @@ -197,9 +176,6 @@ int board_init(void) /* Setup iomux for non console UARTS */ displ5_set_iomux_uart(); - - displ5_setup_ecspi(); - /* Setup misc (application specific) stuff */ SETUP_IOMUX_PADS(misc_pads); @@ -229,6 +205,17 @@ int board_init(void) iomuxc_set_rgmii_io_voltage(DDR_SEL_1P5V_IO); enable_fec_anatop_clock(0, ENET_125MHZ); + /* Setup #WP for SPI-NOR memory */ + ret = dm_gpio_lookup_name("GPIO7_0", &spi2_wp); + if (ret) { + printf("Cannot get GPIO7_0\n"); + } else { + ret = dm_gpio_request(&spi2_wp, "spi2_#wp"); + if (!ret) + dm_gpio_set_dir_flags(&spi2_wp, GPIOD_IS_OUT | + GPIOD_IS_OUT_ACTIVE); + } + return 0; } diff --git a/configs/display5_defconfig b/configs/display5_defconfig index 6c80a4d46678..3719eb40d5ea 100644 --- a/configs/display5_defconfig +++ b/configs/display5_defconfig @@ -85,12 +85,15 @@ CONFIG_SYS_I2C_EEPROM_ADDR_LEN=2 CONFIG_SUPPORT_EMMC_BOOT=y CONFIG_FSL_USDHC=y CONFIG_MTD_DEVICE=y +CONFIG_DM_SPI_FLASH=y CONFIG_SPI_FLASH=y CONFIG_SF_DEFAULT_BUS=1 CONFIG_SF_DEFAULT_MODE=0 CONFIG_SF_DEFAULT_SPEED=50000000 +CONFIG_SPI_FLASH_SFDP_SUPPORT=y CONFIG_SPI_FLASH_SPANSION=y CONFIG_SPI_FLASH_STMICRO=y +CONFIG_SPI_FLASH_MTD=y CONFIG_PHYLIB=y CONFIG_PHY_MARVELL=y CONFIG_FEC_MXC=y diff --git a/include/configs/display5.h b/include/configs/display5.h index 15027f153341..a3cb62367c4c 100644 --- a/include/configs/display5.h +++ b/include/configs/display5.h @@ -35,8 +35,11 @@ * 0x1540000 - 0x1640000 : SPI.factory (1MiB) */ -#ifndef CONFIG_SPL_BUILD -#define CONFIG_SPI_FLASH_MTD +/* SPI Flash Configs */ +#if defined(CONFIG_SPL_BUILD) +#undef CONFIG_DM_SPI +#undef CONFIG_DM_SPI_FLASH +#undef CONFIG_SPI_FLASH_MTD #endif /* Below values are "dummy" - only to avoid build break */