Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp4845379ybe; Mon, 9 Sep 2019 15:52:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqzZV57OGQHzvr5ZicetHSzSZt3YXFl8+yycqQDYbw4oJDAolMY4dqQRn3YX0BdWQES5C6UB X-Received: by 2002:aa7:db05:: with SMTP id t5mr27507310eds.242.1568069541338; Mon, 09 Sep 2019 15:52:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568069541; cv=none; d=google.com; s=arc-20160816; b=bymDcjZ6pdreMhCp89BozOJ91++P39CqGuuALKxzm0vfPtu+pfyVaAedCTatmxK6gi WXoT0Cld13dfbj6L1Q81Ys2kFDZbfeyJCA4n0qSTQOSl1v1M67wQghFO9A2o8WegJ3ts vLYApEp7wcpn0iMsgbsE+Vg9TKgILFEhxU4gSzgaDEhh2HkCd8jGCIrkn/lBNVZje2yB cObplID/LKTQNrp2S7DBm4uJq6lzEfHdtQjWP4WHKKe3sI4QhBwaj2GCcZgUK3DS50Q2 LdiD5b2R54nHV+eySlcMvUqD5dgRo4SJ5nC1GfvT6hTaNML78I9y+bXCfPmPPcMnB+Ok aBPw== 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=qyn62ntm503u5PKUtOnrJJdBYIYdXadbwsLVaszX0TA=; b=Qy612v5wvSgPacHFTPFSVVUTDkonnJETLHzIjcgBxXXRmKUup+ZM+JtHBV2XGgQE4f 9HwZ6XhizwnNltttx4ndXtDcreSRZIBUOJIivN3ge9+4yu9/z48Xs8u9+kop0bAsjUa5 V7QGOK1y87gWFFUonLm39JfuPwHNJlvXh+FD2JT2vF/OyuHkJhhHiPb4WfANTUGitbgf JRgz8yVUpDRtuFbDti48yhhLHQSaRVSBx1NUQhrZiggm0UzYFs2623SNzFGjbHU7vyk1 b9SsPdFGw8zKHZ6Mtkhr4D6YXuyNqactG0f1PlRtiei7PtkDBxOSnQMMVMQ2f6Zep5u0 TA8Q== 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 of21si8005326ejb.72.2019.09.09.15.51.57; Mon, 09 Sep 2019 15:52:21 -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 S1731475AbfIIKru (ORCPT + 99 others); Mon, 9 Sep 2019 06:47:50 -0400 Received: from mga07.intel.com ([134.134.136.100]:17906 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726509AbfIIKrt (ORCPT ); Mon, 9 Sep 2019 06:47:49 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Sep 2019 03:47:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,484,1559545200"; d="scan'208";a="185158774" Received: from sgsxdev004.isng.intel.com (HELO localhost) ([10.226.88.13]) by fmsmga007.fm.intel.com with ESMTP; 09 Sep 2019 03:47:44 -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 v3 2/3] mtd: spi-nor: cadence-quadspi: Disable the DAC for Intel LGM SoC Date: Mon, 9 Sep 2019 18:47:32 +0800 Message-Id: <20190909104733.14273-3-vadivel.muruganx.ramuthevar@linux.intel.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190909104733.14273-1-vadivel.muruganx.ramuthevar@linux.intel.com> References: <20190909104733.14273-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's Lightning Mountain(LGM) SoCs QSPI controller do not use Direct Access Controller(DAC). This patch introduces to properly 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 | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/Kconfig b/drivers/mtd/spi-nor/Kconfig index 6de83277ce8b..ba2e372ae514 100644 --- a/drivers/mtd/spi-nor/Kconfig +++ b/drivers/mtd/spi-nor/Kconfig @@ -34,7 +34,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 67f15a1f16fd..73b9fbd1508a 100644 --- a/drivers/mtd/spi-nor/cadence-quadspi.c +++ b/drivers/mtd/spi-nor/cadence-quadspi.c @@ -33,6 +33,7 @@ /* Quirks */ #define CQSPI_NEEDS_WR_DELAY BIT(0) +#define CQSPI_DISABLE_DAC_MODE BIT(1) /* Capabilities mask */ #define CQSPI_BASE_HWCAPS_MASK \ @@ -609,6 +610,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); @@ -1328,6 +1336,7 @@ static int cqspi_probe(struct platform_device *pdev) struct resource *res_ahb; struct reset_control *rstc, *rstc_ocp; const struct cqspi_driver_platdata *ddata; + struct cqspi_flash_pdata *f_pdata; int ret; int irq; @@ -1436,6 +1445,9 @@ static int cqspi_probe(struct platform_device *pdev) goto probe_setup_failed; } + if (ddata && (ddata->quirks & CQSPI_DISABLE_DAC_MODE)) + f_pdata->use_direct_mode = false; + return ret; probe_setup_failed: cqspi_controller_enable(cqspi, 0); @@ -1510,6 +1522,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", @@ -1523,6 +1540,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