All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pramod Kumar <pramodku@broadcom.com>
To: Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Kumar Gala <galak@codeaurora.org>, Ray Jui <rjui@broadcom.com>,
	Scott Branden <sbranden@broadcom.com>,
	Russell King <linux@arm.linux.org.uk>,
	Linus Walleij <linus.walleij@linaro.org>,
	linux-gpio@vger.kernel.org
Cc: BCM Kernel Feedback <bcm-kernel-feedback-list@broadcom.com>,
	Jason Uy <jasonuy@broadcom.com>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Jonas Gorski <jogo@openwrt.org>,
	Pramod Kumar <pramodku@broadcom.com>
Subject: [PATCH 07/11] pinctrl: use ngpios propety from DT
Date: Mon, 19 Oct 2015 11:13:14 +0530	[thread overview]
Message-ID: <1445233398-27129-8-git-send-email-pramodku@broadcom.com> (raw)
In-Reply-To: <1445233398-27129-1-git-send-email-pramodku@broadcom.com>

Since identical hardware is used in several instances and all pins
are not routed to pinctrl hence getting total number of gpios from
DT make more sense hence stop using total number of gpios pins from
drivers and extract it from DT.

Signed-off-by: Pramod Kumar <pramodku@broadcom.com>
Reviewed-by: Ray Jui <rjui@broadcom.com>
Reviewed-by: Scott Branden <sbranden@broadcom.com>
---
 drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c | 45 +++++++------------------------
 1 file changed, 9 insertions(+), 36 deletions(-)

diff --git a/drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c b/drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c
index 12a48f4..498a58a 100644
--- a/drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c
+++ b/drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c
@@ -642,35 +642,11 @@ static void cygnus_gpio_unregister_pinconf(struct cygnus_gpio *chip)
 		pinctrl_unregister(chip->pctl);
 }
 
-struct cygnus_gpio_data {
-	unsigned num_gpios;
-};
-
-static const struct cygnus_gpio_data cygnus_cmm_gpio_data = {
-	.num_gpios = 24,
-};
-
-static const struct cygnus_gpio_data cygnus_asiu_gpio_data = {
-	.num_gpios = 146,
-};
-
-static const struct cygnus_gpio_data cygnus_crmu_gpio_data = {
-	.num_gpios = 6,
-};
-
 static const struct of_device_id cygnus_gpio_of_match[] = {
-	{
-		.compatible = "brcm,cygnus-ccm-gpio",
-		.data = &cygnus_cmm_gpio_data,
-	},
-	{
-		.compatible = "brcm,cygnus-asiu-gpio",
-		.data = &cygnus_asiu_gpio_data,
-	},
-	{
-		.compatible = "brcm,cygnus-crmu-gpio",
-		.data = &cygnus_crmu_gpio_data,
-	}
+	{ .compatible = "brcm,cygnus-ccm-gpio" },
+	{ .compatible = "brcm,cygnus-asiu-gpio" },
+	{ .compatible = "brcm,cygnus-crmu-gpio" },
+	{ }
 };
 
 static int cygnus_gpio_probe(struct platform_device *pdev)
@@ -681,14 +657,6 @@ static int cygnus_gpio_probe(struct platform_device *pdev)
 	struct gpio_chip *gc;
 	u32 ngpios;
 	int irq, ret;
-	const struct of_device_id *match;
-	const struct cygnus_gpio_data *gpio_data;
-
-	match = of_match_device(cygnus_gpio_of_match, dev);
-	if (!match)
-		return -ENODEV;
-	gpio_data = match->data;
-	ngpios = gpio_data->num_gpios;
 
 	chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL);
 	if (!chip)
@@ -713,6 +681,11 @@ static int cygnus_gpio_probe(struct platform_device *pdev)
 		}
 	}
 
+	if (of_property_read_u32(dev->of_node, "ngpios", &ngpios)) {
+		dev_err(&pdev->dev, "missing ngpios DT property\n");
+		return -ENODEV;
+	}
+
 	spin_lock_init(&chip->lock);
 
 	gc = &chip->gc;
-- 
1.9.1

