From patchwork Tue Jun 6 23:12:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Zhang X-Patchwork-Id: 104144 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3731434vqr; Tue, 6 Jun 2023 16:21:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5SdwEaoulMX0DV0grzMRfjnfuka4uJqS0PbhURCp532oim/K2BHgVLZU3/uJyJXmwyqlJX X-Received: by 2002:a17:90b:2347:b0:256:4196:f722 with SMTP id ms7-20020a17090b234700b002564196f722mr1670244pjb.47.1686093678276; Tue, 06 Jun 2023 16:21:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686093678; cv=none; d=google.com; s=arc-20160816; b=LXho3rxKaGCoWG61PJA06ddTQ4eLzaJWtMTfEg6PZT4nUvIIdhdC6GpguOWtkwdm3Z EJ0z1I4WZocSTFaN0ngaGfjbD+4zBd+pT/WuI6g+sQpRAG3qmPXnNAG3i7tf7rzklHRJ NzcGmCUEGekly9IxNqXCf2ug9K0+ELlroTWGJB7wG+9aN/ZTHA27q79fzcQxeYu+PJli TUgWcImVWDlv2ZD1TQt95LCIvK9e7bfumbYCcGuf5RtqyEoS0mnm3CRsqmvZ2gpmO/U3 M4Phwso6+u0Rvmo40LI2PCTi7x1rGSqq4j2M7kUgTfyUtmx9imbJDohy207WhRrQjJIN yEhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Y5bwj1z7HnH+2QnddyqopBsaPUZmUyRMoGGaHHRmdoU=; b=NgyXV+3zANPHZoAOIoqJlaLANG9PASzoSSA5sOVqB3XjaSjsIeZG5NyhsMB+Hj4LbH uQY1xhgiSXvn2/NguTcHEdA0q6d6MpRON+N4TjKYtC6I1lxOEoK9hjOl+woerCsS35x7 XXj/+cnpOchMD74z5kz6W9kSd5QU2r4El8PztCqKFvE9fZm6ZAMGdhBlxImlGg60RqjI bGxOiw1rVGjHZWBsARQ70TUgpd5Td+ZvWSzMPou5SFf2vyxDgWnSLC7WLU4IOuveL6jk 9yCkHW13WUQUEXuWQSGW8r0uxTASIOvPCyB4XoRrt+Cqa5grJ+TfmZYT++I33ErglqoY bwNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=dQBs8m7J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j15-20020a17090a588f00b002402275fc56si111959pji.118.2023.06.06.16.21.03; Tue, 06 Jun 2023 16:21:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=dQBs8m7J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240206AbjFFXOB (ORCPT + 99 others); Tue, 6 Jun 2023 19:14:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240201AbjFFXN7 (ORCPT ); Tue, 6 Jun 2023 19:13:59 -0400 Received: from mail-qk1-x72f.google.com (mail-qk1-x72f.google.com [IPv6:2607:f8b0:4864:20::72f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DC1210C6 for ; Tue, 6 Jun 2023 16:13:57 -0700 (PDT) Received: by mail-qk1-x72f.google.com with SMTP id af79cd13be357-75ea05150b3so255301285a.0 for ; Tue, 06 Jun 2023 16:13:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1686093236; x=1688685236; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=Y5bwj1z7HnH+2QnddyqopBsaPUZmUyRMoGGaHHRmdoU=; b=dQBs8m7JPeeygMxsKuUzm5VTwp2Blozhsgvsj5I0blRCBSX019vDn85e/CcelOU6UL HdZGzTb619CcUd2vImvQN5v+d1BglGdha7l6TXEY5GyUk2Wy5Rgs+KUIiRFjbLRhkxpY 7DpyydIyATqNXHfRXjDYc+CMKrU0rs6yEV9d4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686093236; x=1688685236; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Y5bwj1z7HnH+2QnddyqopBsaPUZmUyRMoGGaHHRmdoU=; b=R6SjrK1jNs9eAnUenJqU1saxg1hOzrWJUNHnwrS/VopaPJsxqZTyOw7sJqGV6DjDDg K2Z0U9dzh1wmXSbuBYsoWjTkTO1ogmzGNSsuoB8X8RBvgGWN+RVIn0vtu5HLVnqMiXHy r3wkferNIZ1nuBztSPw0w0SeT8hY/+GSbOUBeCFaxdmT2qsWo0923iI1qQ73GCfjcEhS cXRGdn8j+97W653Yw9kFxXtlaFEbXMNOVgkIMCK51bLWvDD7SBnLxfKSQrL2bXT8D3iJ 5lmTGhFFLB1dQ8eI+FcrJ58x8J8Qlpu68jZRHpM8oRsolTMVDQSaFcPhjM6bcVGQ6Rle FhJQ== X-Gm-Message-State: AC+VfDyI14TB/ExFjhrUQ0s0GrpHLtV7jbbz7sNhnUA6rJcFvhrTHHie 44+3QYGoTBjynpW7uzow9Xb6qQ== X-Received: by 2002:a05:620a:843:b0:75e:cda3:16ab with SMTP id u3-20020a05620a084300b0075ecda316abmr181956qku.33.1686093236614; Tue, 06 Jun 2023 16:13:56 -0700 (PDT) Received: from ubuntu-22.localdomain ([192.19.222.250]) by smtp.gmail.com with ESMTPSA id x9-20020ae9e909000000b0075b23e55640sm5221519qkf.123.2023.06.06.16.13.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jun 2023 16:13:55 -0700 (PDT) From: William Zhang To: Broadcom Kernel List , Linux MTD List Cc: f.fainelli@gmail.com, rafal@milecki.pl, kursad.oney@broadcom.com, joel.peshkin@broadcom.com, computersforpeace@gmail.com, anand.gore@broadcom.com, dregan@mail.com, kamal.dasu@broadcom.com, tomer.yacoby@broadcom.com, dan.beygelman@broadcom.com, William Zhang , Florian Fainelli , Rob Herring , linux-kernel@vger.kernel.org, Vignesh Raghavendra , Miquel Raynal , Richard Weinberger , Boris Brezillon , Kamal Dasu Subject: [PATCH 01/12] mtd: rawnand: brcmnand: Fix ECC level field setting for v7.2 controller Date: Tue, 6 Jun 2023 16:12:41 -0700 Message-Id: <20230606231252.94838-2-william.zhang@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230606231252.94838-1-william.zhang@broadcom.com> References: <20230606231252.94838-1-william.zhang@broadcom.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767997364935998415?= X-GMAIL-MSGID: =?utf-8?q?1767997364935998415?= v7.2 controller has different ECC level field size and shift in the acc control register than its predecessor and successor controller. It needs to be set specifically. Fixes: decba6d47869 ("mtd: brcmnand: Add v7.2 controller support") Signed-off-by: William Zhang Reviewed-by: Florian Fainelli --- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c index 2e9c2e2d9c9f..b2cde1082b3b 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c @@ -977,12 +977,20 @@ static inline u32 brcmnand_ecc_level_mask(struct brcmnand_controller *ctrl) mask <<= NAND_ACC_CONTROL_ECC_SHIFT; /* v7.2 includes additional ECC levels */ - if (ctrl->nand_version >= 0x0702) + if (ctrl->nand_version == 0x0702) mask |= 0x7 << NAND_ACC_CONTROL_ECC_EXT_SHIFT; return mask; } +static inline int brcmnand_ecc_level_shift(struct brcmnand_controller *ctrl) +{ + if (ctrl->nand_version == 0x0702) + return NAND_ACC_CONTROL_ECC_EXT_SHIFT; + else + return NAND_ACC_CONTROL_ECC_SHIFT; +} + static void brcmnand_set_ecc_enabled(struct brcmnand_host *host, int en) { struct brcmnand_controller *ctrl = host->ctrl; @@ -992,8 +1000,8 @@ static void brcmnand_set_ecc_enabled(struct brcmnand_host *host, int en) if (en) { acc_control |= ecc_flags; /* enable RD/WR ECC */ - acc_control |= host->hwcfg.ecc_level - << NAND_ACC_CONTROL_ECC_SHIFT; + acc_control &= ~brcmnand_ecc_level_mask(ctrl); + acc_control |= host->hwcfg.ecc_level << brcmnand_ecc_level_shift(ctrl); } else { acc_control &= ~ecc_flags; /* disable RD/WR ECC */ acc_control &= ~brcmnand_ecc_level_mask(ctrl); From patchwork Tue Jun 6 23:12:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Zhang X-Patchwork-Id: 104148 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3737132vqr; Tue, 6 Jun 2023 16:36:13 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4P75792MUaOkBnKtlTFdefDIvvHkEBdyvWE07FsYS704WBvxKL8xb+twFr88ZHFsXQZlvs X-Received: by 2002:a05:6a20:2591:b0:117:c69b:cb34 with SMTP id k17-20020a056a20259100b00117c69bcb34mr1386762pzd.2.1686094573282; Tue, 06 Jun 2023 16:36:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686094573; cv=none; d=google.com; s=arc-20160816; b=Pn1sCxD1fNVFbz/7P/eTwMRCTwOBfKyF7UsVE4p/HznEGiGpaTI6U3rlqulQF/XFB5 rt4R54TztG4GKyuBIWbcD25RJSPsMlx4PTWPyCZuEhOQovQPUfAStk6I9EGaS9mleTZ8 C19hx0tBG3rRc2cfOIaKPmGkH644UMq+bwE4fzCBbHV+O4THd4J7U1Z22fQJk33pUCQk iQ+xPlISLuqWfC45VLYcDVe73gYfZqF+aVnFH592RI/d0Hi7fLMFk73Qby0P18VEXOgu OiXAg0Bjm1NunUkQe4xEWD023yA1vzRi4qmo84lK+OXI2kkLc4dREx6ssgulOEwqWyeh HV4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=+Uxe4ngKTvNFW992508pPtOKsthsuCTTWurBQad88ro=; b=MjDGYCB+WJ+KTuf2v2gGFC6S1bijBfnVQB/TiIId3FnUGIM187cuDfoRoxolFXryTg /2V1wUneX49MrFFVyo1eXiIOzbuvYLVex9NJPHvsao5b5G2YY+TckxEd0RfR4Ty9J+cc qrJ78UaUzBt5lPcWHMKHr9CSzTCWr5cE2LCMPS3RQeOjAesc3cMBGnUmx7Zn9bozE1Um ztpzdwbp9j7sO+a3DL71a62hkMAWcbI7V7GRCD7bqZ+kKE2kakCfJT95wBOPgnmKENsW xrFu+Z6dH2Q1Z/N26FpI/t0Tb4B6B4Kj7bqkIF5VTe6QpQnvru3irJLFx1OAXdaxTE6T galw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=ERkLD+l8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k13-20020a636f0d000000b0054033bf35easi8025760pgc.269.2023.06.06.16.35.58; Tue, 06 Jun 2023 16:36:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=ERkLD+l8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240209AbjFFXOP (ORCPT + 99 others); Tue, 6 Jun 2023 19:14:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240226AbjFFXOL (ORCPT ); Tue, 6 Jun 2023 19:14:11 -0400 Received: from mail-qk1-x733.google.com (mail-qk1-x733.google.com [IPv6:2607:f8b0:4864:20::733]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 226B4198D for ; Tue, 6 Jun 2023 16:14:10 -0700 (PDT) Received: by mail-qk1-x733.google.com with SMTP id af79cd13be357-75ec541f933so2291085a.0 for ; Tue, 06 Jun 2023 16:14:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1686093249; x=1688685249; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=+Uxe4ngKTvNFW992508pPtOKsthsuCTTWurBQad88ro=; b=ERkLD+l8LfwszLrjOzufekft3SVcHOEFFyLMDpWXb736gVGi0xS5MNgOShmMuCmGe6 +FSyd89WVYXVGgF707pZg42DoXS7zErvPNwDcsMtjdG+OPH/Be0MVqyROkSrYO0vjqh9 E7Qk1kM+mv11FI6e3p9tZwTsaTIx2x3hgJqkI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686093249; x=1688685249; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+Uxe4ngKTvNFW992508pPtOKsthsuCTTWurBQad88ro=; b=c4RT9a8oM9LhkqAcPcLH+QtZhVGRYDHnvv45iywGLJhHaEVhRFGE8fzgZlLkEYzXzw HzBu4Xli7Y2CYDUftM+vJTqhh6R6C6Hri6P0yq08rrgY2ux/CWARI0oF48JOeD1W1A96 EBnB+MNxNVWIq1h7duMWI2axcQrivOOHvF0Wnpr8t5FdUgOkCylbWM1hl8yzYx3N4jQ+ iVtJA5ZC0VFb62jlOoTWsRDKFit2wQ1tCKZg6K5wuhPO2KZetwWCYBIfkEo9Jz7NyxCl 4Wi0V/hKoKiFhAGoiVGsrNf+ylkTJCuR4AIvh6IYG9WxeXxEOFxrz8bOfrLX6a17HLS7 Xs7A== X-Gm-Message-State: AC+VfDz2AvGfKh7rNR4hmDSuZpizvlxyGIkAtQXJsETkO9ZboejbhAp4 uZtHxbm5/WhtsvSNGuFHhOtpqA== X-Received: by 2002:a05:620a:3a41:b0:75e:ca48:51c8 with SMTP id sk1-20020a05620a3a4100b0075eca4851c8mr99401qkn.4.1686093249233; Tue, 06 Jun 2023 16:14:09 -0700 (PDT) Received: from ubuntu-22.localdomain ([192.19.222.250]) by smtp.gmail.com with ESMTPSA id x9-20020ae9e909000000b0075b23e55640sm5221519qkf.123.2023.06.06.16.14.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jun 2023 16:14:08 -0700 (PDT) From: William Zhang To: Broadcom Kernel List , Linux MTD List Cc: f.fainelli@gmail.com, rafal@milecki.pl, kursad.oney@broadcom.com, joel.peshkin@broadcom.com, computersforpeace@gmail.com, anand.gore@broadcom.com, dregan@mail.com, kamal.dasu@broadcom.com, tomer.yacoby@broadcom.com, dan.beygelman@broadcom.com, William Zhang , Florian Fainelli , Miquel Raynal , linux-kernel@vger.kernel.org, Vignesh Raghavendra , Richard Weinberger , Boris Brezillon , Kamal Dasu Subject: [PATCH 02/12] mtd: rawnand: brcmnand: Fix potential false time out warning Date: Tue, 6 Jun 2023 16:12:42 -0700 Message-Id: <20230606231252.94838-3-william.zhang@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230606231252.94838-1-william.zhang@broadcom.com> References: <20230606231252.94838-1-william.zhang@broadcom.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767998303570732070?= X-GMAIL-MSGID: =?utf-8?q?1767998303570732070?= If system is busy during the command status polling function, the driver may not get the chance to poll the status register till the end of time out and return the premature status. Do a final check after time out happens to ensure reading the correct status. Fixes: 9d2ee0a60b8b ("mtd: nand: brcmnand: Check flash #WP pin status before nand erase/program") Signed-off-by: William Zhang Reviewed-by: Florian Fainelli --- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c index b2cde1082b3b..b6346a8b9833 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c @@ -1080,6 +1080,14 @@ static int bcmnand_ctrl_poll_status(struct brcmnand_controller *ctrl, cpu_relax(); } while (time_after(limit, jiffies)); + /* + * do a final check after time out in case CPU is busy and driver does + * not get the enough time to poll to avoid false alarm + */ + val = brcmnand_read_reg(ctrl, BRCMNAND_INTFC_STATUS); + if ((val & mask) == expected_val) + return 0; + dev_warn(ctrl->dev, "timeout on status poll (expected %x got %x)\n", expected_val, val & mask); From patchwork Tue Jun 6 23:12:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Zhang X-Patchwork-Id: 104145 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3731541vqr; Tue, 6 Jun 2023 16:21:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7/Bkm/A1PdlH5GJmQUc5vARb/txuXJ09jfftKsLBMawjKCx66UmylK5eturpUpJcZPVLRF X-Received: by 2002:a05:6a00:1883:b0:646:9232:df6 with SMTP id x3-20020a056a00188300b0064692320df6mr4865092pfh.33.1686093693863; Tue, 06 Jun 2023 16:21:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686093693; cv=none; d=google.com; s=arc-20160816; b=DPkKoC1Jvdu4pGfemIFO2CtjWprdp4mSwqkscDpqzcGQRLZTqZmwDsAo9o1R9CHUZD Uf5OWlCPOB/Er9JJuj34sIweFoxg+LjtESahBHXAKJ04zZcX+K4B+Hei2hwYrBgSjdml Qz6S3aX9Vb634/WRFNsecLCBoADxGFu8jtopONIE9FCVJcTEQJ0SXkH20+6RLv9E/une Ku4e4u35VcYgdv+z9RBdlya578Pq7kzrjDpK8qrquVwiTt/pRA1pxbITlEbIwnPQRRmN Sfo/Y5A9Vm+4Gxac3HCLlVABCt0qy3VIz+0spDF2kpJ31mW0pNSrVkI9kriquOxcHFo9 /X/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=19YeYuGMdrBP8BcBy6qvZnJ7POtkzTzxfbLYppbf8ls=; b=qCfnuXjUleobNolM1/Ke9n3auRcLMvlNIfhU5FeMLckV8wKOW9Ka3nQXy8aHikx52v 9+j64ZTeaQP9MpJZLrQCUnnpaMtkXauYSb0IyhBzBg8BZCo+5PEsJKUmqCzoUbHYjbCd /246cSIid/X2nmQ+8uXVRSgTYzIWcfJGls+tZy+YvOdisrG4IALq54is0+nvdPs9+VmJ A4nTwXII7Agrkz/w7rNTv45UmYiXtmjYlgGxkFnjSaWpjWOMMVgU524xfoKld6YZaUi0 UWMxspf0AfuQTAOw3SL6ufSPYDj79oaGLkk2LuUsJsrdGKJvzxBOUGi3jVyk9Ne+QLds euKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=XTaBro+q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c15-20020a624e0f000000b0063354a65327si7486381pfb.395.2023.06.06.16.21.18; Tue, 06 Jun 2023 16:21:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=XTaBro+q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240213AbjFFXOk (ORCPT + 99 others); Tue, 6 Jun 2023 19:14:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240224AbjFFXO0 (ORCPT ); Tue, 6 Jun 2023 19:14:26 -0400 Received: from mail-qk1-x730.google.com (mail-qk1-x730.google.com [IPv6:2607:f8b0:4864:20::730]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C31D1706 for ; Tue, 6 Jun 2023 16:14:24 -0700 (PDT) Received: by mail-qk1-x730.google.com with SMTP id af79cd13be357-75da00a1eddso358228485a.3 for ; Tue, 06 Jun 2023 16:14:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1686093263; x=1688685263; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=19YeYuGMdrBP8BcBy6qvZnJ7POtkzTzxfbLYppbf8ls=; b=XTaBro+qytTMBqU4ZbSvlbNy8RGzZcUL1hgm8bVRNKP/7A3xPDL42lLvyHseJANKCy 3VDmAAs0LZkqKpNgE5+LTNVTQ0u0ZVgTUMXoCyymgVb+jSiuFFCBRDr+/YPPQ2htNnSs PbVPW35NL0hJnD+X5ClGbPmqR/iKL0K6hQMJo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686093263; x=1688685263; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=19YeYuGMdrBP8BcBy6qvZnJ7POtkzTzxfbLYppbf8ls=; b=CgBZrOWVdXnmUuAy5GKCv0Lsc5Ll6eIEtpGXvdF5YzUng8O1lsUNr/AcMtCmoRyA32 bdDPKHXyjtrxMmtXPJJqL2RYPdQyyRLa3IMocP46cjlZiPBcvgSoFCEPgxZmAGT/HdZQ N0cdM4IiwUEoFlWURRHjy/RQACbTnuSQ5KEUu86ce9zH3nOGtbOzK7Dr/TGeTXJZWMNO 0sZmaGIbq/m2viGW3+dYP6ht7yLt5bcm7fWfTYLbEvM7fn309m8AjDUnUlFpA6L+JZ9i S1x76Abu/9+7EwAzkzt+3dm2v22f7YUSg4C88Z0DCY2RE183eMq8Nq2erPVc8Ymw2iBm BO1Q== X-Gm-Message-State: AC+VfDzfwFahoci6CDH8MDuvmChu0aqaHsKe+MY53coSIFWR8S7oXQk7 yU+DH1hNx6r5YGXMNYYy837mrA== X-Received: by 2002:a05:620a:88a:b0:75d:4699:756e with SMTP id b10-20020a05620a088a00b0075d4699756emr110283qka.56.1686093263318; Tue, 06 Jun 2023 16:14:23 -0700 (PDT) Received: from ubuntu-22.localdomain ([192.19.222.250]) by smtp.gmail.com with ESMTPSA id x9-20020ae9e909000000b0075b23e55640sm5221519qkf.123.2023.06.06.16.14.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jun 2023 16:14:22 -0700 (PDT) From: William Zhang To: Broadcom Kernel List , Linux MTD List Cc: f.fainelli@gmail.com, rafal@milecki.pl, kursad.oney@broadcom.com, joel.peshkin@broadcom.com, computersforpeace@gmail.com, anand.gore@broadcom.com, dregan@mail.com, kamal.dasu@broadcom.com, tomer.yacoby@broadcom.com, dan.beygelman@broadcom.com, William Zhang , Florian Fainelli , Miquel Raynal , linux-kernel@vger.kernel.org, Vignesh Raghavendra , Richard Weinberger , Kamal Dasu Subject: [PATCH 03/12] mtd: rawnand: brcmnand: Fix crash during the panic_write Date: Tue, 6 Jun 2023 16:12:43 -0700 Message-Id: <20230606231252.94838-4-william.zhang@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230606231252.94838-1-william.zhang@broadcom.com> References: <20230606231252.94838-1-william.zhang@broadcom.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767997381185680919?= X-GMAIL-MSGID: =?utf-8?q?1767997381185680919?= During the panic write path to execute another nand command, if there is a pending command, we should wait for the command instead of calling BUG_ON so we don't crash while crashing. Fixes: 27c5b17cd1b1 ("mtd: nand: add NAND driver "library" for Broadcom STB NAND controller") Signed-off-by: William Zhang Reviewed-by: Florian Fainelli Reviewed-by: Kursad Oney Reviewed-by: Kamal Dasu --- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c index b6346a8b9833..20832857c4aa 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c @@ -1608,7 +1608,17 @@ static void brcmnand_send_cmd(struct brcmnand_host *host, int cmd) dev_dbg(ctrl->dev, "send native cmd %d addr 0x%llx\n", cmd, cmd_addr); - BUG_ON(ctrl->cmd_pending != 0); + /* + * If we came here through _panic_write and there is a pending + * command, try to wait for it. If it times out, rather than + * hitting BUG_ON, just return so we don't crash while crashing. + */ + if (oops_in_progress) { + if (ctrl->cmd_pending && + bcmnand_ctrl_poll_status(ctrl, NAND_CTRL_RDY, NAND_CTRL_RDY, 0)) + return; + } else + BUG_ON(ctrl->cmd_pending != 0); ctrl->cmd_pending = cmd; ret = bcmnand_ctrl_poll_status(ctrl, NAND_CTRL_RDY, NAND_CTRL_RDY, 0); From patchwork Tue Jun 6 23:12:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Zhang X-Patchwork-Id: 104140 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3731182vqr; Tue, 6 Jun 2023 16:20:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5pQ1m5pfjwKZBeiY/LirafmnkakIUE0o0hO7J5tiAxX8grG/afpMrcthXHqNNrVq4ITVGo X-Received: by 2002:a05:6359:324:b0:129:c2dc:1bcb with SMTP id ef36-20020a056359032400b00129c2dc1bcbmr645245rwb.1.1686093639677; Tue, 06 Jun 2023 16:20:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686093639; cv=none; d=google.com; s=arc-20160816; b=kouk/prPTVIrFpMQrHdZIypG5J52TpH3xusSr96bsksL5oqL0eMEbwEtT5nANqjmSi fjvf3YqNjJJ7+4H5oGO/Kr1vUktQM5k990ZtLq4Ximvzj868hg93toYRaXg65iEfw6gC I2+TMXdh7FFPggq74QkiFXBLfJ8evftETp1Hq1D5ptqVxRl2pzfxJ0BFhl3g/fF5p8aD faIPN5e5CttmHj4CcBAhHK3jGSGUh100wfe3Z7wSYBzq0yItSUAOShML1zGXgrjaknVo 6bmnP0UxA9AxzLFA5PEYx3ua02ZUhMDYdgfOEdKK4IfaPXMB0yKpw9WMzi2TIIJEjWcA Ee/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Y/bt+LEczbR9ZUUhvtsOE3sTva/F2otJWZaeIMwxWEk=; b=gwiFTbLvrQvCImR9HpHaJRE7AXDrNXggSv4WBxh6syn75Onnfxm2k5mGC+xyhk9OlW EzxQwVKwUBNke2es/43SMVZ7lb7+T0S5o9Pb7PJ+7NBcuQYfM98ZQYRo6NzLeJFOEF5c 7YlhcQHXzSugWhKQ7Keib12PWrv7swPgu0JTkLe1J4uOd8A9qjSAYxfmD1Wx3Dicnmz3 M05ChTT1OCDJRR1JzgTem4FW5NTtvtafI9BDeVrf8tXGXqDXGTeXTwVrZhiAyq1PlWFe weLeYV+dxWiv5v54eWz3OEUaJ4jW7W9p5uKKE4NOMnzhn2Zs8p9jrs5ENXU72s7WXFgE j/jA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=IcvpTxqz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ca5-20020a17090af30500b00255d8dda719si106059pjb.148.2023.06.06.16.20.24; Tue, 06 Jun 2023 16:20:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=IcvpTxqz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240234AbjFFXOq (ORCPT + 99 others); Tue, 6 Jun 2023 19:14:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240217AbjFFXOe (ORCPT ); Tue, 6 Jun 2023 19:14:34 -0400 Received: from mail-qk1-x72e.google.com (mail-qk1-x72e.google.com [IPv6:2607:f8b0:4864:20::72e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7252C19A0 for ; Tue, 6 Jun 2023 16:14:27 -0700 (PDT) Received: by mail-qk1-x72e.google.com with SMTP id af79cd13be357-75d5051fad3so459497985a.3 for ; Tue, 06 Jun 2023 16:14:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1686093266; x=1688685266; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=Y/bt+LEczbR9ZUUhvtsOE3sTva/F2otJWZaeIMwxWEk=; b=IcvpTxqz3X3uEzw7gAkqP2liMCfJ2uugzeIKp6t36GLVNCcdf6xV5178qrmEUAsyOX mLvx6qrqCfXcUN/hqyEGHOmAzXMv4b6GKoGR1aWaxPc9mrIvr9BAVVVv5Eis1QBj2qYb mif4GWt4gIjcabQYs+fXdHxksx8EP8zVHs2IY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686093266; x=1688685266; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Y/bt+LEczbR9ZUUhvtsOE3sTva/F2otJWZaeIMwxWEk=; b=MzsmuL2J3jqemKM0SllD1LOOEMn2sMsQfwD3+EGqOrpApQviNBL+w9QmnyKsVrdPZB uikCiwHSomFBbLDk7IEtDxbevqgi13bWT95QHg0EdffUUmJd+FfiRx4wXGcF+GBqZOG4 2von6T7PLvyL17fAC6yutTf/2516cPWiX8r0jDprmDouM+fVn8mTp/5HjPfQOEp+T1wG 2Vbtd5loOO4KSwUjrvNTgxuIoyYZ4DY3t6MZ+7n5jCsfaQkLrxBLPNELVNI+HRr7zqxL j98C/R7V84NhuS2KgngoICvzm8UA2iWWy/glgHZ49TgiPeRbQkcZlw5+ylsVXxnCPF4q wN7Q== X-Gm-Message-State: AC+VfDxjYSXE86BmjhEMPO0qT/3nS5zoJ8C6rF9B4/Ke2AuZkdvBiJIg gcT72sd/YkdbSILO/amTfKB1h2bJYK1DTvi2Oh4= X-Received: by 2002:a05:620a:6285:b0:75d:5446:3bff with SMTP id ov5-20020a05620a628500b0075d54463bffmr132327qkn.55.1686093266463; Tue, 06 Jun 2023 16:14:26 -0700 (PDT) Received: from ubuntu-22.localdomain ([192.19.222.250]) by smtp.gmail.com with ESMTPSA id x9-20020ae9e909000000b0075b23e55640sm5221519qkf.123.2023.06.06.16.14.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jun 2023 16:14:25 -0700 (PDT) From: William Zhang To: Broadcom Kernel List , Linux MTD List Cc: f.fainelli@gmail.com, rafal@milecki.pl, kursad.oney@broadcom.com, joel.peshkin@broadcom.com, computersforpeace@gmail.com, anand.gore@broadcom.com, dregan@mail.com, kamal.dasu@broadcom.com, tomer.yacoby@broadcom.com, dan.beygelman@broadcom.com, William Zhang , Florian Fainelli , Miquel Raynal , linux-kernel@vger.kernel.org, Vignesh Raghavendra , Richard Weinberger , Kamal Dasu Subject: [PATCH 04/12] mtd: rawnand: brcmnand: Fix potential out-of-bounds access in oob write Date: Tue, 6 Jun 2023 16:12:44 -0700 Message-Id: <20230606231252.94838-5-william.zhang@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230606231252.94838-1-william.zhang@broadcom.com> References: <20230606231252.94838-1-william.zhang@broadcom.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767997324144368498?= X-GMAIL-MSGID: =?utf-8?q?1767997324144368498?= When the oob buffer length is not in multiple of words, the oob write function does out-of-bounds read on the oob source buffer at the last iteration. Fix that by always checking length limit on the oob buffer read and fill with 0xff when reaching the end of the buffer to the oob registers. Fixes: 27c5b17cd1b1 ("mtd: nand: add NAND driver "library" for Broadcom STB NAND controller") Signed-off-by: William Zhang Reviewed-by: Florian Fainelli --- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c index 20832857c4aa..d920e88c7f5b 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c @@ -1486,10 +1486,10 @@ static int write_oob_to_regs(struct brcmnand_controller *ctrl, int i, for (j = 0; j < tbytes; j += 4) oob_reg_write(ctrl, j, - (oob[j + 0] << 24) | - (oob[j + 1] << 16) | - (oob[j + 2] << 8) | - (oob[j + 3] << 0)); + (((j < tbytes) ? oob[j] : 0xff) << 24) | + (((j + 1 < tbytes) ? oob[j + 1] : 0xff) << 16) | + (((j + 2 < tbytes) ? oob[j + 2] : 0xff) << 8) | + ((j + 3 < tbytes) ? oob[j + 3] : 0xff)); return tbytes; } From patchwork Tue Jun 6 23:12:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Zhang X-Patchwork-Id: 104141 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3731181vqr; Tue, 6 Jun 2023 16:20:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5+QPSCxpkJfxaIteE9pvZJwVPCiEVXMAAT36ErhlhxJbEdt33TPiH0FSE8YM6+bRqL8qVg X-Received: by 2002:a05:6808:7cd:b0:39b:e5fe:abe8 with SMTP id f13-20020a05680807cd00b0039be5feabe8mr2891025oij.50.1686093639465; Tue, 06 Jun 2023 16:20:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686093639; cv=none; d=google.com; s=arc-20160816; b=wFZH3iIp+ZAaxwbFKR2XWSg0r0D/GAeJ62IQX9H5dy1THxzCoUH5ffMr2oniwirPoh ZCVZnWtJiKD/AnZYGwQYPplyuw/4ZR+i+G2tdDbm3058+mtjR67Gyn1MVg8GUsbCLYm9 bqWQknT7SMXFlW3VF5i2Ph4IKHB3ZPqoGQ+Z5mooRaoYhaNn+FA6u2DdtpYRK2AFAhkd jJM8oC9M/g06qXi9wjf1J90tdu6+ei1CQ7ZelkVrB+wGyYlAZbCNtOnaCIje2T0760cA T+VsBJEBzA/XMmhyWUqZBeJIxgAExwZpt62Ii269enSZj8Gwnd7MYRrkwvQDT5rvw6VY Ig/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=aMp9SteW8CjamwuG8H9GTcy/ftn8hurCHArp4vYinYo=; b=sK0kor/IY13TP1U6fVjKjOTi0BbU/VgJJc7LNmGaln8fyzGRZbkHg9Ta4O2/3K6AQM 4s4VYmjaeyQTJZRTLNNPamYQct3QZu8snCJCma+sV9I9inckmgtMn7yKN9LcEQ3luHyp cOnfYYn5DXH2syE/ddhVGnj5MPxk7LGn7LAH37HLydkE0x37WXLisK7Y4alACWiC+TTQ /Xrtha18Fj4tABQ7xDQPD1WWjiOHCGbIjln0sViUDU7nQ+nF/XLh2x8wu3bWQJEMYk+h aZeEVwkyNxFautG9bh/kUN70dhJS29ZGe47OEr31MCoJbmNqWEgTSjd2mRgF6aQnX5b1 apuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=M2gHeeds; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jj6-20020a170903048600b001ae5fcecb49si7704102plb.25.2023.06.06.16.20.24; Tue, 06 Jun 2023 16:20:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=M2gHeeds; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240287AbjFFXOz (ORCPT + 99 others); Tue, 6 Jun 2023 19:14:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240242AbjFFXOg (ORCPT ); Tue, 6 Jun 2023 19:14:36 -0400 Received: from mail-qk1-x72f.google.com (mail-qk1-x72f.google.com [IPv6:2607:f8b0:4864:20::72f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 492E919AA for ; Tue, 6 Jun 2023 16:14:30 -0700 (PDT) Received: by mail-qk1-x72f.google.com with SMTP id af79cd13be357-75d518f6f74so300481085a.1 for ; Tue, 06 Jun 2023 16:14:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1686093269; x=1688685269; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=aMp9SteW8CjamwuG8H9GTcy/ftn8hurCHArp4vYinYo=; b=M2gHeedsV5IdVtiM7jw/TqfKl9/5D88h5DlV00xP1TBx9iXNmCe0NPd1fz+kW78LN9 7e9oy8RbHJoGlaaKmGqqSxuVT1s5tIRudbB6PUGNKQYUyV1M8VSq6sKGATBCo31FmjI5 3WkN5A/XWpo+we1FZgmazCvScf3dPVODa+nIs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686093269; x=1688685269; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=aMp9SteW8CjamwuG8H9GTcy/ftn8hurCHArp4vYinYo=; b=clWufWiQoXsF5C2khk1/AXCIXh1PVyR78cCW7G5VEtI+6f0nZHhIyR4cfktMttpLQB r8sPHcpCaQxPu58ey0BpGyx3rL9pPPlFAcFe1qesA5DN13bd8KLI537+bLdGVcO8uD+q Pb4AvctMHOszxf/nAFhh/0PU12/+kkBdE9aMrnIIYvVzGBkgEbFcTxpgAhdxCqx8iEqK tzGF5tqGtASPMW9hWv3F188c+0N/O6In8kOU7jdbl9lMPsioCkISraUctNukLr1DHfVa epmp6mqPIwCIW6tlkjba5+X+Ev1fXNTdhO/nHaZz/ztm7d7mp5BHWOpySwCy0G9PPOqJ VHrQ== X-Gm-Message-State: AC+VfDwaJAmQFZFPFRqZYTuZsSlWBj+wEaYNhq459dhdQOtMgJf4K6Vr sczzOU2xUb7AOgcJMFx0PQGzUQ== X-Received: by 2002:a05:620a:2995:b0:75e:b8b2:3373 with SMTP id r21-20020a05620a299500b0075eb8b23373mr337281qkp.12.1686093269378; Tue, 06 Jun 2023 16:14:29 -0700 (PDT) Received: from ubuntu-22.localdomain ([192.19.222.250]) by smtp.gmail.com with ESMTPSA id x9-20020ae9e909000000b0075b23e55640sm5221519qkf.123.2023.06.06.16.14.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jun 2023 16:14:28 -0700 (PDT) From: William Zhang To: Broadcom Kernel List , Linux MTD List Cc: f.fainelli@gmail.com, rafal@milecki.pl, kursad.oney@broadcom.com, joel.peshkin@broadcom.com, computersforpeace@gmail.com, anand.gore@broadcom.com, dregan@mail.com, kamal.dasu@broadcom.com, tomer.yacoby@broadcom.com, dan.beygelman@broadcom.com, William Zhang , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski , Vignesh Raghavendra , Miquel Raynal , Richard Weinberger , Kamal Dasu , Rob Herring Subject: [PATCH 05/12] dt-bindings: mtd: brcmnand: Updates for bcmbca SoCs Date: Tue, 6 Jun 2023 16:12:45 -0700 Message-Id: <20230606231252.94838-6-william.zhang@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230606231252.94838-1-william.zhang@broadcom.com> References: <20230606231252.94838-1-william.zhang@broadcom.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767997324095899046?= X-GMAIL-MSGID: =?utf-8?q?1767997324095899046?= Use new compatiable brcm,nand-bcmbca to support BCMBCA broadband product. The old compatible string is still kept in the driver so old dtb can still work. Add brcm,nand-use-wp property to have an option for disabling this feature on broadband board design that does not use write protection. Add brcm,nand-ecc-use-strap to get ecc setting from board strap for broadband board designs because they do not specify ecc setting in dts but rather using the strap setting. Remove the requirement of interrupts and interrupt-names properties to reflect the driver code. This patch also includes a few minor fixes to the BCM63xx compatibles and add myself to the list of maintainers. Signed-off-by: William Zhang --- .../bindings/mtd/brcm,brcmnand.yaml | 64 +++++++++++++------ 1 file changed, 43 insertions(+), 21 deletions(-) diff --git a/Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml b/Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml index 1571024aa119..1fe1c166a9db 100644 --- a/Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml +++ b/Documentation/devicetree/bindings/mtd/brcm,brcmnand.yaml @@ -9,6 +9,7 @@ title: Broadcom STB NAND Controller maintainers: - Brian Norris - Kamal Dasu + - William Zhang description: | The Broadcom Set-Top Box NAND controller supports low-level access to raw NAND @@ -18,9 +19,10 @@ description: | supports basic PROGRAM and READ functions, among other features. This controller was originally designed for STB SoCs (BCM7xxx) but is now - available on a variety of Broadcom SoCs, including some BCM3xxx, BCM63xx, and - iProc/Cygnus. Its history includes several similar (but not fully register - compatible) versions. + available on a variety of Broadcom SoCs, including some BCM3xxx, MIPS based + Broadband SoC (BCM63xx), ARM based Broadband SoC (BCMBCA) and iProc/Cygnus. + Its history includes several similar (but not fully register compatible) + versions. -- Additional SoC-specific NAND controller properties -- @@ -53,9 +55,9 @@ properties: - brcm,brcmnand-v7.2 - brcm,brcmnand-v7.3 - const: brcm,brcmnand - - description: BCM63138 SoC-specific NAND controller + - description: BCMBCA SoC-specific NAND controller items: - - const: brcm,nand-bcm63138 + - const: brcm,nand-bcmbca - enum: - brcm,brcmnand-v7.0 - brcm,brcmnand-v7.1 @@ -65,11 +67,15 @@ properties: - const: brcm,nand-iproc - const: brcm,brcmnand-v6.1 - const: brcm,brcmnand - - description: BCM63168 SoC-specific NAND controller + - description: BCM63xx SoC-specific NAND controller items: - - const: brcm,nand-bcm63168 - - const: brcm,nand-bcm6368 - - const: brcm,brcmnand-v4.0 + - enum: + - brcm,nand-bcm63168 + - brcm,nand-bcm6368 + - enum: + - brcm,brcmnand-v2.1 + - brcm,brcmnand-v2.2 + - brcm,brcmnand-v4.0 - const: brcm,brcmnand reg: @@ -111,6 +117,19 @@ properties: earlier versions of this core that include WP type: boolean + brcm,nand-use-wp: + description: + Use this integer to indicate if board design uses + controller's write protection feature and connects its + NAND_WPb pin to nand chip's WP_L pin. Driver defaults to + use this feature when this property does not exist. + Set to 0 if WP pins are not connected and feature is not + used. Set to 1 if WP pins are connected and feature is used. + Set to 2 if WP pins are connected but disable this feature + through driver that sets controller to output high on NAND_WPb. + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1, 2] + patternProperties: "^nand@[a-f0-9]$": type: object @@ -136,13 +155,23 @@ patternProperties: layout. $ref: /schemas/types.yaml#/definitions/uint32 + brcm,nand-ecc-use-strap: + description: + This flag is used by the driver to get the ecc strength and + spare area size from the SoC NAND boot strap setting. This + is commonly used by the BCMBCA SoC board design. If ecc + strength and spare area size are set by nand-ecc-strength + and brcm,nand-oob-sector-size in the dts, these settings + have precedence and override this flag. + $ref: /schemas/types.yaml#/definitions/flag + allOf: - $ref: nand-controller.yaml# - if: properties: compatible: contains: - const: brcm,nand-bcm63138 + const: brcm,nand-bcmbca then: properties: reg-names: @@ -153,7 +182,9 @@ allOf: properties: compatible: contains: - const: brcm,nand-bcm6368 + enum: + - brcm,nand-bcm63168 + - brcm,nand-bcm6368 then: properties: reg-names: @@ -173,20 +204,12 @@ allOf: - const: nand - const: iproc-idm - const: iproc-ext - - if: - properties: - interrupts: - minItems: 2 - then: - required: - - interrupt-names unevaluatedProperties: false required: - reg - reg-names - - interrupts examples: - | @@ -215,8 +238,7 @@ examples: }; - | nand-controller@10000200 { - compatible = "brcm,nand-bcm63168", "brcm,nand-bcm6368", - "brcm,brcmnand-v4.0", "brcm,brcmnand"; + compatible = "brcm,nand-bcm6368", "brcm,brcmnand-v2.1", "brcm,brcmnand"; reg = <0x10000200 0x180>, <0x100000b0 0x10>, <0x10000600 0x200>; From patchwork Tue Jun 6 23:12:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Zhang X-Patchwork-Id: 104142 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3731188vqr; Tue, 6 Jun 2023 16:20:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Dg2ftQARZ+DsJrk0NL14zvo9LRcnKSObRDoTBUWwu+WidG/fr4OHgjwJk6ggEprJpioVv X-Received: by 2002:a17:90a:2c44:b0:256:7d07:c8a1 with SMTP id p4-20020a17090a2c4400b002567d07c8a1mr14072232pjm.12.1686093640783; Tue, 06 Jun 2023 16:20:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686093640; cv=none; d=google.com; s=arc-20160816; b=wdC8SpliuxgPS3yhsoEIQb2yHkkgt4V1yP32Y7c6pjSx2oLvxBF9fhn5bTK7lkVsbw 28Y/WFtkb7Ti+5h52oSIaiPX2xbL6FJpS2f3Z/remmUTjBS4WIpGu4DWyncRUCUE2v40 YfrcaQDFvEHkCgGkZSTpq2rua/FyvdzzaTcX0Bp5nw69mgL4gR41cvL+JOVhqjps/rrM 01UrQjIrVe3pSx58/1GrrixSjqOMpZSPm6ViR3dN8VVhWkyJfWWL8Ihs7/13otaQXepn oP5v1bG65S8GSC3nkN4Q1KymbYannsV4UqQH4/+wPjfR4edH8lB5ybbMmyaE78UIr/wN Oxkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=G1D+ZZl57XcAjvEIoiWhYXbvP23LFWEXXRH05IDdY1o=; b=CkILXq3cU46d5oVRHXYggrMw3tpNyaLRV0/8Exa7LJzoY9WRZIUr0TLtNOjkbOIbE6 GEPlUYw/BWXpqInRWOCN/fG/bLnX8KNXQNixwFe23DUxaItOpkCkqGgLtXo/c4WgaN5G 4dCbD+sD27wrCiw0fdKPVudAELX4o41TBQcG5IKcXLESdRHVpzXlSkOwlJESjjFmwuX5 ndRIXd5aa60SyBJmSaGT0Kh+APgeQeOkhnWDgFQYYDIn7Hbc1QacrpAFRBI6Ls7JBBwr duhohEa1aX2LNCEtOr4HJKd0Ob4WQ5y1ee7DLC5tJwhqnbrGu0XeVCGSvZTzXLXXltAW 0TDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b="VxdTLL7/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s199-20020a632cd0000000b00543d32ee960si2511851pgs.594.2023.06.06.16.20.25; Tue, 06 Jun 2023 16:20:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b="VxdTLL7/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240228AbjFFXPD (ORCPT + 99 others); Tue, 6 Jun 2023 19:15:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240251AbjFFXOi (ORCPT ); Tue, 6 Jun 2023 19:14:38 -0400 Received: from mail-qk1-x733.google.com (mail-qk1-x733.google.com [IPv6:2607:f8b0:4864:20::733]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C7C619B1 for ; Tue, 6 Jun 2023 16:14:32 -0700 (PDT) Received: by mail-qk1-x733.google.com with SMTP id af79cd13be357-75ec541f933so2303085a.0 for ; Tue, 06 Jun 2023 16:14:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1686093272; x=1688685272; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=G1D+ZZl57XcAjvEIoiWhYXbvP23LFWEXXRH05IDdY1o=; b=VxdTLL7//jitKwVOceczR3KBuZSUHjmMc48N1+BFf7yPsoXAfLCw8iSx1oYg+Ql+Xf eP2xzm/TCeHRseONPGwPx/IMF2gvgjBPKxI+hn/jra73ZAP+n5TiOFMNlKqV5+IPrZ5r QLKdD+2VXgjgS5YvFAUiopVDMAetmw2MsWpjU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686093272; x=1688685272; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=G1D+ZZl57XcAjvEIoiWhYXbvP23LFWEXXRH05IDdY1o=; b=kA46s8hwiKSikvGwuQY+qZOBtZ4+kKbhYvC0yObssTj8uy2+9KO631A3fgJA6pgB2L 6erU+OvvX2dOX4nGUjElH38PIByQPdga6NV2pDt29TpORF0A6fvlZtnjPu9VYtMpoa5B UM5FHBH0mWv9N1pR/mD1UyXXbfGK6FcIiezKXQM0fW3JgxfEdTi+rIX+s7genrMVPGxr wqKuxd8wACEhlKKxEk8NGWZ4n9uGIYQpvTS/3OA6NFt5ulasBrVGuL+hlK8c3y7LTGuS US7DMR3eHa4y7tgCO4/NQeqhIkSNIlPHC2SywKzPsjtDkshGOBaIDQSPTDFTeWEk8X++ JdCw== X-Gm-Message-State: AC+VfDyHinSdRVUbW8nuofQ8l+3rh44rDEgKWs2aURYYGyBXiJNAbD1m bVTHPU9i9aZ34BZPWNwvdshVig== X-Received: by 2002:a37:e112:0:b0:75e:5141:f403 with SMTP id c18-20020a37e112000000b0075e5141f403mr12459qkm.23.1686093271889; Tue, 06 Jun 2023 16:14:31 -0700 (PDT) Received: from ubuntu-22.localdomain ([192.19.222.250]) by smtp.gmail.com with ESMTPSA id x9-20020ae9e909000000b0075b23e55640sm5221519qkf.123.2023.06.06.16.14.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jun 2023 16:14:31 -0700 (PDT) From: William Zhang To: Broadcom Kernel List , Linux MTD List Cc: f.fainelli@gmail.com, rafal@milecki.pl, kursad.oney@broadcom.com, joel.peshkin@broadcom.com, computersforpeace@gmail.com, anand.gore@broadcom.com, dregan@mail.com, kamal.dasu@broadcom.com, tomer.yacoby@broadcom.com, dan.beygelman@broadcom.com, William Zhang , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski , Rob Herring , linux-arm-kernel@lists.infradead.org Subject: [PATCH 06/12] ARM: dts: broadcom: bcmbca: Add NAND controller node Date: Tue, 6 Jun 2023 16:12:46 -0700 Message-Id: <20230606231252.94838-7-william.zhang@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230606231252.94838-1-william.zhang@broadcom.com> References: <20230606231252.94838-1-william.zhang@broadcom.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767997325635700496?= X-GMAIL-MSGID: =?utf-8?q?1767997325635700496?= Add support for Broadcom STB NAND controller in BCMBCA ARMv7 chip dts files. Signed-off-by: William Zhang --- arch/arm/boot/dts/bcm47622.dtsi | 17 +++++++++++++++++ arch/arm/boot/dts/bcm63138.dtsi | 12 ++++++++++-- arch/arm/boot/dts/bcm63148.dtsi | 17 +++++++++++++++++ arch/arm/boot/dts/bcm63178.dtsi | 17 +++++++++++++++++ arch/arm/boot/dts/bcm6756.dtsi | 17 +++++++++++++++++ arch/arm/boot/dts/bcm6846.dtsi | 17 +++++++++++++++++ arch/arm/boot/dts/bcm6855.dtsi | 17 +++++++++++++++++ arch/arm/boot/dts/bcm6878.dtsi | 17 +++++++++++++++++ arch/arm/boot/dts/bcm947622.dts | 4 ++++ arch/arm/boot/dts/bcm963138.dts | 4 ++++ arch/arm/boot/dts/bcm963138dvt.dts | 12 +++++------- arch/arm/boot/dts/bcm963148.dts | 4 ++++ arch/arm/boot/dts/bcm963178.dts | 4 ++++ arch/arm/boot/dts/bcm96756.dts | 4 ++++ arch/arm/boot/dts/bcm96846.dts | 4 ++++ arch/arm/boot/dts/bcm96855.dts | 4 ++++ arch/arm/boot/dts/bcm96878.dts | 4 ++++ 17 files changed, 166 insertions(+), 9 deletions(-) diff --git a/arch/arm/boot/dts/bcm47622.dtsi b/arch/arm/boot/dts/bcm47622.dtsi index cd25ed2757b7..401e1ce1da6d 100644 --- a/arch/arm/boot/dts/bcm47622.dtsi +++ b/arch/arm/boot/dts/bcm47622.dtsi @@ -137,6 +137,23 @@ hsspi: spi@1000 { status = "disabled"; }; + nand_controller: nand-controller@1800 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "brcm,nand-bcmbca", "brcm,brcmnand-v7.1", "brcm,brcmnand"; + reg = <0x1800 0x600>, <0x2000 0x10>; + reg-names = "nand", "nand-int-base"; + brcm,nand-use-wp = <0>; + status = "disabled"; + + nandcs: nand@0 { + compatible = "brcm,nandcs"; + reg = <0>; + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; + }; + }; + uart0: serial@12000 { compatible = "arm,pl011", "arm,primecell"; reg = <0x12000 0x1000>; diff --git a/arch/arm/boot/dts/bcm63138.dtsi b/arch/arm/boot/dts/bcm63138.dtsi index 93281c47c9ba..2c9939e775fb 100644 --- a/arch/arm/boot/dts/bcm63138.dtsi +++ b/arch/arm/boot/dts/bcm63138.dtsi @@ -224,12 +224,20 @@ hsspi: spi@1000 { nand_controller: nand-controller@2000 { #address-cells = <1>; #size-cells = <0>; - compatible = "brcm,nand-bcm63138", "brcm,brcmnand-v7.0", "brcm,brcmnand"; + compatible = "brcm,nand-bcmbca", "brcm,brcmnand-v7.0", "brcm,brcmnand"; reg = <0x2000 0x600>, <0xf0 0x10>; reg-names = "nand", "nand-int-base"; status = "disabled"; interrupts = ; - interrupt-names = "nand"; + interrupt-names = "nand_ctlrdy"; + brcm,nand-use-wp = <0>; + + nandcs: nand@0 { + compatible = "brcm,nandcs"; + reg = <0>; + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; + }; }; bootlut: bootlut@8000 { diff --git a/arch/arm/boot/dts/bcm63148.dtsi b/arch/arm/boot/dts/bcm63148.dtsi index ba7f265db121..de14d4564b14 100644 --- a/arch/arm/boot/dts/bcm63148.dtsi +++ b/arch/arm/boot/dts/bcm63148.dtsi @@ -118,5 +118,22 @@ hsspi: spi@1000 { num-cs = <8>; status = "disabled"; }; + + nand_controller: nand-controller@2000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "brcm,nand-bcmbca", "brcm,brcmnand-v7.1", "brcm,brcmnand"; + reg = <0x2000 0x600>, <0xf0 0x10>; + reg-names = "nand", "nand-int-base"; + brcm,nand-use-wp = <0>; + status = "disabled"; + + nandcs: nand@0 { + compatible = "brcm,nandcs"; + reg = <0>; + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; + }; + }; }; }; diff --git a/arch/arm/boot/dts/bcm63178.dtsi b/arch/arm/boot/dts/bcm63178.dtsi index d8268a1e889b..ae205408c5cd 100644 --- a/arch/arm/boot/dts/bcm63178.dtsi +++ b/arch/arm/boot/dts/bcm63178.dtsi @@ -128,6 +128,23 @@ hsspi: spi@1000 { status = "disabled"; }; + nand_controller: nand-controller@1800 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "brcm,nand-bcmbca", "brcm,brcmnand-v7.1", "brcm,brcmnand"; + reg = <0x1800 0x600>, <0x2000 0x10>; + reg-names = "nand", "nand-int-base"; + brcm,nand-use-wp = <0>; + status = "disabled"; + + nandcs: nand@0 { + compatible = "brcm,nandcs"; + reg = <0>; + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; + }; + }; + uart0: serial@12000 { compatible = "arm,pl011", "arm,primecell"; reg = <0x12000 0x1000>; diff --git a/arch/arm/boot/dts/bcm6756.dtsi b/arch/arm/boot/dts/bcm6756.dtsi index 49ecc1f0c18c..bbff47172dc1 100644 --- a/arch/arm/boot/dts/bcm6756.dtsi +++ b/arch/arm/boot/dts/bcm6756.dtsi @@ -138,6 +138,23 @@ hsspi: spi@1000 { status = "disabled"; }; + nand_controller: nand-controller@1800 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "brcm,nand-bcmbca", "brcm,brcmnand-v7.1", "brcm,brcmnand"; + reg = <0x1800 0x600>, <0x2000 0x10>; + reg-names = "nand", "nand-int-base"; + brcm,nand-use-wp = <0>; + status = "disabled"; + + nandcs: nand@0 { + compatible = "brcm,nandcs"; + reg = <0>; + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; + }; + }; + uart0: serial@12000 { compatible = "arm,pl011", "arm,primecell"; reg = <0x12000 0x1000>; diff --git a/arch/arm/boot/dts/bcm6846.dtsi b/arch/arm/boot/dts/bcm6846.dtsi index fbc7d3a5dc5f..26a36a577b44 100644 --- a/arch/arm/boot/dts/bcm6846.dtsi +++ b/arch/arm/boot/dts/bcm6846.dtsi @@ -118,5 +118,22 @@ hsspi: spi@1000 { num-cs = <8>; status = "disabled"; }; + + nand_controller: nand-controller@1800 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "brcm,nand-bcmbca", "brcm,brcmnand-v7.1", "brcm,brcmnand"; + reg = <0x1800 0x600>, <0x2000 0x10>; + reg-names = "nand", "nand-int-base"; + brcm,nand-use-wp = <0>; + status = "disabled"; + + nandcs: nand@0 { + compatible = "brcm,nandcs"; + reg = <0>; + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; + }; + }; }; }; diff --git a/arch/arm/boot/dts/bcm6855.dtsi b/arch/arm/boot/dts/bcm6855.dtsi index 5e0fe26530f1..0defcc10ca8a 100644 --- a/arch/arm/boot/dts/bcm6855.dtsi +++ b/arch/arm/boot/dts/bcm6855.dtsi @@ -128,6 +128,23 @@ hsspi: spi@1000 { status = "disabled"; }; + nand_controller: nand-controller@1800 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "brcm,nand-bcmbca", "brcm,brcmnand-v7.1", "brcm,brcmnand"; + reg = <0x1800 0x600>, <0x2000 0x10>; + reg-names = "nand", "nand-int-base"; + brcm,nand-use-wp = <0>; + status = "disabled"; + + nandcs: nand@0 { + compatible = "brcm,nandcs"; + reg = <0>; + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; + }; + }; + uart0: serial@12000 { compatible = "arm,pl011", "arm,primecell"; reg = <0x12000 0x1000>; diff --git a/arch/arm/boot/dts/bcm6878.dtsi b/arch/arm/boot/dts/bcm6878.dtsi index 96529d3d4dc2..f6ae07fe1b44 100644 --- a/arch/arm/boot/dts/bcm6878.dtsi +++ b/arch/arm/boot/dts/bcm6878.dtsi @@ -119,6 +119,23 @@ hsspi: spi@1000 { status = "disabled"; }; + nand_controller: nand-controller@1800 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "brcm,nand-bcmbca", "brcm,brcmnand-v7.1", "brcm,brcmnand"; + reg = <0x1800 0x600>, <0x2000 0x10>; + reg-names = "nand", "nand-int-base"; + brcm,nand-use-wp = <0>; + status = "disabled"; + + nandcs: nand@0 { + compatible = "brcm,nandcs"; + reg = <0>; + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; + }; + }; + uart0: serial@12000 { compatible = "arm,pl011", "arm,primecell"; reg = <0x12000 0x1000>; diff --git a/arch/arm/boot/dts/bcm947622.dts b/arch/arm/boot/dts/bcm947622.dts index 93b8ce22678d..22e3c4508e1a 100644 --- a/arch/arm/boot/dts/bcm947622.dts +++ b/arch/arm/boot/dts/bcm947622.dts @@ -32,3 +32,7 @@ &uart0 { &hsspi { status = "okay"; }; + +&nand_controller { + status = "okay"; +}; diff --git a/arch/arm/boot/dts/bcm963138.dts b/arch/arm/boot/dts/bcm963138.dts index 1b405c249213..450289d47dc7 100644 --- a/arch/arm/boot/dts/bcm963138.dts +++ b/arch/arm/boot/dts/bcm963138.dts @@ -29,3 +29,7 @@ &serial0 { &hsspi { status = "okay"; }; + +&nand_controller { + status = "okay"; +}; diff --git a/arch/arm/boot/dts/bcm963138dvt.dts b/arch/arm/boot/dts/bcm963138dvt.dts index b5af61853a07..f2140e512070 100644 --- a/arch/arm/boot/dts/bcm963138dvt.dts +++ b/arch/arm/boot/dts/bcm963138dvt.dts @@ -33,14 +33,12 @@ &serial1 { &nand_controller { status = "okay"; +}; - nand@0 { - compatible = "brcm,nandcs"; - reg = <0>; - nand-ecc-strength = <4>; - nand-ecc-step-size = <512>; - brcm,nand-oob-sectors-size = <16>; - }; +&nandcs { + nand-ecc-strength = <4>; + nand-ecc-step-size = <512>; + brcm,nand-oob-sectors-size = <16>; }; &ahci { diff --git a/arch/arm/boot/dts/bcm963148.dts b/arch/arm/boot/dts/bcm963148.dts index 1f5d6d783f09..aa08b473c7cd 100644 --- a/arch/arm/boot/dts/bcm963148.dts +++ b/arch/arm/boot/dts/bcm963148.dts @@ -32,3 +32,7 @@ &uart0 { &hsspi { status = "okay"; }; + +&nand_controller { + status = "okay"; +}; diff --git a/arch/arm/boot/dts/bcm963178.dts b/arch/arm/boot/dts/bcm963178.dts index d036e99dd8d1..c0f504ac43a4 100644 --- a/arch/arm/boot/dts/bcm963178.dts +++ b/arch/arm/boot/dts/bcm963178.dts @@ -32,3 +32,7 @@ &uart0 { &hsspi { status = "okay"; }; + +&nand_controller { + status = "okay"; +}; diff --git a/arch/arm/boot/dts/bcm96756.dts b/arch/arm/boot/dts/bcm96756.dts index 8b104f3fb14a..2ce998f2b84f 100644 --- a/arch/arm/boot/dts/bcm96756.dts +++ b/arch/arm/boot/dts/bcm96756.dts @@ -32,3 +32,7 @@ &uart0 { &hsspi { status = "okay"; }; + +&nand_controller { + status = "okay"; +}; diff --git a/arch/arm/boot/dts/bcm96846.dts b/arch/arm/boot/dts/bcm96846.dts index 55852c229608..f4b9a07370ee 100644 --- a/arch/arm/boot/dts/bcm96846.dts +++ b/arch/arm/boot/dts/bcm96846.dts @@ -32,3 +32,7 @@ &uart0 { &hsspi { status = "okay"; }; + +&nand_controller { + status = "okay"; +}; diff --git a/arch/arm/boot/dts/bcm96855.dts b/arch/arm/boot/dts/bcm96855.dts index 2ad880af2104..5c94063bceaf 100644 --- a/arch/arm/boot/dts/bcm96855.dts +++ b/arch/arm/boot/dts/bcm96855.dts @@ -32,3 +32,7 @@ &uart0 { &hsspi { status = "okay"; }; + +&nand_controller { + status = "okay"; +}; diff --git a/arch/arm/boot/dts/bcm96878.dts b/arch/arm/boot/dts/bcm96878.dts index b7af8ade7a9d..910f7e125bad 100644 --- a/arch/arm/boot/dts/bcm96878.dts +++ b/arch/arm/boot/dts/bcm96878.dts @@ -32,3 +32,7 @@ &uart0 { &hsspi { status = "okay"; }; + +&nand_controller { + status = "okay"; +}; From patchwork Tue Jun 6 23:12:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Zhang X-Patchwork-Id: 104146 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3731714vqr; Tue, 6 Jun 2023 16:22:03 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ64uHUohNe8/WtFbzUqBpXVdkJsd3IfTKukZFKrsdAoWfO8mBqbuhrpZEDJvgVm/tS9VYg+ X-Received: by 2002:a05:6808:9ac:b0:39a:a146:8bf1 with SMTP id e12-20020a05680809ac00b0039aa1468bf1mr3679133oig.3.1686093723333; Tue, 06 Jun 2023 16:22:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686093723; cv=none; d=google.com; s=arc-20160816; b=upwM49oN8W8krrRGv+xFKOr45Pnkv80JpuxkBR/1vAg1AO9YcjZGk4Ad0V9zNwixMi +TDJTIqFGcLyFjYYJFHl1WXRuxFn3t0m9MRUbPYWSsuu1iyrM8xa707Z9eIYgDs9B3/G OzLu9XsHUztqTTJf+unKYcwKFLQqDBc19IHFu8Hgaf2QQW6qx3WqgJ0ruPUraY36MlvQ aaZs7Ejyudv4lclbyhL/FF6P8N/+BpfHBgEngeILdKvMsgaRyy3u+tU4PT153pDjGVzM m8jWVE9GvDkHMg8d9P/y4HkrtdJz1Hz52tZ35Ie1lo24QabXoeMbFBkhAEaygQxqywvb Ro8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=3yF2vH9K4yZCXKUIwTltrXNPtNJ4wOFgjfDq693X0yk=; b=s2R83RTEZGZEZNGf98ZKnw6U7uQjQlrZqTMxkUdELCf0/7YfmndN7SUjsAMC3WOSKz xPDx5yXaC1YSGdzMMSo3JVt7Ls9Hp1mU42XmFJLdZIC8Eek0w+/flXHAedvKHXQE93iK Bl1yv5H2wMMsMrY/FJVbIOhY3aBMqLhOsvjabCKYHJ0d5FDXLPhlX0uy0amrP+2Zwelw lTubi0/hpZvMkE0AeW4IcCq0KmmWOCvc4XGCr7aozKXWXUxv7N4eYYfNR/M76jHzewc9 SAHVruAGRFFG0gWYwNqKj2NWSD7AAuG2F/V+535WEivIJk4G9WKwwcUCn3YhGrVvP6nL V4rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=a+bz7LiO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g8-20020aa79dc8000000b0064cecf7b983si7622479pfq.143.2023.06.06.16.21.47; Tue, 06 Jun 2023 16:22:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=a+bz7LiO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240253AbjFFXPF (ORCPT + 99 others); Tue, 6 Jun 2023 19:15:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240223AbjFFXOj (ORCPT ); Tue, 6 Jun 2023 19:14:39 -0400 Received: from mail-qk1-x72c.google.com (mail-qk1-x72c.google.com [IPv6:2607:f8b0:4864:20::72c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2822E19BD for ; Tue, 6 Jun 2023 16:14:36 -0700 (PDT) Received: by mail-qk1-x72c.google.com with SMTP id af79cd13be357-75ebb3d57d0so231329485a.3 for ; Tue, 06 Jun 2023 16:14:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1686093275; x=1688685275; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=3yF2vH9K4yZCXKUIwTltrXNPtNJ4wOFgjfDq693X0yk=; b=a+bz7LiO/BXo0si/YCD/gJqJXIc/NzOBgtZibDMoYBnmiDXtJHSkjLCfJeD+QjRgYs /s5BC81uNnDCj0JRQsrcWt5mYJoxTvOeASk+zgL2bRx4Ef9rAdaGj1PLxJ3iTBAD0GKP rJw/7dY4KkYE+OrZFAMxtqj738dkyOk/wy8bQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686093275; x=1688685275; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=3yF2vH9K4yZCXKUIwTltrXNPtNJ4wOFgjfDq693X0yk=; b=iPkgGfsUPz71/NSF5flkvNPQOTxe5JxI3xIG41ETOq05SedlxzSAJa9ZvUvzMKaUF2 dPorJ8O1HDXR/5ZTpom04E6myszoDt7ofUX/sDun3npy3zAECgHp9YT79PISq3HXtBZW CEDEO6/fZzz4iB7SE+UlP+v0RipAuTZ3JM9Bo5azrL9w3X8JUFw1F0n2+x3gHig1JikX VZQq2kMGgxG6UnnvRHBR5kDHQq0tkf0Bb2UWq7pgEw8oYW/bUL5tiOM9S/XebaAtjcO2 lUn2bjkCm3qWhQ4wIb6j7JFpcz274ZW8o3q6HkBhDXp3znlfmuvQhXYpMnYHqcxwousl Sgcg== X-Gm-Message-State: AC+VfDzSB1czBfO5LP3RGCovU09MKHIsn0L/VV2D5heIfGEZVIM8JWkJ rICHv2ZqXfL+xSRPuxzzBJsdlQ== X-Received: by 2002:a05:620a:2856:b0:75b:23a0:d9f6 with SMTP id h22-20020a05620a285600b0075b23a0d9f6mr89094qkp.76.1686093275107; Tue, 06 Jun 2023 16:14:35 -0700 (PDT) Received: from ubuntu-22.localdomain ([192.19.222.250]) by smtp.gmail.com with ESMTPSA id x9-20020ae9e909000000b0075b23e55640sm5221519qkf.123.2023.06.06.16.14.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jun 2023 16:14:34 -0700 (PDT) From: William Zhang To: Broadcom Kernel List , Linux MTD List Cc: f.fainelli@gmail.com, rafal@milecki.pl, kursad.oney@broadcom.com, joel.peshkin@broadcom.com, computersforpeace@gmail.com, anand.gore@broadcom.com, dregan@mail.com, kamal.dasu@broadcom.com, tomer.yacoby@broadcom.com, dan.beygelman@broadcom.com, William Zhang , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski , Rob Herring , linux-arm-kernel@lists.infradead.org Subject: [PATCH 07/12] arm64: dts: broadcom: bcmbca: Add NAND controller node Date: Tue, 6 Jun 2023 16:12:47 -0700 Message-Id: <20230606231252.94838-8-william.zhang@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230606231252.94838-1-william.zhang@broadcom.com> References: <20230606231252.94838-1-william.zhang@broadcom.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767997411930775569?= X-GMAIL-MSGID: =?utf-8?q?1767997411930775569?= Add support for Broadcom STB NAND controller in BCMBCA ARMv8 chip dts files. Signed-off-by: William Zhang --- .../arm64/boot/dts/broadcom/bcmbca/bcm4908.dtsi | 5 ++++- .../arm64/boot/dts/broadcom/bcmbca/bcm4912.dtsi | 17 +++++++++++++++++ .../boot/dts/broadcom/bcmbca/bcm63146.dtsi | 17 +++++++++++++++++ .../boot/dts/broadcom/bcmbca/bcm63158.dtsi | 17 +++++++++++++++++ .../arm64/boot/dts/broadcom/bcmbca/bcm6813.dtsi | 17 +++++++++++++++++ .../arm64/boot/dts/broadcom/bcmbca/bcm6856.dtsi | 17 +++++++++++++++++ .../arm64/boot/dts/broadcom/bcmbca/bcm6858.dtsi | 17 +++++++++++++++++ .../arm64/boot/dts/broadcom/bcmbca/bcm94912.dts | 4 ++++ .../boot/dts/broadcom/bcmbca/bcm963146.dts | 4 ++++ .../boot/dts/broadcom/bcmbca/bcm963158.dts | 4 ++++ .../arm64/boot/dts/broadcom/bcmbca/bcm96813.dts | 4 ++++ .../arm64/boot/dts/broadcom/bcmbca/bcm96856.dts | 4 ++++ .../arm64/boot/dts/broadcom/bcmbca/bcm96858.dts | 4 ++++ 13 files changed, 130 insertions(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/broadcom/bcmbca/bcm4908.dtsi b/arch/arm64/boot/dts/broadcom/bcmbca/bcm4908.dtsi index 457805efb385..acfedff89d19 100644 --- a/arch/arm64/boot/dts/broadcom/bcmbca/bcm4908.dtsi +++ b/arch/arm64/boot/dts/broadcom/bcmbca/bcm4908.dtsi @@ -591,16 +591,19 @@ hsspi: spi@1000{ nand-controller@1800 { #address-cells = <1>; #size-cells = <0>; - compatible = "brcm,nand-bcm63138", "brcm,brcmnand-v7.1", "brcm,brcmnand"; + compatible = "brcm,nand-bcmbca", "brcm,brcmnand-v7.1", "brcm,brcmnand"; reg = <0x1800 0x600>, <0x2000 0x10>; reg-names = "nand", "nand-int-base"; interrupts = ; interrupt-names = "nand_ctlrdy"; + brcm,nand-use-wp = <0>; status = "okay"; nandcs: nand@0 { compatible = "brcm,nandcs"; reg = <0>; + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; }; }; diff --git a/arch/arm64/boot/dts/broadcom/bcmbca/bcm4912.dtsi b/arch/arm64/boot/dts/broadcom/bcmbca/bcm4912.dtsi index 46aa8c0b7971..7c611c1978ac 100644 --- a/arch/arm64/boot/dts/broadcom/bcmbca/bcm4912.dtsi +++ b/arch/arm64/boot/dts/broadcom/bcmbca/bcm4912.dtsi @@ -137,6 +137,23 @@ hsspi: spi@1000 { status = "disabled"; }; + nand_controller: nand-controller@1800 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "brcm,nand-bcmbca", "brcm,brcmnand-v7.1", "brcm,brcmnand"; + reg = <0x1800 0x600>, <0x2000 0x10>; + reg-names = "nand", "nand-int-base"; + brcm,nand-use-wp = <0>; + status = "disabled"; + + nandcs: nand@0 { + compatible = "brcm,nandcs"; + reg = <0>; + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; + }; + }; + uart0: serial@12000 { compatible = "arm,pl011", "arm,primecell"; reg = <0x12000 0x1000>; diff --git a/arch/arm64/boot/dts/broadcom/bcmbca/bcm63146.dtsi b/arch/arm64/boot/dts/broadcom/bcmbca/bcm63146.dtsi index 7020f2e995e2..faf8b1198d8e 100644 --- a/arch/arm64/boot/dts/broadcom/bcmbca/bcm63146.dtsi +++ b/arch/arm64/boot/dts/broadcom/bcmbca/bcm63146.dtsi @@ -118,6 +118,23 @@ hsspi: spi@1000 { status = "disabled"; }; + nand_controller: nand-controller@1800 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "brcm,nand-bcmbca", "brcm,brcmnand-v7.1", "brcm,brcmnand"; + reg = <0x1800 0x600>, <0x2000 0x10>; + reg-names = "nand", "nand-int-base"; + brcm,nand-use-wp = <0>; + status = "disabled"; + + nandcs: nand@0 { + compatible = "brcm,nandcs"; + reg = <0>; + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; + }; + }; + uart0: serial@12000 { compatible = "arm,pl011", "arm,primecell"; reg = <0x12000 0x1000>; diff --git a/arch/arm64/boot/dts/broadcom/bcmbca/bcm63158.dtsi b/arch/arm64/boot/dts/broadcom/bcmbca/bcm63158.dtsi index 6a0242cbea57..24c344ed5dba 100644 --- a/arch/arm64/boot/dts/broadcom/bcmbca/bcm63158.dtsi +++ b/arch/arm64/boot/dts/broadcom/bcmbca/bcm63158.dtsi @@ -136,6 +136,23 @@ hsspi: spi@1000 { status = "disabled"; }; + nand_controller: nand-controller@1800 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "brcm,nand-bcmbca", "brcm,brcmnand-v7.1", "brcm,brcmnand"; + reg = <0x1800 0x600>, <0x2000 0x10>; + reg-names = "nand", "nand-int-base"; + brcm,nand-use-wp = <0>; + status = "disabled"; + + nandcs: nand@0 { + compatible = "brcm,nandcs"; + reg = <0>; + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; + }; + }; + uart0: serial@12000 { compatible = "arm,pl011", "arm,primecell"; reg = <0x12000 0x1000>; diff --git a/arch/arm64/boot/dts/broadcom/bcmbca/bcm6813.dtsi b/arch/arm64/boot/dts/broadcom/bcmbca/bcm6813.dtsi index 1a12905266ef..c3416146c946 100644 --- a/arch/arm64/boot/dts/broadcom/bcmbca/bcm6813.dtsi +++ b/arch/arm64/boot/dts/broadcom/bcmbca/bcm6813.dtsi @@ -137,6 +137,23 @@ hsspi: spi@1000 { status = "disabled"; }; + nand_controller: nand-controller@1800 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "brcm,nand-bcmbca", "brcm,brcmnand-v7.1", "brcm,brcmnand"; + reg = <0x1800 0x600>, <0x2000 0x10>; + reg-names = "nand", "nand-int-base"; + brcm,nand-use-wp = <0>; + status = "disabled"; + + nandcs: nand@0 { + compatible = "brcm,nandcs"; + reg = <0>; + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; + }; + }; + uart0: serial@12000 { compatible = "arm,pl011", "arm,primecell"; reg = <0x12000 0x1000>; diff --git a/arch/arm64/boot/dts/broadcom/bcmbca/bcm6856.dtsi b/arch/arm64/boot/dts/broadcom/bcmbca/bcm6856.dtsi index f41ebc30666f..ab6866ab6107 100644 --- a/arch/arm64/boot/dts/broadcom/bcmbca/bcm6856.dtsi +++ b/arch/arm64/boot/dts/broadcom/bcmbca/bcm6856.dtsi @@ -107,6 +107,23 @@ uart0: serial@640 { status = "disabled"; }; + nand_controller: nand-controller@1800 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "brcm,nand-bcmbca", "brcm,brcmnand-v7.1", "brcm,brcmnand"; + reg = <0x1800 0x600>, <0x2000 0x10>; + reg-names = "nand", "nand-int-base"; + brcm,nand-use-wp = <0>; + status = "disabled"; + + nandcs: nand@0 { + compatible = "brcm,nandcs"; + reg = <0>; + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; + }; + }; + hsspi: spi@1000 { #address-cells = <1>; #size-cells = <0>; diff --git a/arch/arm64/boot/dts/broadcom/bcmbca/bcm6858.dtsi b/arch/arm64/boot/dts/broadcom/bcmbca/bcm6858.dtsi index fa2688f41f06..390d5da67a3b 100644 --- a/arch/arm64/boot/dts/broadcom/bcmbca/bcm6858.dtsi +++ b/arch/arm64/boot/dts/broadcom/bcmbca/bcm6858.dtsi @@ -155,5 +155,22 @@ hsspi: spi@1000 { num-cs = <8>; status = "disabled"; }; + + nand_controller: nand-controller@1800 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "brcm,nand-bcmbca", "brcm,brcmnand-v7.1", "brcm,brcmnand"; + reg = <0x1800 0x600>, <0x2000 0x10>; + reg-names = "nand", "nand-int-base"; + brcm,nand-use-wp = <0>; + status = "disabled"; + + nandcs: nand@0 { + compatible = "brcm,nandcs"; + reg = <0>; + nand-on-flash-bbt; + brcm,nand-ecc-use-strap; + }; + }; }; }; diff --git a/arch/arm64/boot/dts/broadcom/bcmbca/bcm94912.dts b/arch/arm64/boot/dts/broadcom/bcmbca/bcm94912.dts index e69cd683211a..4d1ea501e384 100644 --- a/arch/arm64/boot/dts/broadcom/bcmbca/bcm94912.dts +++ b/arch/arm64/boot/dts/broadcom/bcmbca/bcm94912.dts @@ -32,3 +32,7 @@ &uart0 { &hsspi { status = "okay"; }; + +&nand_controller { + status = "okay"; +}; diff --git a/arch/arm64/boot/dts/broadcom/bcmbca/bcm963146.dts b/arch/arm64/boot/dts/broadcom/bcmbca/bcm963146.dts index db2c82d6dfd8..810b5a23da7b 100644 --- a/arch/arm64/boot/dts/broadcom/bcmbca/bcm963146.dts +++ b/arch/arm64/boot/dts/broadcom/bcmbca/bcm963146.dts @@ -32,3 +32,7 @@ &uart0 { &hsspi { status = "okay"; }; + +&nand_controller { + status = "okay"; +}; diff --git a/arch/arm64/boot/dts/broadcom/bcmbca/bcm963158.dts b/arch/arm64/boot/dts/broadcom/bcmbca/bcm963158.dts index 25c12bc63545..3aaae5dbb568 100644 --- a/arch/arm64/boot/dts/broadcom/bcmbca/bcm963158.dts +++ b/arch/arm64/boot/dts/broadcom/bcmbca/bcm963158.dts @@ -32,3 +32,7 @@ &uart0 { &hsspi { status = "okay"; }; + +&nand_controller { + status = "okay"; +}; diff --git a/arch/arm64/boot/dts/broadcom/bcmbca/bcm96813.dts b/arch/arm64/boot/dts/broadcom/bcmbca/bcm96813.dts index faba21f03120..6b167cc2af76 100644 --- a/arch/arm64/boot/dts/broadcom/bcmbca/bcm96813.dts +++ b/arch/arm64/boot/dts/broadcom/bcmbca/bcm96813.dts @@ -32,3 +32,7 @@ &uart0 { &hsspi { status = "okay"; }; + +&nand_controller { + status = "okay"; +}; diff --git a/arch/arm64/boot/dts/broadcom/bcmbca/bcm96856.dts b/arch/arm64/boot/dts/broadcom/bcmbca/bcm96856.dts index 9808331eede2..d598cd618b57 100644 --- a/arch/arm64/boot/dts/broadcom/bcmbca/bcm96856.dts +++ b/arch/arm64/boot/dts/broadcom/bcmbca/bcm96856.dts @@ -32,3 +32,7 @@ &uart0 { &hsspi { status = "okay"; }; + +&nand_controller { + status = "okay"; +}; diff --git a/arch/arm64/boot/dts/broadcom/bcmbca/bcm96858.dts b/arch/arm64/boot/dts/broadcom/bcmbca/bcm96858.dts index 1f561c8e13b0..e50ddbf6f58c 100644 --- a/arch/arm64/boot/dts/broadcom/bcmbca/bcm96858.dts +++ b/arch/arm64/boot/dts/broadcom/bcmbca/bcm96858.dts @@ -32,3 +32,7 @@ &uart0 { &hsspi { status = "okay"; }; + +&nand_controller { + status = "okay"; +}; From patchwork Tue Jun 6 23:12:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: William Zhang X-Patchwork-Id: 104149 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3737899vqr; Tue, 6 Jun 2023 16:38:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ43hjNwyM3KdK9+DbjhZmLGcY4/H5F9W7pD8KCDMGhDMayor5A3ljCG9ASwDTbtKeZwlKAY X-Received: by 2002:a17:902:ce88:b0:1b2:3e9f:69d1 with SMTP id f8-20020a170902ce8800b001b23e9f69d1mr3529401plg.18.1686094706702; Tue, 06 Jun 2023 16:38:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686094706; cv=none; d=google.com; s=arc-20160816; b=YDgq3H2FbQRYXxUbXByGp7aLG+KB0PxJVQ9RlMbTVhp/bQ+4gC6UC5Y0X7GwaRwK0N w3JuAJ0qviEJmiMHlANoze613l1/RyD955Z0ME/RsUreM6lkTBaOXottx8lKJDHn4Rbd cECgylEavc9l8rZD/iOTel8bpRrjGhc1NQPg7Y/HcGCLFUtBQbydczEpWfy3GzhaT0wQ Yf5ZmT0jBk/pJb2dV7aV5xJBYmxpXyYMc+6BSHbY+kHfYHCHXPCMXTm5fenkCaSsDF20 TWS2vb0Z8qEEKBwRcP0uL6o4gsIsb5+E6v2QnlHbCIW9YgNVP3ffft0UNkaUuHyPbg53 YoYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=utbFmoxqPeO5DXLP8WjVav4L/gw7BvqTILcaV0zVyU4=; b=zIN78cERICmkKUMpno6PHgXJGA4FD46yOQCKK7KGz67423FntRkb1swcjFsta8P9YL aKib2sgxPQA7emTap95PmrfuUZg8aabTlmbaSbXurz/VKFEdEFEiMkBw+dJu8kR3mF5b aJqRrPvQAVezc36HY/q1RghMuvvJm6hTe4OLzgZ/M7W8COO3J09+xIDez05gLEuak3pJ llFPbwyqxnrA2tkeXpzlMiOZ8Xkv7ijNlYKdEDaLFOAJ3OOlWvVAPkk9bWFTK/sdFaAH U3r9YTq9kkY6y7vVsyfVvGLkTSEmTdBdjnjrU3zPXfSBp66PvFHVDRDJGK2GPs0Xw7TH +88w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=Vanbc2ru; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u7-20020a17090282c700b001b04903dd73si7609066plz.120.2023.06.06.16.38.12; Tue, 06 Jun 2023 16:38:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=Vanbc2ru; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240301AbjFFXPL (ORCPT + 99 others); Tue, 6 Jun 2023 19:15:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240214AbjFFXOk (ORCPT ); Tue, 6 Jun 2023 19:14:40 -0400 Received: from mail-qk1-x733.google.com (mail-qk1-x733.google.com [IPv6:2607:f8b0:4864:20::733]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E477810D4 for ; Tue, 6 Jun 2023 16:14:38 -0700 (PDT) Received: by mail-qk1-x733.google.com with SMTP id af79cd13be357-75ec541f933so2307985a.0 for ; Tue, 06 Jun 2023 16:14:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1686093278; x=1688685278; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=utbFmoxqPeO5DXLP8WjVav4L/gw7BvqTILcaV0zVyU4=; b=Vanbc2ruBfmMjgG1yZD0LJTYV8VbQZWYlFScjG0fAaI2jOW8/2Q4uKh4u8flo98YYk R5aZlhT5UlbXfc+0PwxMofdOt1f4Qamr/bdBK8+PlHbsv/C2LrhkkFbVeogYbKvw/v1A QqEbMUW/BrRK9yrg0kQawsyMA9uMznZymTbhc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686093278; x=1688685278; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=utbFmoxqPeO5DXLP8WjVav4L/gw7BvqTILcaV0zVyU4=; b=GpBzynnFeFC2FLVpglBWTotkv4NYuNCYhlqrGOP+CGMUd56KZN0u0P6MjOQ+9IQsl0 elWgzAStIOCl1ZSBbvwpzpULeJn5yzmG/W8VtNHYo1hYwDBpd8iQTadCaW5vH56H/NPT i+Gh1f+fddT+5oFaX4yYVUghgA5IbU/fTjGwJF+Z/2eETjRiI1Z74BPEiN5PuKvyPZrB NeEMLRaj6O+60rrQnW9ocP5WhZc6f8OeL/VOL3WWbTiXXVduMLQHfnYQ0sxI5BMUieXi bNnEjMfpOZd7VIIOmLilVroUW1FGEQlXWw3zpeyhiCFUBngOEjZ3d7ZsdZQmTdTn3Xen qtMg== X-Gm-Message-State: AC+VfDxrDieSB6hm0+hh+FoMOnnHafcrZCr/d9232o3k8jQm44+L580v rzLjR8ughNBXChKTeO/HhuAxtA== X-Received: by 2002:a05:620a:6186:b0:75e:c7cb:d75d with SMTP id or6-20020a05620a618600b0075ec7cbd75dmr62038qkn.17.1686093278518; Tue, 06 Jun 2023 16:14:38 -0700 (PDT) Received: from ubuntu-22.localdomain ([192.19.222.250]) by smtp.gmail.com with ESMTPSA id x9-20020ae9e909000000b0075b23e55640sm5221519qkf.123.2023.06.06.16.14.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jun 2023 16:14:37 -0700 (PDT) From: William Zhang To: Broadcom Kernel List , Linux MTD List Cc: f.fainelli@gmail.com, rafal@milecki.pl, kursad.oney@broadcom.com, joel.peshkin@broadcom.com, computersforpeace@gmail.com, anand.gore@broadcom.com, dregan@mail.com, kamal.dasu@broadcom.com, tomer.yacoby@broadcom.com, dan.beygelman@broadcom.com, William Zhang , Florian Fainelli , Miquel Raynal , linux-kernel@vger.kernel.org, Vignesh Raghavendra , Richard Weinberger , Kamal Dasu , linux-arm-kernel@lists.infradead.org Subject: [PATCH 08/12] mtd: rawnand: brcmnand: Rename bcm63138 nand driver Date: Tue, 6 Jun 2023 16:12:48 -0700 Message-Id: <20230606231252.94838-9-william.zhang@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230606231252.94838-1-william.zhang@broadcom.com> References: <20230606231252.94838-1-william.zhang@broadcom.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767998442952074652?= X-GMAIL-MSGID: =?utf-8?q?1767998442952074652?= In preparing to support multiple BCMBCA SoCs, rename bcm63138 to bcmbca in the driver code and driver file name. Signed-off-by: William Zhang Acked-by: Florian Fainelli --- drivers/mtd/nand/raw/brcmnand/Makefile | 2 +- drivers/mtd/nand/raw/brcmnand/bcm63138_nand.c | 101 ------------------ drivers/mtd/nand/raw/brcmnand/bcmbca_nand.c | 101 ++++++++++++++++++ 3 files changed, 102 insertions(+), 102 deletions(-) delete mode 100644 drivers/mtd/nand/raw/brcmnand/bcm63138_nand.c create mode 100644 drivers/mtd/nand/raw/brcmnand/bcmbca_nand.c diff --git a/drivers/mtd/nand/raw/brcmnand/Makefile b/drivers/mtd/nand/raw/brcmnand/Makefile index 9907e3ec4bb2..0536568c6467 100644 --- a/drivers/mtd/nand/raw/brcmnand/Makefile +++ b/drivers/mtd/nand/raw/brcmnand/Makefile @@ -2,7 +2,7 @@ # link order matters; don't link the more generic brcmstb_nand.o before the # more specific iproc_nand.o, for instance obj-$(CONFIG_MTD_NAND_BRCMNAND_IPROC) += iproc_nand.o -obj-$(CONFIG_MTD_NAND_BRCMNAND_BCMBCA) += bcm63138_nand.o +obj-$(CONFIG_MTD_NAND_BRCMNAND_BCMBCA) += bcmbca_nand.o obj-$(CONFIG_MTD_NAND_BRCMNAND_BCM63XX) += bcm6368_nand.o obj-$(CONFIG_MTD_NAND_BRCMNAND_BRCMSTB) += brcmstb_nand.o obj-$(CONFIG_MTD_NAND_BRCMNAND) += brcmnand.o diff --git a/drivers/mtd/nand/raw/brcmnand/bcm63138_nand.c b/drivers/mtd/nand/raw/brcmnand/bcm63138_nand.c deleted file mode 100644 index 71ddcc611f6e..000000000000 --- a/drivers/mtd/nand/raw/brcmnand/bcm63138_nand.c +++ /dev/null @@ -1,101 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Copyright © 2015 Broadcom Corporation - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "brcmnand.h" - -struct bcm63138_nand_soc { - struct brcmnand_soc soc; - void __iomem *base; -}; - -#define BCM63138_NAND_INT_STATUS 0x00 -#define BCM63138_NAND_INT_EN 0x04 - -enum { - BCM63138_CTLRDY = BIT(4), -}; - -static bool bcm63138_nand_intc_ack(struct brcmnand_soc *soc) -{ - struct bcm63138_nand_soc *priv = - container_of(soc, struct bcm63138_nand_soc, soc); - void __iomem *mmio = priv->base + BCM63138_NAND_INT_STATUS; - u32 val = brcmnand_readl(mmio); - - if (val & BCM63138_CTLRDY) { - brcmnand_writel(val & ~BCM63138_CTLRDY, mmio); - return true; - } - - return false; -} - -static void bcm63138_nand_intc_set(struct brcmnand_soc *soc, bool en) -{ - struct bcm63138_nand_soc *priv = - container_of(soc, struct bcm63138_nand_soc, soc); - void __iomem *mmio = priv->base + BCM63138_NAND_INT_EN; - u32 val = brcmnand_readl(mmio); - - if (en) - val |= BCM63138_CTLRDY; - else - val &= ~BCM63138_CTLRDY; - - brcmnand_writel(val, mmio); -} - -static int bcm63138_nand_probe(struct platform_device *pdev) -{ - struct device *dev = &pdev->dev; - struct bcm63138_nand_soc *priv; - struct brcmnand_soc *soc; - struct resource *res; - - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); - if (!priv) - return -ENOMEM; - soc = &priv->soc; - - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "nand-int-base"); - priv->base = devm_ioremap_resource(dev, res); - if (IS_ERR(priv->base)) - return PTR_ERR(priv->base); - - soc->ctlrdy_ack = bcm63138_nand_intc_ack; - soc->ctlrdy_set_enabled = bcm63138_nand_intc_set; - - return brcmnand_probe(pdev, soc); -} - -static const struct of_device_id bcm63138_nand_of_match[] = { - { .compatible = "brcm,nand-bcm63138" }, - {}, -}; -MODULE_DEVICE_TABLE(of, bcm63138_nand_of_match); - -static struct platform_driver bcm63138_nand_driver = { - .probe = bcm63138_nand_probe, - .remove = brcmnand_remove, - .driver = { - .name = "bcm63138_nand", - .pm = &brcmnand_pm_ops, - .of_match_table = bcm63138_nand_of_match, - } -}; -module_platform_driver(bcm63138_nand_driver); - -MODULE_LICENSE("GPL v2"); -MODULE_AUTHOR("Brian Norris"); -MODULE_DESCRIPTION("NAND driver for BCM63138"); diff --git a/drivers/mtd/nand/raw/brcmnand/bcmbca_nand.c b/drivers/mtd/nand/raw/brcmnand/bcmbca_nand.c new file mode 100644 index 000000000000..f51f857eeea6 --- /dev/null +++ b/drivers/mtd/nand/raw/brcmnand/bcmbca_nand.c @@ -0,0 +1,101 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright © 2015 Broadcom Corporation + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "brcmnand.h" + +struct bcmbca_nand_soc { + struct brcmnand_soc soc; + void __iomem *base; +}; + +#define BCMBCA_NAND_INT_STATUS 0x00 +#define BCMBCA_NAND_INT_EN 0x04 + +enum { + BCMBCA_CTLRDY = BIT(4), +}; + +static bool bcmbca_nand_intc_ack(struct brcmnand_soc *soc) +{ + struct bcmbca_nand_soc *priv = + container_of(soc, struct bcmbca_nand_soc, soc); + void __iomem *mmio = priv->base + BCMBCA_NAND_INT_STATUS; + u32 val = brcmnand_readl(mmio); + + if (val & BCMBCA_CTLRDY) { + brcmnand_writel(val & ~BCMBCA_CTLRDY, mmio); + return true; + } + + return false; +} + +static void bcmbca_nand_intc_set(struct brcmnand_soc *soc, bool en) +{ + struct bcmbca_nand_soc *priv = + container_of(soc, struct bcmbca_nand_soc, soc); + void __iomem *mmio = priv->base + BCMBCA_NAND_INT_EN; + u32 val = brcmnand_readl(mmio); + + if (en) + val |= BCMBCA_CTLRDY; + else + val &= ~BCMBCA_CTLRDY; + + brcmnand_writel(val, mmio); +} + +static int bcmbca_nand_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct bcmbca_nand_soc *priv; + struct brcmnand_soc *soc; + struct resource *res; + + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + soc = &priv->soc; + + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "nand-int-base"); + priv->base = devm_ioremap_resource(dev, res); + if (IS_ERR(priv->base)) + return PTR_ERR(priv->base); + + soc->ctlrdy_ack = bcmbca_nand_intc_ack; + soc->ctlrdy_set_enabled = bcmbca_nand_intc_set; + + return brcmnand_probe(pdev, soc); +} + +static const struct of_device_id bcmbca_nand_of_match[] = { + { .compatible = "brcm,nand-bcm63138" }, + {}, +}; +MODULE_DEVICE_TABLE(of, bcmbca_nand_of_match); + +static struct platform_driver bcmbca_nand_driver = { + .probe = bcmbca_nand_probe, + .remove = brcmnand_remove, + .driver = { + .name = "bcmbca_nand", + .pm = &brcmnand_pm_ops, + .of_match_table = bcmbca_nand_of_match, + } +}; +module_platform_driver(bcmbca_nand_driver); + +MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Brian Norris"); +MODULE_DESCRIPTION("NAND driver for BCMBCA"); From patchwork Tue Jun 6 23:12:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Zhang X-Patchwork-Id: 104147 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3733774vqr; Tue, 6 Jun 2023 16:27:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7oQqKDHFrmbzyLQ1zDtfGuhES5ITpk1+PmMlRKD1e0/BbphRWaTgB5wxqA93BwWT4G8/KF X-Received: by 2002:a05:6a20:7d96:b0:104:ad71:f080 with SMTP id v22-20020a056a207d9600b00104ad71f080mr1052241pzj.34.1686094070837; Tue, 06 Jun 2023 16:27:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686094070; cv=none; d=google.com; s=arc-20160816; b=WxQZFgj8NX413oKGxDxM8zhgPYIIY26FovzEITYZA1LaFzx0+aBlnpkkY7669z18LD z/QC9HwAt8Z+pXCiI+1KoeSHLrcjUi7sZ54WrWmK03BZXDWuCFi5OKfdAi/qsxYaQFVw 1d4zPwAu+DV6jicUlDXo0FKCjztPFnnTnmnKZp8X32x7tYWrv0C9z7AOoBqQdrqAp5fV 4HeX2cV9G3E3/OxjFZNfcxix5zqnoxt5lb/sQYCRbfKjEJIN5/8nZMie+21PToYRl5W0 M/yarVMI03d/k8JkfV31rkgqJOaKRvHtPJTt1CFphX/SEiP+4SNMq+Eajl4grr77MQK6 mjkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=bdoyzb/MjHfNfTvT1opC1ogKeGdwP7RMx4V0baj279E=; b=yFyEWts5nrzoJ/UgMq+8OtJB7/W/WjD9ggNAxD7qbuGaY/whMcsb5FbD/0LNoe+3Ae 7U6n4vwNgoeRed7A/F/oRYnciaLBL5PLIJHwlLENGztnFlfH9vBCa0iqDZeUuKQGaZop gRVL333D+ZG+30FJ8zNTiWzncJRArozSoU8gMSSE87oFLQKrOG2z+3MepCayXi5yujUs B9u6lDrvavc9WiIjb8LNWVQhNHxisSqiD5WM6PIyZucT8e6BEqH510NzVuC7CZka/R3V 00ngXgzI38F/wcFRhh2A812xJ7ybPMtaK1F5U2XoG1wsvA1+LfF2sE8KzcX96FkmcG45 pgXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=dBNCgOZT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h17-20020a056a00001100b00659145ce601si4627367pfk.401.2023.06.06.16.27.33; Tue, 06 Jun 2023 16:27:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=dBNCgOZT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240236AbjFFXPV (ORCPT + 99 others); Tue, 6 Jun 2023 19:15:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240220AbjFFXOo (ORCPT ); Tue, 6 Jun 2023 19:14:44 -0400 Received: from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com [IPv6:2607:f8b0:4864:20::72d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1095210F2 for ; Tue, 6 Jun 2023 16:14:43 -0700 (PDT) Received: by mail-qk1-x72d.google.com with SMTP id af79cd13be357-75d4dd6f012so473416885a.2 for ; Tue, 06 Jun 2023 16:14:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1686093282; x=1688685282; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=bdoyzb/MjHfNfTvT1opC1ogKeGdwP7RMx4V0baj279E=; b=dBNCgOZTRnbvMt0bzjeFBb6Dkjt2bIKN9RwAGCqAjH4sT6qOZeK9kJeNKQ241VGEfj BSxDWHgxIPWaZdgRnmjBj1lfpi5NqKB4fPMmRT8W/WzD5CCuwd273xaB9+81reO50WMD 6gAYAKwvRYkxI89k2R60Tq03eC8UGGLfO+92M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686093282; x=1688685282; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=bdoyzb/MjHfNfTvT1opC1ogKeGdwP7RMx4V0baj279E=; b=ZHoMaZV9Lr1Fc09GLaCV3GaY/oU0+MXkLe5v3u8XSJhEdC2qw8F8VyVJ4V1Fa0EMyz xscCRMAOzFRwpQOO6Zm8wpQDHZ1QElxS2qxYLEVJFxQgZD7br5qP/FL9L+EuMSej63Uq 1y5M0kYdDDxkyX88n2coqU8WVp9irJi2t2S/4cXlLTehFfYI1V4/8G6Zut/qxaTJ5aO8 7JZ4KuaiBBn/8+xC2ouEJWNvhDXjkSTA8uw2sYZ7bHA1Rug70qekp5J8UP7ZSA82x9Uw dq1I6zuJLMfgImQM6mfnwycMIAvvjQGLG0UhSzZ4C9D52p2ZaQsYCzb2ccECDV9TdxDd HLtg== X-Gm-Message-State: AC+VfDxK+wPfs2/XmfOIVd1hy+YfnZza+wnPNleEvQcZ5hEpxlFMcJlB aryekW9K8OlF0GkJ1QVjqraP/Q== X-Received: by 2002:a05:620a:40cf:b0:75e:cec3:1ab1 with SMTP id g15-20020a05620a40cf00b0075ecec31ab1mr418749qko.0.1686093282119; Tue, 06 Jun 2023 16:14:42 -0700 (PDT) Received: from ubuntu-22.localdomain ([192.19.222.250]) by smtp.gmail.com with ESMTPSA id x9-20020ae9e909000000b0075b23e55640sm5221519qkf.123.2023.06.06.16.14.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jun 2023 16:14:41 -0700 (PDT) From: William Zhang To: Broadcom Kernel List , Linux MTD List Cc: f.fainelli@gmail.com, rafal@milecki.pl, kursad.oney@broadcom.com, joel.peshkin@broadcom.com, computersforpeace@gmail.com, anand.gore@broadcom.com, dregan@mail.com, kamal.dasu@broadcom.com, tomer.yacoby@broadcom.com, dan.beygelman@broadcom.com, William Zhang , Miquel Raynal , linux-kernel@vger.kernel.org, Vignesh Raghavendra , Richard Weinberger , Kamal Dasu , linux-arm-kernel@lists.infradead.org Subject: [PATCH 09/12] mtd: rawnand: brcmnand: Add new compatible string Date: Tue, 6 Jun 2023 16:12:49 -0700 Message-Id: <20230606231252.94838-10-william.zhang@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230606231252.94838-1-william.zhang@broadcom.com> References: <20230606231252.94838-1-william.zhang@broadcom.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767997776554164661?= X-GMAIL-MSGID: =?utf-8?q?1767997776554164661?= To support the new BCMBCA SoCs, add brcm,nand-bcmbca to the driver of match table based on the updated binding document brcm,brcmnand.yaml. Signed-off-by: William Zhang --- drivers/mtd/nand/raw/brcmnand/bcmbca_nand.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mtd/nand/raw/brcmnand/bcmbca_nand.c b/drivers/mtd/nand/raw/brcmnand/bcmbca_nand.c index f51f857eeea6..7e48b6a0bfa2 100644 --- a/drivers/mtd/nand/raw/brcmnand/bcmbca_nand.c +++ b/drivers/mtd/nand/raw/brcmnand/bcmbca_nand.c @@ -81,6 +81,7 @@ static int bcmbca_nand_probe(struct platform_device *pdev) static const struct of_device_id bcmbca_nand_of_match[] = { { .compatible = "brcm,nand-bcm63138" }, + { .compatible = "brcm,nand-bcmbca" }, {}, }; MODULE_DEVICE_TABLE(of, bcmbca_nand_of_match); From patchwork Tue Jun 6 23:12:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Zhang X-Patchwork-Id: 104150 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3738060vqr; Tue, 6 Jun 2023 16:38:55 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7nbEQjmCoO2I8UHm2a9BUN5aYLo2CJi8UrnJxC5g4J3To2W16o4TFoW3/JeCYeKdT7Wpkx X-Received: by 2002:a05:6a00:99b:b0:655:6bcf:208a with SMTP id u27-20020a056a00099b00b006556bcf208amr4328948pfg.6.1686094735273; Tue, 06 Jun 2023 16:38:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686094735; cv=none; d=google.com; s=arc-20160816; b=dYU5wqZcXl4FyrSLjUQaO3qB+38lmX/fvPh5H+hW0fYu/pIPAVBMECKFbqBeeW/iEY 4GIrThdWXYs14wUBQPf/Br+2VRO16PhJc2kCTFRb2amAXhDt3bgWUUl19HR+8u4r/wy8 +cT7nbeplJha9lor/N+N4qQqNgx1N1iju07wjgIuqKLiXzghUsyKWy01rFFw4Ue1Fqcn w64AmtFXFQxqbwAzBp08yuKmiuDxj/5nr0/cUC0e6RMWBlFORcidCVoyQr6fWAdHgg9e KSvrxnqsRGMlEWXMdYKHjcS7N8Tc8en11KqCnx9/s/OxZrSZx5YBlHIdUKRCB1nxfPC3 2hdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=U+Z84/AfzP1MYacvhjEamKy0f7DBRojW2nAeEre6Y5c=; b=Bzo0+58aftkitKLZ21QVp42DKeUPorzNVHgeR8kGmM+4n4JU7EZ3Aj8rc1jS9hek+r AH/o6OGNUz1NX4XC8AWoYe5rSSrcLpvRg2IqUa4yNlIbsH8TjuUiQMyNLUrSdn+HZEaW AWv3zkehoL10pTqAWk5Ei4jKlUfQcElkHSuJpgLQcqleb3XGD66Tnwty7taggOWHLd+A 2le2QgFOsa71/gtUSUlAjuQcX7g4J8HEnrmfh+FsZh7ohAWq+n20gYgXWP54iEb6Rkgi tz1JfL5u6A/51KhwLEzfXg+usqIfGJt7/1LffRBm0dlcLzbexz5CS7n3pzCZtKkR1AZR JAwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b="dWM/Zn8f"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y12-20020aa79aec000000b0064f44863407si6188383pfp.384.2023.06.06.16.38.41; Tue, 06 Jun 2023 16:38:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b="dWM/Zn8f"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240315AbjFFXPQ (ORCPT + 99 others); Tue, 6 Jun 2023 19:15:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240236AbjFFXOq (ORCPT ); Tue, 6 Jun 2023 19:14:46 -0400 Received: from mail-qv1-xf2a.google.com (mail-qv1-xf2a.google.com [IPv6:2607:f8b0:4864:20::f2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6CD81723 for ; Tue, 6 Jun 2023 16:14:45 -0700 (PDT) Received: by mail-qv1-xf2a.google.com with SMTP id 6a1803df08f44-62b699b88e1so4354076d6.1 for ; Tue, 06 Jun 2023 16:14:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1686093285; x=1688685285; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=U+Z84/AfzP1MYacvhjEamKy0f7DBRojW2nAeEre6Y5c=; b=dWM/Zn8fIv72Rap3CadIPAy7izpJgg1EUz+A4LqaCoNOfUTJEoOcevr97mTdfsPbvG JQmFoCXVqr8q5Ytlb0NroBv5KT8A4JF6IHlrY80YbZG5qivCGKKE3vu0I8iIhc9mO7Iq pKjxxELjXXcJXpGot5mMb+7Up+ZGf1OroYIyU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686093285; x=1688685285; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=U+Z84/AfzP1MYacvhjEamKy0f7DBRojW2nAeEre6Y5c=; b=NtQCysrmXSMcIKG3c/T5wRlRKe2Hqeq1uwXHNOPAqF9s7J6s48VoctjiQf71HVM+qD 6qVeBCYIYLBzMv1hBETfql4c+S9svjd9C87KzTb6OlryJZGjjJQ1YH7eydv81G+DUYRe lG4S3dPlFnysqVFCxRP9/ims3WpMtJOAujT09vlRqS6sL1ZAMzLCgu+7OpMdjIi8phnN G73FDQC/cWs/dQMKMeDBa7On2fIZ0oYTLfqNEwcLxNC5NUIQw8g4yXmQzzfT0OCDs/vm j1OQ01IrDCCsGz2ruheEKIuekOdQlkfhEhRnWyZgfK92P+F3LCol3KW18QCaykMozW+9 yEUw== X-Gm-Message-State: AC+VfDytWE30q/VkYDi7Uz/Ehy1Bd7RkfT5jKYCL0i3qXQIpXifgmKUV +Ao+w/cfeJ0oQqaBW51K86slYg== X-Received: by 2002:ad4:5c8e:0:b0:625:aa49:19f3 with SMTP id o14-20020ad45c8e000000b00625aa4919f3mr1208739qvh.64.1686093284715; Tue, 06 Jun 2023 16:14:44 -0700 (PDT) Received: from ubuntu-22.localdomain ([192.19.222.250]) by smtp.gmail.com with ESMTPSA id x9-20020ae9e909000000b0075b23e55640sm5221519qkf.123.2023.06.06.16.14.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jun 2023 16:14:44 -0700 (PDT) From: William Zhang To: Broadcom Kernel List , Linux MTD List Cc: f.fainelli@gmail.com, rafal@milecki.pl, kursad.oney@broadcom.com, joel.peshkin@broadcom.com, computersforpeace@gmail.com, anand.gore@broadcom.com, dregan@mail.com, kamal.dasu@broadcom.com, tomer.yacoby@broadcom.com, dan.beygelman@broadcom.com, William Zhang , Miquel Raynal , linux-kernel@vger.kernel.org, Vignesh Raghavendra , Richard Weinberger , Kamal Dasu , linux-arm-kernel@lists.infradead.org Subject: [PATCH 10/12] mtd: rawnand: brcmnand: Add BCMBCA read data bus interface Date: Tue, 6 Jun 2023 16:12:50 -0700 Message-Id: <20230606231252.94838-11-william.zhang@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230606231252.94838-1-william.zhang@broadcom.com> References: <20230606231252.94838-1-william.zhang@broadcom.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767998472933372452?= X-GMAIL-MSGID: =?utf-8?q?1767998472933372452?= The BCMBCA broadband SoC integrates the NAND controller differently than STB, iProc and other SoCs. It has different endianness for NAND cache data and ONFI parameter data. Add a SoC read data bus shim for BCMBCA to meet the specific SoC need and performance improvement using the optimized memcpy function on NAND cache memory. Signed-off-by: William Zhang --- drivers/mtd/nand/raw/brcmnand/bcmbca_nand.c | 36 +++++++++++++++++ drivers/mtd/nand/raw/brcmnand/brcmnand.c | 44 ++++++++++++++------- drivers/mtd/nand/raw/brcmnand/brcmnand.h | 2 + 3 files changed, 68 insertions(+), 14 deletions(-) diff --git a/drivers/mtd/nand/raw/brcmnand/bcmbca_nand.c b/drivers/mtd/nand/raw/brcmnand/bcmbca_nand.c index 7e48b6a0bfa2..899103a62c98 100644 --- a/drivers/mtd/nand/raw/brcmnand/bcmbca_nand.c +++ b/drivers/mtd/nand/raw/brcmnand/bcmbca_nand.c @@ -26,6 +26,18 @@ enum { BCMBCA_CTLRDY = BIT(4), }; +#if defined(CONFIG_ARM64) +#define ALIGN_REQ 8 +#else +#define ALIGN_REQ 4 +#endif + +static inline bool bcmbca_nand_is_buf_aligned(void *flash_cache, void *buffer) +{ + return IS_ALIGNED((uintptr_t)buffer, ALIGN_REQ) && + IS_ALIGNED((uintptr_t)flash_cache, ALIGN_REQ); +} + static bool bcmbca_nand_intc_ack(struct brcmnand_soc *soc) { struct bcmbca_nand_soc *priv = @@ -56,6 +68,29 @@ static void bcmbca_nand_intc_set(struct brcmnand_soc *soc, bool en) brcmnand_writel(val, mmio); } +static void bcmbca_read_data_bus(struct brcmnand_soc *soc, + void __iomem *flash_cache, u32 *buffer, + int fc_words, bool is_param) +{ + int i; + + if (!is_param) { + /* + * memcpy can do unaligned aligned access depending on source + * and dest address, which is incompatible with nand cache. Fallback + * to the memcpy for io version + */ + if (bcmbca_nand_is_buf_aligned(flash_cache, buffer)) + memcpy((void *)buffer, (void *)flash_cache, fc_words * 4); + else + memcpy_fromio((void *)buffer, (void *)flash_cache, fc_words * 4); + } else { + /* Flash cache has same endian as the host for parameter pages */ + for (i = 0; i < fc_words; i++, buffer++) + *buffer = __raw_readl(flash_cache + i * 4); + } +} + static int bcmbca_nand_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -75,6 +110,7 @@ static int bcmbca_nand_probe(struct platform_device *pdev) soc->ctlrdy_ack = bcmbca_nand_intc_ack; soc->ctlrdy_set_enabled = bcmbca_nand_intc_set; + soc->read_data_bus = bcmbca_read_data_bus; return brcmnand_probe(pdev, soc); } diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c index d920e88c7f5b..656be4d73016 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c @@ -814,6 +814,30 @@ static inline u32 edu_readl(struct brcmnand_controller *ctrl, return brcmnand_readl(ctrl->edu_base + offs); } +static inline void brcmnand_read_data_bus(struct brcmnand_controller *ctrl, + void __iomem *flash_cache, u32 *buffer, + int fc_words, bool is_param) +{ + struct brcmnand_soc *soc = ctrl->soc; + int i; + + if (soc->read_data_bus) { + soc->read_data_bus(soc, flash_cache, buffer, fc_words, is_param); + } else { + if (!is_param) { + for (i = 0; i < fc_words; i++, buffer++) + *buffer = brcmnand_read_fc(ctrl, i); + } else { + for (i = 0; i < fc_words; i++) + /* + * Flash cache is big endian for parameter pages, at + * least on STB SoCs + */ + buffer[i] = be32_to_cpu(brcmnand_read_fc(ctrl, i)); + } + } +} + static void brcmnand_clear_ecc_addr(struct brcmnand_controller *ctrl) { @@ -1811,20 +1835,11 @@ static void brcmnand_cmdfunc(struct nand_chip *chip, unsigned command, native_cmd == CMD_PARAMETER_CHANGE_COL) { /* Copy flash cache word-wise */ u32 *flash_cache = (u32 *)ctrl->flash_cache; - int i; brcmnand_soc_data_bus_prepare(ctrl->soc, true); - /* - * Must cache the FLASH_CACHE now, since changes in - * SECTOR_SIZE_1K may invalidate it - */ - for (i = 0; i < FC_WORDS; i++) - /* - * Flash cache is big endian for parameter pages, at - * least on STB SoCs - */ - flash_cache[i] = be32_to_cpu(brcmnand_read_fc(ctrl, i)); + brcmnand_read_data_bus(ctrl, ctrl->nand_fc, flash_cache, + FC_WORDS, true); brcmnand_soc_data_bus_unprepare(ctrl->soc, true); @@ -2137,7 +2152,7 @@ static int brcmnand_read_by_pio(struct mtd_info *mtd, struct nand_chip *chip, { struct brcmnand_host *host = nand_get_controller_data(chip); struct brcmnand_controller *ctrl = host->ctrl; - int i, j, ret = 0; + int i, ret = 0; brcmnand_clear_ecc_addr(ctrl); @@ -2150,8 +2165,9 @@ static int brcmnand_read_by_pio(struct mtd_info *mtd, struct nand_chip *chip, if (likely(buf)) { brcmnand_soc_data_bus_prepare(ctrl->soc, false); - for (j = 0; j < FC_WORDS; j++, buf++) - *buf = brcmnand_read_fc(ctrl, j); + brcmnand_read_data_bus(ctrl, ctrl->nand_fc, buf, + FC_WORDS, false); + buf += FC_WORDS; brcmnand_soc_data_bus_unprepare(ctrl->soc, false); } diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.h b/drivers/mtd/nand/raw/brcmnand/brcmnand.h index f1f93d85f50d..88819bc395f8 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.h +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.h @@ -24,6 +24,8 @@ struct brcmnand_soc { void (*ctlrdy_set_enabled)(struct brcmnand_soc *soc, bool en); void (*prepare_data_bus)(struct brcmnand_soc *soc, bool prepare, bool is_param); + void (*read_data_bus)(struct brcmnand_soc *soc, void __iomem *flash_cache, + u32 *buffer, int fc_words, bool is_param); const struct brcmnand_io_ops *ops; }; From patchwork Tue Jun 6 23:12:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Zhang X-Patchwork-Id: 104153 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3744013vqr; Tue, 6 Jun 2023 16:57:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6t0wQUJwbcuumDslHp5Leas6+pVGFYQ7cDGhftXtfaFYaXSSr7SFIxO1S6/57lbV4JQK+F X-Received: by 2002:a05:6830:1481:b0:6b1:383f:cb83 with SMTP id s1-20020a056830148100b006b1383fcb83mr3350321otq.18.1686095836582; Tue, 06 Jun 2023 16:57:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686095836; cv=none; d=google.com; s=arc-20160816; b=n5w394rrYj6agN2BvpsBui3kgLh4p2AC9JynjNhQ1xLttEXm+J0jNrN300QIqG178A RIzJmswB5D2uZkw3kLGWWpSc8gteGsBbgW01xHUyaiQE6Hvnb+JZ5pQGTh5c92lySplP sKXzRENpvEYE2UgyIJq0Yt6CUa8etMXe3kwUDOtr6X1faSTGljJUlctPuklh0jJOJgyZ p+soNZ7Z9h01DGr2YhfJmtUai0IVxQjluUBCzhOXMVZ+wT/Fl6p5AXSyoZ0TRFN4QhiQ c0+ZevcMcyGTD7f35mwE/v8BivyP7Tvx+u+ZjOoEazeU47iWuWBRVIQuC3K1HQN0onmH TVDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=nyPi1rPwS98XQwiWgY12WZBBaK5d1Swjzk87WsXmA6w=; b=s9ny1/eYyrkNfjbo/BTyy/hvMYWZpjKFSXFPUWJoo3WkWfKXz3unD0soW3BW3AkVIu 0xm8XLKOBS0z74Zxe3AArPlmLtWoi4FjzSaGjJRgB2zcBcmhO15GWtUSX/DDd141RdEy GHM6s1nYVzVYVezWfimRNtZlF1ixSOTmdCXb5ZFS5RHJ+HRmpCjJqKd1Fpaduxuya7Sy lmaBXpG12Vix3mNe1XwFPGynZLHST0jXMwVcid+QNM2qr528jdG9tp5DSWfXZTW+1PbF sYB2jX3cnm+Ep2N4TsIeN266JFyEr8ija/DMeCHEvAzpforuBK147PVlGNpWR5Cm4p16 c1Vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=PlDt06DF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r16-20020a638f50000000b00530b135eae9si8083477pgn.119.2023.06.06.16.57.02; Tue, 06 Jun 2023 16:57:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=PlDt06DF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240333AbjFFXP2 (ORCPT + 99 others); Tue, 6 Jun 2023 19:15:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240267AbjFFXOt (ORCPT ); Tue, 6 Jun 2023 19:14:49 -0400 Received: from mail-qk1-x72e.google.com (mail-qk1-x72e.google.com [IPv6:2607:f8b0:4864:20::72e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E4B61998 for ; Tue, 6 Jun 2023 16:14:48 -0700 (PDT) Received: by mail-qk1-x72e.google.com with SMTP id af79cd13be357-75d4b85b3ccso445665685a.2 for ; Tue, 06 Jun 2023 16:14:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1686093287; x=1688685287; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=nyPi1rPwS98XQwiWgY12WZBBaK5d1Swjzk87WsXmA6w=; b=PlDt06DFXzllU2CBA+uStg5g81PCA9DmFTbwBCqHiAyONJMaXSZXmGAVCFyfhlyrL9 gfsHvsVhfJ3t/CnALktbVJ+88jFSgDlW5bfQ+xxWC1pNdQj5GAw9OwLvVAWYZBBNFvmK 75r8cWtJRdmP08wqidiGU8UZ0oRx6mtBfQFpc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686093287; x=1688685287; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=nyPi1rPwS98XQwiWgY12WZBBaK5d1Swjzk87WsXmA6w=; b=K4ordKsBS9r6NQCBaDlUOaoqPtMhB1mHyKAOTQj7AR2v70VjlC/rcYLpRXX1jXmHZ7 ITKPr9tZXXQbwnANc20oPl98O8k8YU8IcXQk4ObSoTXb6X/B9X4s5JhExdkTq63KGSWz tJ4l7jafa5YhxeQ3UZSMvkJjDAdwCdsRsAP3py94dvi4bp5c3P6lIRAZYCd79+K5WEWu 9LqCVTZwhgu1K8wgRRC20RDhX3uLRdtZso3IXAOSwzSXx7rfeXqpRZIqo/G8zzGVED4U KaY/+gWy0sbyeUWJpFR8+IhwswVIORT/nZo8KqG3vcv+ZwODJOK+DOlTdfLZe0ZbBh9n 7nYg== X-Gm-Message-State: AC+VfDx83sox3EgyJUhBIc5JyOTj3cgWSQ8LTCoWrZ3Rx9KWhxuD9c2i BPVfDpOsrTQsYEy7DyQtMT8K2w== X-Received: by 2002:a05:620a:2541:b0:75b:23a1:3605 with SMTP id s1-20020a05620a254100b0075b23a13605mr221743qko.22.1686093287284; Tue, 06 Jun 2023 16:14:47 -0700 (PDT) Received: from ubuntu-22.localdomain ([192.19.222.250]) by smtp.gmail.com with ESMTPSA id x9-20020ae9e909000000b0075b23e55640sm5221519qkf.123.2023.06.06.16.14.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jun 2023 16:14:46 -0700 (PDT) From: William Zhang To: Broadcom Kernel List , Linux MTD List Cc: f.fainelli@gmail.com, rafal@milecki.pl, kursad.oney@broadcom.com, joel.peshkin@broadcom.com, computersforpeace@gmail.com, anand.gore@broadcom.com, dregan@mail.com, kamal.dasu@broadcom.com, tomer.yacoby@broadcom.com, dan.beygelman@broadcom.com, William Zhang , Miquel Raynal , linux-kernel@vger.kernel.org, Vignesh Raghavendra , Richard Weinberger , Kamal Dasu Subject: [PATCH 11/12] mtd: rawnand: brcmnand: Add support for getting ecc setting from strap Date: Tue, 6 Jun 2023 16:12:51 -0700 Message-Id: <20230606231252.94838-12-william.zhang@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230606231252.94838-1-william.zhang@broadcom.com> References: <20230606231252.94838-1-william.zhang@broadcom.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767999627645520591?= X-GMAIL-MSGID: =?utf-8?q?1767999627645520591?= BCMBCA broadband SoC based board design does not specify ecc setting in dts but rather use the SoC NAND strap info to obtain the ecc strength and spare area size setting. Add brcm,nand-ecc-use-strap dts propety for this purpose and update driver to support this option. The generic nand ecc settings still take precedence over this flag. For example, if nand-ecc-strength is set in the dts, the driver ignores the strap setting and falls back to original behavior. This makes sure that the existing BCMBCA board dts still works the old way even the strap flag is set in the BCMBCA chip dtsi. Signed-off-by: William Zhang --- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 72 +++++++++++++++++++++--- 1 file changed, 64 insertions(+), 8 deletions(-) diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c index 656be4d73016..8c7cea36ac71 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c @@ -1076,6 +1076,38 @@ static void brcmnand_set_sector_size_1k(struct brcmnand_host *host, int val) nand_writereg(ctrl, acc_control_offs, tmp); } +static int brcmnand_get_spare_size(struct brcmnand_host *host) +{ + struct brcmnand_controller *ctrl = host->ctrl; + u16 acc_control_offs = brcmnand_cs_offset(ctrl, host->cs, + BRCMNAND_CS_ACC_CONTROL); + u32 acc = nand_readreg(ctrl, acc_control_offs); + + return (acc&brcmnand_spare_area_mask(ctrl)); +} + +static int brcmnand_get_ecc_strength(struct brcmnand_host *host) +{ + struct brcmnand_controller *ctrl = host->ctrl; + u16 acc_control_offs = brcmnand_cs_offset(ctrl, host->cs, + BRCMNAND_CS_ACC_CONTROL); + int sector_size_1k = brcmnand_get_sector_size_1k(host); + int spare_area_size, ecc_level, ecc_strength; + u32 acc; + + spare_area_size = brcmnand_get_spare_size(host); + acc = nand_readreg(ctrl, acc_control_offs); + ecc_level = (acc & brcmnand_ecc_level_mask(ctrl)) >> brcmnand_ecc_level_shift(ctrl); + if (sector_size_1k) + ecc_strength = ecc_level<<1; + else if (spare_area_size == 16 && ecc_level == 15) + ecc_strength = 1; /* hamming */ + else + ecc_strength = ecc_level; + + return ecc_strength; +} + /*********************************************************************** * CS_NAND_SELECT ***********************************************************************/ @@ -2656,19 +2688,43 @@ static int brcmnand_setup_dev(struct brcmnand_host *host) nanddev_get_ecc_requirements(&chip->base); struct brcmnand_controller *ctrl = host->ctrl; struct brcmnand_cfg *cfg = &host->hwcfg; - char msg[128]; + struct device_node *np = nand_get_flash_node(chip); u32 offs, tmp, oob_sector; - int ret; + int ret, sector_size_1k = 0; + bool use_strap = false; + char msg[128]; memset(cfg, 0, sizeof(*cfg)); + use_strap = of_property_read_bool(np, "brcm,nand-ecc-use-strap"); + + /* + * Set ECC size and strength based on hw configuration from strap + * if device tree does not specify them and use strap property is set + * If ecc strength is set in dts, don't use strap setting. + */ + if (chip->ecc.strength) + use_strap = 0; + + if (use_strap) { + chip->ecc.strength = brcmnand_get_ecc_strength(host); + sector_size_1k = brcmnand_get_sector_size_1k(host); + if (chip->ecc.size == 0) { + if (sector_size_1k < 0) + chip->ecc.size = 512; + else + chip->ecc.size = 512<spare_area_size = mtd->oobsize / - (mtd->writesize >> FC_SHIFT); + if (use_strap) + cfg->spare_area_size = brcmnand_get_spare_size(host); + else + /* Use detected size */ + cfg->spare_area_size = mtd->oobsize / + (mtd->writesize >> FC_SHIFT); } else { cfg->spare_area_size = oob_sector; } From patchwork Tue Jun 6 23:12:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Zhang X-Patchwork-Id: 104143 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3731407vqr; Tue, 6 Jun 2023 16:21:13 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6a8tPjSmi52TUZb0S6i7W4BixQZ4FJFd1rcIYUQRwoMdA5AHyY8UAmmGTeZzSuQqOemxIE X-Received: by 2002:a05:6a20:1587:b0:111:1bd6:2731 with SMTP id h7-20020a056a20158700b001111bd62731mr734595pzj.7.1686093672996; Tue, 06 Jun 2023 16:21:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686093672; cv=none; d=google.com; s=arc-20160816; b=ktrUb6altfTnRpQBumpExTMLdIJAJ8YgNAILe5lj169MeH3dJelBg4ouuD0BdrFG3n /GiXuT67giffA3Gxf5dqEljDTp3vi/e1VOKkKj5QVLKwG8+bLxKpHuQkbWLcTez5Yaqj VWeeynfa+fm9G6jw0jxa+32cWah2Rc800d5fqLdxPQm91ZiaqVj1Hn5zrFbw8/hg7tBv ySandtipqkinjfBfP9baMpETjjGCsfCfZibkD29RPT4G31WI1Sg24hgVjDz8MS7c3oow R17JH9Zw/8sRL0uab6Qvy6mqNOr6ZZSHJH5kBjG3rOObaib0BUVs1EoKIKfh9sV5ywh/ Pc2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=ROcC2ZfyjeH1aEZUXxYoPFe2+Pi0XlWSLTaDtsSWdFo=; b=a9LdQO11oHk7v6h1yWKHvOwE3AKSiIQNUdJMWjggrzDnB1+5e5pj/fpct2ouFioen4 syGQlQCpXNFIJMnHV1YL+3ZIOSAFOJx6f+xWNOOzWElBpXtzhwKxIjmKi0bAz6dLP5Bs Ju60qxk531IiexENgsH0OYEdThNvYQ3pKPjpayA9+JPGMmvwGfe7zbjbCDcjDXxj1oZ7 pWJxZsvxtv0cM/OXq8tIfkgwvREwyVoae/ItFWnV79j5yMpFeld3g2VkGSyn/jqjMkTV yy8ibb5rCgGLFrmkL4qEvPWGIbFSo/a0EVTZkFS8+PHMeZQMJO/BM7s5sU6KWpyDa7Bf Vjeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=X9UB9wKm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ik6-20020a170902ab0600b001ac6b926624si7694335plb.122.2023.06.06.16.20.58; Tue, 06 Jun 2023 16:21:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=X9UB9wKm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239673AbjFFXPb (ORCPT + 99 others); Tue, 6 Jun 2023 19:15:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240278AbjFFXOz (ORCPT ); Tue, 6 Jun 2023 19:14:55 -0400 Received: from mail-qk1-x72c.google.com (mail-qk1-x72c.google.com [IPv6:2607:f8b0:4864:20::72c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25C7419B0 for ; Tue, 6 Jun 2023 16:14:51 -0700 (PDT) Received: by mail-qk1-x72c.google.com with SMTP id af79cd13be357-75d4fb03100so430221485a.3 for ; Tue, 06 Jun 2023 16:14:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1686093290; x=1688685290; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=ROcC2ZfyjeH1aEZUXxYoPFe2+Pi0XlWSLTaDtsSWdFo=; b=X9UB9wKmSqRUchfp51LykZoGNamlKGl3mQkuLbwMeLCo6Ghpy4Uzg6JTXwk125vjRa jd4U0SvFU/ZiXVw+uH/BQSIRROL/+KAQGNB7cMRD2oZ4LZev4mFhRMBiIDk6Za0qLLd5 wrWdwme7vRj7gVmaodE19FDfT8pfywj3dT/FA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686093290; x=1688685290; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ROcC2ZfyjeH1aEZUXxYoPFe2+Pi0XlWSLTaDtsSWdFo=; b=e+OY6GVtDmAEsY0QDLhx36oJViP8bi+I2EHg9c9ymhilTLqJhfpnw83GZBhpLR/pSj Xzj9qa2620wBuWoKdhn0nHCdla4R7wN68K4l7FgKdezjTllL6zjF7biR8giwTeEjOAuv 1vKbe5IF6aMJ/cdnrtWbpfbVIzaZQHVwynvmbUMXcQon2DLapA6NPsACeZgO2qAHZKDR NyLGSnYF4r8TLOa9kw6PYCqbpa8joX604/ECpuL9cRpFLwqZqXDyt+uU+tCicnVIV11G l1KUdooIuNuVZ27QfD88B3VQ0WWve5e+iklZ/GBA+jIZP97HYZM9SRQ41LDJUWl/qeNb cQVg== X-Gm-Message-State: AC+VfDxyan4oGx3PIqO4I9D2QHUzQ0szz4pZ2JuZISdqFtni4JcrOcmP 8MHD6w4GhLb6uwMiVNi6+pBP5g== X-Received: by 2002:a05:620a:4495:b0:75b:23a1:362e with SMTP id x21-20020a05620a449500b0075b23a1362emr167782qkp.63.1686093290204; Tue, 06 Jun 2023 16:14:50 -0700 (PDT) Received: from ubuntu-22.localdomain ([192.19.222.250]) by smtp.gmail.com with ESMTPSA id x9-20020ae9e909000000b0075b23e55640sm5221519qkf.123.2023.06.06.16.14.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jun 2023 16:14:49 -0700 (PDT) From: William Zhang To: Broadcom Kernel List , Linux MTD List Cc: f.fainelli@gmail.com, rafal@milecki.pl, kursad.oney@broadcom.com, joel.peshkin@broadcom.com, computersforpeace@gmail.com, anand.gore@broadcom.com, dregan@mail.com, kamal.dasu@broadcom.com, tomer.yacoby@broadcom.com, dan.beygelman@broadcom.com, William Zhang , Florian Fainelli , Miquel Raynal , linux-kernel@vger.kernel.org, Vignesh Raghavendra , Richard Weinberger , Kamal Dasu Subject: [PATCH 12/12] mtd: rawnand: brcmnand: Support write protection setting from dts Date: Tue, 6 Jun 2023 16:12:52 -0700 Message-Id: <20230606231252.94838-13-william.zhang@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230606231252.94838-1-william.zhang@broadcom.com> References: <20230606231252.94838-1-william.zhang@broadcom.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767997359715215064?= X-GMAIL-MSGID: =?utf-8?q?1767997359715215064?= The write protection feature is controlled by the module parameter wp_on with default set to enabled. But not all the board use this feature especially in BCMBCA broadband board. And module parameter is not sufficient as different board can have different option. Add a device tree property and allow this feature to be configured through the board dts on per board basis. Signed-off-by: William Zhang Reviewed-by: Florian Fainelli Reviewed-by: Kamal Dasu --- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c index 8c7cea36ac71..4fc23077a5b5 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c @@ -3106,7 +3106,7 @@ int brcmnand_probe(struct platform_device *pdev, struct brcmnand_soc *soc) struct brcmnand_controller *ctrl; struct brcmnand_host *host; struct resource *res; - int ret; + int ret, wp_dt; if (dn && !of_match_node(brcmnand_of_match, dn)) return -ENODEV; @@ -3243,6 +3243,12 @@ int brcmnand_probe(struct platform_device *pdev, struct brcmnand_soc *soc) /* Disable XOR addressing */ brcmnand_rmw_reg(ctrl, BRCMNAND_CS_XOR, 0xff, 0, 0); + /* Not all boards support write protect (WP), check DT property */ + if (of_property_read_u32(dn, "brcm,nand-use-wp", &wp_dt) == 0) { + if (wp_dt >= 0 && wp_dt <= 2) + wp_on = wp_dt; + } + if (ctrl->features & BRCMNAND_HAS_WP) { /* Permanently disable write protection */ if (wp_on == 2)