From patchwork Mon Sep 16 09:58:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 829008 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:4187:b0:367:895a:4699 with SMTP id ei7csp699708wrb; Mon, 16 Sep 2024 02:59:45 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUsLqi113kpwOhroDlqaiSdh8cmidktpctSM/cpAX3EL3RruxHM9GRFO81DsSvBvZ3A85K6Nw==@linaro.org X-Google-Smtp-Source: AGHT+IEL+v174hEoohhdh6h/jm3bH6gq3WHkzdwJh1Md6iHNWzHlq6qsXyT3baYSwwHNmpOR3cp0 X-Received: by 2002:a05:6512:1106:b0:536:53dd:6584 with SMTP id 2adb3069b0e04-53678fc99aamr6939433e87.34.1726480785488; Mon, 16 Sep 2024 02:59:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726480785; cv=none; d=google.com; s=arc-20240605; b=HjodOF22ap7izsDoRxk+1zdyIvZFrJzUHSki4/dhWeUNgWxL5p7wwAZfKxZ3WqJrJ5 GMH3mySYyzng39MbjrPs5KxB1rz+sPkrBeEppTmH6fPP1diIlMdOZc8ogQsNbIqrCcC9 wXqCB4mQpbyg0L08k6cJG7FjiPQ1nfaFLoouj8Yg+VHgFtuAP17VPW9mXXn40zll5hJY mDPaYPuiAT9BhXgIA/CZivEY7pe/Pve15qgMgS2N4JsR7WwG09P1dOEf+aJSOjt7ygsu bTRkgVms3/MrIlXwGMU2dp/nwD+MSwmPTKYrTjj8p8LV3onGVwXCFuYPPuTyvUWyCbSZ De5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=Vqy6PVBHxWJx4+pP+WOa/qhGDCdQPicD1vpW1c3GTF4=; fh=ftQntzGq59ruF58t30aRXV87AbbvorkS2P8ZbONQbrM=; b=CFb9a+uD9ONBElXMzde8Dq+v1fhZypps/Ny80Ow66iVOCJX+BOHg8HrIVBpagU1dbA Mm8jzpwgOZ9sEsCfzkYanmisczAH4bJAtaOytFLvdxj6vuGHnc76vL4eZJXjmXbHkrvi rg+WoxbVzDFvhfQnuidBVkQLcGFXh6AykeyLPobOsCqC+jWz5tp5ui31doYpCMr8CWxx 6UJdn81HUgG0wKVA/FzdntU5FbFwz6sLAD4EY8BqWv0MiWdzuxVsTV3COgGgOKKl6AHB lbEUJTsKREcV41Ukxt9MEfhOZua9Cd/H+3sW75TbvVopRic1gbraS6JFnEpIGd5VPHaI ajIA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zEjZVp8J; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id 5b1f17b1804b1-42d9b180d56si35156825e9.146.2024.09.16.02.59.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2024 02:59:45 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zEjZVp8J; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A4760889BD; Mon, 16 Sep 2024 11:59:00 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="zEjZVp8J"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 317C988EFA; Mon, 16 Sep 2024 11:59:00 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 75B6788EF4 for ; Mon, 16 Sep 2024 11:58:54 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=linus.walleij@linaro.org Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-5c3d209db94so5283061a12.3 for ; Mon, 16 Sep 2024 02:58:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726480734; x=1727085534; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Vqy6PVBHxWJx4+pP+WOa/qhGDCdQPicD1vpW1c3GTF4=; b=zEjZVp8JPbbQ9dJffrI6vKB5GSeWawwFHnOvsqYYaIoSNHxISzhIvhBSkyTPJF+OMB /XgiPOBd70w5IM2Fy1g4foa5jCdLoKZc4afLDbJxnluZ7PvBqI8Mt07kn+0ZQRx8MBRo 2+UnWZzwulDrfYWWSnBpdhTf+YSdEc7fHgHwy73VU4ULpdM2unJVz//5CaprekMXwSWP IeQjum8FrJHLdJWCbeTFAJVjl3fbZvrUtt1r1E5jGH29ywZFWEzdQBL9NGK4GNwnI1kO fdJ4F1HbR3mekysD8kwbcgV69ycWuxZkDR5mehiBuziNpE5euO/Yy5/52FYm2T+h3m+S 2dag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726480734; x=1727085534; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Vqy6PVBHxWJx4+pP+WOa/qhGDCdQPicD1vpW1c3GTF4=; b=kVwqJ1Yt+aOQtaB/mhno9K6RGhgVq9eyzRUR8KJ5436FfY+EXnotr5thcy2pdwLgLy bp3yfpwZGqq4PlQ5ijrJ09rbSph6l854ivaTAs5ZvJbmqUbljfj88B6ahBxAvJ/rxgjm R6IQt65nX6xBun918e3tR4FgKKx/+gOi4CvQALd7KgfQt1IHBYXWeS1fs6pPdYScWKiK B3E15axDcuZP76fr3CslLnYMNZQVTmAsKPlWVcmmqhTvc22RzfvYfMFhIEgw09KcgA3h QFO5q8fngir/rvKokMIdKIK4P9ro7dzn5m/yvXrojOFGRu5oEINwjNs3i3Yf0NIQxul6 mTHw== X-Gm-Message-State: AOJu0YzWcqwXH21COnWO+ANZ+zO/qb3uxmDG06IDD6pCT3jICMrijD+N 7OmxX3LQjHHbgByWtNPk+iWl4gCqLetzVhWyHFbrGe0SARktIlgGznEloklhYWE= X-Received: by 2002:a17:907:9446:b0:a86:894e:cd09 with SMTP id a640c23a62f3a-a90293c4fe5mr1674501366b.9.1726480733719; Mon, 16 Sep 2024 02:58:53 -0700 (PDT) Received: from lino.lan ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a906109662fsm292862966b.38.2024.09.16.02.58.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2024 02:58:52 -0700 (PDT) From: Linus Walleij Date: Mon, 16 Sep 2024 11:58:47 +0200 Subject: [PATCH v2 5/7] mtd: rawnand: brcmnand: Add read data bus interface MIME-Version: 1.0 Message-Id: <20240916-brcmnand-fixes-v2-5-08632f64c8ec@linaro.org> References: <20240916-brcmnand-fixes-v2-0-08632f64c8ec@linaro.org> In-Reply-To: <20240916-brcmnand-fixes-v2-0-08632f64c8ec@linaro.org> To: u-boot@lists.denx.de, Dario Binacchi , Michael Trimarchi , Anand Gore , William Zhang , Kursad Oney , Philippe Reynes Cc: Linus Walleij X-Mailer: b4 0.14.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean This is a port of the read data bus interface from the Linux brcmnand driver, commit 546e425991205f59281e160a0d0daed47b7ca9b3 "mtd: rawnand: brcmnand: Add BCMBCA read data bus interface" This is needed for the BCMBCA RAW NAND driver. Signed-off-by: William Zhang Signed-off-by: Linus Walleij Reviewed-by: William Zhang --- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 20 +++++++++++++++++--- drivers/mtd/nand/raw/brcmnand/brcmnand.h | 2 ++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c index 552b239b95ae..2f786584a1ae 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c @@ -769,6 +769,20 @@ static inline void brcmnand_write_fc(struct brcmnand_controller *ctrl, __raw_writel(val, ctrl->nand_fc + word * 4); } +static inline void brcmnand_read_data_bus(struct brcmnand_controller *ctrl, + void __iomem *flash_cache, u32 *buffer, int fc_words) +{ + struct brcmnand_soc *soc = ctrl->soc; + int i; + + if (soc && soc->read_data_bus) { + soc->read_data_bus(soc, flash_cache, buffer, fc_words); + } else { + for (i = 0; i < fc_words; i++) + buffer[i] = brcmnand_read_fc(ctrl, i); + } +} + static void brcmnand_clear_ecc_addr(struct brcmnand_controller *ctrl) { @@ -1812,7 +1826,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); @@ -1825,8 +1839,8 @@ 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); + 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 6946a62b0679..3a1d60471361 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.h +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.h @@ -11,6 +11,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); void *ctrl; };