WARNING: multiple messages have this Message-ID (diff)
From: Pramod Kumar <pramodku@broadcom.com>
To: Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
	"Mark Rutland" <mark.rutland@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Kumar Gala <galak@codeaurora.org>, Ray Jui <rjui@broadcom.com>,
	Scott Branden <sbranden@broadcom.com>,
	Russell King <linux@arm.linux.org.uk>,
	Linus Walleij <linus.walleij@linaro.org>,
	<linux-gpio@vger.kernel.org>
Cc: BCM Kernel Feedback <bcm-kernel-feedback-list@broadcom.com>,
	Jason Uy <jasonuy@broadcom.com>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	<devicetree@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, Jonas Gorski <jogo@openwrt.org>,
	Pramod Kumar <pramodku@broadcom.com>
Subject: [PATCH 07/11] pinctrl: use ngpios propety from DT
Date: Mon, 19 Oct 2015 11:13:14 +0530	[thread overview]
Message-ID: <1445233398-27129-8-git-send-email-pramodku@broadcom.com> (raw)
In-Reply-To: <1445233398-27129-1-git-send-email-pramodku@broadcom.com>

Since identical hardware is used in several instances and all pins
are not routed to pinctrl hence getting total number of gpios from
DT make more sense hence stop using total number of gpios pins from
drivers and extract it from DT.

Signed-off-by: Pramod Kumar <pramodku@broadcom.com>
Reviewed-by: Ray Jui <rjui@broadcom.com>
Reviewed-by: Scott Branden <sbranden@broadcom.com>
---
 drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c | 45 +++++++------------------------
 1 file changed, 9 insertions(+), 36 deletions(-)

diff --git a/drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c b/drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c
index 12a48f4..498a58a 100644
--- a/drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c
+++ b/drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c
@@ -642,35 +642,11 @@ static void cygnus_gpio_unregister_pinconf(struct cygnus_gpio *chip)
 		pinctrl_unregister(chip->pctl);
 }
 
-struct cygnus_gpio_data {
-	unsigned num_gpios;
-};
-
-static const struct cygnus_gpio_data cygnus_cmm_gpio_data = {
-	.num_gpios = 24,
-};
-
-static const struct cygnus_gpio_data cygnus_asiu_gpio_data = {
-	.num_gpios = 146,
-};
-
-static const struct cygnus_gpio_data cygnus_crmu_gpio_data = {
-	.num_gpios = 6,
-};
-
 static const struct of_device_id cygnus_gpio_of_match[] = {
-	{
-		.compatible = "brcm,cygnus-ccm-gpio",
-		.data = &cygnus_cmm_gpio_data,
-	},
-	{
-		.compatible = "brcm,cygnus-asiu-gpio",
-		.data = &cygnus_asiu_gpio_data,
-	},
-	{
-		.compatible = "brcm,cygnus-crmu-gpio",
-		.data = &cygnus_crmu_gpio_data,
-	}
+	{ .compatible = "brcm,cygnus-ccm-gpio" },
+	{ .compatible = "brcm,cygnus-asiu-gpio" },
+	{ .compatible = "brcm,cygnus-crmu-gpio" },
+	{ }
 };
 
 static int cygnus_gpio_probe(struct platform_device *pdev)
@@ -681,14 +657,6 @@ static int cygnus_gpio_probe(struct platform_device *pdev)
 	struct gpio_chip *gc;
 	u32 ngpios;
 	int irq, ret;
-	const struct of_device_id *match;
-	const struct cygnus_gpio_data *gpio_data;
-
-	match = of_match_device(cygnus_gpio_of_match, dev);
-	if (!match)
-		return -ENODEV;
-	gpio_data = match->data;
-	ngpios = gpio_data->num_gpios;
 
 	chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL);
 	if (!chip)
@@ -713,6 +681,11 @@ static int cygnus_gpio_probe(struct platform_device *pdev)
 		}
 	}
 
+	if (of_property_read_u32(dev->of_node, "ngpios", &ngpios)) {
+		dev_err(&pdev->dev, "missing ngpios DT property\n");
+		return -ENODEV;
+	}
+
 	spin_lock_init(&chip->lock);
 
 	gc = &chip->gc;
-- 
1.9.1


