From patchwork Thu Oct 11 18:53:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 148667 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp2481813lji; Thu, 11 Oct 2018 11:54:11 -0700 (PDT) X-Google-Smtp-Source: ACcGV62bRLTjy7MqVXwufmHUgb4XEn440c7QRfBZGNVAxOfZxacoKce8xk0edgUWj1XElDSwqyvI X-Received: by 2002:a63:e116:: with SMTP id z22-v6mr2435956pgh.20.1539284051346; Thu, 11 Oct 2018 11:54:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539284051; cv=none; d=google.com; s=arc-20160816; b=TJGb70tblJQCUfvS3NjSxVPNCZW+mL4geMZAtzIkTvhiF4lTNLtB8hDQzw8TpF7oIF 8n31rPaq6CqOT014x8CC8IWeffetw0VImF2NsfDlVFgv19741ve2SpSocpr5KK80qizY QPgnaxe1chuGrgccTAjPi0JODwjq0qyRFs5jxbZxUxRWa8ZssksHJxjtFMXDBzBM4NH4 /9NlGTUlaQCe+yXCgJd8vUC2BtddFmrpUiud+ZaIhUg8CYiCHGrBR6cn94v29xPVY/hJ CD0bArnNAOFYGMu68FC2+eSbW08xxxzClxJ1MsMonNeaG+jWyxbW7l5EluZWb00esrzg bxAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:message-id:date:subject:to:from:dkim-signature :dkim-signature; bh=qSxVl+Qr7OZ6JrZcM97jYRgvAh2dPQ0Fpqb1gdUSC+8=; b=wCPtdtiHD/woBU1VdfESVtJyDvWOuFvadugZQphZywbOu32MQcL7BLs5IHNskFB6F5 Ei0gdLjvqEe6K7556CofnbYs/AS8CMMzdmbRt0jtGTC75jEDVOjQ5s4Ft58EPuEvC9rn 5ZwEK9IQa+GUWp0qFoc1I7dbmO/vHMR/R0LBEVl6TWEJGhkUi/MWuk0CjlaNo6wROgeg rVUdqpzQ1gOCFX9Kpi5K4g4A1M+8tp3gsemR/rBrUFJcqyVPWuOYSiyfeydPUVbZnAFR ZqZGyiTI/W7tFV+PcQIloZD72nAArUf4FvYzWDyImsyOtG7aK3YDKmjNuObsJb5zD2tn EqsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b="Znvlxd2/"; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=E4UFDSvr; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id n3-v6si30039084plb.435.2018.10.11.11.54.11 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 11 Oct 2018 11:54:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b="Znvlxd2/"; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=E4UFDSvr; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=qSxVl+Qr7OZ6JrZcM97jYRgvAh2dPQ0Fpqb1gdUSC+8=; b=Znv lxd2/CI0A3wNYu/GizLNOxfyThoeg2HuKL2e6Ikj2Txzl6AmS7Jn/gAS4Auime2aF0lI3QfUUDgA9 P/v5j2duWshIUawLyQBjE7DdJokLk3S9b0Y9cFrgeyLh7SFOjgl63QXgokuYcpB0JVMxOtF/WJRfL ikd+wRIN0ANtDo+1EehqFk8pjQwLKzm7N7W9rQRCNcAnCnLf8TyAYp0ll1hhjzVKVLMXZVcDRzP5b 64eau+c7GAlOYrK9+/ykehqjKFLC5qMAcxQH8Fdhdd2BDF2bw/VN16YhKmoVnZeE60nEsQumL/UM3 0WP65W6biehCDQtRZr430TfAFWXAD6Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAg5m-00028p-1c; Thu, 11 Oct 2018 18:53:50 +0000 Received: from mail-lf1-x142.google.com ([2a00:1450:4864:20::142]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAg5i-00024I-Dx for linux-mtd@lists.infradead.org; Thu, 11 Oct 2018 18:53:47 +0000 Received: by mail-lf1-x142.google.com with SMTP id w21-v6so7489434lff.6 for ; Thu, 11 Oct 2018 11:53:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=ak5cx/E4OF+zESD37+v90KDpS1hZEtug/OhCwtS59V4=; b=E4UFDSvrxirWFUVSCc3qjZpWSngnTqUPJFDHMYI/oNlbq+r4JG69Da9eTudL8LSEsS GcQBOB4katWavkqpoUHLLvrw32hCCWbiH3bejzPIbhz7DbqoqSutpoaLReqQsAKnCMKL RUhpwK9QtKds7ancZNiINNRq1C5TECXlq0qOo= 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=ak5cx/E4OF+zESD37+v90KDpS1hZEtug/OhCwtS59V4=; b=ooNAq7dibaMyvakaJ0ammb5FslKW3VmJvDClB01pPeTPFzKRd9uziY7Comn5A5fzv0 TBYAJV988gwzEZCdi/06rlqNvcZfAR/T3ugr6iuQIb1KalJMHakeNWHVD+T1d72Fdwq1 WO3skZbBRqX5/e8urIrWDrABw8MkcduVpJpSGqaRfE3N1GMEKSBQ/Zuxv28XPKkpD0kM R/f3HiBU/owKCs+xXp4EBAihD87pCEBoEdqrXW+2Pq/uOYa7h+g1TjVkjYxYpDGr9Rva MQSRgpQfc018cp2Y1CjdU63PnM6RSYhA+tpIzJKSpCh5WO5fpNAI0pwdVJypBgj6irs9 3cAQ== X-Gm-Message-State: ABuFfojhgxgrhtlPh/PD0Abx9J8/9dVai3D6FWTMiK/KC2JWHzrYtgtF E0myL31NpWXD1QoaevhIBHPEgg== X-Received: by 2002:a19:c7c2:: with SMTP id x185-v6mr1955445lff.123.1539284013305; Thu, 11 Oct 2018 11:53:33 -0700 (PDT) Received: from localhost.bredbandsbolaget (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id t21-v6sm6362632ljg.32.2018.10.11.11.53.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 11 Oct 2018 11:53:32 -0700 (PDT) From: Linus Walleij To: David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , linux-mtd@lists.infradead.org Subject: [PATCH 1/2] mtd: physmap_of: Move custom initialization Date: Thu, 11 Oct 2018 20:53:25 +0200 Message-Id: <20181011185326.1371-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.17.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181011_115346_480553_E49CC35B X-CRM114-Status: GOOD ( 15.92 ) X-Spam-Score: -0.1 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:142 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linus Walleij MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org In order to be able to assign custom complex mappings to the physmap_of plugin for Gemini, move the initialization so that the simple map is initialized before we enter the platform-specific functions so the latter can override them. Signed-off-by: Linus Walleij --- drivers/mtd/maps/physmap_of_core.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) -- 2.17.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/maps/physmap_of_core.c b/drivers/mtd/maps/physmap_of_core.c index 4129535b8e46..74ad753265f3 100644 --- a/drivers/mtd/maps/physmap_of_core.c +++ b/drivers/mtd/maps/physmap_of_core.c @@ -239,13 +239,6 @@ static int of_flash_probe(struct platform_device *dev) else if (of_property_read_bool(dp, "little-endian")) info->list[i].map.swap = CFI_LITTLE_ENDIAN; - err = of_flash_probe_gemini(dev, dp, &info->list[i].map); - if (err) - goto err_out; - err = of_flash_probe_versatile(dev, dp, &info->list[i].map); - if (err) - goto err_out; - err = -ENOMEM; info->list[i].map.virt = ioremap(info->list[i].map.phys, info->list[i].map.size); @@ -257,6 +250,14 @@ static int of_flash_probe(struct platform_device *dev) simple_map_init(&info->list[i].map); + /* Variants can override map accessors */ + err = of_flash_probe_gemini(dev, dp, &info->list[i].map); + if (err) + goto err_out; + err = of_flash_probe_versatile(dev, dp, &info->list[i].map); + if (err) + goto err_out; + /* * On some platforms (e.g. MPC5200) a direct 1:1 mapping * may cause problems with JFFS2 usage, as the local bus (LPB) From patchwork Thu Oct 11 18:53:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 148668 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp2482086lji; Thu, 11 Oct 2018 11:54:31 -0700 (PDT) X-Google-Smtp-Source: ACcGV62yooxMmGZBn0LoGZ0/kkYpaj64BavlC7cHnlx6rNXydhhSxj0e3ksjCbXdko1ZJ8jsVV3c X-Received: by 2002:a17:902:74cb:: with SMTP id f11-v6mr2664537plt.96.1539284071047; Thu, 11 Oct 2018 11:54:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539284071; cv=none; d=google.com; s=arc-20160816; b=Y7bC+SoTfNhL3cXWHgBph7zkGwDRruWsaMabeH/3ichSR+AkT8Umh5maEQsoZPs/IW /lPpLlBER+XONZogpBoAleKEEj3riGY4uCeQftur8ue8c6CosICPsT1DjfSIg2N0+Scm FWDw2SkX1v7I0HZV+WcT3fOJwEBWArrOsYgL6/rPM9vh9VT2rNWsR79/fJOli11iUEt+ TO6gn4rtuN1dVbSSvoqHVjI2wnb012/dGkjbwH1MtBYO+sqOE0PFsEzm8lL/tHpQp9nq atV/ZUWzjxqIoIfo2QRynZY6yLCbhAbNVjK42yLDnAGBgqZw9n1y1eyzPBzp9C+so8Q5 dRxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:dkim-signature; bh=QdZ3EpXgT+dGDR8fnjrn5H2S4RAEJ8D2/8QQCeZuA3A=; b=yZJTVzMQmTUuGarSw9CzXX3EFa46/DTWuA12YlpazDp0zdbKpq8ar9uTkOwdt6P9ZV zKI70OCOPywL7iyATHRILJiKa8fCp7q5yeNKt2dLnryBYWJm0lCLo36Wa2Wp/pX1Qlbc 2Zfc4/elIYdJYCeEBlakvnRrdagLjqb7BYkK0U+683gsCGhrUDoejUiYzoUqj/CPvKcS Ftl+worcKKDNkKyHk4QOMDDxOEdv6wOxnGjkMm10I+kfDQal+W6rHL937i7PRIh0vcSU +qiCkmgg/4ytQNpsCPLTjuI1TsPRNRhaB7XLcPTIjEoiZVINK+vbWXcuYjxqyRk34obl JiCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=sxdburMo; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=HUkCxVbm; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id p15-v6si28737288pgr.336.2018.10.11.11.54.30 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 11 Oct 2018 11:54:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=sxdburMo; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=HUkCxVbm; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=QdZ3EpXgT+dGDR8fnjrn5H2S4RAEJ8D2/8QQCeZuA3A=; b=sxdburMob8L2mAeX8QcfOWJD31 78XGFxIRFCSN1OrK9QzvIeYa7ISrUVS4I06kmnZKMQweeW6FXZjr7fmfb0GMTFptQ61L3OO8gQqwR WC6HV0TAfAtL6B5TdOn7+d8QoLKxiocSNcNGwO6+7w11CyscY1CG98yFu7OjsuXg9Dy+IXB9xnOf0 eu6rlV3XCNFGFPlPGpt2Pd1HSwNPxyRLJTrTcUoGDc4lA6a2h1pyCHJcn3QjVK/OyZr2nNaDyjljK kk3kWKImWj0l1Q+0zz0AgL4eVIDq57U6SyyFAaOdbazwRJ0xxzS9GTm01TVX1TiA43okLVKRmN9V3 nx6B6yUA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAg6C-0002Mb-4H; Thu, 11 Oct 2018 18:54:16 +0000 Received: from mail-lj1-x242.google.com ([2a00:1450:4864:20::242]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAg5l-00024t-GQ for linux-mtd@lists.infradead.org; Thu, 11 Oct 2018 18:53:56 +0000 Received: by mail-lj1-x242.google.com with SMTP id j17-v6so9208391lja.1 for ; Thu, 11 Oct 2018 11:53:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=vPRhR19g40rxUV9LJLjczG5TizrdIyKnSIXMXlJsTiI=; b=HUkCxVbmWyliCj74pwEHs9OLsrEwLv9CgLZwyc7fsF/A/4bbERszLj+SUgJykF9kWi OesUyZ8g9vpdTYg9n25SsqMSCmXOloRR4RdG8H23cRzAjYgjdqJkdHm1XM5nP4+/Oci0 K2NYIXBqjIejUauKvAOOxne4YrseC2HNk+XZ4= 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:in-reply-to :references; bh=vPRhR19g40rxUV9LJLjczG5TizrdIyKnSIXMXlJsTiI=; b=YWstJJIGfDimYnFt/szWKbRe18JdAXeiNhZQpv2vr2JXztwVVJexluJ1ZqyeI0WQOc /cBL4KXL6czCeVnsPrKOD2dXvehvbF0LIdTVmh5iTeRoOaGhtmsbkkXWGYxFX2Bs/l7C u2yEyYym356SROKDfjd/9MlANn0gIvIcTC6MF/gy0ei1SVdaS7D9tG0LyG35oweeKg/V Q/sEvGA50Lcm4ZR03IMqMgNxaQHF19JR51PusNxE+fSbw4c2n1t6nbye5A1JsOpU42E1 Ndp2w2ZeACQjsZC5E+wlxWHssRmsn26WoxOsSWC7ZWa1ibzRBCUKKHDR9xX0WiCyBRYk tiqg== X-Gm-Message-State: ABuFfoh01PKPoFcb6a2N8btZ2IwXrp7DuhHTBk34kVynrjX9tsdjl7dx a8dN5QkZDJYv7rSmynTSTMRgHQ== X-Received: by 2002:a2e:7109:: with SMTP id m9-v6mr1975681ljc.176.1539284016564; Thu, 11 Oct 2018 11:53:36 -0700 (PDT) Received: from localhost.bredbandsbolaget (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id t21-v6sm6362632ljg.32.2018.10.11.11.53.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 11 Oct 2018 11:53:35 -0700 (PDT) From: Linus Walleij To: David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , linux-mtd@lists.infradead.org Subject: [PATCH 2/2] mtd: physmap_of_gemini: Handle pin control Date: Thu, 11 Oct 2018 20:53:26 +0200 Message-Id: <20181011185326.1371-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181011185326.1371-1-linus.walleij@linaro.org> References: <20181011185326.1371-1-linus.walleij@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181011_115349_594872_570AA528 X-CRM114-Status: GOOD ( 24.79 ) X-Spam-Score: -0.1 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:242 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linus Walleij MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org This enables the complex mapping for the Gemini and kicks in custom read/write functions that will wrap the existing simple functions in calls to enable/disable the parallel flash pins using pin controls. This is necessary on some hardware such as the D-Link DIR-685 where all flash pins are patched in/out at the same time, but some of the flash pins are in practice unused by the flash and have anyway been reused as GPIO. This concerns specifically CE1 on the Gemini. There is only one flash chip, so only CE0 is used, and the line for CE1 has been reused as chip select for the emulated SPI port connected to the display. If we try to use the same lines for flash and GPIO at the same time, one of them will loose: the GPIO line will disappear because it gets disconnected from the pin when the flash group is muxed out. Fix this by introducing two pin control states named simply "enabled" and "disabled" and only enable the flash lines when absolutely necessary (during read/write/copy). This way, they are available for GPIO at all other times and the display works. Collect all the state variables in a struct named struct gemini_flash and allocate this struct at probe time. Signed-off-by: Linus Walleij --- drivers/mtd/maps/Kconfig | 1 + drivers/mtd/maps/physmap_of_gemini.c | 105 ++++++++++++++++++++++++++- 2 files changed, 105 insertions(+), 1 deletion(-) -- 2.17.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig index afb36bff13a7..00efbf246849 100644 --- a/drivers/mtd/maps/Kconfig +++ b/drivers/mtd/maps/Kconfig @@ -89,6 +89,7 @@ config MTD_PHYSMAP_OF_GEMINI depends on MTD_PHYSMAP_OF depends on MFD_SYSCON default ARCH_GEMINI + select MTD_COMPLEX_MAPPINGS help This provides some extra DT physmap parsing for the Gemini platforms, some detection and setting up parallel mode on the diff --git a/drivers/mtd/maps/physmap_of_gemini.c b/drivers/mtd/maps/physmap_of_gemini.c index 830b1b7e702b..7c2b67460192 100644 --- a/drivers/mtd/maps/physmap_of_gemini.c +++ b/drivers/mtd/maps/physmap_of_gemini.c @@ -10,9 +10,11 @@ #include #include #include +#include #include #include #include +#include #include "physmap_of_gemini.h" /* @@ -49,6 +51,77 @@ static const struct of_device_id syscon_match[] = { { }, }; +struct gemini_flash { + struct device *dev; + struct pinctrl *p; + struct pinctrl_state *enabled_state; + struct pinctrl_state *disabled_state; +}; + +/* Static local state */ +static struct gemini_flash *gf; + +static void gemini_flash_enable_pins(void) +{ + int ret; + + if (IS_ERR(gf->enabled_state)) + return; + ret = pinctrl_select_state(gf->p, gf->enabled_state); + if (ret) + dev_err(gf->dev, "failed to enable pins\n"); +} + +static void gemini_flash_disable_pins(void) +{ + int ret; + + if (IS_ERR(gf->disabled_state)) + return; + ret = pinctrl_select_state(gf->p, gf->disabled_state); + if (ret) + dev_err(gf->dev, "failed to disable pins\n"); +} + +static map_word __xipram gemini_flash_map_read(struct map_info *map, + unsigned long ofs) +{ + map_word __xipram ret; + + gemini_flash_enable_pins(); + ret = inline_map_read(map, ofs); + gemini_flash_disable_pins(); + + return ret; +} + +static void __xipram gemini_flash_map_write(struct map_info *map, + const map_word datum, + unsigned long ofs) +{ + gemini_flash_enable_pins(); + inline_map_write(map, datum, ofs); + gemini_flash_disable_pins(); +} + +static void __xipram gemini_flash_map_copy_from(struct map_info *map, + void *to, unsigned long from, + ssize_t len) +{ + gemini_flash_enable_pins(); + inline_map_copy_from(map, to, from, len); + gemini_flash_disable_pins(); +} + +static void __xipram gemini_flash_map_copy_to(struct map_info *map, + unsigned long to, + const void *from, ssize_t len) +{ + gemini_flash_enable_pins(); + inline_map_copy_to(map, to, from, len); + gemini_flash_disable_pins(); +} + int of_flash_probe_gemini(struct platform_device *pdev, struct device_node *np, struct map_info *map) @@ -62,6 +135,11 @@ int of_flash_probe_gemini(struct platform_device *pdev, if (!of_device_is_compatible(np, "cortina,gemini-flash")) return 0; + gf = devm_kzalloc(dev, sizeof(*gf), GFP_KERNEL); + if (!gf) + return -ENOMEM; + gf->dev = dev; + rmap = syscon_regmap_lookup_by_phandle(np, "syscon"); if (IS_ERR(rmap)) { dev_err(dev, "no syscon\n"); @@ -96,7 +174,32 @@ int of_flash_probe_gemini(struct platform_device *pdev, map->bankwidth * 8); } - dev_info(&pdev->dev, "initialized Gemini-specific physmap control\n"); + gf->p = devm_pinctrl_get(dev); + if (IS_ERR(gf->p)) { + dev_err(dev, "no pinctrl handle\n"); + ret = PTR_ERR(gf->p); + return ret; + } + + gf->enabled_state = pinctrl_lookup_state(gf->p, "enabled"); + if (IS_ERR(gf->enabled_state)) + dev_err(dev, "no enabled pin control state\n"); + + gf->disabled_state = pinctrl_lookup_state(gf->p, "disabled"); + if (IS_ERR(gf->enabled_state)) { + dev_err(dev, "no disabled pin control state\n"); + } else { + ret = pinctrl_select_state(gf->p, gf->disabled_state); + if (ret) + dev_err(gf->dev, "failed to disable pins\n"); + } + + map->read = gemini_flash_map_read; + map->write = gemini_flash_map_write; + map->copy_from = gemini_flash_map_copy_from; + map->copy_to = gemini_flash_map_copy_to; + + dev_info(dev, "initialized Gemini-specific physmap control\n"); return 0; }