From patchwork Wed Jan 23 08:25:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haojian Zhuang X-Patchwork-Id: 14235 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 277AC23E1A for ; Wed, 23 Jan 2013 08:26:36 +0000 (UTC) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by fiordland.canonical.com (Postfix) with ESMTP id B1CA8A18D3F for ; Wed, 23 Jan 2013 08:26:35 +0000 (UTC) Received: by mail-vc0-f174.google.com with SMTP id n11so5514420vch.33 for ; Wed, 23 Jan 2013 00:26:35 -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=wiNu2TscaA603Y1BwwGeX2ZO+ekblDebmienDlMEl38=; b=CiRmWtO8yNYZk1srF9PKYiwOzFQD8bIkWPQvP5QIhgspSNy1gluByx4NfMxq1vV6lh 1jub+aA60DRIUPcr0VaB8CGt4wE2IS5pABaLmnRmriaYg5scHmInxbdv4gMtxoZ4awYf Qhu9vYxbO9/U+JMUUM/GaXd88gvlBBX+Sxsl6FdEy/8qEk/0h3FBLKu50W8jf+UDZ3a2 jpJBsMyfUJSOhmMgbtRQw1VLGzsPiU87WFX13OWan+Hk5smmGJlMC5aGpcYVZtgKs55Y o0X21bXMYqBTo2KVD6VLzAOiYy8zSr2MgTc6pmXTbeZqiKkWhjc2g7a0Lovz8mAFsbeH IHcg== X-Received: by 10.52.16.6 with SMTP id b6mr398908vdd.40.1358929595252; Wed, 23 Jan 2013 00:26:35 -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.145.101 with SMTP id st5csp292084veb; Wed, 23 Jan 2013 00:26:34 -0800 (PST) X-Received: by 10.66.72.225 with SMTP id g1mr2335880pav.79.1358929594359; Wed, 23 Jan 2013 00:26:34 -0800 (PST) Received: from mail-pb0-f43.google.com (mail-pb0-f43.google.com [209.85.160.43]) by mx.google.com with ESMTPS id su5si17333089pbc.332.2013.01.23.00.26.34 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 23 Jan 2013 00:26:34 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.43 is neither permitted nor denied by best guess record for domain of haojian.zhuang@linaro.org) client-ip=209.85.160.43; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.43 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-f43.google.com with SMTP id jt11so3149111pbb.2 for ; Wed, 23 Jan 2013 00:26:34 -0800 (PST) X-Received: by 10.68.189.163 with SMTP id gj3mr1274844pbc.110.1358929593990; Wed, 23 Jan 2013 00:26:33 -0800 (PST) Received: from localhost.localdomain ([98.126.173.75]) by mx.google.com with ESMTPS id qf7sm12392126pbb.49.2013.01.23.00.26.30 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 23 Jan 2013 00:26:33 -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 Cc: patches@linaro.org, Haojian Zhuang Subject: [PATCH 09/10] gpio: pxa: move gpio properties into child node Date: Wed, 23 Jan 2013 16:25:53 +0800 Message-Id: <1358929554-32265-10-git-send-email-haojian.zhuang@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1358929554-32265-1-git-send-email-haojian.zhuang@linaro.org> References: <1358929554-32265-1-git-send-email-haojian.zhuang@linaro.org> X-Gm-Message-State: ALoCoQmjTAe7T7FUPmjBmNQ/E4q4+JCuJOwjDL/XM6PEJ0NUkv+mHtWCKJxh0gh8sJqNYJ3ZEiCZ Move gpio properties into child node. So pinctrl driver could binds to each gpio chip with gpio range. Signed-off-by: Haojian Zhuang --- drivers/gpio/gpio-pxa.c | 33 ++++++++------------------------- 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c index 21cf8fd..528f742 100644 --- a/drivers/gpio/gpio-pxa.c +++ b/drivers/gpio/gpio-pxa.c @@ -63,10 +63,6 @@ int pxa_last_gpio; -#ifdef CONFIG_OF -static struct device_node *pxa_gpio_of_node; -#endif - struct pxa_gpio_chip { struct gpio_chip chip; void __iomem *regbase; @@ -404,9 +400,9 @@ static const struct irq_domain_ops pxa_irq_domain_ops = { static int pxa_gpio_probe_dt(struct platform_device *pdev) { - int ret, nr_banks; + int ret; struct pxa_gpio_platform_data *pdata; - struct device_node *prev, *next, *np = pdev->dev.of_node; + struct device_node *np = pdev->dev.of_node; const struct of_device_id *of_id = of_match_device(pxa_gpio_dt_ids, &pdev->dev); @@ -432,25 +428,7 @@ static int pxa_gpio_probe_dt(struct platform_device *pdev) /* set the platform data */ pdev->dev.platform_data = pdata; - next = of_get_next_child(np, NULL); - prev = next; - if (!next) { - dev_err(&pdev->dev, "Failed to find child gpio node\n"); - ret = -EINVAL; - goto err; - } - for (nr_banks = 1; ; nr_banks++) { - next = of_get_next_child(np, prev); - if (!next) - break; - prev = next; - } - of_node_put(prev); - return 0; -err: - iounmap(gpio_reg_base); - return ret; } #else #define pxa_gpio_probe_dt(pdev) (-1) @@ -460,6 +438,7 @@ static int pxa_init_gpio_chip(struct platform_device *pdev, int gpio_end, int (*set_wake)(unsigned int, unsigned int)) { int i, gpio, nbanks = gpio_to_bank(gpio_end) + 1; + struct device_node *next, *np = pdev->dev.of_node; struct pxa_gpio_chip *chips; chips = devm_kzalloc(&pdev->dev, nbanks * sizeof(*chips), GFP_KERNEL); @@ -468,6 +447,7 @@ static int pxa_init_gpio_chip(struct platform_device *pdev, int gpio_end, return -ENOMEM; } + next = of_get_next_child(np, NULL); for (i = 0, gpio = 0; i < nbanks; i++, gpio += 32) { struct gpio_chip *gc = &chips[i].chip; @@ -495,7 +475,10 @@ static int pxa_init_gpio_chip(struct platform_device *pdev, int gpio_end, gc->set = pxa_gpio_set; gc->to_irq = pxa_gpio_to_irq; #ifdef CONFIG_OF_GPIO - gc->of_node = pxa_gpio_of_node; + gc->of_node = next; + next = of_get_next_child(np, next); + of_node_put(gc->of_node); + gc->of_xlate = pxa_gpio_of_xlate; gc->of_gpio_n_cells = 2; #endif