Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2459978imu; Thu, 17 Jan 2019 14:47:43 -0800 (PST) X-Google-Smtp-Source: ALg8bN4820Fo3HTnHVt1Fl9ppz5BIfFBg4CAVcqSJAckdW02JLl8wNt3TLcOsnnu5JGbznzigtvw X-Received: by 2002:a17:902:bd86:: with SMTP id q6mr16367674pls.16.1547765263110; Thu, 17 Jan 2019 14:47:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547765263; cv=none; d=google.com; s=arc-20160816; b=kqza5P4ef8BEW9MEc+03qCBUa9sTIi7YI2CZKMLPx83DHlmEVU2CClsW9uSBuOaALr he/yvrA92DTwq45ykoOgY17JZ12AL8HWvM1ht1uTQihDrqdlJTPYFPWQkzA4J+Z0xrl0 BxiHXostqAiTtQZdabClRavQMBLtVklKIvk5tFAKWTNjQ1bsVGIyyNBR3rxNwi/qskl8 az48HKp41uv8ySRKI5LvwFjptNukNH0cjffWQhx9/YBZwetj64lEtMvZQ5WQfRQH/BS2 pXfPuG44Izadg4hq9pbLiqjDnqJA5zaukZzdTbyNjqMFOZ4z/EhLuH01m8KIs9TJChUb t9/g== 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:dkim-signature; bh=PVwjhODYAGeltgvzngJ8dtO1QRgp91fRfTD4Ke5HM8I=; b=MB/1U0Jw+U3njDAVbmxCv0V6Ytlcm8hiREhjeK1awCliKly7Zq7uhIKhNAX+yWuJfW GXMiy05FJo4zmYAiONnKhQtX+dHtKhPt1UeFxKmQGkzQtklDyc0Tg5SF3tPVkW8VQ928 s/wPSX46H7uVktzPfyuwHhnkTTnvzY/4wgmPV424+jHOjUI2a8izfU3r04cy9TwTSJJ1 daVsRk1g5xiy2zJTeMUeJVJm+whA6WumA2HFvRV6ALeyIgT6L1KtkGZEJL//xkMYWq7v IiwGj2K2ZtAyAq/olR3pSnzSEsojZaMatFZd4GmdmvUbjZhQfFQerR53d9D+w8N0Sitx 6TkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@crapouillou.net header.s=mail header.b=O1vMjcOa; 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=crapouillou.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w2si2415104pgp.546.2019.01.17.14.47.27; Thu, 17 Jan 2019 14:47:43 -0800 (PST) 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=fail header.i=@crapouillou.net header.s=mail header.b=O1vMjcOa; 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=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726839AbfAQWqN (ORCPT + 99 others); Thu, 17 Jan 2019 17:46:13 -0500 Received: from outils.crapouillou.net ([89.234.176.41]:47704 "EHLO crapouillou.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726782AbfAQWqL (ORCPT ); Thu, 17 Jan 2019 17:46:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1547765169; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=PVwjhODYAGeltgvzngJ8dtO1QRgp91fRfTD4Ke5HM8I=; b=O1vMjcOamfxjqJMoO2mmVReD5JGwQIfUPdkaYnKVN2pYJ6uPqcO7rnRDfd4um6U10A5gal 8Sw/GJzHOjCzshOvlI9uA/voxunGn8aF9/u3cxowJbknjslDQMXXcAMrgUgHNOIbi3/G45 C8b5iSVgWVr0ah5xB8ywne+uJD0GnEU= From: Paul Cercueil To: Rob Herring , Mark Rutland , Miquel Raynal , Boris Brezillon Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH 4/4] memory: jz4780_nemc: Add support for the JZ4725B Date: Thu, 17 Jan 2019 19:45:50 -0300 Message-Id: <20190117224550.18043-4-paul@crapouillou.net> In-Reply-To: <20190117224550.18043-1-paul@crapouillou.net> References: <20190117224550.18043-1-paul@crapouillou.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add support for the JZ4725B SoC from Ingenic. Signed-off-by: Paul Cercueil --- drivers/memory/jz4780-nemc.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/drivers/memory/jz4780-nemc.c b/drivers/memory/jz4780-nemc.c index ef3f20e46590..c472a22d6df5 100644 --- a/drivers/memory/jz4780-nemc.c +++ b/drivers/memory/jz4780-nemc.c @@ -44,9 +44,14 @@ #define NEMC_NFCSR_NFCEn(n) BIT((((n) - 1) << 1) + 1) #define NEMC_NFCSR_TNFEn(n) BIT(16 + (n) - 1) +struct jz_soc_info { + u8 tas_tah_cycles_max; +}; + struct jz4780_nemc { spinlock_t lock; struct device *dev; + const struct jz_soc_info *soc_info; void __iomem *base; struct clk *clk; uint32_t clk_period; @@ -202,7 +207,7 @@ static bool jz4780_nemc_configure_bank(struct jz4780_nemc *nemc, if (of_property_read_u32(node, "ingenic,nemc-tAS", &val) == 0) { smcr &= ~NEMC_SMCR_TAS_MASK; cycles = jz4780_nemc_ns_to_cycles(nemc, val); - if (cycles > 15) { + if (cycles > nemc->soc_info->tas_tah_cycles_max) { dev_err(nemc->dev, "tAS %u is too high (%u cycles)\n", val, cycles); return false; @@ -214,7 +219,7 @@ static bool jz4780_nemc_configure_bank(struct jz4780_nemc *nemc, if (of_property_read_u32(node, "ingenic,nemc-tAH", &val) == 0) { smcr &= ~NEMC_SMCR_TAH_MASK; cycles = jz4780_nemc_ns_to_cycles(nemc, val); - if (cycles > 15) { + if (cycles > nemc->soc_info->tas_tah_cycles_max) { dev_err(nemc->dev, "tAH %u is too high (%u cycles)\n", val, cycles); return false; @@ -278,6 +283,10 @@ static int jz4780_nemc_probe(struct platform_device *pdev) if (!nemc) return -ENOMEM; + nemc->soc_info = device_get_match_data(dev); + if (!nemc->soc_info) + return -EINVAL; + spin_lock_init(&nemc->lock); nemc->dev = dev; @@ -370,8 +379,17 @@ static int jz4780_nemc_remove(struct platform_device *pdev) return 0; } +static const struct jz_soc_info jz4725b_soc_info = { + .tas_tah_cycles_max = 7, +}; + +static const struct jz_soc_info jz4780_soc_info = { + .tas_tah_cycles_max = 15, +}; + static const struct of_device_id jz4780_nemc_dt_match[] = { - { .compatible = "ingenic,jz4780-nemc" }, + { .compatible = "ingenic,jz4725b-nemc", .data = &jz4725b_soc_info, }, + { .compatible = "ingenic,jz4780-nemc", .data = &jz4780_soc_info, }, {}, }; -- 2.11.0