From patchwork Mon Jun 8 09:40:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= X-Patchwork-Id: 11592897 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 96AAC13B1 for ; Mon, 8 Jun 2020 09:41:33 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 73174206D5 for ; Mon, 8 Jun 2020 09:41:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="s+YlzcFq"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CLeq0rnl" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 73174206D5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=P6CGmXWN+CPOKuglq2d+2C/mBJ+weOTlGqRSVeH1YM8=; b=s+YlzcFqU8YOkl wLovPv5U6KZZfsvUZ38jiJx3Q8qsbWNRQSeHePg69t2gSIxsQ92MhY6x1h+gnm7B7We1MWzrnBorW 3aZn54x+eLL2ub3JvJtfkviWoE/+lr0lDOqrNfSJlborq14eY3kVDY19nFzsdSsCtR4w1zBS2LEiC aPd3r/2fffRFAz4cuueqAkxFSlFghemjprYhf1+LfHM3FLk9wPpTa2Zex7EEA0N1GT+dW4KruBV5a rw71QvDDQO/R9VZk02FetAecrVVLsiG31eoOeiO2LkV/4YWd7gaoJgBprafwphtk9HgNni8Bt+sZv lzp4UCHT2lVxRWaB/3aw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jiEHW-0003Bb-7i; Mon, 08 Jun 2020 09:41:26 +0000 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jiEH5-0002mt-8b; Mon, 08 Jun 2020 09:41:00 +0000 Received: by mail-wm1-x32e.google.com with SMTP id k26so15827882wmi.4; Mon, 08 Jun 2020 02:40:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=il1m5NUP7re9G7KU6aHwcFuWrrrnzuYE/JMpUwdavKA=; b=CLeq0rnlvqkHw2Qlwfd/NB4okSe7BM4LDkARQWALxpxMU9NXeBR5tgGn6UbrJR8bvT o7MQf65r2QX2CAAHW7x7uYdO2NutqOzSjV0z/yDgc6S/qLiicFEVzsQL49h3mYHaid28 QMO+r/9q7akBk72uMZkOPi6facaSCzUKjKo8rZf9FzqArcoi+QoqhPY3j00NrGP7KSNz 1Z+P2U1Y42Nh8738GYGIyXhHp5EKWYXvvpCdOT/CBgDRJK7/oPndGA7Of+y+fm2HKUCf PFB+VZ74lrsqENdaBJMzQGFZe3YwKjHIJoinfXmAwj0tnLIq4/e6MmPRNkmD4z755hw9 QqIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=il1m5NUP7re9G7KU6aHwcFuWrrrnzuYE/JMpUwdavKA=; b=iwupgZkz2jM+OjryBkkvxA2EONLPOkyu0q3gghSj3oJOoMMcbgyj3pV05U69IFRAyQ /X++BaYSqmq7JtWSItnWh5RgjUsSRiTheTPkuf7Hq178G0IXBWOlI9NZVBF1vcx0mI3d 9lRWk+znrEdTcLND9YKlX/yi0OslyRqS16nI1y1T6tHAhJR7eAGC7MokxStAxsXAFKgN hfjJ0042A0z66VfBjo4BOh3v2PsXa91u64NR77ZRR5A2IXlhi2IOScTAvjJwYPPpPhhv OWYNEw3cvVuDEBMmTKfg8Z0l3mA7Stv2ioiNgaGodq6Uk0c9Cy4tOP7drvXHRoJnLOkD n9SA== X-Gm-Message-State: AOAM533NosnMfduBZjxsdXLt+RFzKT9c6dKYO01QlZFlzzPVZC06HFTN eUOBNwMOSU/db/n5f11b3i12kD5UrhzLIQ== X-Google-Smtp-Source: ABdhPJwdwqoWaP8+TMuOU5+m89nd/NKtrkkJcMfiuCxPYHjWwM/xJi7bWdkRUO3z4i7W8AInvcYxJQ== X-Received: by 2002:a1c:4105:: with SMTP id o5mr15250547wma.168.1591609257618; Mon, 08 Jun 2020 02:40:57 -0700 (PDT) Received: from skynet.lan (28.red-83-49-61.dynamicip.rima-tde.net. [83.49.61.28]) by smtp.gmail.com with ESMTPSA id a3sm22096479wrp.91.2020.06.08.02.40.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jun 2020 02:40:57 -0700 (PDT) From: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= To: tsbogend@alpha.franken.de, f.fainelli@gmail.com, bcm-kernel-feedback-list@broadcom.com, miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, jonas.gorski@gmail.com, linus.walleij@linaro.org, linux-mips@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org Subject: [PATCH 1/2] MIPS: BCM63xx: add helper function to detect CFE Date: Mon, 8 Jun 2020 11:40:52 +0200 Message-Id: <20200608094053.3381512-2-noltari@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200608094053.3381512-1-noltari@gmail.com> References: <20200608094053.3381512-1-noltari@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200608_024059_302659_55BA0FE4 X-CRM114-Status: UNSURE ( 7.50 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:32e listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [noltari[at]gmail.com] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org CFE passes argument 3 as "CFE1". Signed-off-by: Álvaro Fernández Rojas Signed-off-by: Jonas Gorski --- arch/mips/include/asm/mach-bcm63xx/bcm63xx_board.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_board.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_board.h index 1d19a726f86c..5af07796e8c7 100644 --- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_board.h +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_board.h @@ -2,6 +2,8 @@ #ifndef BCM63XX_BOARD_H_ #define BCM63XX_BOARD_H_ +#include + const char *board_get_name(void); void board_prom_init(void); @@ -10,4 +12,8 @@ void board_setup(void); int board_register_devices(void); +static inline bool bcm63xx_is_cfe_present(void) { + return fw_arg3 == 0x43464531; +} + #endif /* ! BCM63XX_BOARD_H_ */ From patchwork Mon Jun 8 09:40:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= X-Patchwork-Id: 11592907 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B6D6A13B1 for ; Mon, 8 Jun 2020 09:42:05 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8D8602076A for ; Mon, 8 Jun 2020 09:42:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="KC/yQetk"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FH9R6PgL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8D8602076A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=iRgt7fRqthK61/KbTi+N4D/o/giR9xoz62RyFNXzkSA=; b=KC/yQetkMhCF0F FcwOO0t59bvccXgge67CGJ3q/wYbUjc9678jUJ9Gcg8gcd8oWPKoNqjeLA3BFASz4A+c4tnrsOfzx FFV+/ekQDIrnnx/r2JUdUAbyjzbHxK+yeZg/hMBQK80Bk+0TjFHlvc9tY92I82oVFyvQuiXTuvmpW rCXVPElYCW0Jcr93bLe7t2rXJyZc72foIEtpvau4bEmw1u74Yy1xWN6onLIKJGq3BZJnP5+qZ/vnO tc1WbXu+npezHMVy/xhwJ0R+THM8/jgO9twKkYWos3gfWGKzzithjmk2m4Js8vb0C4zoZtEGCoNo6 usUdx/Z5W0EvSYJb1zRw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jiEI2-0003fe-2R; Mon, 08 Jun 2020 09:41:58 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jiEH6-0002n7-C9; Mon, 08 Jun 2020 09:41:01 +0000 Received: by mail-wr1-x443.google.com with SMTP id t18so16636995wru.6; Mon, 08 Jun 2020 02:40:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iutKVuNQT00nZYTrm/7dqkO57UE+CiDX2Zw0XM5T/bs=; b=FH9R6PgLpY/xfk9Y1umYU9fO4KCushpyvjjDhM6GJ3nbePEUfx9CV9RGHkeRSKEsHj zCXHp+4Ck8VAOggyeM3SPuTEOA6yYqQlAiHqlJeK+Tw08h17No6y1uCKK92+EdzuRSD9 iYmyshNqAE33+CC7ezVX90kkXloMBdNxYKKkXuvntSmd4Vfv9P53HbLszP3pvtFAQ4u+ WY/fTwy4fFDibyaS6xNI8Dh5SvXgvY6twrbNPfSRkwQk/SmbbnRdzcxIy5mfqVenF3jH ioqEmx/A1cA7WMxoRwDOzRHXszwdyy3dYKEVTAZDtqV0lOVXw93sqf2pulgQUzOnACOx 1j3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iutKVuNQT00nZYTrm/7dqkO57UE+CiDX2Zw0XM5T/bs=; b=pYFrZZqOTOKMSZk1qD6T1izBeT7oK8sNusj/WMm7WNTgUZGElVlHWo21fpZIRvVPT9 2SOUA4QAK+7wbcIgRPWBac7q+eOHymRrnKIL4YBU34zoUKPbbBMbQSdNAcLX6RDE2g7O GKWvwRGNgxjkQEwyoIVcIQUTxCkujuQYwj6ygVYxss4+BNh91fNAHSviO5H5rHlGGmud 9qNZyCmESk0LbSyYiIY/85gl95Mxj1qU66C7VNzawT1orLx5Luw0LcFLb379GSGe2jf5 r7GsjtuFsfGZZkgkMLzPo2c4ZuQ8KJj21AKxHXt8KOvm1udTegyOdHWTQRiTNCB9dkIa z0QA== X-Gm-Message-State: AOAM530dnO2G1I+rz0TMm9txUZwQb+tqBvGaZfUcwGrkELR/jNFqP/fC lCf33hAPqlwRXW4bFpFjjuk= X-Google-Smtp-Source: ABdhPJxGkVz4sfW8YmjuDWuFHym9WXb7hrNJ4E1wx771qRgJ70vSanVuzdsFBsv1+hLGrALaJ6L1Rw== X-Received: by 2002:adf:a283:: with SMTP id s3mr21368789wra.147.1591609258686; Mon, 08 Jun 2020 02:40:58 -0700 (PDT) Received: from skynet.lan (28.red-83-49-61.dynamicip.rima-tde.net. [83.49.61.28]) by smtp.gmail.com with ESMTPSA id a3sm22096479wrp.91.2020.06.08.02.40.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jun 2020 02:40:58 -0700 (PDT) From: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= To: tsbogend@alpha.franken.de, f.fainelli@gmail.com, bcm-kernel-feedback-list@broadcom.com, miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, jonas.gorski@gmail.com, linus.walleij@linaro.org, linux-mips@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org Subject: [PATCH 2/2] mtd: parsers: bcm63xx: simplify CFE detection Date: Mon, 8 Jun 2020 11:40:53 +0200 Message-Id: <20200608094053.3381512-3-noltari@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200608094053.3381512-1-noltari@gmail.com> References: <20200608094053.3381512-1-noltari@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200608_024100_413287_479FFAE9 X-CRM114-Status: GOOD ( 12.29 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:443 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [noltari[at]gmail.com] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Instead of trying to parse CFE version string, which is customized by some vendors, let's just check that "CFE1" was passed on argument 3. Signed-off-by: Álvaro Fernández Rojas Signed-off-by: Jonas Gorski --- drivers/mtd/parsers/bcm63xxpart.c | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/drivers/mtd/parsers/bcm63xxpart.c b/drivers/mtd/parsers/bcm63xxpart.c index 78f90c6c18fd..06b69e905a42 100644 --- a/drivers/mtd/parsers/bcm63xxpart.c +++ b/drivers/mtd/parsers/bcm63xxpart.c @@ -22,6 +22,8 @@ #include #include +#include + #define BCM963XX_CFE_BLOCK_SIZE SZ_64K /* always at least 64KiB */ #define BCM963XX_CFE_MAGIC_OFFSET 0x4e0 @@ -32,30 +34,6 @@ #define STR_NULL_TERMINATE(x) \ do { char *_str = (x); _str[sizeof(x) - 1] = 0; } while (0) -static int bcm63xx_detect_cfe(struct mtd_info *master) -{ - char buf[9]; - int ret; - size_t retlen; - - ret = mtd_read(master, BCM963XX_CFE_VERSION_OFFSET, 5, &retlen, - (void *)buf); - buf[retlen] = 0; - - if (ret) - return ret; - - if (strncmp("cfe-v", buf, 5) == 0) - return 0; - - /* very old CFE's do not have the cfe-v string, so check for magic */ - ret = mtd_read(master, BCM963XX_CFE_MAGIC_OFFSET, 8, &retlen, - (void *)buf); - buf[retlen] = 0; - - return strncmp("CFE1CFE1", buf, 8); -} - static int bcm63xx_read_nvram(struct mtd_info *master, struct bcm963xx_nvram *nvram) { @@ -138,7 +116,7 @@ static int bcm63xx_parse_cfe_partitions(struct mtd_info *master, struct bcm963xx_nvram *nvram = NULL; int ret; - if (bcm63xx_detect_cfe(master)) + if (!bcm63xx_is_cfe_present()) return -EINVAL; nvram = vzalloc(sizeof(*nvram));