From patchwork Sun Feb 3 10:15:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haojian Zhuang X-Patchwork-Id: 14434 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id F3EAE23E2E for ; Sun, 3 Feb 2013 10:16:30 +0000 (UTC) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by fiordland.canonical.com (Postfix) with ESMTP id 996B0A18412 for ; Sun, 3 Feb 2013 10:16:30 +0000 (UTC) Received: by mail-vc0-f179.google.com with SMTP id gb23so3385568vcb.10 for ; Sun, 03 Feb 2013 02:16:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=Lwye0qmPabbX3ggEkPg05rASb73QUbCP7M3ratuzhss=; b=Wa86VhUIB4jy4acD9X0UUJQy4iF/Swl6mmI1C3RFWM19pKVwzydHGGlEirNyi8MOHZ uzPFVFn2wK1lEqsB5STMBGjCXWXcxA9n1qHLVPoNK+mCDZ0LAKqgkEIUNQG6dQSVrVr5 /4mgeLs7RpAgblj6uNBRT++GqZWU67roYLC+6Owa2aC7KdNcaBsV9zJcmwWHrIWZR/NR b3UD5PloeSM6FCPxszd7T1GzFaDHz9LU1qzCnktP5Ia7Un4pxcq1ZYJCbX/l2RLJ7ZJd 90krLHtri8q0HbvnxH8/G3JZQDMtZMx/T6aTAPmoS/42i53P0ximLJZBLlpuXh2nmhIM l7EQ== X-Received: by 10.220.219.204 with SMTP id hv12mr17073267vcb.71.1359886590047; Sun, 03 Feb 2013 02:16:30 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.252.8 with SMTP id zo8csp40349vec; Sun, 3 Feb 2013 02:16:29 -0800 (PST) X-Received: by 10.68.219.71 with SMTP id pm7mr45761416pbc.82.1359886589018; Sun, 03 Feb 2013 02:16:29 -0800 (PST) Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com [209.85.160.54]) by mx.google.com with ESMTPS id b9si13137004pax.223.2013.02.03.02.16.28 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 03 Feb 2013 02:16:29 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.54 is neither permitted nor denied by best guess record for domain of haojian.zhuang@linaro.org) client-ip=209.85.160.54; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.54 is neither permitted nor denied by best guess record for domain of haojian.zhuang@linaro.org) smtp.mail=haojian.zhuang@linaro.org Received: by mail-pb0-f54.google.com with SMTP id rr4so2778585pbb.41 for ; Sun, 03 Feb 2013 02:16:28 -0800 (PST) X-Received: by 10.66.76.97 with SMTP id j1mr43408591paw.70.1359886588584; Sun, 03 Feb 2013 02:16:28 -0800 (PST) Received: from haojian-E6230.domain ([67.198.145.34]) by mx.google.com with ESMTPS id ov4sm14344348pbb.45.2013.02.03.02.16.13 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 03 Feb 2013 02:16:27 -0800 (PST) From: Haojian Zhuang To: linux@arm.linux.org.uk, marek.vasut@gmail.com, robert.jarzmik@free.fr, daniel@caiaq.de, linux-arm-kernel@lists.infradead.org, linus.walleij@linaro.org, grant.likely@secretlab.ca, cxie4@marvell.com, grinberg@compulab.co.il Cc: patches@linaro.org, Haojian Zhuang Subject: [PATCH v2 01/10] gpio: pxa: identify ed mask reg with platform data Date: Sun, 3 Feb 2013 18:15:42 +0800 Message-Id: <1359886551-20950-2-git-send-email-haojian.zhuang@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1359886551-20950-1-git-send-email-haojian.zhuang@linaro.org> References: <1359886551-20950-1-git-send-email-haojian.zhuang@linaro.org> X-Gm-Message-State: ALoCoQnGVN248tkqzwui1QOx+VlhcjRhk2WB8JhJcX+svCCibzqmLAa/ZZ4mZAdFKowJ6/6DHG7i Avoid to judge whether edge mask register exists by CPU. Use platform data to identify it instead. The gpio edge mask register exists in MMP series SoC. Signed-off-by: Haojian Zhuang --- arch/arm/mach-mmp/aspenite.c | 7 +++++++ arch/arm/mach-mmp/avengers_lite.c | 7 +++++++ arch/arm/mach-mmp/brownstone.c | 7 +++++++ arch/arm/mach-mmp/flint.c | 7 +++++++ arch/arm/mach-mmp/gplugd.c | 7 +++++++ arch/arm/mach-mmp/tavorevb.c | 7 +++++++ arch/arm/mach-mmp/teton_bga.c | 7 +++++++ arch/arm/mach-mmp/ttc_dkb.c | 7 +++++++ drivers/gpio/gpio-pxa.c | 10 +++++++++- include/linux/gpio-pxa.h | 1 + 10 files changed, 66 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-mmp/aspenite.c b/arch/arm/mach-mmp/aspenite.c index 9f64d56..36f5781 100644 --- a/arch/arm/mach-mmp/aspenite.c +++ b/arch/arm/mach-mmp/aspenite.c @@ -9,6 +9,7 @@ * publishhed by the Free Software Foundation. */ #include +#include #include #include #include @@ -110,6 +111,10 @@ static unsigned long common_pin_config[] __initdata = { GPIO121_KP_MKIN4, }; +static struct pxa_gpio_platform_data pxa168_gpio_pdata = { + .ed_mask = true, +}; + static struct smc91x_platdata smc91x_info = { .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT, }; @@ -248,6 +253,8 @@ static void __init common_init(void) pxa168_add_nand(&aspenite_nand_info); pxa168_add_fb(&aspenite_lcd_info); pxa168_add_keypad(&aspenite_keypad_info); + platform_device_add_data(&pxa168_device_gpio, &pxa168_gpio_pdata, + sizeof(struct pxa_gpio_platform_data)); platform_device_register(&pxa168_device_gpio); /* off-chip devices */ diff --git a/arch/arm/mach-mmp/avengers_lite.c b/arch/arm/mach-mmp/avengers_lite.c index 1f94957..b8fe447 100644 --- a/arch/arm/mach-mmp/avengers_lite.c +++ b/arch/arm/mach-mmp/avengers_lite.c @@ -12,6 +12,7 @@ #include #include +#include #include #include @@ -32,12 +33,18 @@ static unsigned long avengers_lite_pin_config_V16F[] __initdata = { GPIO89_UART2_RXD, }; +static struct pxa_gpio_platform_data pxa168_gpio_pdata = { + .ed_mask = true, +}; + static void __init avengers_lite_init(void) { mfp_config(ARRAY_AND_SIZE(avengers_lite_pin_config_V16F)); /* on-chip devices */ pxa168_add_uart(2); + platform_device_add_data(&pxa168_device_gpio, &pxa168_gpio_pdata, + sizeof(struct pxa_gpio_platform_data)); platform_device_register(&pxa168_device_gpio); } diff --git a/arch/arm/mach-mmp/brownstone.c b/arch/arm/mach-mmp/brownstone.c index 2358011..d6ea5c4 100644 --- a/arch/arm/mach-mmp/brownstone.c +++ b/arch/arm/mach-mmp/brownstone.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -104,6 +105,10 @@ static unsigned long brownstone_pin_config[] __initdata = { GPIO89_GPIO, }; +static struct pxa_gpio_platform_data mmp2_gpio_pdata = { + .ed_mask = true, +}; + static struct regulator_consumer_supply max8649_supply[] = { REGULATOR_SUPPLY("vcc_core", NULL), }; @@ -202,6 +207,8 @@ static void __init brownstone_init(void) /* on-chip devices */ mmp2_add_uart(1); mmp2_add_uart(3); + platform_device_add_data(&mmp2_device_gpio, &mmp2_gpio_pdata, + sizeof(struct pxa_gpio_platform_data)); platform_device_register(&mmp2_device_gpio); mmp2_add_twsi(1, NULL, ARRAY_AND_SIZE(brownstone_twsi1_info)); mmp2_add_sdhost(0, &mmp2_sdh_platdata_mmc0); /* SD/MMC */ diff --git a/arch/arm/mach-mmp/flint.c b/arch/arm/mach-mmp/flint.c index 754c352..0955f44 100644 --- a/arch/arm/mach-mmp/flint.c +++ b/arch/arm/mach-mmp/flint.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -77,6 +78,10 @@ static unsigned long flint_pin_config[] __initdata = { GPIO160_ND_RDY1, }; +static struct pxa_gpio_platform_data mmp2_gpio_pdata = { + .ed_mask = true, +}; + static struct smc91x_platdata flint_smc91x_info = { .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT, }; @@ -111,6 +116,8 @@ static void __init flint_init(void) /* on-chip devices */ mmp2_add_uart(1); mmp2_add_uart(2); + platform_device_add_data(&mmp2_device_gpio, &mmp2_gpio_pdata, + sizeof(struct pxa_gpio_platform_data)); platform_device_register(&mmp2_device_gpio); /* off-chip devices */ diff --git a/arch/arm/mach-mmp/gplugd.c b/arch/arm/mach-mmp/gplugd.c index d1e2d59..2315cce 100644 --- a/arch/arm/mach-mmp/gplugd.c +++ b/arch/arm/mach-mmp/gplugd.c @@ -10,6 +10,7 @@ #include #include +#include #include #include @@ -127,6 +128,10 @@ static unsigned long gplugd_pin_config[] __initdata = { GPIO116_I2S_TXD }; +static struct pxa_gpio_platform_data pxa168_gpio_pdata = { + .ed_mask = true, +}; + static struct i2c_board_info gplugd_i2c_board_info[] = { { .type = "isl1208", @@ -185,6 +190,8 @@ static void __init gplugd_init(void) pxa168_add_uart(3); pxa168_add_ssp(1); pxa168_add_twsi(0, NULL, ARRAY_AND_SIZE(gplugd_i2c_board_info)); + platform_device_add_data(&pxa168_device_gpio, &pxa168_gpio_pdata, + sizeof(struct pxa_gpio_platform_data)); platform_device_register(&pxa168_device_gpio); pxa168_add_eth(&gplugd_eth_platform_data); diff --git a/arch/arm/mach-mmp/tavorevb.c b/arch/arm/mach-mmp/tavorevb.c index 4c127d2..eaec649 100644 --- a/arch/arm/mach-mmp/tavorevb.c +++ b/arch/arm/mach-mmp/tavorevb.c @@ -8,6 +8,7 @@ * publishhed by the Free Software Foundation. */ #include +#include #include #include #include @@ -60,6 +61,10 @@ static unsigned long tavorevb_pin_config[] __initdata = { DF_RDY0_DF_RDY0, }; +static struct pxa_gpio_platform_data ttc_dkb_gpio_pdata = { + .ed_mask = true, +}; + static struct smc91x_platdata tavorevb_smc91x_info = { .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT, }; @@ -93,6 +98,8 @@ static void __init tavorevb_init(void) /* on-chip devices */ pxa910_add_uart(1); + platform_device_add_data(&pxa910_device_gpio, &ttc_dkb_gpio_pdata, + sizeof(struct pxa_gpio_platform_data)); platform_device_register(&pxa910_device_gpio); /* off-chip devices */ diff --git a/arch/arm/mach-mmp/teton_bga.c b/arch/arm/mach-mmp/teton_bga.c index 8609967..6682100 100644 --- a/arch/arm/mach-mmp/teton_bga.c +++ b/arch/arm/mach-mmp/teton_bga.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -49,6 +50,10 @@ static unsigned long teton_bga_pin_config[] __initdata = { GPIO78_GPIO, }; +static struct pxa_gpio_platform_data pxa168_gpio_pdata = { + .ed_mask = true, +}; + static unsigned int teton_bga_matrix_key_map[] = { KEY(0, 6, KEY_ESC), KEY(0, 7, KEY_ENTER), @@ -79,6 +84,8 @@ static void __init teton_bga_init(void) pxa168_add_uart(1); pxa168_add_keypad(&teton_bga_keypad_info); pxa168_add_twsi(0, NULL, ARRAY_AND_SIZE(teton_bga_i2c_info)); + platform_device_add_data(&pxa168_device_gpio, &pxa168_gpio_pdata, + sizeof(struct pxa_gpio_platform_data)); platform_device_register(&pxa168_device_gpio); } diff --git a/arch/arm/mach-mmp/ttc_dkb.c b/arch/arm/mach-mmp/ttc_dkb.c index 6e47490..984d902 100644 --- a/arch/arm/mach-mmp/ttc_dkb.c +++ b/arch/arm/mach-mmp/ttc_dkb.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -73,6 +74,10 @@ static unsigned long ttc_dkb_pin_config[] __initdata = { DF_RDY0_DF_RDY0, }; +static struct pxa_gpio_platform_data ttc_dkb_gpio_pdata = { + .ed_mask = true, +}; + static struct mtd_partition ttc_dkb_onenand_partitions[] = { { .name = "bootloader", @@ -196,6 +201,8 @@ static void __init ttc_dkb_init(void) /* off-chip devices */ pxa910_add_twsi(0, NULL, ARRAY_AND_SIZE(ttc_dkb_i2c_info)); + platform_device_add_data(&pxa910_device_gpio, &ttc_dkb_gpio_pdata, + sizeof(struct pxa_gpio_platform_data)); platform_add_devices(ARRAY_AND_SIZE(ttc_dkb_devices)); #ifdef CONFIG_USB_MV_UDC diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c index 9cc108d..a4c6687 100644 --- a/drivers/gpio/gpio-pxa.c +++ b/drivers/gpio/gpio-pxa.c @@ -493,6 +493,7 @@ const struct irq_domain_ops pxa_irq_domain_ops = { static int pxa_gpio_probe_dt(struct platform_device *pdev) { int ret, nr_banks, nr_gpios; + struct pxa_gpio_platform_data *pdata; struct device_node *prev, *next, *np = pdev->dev.of_node; const struct of_device_id *of_id = of_match_device(pxa_gpio_dt_ids, &pdev->dev); @@ -501,6 +502,13 @@ static int pxa_gpio_probe_dt(struct platform_device *pdev) dev_err(&pdev->dev, "Failed to find gpio controller\n"); return -EFAULT; } + pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) + return -ENOMEM; + if (of_find_property(np, "marvell,gpio-ed-mask", NULL)) + pdata->ed_mask = true; + /* set the platform data */ + pdev->dev.platform_data = pdata; gpio_type = (int)of_id->data; next = of_get_next_child(np, NULL); @@ -604,7 +612,7 @@ static int pxa_gpio_probe(struct platform_device *pdev) writel_relaxed(0, c->regbase + GRER_OFFSET); writel_relaxed(~0,c->regbase + GEDR_OFFSET); /* unmask GPIO edge detect for AP side */ - if (gpio_is_mmp_type(gpio_type)) + if (info->ed_mask) writel_relaxed(~0, c->regbase + ED_MASK_OFFSET); } diff --git a/include/linux/gpio-pxa.h b/include/linux/gpio-pxa.h index d755b28..bc5cae5 100644 --- a/include/linux/gpio-pxa.h +++ b/include/linux/gpio-pxa.h @@ -14,6 +14,7 @@ extern int pxa_last_gpio; extern int pxa_irq_to_gpio(int irq); struct pxa_gpio_platform_data { + bool ed_mask; /* true means that ed_mask reg is available */ int (*gpio_set_wake)(unsigned int gpio, unsigned int on); };