From patchwork Mon Nov 28 10:01:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Fenkart X-Patchwork-Id: 699913 X-Patchwork-Delegate: trini@ti.com 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 3tS2K02WD0z9vDl for ; Mon, 28 Nov 2016 21:01:56 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CDD99A7631; Mon, 28 Nov 2016 11:01:44 +0100 (CET) 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 gAJRN-nOw5lM; Mon, 28 Nov 2016 11:01:44 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id F2594B3865; Mon, 28 Nov 2016 11:01:39 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 832D6A75CD for ; Mon, 28 Nov 2016 11:01:30 +0100 (CET) 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 5t7RWVko0seT for ; Mon, 28 Nov 2016 11:01:30 +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.newtechgroup.ch (mail.newtechgroup.ch [83.144.237.166]) by theia.denx.de (Postfix) with ESMTPS id 5BBB7A75DC for ; Mon, 28 Nov 2016 11:01:30 +0100 (CET) Received: from localhost (192.168.1.1) by vsrv-mailch01.newtechgroup.local (192.168.1.208) with Microsoft SMTP Server (TLS) id 15.0.775.38; Mon, 28 Nov 2016 11:01:26 +0100 From: Andreas Fenkart To: Date: Mon, 28 Nov 2016 11:01:15 +0100 Message-ID: <20161128100117.5237-3-andreas.fenkart@digitalstrom.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20161128100117.5237-1-andreas.fenkart@digitalstrom.com> References: <20161128100117.5237-1-andreas.fenkart@digitalstrom.com> MIME-Version: 1.0 X-Originating-IP: [192.168.1.1] X-ClientProxiedBy: VSRV-MAILCH01.newtechgroup.local (192.168.1.208) To vsrv-mailch01.newtechgroup.local (192.168.1.208) X-Brightmail-Tracker: H4sIAAAAAAAAC+NgFprLKsWRWlGSWpSXmKPExsVyYAUjo24Zg02EwbblC5YwWfz64Gcx/dVjZotvW7YxWrzd28lu8f/sB3YHVo/ZDRdZPLomz2fx+He4n8nj7J0djB7Hb2xnCmCNYs3MS8qvSGDNOL9kDnPBfu6K53OvsTQw7uXsYuTiEBJYzyhx5eQb9i5GTg42AQuJh3emsIDYIgISEr/6rzKCFDELzGWUOLS+mREkISzgLzFjYSsbiM0ioCqx4OdS1i5GDg5eAReJhXfFQcISAvISF66eApvDKeAqcWD+CbD5QkAltz+sZgaxeQUEJU7OfAJWwwy06+CLF8wgY4QEdCX6t0tDjAmUOHhvMhuE7S4x+/VtZgjbXmLdi29gWyUEHCWefAiFKfm8bSUrhK0tsf3VPihbR2L5vunsMJf93LqECcKulLj4+DJUPF6i6egXqJGhEkvmhU5glJiF5M5ZSO5cwMi0ilGhrLioTDc3MTMnOcPAUC8vtbwkNTkjvSi/tEAvJz85MWcTIyQGL+xgbH7tfohRkoNJSZT39mPrCCG+pPyUyozE4oz4otKc1OJDjDIcHEoSvPH/gHKCRanpqRVpmTnAZACTZuLgPMQowcGjJMI74S9QDW9xQWJucWY6RP4Uo6SUOG8HSLMASCKjNA+u9xKjqJQw759PQDmegtSi3MwSiPgrRnEORiVh3nSQLp7MvBK4aa+AFjEBLXr7GmxRSSJCSqqBcea+y0c7LFIYu3sqIr5MVi/xtZDRWtQ+fXEHmx6Lfe/dv43a/YvbgkVFZQN3XBF2/BL1Lptjk8y55ElPmJ1S5WxTWFuMuxa+F1wbc+LMhGnX1Sv5I6dvmyPBftTn6eFjK5ICJx77MkNux+xdiUJOU0/8X7P4hZajB1PEsq/fbMz7dTkqjrNmKrEUZyQaajEXFScCADzYzDYwAwAA Cc: Qianyu Subject: [U-Boot] [PATCH 2/4] enf_sf: reuse setup_flash_device instead of open coding it 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" setup_flash_device selects one of two code paths depending on the driver model being used (=CONFIG_DM_SPI_FLASH). env_relocate_spec only used the non driver-model code path. I'm unsure why, either none of the platforms that need relocation use the driver model, or - worse - the driver model is not yet usable when relocating. Signed-off-by: Andreas Fenkart --- common/env_sf.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/common/env_sf.c b/common/env_sf.c index 5126762..ba9ac8a 100644 --- a/common/env_sf.c +++ b/common/env_sf.c @@ -175,12 +175,9 @@ void env_relocate_spec(void) goto out; } - env_flash = spi_flash_probe(CONFIG_ENV_SPI_BUS, CONFIG_ENV_SPI_CS, - CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE); - if (!env_flash) { - set_default_env("!spi_flash_probe() failed"); + ret = setup_flash_device(); + if (ret) goto out; - } ret = spi_flash_read(env_flash, CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE, tmp_env1); @@ -315,10 +312,9 @@ void env_relocate_spec(void) char *buf = NULL; buf = (char *)memalign(ARCH_DMA_MINALIGN, CONFIG_ENV_SIZE); - env_flash = spi_flash_probe(CONFIG_ENV_SPI_BUS, CONFIG_ENV_SPI_CS, - CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE); - if (!env_flash) { - set_default_env("!spi_flash_probe() failed"); + + ret = setup_flash_device(); + if (ret) { if (buf) free(buf); return;