* [U-Boot] [PATCH v2] gpio: lpc32xx: Use priv_data instead of platdata
@ 2015-04-14 6:55 Axel Lin
2015-04-16 11:52 ` Albert ARIBAUD
2015-06-03 17:24 ` Albert ARIBAUD
0 siblings, 2 replies; 3+ messages in thread
From: Axel Lin @ 2015-04-14 6:55 UTC (permalink / raw)
To: u-boot
The LPC32XX GPIO driver platdata currently contains GPIO state information,
which should go into priv_data. Thus rename lpc32xx_gpio_platdata to
lpc32xx_gpio_priv and convert to use dev_get_priv() instead.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
v2: Update commit log to mention that using priv_data for runtime state
which was stored in platdata.
drivers/gpio/lpc32xx_gpio.c | 39 +++++++++++++++++++--------------------
1 file changed, 19 insertions(+), 20 deletions(-)
diff --git a/drivers/gpio/lpc32xx_gpio.c b/drivers/gpio/lpc32xx_gpio.c
index 96b3125..8a9826e 100644
--- a/drivers/gpio/lpc32xx_gpio.c
+++ b/drivers/gpio/lpc32xx_gpio.c
@@ -37,7 +37,7 @@
#define LPC32XX_GPIOS 128
-struct lpc32xx_gpio_platdata {
+struct lpc32xx_gpio_priv {
struct gpio_regs *regs;
/* GPIO FUNCTION: SEE WARNING #2 */
signed char function[LPC32XX_GPIOS];
@@ -60,8 +60,8 @@ struct lpc32xx_gpio_platdata {
static int lpc32xx_gpio_direction_input(struct udevice *dev, unsigned offset)
{
int port, mask;
- struct lpc32xx_gpio_platdata *gpio_platdata = dev_get_platdata(dev);
- struct gpio_regs *regs = gpio_platdata->regs;
+ struct lpc32xx_gpio_priv *gpio_priv = dev_get_priv(dev);
+ struct gpio_regs *regs = gpio_priv->regs;
port = GPIO_TO_PORT(offset);
mask = GPIO_TO_MASK(offset);
@@ -83,7 +83,7 @@ static int lpc32xx_gpio_direction_input(struct udevice *dev, unsigned offset)
}
/* GPIO FUNCTION: SEE WARNING #2 */
- gpio_platdata->function[offset] = GPIOF_INPUT;
+ gpio_priv->function[offset] = GPIOF_INPUT;
return 0;
}
@@ -95,8 +95,8 @@ static int lpc32xx_gpio_direction_input(struct udevice *dev, unsigned offset)
static int lpc32xx_gpio_get_value(struct udevice *dev, unsigned offset)
{
int port, rank, mask, value;
- struct lpc32xx_gpio_platdata *gpio_platdata = dev_get_platdata(dev);
- struct gpio_regs *regs = gpio_platdata->regs;
+ struct lpc32xx_gpio_priv *gpio_priv = dev_get_priv(dev);
+ struct gpio_regs *regs = gpio_priv->regs;
port = GPIO_TO_PORT(offset);
@@ -130,8 +130,8 @@ static int lpc32xx_gpio_get_value(struct udevice *dev, unsigned offset)
static int gpio_set(struct udevice *dev, unsigned gpio)
{
int port, mask;
- struct lpc32xx_gpio_platdata *gpio_platdata = dev_get_platdata(dev);
- struct gpio_regs *regs = gpio_platdata->regs;
+ struct lpc32xx_gpio_priv *gpio_priv = dev_get_priv(dev);
+ struct gpio_regs *regs = gpio_priv->regs;
port = GPIO_TO_PORT(gpio);
mask = GPIO_TO_MASK(gpio);
@@ -162,8 +162,8 @@ static int gpio_set(struct udevice *dev, unsigned gpio)
static int gpio_clr(struct udevice *dev, unsigned gpio)
{
int port, mask;
- struct lpc32xx_gpio_platdata *gpio_platdata = dev_get_platdata(dev);
- struct gpio_regs *regs = gpio_platdata->regs;
+ struct lpc32xx_gpio_priv *gpio_priv = dev_get_priv(dev);
+ struct gpio_regs *regs = gpio_priv->regs;
port = GPIO_TO_PORT(gpio);
mask = GPIO_TO_MASK(gpio);
@@ -208,8 +208,8 @@ static int lpc32xx_gpio_direction_output(struct udevice *dev, unsigned offset,
int value)
{
int port, mask;
- struct lpc32xx_gpio_platdata *gpio_platdata = dev_get_platdata(dev);
- struct gpio_regs *regs = gpio_platdata->regs;
+ struct lpc32xx_gpio_priv *gpio_priv = dev_get_priv(dev);
+ struct gpio_regs *regs = gpio_priv->regs;
port = GPIO_TO_PORT(offset);
mask = GPIO_TO_MASK(offset);
@@ -231,7 +231,7 @@ static int lpc32xx_gpio_direction_output(struct udevice *dev, unsigned offset,
}
/* GPIO FUNCTION: SEE WARNING #2 */
- gpio_platdata->function[offset] = GPIOF_OUTPUT;
+ gpio_priv->function[offset] = GPIOF_OUTPUT;
return lpc32xx_gpio_set_value(dev, offset, value);
}
@@ -251,8 +251,8 @@ static int lpc32xx_gpio_direction_output(struct udevice *dev, unsigned offset,
static int lpc32xx_gpio_get_function(struct udevice *dev, unsigned offset)
{
- struct lpc32xx_gpio_platdata *gpio_platdata = dev_get_platdata(dev);
- return gpio_platdata->function[offset];
+ struct lpc32xx_gpio_priv *gpio_priv = dev_get_priv(dev);
+ return gpio_priv->function[offset];
}
static const struct dm_gpio_ops gpio_lpc32xx_ops = {
@@ -265,7 +265,7 @@ static const struct dm_gpio_ops gpio_lpc32xx_ops = {
static int lpc32xx_gpio_probe(struct udevice *dev)
{
- struct lpc32xx_gpio_platdata *gpio_platdata = dev_get_platdata(dev);
+ struct lpc32xx_gpio_priv *gpio_priv = dev_get_priv(dev);
struct gpio_dev_priv *uc_priv = dev->uclass_priv;
if (dev->of_offset == -1) {
@@ -274,12 +274,11 @@ static int lpc32xx_gpio_probe(struct udevice *dev)
}
/* set base address for GPIO registers */
- gpio_platdata->regs = (struct gpio_regs *)GPIO_BASE;
+ gpio_priv->regs = (struct gpio_regs *)GPIO_BASE;
/* all GPIO functions are unknown until requested */
/* GPIO FUNCTION: SEE WARNING #2 */
- memset(gpio_platdata->function, GPIOF_UNKNOWN,
- sizeof(gpio_platdata->function));
+ memset(gpio_priv->function, GPIOF_UNKNOWN, sizeof(gpio_priv->function));
return 0;
}
@@ -289,5 +288,5 @@ U_BOOT_DRIVER(gpio_lpc32xx) = {
.id = UCLASS_GPIO,
.ops = &gpio_lpc32xx_ops,
.probe = lpc32xx_gpio_probe,
- .priv_auto_alloc_size = sizeof(struct lpc32xx_gpio_platdata),
+ .priv_auto_alloc_size = sizeof(struct lpc32xx_gpio_priv),
};
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* [U-Boot] [PATCH v2] gpio: lpc32xx: Use priv_data instead of platdata
2015-04-14 6:55 [U-Boot] [PATCH v2] gpio: lpc32xx: Use priv_data instead of platdata Axel Lin
@ 2015-04-16 11:52 ` Albert ARIBAUD
2015-06-03 17:24 ` Albert ARIBAUD
1 sibling, 0 replies; 3+ messages in thread
From: Albert ARIBAUD @ 2015-04-16 11:52 UTC (permalink / raw)
To: u-boot
Hello Axel,
On Tue, 14 Apr 2015 14:55:24 +0800, Axel Lin <axel.lin@ingics.com>
wrote:
> The LPC32XX GPIO driver platdata currently contains GPIO state information,
> which should go into priv_data. Thus rename lpc32xx_gpio_platdata to
> lpc32xx_gpio_priv and convert to use dev_get_priv() instead.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
Tested-by: Albert ARIBAUD <albert.aribaud@3adev.fr>
Amicalement,
--
Albert.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH v2] gpio: lpc32xx: Use priv_data instead of platdata
2015-04-14 6:55 [U-Boot] [PATCH v2] gpio: lpc32xx: Use priv_data instead of platdata Axel Lin
2015-04-16 11:52 ` Albert ARIBAUD
@ 2015-06-03 17:24 ` Albert ARIBAUD
1 sibling, 0 replies; 3+ messages in thread
From: Albert ARIBAUD @ 2015-06-03 17:24 UTC (permalink / raw)
To: u-boot
Hello Axel,
On Tue, 14 Apr 2015 14:55:24 +0800, Axel Lin <axel.lin@ingics.com> wrote:
> The LPC32XX GPIO driver platdata currently contains GPIO state information,
> which should go into priv_data. Thus rename lpc32xx_gpio_platdata to
> lpc32xx_gpio_priv and convert to use dev_get_priv() instead.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
> v2: Update commit log to mention that using priv_data for runtime state
> which was stored in platdata.
> drivers/gpio/lpc32xx_gpio.c | 39 +++++++++++++++++++--------------------
> 1 file changed, 19 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/gpio/lpc32xx_gpio.c b/drivers/gpio/lpc32xx_gpio.c
> index 96b3125..8a9826e 100644
> --- a/drivers/gpio/lpc32xx_gpio.c
> +++ b/drivers/gpio/lpc32xx_gpio.c
> @@ -37,7 +37,7 @@
>
> #define LPC32XX_GPIOS 128
>
> -struct lpc32xx_gpio_platdata {
> +struct lpc32xx_gpio_priv {
> struct gpio_regs *regs;
> /* GPIO FUNCTION: SEE WARNING #2 */
> signed char function[LPC32XX_GPIOS];
> @@ -60,8 +60,8 @@ struct lpc32xx_gpio_platdata {
> static int lpc32xx_gpio_direction_input(struct udevice *dev, unsigned offset)
> {
> int port, mask;
> - struct lpc32xx_gpio_platdata *gpio_platdata = dev_get_platdata(dev);
> - struct gpio_regs *regs = gpio_platdata->regs;
> + struct lpc32xx_gpio_priv *gpio_priv = dev_get_priv(dev);
> + struct gpio_regs *regs = gpio_priv->regs;
>
> port = GPIO_TO_PORT(offset);
> mask = GPIO_TO_MASK(offset);
> @@ -83,7 +83,7 @@ static int lpc32xx_gpio_direction_input(struct udevice *dev, unsigned offset)
> }
>
> /* GPIO FUNCTION: SEE WARNING #2 */
> - gpio_platdata->function[offset] = GPIOF_INPUT;
> + gpio_priv->function[offset] = GPIOF_INPUT;
>
> return 0;
> }
> @@ -95,8 +95,8 @@ static int lpc32xx_gpio_direction_input(struct udevice *dev, unsigned offset)
> static int lpc32xx_gpio_get_value(struct udevice *dev, unsigned offset)
> {
> int port, rank, mask, value;
> - struct lpc32xx_gpio_platdata *gpio_platdata = dev_get_platdata(dev);
> - struct gpio_regs *regs = gpio_platdata->regs;
> + struct lpc32xx_gpio_priv *gpio_priv = dev_get_priv(dev);
> + struct gpio_regs *regs = gpio_priv->regs;
>
> port = GPIO_TO_PORT(offset);
>
> @@ -130,8 +130,8 @@ static int lpc32xx_gpio_get_value(struct udevice *dev, unsigned offset)
> static int gpio_set(struct udevice *dev, unsigned gpio)
> {
> int port, mask;
> - struct lpc32xx_gpio_platdata *gpio_platdata = dev_get_platdata(dev);
> - struct gpio_regs *regs = gpio_platdata->regs;
> + struct lpc32xx_gpio_priv *gpio_priv = dev_get_priv(dev);
> + struct gpio_regs *regs = gpio_priv->regs;
>
> port = GPIO_TO_PORT(gpio);
> mask = GPIO_TO_MASK(gpio);
> @@ -162,8 +162,8 @@ static int gpio_set(struct udevice *dev, unsigned gpio)
> static int gpio_clr(struct udevice *dev, unsigned gpio)
> {
> int port, mask;
> - struct lpc32xx_gpio_platdata *gpio_platdata = dev_get_platdata(dev);
> - struct gpio_regs *regs = gpio_platdata->regs;
> + struct lpc32xx_gpio_priv *gpio_priv = dev_get_priv(dev);
> + struct gpio_regs *regs = gpio_priv->regs;
>
> port = GPIO_TO_PORT(gpio);
> mask = GPIO_TO_MASK(gpio);
> @@ -208,8 +208,8 @@ static int lpc32xx_gpio_direction_output(struct udevice *dev, unsigned offset,
> int value)
> {
> int port, mask;
> - struct lpc32xx_gpio_platdata *gpio_platdata = dev_get_platdata(dev);
> - struct gpio_regs *regs = gpio_platdata->regs;
> + struct lpc32xx_gpio_priv *gpio_priv = dev_get_priv(dev);
> + struct gpio_regs *regs = gpio_priv->regs;
>
> port = GPIO_TO_PORT(offset);
> mask = GPIO_TO_MASK(offset);
> @@ -231,7 +231,7 @@ static int lpc32xx_gpio_direction_output(struct udevice *dev, unsigned offset,
> }
>
> /* GPIO FUNCTION: SEE WARNING #2 */
> - gpio_platdata->function[offset] = GPIOF_OUTPUT;
> + gpio_priv->function[offset] = GPIOF_OUTPUT;
>
> return lpc32xx_gpio_set_value(dev, offset, value);
> }
> @@ -251,8 +251,8 @@ static int lpc32xx_gpio_direction_output(struct udevice *dev, unsigned offset,
>
> static int lpc32xx_gpio_get_function(struct udevice *dev, unsigned offset)
> {
> - struct lpc32xx_gpio_platdata *gpio_platdata = dev_get_platdata(dev);
> - return gpio_platdata->function[offset];
> + struct lpc32xx_gpio_priv *gpio_priv = dev_get_priv(dev);
> + return gpio_priv->function[offset];
> }
>
> static const struct dm_gpio_ops gpio_lpc32xx_ops = {
> @@ -265,7 +265,7 @@ static const struct dm_gpio_ops gpio_lpc32xx_ops = {
>
> static int lpc32xx_gpio_probe(struct udevice *dev)
> {
> - struct lpc32xx_gpio_platdata *gpio_platdata = dev_get_platdata(dev);
> + struct lpc32xx_gpio_priv *gpio_priv = dev_get_priv(dev);
> struct gpio_dev_priv *uc_priv = dev->uclass_priv;
>
> if (dev->of_offset == -1) {
> @@ -274,12 +274,11 @@ static int lpc32xx_gpio_probe(struct udevice *dev)
> }
>
> /* set base address for GPIO registers */
> - gpio_platdata->regs = (struct gpio_regs *)GPIO_BASE;
> + gpio_priv->regs = (struct gpio_regs *)GPIO_BASE;
>
> /* all GPIO functions are unknown until requested */
> /* GPIO FUNCTION: SEE WARNING #2 */
> - memset(gpio_platdata->function, GPIOF_UNKNOWN,
> - sizeof(gpio_platdata->function));
> + memset(gpio_priv->function, GPIOF_UNKNOWN, sizeof(gpio_priv->function));
>
> return 0;
> }
> @@ -289,5 +288,5 @@ U_BOOT_DRIVER(gpio_lpc32xx) = {
> .id = UCLASS_GPIO,
> .ops = &gpio_lpc32xx_ops,
> .probe = lpc32xx_gpio_probe,
> - .priv_auto_alloc_size = sizeof(struct lpc32xx_gpio_platdata),
> + .priv_auto_alloc_size = sizeof(struct lpc32xx_gpio_priv),
> };
> --
> 1.9.1
>
>
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
Applied to u-boot-arm/master, thanks!
Amicalement,
--
Albert.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-06-03 17:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-14 6:55 [U-Boot] [PATCH v2] gpio: lpc32xx: Use priv_data instead of platdata Axel Lin
2015-04-16 11:52 ` Albert ARIBAUD
2015-06-03 17:24 ` Albert ARIBAUD
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox