From patchwork Mon Aug 26 10:55:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sekhar Nori X-Patchwork-Id: 2849520 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C315DBF546 for ; Mon, 26 Aug 2013 11:00:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 134C820109 for ; Mon, 26 Aug 2013 11:00:35 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 633F42012F for ; Mon, 26 Aug 2013 11:00:33 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VDuX8-0002Ej-EE; Mon, 26 Aug 2013 11:00:30 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VDuX6-0003eH-40; Mon, 26 Aug 2013 11:00:28 +0000 Received: from devils.ext.ti.com ([198.47.26.153]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VDuX3-0003dF-IA for linux-arm-kernel@lists.infradead.org; Mon, 26 Aug 2013 11:00:26 +0000 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id r7QB023K028698; Mon, 26 Aug 2013 06:00:02 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id r7QB02sx032510; Mon, 26 Aug 2013 06:00:02 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.2.342.3; Mon, 26 Aug 2013 06:00:01 -0500 Received: from [172.24.190.229] (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id r7QAxw7T010333; Mon, 26 Aug 2013 05:59:58 -0500 Message-ID: <521B343D.8060900@ti.com> Date: Mon, 26 Aug 2013 16:25:57 +0530 From: Sekhar Nori User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130803 Thunderbird/17.0.8 MIME-Version: 1.0 To: "Lad, Prabhakar" Subject: Re: [PATCH v3 3/7] ARM: davinci: da8xx: support gpio platform device References: <1376803143-13738-1-git-send-email-prabhakar.csengg@gmail.com> <1376803143-13738-4-git-send-email-prabhakar.csengg@gmail.com> In-Reply-To: <1376803143-13738-4-git-send-email-prabhakar.csengg@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130826_070025_708703_B212B8C6 X-CRM114-Status: GOOD ( 18.24 ) X-Spam-Score: -9.3 (---------) Cc: DLOS , Kevin Hilman , Linus Walleij , LKML , Grant Likely , LAK X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Sunday 18 August 2013 10:48 AM, Lad, Prabhakar wrote: > From: KV Sujith > > DaVinci GPIO driver now uses platform device model. > Convert DA8XX SoC code to use the new model. > > - Add Memory and IRQ resources for da8xx > - Add da8xx_register_gpio API to create platform device for da8xx > platforms. > - Removed unused GPIO initialization in davinci_soc_info structure > > Signed-off-by: KV Sujith > Signed-off-by: Philip Avinash > Acked-by: Linus Walleij > [nsekhar@ti.com: simplify commit message] > Signed-off-by: Sekhar Nori > Signed-off-by: Lad, Prabhakar Parts of 5/7 which touch SoC specific portion can be merged into this patch. I did that for you and here is the result. Thanks, Sekhar From 50db0a98a3076a667d85b4009eb3f029a2f51d14 Mon Sep 17 00:00:00 2001 From: KV Sujith Date: Sun, 18 Aug 2013 10:48:59 +0530 Subject: [PATCH] ARM: davinci: da8xx: support gpio platform device DaVinci GPIO driver now uses platform device model. Convert DA8XX SoC code to use the new model. Add da8xx_register_gpio() to create platform device for da8xx platforms. While at it, reorder include files in alphabetical order. This will eventually help avoid duplicate include files. Signed-off-by: KV Sujith Signed-off-by: Philip Avinash Acked-by: Linus Walleij [nsekhar@ti.com: simplify commit message] Signed-off-by: Sekhar Nori Signed-off-by: Lad, Prabhakar --- arch/arm/mach-davinci/da830.c | 25 ++++++++++++++-------- arch/arm/mach-davinci/da850.c | 31 +++++++++++++++++----------- arch/arm/mach-davinci/devices-da8xx.c | 26 +++++++++++++++++++++++ arch/arm/mach-davinci/include/mach/da8xx.h | 23 ++++++++++++--------- 4 files changed, 74 insertions(+), 31 deletions(-) diff --git a/arch/arm/mach-davinci/da830.c b/arch/arm/mach-davinci/da830.c index d6c746e..73c094d 100644 --- a/arch/arm/mach-davinci/da830.c +++ b/arch/arm/mach-davinci/da830.c @@ -8,19 +8,20 @@ * is licensed "as is" without any warranty of any kind, whether express * or implied. */ +#include #include #include -#include +#include #include -#include -#include -#include #include -#include +#include #include #include +#include +#include +#include #include "clock.h" #include "mux.h" @@ -1151,6 +1152,16 @@ static struct davinci_id da830_ids[] = { }, }; +static struct davinci_gpio_platform_data da830_gpio_platform_data = { + .ngpio = 128, + .intc_irq_num = DA830_N_CP_INTC_IRQ, +}; + +int __init da830_register_gpio(void) +{ + return da8xx_register_gpio(&da830_gpio_platform_data); +} + static struct davinci_timer_instance da830_timer_instance[2] = { { .base = DA8XX_TIMER64P0_BASE, @@ -1196,10 +1207,6 @@ static struct davinci_soc_info davinci_soc_info_da830 = { .intc_irq_prios = da830_default_priorities, .intc_irq_num = DA830_N_CP_INTC_IRQ, .timer_info = &da830_timer_info, - .gpio_type = GPIO_TYPE_DAVINCI, - .gpio_base = DA8XX_GPIO_BASE, - .gpio_num = 128, - .gpio_irq = IRQ_DA8XX_GPIO0, .emac_pdata = &da8xx_emac_pdata, }; diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c index f56e5fb..bcabb1e 100644 --- a/arch/arm/mach-davinci/da850.c +++ b/arch/arm/mach-davinci/da850.c @@ -11,24 +11,25 @@ * is licensed "as is" without any warranty of any kind, whether express * or implied. */ +#include +#include #include #include -#include +#include #include -#include #include #include -#include -#include -#include #include -#include -#include #include -#include +#include +#include #include +#include +#include +#include +#include #include "clock.h" #include "mux.h" @@ -1281,6 +1282,16 @@ int __init da850_register_vpif_capture(struct vpif_capture_config return platform_device_register(&da850_vpif_capture_dev); } +static struct davinci_gpio_platform_data da850_gpio_platform_data = { + .ngpio = 144, + .intc_irq_num = DA850_N_CP_INTC_IRQ, +}; + +int __init da850_register_gpio(void) +{ + return da8xx_register_gpio(&da850_gpio_platform_data); +} + static struct davinci_soc_info davinci_soc_info_da850 = { .io_desc = da850_io_desc, .io_desc_num = ARRAY_SIZE(da850_io_desc), @@ -1298,10 +1309,6 @@ static struct davinci_soc_info davinci_soc_info_da850 = { .intc_irq_prios = da850_default_priorities, .intc_irq_num = DA850_N_CP_INTC_IRQ, .timer_info = &da850_timer_info, - .gpio_type = GPIO_TYPE_DAVINCI, - .gpio_base = DA8XX_GPIO_BASE, - .gpio_num = 144, - .gpio_irq = IRQ_DA8XX_GPIO0, .emac_pdata = &da8xx_emac_pdata, .sram_dma = DA8XX_SHARED_RAM_BASE, .sram_len = SZ_128K, diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c index 2e473fe..c46eccb 100644 --- a/arch/arm/mach-davinci/devices-da8xx.c +++ b/arch/arm/mach-davinci/devices-da8xx.c @@ -665,6 +665,32 @@ int __init da8xx_register_lcdc(struct da8xx_lcdc_platform_data *pdata) return platform_device_register(&da8xx_lcdc_device); } +static struct resource da8xx_gpio_resources[] = { + { /* registers */ + .start = DA8XX_GPIO_BASE, + .end = DA8XX_GPIO_BASE + SZ_4K - 1, + .flags = IORESOURCE_MEM, + }, + { /* interrupt */ + .start = IRQ_DA8XX_GPIO0, + .end = IRQ_DA8XX_GPIO8, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct platform_device da8xx_gpio_device = { + .name = "davinci_gpio", + .id = -1, + .num_resources = ARRAY_SIZE(da8xx_gpio_resources), + .resource = da8xx_gpio_resources, +}; + +int __init da8xx_register_gpio(void *pdata) +{ + da8xx_gpio_device.dev.platform_data = pdata; + return platform_device_register(&da8xx_gpio_device); +} + static struct resource da8xx_mmcsd0_resources[] = { { /* registers */ .start = DA8XX_MMCSD0_BASE, diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h index aae5307..8642150 100644 --- a/arch/arm/mach-davinci/include/mach/da8xx.h +++ b/arch/arm/mach-davinci/include/mach/da8xx.h @@ -11,26 +11,26 @@ #ifndef __ASM_ARCH_DAVINCI_DA8XX_H #define __ASM_ARCH_DAVINCI_DA8XX_H -#include