WARNING: multiple messages have this Message-ID (diff)
From: pramodku@broadcom.com (Pramod Kumar)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 07/11] pinctrl: use ngpios propety from DT
Date: Mon, 19 Oct 2015 11:13:14 +0530	[thread overview]
Message-ID: <1445233398-27129-8-git-send-email-pramodku@broadcom.com> (raw)
In-Reply-To: <1445233398-27129-1-git-send-email-pramodku@broadcom.com>

Since identical hardware is used in several instances and all pins
are not routed to pinctrl hence getting total number of gpios from
DT make more sense hence stop using total number of gpios pins from
drivers and extract it from DT.

Signed-off-by: Pramod Kumar <pramodku@broadcom.com>
Reviewed-by: Ray Jui <rjui@broadcom.com>
Reviewed-by: Scott Branden <sbranden@broadcom.com>
---
 drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c | 45 +++++++------------------------
 1 file changed, 9 insertions(+), 36 deletions(-)

diff --git a/drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c b/drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c
index 12a48f4..498a58a 100644
--- a/drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c
+++ b/drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c
@@ -642,35 +642,11 @@ static void cygnus_gpio_unregister_pinconf(struct cygnus_gpio *chip)
 		pinctrl_unregister(chip->pctl);
 }
 
-struct cygnus_gpio_data {
-	unsigned num_gpios;
-};
-
-static const struct cygnus_gpio_data cygnus_cmm_gpio_data = {
-	.num_gpios = 24,
-};
-
-static const struct cygnus_gpio_data cygnus_asiu_gpio_data = {
-	.num_gpios = 146,
-};
-
-static const struct cygnus_gpio_data cygnus_crmu_gpio_data = {
-	.num_gpios = 6,
-};
-
 static const struct of_device_id cygnus_gpio_of_match[] = {
-	{
-		.compatible = "brcm,cygnus-ccm-gpio",
-		.data = &cygnus_cmm_gpio_data,
-	},
-	{
-		.compatible = "brcm,cygnus-asiu-gpio",
-		.data = &cygnus_asiu_gpio_data,
-	},
-	{
-		.compatible = "brcm,cygnus-crmu-gpio",
-		.data = &cygnus_crmu_gpio_data,
-	}
+	{ .compatible = "brcm,cygnus-ccm-gpio" },
+	{ .compatible = "brcm,cygnus-asiu-gpio" },
+	{ .compatible = "brcm,cygnus-crmu-gpio" },
+	{ }
 };
 
 static int cygnus_gpio_probe(struct platform_device *pdev)
@@ -681,14 +657,6 @@ static int cygnus_gpio_probe(struct platform_device *pdev)
 	struct gpio_chip *gc;
 	u32 ngpios;
 	int irq, ret;
-	const struct of_device_id *match;
-	const struct cygnus_gpio_data *gpio_data;
-
-	match = of_match_device(cygnus_gpio_of_match, dev);
-	if (!match)
-		return -ENODEV;
-	gpio_data = match->data;
-	ngpios = gpio_data->num_gpios;
 
 	chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL);
 	if (!chip)
@@ -713,6 +681,11 @@ static int cygnus_gpio_probe(struct platform_device *pdev)
 		}
 	}
 
+	if (of_property_read_u32(dev->of_node, "ngpios", &ngpios)) {
+		dev_err(&pdev->dev, "missing ngpios DT property\n");
+		return -ENODEV;
+	}
+
 	spin_lock_init(&chip->lock);
 
 	gc = &chip->gc;
-- 
1.9.1

  parent reply	other threads:[~2015-10-19  5:43 UTC|newest]

