Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp7130imm; Thu, 4 Oct 2018 15:22:34 -0700 (PDT) X-Google-Smtp-Source: ACcGV62OcPJqXFpn8zFzYZpaTemE9djBnix9z537Zwa3zqV7CraNvDpwQr52+QrwGc9iUxm73opi X-Received: by 2002:a63:fb09:: with SMTP id o9-v6mr7509618pgh.333.1538691754232; Thu, 04 Oct 2018 15:22:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538691754; cv=none; d=google.com; s=arc-20160816; b=IwKBwSzxFiXzJ5SdqRm/qmroQbEk3eiJUqWB6kAavKI21XKdzfL/0L2kEOrpSZI7PL AGqw1A/Sqyl8fJq0IZENmht6d6jlg8KMyXL+5lV0INgfNSwH3uY1gqSTGw6J0kps/Qky 7+SC9sL0IZ53zvgS0ztM/V20oYrDBKRwLiqdObnO1sb3X6L7HgPDdUM+5c14Pd+VkTyI 0c+fwe7tITrfpNwQrGINOWeOufqUgnkMqfInxPuRssa3kxOvhtbb/Rvsqaf13z+joWS3 B/xb1QOWxdMg+OkXDGFhjvsKMxV5Gglq8ctq4dqbsR92FXHWIqJMiEQ2louH5KPRxRoj mNSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=evF3iN0HAmiNcowj4k7xqc9Rm9zDyzhg/mA+ItBHtxQ=; b=UX4lycYUZ80XqDg/2Q2n3AS6U2+ucPNis356y3RV+y7gYd1mNamUthUZmS1O772e4A 8GH45tXV8rfx74sDsGk40+mrLLP60z/UwxgVXMplCbjdB4VG3xm4ATptIP1GwU19NEpY 3QAuzuahZO5Qgi70TwtrmbQYpymvaN22Mcur4zup6i2YVNu5YdOyqmIJzkd9nhFvzC7x txFWaWqRYO9Fub6MW3yhO6ze/dRvcYNUWO0VxoSNxJ609jPy//Qiem4on6AAjwV4AlWD +TuKWuvZo6RVZMtzyu9ow65E/ekGi4pIYy5435fmEqSB0dWIC2zNj0/t6COtOWbIQKJ+ +86w== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z14-v6si6676468pgk.172.2018.10.04.15.22.18; Thu, 04 Oct 2018 15:22:34 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727489AbeJEFQ5 (ORCPT + 99 others); Fri, 5 Oct 2018 01:16:57 -0400 Received: from mail.bootlin.com ([62.4.15.54]:55539 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725996AbeJEFQ5 (ORCPT ); Fri, 5 Oct 2018 01:16:57 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id DD795207B4; Fri, 5 Oct 2018 00:21:25 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.0 Received: from bbrezillon (91-160-177-164.subs.proxad.net [91.160.177.164]) by mail.bootlin.com (Postfix) with ESMTPSA id 95A1220701; Fri, 5 Oct 2018 00:21:25 +0200 (CEST) Date: Fri, 5 Oct 2018 00:21:25 +0200 From: Boris Brezillon To: Ricardo Ribalda Delgado Cc: David Woodhouse , Brian Norris , Marek Vasut , Richard Weinberger , Zhouyang Jia , linux-mtd@lists.infradead.org, open list Subject: Re: [PATCH v10 10/10] mtd: maps: gpio-addr-flash: Add support for device-tree devices Message-ID: <20181005002125.12fd229f@bbrezillon> In-Reply-To: <20181004142942.11887-2-ricardo.ribalda@gmail.com> References: <20181004142942.11887-1-ricardo.ribalda@gmail.com> <20181004142942.11887-2-ricardo.ribalda@gmail.com> X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Ricardo, On Thu, 4 Oct 2018 16:29:42 +0200 Ricardo Ribalda Delgado wrote: > Allow creating gpio-addr-flash via device-tree and not just via platform > data. > > Mimic what physmap_of_versatile and physmap_of_gemini does to reduce > code duplicity. > > Signed-off-by: Ricardo Ribalda Delgado > --- > drivers/mtd/maps/Kconfig | 8 +++ > drivers/mtd/maps/Makefile | 3 +- > drivers/mtd/maps/gpio-addr-flash.c | 95 +++++++++++++++++++----------- > drivers/mtd/maps/gpio-addr-flash.h | 34 +++++++++++ > drivers/mtd/maps/physmap_of_core.c | 5 ++ > drivers/mtd/maps/physmap_of_gpio.c | 21 +++++++ > 6 files changed, 129 insertions(+), 37 deletions(-) > create mode 100644 drivers/mtd/maps/gpio-addr-flash.h > create mode 100644 drivers/mtd/maps/physmap_of_gpio.c > > diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig > index afb36bff13a7..427143d42168 100644 > --- a/drivers/mtd/maps/Kconfig > +++ b/drivers/mtd/maps/Kconfig > @@ -94,6 +94,14 @@ config MTD_PHYSMAP_OF_GEMINI > platforms, some detection and setting up parallel mode on the > external interface. > > +config MTD_PHYSMAP_OF_GPIO > + bool "GPIO-assisted OF-based physical memory map handling" > + depends on MTD_PHYSMAP_OF > + depends on MTD_GPIO_ADDR > + help > + This provides some extra DT physmap parsing for flashes that are > + partially physically addressed and assisted by GPIOs. > + Hm, so now we have the physmap_of driver which uses a function exposed by the gpio-addr-flash module, but this module is also declaring a platform_driver. It's probably working fine, but it's hard to follow. So, I decided to give it a try and started to rework a bit the physmap, physmap_of and gpio-addr-flash drivers. Here is the result [1] (it's only been compile tested). With this rework we now have a single driver which supports DT and !DT init and can also use GPIOs to extend the physical memory range in case it's not large enough to address the whole memory dev. Let me know what you think of this approach. Regards, Boris [1]https://github.com/bbrezillon/linux-0day/commits/mtd/physmap-cleanup