From patchwork Mon Aug 29 10:26:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 9303527 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 DE6D0601C0 for ; Mon, 29 Aug 2016 10:46:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CDF56286DD for ; Mon, 29 Aug 2016 10:46:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C2BB628720; Mon, 29 Aug 2016 10:46:15 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9F97F286DD for ; Mon, 29 Aug 2016 10:46:14 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1beK4F-0000HC-87; Mon, 29 Aug 2016 10:45:27 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:3201:214:fdff:fe10:1be6]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1beJm5-0005Yo-N7 for linux-arm-kernel@lists.infradead.org; Mon, 29 Aug 2016 10:26:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2014; h=Date:Sender:Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References:In-Reply-To; bh=lVYUaZuumE6bmLhy7DtpqdohIwXsmeR/A7oX12Labls=; b=b/BdPnJQT8LClHRakgBLOMN0rr1JRRrJtZPdd9GpxuggKdExiHNIthBEmKuj6FKSXmHHXy+Be5aOdIWjZ6IbcGt+MzW5BT+EFHGnYeDGI9+GtRA06NQGVn6lA+ErveFYM5E7MUSAuLL7VIJutce1XtFICNVzEBBVmc+wXntuHTM=; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:58564 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1beJle-0003fq-IF; Mon, 29 Aug 2016 11:26:14 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1beJld-0000o9-Lu; Mon, 29 Aug 2016 11:26:13 +0100 In-Reply-To: <20160829102328.GA28796@n2100.armlinux.org.uk> References: <20160829102328.GA28796@n2100.armlinux.org.uk> From: Russell King To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-pcmcia@lists.infradead.org Subject: [PATCH 25/33] ARM: sa1100/nanoengine: convert to generic CF sockets MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Mon, 29 Aug 2016 11:26:13 +0100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160829_032643_023828_7FB5A7A6 X-CRM114-Status: GOOD ( 16.09 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Courbot , Linus Walleij , Haojian Zhuang , Kristoffer Ericson , Robert Jarzmik , Daniel Mack 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 Convert nanoengine to use the generic CF socket support. Signed-off-by: Russell King --- arch/arm/mach-sa1100/nanoengine.c | 23 +++++++ drivers/pcmcia/sa1100_generic.c | 3 - drivers/pcmcia/sa1100_generic.h | 1 - drivers/pcmcia/sa1100_nanoengine.c | 133 ------------------------------------- 4 files changed, 23 insertions(+), 137 deletions(-) delete mode 100644 drivers/pcmcia/sa1100_nanoengine.c diff --git a/arch/arm/mach-sa1100/nanoengine.c b/arch/arm/mach-sa1100/nanoengine.c index f1cb3784d525..4d35258a7b32 100644 --- a/arch/arm/mach-sa1100/nanoengine.c +++ b/arch/arm/mach-sa1100/nanoengine.c @@ -12,6 +12,7 @@ */ #include +#include #include #include #include @@ -99,8 +100,30 @@ static void __init nanoengine_map_io(void) Ser2HSCR0 = 0; } +static struct gpiod_lookup_table nanoengine_pcmcia0_gpio_table = { + .dev_id = "sa11x0-pcmcia.0", + .table = { + GPIO_LOOKUP("gpio", 11, "ready", GPIO_ACTIVE_HIGH), + GPIO_LOOKUP("gpio", 13, "detect", GPIO_ACTIVE_LOW), + GPIO_LOOKUP("gpio", 15, "reset", GPIO_ACTIVE_HIGH), + { }, + }, +}; + +static struct gpiod_lookup_table nanoengine_pcmcia1_gpio_table = { + .dev_id = "sa11x0-pcmcia.1", + .table = { + GPIO_LOOKUP("gpio", 12, "ready", GPIO_ACTIVE_HIGH), + GPIO_LOOKUP("gpio", 14, "detect", GPIO_ACTIVE_LOW), + GPIO_LOOKUP("gpio", 16, "reset", GPIO_ACTIVE_HIGH), + { }, + }, +}; + static void __init nanoengine_init(void) { + sa11x0_register_pcmcia(0, &nanoengine_pcmcia0_gpio_table); + sa11x0_register_pcmcia(1, &nanoengine_pcmcia1_gpio_table); sa11x0_register_mtd(&nanoengine_flash_data, nanoengine_flash_resources, ARRAY_SIZE(nanoengine_flash_resources)); } diff --git a/drivers/pcmcia/sa1100_generic.c b/drivers/pcmcia/sa1100_generic.c index 83b365f060ea..a8290973538b 100644 --- a/drivers/pcmcia/sa1100_generic.c +++ b/drivers/pcmcia/sa1100_generic.c @@ -118,9 +118,6 @@ static int (*sa11x0_pcmcia_legacy_hw_init[])(struct device *dev) = { #if defined(CONFIG_SA1100_H3100) || defined(CONFIG_SA1100_H3600) pcmcia_h3600_init, #endif -#ifdef CONFIG_SA1100_NANOENGINE - pcmcia_nanoengine_init, -#endif #ifdef CONFIG_SA1100_SHANNON pcmcia_shannon_init, #endif diff --git a/drivers/pcmcia/sa1100_generic.h b/drivers/pcmcia/sa1100_generic.h index 3f5495957ca5..f74b269e87d3 100644 --- a/drivers/pcmcia/sa1100_generic.h +++ b/drivers/pcmcia/sa1100_generic.h @@ -11,7 +11,6 @@ extern int pcmcia_freebird_init(struct device *); extern int pcmcia_gcplus_init(struct device *); extern int pcmcia_graphicsmaster_init(struct device *); extern int pcmcia_h3600_init(struct device *); -extern int pcmcia_nanoengine_init(struct device *); extern int pcmcia_pangolin_init(struct device *); extern int pcmcia_pfs168_init(struct device *); extern int pcmcia_shannon_init(struct device *); diff --git a/drivers/pcmcia/sa1100_nanoengine.c b/drivers/pcmcia/sa1100_nanoengine.c deleted file mode 100644 index 35c30ff41e81..000000000000 --- a/drivers/pcmcia/sa1100_nanoengine.c +++ /dev/null @@ -1,133 +0,0 @@ -/* - * drivers/pcmcia/sa1100_nanoengine.c - * - * PCMCIA implementation routines for BSI nanoEngine. - * - * In order to have a fully functional pcmcia subsystem in a BSE nanoEngine - * board you should carefully read this: - * http://cambuca.ldhs.cetuc.puc-rio.br/nanoengine/ - * - * Copyright (C) 2010 Marcelo Roberto Jimenez - * - * Based on original work for kernel 2.4 by - * Miguel Freitas - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include - -#include "sa1100_generic.h" - -struct nanoengine_pins { - unsigned output_pins; - unsigned clear_outputs; - int gpio_rst; - int gpio_cd; - int gpio_rdy; -}; - -static struct nanoengine_pins nano_skts[] = { - { - .gpio_rst = GPIO_PC_RESET0, - .gpio_cd = GPIO_PC_CD0, - .gpio_rdy = GPIO_PC_READY0, - }, { - .gpio_rst = GPIO_PC_RESET1, - .gpio_cd = GPIO_PC_CD1, - .gpio_rdy = GPIO_PC_READY1, - } -}; - -unsigned num_nano_pcmcia_sockets = ARRAY_SIZE(nano_skts); - -static int nanoengine_pcmcia_hw_init(struct soc_pcmcia_socket *skt) -{ - unsigned i = skt->nr; - int ret; - - if (i >= num_nano_pcmcia_sockets) - return -ENXIO; - - ret = gpio_request_one(nano_skts[i].gpio_rst, GPIOF_OUT_INIT_LOW, - i ? "PC RST1" : "PC RST0"); - if (ret) - return ret; - - skt->stat[SOC_STAT_CD].gpio = nano_skts[i].gpio_cd; - skt->stat[SOC_STAT_CD].name = i ? "PC CD1" : "PC CD0"; - skt->stat[SOC_STAT_RDY].gpio = nano_skts[i].gpio_rdy; - skt->stat[SOC_STAT_RDY].name = i ? "PC RDY1" : "PC RDY0"; - - return 0; -} - -static void nanoengine_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) -{ - gpio_free(nano_skts[skt->nr].gpio_rst); -} - -static int nanoengine_pcmcia_configure_socket( - struct soc_pcmcia_socket *skt, const socket_state_t *state) -{ - unsigned i = skt->nr; - - if (i >= num_nano_pcmcia_sockets) - return -ENXIO; - - gpio_set_value(nano_skts[skt->nr].gpio_rst, !!(state->flags & SS_RESET)); - - return 0; -} - -static void nanoengine_pcmcia_socket_state( - struct soc_pcmcia_socket *skt, struct pcmcia_state *state) -{ - unsigned i = skt->nr; - - if (i >= num_nano_pcmcia_sockets) - return; - - state->bvd1 = 1; - state->bvd2 = 1; - state->vs_3v = 1; /* Can only apply 3.3V */ - state->vs_Xv = 0; -} - -static struct pcmcia_low_level nanoengine_pcmcia_ops = { - .owner = THIS_MODULE, - - .hw_init = nanoengine_pcmcia_hw_init, - .hw_shutdown = nanoengine_pcmcia_hw_shutdown, - - .configure_socket = nanoengine_pcmcia_configure_socket, - .socket_state = nanoengine_pcmcia_socket_state, -}; - -int pcmcia_nanoengine_init(struct device *dev) -{ - int ret = -ENODEV; - - if (machine_is_nanoengine()) - ret = sa11xx_drv_pcmcia_probe( - dev, &nanoengine_pcmcia_ops, 0, 2); - - return ret; -} -