Thread overview: 122+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-19  5:43 [PATCH 00/11] Generalized broadcom cygnus gpio driver Pramod Kumar
2015-10-19  5:43 ` Pramod Kumar
2015-10-19  5:43 ` Pramod Kumar
2015-10-19  5:43 ` [PATCH 01/11] dt-bindings: pinctrl: Optional DT property to support pin mappings Pramod Kumar
2015-10-19  5:43   ` Pramod Kumar
2015-10-19  5:43   ` Pramod Kumar
2015-10-22 18:45   ` Rob Herring
2015-10-22 18:45     ` Rob Herring
2015-10-22 18:45     ` Rob Herring
2015-10-27  9:43   ` Linus Walleij
2015-10-27  9:43     ` Linus Walleij
2015-10-27  9:43     ` Linus Walleij
2015-10-19  5:43 ` [PATCH 02/11] pinctrl: Remove GPIO to Pinctrl pin mapping from driver Pramod Kumar
2015-10-19  5:43   ` Pramod Kumar
2015-10-19  5:43   ` Pramod Kumar
2015-10-27  9:45   ` Linus Walleij
2015-10-27  9:45     ` Linus Walleij
2015-10-27  9:45     ` Linus Walleij
     [not found] ` <1445233398-27129-1-git-send-email-pramodku-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2015-10-19  5:43   ` [PATCH 03/11] dts: pinctrl: Add GPIO to Pinctrl pin mapping in DT Pramod Kumar
2015-10-19  5:43     ` Pramod Kumar
2015-10-19  5:43     ` Pramod Kumar
     [not found]     ` <1445233398-27129-4-git-send-email-pramodku-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2015-10-27  9:46       ` Linus Walleij
2015-10-27  9:46         ` Linus Walleij
2015-10-27  9:46         ` Linus Walleij
2015-11-18 18:39     ` Florian Fainelli
2015-11-18 18:39       ` Florian Fainelli
2015-11-19  3:34       ` Pramod Kumar
2015-11-19  3:34         ` Pramod Kumar
2015-11-19  3:34         ` Pramod Kumar
2015-10-19  5:43   ` [PATCH 08/11] pinctrl: Add new compatible string to GPIO controller driver Pramod Kumar
2015-10-19  5:43     ` Pramod Kumar
2015-10-19  5:43     ` Pramod Kumar
     [not found]     ` <1445233398-27129-9-git-send-email-pramodku-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2015-10-27  9:54       ` Linus Walleij
2015-10-27  9:54         ` Linus Walleij
2015-10-27  9:54         ` Linus Walleij
2015-10-19  5:43 ` [PATCH 04/11] dt-binding: Add new compatible string for gpio " Pramod Kumar
2015-10-19  5:43   ` Pramod Kumar
2015-10-19  5:43   ` Pramod Kumar
2015-10-22 18:40   ` Rob Herring
2015-10-22 18:40     ` Rob Herring
2015-10-22 18:40     ` Rob Herring
2015-10-27  9:49   ` Linus Walleij
2015-10-27  9:49     ` Linus Walleij
2015-10-27  9:49     ` Linus Walleij
2015-10-19  5:43 ` [PATCH 05/11] dt-binding: Add ngpios property to GPIO controller node Pramod Kumar
2015-10-19  5:43   ` Pramod Kumar
2015-10-19  5:43   ` Pramod Kumar
2015-10-22 18:43   ` Rob Herring
2015-10-22 18:43     ` Rob Herring
2015-10-22 18:43     ` Rob Herring
     [not found]     ` <CAL_Jsq+Xwf7==J1LLnUDtj-cgJWRizbKXcYtwfEe5iv8VS-Uwg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-10-22 18:52       ` Ray Jui
2015-10-22 18:52         ` Ray Jui
2015-10-22 18:52         ` Ray Jui
2015-10-22 23:41         ` Rob Herring
2015-10-22 23:41           ` Rob Herring
2015-10-22 23:41           ` Rob Herring
2015-10-23  9:08           ` Laurent Pinchart
2015-10-23  9:08             ` Laurent Pinchart
2015-10-23  9:08             ` Laurent Pinchart
2015-10-23 11:51             ` Rob Herring
2015-10-23 11:51               ` Rob Herring
2015-10-23 11:51               ` Rob Herring
2015-10-23 13:02               ` Laurent Pinchart
2015-10-23 13:02                 ` Laurent Pinchart
2015-10-23 13:02                 ` Laurent Pinchart
2015-10-23 16:08                 ` Ray Jui
2015-10-23 16:08                   ` Ray Jui
2015-10-23 16:08                   ` Ray Jui
     [not found]                   ` <562A5B75.7010804-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2015-10-26 17:08                     ` Pramod Kumar
2015-10-26 17:08                       ` Pramod Kumar
2015-10-26 17:08                       ` Pramod Kumar
2015-10-26 17:12                       ` Ray Jui
2015-10-26 17:12                         ` Ray Jui
2015-10-26 17:12                         ` Ray Jui
2015-10-26 18:06                         ` Pramod Kumar
2015-10-26 18:06                           ` Pramod Kumar
2015-10-26 18:06                           ` Pramod Kumar
     [not found]                           ` <0C803592FC378B4E83922050AB46442A2AD729D4-HXj2mutaA2qau4nib9vn7Zr/X4hKkxxPpWgKQ6/u3Fg@public.gmane.org>
