From patchwork Thu May 25 04:30:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Packham X-Patchwork-Id: 9747681 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 926D760209 for ; Thu, 25 May 2017 04:31:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE7122766D for ; Thu, 25 May 2017 04:31:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A207A27852; Thu, 25 May 2017 04:31:43 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 462E92766D for ; Thu, 25 May 2017 04:31:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S941729AbdEYEbk (ORCPT ); Thu, 25 May 2017 00:31:40 -0400 Received: from gate2.alliedtelesis.co.nz ([202.36.163.20]:53109 "EHLO gate2.alliedtelesis.co.nz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S941736AbdEYEax (ORCPT ); Thu, 25 May 2017 00:30:53 -0400 Received: from mmarshal3.atlnz.lc (mmarshal3.atlnz.lc [10.32.18.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by gate2.alliedtelesis.co.nz (Postfix) with ESMTPS id AE63484491; Thu, 25 May 2017 16:30:48 +1200 (NZST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alliedtelesis.co.nz; s=mail; t=1495686648; bh=yoeOAa32a7dOEPO8cSMGG6glOv/OjQ+fsiXBZGt6GhQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=AN6/uiC+upK42SB0xRGWCfdlnROgDpO/pZAVXPKuYrfwvn74plrkWpt/QhjtoSOcN EFZX7JrQEBWCG37VKah1zpf4dQ14JGqjWsKHnHr1ERbdyRVDzNKO0dAPREclSxmuvg ngAO+HoD16Al47f4/eapIyaNpBPJFG69/A5NCM1w= Received: from smtp (Not Verified[10.32.16.33]) by mmarshal3.atlnz.lc with Trustwave SEG (v7, 5, 7, 9061) id ; Thu, 25 May 2017 16:30:49 +1200 Received: from chrisp-dl.atlnz.lc (chrisp-dl.ws.atlnz.lc [10.33.22.30]) by smtp (Postfix) with ESMTP id 4ADA113EFAF; Thu, 25 May 2017 16:30:48 +1200 (NZST) Received: by chrisp-dl.atlnz.lc (Postfix, from userid 1030) id 0E5641E1DA3; Thu, 25 May 2017 16:30:46 +1200 (NZST) From: Chris Packham To: broonie@kernel.org, andy.shevchenko@gmail.com, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, rmallon@gmail.com, shawnguo@kernel.org Cc: linux@armlinux.org.uk, Chris Packham , Hartley Sweeten , linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH 2/5] ARM: ep93xx: add gpiod_lookup_table for spi chip-selects Date: Thu, 25 May 2017 16:30:40 +1200 Message-Id: <20170525043043.1930-3-chris.packham@alliedtelesis.co.nz> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170525043043.1930-1-chris.packham@alliedtelesis.co.nz> References: <20170525043043.1930-1-chris.packham@alliedtelesis.co.nz> Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This is a preparatory step which will allow the conversion of spi-ep93xx.c to gpiod. Signed-off-by: Chris Packham --- arch/arm/mach-ep93xx/edb93xx.c | 12 ++++++++++++ arch/arm/mach-ep93xx/simone.c | 11 +++++++++++ arch/arm/mach-ep93xx/vision_ep9307.c | 15 +++++++++++++++ 3 files changed, 38 insertions(+) diff --git a/arch/arm/mach-ep93xx/edb93xx.c b/arch/arm/mach-ep93xx/edb93xx.c index 0ac176386789..9042adfe03de 100644 --- a/arch/arm/mach-ep93xx/edb93xx.c +++ b/arch/arm/mach-ep93xx/edb93xx.c @@ -27,6 +27,8 @@ #include #include #include +#include +#include #include #include #include @@ -116,6 +118,15 @@ static struct spi_board_info edb93xx_spi_board_info[] __initdata = { }, }; +static struct gpiod_lookup_table edb93xx_gpios_table = { + .dev_id = "spi.0", + .table = { + GPIO_LOOKUP("gpio-ep93xx", EP93XX_GPIO_LINE_EGPIO6, + "spi-cs", GPIO_ACTIVE_HIGH), + {}, + }, +}; + static int edb93xx_spi_chipselects[] __initdata = { EP93XX_GPIO_LINE_EGPIO6, }; @@ -134,6 +145,7 @@ static void __init edb93xx_register_spi(void) else if (machine_is_edb9315a()) edb93xx_cs4271_data.gpio_nreset = EP93XX_GPIO_LINE_EGPIO14; + gpiod_add_lookup_table(&edb93xx_gpios_table); ep93xx_register_spi(&edb93xx_spi_info, edb93xx_spi_board_info, ARRAY_SIZE(edb93xx_spi_board_info)); } diff --git a/arch/arm/mach-ep93xx/simone.c b/arch/arm/mach-ep93xx/simone.c index c7a40f245892..f297a7a89ed9 100644 --- a/arch/arm/mach-ep93xx/simone.c +++ b/arch/arm/mach-ep93xx/simone.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -119,6 +120,15 @@ static struct spi_board_info simone_spi_devices[] __initdata = { * low between multi-message command blocks. From v1.4, it uses a GPIO instead. * v1.3 parts will still work, since the signal on SFRMOUT is automatic. */ +static struct gpiod_lookup_table simone_gpios_table = { + .dev_id = "spi.0", + .table = { + GPIO_LOOKUP("gpio-ep93xx", EP93XX_GPIO_LINE_EGPIO1, + "spi-cs", GPIO_ACTIVE_HIGH), + {}, + }, +}; + static int simone_spi_chipselects[] __initdata = { EP93XX_GPIO_LINE_EGPIO1, }; @@ -163,6 +173,7 @@ static void __init simone_init_machine(void) ep93xx_register_fb(&simone_fb_info); ep93xx_register_i2c(&simone_i2c_gpio_data, simone_i2c_board_info, ARRAY_SIZE(simone_i2c_board_info)); + gpiod_add_lookup_table(&simone_gpios_table); ep93xx_register_spi(&simone_spi_info, simone_spi_devices, ARRAY_SIZE(simone_spi_devices)); simone_register_audio(); diff --git a/arch/arm/mach-ep93xx/vision_ep9307.c b/arch/arm/mach-ep93xx/vision_ep9307.c index 1daf9441058c..3d9c66bbf2af 100644 --- a/arch/arm/mach-ep93xx/vision_ep9307.c +++ b/arch/arm/mach-ep93xx/vision_ep9307.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -242,6 +243,19 @@ static struct spi_board_info vision_spi_board_info[] __initdata = { }, }; +static struct gpiod_lookup_table vision_gpios_table = { + .dev_id = "spi.0", + .table = { + GPIO_LOOKUP_IDX("gpio-ep93xx", EP93XX_GPIO_LINE_EGPIO6, + "spi-cs", 0, GPIO_ACTIVE_HIGH), + GPIO_LOOKUP_IDX("gpio-ep93xx", EP93XX_GPIO_LINE_EGPIO7, + "spi-cs", 1, GPIO_ACTIVE_HIGH), + GPIO_LOOKUP_IDX("gpio-ep93xx", EP93XX_GPIO_LINE_G(2), + "spi-cs", 2, GPIO_ACTIVE_HIGH), + {}, + }, +}; + static int vision_spi_chipselects[] __initdata = { EP93XX_GPIO_LINE_EGPIO6, EP93XX_GPIO_LINE_EGPIO7, @@ -291,6 +305,7 @@ static void __init vision_init_machine(void) ep93xx_register_i2c(&vision_i2c_gpio_data, vision_i2c_info, ARRAY_SIZE(vision_i2c_info)); + gpiod_add_lookup_table(&vision_gpios_table); ep93xx_register_spi(&vision_spi_master, vision_spi_board_info, ARRAY_SIZE(vision_spi_board_info)); vision_register_i2s();