Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp2474607ybe; Sat, 7 Sep 2019 16:48:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqxC4MMqoSLh3HvufdWmmrpigEuyVhFkFltwqw3WyHzGGOXXroZg3jfb5V7B+4ZKTW4APCM6 X-Received: by 2002:a17:902:7781:: with SMTP id o1mr17163734pll.238.1567900102716; Sat, 07 Sep 2019 16:48:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567900102; cv=none; d=google.com; s=arc-20160816; b=kwKXmtWxTquGPhzSotqPEFnz1ZKPgFSew11i8Mvi6vWVNSUIBFNwPxjGySyvNe+r+Q j2YVOxclIt0vFRQ3vxV87fv+aoQckBERY+dWhSrVvi/Sq/FxKLNYVXvtcNbz9xKiCz17 wvem5ZwCSNAoxDO2AhIJxGUXosgBKHpknzYKx1SOs+1IZ6vZSE4qFWVq9X+Qe9Ovd7jI RpreIart9RbDhbrzGLFTV9l2NjFtHPQMOtuHiT6vftRwuzaMz6fs4ThOECNsxrdlGQ2Z Y2VVTdVyqvsK+tjmcfjhCcnNTB/WjuYo71jQMn2AClMeZIo6fjgf+QAZCB+rLs0PIyfU Y2GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=uAzFuMJFC8Qs6zalTfHoEOACCJjWE6SxXCJNlMiufmc=; b=AZy2efaPSOGl4inD5ubxFR3gGaNBekQOhzxH925if+oX23AgkpT3FcWqTEqvSsYhJb 0As5T8mO9vXxWiMvg3rHQxQnFgqx7vlzxb1hVAz2iy2EoS0gIideXf7cpI5sIVq1K4Kw 7TBESM+1b6uD0XCjy5agYS+Mcscppfheo3DunIYbaQXmisy0i7ZnTe5cNYYiFeusc+Vd 9qlC9QfVoIWDVMlqRuerC+MdHffC9i35gZrL/PnDayZg7AMMIF5UwBy4ehs3DcnvE6uc hvCGnIHuFY3UMoF9pbmba7ZHVrv8+UxNXa9hyiKF7j8Z9GR55rNsZblwEjZvMYNRAbqz q4DA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RKKwKRs2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f12si8165495pgp.218.2019.09.07.16.47.29; Sat, 07 Sep 2019 16:48:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RKKwKRs2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732011AbfIFTtM (ORCPT + 99 others); Fri, 6 Sep 2019 15:49:12 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:40075 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725846AbfIFTtM (ORCPT ); Fri, 6 Sep 2019 15:49:12 -0400 Received: by mail-pg1-f195.google.com with SMTP id w10so4077608pgj.7 for ; Fri, 06 Sep 2019 12:49:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=uAzFuMJFC8Qs6zalTfHoEOACCJjWE6SxXCJNlMiufmc=; b=RKKwKRs2N6yoI0pB2oH4Uv9SbRzRWQEW0woC725TrgQ5hhPfgqJWWtes733p+nCc4u ds98ZXgCub53C6qaASOae9vIW3w2C7hXik/fsEOhicdwKkxuKJcR6hWAE4HsDXbnU9U0 5gNeKjfnE2BGZhJNJ8AAVceGHsbxrZOOpmfEkOef6xgNdcNdw/DE1xZIQ8TUu9MinI/j OxfwccCtnukauMPYWIs4U4jT+wlBUWnze7aTbQThbkKOBNuwJbBeouUFufFHctIO45OV lXZikXmPFrQJsxk871LQr1cv4vXt4Gc5+hdxl/AAKi+K5cUaYMyhCEp7HTne/9AyBaDS WrVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=uAzFuMJFC8Qs6zalTfHoEOACCJjWE6SxXCJNlMiufmc=; b=Bid/zszyssFDNi2gFQX7CP5qUcsuZs4nJiH6gU+viw+66o8LUaaeLEn0QAl4Lt5Cgq 5lOUGbAHBVszelptpvOJCFkhDPzI4lGOTgEL+c6QD/iA+pLWEJjg5+ray4eZfp6PunAz FIayf0YXLzYkRLnl4EzpY2jQ+YLqFoaXJ+d5vGFR764Stb1GIGaFST6jmssPwfhnTtYu UoKV/tZZ2TWgg1UiaIWMEczwoKMC8E7BCCYyQ8raiYtlFYgpuR5WYugS1L7j0rDRHfDQ zgdrKZiaLJRx5QZPhFxoo4oS0ENAB+IoDQNgSYdwgsoRsOF0NhEkAiCKOhr1IfFpVMpo iyFg== X-Gm-Message-State: APjAAAWHYLgW9eB9k0ePorHYgxoclDtISZP/6cA9JxVbY+kcD9mb7Uaj qPYakz1shFyVgvNbwbEs1+I= X-Received: by 2002:a17:90a:2e15:: with SMTP id q21mr11395700pjd.97.1567799351470; Fri, 06 Sep 2019 12:49:11 -0700 (PDT) Received: from mail.broadcom.com ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id c127sm9830119pfb.5.2019.09.06.12.49.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2019 12:49:10 -0700 (PDT) From: Kamal Dasu To: kdasu.kdev@gmail.com Cc: Brian Norris , Miquel Raynal , Richard Weinberger , David Woodhouse , Marek Vasut , Vignesh Raghavendra , Boris Brezillon , Frieder Schrempf , linux-mtd@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] mtd: nand: brcmnand: Add support for flash-dma v0 Date: Fri, 6 Sep 2019 15:47:15 -0400 Message-Id: <20190906194719.15761-1-kdasu.kdev@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This change adds support for flash dma v0.0. Signed-off-by: Kamal Dasu --- 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 33310b8a6eb8..1eade9dc3b0d 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c @@ -117,6 +117,18 @@ enum flash_dma_reg { FLASH_DMA_CURRENT_DESC_EXT, }; +/* 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, @@ -597,6 +609,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; } @@ -1673,8 +1687,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; -- 2.17.1