From patchwork Sat Feb 11 15:29:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 652696 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp1537298wrr; Sat, 11 Feb 2023 07:30:33 -0800 (PST) X-Google-Smtp-Source: AK7set9wFlYgYGd+wZLDM8ni4wBPidR8jLIZ0C8SLUKPhwR7z8MqjEbYXy7cV24T52ZKILAp4ROl X-Received: by 2002:aca:2401:0:b0:378:9c51:3ed6 with SMTP id n1-20020aca2401000000b003789c513ed6mr8097816oic.20.1676129433131; Sat, 11 Feb 2023 07:30:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676129433; cv=none; d=google.com; s=arc-20160816; b=ouACyV0Qw+A/3vlR3aHWW+cjnjBCh2bx6HRz5UyaJkcVqqLqlEP4yddgNRy/EI9O1T GLkuE+o0c1YJfkj54GOrmYEFeAqwSMoV2Cj+udLkasuolCS3ao+G2SE/5uqE66JfHhqq k6ZRlwfh428W/TGHnUzgW/og6e674KMQQH1F18bZl5Bfzvyqmuxv++XND7QCy+AXoD0X W757HhuALo7gS/zhlbg2aVwDOPYYLMkTGKsc9t5ovw2EU/ayTUax+ZUtEYEnVai/CuZx 7t8eojKZm9LnnEDc0qY62f+y3JK5NYqjxzeS1T0pI5rsD75Z+gVGIYXoJb19su8D/cIb 1Gig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Wg8CvbH6oag7e9s5/CAPHzV05zxO8iZA6F2coGGE+hU=; b=IXCMRzZ/5JyZjixdfmb3tNFFosRcUQdgZTSggnAgMKJIHVnS9nJ8+FvZ01csWlt8AA xbcD8rF0m26RvnELiDS9BxL93WbVIdoNGFelydQFxYQGaq/byeehRmT6fk02hbwmMtcJ 3aJF5PTOwpip7KDBhV3bmmt1l/Xs4wFJcuza1g8euth9ox30RH8frH+KJ3muByaYfclg hBfw1p64yeyHw96ya3X5SRkiVS9GaA5p69p5pLf4BbCcvSpXd5Drjpgjpbogx1eZVVC1 u2UqmpFDllzH4XjV6MhmfbtYVvD3hB02gzuOsIzYA7zhEq6FGh6+uxx2p8CkxfkO+zfI ENTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VTmnrvz9; 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 Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id i128-20020acaea86000000b003784bcf6537si6547782oih.309.2023.02.11.07.30.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Feb 2023 07:30:33 -0800 (PST) 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=VTmnrvz9; 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 Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 655EF85794; Sat, 11 Feb 2023 16:29:35 +0100 (CET) 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="VTmnrvz9"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 28DC085780; Sat, 11 Feb 2023 16:29:27 +0100 (CET) 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-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) (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 F130B85762 for ; Sat, 11 Feb 2023 16:29:23 +0100 (CET) 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-ej1-x62a.google.com with SMTP id qb15so20393814ejc.1 for ; Sat, 11 Feb 2023 07:29:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Wg8CvbH6oag7e9s5/CAPHzV05zxO8iZA6F2coGGE+hU=; b=VTmnrvz9GrfztCerbFHa85ZPf9xq/xhK0O4AX3xrXZav7JTCaUdiUnedCpS6FmlZwf MoyE6cK7maHq0LgLyWCXgTcNaVani0fIkCFqP//k4EQlphuWhmWv7oVfwXf2RPOwPiuD 3llejtrkvFkeOVeTn6/xPndwLRWeNshqbGU8wVo+F0RKN9qjOm5WqS5XQwsY9uO0iHt8 agbEc4ejQpdAkTXYdv86Fbam7dQ3WI0LAjwUqcx7pNuhQRMqwpijw692xjetUTknOMIq JNwr9+tbOnngnlYHYQB5+DAjLVmsLh5fbgkv4PsXA5Rs8mYYP/opKpetm9i9Tm3CJTix 4+xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding: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=Wg8CvbH6oag7e9s5/CAPHzV05zxO8iZA6F2coGGE+hU=; b=8Gdr5YWPP6tagsiEOYedsryftucL1scl/mxqRXbe0odbu8OaAwCVSjE50w3opB2CY5 CVawRtz8Dfz7SO7F2sOMz7KOSMsN0T/dlxy7SxEPjd6Ul50H/7/TlpwmFIwzrmzKtZHx AWmocZBQd6oOEmLkCIA0Jp4IsD8+hC5sRornH98xgPkM3A+RCrUaYZ6hp8ZuvjTR88OF +oWZJbMOKbxQRYyN/39iogoqACct4X8iSVrNbYz++90OPV6MTIoQfdxJs40jmf6DxUFg DZAqiMEQBwfml8858y613Shrd0LCLyFcNnd2UQ/9sHXrY0kbe+RGpa3fYvZDJTQjk6iB Gfig== X-Gm-Message-State: AO0yUKXbY0z85b3RpVmFJ2ipiyxHmP0FXguZpnIdJeos6ikTfjpm6ST1 oeeNK3fBp/r3cARcIXqw7dFiOAS73qn6wlUi X-Received: by 2002:a17:907:7212:b0:8ac:8f3c:7f65 with SMTP id dr18-20020a170907721200b008ac8f3c7f65mr11794642ejc.48.1676129362664; Sat, 11 Feb 2023 07:29:22 -0800 (PST) Received: from Fecusia.lan (c-05d8225c.014-348-6c756e10.bbcust.telenor.se. [92.34.216.5]) by smtp.gmail.com with ESMTPSA id f26-20020a170906825a00b0084c4b87aa18sm3977768ejx.37.2023.02.11.07.29.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Feb 2023 07:29:21 -0800 (PST) From: Linus Walleij To: u-boot@lists.denx.de, Tom Rini , Michael Nazzareno Trimarchi Cc: Anand Gore , William Zhang , Kursad Oney , Joel Peshkin , Philippe Reynes , =?utf-8?b?UmFmYcWCIE1p?= =?utf-8?b?xYJlY2tp?= , Kamal Dasu , Miquel Raynal , Linus Walleij Subject: [PATCH v2 04/10] mtd: nand: brcmnand: Add support for flash-dma v0 Date: Sat, 11 Feb 2023 16:29:03 +0100 Message-Id: <20230211152909.1436133-5-linus.walleij@linaro.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230211152909.1436133-1-linus.walleij@linaro.org> References: <20230211152909.1436133-1-linus.walleij@linaro.org> MIME-Version: 1.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.6 at phobos.denx.de X-Virus-Status: Clean From: Kamal Dasu This change adds support for flash dma v0.0. Signed-off-by: Kamal Dasu Signed-off-by: Miquel Raynal [Ported to U-Boot from the Linux kernel] Signed-off-by: Linus Walleij Acked-by: William Zhang --- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c index 0402cb06a74b..a934373a2992 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c @@ -120,6 +120,18 @@ enum flash_dma_reg { }; #ifndef __UBOOT__ +/* flash_dma registers v0*/ +static const u16 flash_dma_regs_v0[] = { + [FLASH_DMA_REVISION] = 0x00, + [FLASH_DMA_FIRST_DESC] = 0x04, + [FLASH_DMA_CTRL] = 0x08, + [FLASH_DMA_MODE] = 0x0c, + [FLASH_DMA_STATUS] = 0x10, + [FLASH_DMA_INTERRUPT_DESC] = 0x14, + [FLASH_DMA_ERROR_STATUS] = 0x18, + [FLASH_DMA_CURRENT_DESC] = 0x1c, +}; + /* flash_dma registers v1*/ static const u16 flash_dma_regs_v1[] = { [FLASH_DMA_REVISION] = 0x00, @@ -614,6 +626,8 @@ static void brcmnand_flash_dma_revision_init(struct brcmnand_controller *ctrl) /* flash_dma register offsets */ if (ctrl->nand_version >= 0x0703) ctrl->flash_dma_offsets = flash_dma_regs_v4; + else if (ctrl->nand_version == 0x0602) + ctrl->flash_dma_offsets = flash_dma_regs_v0; else ctrl->flash_dma_offsets = flash_dma_regs_v1; } @@ -1645,8 +1659,11 @@ static void brcmnand_dma_run(struct brcmnand_host *host, dma_addr_t desc) flash_dma_writel(ctrl, FLASH_DMA_FIRST_DESC, lower_32_bits(desc)); (void)flash_dma_readl(ctrl, FLASH_DMA_FIRST_DESC); - flash_dma_writel(ctrl, FLASH_DMA_FIRST_DESC_EXT, upper_32_bits(desc)); - (void)flash_dma_readl(ctrl, FLASH_DMA_FIRST_DESC_EXT); + if (ctrl->nand_version > 0x0602) { + flash_dma_writel(ctrl, FLASH_DMA_FIRST_DESC_EXT, + upper_32_bits(desc)); + (void)flash_dma_readl(ctrl, FLASH_DMA_FIRST_DESC_EXT); + } /* Start FLASH_DMA engine */ ctrl->dma_pending = true;