Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp499375ybg; Fri, 18 Oct 2019 03:07:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqxQTVvR/Rdwmop/txTC9MZ+NUbkZYxe92k5jFXlofH8JkDaSTECp+1+sqXb5CJx4zr4hjaY X-Received: by 2002:a50:d4d7:: with SMTP id e23mr8624515edj.135.1571393251679; Fri, 18 Oct 2019 03:07:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571393251; cv=none; d=google.com; s=arc-20160816; b=QW3/DyZe6U9lBn1bI91pW7GQSxwCxrWl1CuDCZWPkqB8XY1ihy8X+jRJ3E9J97AU9a vRR4Ec5QVeawxBoyoTvf9/dQtWVwYQMkSzc/dSvuvTm9882aZAAC1g9Ss1+2BqQwQBld 8obCemub0MgG91Rm0J0NOogkY2/pcRRsEUGihOE8W0M64UMDByMLhh1tO+WpRsyFZbdd 3MCKAyGqEB3exiFkGrwocWYQHblFXrEGCPuFIc+BJ6I/iPbgEhxPuiit0ixojcce9UID 8dXVKsORluTirwwCNENDGN8qiZs5jwiCwrT5vkLBuM3mUwJv27XhdpNsGb4uIHlbEbj0 OkNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=IiX70rIJRkVTeQBGuO5XdCGSQZVCtM8BXBg5cJRW/K0=; b=xItWjobL2aDwDGz/haMq4BQuMiQLapfIQQMcfQMo87DEiM8eEmBlieDxdeI3zD+ahn 4h6paTMLet8apz4VaxnvZU3+cBcTFuNd+7Aqw8paunu/EXlWW97B4VKTM4iKg+prjKOi YzokVLTyOqT1awyWwOZHOKrdOuAQQTfAo0N0Ey/xJkAEeh0grQiH6YZwwT8icaLSS7YD 7MHFTXJztd66FLtNcrfH0jT/UEYfNg2GORD3BThO2+1p2mZc9IPVgKONOOfj+FWhjl4z UrI/oHmlwK6Tvt5E5G89HXfN+EMSApEJfRh4NgF4pNG7+Ffi8wVZ5LjXmoXMrkS/KsYk 2fLw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u2si3139209ejr.332.2019.10.18.03.07.08; Fri, 18 Oct 2019 03:07:31 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2408092AbfJQHUO (ORCPT + 99 others); Thu, 17 Oct 2019 03:20:14 -0400 Received: from mga03.intel.com ([134.134.136.65]:58813 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2408044AbfJQHUN (ORCPT ); Thu, 17 Oct 2019 03:20:13 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Oct 2019 00:20:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,306,1566889200"; d="scan'208";a="396164642" Received: from sgsxdev004.isng.intel.com (HELO localhost) ([10.226.88.13]) by fmsmga005.fm.intel.com with ESMTP; 17 Oct 2019 00:20:09 -0700 From: "Ramuthevar,Vadivel MuruganX" To: linux-mtd@lists.infradead.org Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, dwmw2@infradead.org, computersforpeace@gmail.com, richard@nod.at, jwboyer@gmail.com, boris.brezillon@free-electrons.com, cyrille.pitchen@atmel.com, david.oberhollenzer@sigma-star.at, miquel.raynal@bootlin.com, tudor.ambarus@gmail.com, vigneshr@ti.com, andriy.shevchenko@intel.com, cheol.yong.kim@intel.com, qi-ming.wu@intel.com, Ramuthevar Vadivel Murugan Subject: [PATCH v4 1/2] mtd: spi-nor: cadence-quadspi: Disable the DAC for Intel LGM SoC Date: Thu, 17 Oct 2019 15:19:59 +0800 Message-Id: <20191017072000.48860-2-vadivel.muruganx.ramuthevar@linux.intel.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191017072000.48860-1-vadivel.muruganx.ramuthevar@linux.intel.com> References: <20191017072000.48860-1-vadivel.muruganx.ramuthevar@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ramuthevar Vadivel Murugan On Intel Lightning Mountain(LGM) SoCs QSPI controller do not use Direct Access Controller(DAC). This patch adds a quirk to disable the Direct Access Controller for data transfer instead it uses indirect data transfer. Signed-off-by: Ramuthevar Vadivel Murugan --- drivers/mtd/spi-nor/Kconfig | 2 +- drivers/mtd/spi-nor/cadence-quadspi.c | 33 +++++++++++++++++++++++++++------ 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/drivers/mtd/spi-nor/Kconfig b/drivers/mtd/spi-nor/Kconfig index f237fcdf7f86..ef1aa369c2e3 100644 --- a/drivers/mtd/spi-nor/Kconfig +++ b/drivers/mtd/spi-nor/Kconfig @@ -36,7 +36,7 @@ config SPI_ASPEED_SMC config SPI_CADENCE_QUADSPI tristate "Cadence Quad SPI controller" - depends on OF && (ARM || ARM64 || COMPILE_TEST) + depends on OF && (ARM || ARM64 || COMPILE_TEST || X86) help Enable support for the Cadence Quad SPI Flash controller. diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c index 7bef63947b29..0ad076eaa81b 100644 --- a/drivers/mtd/spi-nor/cadence-quadspi.c +++ b/drivers/mtd/spi-nor/cadence-quadspi.c @@ -34,6 +34,7 @@ /* Quirks */ #define CQSPI_NEEDS_WR_DELAY BIT(0) +#define CQSPI_DISABLE_DAC_MODE BIT(1) /* Capabilities mask */ #define CQSPI_BASE_HWCAPS_MASK \ @@ -600,6 +601,13 @@ static int cqspi_write_setup(struct spi_nor *nor) struct cqspi_st *cqspi = f_pdata->cqspi; void __iomem *reg_base = cqspi->iobase; + /* Disable direct access controller */ + if (!f_pdata->use_direct_mode) { + reg = readl(reg_base + CQSPI_REG_CONFIG); + reg &= ~CQSPI_REG_CONFIG_ENB_DIR_ACC_CTRL; + writel(reg, reg_base + CQSPI_REG_CONFIG); + } + /* Set opcode. */ reg = nor->program_opcode << CQSPI_REG_WR_INSTR_OPCODE_LSB; writel(reg, reg_base + CQSPI_REG_WR_INSTR); @@ -1292,12 +1300,16 @@ static int cqspi_setup_flash(struct cqspi_st *cqspi, struct device_node *np) f_pdata->registered = true; if (mtd->size <= cqspi->ahb_size) { - f_pdata->use_direct_mode = true; - dev_dbg(nor->dev, "using direct mode for %s\n", - mtd->name); - - if (!cqspi->rx_chan) - cqspi_request_mmap_dma(cqspi); + if (ddata && (ddata->quirks & CQSPI_DISABLE_DAC_MODE)) { + f_pdata->use_direct_mode = false; + } else { + f_pdata->use_direct_mode = true; + dev_dbg(nor->dev, "using direct mode for %s\n", + mtd->name); + + if (!cqspi->rx_chan) + cqspi_request_mmap_dma(cqspi); + } } } @@ -1501,6 +1513,11 @@ static const struct cqspi_driver_platdata am654_ospi = { .quirks = CQSPI_NEEDS_WR_DELAY, }; +static const struct cqspi_driver_platdata intel_lgm_qspi = { + .hwcaps_mask = CQSPI_BASE_HWCAPS_MASK, + .quirks = CQSPI_DISABLE_DAC_MODE, +}; + static const struct of_device_id cqspi_dt_ids[] = { { .compatible = "cdns,qspi-nor", @@ -1514,6 +1531,10 @@ static const struct of_device_id cqspi_dt_ids[] = { .compatible = "ti,am654-ospi", .data = &am654_ospi, }, + { + .compatible = "intel,lgm-qspi", + .data = &intel_lgm_qspi, + }, { /* end of table */ } }; -- 2.11.0