Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A9699C433EF for ; Sat, 23 Jul 2022 17:05:33 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 57E0384142; Sat, 23 Jul 2022 19:05:23 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="iZi6FQbV"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DF91F8410B; Sat, 23 Jul 2022 19:05:20 +0200 (CEST) Received: from mail-qt1-x82c.google.com (mail-qt1-x82c.google.com [IPv6:2607:f8b0:4864:20::82c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D264F840F9 for ; Sat, 23 Jul 2022 19:05:17 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qt1-x82c.google.com with SMTP id bz13so5510357qtb.7 for ; Sat, 23 Jul 2022 10:05:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZjhIwIN7F7Dizc3Tk/L45E0rBwAFDqNv3um+ON0j8HA=; b=iZi6FQbVRcWq1LrvkFG9p5aI51h6OJE6xiCelG/vZz6NwNRNwPisd+IWFzbSz79stt mMHQkWCtSpCuo0sCyNvk9bfeKD+4JENdjyzFsHIoxD37ig1uZ66IQooT3LIry+arKMMp FnheX/+I9ZfN895aQrgI8j7hPEIskimpn1rHs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZjhIwIN7F7Dizc3Tk/L45E0rBwAFDqNv3um+ON0j8HA=; b=naDtYUVthvjMHobAnSSJgw+k7elJHtuu/d7CK/0oZUs3zlENMYssfhG03co2shhzOq FS9rj3SRoYzGXPa4QBSX94JzORNOR3atckexL96lTuixVq3R3hmmOTdhHLooc0rIx0Pw XTlbL8LjhS6b7Nk+mCZKw+4VrLcOAsTwA6392xz01Z2/uztEB3sO1Zl1DQJ/F2KD3Qmb 3cOoiE2qxeXnilDqdm+fqDg186L/723MIm8Yv1jfmeksQFUmSerpj/0lgDix7jUG6ele MOTpDRmgTIYGBv0kzdsELxlbMwZpyUjBjLNW1dWZDQns6iCvVC3WEjv8Hgw7ECh8Q0uI jGeA== X-Gm-Message-State: AJIora+5oh1tJTStsDM5igql6qjSlx8w+aHamdMeRAJjHQQdMGfksFkv LmtVR8MaezCFto1Z6cHs7aSLyL50wdNKcQ== X-Google-Smtp-Source: AGRyM1sE1rhERawPdwq18Q/q6MuryKtKSyO4Wda3FcqwXJMG0HLSSR/7LwjnzYtnv+QvKRnMCjGEDw== X-Received: by 2002:ac8:5889:0:b0:31f:dac:885d with SMTP id t9-20020ac85889000000b0031f0dac885dmr4515152qta.610.1658595916178; Sat, 23 Jul 2022 10:05:16 -0700 (PDT) Received: from bill-the-cat.lan (cpe-65-184-195-139.ec.res.rr.com. [65.184.195.139]) by smtp.gmail.com with ESMTPSA id w12-20020a05620a444c00b006a981a2c483sm5983901qkp.39.2022.07.23.10.05.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Jul 2022 10:05:15 -0700 (PDT) From: Tom Rini To: u-boot@lists.denx.de Cc: Joe Hershberger , Ramon Fried Subject: [PATCH 02/20] net: Remove CONFIG_SYS_DIRECT_FLASH_TFTP Date: Sat, 23 Jul 2022 13:04:54 -0400 Message-Id: <20220723170512.1472738-2-trini@konsulko.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220723170512.1472738-1-trini@konsulko.com> References: <20220723170512.1472738-1-trini@konsulko.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean No platforms enable the functionality to tftp directly to NOR flash, and this is discouraged by the documentation. Remove this code. Further, this highlights an oddity of the code. Un-indent the start of this function. Cc: Joe Hershberger Cc: Ramon Fried Signed-off-by: Tom Rini --- README | 13 ----------- include/configs/kzm9g.h | 2 -- net/tftp.c | 52 +++++++++++------------------------------ 3 files changed, 13 insertions(+), 54 deletions(-) diff --git a/README b/README index ff0df3797d21..74e37aa95cc4 100644 --- a/README +++ b/README @@ -1775,19 +1775,6 @@ Configuration Settings: If defined, hardware flash sectors protection is used instead of U-Boot software protection. -- CONFIG_SYS_DIRECT_FLASH_TFTP: - - Enable TFTP transfers directly to flash memory; - without this option such a download has to be - performed in two steps: (1) download to RAM, and (2) - copy from RAM to flash. - - The two-step approach is usually more reliable, since - you can check if the download worked before you erase - the flash, but in some situations (when system RAM is - too limited to allow for a temporary copy of the - downloaded image) this option may be very useful. - - CONFIG_SYS_FLASH_CFI: Define if the flash driver uses extra elements in the common flash structure for storing flash geometry. diff --git a/include/configs/kzm9g.h b/include/configs/kzm9g.h index e084f87d14dd..f94cb54c7050 100644 --- a/include/configs/kzm9g.h +++ b/include/configs/kzm9g.h @@ -53,8 +53,6 @@ /* Timeout for Flash clear lock bit operations (in ms) */ #define CONFIG_SYS_FLASH_UNLOCK_TOUT (3 * 1000) -#undef CONFIG_SYS_DIRECT_FLASH_TFTP - /* GPIO / PFC */ #define CONFIG_SH_GPIO_PFC diff --git a/net/tftp.c b/net/tftp.c index bfc4c9bde9cb..451d73529f2a 100644 --- a/net/tftp.c +++ b/net/tftp.c @@ -17,9 +17,6 @@ #include #include #include "bootp.h" -#ifdef CONFIG_SYS_DIRECT_FLASH_TFTP -#include -#endif DECLARE_GLOBAL_DATA_PTR; @@ -158,47 +155,24 @@ static inline int store_block(int block, uchar *src, unsigned int len) tftp_block_size; ulong newsize = offset + len; ulong store_addr = tftp_load_addr + offset; -#ifdef CONFIG_SYS_DIRECT_FLASH_TFTP - int i, rc = 0; - - for (i = 0; i < CONFIG_SYS_MAX_FLASH_BANKS; i++) { - /* start address in flash? */ - if (flash_info[i].flash_id == FLASH_UNKNOWN) - continue; - if (store_addr >= flash_info[i].start[0]) { - rc = 1; - break; - } - } - - if (rc) { /* Flash is destination for this packet */ - rc = flash_write((char *)src, store_addr, len); - if (rc) { - flash_perror(rc); - return rc; - } - } else -#endif /* CONFIG_SYS_DIRECT_FLASH_TFTP */ - { - void *ptr; + void *ptr; #ifdef CONFIG_LMB - ulong end_addr = tftp_load_addr + tftp_load_size; + ulong end_addr = tftp_load_addr + tftp_load_size; - if (!end_addr) - end_addr = ULONG_MAX; + if (!end_addr) + end_addr = ULONG_MAX; - if (store_addr < tftp_load_addr || - store_addr + len > end_addr) { - puts("\nTFTP error: "); - puts("trying to overwrite reserved memory...\n"); - return -1; - } -#endif - ptr = map_sysmem(store_addr, len); - memcpy(ptr, src, len); - unmap_sysmem(ptr); + if (store_addr < tftp_load_addr || + store_addr + len > end_addr) { + puts("\nTFTP error: "); + puts("trying to overwrite reserved memory...\n"); + return -1; } +#endif + ptr = map_sysmem(store_addr, len); + memcpy(ptr, src, len); + unmap_sysmem(ptr); if (net_boot_file_size < newsize) net_boot_file_size = newsize; -- 2.25.1