2015-10-26 18:08                             ` Ray Jui
2015-10-26 18:08                               ` Ray Jui
2015-10-26 18:08                               ` Ray Jui
2015-10-27  9:41   ` Linus Walleij
2015-10-27  9:41     ` Linus Walleij
2015-10-27  9:41     ` Linus Walleij
2015-10-28  5:14     ` Pramod Kumar
2015-10-28  5:14       ` Pramod Kumar
2015-10-28  5:14       ` Pramod Kumar
2015-10-19  5:43 ` [PATCH 06/11] dts: define ngpios property in gpio controller's node Pramod Kumar
2015-10-19  5:43   ` Pramod Kumar
2015-10-19  5:43   ` Pramod Kumar
2015-10-19  5:43 ` Pramod Kumar [this message]
2015-10-19  5:43   ` [PATCH 07/11] pinctrl: use ngpios propety from DT Pramod Kumar
2015-10-19  5:43   ` Pramod Kumar
2015-10-27  9:51   ` Linus Walleij
2015-10-27  9:51     ` Linus Walleij
2015-10-27  9:51     ` Linus Walleij
     [not found]     ` <CACRpkdY1GDs6ypqCiY3iiv3DkfnHchnY+bWPoCqU=_sgn9f5vQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-10-28 11:52       ` Pramod Kumar
2015-10-28 11:52         ` Pramod Kumar
2015-10-28 11:52         ` Pramod Kumar
     [not found]         ` <0C803592FC378B4E83922050AB46442A2AD742F0-HXj2mutaA2qau4nib9vn7Zr/X4hKkxxPpWgKQ6/u3Fg@public.gmane.org>
2015-10-28 15:39           ` Ray Jui
2015-10-28 15:39             ` Ray Jui
2015-10-28 15:39             ` Ray Jui
2015-10-29 14:36           ` Linus Walleij
2015-10-29 14:36             ` Linus Walleij
2015-10-29 14:36             ` Linus Walleij
2015-10-29 14:47             ` Jonas Gorski
2015-10-29 14:47               ` Jonas Gorski
2015-10-29 14:47               ` Jonas Gorski
2015-10-30 11:06               ` Linus Walleij
2015-10-30 11:06                 ` Linus Walleij
2015-10-30 11:06                 ` Linus Walleij
2015-10-19  5:43 ` [PATCH 09/11] gpio: Rename func/macro/var to IP-block,iproc Pramod Kumar
2015-10-19  5:43   ` Pramod Kumar
2015-10-19  5:43   ` Pramod Kumar
2015-10-19  5:43 ` [PATCH 10/11] Documentation: Rename gpio controller name from cygnus to iproc Pramod Kumar
2015-10-19  5:43   ` Pramod Kumar
2015-10-19  5:43   ` Pramod Kumar
2015-10-22 18:41   ` Rob Herring
2015-10-22 18:41     ` Rob Herring
2015-10-22 18:41     ` Rob Herring
2015-10-19  5:43 ` [PATCH 11/11] pinctrl: Rename gpio driver " Pramod Kumar
2015-10-19  5:43   ` Pramod Kumar
2015-10-19  5:43   ` Pramod Kumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1445233398-27129-8-git-send-email-pramodku@broadcom.com \
    --to=pramodku@broadcom.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=devicetree@vger.kernel.org \
    --cc=galak@codeaurora.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=jasonuy@broadcom.com \
    --cc=jogo@openwrt.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mark.rutland@arm.com \
    --cc=pawel.moll@arm.com \
    --cc=rjui@broadcom.com \
    --cc=robh+dt@kernel.org \
    --cc=sbranden@broadcom.com \
    --cc=tglx@linutronix.de \
    --cc=yamada.masahiro@socionext.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.