From patchwork Fri Jul 20 14:12:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 10537595 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A8E6F603B5 for ; Fri, 20 Jul 2018 14:19:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8CE0C2023F for ; Fri, 20 Jul 2018 14:19:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 816CD293C2; Fri, 20 Jul 2018 14:19:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 177F02023F for ; Fri, 20 Jul 2018 14:19:14 +0000 (UTC) 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=/Zib3BZ6ZQAdqsnYq9fNiLkS91iljoLKMWYXdntLO80=; b=GtW OIP+lSlr4gom+ZLMmhlUz8SXrl6lBvtwRiJP5yRL6YCMwAqqosYpcABr0doJU2K7ShUYL2vqpSILI dXKCclSJMu5Q8d/z8V0JdtCFtfSLjc/0x4AY9LndbW8tN1b7AWdnFWLxIiGo9xReSJXR5vbVoITak i0K36/WLDt7YIUKH5qltzPWSJNGSrvoZQ2Y0ShSJMnmgfIPxfrmpzS+01fjxex5XdZQdoBVEnGFKh wygVPQnlyVDPuR7TV5TFewBwTcTjMbqjBOQFkOYTWqtroNnmOw0USdHmktrG7aAMhHGE0sAsZdL5H s3JgvWQSFoq2Zt3Gyt5TllNmiu8DsHg==; 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 1fgWFQ-00021y-S5; Fri, 20 Jul 2018 14:19:08 +0000 Received: from mail-lf1-x141.google.com ([2a00:1450:4864:20::141]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fgWFO-000218-3u for linux-arm-kernel@lists.infradead.org; Fri, 20 Jul 2018 14:19:07 +0000 Received: by mail-lf1-x141.google.com with SMTP id j143-v6so1917965lfj.12 for ; Fri, 20 Jul 2018 07:18:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=acFZK/7X6j4muzxldI+NoMpYw/NvtTNePa1EpMQF1fA=; b=jhoM4JB+tz6yvxVo+lKb7Hhn9NiCvHVyXAcvK328Xs7kXKcjMoQmIQr5d/nw7Mjo5l cDGnJwTYLCCHlQUTL6XeYaeyjVdP/ZDdE82Y7Btkztt1r3i5LmBMimoSL6brXkQYAfDF 2cXS/m6994Tu19mDJzx+AGB1BbTRD4RzsUyxl2AeVmM2GynKkHLK+62Yg99/2ubtAFE6 0/5Mov+MkSQtb4Fzgna52KtKJ0o0ukYhXTsFRf33NIZfYQV1xpJD7bB6UuVO99lpOedM 9pDULRndicQIwTxmovCwWNGOpY7LlAiyUA+XjZqSVcOR20x1NPayjZDZGIvyx1Twoh38 fKYA== 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=acFZK/7X6j4muzxldI+NoMpYw/NvtTNePa1EpMQF1fA=; b=RyJ4Sj+IdSdddunbf3eqPZj6i1KUe+GR/x0hPwaf+knR1uPGgAppPvoz6CYMvzXtq0 NzldL7ID1goITQQo2WjFEFWyfVV+bsvMY9qXxNNYU1SI1Hcuufeg8FPW3Di5Z/W/Atq3 qc8ZScibQnvhRYPb1bCF23EACtwKHpj2D32apYGMbe8uxGJ8MeRuEeSBBvn/GiBXXXgt 8PT45ph9KVemdBnsCmTOGovstHp9K5OV86O2bGa/PYqFvjfVlIZmIu0rKUQ8RMQhPlkq 8+/if2XrlsFKZxCZnp7zNZXbO7//Wl4BcWLiZWPCRbQSPVJG6acfikWVvdaM6mr9UDu6 ca1g== X-Gm-Message-State: AOUpUlG4k+0qiaLS4MYFaGvSH0HMtpg6ID1/7eVNPHJtOj0MepPw5gng JU1W3IdKPulxWZUUqRNUxyg= X-Google-Smtp-Source: AAOMgpecQC0Z0auppx9LTZ/JThqpcmnkBD3CBvsM+Ke/3NUDWcB/dJ8CPyYkYqQJqvuBEqpkh1ieAg== X-Received: by 2002:a19:1b07:: with SMTP id b7-v6mr1551958lfb.32.1532095945031; Fri, 20 Jul 2018 07:12:25 -0700 (PDT) Received: from localhost.localdomain ([31.0.82.186]) by smtp.gmail.com with ESMTPSA id a16-v6sm385342ljj.28.2018.07.20.07.12.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Jul 2018 07:12:24 -0700 (PDT) From: Janusz Krzysztofik To: Tony Lindgren Subject: [RFC PATCH] ARM: OMAP1: Make OMAP15xx MPUIO based GPIO device optional Date: Fri, 20 Jul 2018 16:12:47 +0200 Message-Id: <20180720141247.32214-1-jmkrzyszt@gmail.com> X-Mailer: git-send-email 2.16.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180720_071906_184540_03EBFDB8 X-CRM114-Status: GOOD ( 15.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-omap@vger.kernel.org, Janusz Krzysztofik , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Aaro Koskinen MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP At least one OMAP15xx based board - Amstrad Delta - makes other use than simple GPIO of OMAP1 MPUIO port. Since the port is registered unconditionally at postcore_initcall as "omap_gpio" platform device, hence occupied by gpio-omap driver, other device driver has no chance to request its I/O memory resources successfully and may either fail or proceed without having those resources reserved. See commit b027274d2e3a ("mtd: ams-delta: fix request_mem_region() failure") for details. Even if it's theoretically possible to perform data I/O on the MPUIO port with help of gpiod_*_array_*() functions, that additional layer adds too much overhead for a relatively low powerful OMAP15xx machine. One possible workaround providing acceptable performance would be to use GPIO chip callbacks directly but that approach hasn't been accepted. Instead of inventing a widely acceptable new API for affected driver to get efficient access to the port over the gpio-omap driver, make registration of gpio-omap platform device optional for that port. Boards are then free to decide if they need it as a GPIO device and can call its initialization, or can assign the port resources to another device. Signed-off-by: Janusz Krzysztofik --- arch/arm/mach-omap1/board-generic.c | 2 ++ arch/arm/mach-omap1/board-innovator.c | 7 ++++++- arch/arm/mach-omap1/board-palmte.c | 2 ++ arch/arm/mach-omap1/board-palmtt.c | 2 ++ arch/arm/mach-omap1/board-palmz71.c | 2 ++ arch/arm/mach-omap1/board-sx1.c | 2 ++ arch/arm/mach-omap1/common.h | 3 +++ arch/arm/mach-omap1/gpio15xx.c | 6 +++++- 8 files changed, 24 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-omap1/board-generic.c b/arch/arm/mach-omap1/board-generic.c index 9708629f8c5f..3f812061095e 100644 --- a/arch/arm/mach-omap1/board-generic.c +++ b/arch/arm/mach-omap1/board-generic.c @@ -55,6 +55,8 @@ static void __init omap_generic_init(void) { #ifdef CONFIG_ARCH_OMAP15XX if (cpu_is_omap15xx()) { + omap15xx_mpuio_init(); + /* mux pins for uarts */ omap_cfg_reg(UART1_TX); omap_cfg_reg(UART1_RTS); diff --git a/arch/arm/mach-omap1/board-innovator.c b/arch/arm/mach-omap1/board-innovator.c index 8c286a29f24b..33b74efe3352 100644 --- a/arch/arm/mach-omap1/board-innovator.c +++ b/arch/arm/mach-omap1/board-innovator.c @@ -373,8 +373,13 @@ static inline void innovator_mmc_init(void) static void __init innovator_init(void) { - if (cpu_is_omap1510()) +#ifdef CONFIG_ARCH_OMAP15XX + if (cpu_is_omap1510()) { + omap15xx_mpuio_init(); + omap1510_fpga_init_irq(); + } +#endif innovator_init_smc91x(); #ifdef CONFIG_ARCH_OMAP15XX diff --git a/arch/arm/mach-omap1/board-palmte.c b/arch/arm/mach-omap1/board-palmte.c index 2dc5deb19803..b8620e4a2958 100644 --- a/arch/arm/mach-omap1/board-palmte.c +++ b/arch/arm/mach-omap1/board-palmte.c @@ -210,6 +210,8 @@ static void __init palmte_misc_gpio_setup(void) static void __init omap_palmte_init(void) { + omap15xx_mpuio_init(); + /* mux pins for uarts */ omap_cfg_reg(UART1_TX); omap_cfg_reg(UART1_RTS); diff --git a/arch/arm/mach-omap1/board-palmtt.c b/arch/arm/mach-omap1/board-palmtt.c index a23327682df0..20ab494f20c5 100644 --- a/arch/arm/mach-omap1/board-palmtt.c +++ b/arch/arm/mach-omap1/board-palmtt.c @@ -256,6 +256,8 @@ static void __init omap_mpu_wdt_mode(int mode) { static void __init omap_palmtt_init(void) { + omap15xx_mpuio_init(); + /* mux pins for uarts */ omap_cfg_reg(UART1_TX); omap_cfg_reg(UART1_RTS); diff --git a/arch/arm/mach-omap1/board-palmz71.c b/arch/arm/mach-omap1/board-palmz71.c index 30b07096197b..5d468111f681 100644 --- a/arch/arm/mach-omap1/board-palmz71.c +++ b/arch/arm/mach-omap1/board-palmz71.c @@ -268,6 +268,8 @@ palmz71_gpio_setup(int early) static void __init omap_palmz71_init(void) { + omap15xx_mpuio_init(); + /* mux pins for uarts */ omap_cfg_reg(UART1_TX); omap_cfg_reg(UART1_RTS); diff --git a/arch/arm/mach-omap1/board-sx1.c b/arch/arm/mach-omap1/board-sx1.c index ec27bb3e370f..bbea85943b3b 100644 --- a/arch/arm/mach-omap1/board-sx1.c +++ b/arch/arm/mach-omap1/board-sx1.c @@ -311,6 +311,8 @@ static struct platform_device *sx1_devices[] __initdata = { static void __init omap_sx1_init(void) { + omap15xx_mpuio_init(); + /* mux pins for uarts */ omap_cfg_reg(UART1_TX); omap_cfg_reg(UART1_RTS); diff --git a/arch/arm/mach-omap1/common.h b/arch/arm/mach-omap1/common.h index c6537d2c2859..72551c850197 100644 --- a/arch/arm/mach-omap1/common.h +++ b/arch/arm/mach-omap1/common.h @@ -95,6 +95,9 @@ static inline int __init omap_32k_timer_init(void) } #endif +#ifdef CONFIG_ARCH_OMAP15XX +extern void omap15xx_init_mpuio(void); +#endif #ifdef CONFIG_ARCH_OMAP16XX extern int ocpi_enable(void); #else diff --git a/arch/arm/mach-omap1/gpio15xx.c b/arch/arm/mach-omap1/gpio15xx.c index 312a0924d786..d4c8d257d14d 100644 --- a/arch/arm/mach-omap1/gpio15xx.c +++ b/arch/arm/mach-omap1/gpio15xx.c @@ -115,9 +115,13 @@ static int __init omap15xx_gpio_init(void) if (!cpu_is_omap15xx()) return -EINVAL; - platform_device_register(&omap15xx_mpu_gpio); platform_device_register(&omap15xx_gpio); return 0; } postcore_initcall(omap15xx_gpio_init); + +void __init omap15xx_mpuio_init(void) +{ + platform_device_register(&omap15xx_mpu_gpio); +}