From patchwork Mon Dec 10 10:52:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1010363 X-Patchwork-Delegate: jagannadh.teki@gmail.com 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=st.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 43D0Lh5xNVz9s4s for ; Mon, 10 Dec 2018 21:54:04 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 81947C22485; Mon, 10 Dec 2018 10:53:44 +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=RCVD_IN_DNSWL_BLOCKED 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 A6C67C22473; Mon, 10 Dec 2018 10:53:24 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 951F0C21EEB; Mon, 10 Dec 2018 10:53:22 +0000 (UTC) Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [62.209.51.94]) by lists.denx.de (Postfix) with ESMTPS id 25754C21EEB for ; Mon, 10 Dec 2018 10:53:22 +0000 (UTC) Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id wBAAoxSm012660; Mon, 10 Dec 2018 11:53:19 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2p84kx9xba-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 10 Dec 2018 11:53:19 +0100 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id A95853F; Mon, 10 Dec 2018 10:53:18 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas23.st.com [10.75.90.46]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 8AEE927D6; Mon, 10 Dec 2018 10:53:18 +0000 (GMT) Received: from SAFEX1HUBCAS22.st.com (10.75.90.92) by SAFEX1HUBCAS23.st.com (10.75.90.46) with Microsoft SMTP Server (TLS) id 14.3.361.1; Mon, 10 Dec 2018 11:53:18 +0100 Received: from localhost (10.201.23.85) by Webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.361.1; Mon, 10 Dec 2018 11:53:22 +0100 From: Patrick Delaunay To: Date: Mon, 10 Dec 2018 11:52:40 +0100 Message-ID: <1544439166-5749-2-git-send-email-patrick.delaunay@st.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1544439166-5749-1-git-send-email-patrick.delaunay@st.com> References: <1544439166-5749-1-git-send-email-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.201.23.85] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-12-10_03:, , signatures=0 Cc: Marek Vasut , Michal Simek , Miquel Raynal , U-Boot STM32 , Stephen Warren , Jagan Teki Subject: [U-Boot] [PATCH 1/7] spi: update management of default speed and mode 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" The 2 default values for SPI mode and speed are only if CONFIG_DM_SPI_FLASH is not defined - CONFIG_SF_DEFAULT_SPEED - CONFIG_SF_DEFAULT_MODE Inverse the logic of the test to remove these two defines. Signed-off-by: Patrick Delaunay Reviewed-by: Simon Goldschmidt Reviewed-by: Petr Vorel --- cmd/sf.c | 10 ++++++---- common/spl/spl_spi.c | 11 ++++++----- common/splash_source.c | 11 ++++++----- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/cmd/sf.c b/cmd/sf.c index 84bb057..cfea545 100644 --- a/cmd/sf.c +++ b/cmd/sf.c @@ -81,16 +81,18 @@ static int do_spi_flash_probe(int argc, char * const argv[]) { unsigned int bus = CONFIG_SF_DEFAULT_BUS; unsigned int cs = CONFIG_SF_DEFAULT_CS; - unsigned int speed = CONFIG_SF_DEFAULT_SPEED; - unsigned int mode = CONFIG_SF_DEFAULT_MODE; + /* In DM mode, defaults will be taken from DT */ + unsigned int speed = 0; + unsigned int mode = 0; char *endp; #ifdef CONFIG_DM_SPI_FLASH struct udevice *new, *bus_dev; int ret; - /* In DM mode defaults will be taken from DT */ - speed = 0, mode = 0; #else struct spi_flash *new; + + speed = CONFIG_SF_DEFAULT_SPEED; + mode = CONFIG_SF_DEFAULT_MODE; #endif if (argc >= 2) { diff --git a/common/spl/spl_spi.c b/common/spl/spl_spi.c index b348b45..c1c1fcb 100644 --- a/common/spl/spl_spi.c +++ b/common/spl/spl_spi.c @@ -74,12 +74,13 @@ static int spl_spi_load_image(struct spl_image_info *spl_image, unsigned payload_offs = CONFIG_SYS_SPI_U_BOOT_OFFS; struct spi_flash *flash; struct image_header *header; - unsigned int max_hz = CONFIG_SF_DEFAULT_SPEED; - unsigned int spi_mode = CONFIG_SF_DEFAULT_MODE; + /* In DM mode, defaults will be taken from DT */ + unsigned int max_hz = 0; + unsigned int spi_mode = 0; -#ifdef CONFIG_DM_SPI_FLASH - /* In DM mode defaults will be taken from DT */ - max_hz = 0, spi_mode = 0; +#ifndef CONFIG_DM_SPI_FLASH + max_hz = CONFIG_SF_DEFAULT_SPEED; + spi_mode = CONFIG_SF_DEFAULT_MODE; #endif /* * Load U-Boot image from SPI flash into RAM diff --git a/common/splash_source.c b/common/splash_source.c index 427196c..d5d5550 100644 --- a/common/splash_source.c +++ b/common/splash_source.c @@ -24,12 +24,13 @@ DECLARE_GLOBAL_DATA_PTR; static struct spi_flash *sf; static int splash_sf_read_raw(u32 bmp_load_addr, int offset, size_t read_size) { - unsigned int max_hz = CONFIG_SF_DEFAULT_SPEED; - unsigned int spi_mode = CONFIG_SF_DEFAULT_MODE; + /* In DM mode, defaults will be taken from DT */ + unsigned int max_hz = 0; + unsigned int spi_mode = 0; -#ifdef CONFIG_DM_SPI_FLASH - /* In DM mode defaults will be taken from DT */ - max_hz = 0, spi_mode = 0; +#ifndef CONFIG_DM_SPI_FLASH + max_hz = CONFIG_SF_DEFAULT_SPEED; + spi_mode = CONFIG_SF_DEFAULT_MODE; #endif if (!sf) { From patchwork Mon Dec 10 10:52:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1010362 X-Patchwork-Delegate: jagannadh.teki@gmail.com 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=st.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 43D0L918JHz9s4s for ; Mon, 10 Dec 2018 21:53:32 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 32485C224A5; Mon, 10 Dec 2018 10:53:26 +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=RCVD_IN_DNSWL_BLOCKED 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 DFDEFC21F21; Mon, 10 Dec 2018 10:53:23 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 8A580C22079; Mon, 10 Dec 2018 10:53:22 +0000 (UTC) Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [62.209.51.94]) by lists.denx.de (Postfix) with ESMTPS id 2784DC21F21 for ; Mon, 10 Dec 2018 10:53:22 +0000 (UTC) Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id wBAAp0Fs012677; Mon, 10 Dec 2018 11:53:20 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2p84kx9xbe-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 10 Dec 2018 11:53:20 +0100 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 68E0634; Mon, 10 Dec 2018 10:53:20 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas21.st.com [10.75.90.44]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 4E77F27D6; Mon, 10 Dec 2018 10:53:20 +0000 (GMT) Received: from SAFEX1HUBCAS22.st.com (10.75.90.92) by SAFEX1HUBCAS21.st.com (10.75.90.44) with Microsoft SMTP Server (TLS) id 14.3.361.1; Mon, 10 Dec 2018 11:53:19 +0100 Received: from localhost (10.201.23.85) by Webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.361.1; Mon, 10 Dec 2018 11:53:23 +0100 From: Patrick Delaunay To: Date: Mon, 10 Dec 2018 11:52:41 +0100 Message-ID: <1544439166-5749-3-git-send-email-patrick.delaunay@st.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1544439166-5749-1-git-send-email-patrick.delaunay@st.com> References: <1544439166-5749-1-git-send-email-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.201.23.85] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-12-10_03:, , signatures=0 Cc: U-Boot STM32 , Jagan Teki Subject: [U-Boot] [PATCH 2/7] spi: add comment for spi_flash_probe_bus_cs function 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" Add Kernel style documentation for spi_flash_probe_bus_cs(). Signed-off-by: Patrick Delaunay Reviewed-by: Simon Goldschmidt Reviewed-by: Petr Vorel --- include/spi_flash.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/spi_flash.h b/include/spi_flash.h index e427e96..36565bb 100644 --- a/include/spi_flash.h +++ b/include/spi_flash.h @@ -180,6 +180,20 @@ int spi_flash_erase_dm(struct udevice *dev, u32 offset, size_t len); */ int spl_flash_get_sw_write_prot(struct udevice *dev); +/** + * spi_flash_probe_bus_cs() - Find flash for selected SPI bus and chip select + * + * SPI bus probe and search flash chip for one chip select. + * + * @busnum: SPI bus identifier + * @cs: Chip select to look for + * @max_hz: Requested spi frequency, 0 = get value from platdata + * or device tree + * @spi_mode: Requested spi mode, 0 = get value from platdata + * or device tree + * @devp: Returns pointer to the flash device, if found + * @return 0 if found, -ve on error + */ int spi_flash_probe_bus_cs(unsigned int busnum, unsigned int cs, unsigned int max_hz, unsigned int spi_mode, struct udevice **devp); From patchwork Mon Dec 10 10:52:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1010366 X-Patchwork-Delegate: jagannadh.teki@gmail.com 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=st.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 43D0PB2Kwzz9s55 for ; Mon, 10 Dec 2018 21:56:14 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 065C1C22079; Mon, 10 Dec 2018 10:54:02 +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=RCVD_IN_DNSWL_BLOCKED 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 BCE68C224BC; Mon, 10 Dec 2018 10:53:36 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 8D268C22480; Mon, 10 Dec 2018 10:53:29 +0000 (UTC) Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) by lists.denx.de (Postfix) with ESMTPS id 3813CC22492 for ; Mon, 10 Dec 2018 10:53:26 +0000 (UTC) Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx08-00178001.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id wBAApovI025520; Mon, 10 Dec 2018 11:53:22 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 2p85qjsyqy-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 10 Dec 2018 11:53:22 +0100 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 4C01B34; Mon, 10 Dec 2018 10:53:22 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas24.st.com [10.75.90.94]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 2ED1127D6; Mon, 10 Dec 2018 10:53:22 +0000 (GMT) Received: from SAFEX1HUBCAS22.st.com (10.75.90.92) by Safex1hubcas24.st.com (10.75.90.94) with Microsoft SMTP Server (TLS) id 14.3.361.1; Mon, 10 Dec 2018 11:53:21 +0100 Received: from localhost (10.201.23.85) by Webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.361.1; Mon, 10 Dec 2018 11:53:25 +0100 From: Patrick Delaunay To: Date: Mon, 10 Dec 2018 11:52:42 +0100 Message-ID: <1544439166-5749-4-git-send-email-patrick.delaunay@st.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1544439166-5749-1-git-send-email-patrick.delaunay@st.com> References: <1544439166-5749-1-git-send-email-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.201.23.85] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-12-10_03:, , signatures=0 Cc: U-Boot STM32 Subject: [U-Boot] [PATCH 3/7] da850evm: sf: Read default speed and mode values from DT 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" In case of DT boot, don't read default speed and mode for SPI from CONFIG_*, instead read from DT node. Signed-off-by: Patrick Delaunay Reviewed-by: Petr Vorel --- board/davinci/da8xxevm/da850evm.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/board/davinci/da8xxevm/da850evm.c b/board/davinci/da8xxevm/da850evm.c index b0b29b3..4ef454e 100644 --- a/board/davinci/da8xxevm/da850evm.c +++ b/board/davinci/da8xxevm/da850evm.c @@ -44,8 +44,15 @@ DECLARE_GLOBAL_DATA_PTR; #define CFG_MAC_ADDR_SPI_BUS 0 #define CFG_MAC_ADDR_SPI_CS 0 + +#ifdef CONFIG_DM_SPI_FLASH +/* In DM mode, speed and mode value will be taken from DT */ +#define CFG_MAC_ADDR_SPI_MAX_HZ 0 +#define CFG_MAC_ADDR_SPI_MODE 0 +#else #define CFG_MAC_ADDR_SPI_MAX_HZ CONFIG_SF_DEFAULT_SPEED #define CFG_MAC_ADDR_SPI_MODE SPI_MODE_3 +#endif #define CFG_MAC_ADDR_OFFSET (flash->size - SZ_64K) From patchwork Mon Dec 10 10:52:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1010367 X-Patchwork-Delegate: jagannadh.teki@gmail.com 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=st.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 43D0Pj3vkLz9s55 for ; Mon, 10 Dec 2018 21:56:41 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 17D86C227AA; Mon, 10 Dec 2018 10:54:34 +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=RCVD_IN_DNSWL_BLOCKED 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 DC318C21F21; Mon, 10 Dec 2018 10:53:47 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 16B62C21F21; Mon, 10 Dec 2018 10:53:31 +0000 (UTC) Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [62.209.51.94]) by lists.denx.de (Postfix) with ESMTPS id F2509C224AE for ; Mon, 10 Dec 2018 10:53:27 +0000 (UTC) Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id wBAAoxVJ012657; Mon, 10 Dec 2018 11:53:26 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2p84kx9xbv-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 10 Dec 2018 11:53:26 +0100 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 89FB238; Mon, 10 Dec 2018 10:53:25 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas21.st.com [10.75.90.44]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 72C7027D6; Mon, 10 Dec 2018 10:53:25 +0000 (GMT) Received: from SAFEX1HUBCAS22.st.com (10.75.90.92) by SAFEX1HUBCAS21.st.com (10.75.90.44) with Microsoft SMTP Server (TLS) id 14.3.361.1; Mon, 10 Dec 2018 11:53:24 +0100 Received: from localhost (10.201.23.85) by Webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.361.1; Mon, 10 Dec 2018 11:53:27 +0100 From: Patrick Delaunay To: Date: Mon, 10 Dec 2018 11:52:43 +0100 Message-ID: <1544439166-5749-5-git-send-email-patrick.delaunay@st.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1544439166-5749-1-git-send-email-patrick.delaunay@st.com> References: <1544439166-5749-1-git-send-email-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.201.23.85] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-12-10_03:, , signatures=0 Cc: U-Boot STM32 Subject: [U-Boot] [PATCH 4/7] dfu: sf: Read default speed and mode values from DT 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" In case of DT boot, don't read default speed and mode for SPI from CONFIG_*, instead read from DT node. Signed-off-by: Patrick Delaunay Reviewed-by: Lukasz Majewski Reviewed-by: Petr Vorel --- drivers/dfu/dfu_sf.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/dfu/dfu_sf.c b/drivers/dfu/dfu_sf.c index 066e767..5e32f80 100644 --- a/drivers/dfu/dfu_sf.c +++ b/drivers/dfu/dfu_sf.c @@ -69,11 +69,17 @@ static struct spi_flash *parse_dev(char *devstr) { unsigned int bus; unsigned int cs; - unsigned int speed = CONFIG_SF_DEFAULT_SPEED; - unsigned int mode = CONFIG_SF_DEFAULT_MODE; + /* In DM mode, defaults will be taken from DT */ + unsigned int speed = 0; + unsigned int mode = 0; char *s, *endp; struct spi_flash *dev; +#ifndef CONFIG_DM_SPI_FLASH + speed = CONFIG_SF_DEFAULT_SPEED; + mode = CONFIG_SF_DEFAULT_MODE; +#endif + s = strsep(&devstr, ":"); if (!s || !*s || (bus = simple_strtoul(s, &endp, 0), *endp)) { printf("Invalid SPI bus %s\n", s); From patchwork Mon Dec 10 10:52:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1010364 X-Patchwork-Delegate: jagannadh.teki@gmail.com 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=st.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 43D0NB1Hsnz9s4s for ; Mon, 10 Dec 2018 21:55:22 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id D8F18C2247E; Mon, 10 Dec 2018 10:54:18 +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=RCVD_IN_DNSWL_BLOCKED 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 E204FC224F5; Mon, 10 Dec 2018 10:53:39 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 5BE2BC22486; Mon, 10 Dec 2018 10:53:33 +0000 (UTC) Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [62.209.51.94]) by lists.denx.de (Postfix) with ESMTPS id 98D52C22497 for ; Mon, 10 Dec 2018 10:53:30 +0000 (UTC) Received: from pps.filterd (m0046668.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id wBAAotD6000473; Mon, 10 Dec 2018 11:53:29 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2p84a3206y-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 10 Dec 2018 11:53:29 +0100 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id A8C2034; Mon, 10 Dec 2018 10:53:28 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas23.st.com [10.75.90.46]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 9168927D6; Mon, 10 Dec 2018 10:53:28 +0000 (GMT) Received: from SAFEX1HUBCAS22.st.com (10.75.90.92) by SAFEX1HUBCAS23.st.com (10.75.90.46) with Microsoft SMTP Server (TLS) id 14.3.361.1; Mon, 10 Dec 2018 11:53:28 +0100 Received: from localhost (10.201.23.85) by Webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.361.1; Mon, 10 Dec 2018 11:53:30 +0100 From: Patrick Delaunay To: Date: Mon, 10 Dec 2018 11:52:44 +0100 Message-ID: <1544439166-5749-6-git-send-email-patrick.delaunay@st.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1544439166-5749-1-git-send-email-patrick.delaunay@st.com> References: <1544439166-5749-1-git-send-email-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.201.23.85] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-12-10_03:, , signatures=0 Cc: U-Boot STM32 , Stefan Roese Subject: [U-Boot] [PATCH 5/7] mips: mt76xx: gardena-smart-gateway: Read default speed and mode values from DT 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" In case of DT boot, don't read default speed and mode for SPI from CONFIG_*, instead read from DT node. Signed-off-by: Patrick Delaunay Reviewed-by: Petr Vorel --- board/gardena/smart-gateway-mt7688/board.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/board/gardena/smart-gateway-mt7688/board.c b/board/gardena/smart-gateway-mt7688/board.c index 6e11077..8a67e70 100644 --- a/board/gardena/smart-gateway-mt7688/board.c +++ b/board/gardena/smart-gateway-mt7688/board.c @@ -89,6 +89,14 @@ static void factory_data_env_config(void) u32 crc; int ret; u8 *ptr; + /* In DM mode, defaults will be taken from DT */ + unsigned int speed = 0; + unsigned int mode = 0; + +#ifndef CONFIG_DM_SPI_FLASH + speed = CONFIG_SF_DEFAULT_SPEED; + mode = CONFIG_SF_DEFAULT_MODE; +#endif buf = malloc(FACTORY_DATA_SIZE); if (!buf) { @@ -101,8 +109,8 @@ static void factory_data_env_config(void) */ sf = spi_flash_probe(CONFIG_SF_DEFAULT_BUS, CONFIG_SF_DEFAULT_CS, - CONFIG_SF_DEFAULT_SPEED, - CONFIG_SF_DEFAULT_MODE); + speed, + mode); if (!sf) { printf("F-Data:Unable to access SPI NOR flash\n"); goto err_free; @@ -207,6 +215,14 @@ int do_fd_write(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) struct spi_flash *sf; u8 *buf; int ret = CMD_RET_FAILURE; + /* In DM mode, defaults will be taken from DT */ + unsigned int speed = 0; + unsigned int mode = 0; + +#ifndef CONFIG_DM_SPI_FLASH + speed = CONFIG_SF_DEFAULT_SPEED; + mode = CONFIG_SF_DEFAULT_MODE; +#endif buf = malloc(FACTORY_DATA_SECT_SIZE); if (!buf) { @@ -216,8 +232,8 @@ int do_fd_write(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) sf = spi_flash_probe(CONFIG_SF_DEFAULT_BUS, CONFIG_SF_DEFAULT_CS, - CONFIG_SF_DEFAULT_SPEED, - CONFIG_SF_DEFAULT_MODE); + speed, + mode); if (!sf) { printf("F-Data:Unable to access SPI NOR flash\n"); goto err_free; From patchwork Mon Dec 10 10:52:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1010368 X-Patchwork-Delegate: jagannadh.teki@gmail.com 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=st.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 43D0QC201sz9s55 for ; Mon, 10 Dec 2018 21:57:07 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id EF051C22485; Mon, 10 Dec 2018 10:55:40 +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=RCVD_IN_DNSWL_BLOCKED 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 4166BC224BC; Mon, 10 Dec 2018 10:55:38 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 29E9EC224D2; Mon, 10 Dec 2018 10:54:49 +0000 (UTC) Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [62.209.51.94]) by lists.denx.de (Postfix) with ESMTPS id 71D96C22472 for ; Mon, 10 Dec 2018 10:54:46 +0000 (UTC) Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id wBAAp4iC012719; Mon, 10 Dec 2018 11:53:33 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2p84kx9xch-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 10 Dec 2018 11:53:33 +0100 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 756EE31; Mon, 10 Dec 2018 10:53:32 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas23.st.com [10.75.90.46]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 2C13C27D6; Mon, 10 Dec 2018 10:53:32 +0000 (GMT) Received: from SAFEX1HUBCAS22.st.com (10.75.90.92) by SAFEX1HUBCAS23.st.com (10.75.90.46) with Microsoft SMTP Server (TLS) id 14.3.361.1; Mon, 10 Dec 2018 11:53:31 +0100 Received: from localhost (10.201.23.85) by Webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.361.1; Mon, 10 Dec 2018 11:53:33 +0100 From: Patrick Delaunay To: Date: Mon, 10 Dec 2018 11:52:45 +0100 Message-ID: <1544439166-5749-7-git-send-email-patrick.delaunay@st.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1544439166-5749-1-git-send-email-patrick.delaunay@st.com> References: <1544439166-5749-1-git-send-email-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.201.23.85] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-12-10_03:, , signatures=0 Cc: Andre Przywara , Michal Simek , U-Boot STM32 , Vipul Kumar , Maxime Ripard , Igor Grinberg Subject: [U-Boot] [PATCH 6/7] env: Read default speed and mode values from DT 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" In case of DT boot, don't read default speed and mode for SPI from CONFIG_*, instead read from DT node. Signed-off-by: Patrick Delaunay Reviewed-by: Lukasz Majewski Reviewed-by: Simon Goldschmidt Reviewed-by: Petr Vorel --- env/Kconfig | 4 ++-- env/sf.c | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/env/Kconfig b/env/Kconfig index 9011109..0f760ce 100644 --- a/env/Kconfig +++ b/env/Kconfig @@ -329,11 +329,11 @@ config ENV_IS_IN_SPI_FLASH Define the SPI bus and chip select. If not defined they will be 0. - - CONFIG_ENV_SPI_MAX_HZ (optional): + - CONFIG_ENV_SPI_MAX_HZ (optional if !DM_SPI_FLASH): Define the SPI max work clock. If not defined then use 1MHz. - - CONFIG_ENV_SPI_MODE (optional): + - CONFIG_ENV_SPI_MODE (optional if !DM_SPI_FLASH): Define the SPI work mode. If not defined then use SPI_MODE_3. diff --git a/env/sf.c b/env/sf.c index 2e3c600..edd36f1 100644 --- a/env/sf.c +++ b/env/sf.c @@ -24,12 +24,15 @@ #ifndef CONFIG_ENV_SPI_CS # define CONFIG_ENV_SPI_CS CONFIG_SF_DEFAULT_CS #endif + +#ifndef CONFIG_DM_SPI_FLASH #ifndef CONFIG_ENV_SPI_MAX_HZ # define CONFIG_ENV_SPI_MAX_HZ CONFIG_SF_DEFAULT_SPEED #endif #ifndef CONFIG_ENV_SPI_MODE # define CONFIG_ENV_SPI_MODE CONFIG_SF_DEFAULT_MODE #endif +#endif #ifndef CONFIG_SPL_BUILD #define CMD_SAVEENV @@ -58,7 +61,7 @@ static int setup_flash_device(void) /* speed and mode will be read from DT */ ret = spi_flash_probe_bus_cs(CONFIG_ENV_SPI_BUS, CONFIG_ENV_SPI_CS, - CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE, + 0, 0, &new); if (ret) { set_default_env("spi_flash_probe_bus_cs() failed", 0); From patchwork Mon Dec 10 10:52:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1010365 X-Patchwork-Delegate: jagannadh.teki@gmail.com 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=st.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 43D0P14KgLz9s55 for ; Mon, 10 Dec 2018 21:56:05 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 44068C2247E; Mon, 10 Dec 2018 10:54:51 +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=RCVD_IN_DNSWL_BLOCKED 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 EFFAEC224B4; Mon, 10 Dec 2018 10:54:31 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6A2B1C2249B; Mon, 10 Dec 2018 10:53:41 +0000 (UTC) Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [62.209.51.94]) by lists.denx.de (Postfix) with ESMTPS id F29B6C224A3 for ; Mon, 10 Dec 2018 10:53:34 +0000 (UTC) Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id wBAAoxSs012660; Mon, 10 Dec 2018 11:53:34 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2p84kx9xcm-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 10 Dec 2018 11:53:34 +0100 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 529C934; Mon, 10 Dec 2018 10:53:33 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas23.st.com [10.75.90.46]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 3D1AC27D6; Mon, 10 Dec 2018 10:53:33 +0000 (GMT) Received: from SAFEX1HUBCAS22.st.com (10.75.90.92) by SAFEX1HUBCAS23.st.com (10.75.90.46) with Microsoft SMTP Server (TLS) id 14.3.361.1; Mon, 10 Dec 2018 11:53:32 +0100 Received: from localhost (10.201.23.85) by Webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.361.1; Mon, 10 Dec 2018 11:53:37 +0100 From: Patrick Delaunay To: Date: Mon, 10 Dec 2018 11:52:46 +0100 Message-ID: <1544439166-5749-8-git-send-email-patrick.delaunay@st.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1544439166-5749-1-git-send-email-patrick.delaunay@st.com> References: <1544439166-5749-1-git-send-email-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.201.23.85] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-12-10_03:, , signatures=0 Cc: U-Boot STM32 , Jagan Teki Subject: [U-Boot] [PATCH 7/7] spi: remove define for SPI default SPEED and MODE 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" In DM mode, the speed and mode defaults value will be taken from DT, so these defines should be never used and can be removed. Signed-off-by: Patrick Delaunay Reviewed-by: Simon Goldschmidt Reviewed-by: Petr Vorel --- include/spi_flash.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/spi_flash.h b/include/spi_flash.h index 36565bb..c9d20a5 100644 --- a/include/spi_flash.h +++ b/include/spi_flash.h @@ -12,12 +12,16 @@ #include /* Because we dereference struct udevice here */ #include +#ifndef CONFIG_DM_SPI_FLASH +/* In DM mode, speed and mode value will be taken from DT */ #ifndef CONFIG_SF_DEFAULT_SPEED # define CONFIG_SF_DEFAULT_SPEED 1000000 #endif #ifndef CONFIG_SF_DEFAULT_MODE # define CONFIG_SF_DEFAULT_MODE SPI_MODE_3 #endif +#endif + #ifndef CONFIG_SF_DEFAULT_CS # define CONFIG_SF_DEFAULT_CS 0 #endif