* [PATCH 1/5] GPIO: Rename "drivers/gpio.c" to "drivers/gpiolib.c"
@ 2013-04-20 4:18 Alexander Shiyan
2013-04-20 4:18 ` [PATCH] ubimkvol: Typo fix Alexander Shiyan
` (5 more replies)
0 siblings, 6 replies; 13+ messages in thread
From: Alexander Shiyan @ 2013-04-20 4:18 UTC (permalink / raw)
To: barebox
Rename "drivers/gpio.c" to "drivers/gpiolib.c".
Reason is for understand functionality of driver.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
drivers/gpio/Makefile | 3 ++-
drivers/gpio/{gpio.c => gpiolib.c} | 0
2 files changed, 2 insertions(+), 1 deletion(-)
rename drivers/gpio/{gpio.c => gpiolib.c} (100%)
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 00acb68..6a94430 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -1,4 +1,5 @@
-obj-$(CONFIG_GPIOLIB) += gpio.o
+obj-$(CONFIG_GPIOLIB) += gpiolib.o
+
obj-$(CONFIG_GPIO_BCM2835) += gpio-bcm2835.o
obj-$(CONFIG_GPIO_CLPS711X) += gpio-clps711x.o
obj-$(CONFIG_GPIO_GENERIC) += gpio-generic.o
diff --git a/drivers/gpio/gpio.c b/drivers/gpio/gpiolib.c
similarity index 100%
rename from drivers/gpio/gpio.c
rename to drivers/gpio/gpiolib.c
--
1.8.1.5
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH] ubimkvol: Typo fix
2013-04-20 4:18 [PATCH 1/5] GPIO: Rename "drivers/gpio.c" to "drivers/gpiolib.c" Alexander Shiyan
@ 2013-04-20 4:18 ` Alexander Shiyan
2013-04-20 4:18 ` [PATCH 2/5] ARM: i.MX: Move GPIO driver to drivers/gpio Alexander Shiyan
` (4 subsequent siblings)
5 siblings, 0 replies; 13+ messages in thread
From: Alexander Shiyan @ 2013-04-20 4:18 UTC (permalink / raw)
To: barebox
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
commands/ubi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/commands/ubi.c b/commands/ubi.c
index 1653eaa..7348394 100644
--- a/commands/ubi.c
+++ b/commands/ubi.c
@@ -47,7 +47,7 @@ static int do_ubimkvol(int argc, char *argv[])
static const __maybe_unused char cmd_ubimkvol_help[] =
"Usage: ubimkvol <ubidev> <name> <size>\n"
"Create an ubi volume on <ubidev> with name <name> and size <size>\n"
-"If size os zero all available space is used for the volume\n";
+"If size is zero all available space is used for the volume\n";
BAREBOX_CMD_START(ubimkvol)
.cmd = do_ubimkvol,
--
1.8.1.5
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 2/5] ARM: i.MX: Move GPIO driver to drivers/gpio
2013-04-20 4:18 [PATCH 1/5] GPIO: Rename "drivers/gpio.c" to "drivers/gpiolib.c" Alexander Shiyan
2013-04-20 4:18 ` [PATCH] ubimkvol: Typo fix Alexander Shiyan
@ 2013-04-20 4:18 ` Alexander Shiyan
2013-04-20 4:18 ` [PATCH 3/5] GPIO: i.MX: Rewrite driver for using generic GPIO code Alexander Shiyan
` (3 subsequent siblings)
5 siblings, 0 replies; 13+ messages in thread
From: Alexander Shiyan @ 2013-04-20 4:18 UTC (permalink / raw)
To: barebox
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
arch/arm/mach-imx/Makefile | 2 +-
drivers/gpio/Kconfig | 3 +++
drivers/gpio/Makefile | 1 +
arch/arm/mach-imx/gpio.c => drivers/gpio/gpio-imx.c | 0
4 files changed, 5 insertions(+), 1 deletion(-)
rename arch/arm/mach-imx/gpio.c => drivers/gpio/gpio-imx.c (100%)
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index ff8f15b..b703ed1 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -1,4 +1,4 @@
-obj-y += clocksource.o gpio.o
+obj-y += clocksource.o
obj-$(CONFIG_ARCH_IMX1) += imx1.o iomux-v1.o clk-imx1.o
obj-$(CONFIG_ARCH_IMX25) += imx25.o iomux-v3.o clk-imx25.o
obj-$(CONFIG_ARCH_IMX21) += imx21.o iomux-v1.o clk-imx21.o
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index ea07028..74a4baa 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -27,6 +27,9 @@ config GPIO_GENERIC_PLATFORM
Say yes here to support basic platform memory-mapped
GPIO controllers
+config GPIO_IMX
+ def_bool ARCH_IMX
+
config GPIO_PL061
bool "PrimeCell PL061 GPIO support"
depends on ARM_AMBA
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 6a94430..205d553 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -3,5 +3,6 @@ obj-$(CONFIG_GPIOLIB) += gpiolib.o
obj-$(CONFIG_GPIO_BCM2835) += gpio-bcm2835.o
obj-$(CONFIG_GPIO_CLPS711X) += gpio-clps711x.o
obj-$(CONFIG_GPIO_GENERIC) += gpio-generic.o
+obj-$(CONFIG_GPIO_IMX) += gpio-imx.o
obj-$(CONFIG_GPIO_PL061) += gpio-pl061.o
obj-$(CONFIG_GPIO_STMPE) += gpio-stmpe.o
diff --git a/arch/arm/mach-imx/gpio.c b/drivers/gpio/gpio-imx.c
similarity index 100%
rename from arch/arm/mach-imx/gpio.c
rename to drivers/gpio/gpio-imx.c
--
1.8.1.5
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 3/5] GPIO: i.MX: Rewrite driver for using generic GPIO code
2013-04-20 4:18 [PATCH 1/5] GPIO: Rename "drivers/gpio.c" to "drivers/gpiolib.c" Alexander Shiyan
2013-04-20 4:18 ` [PATCH] ubimkvol: Typo fix Alexander Shiyan
2013-04-20 4:18 ` [PATCH 2/5] ARM: i.MX: Move GPIO driver to drivers/gpio Alexander Shiyan
@ 2013-04-20 4:18 ` Alexander Shiyan
2013-04-22 6:46 ` Sascha Hauer
2013-04-20 4:18 ` [PATCH 4/5] GPIO: i.MX: Cleanup driver code Alexander Shiyan
` (2 subsequent siblings)
5 siblings, 1 reply; 13+ messages in thread
From: Alexander Shiyan @ 2013-04-20 4:18 UTC (permalink / raw)
To: barebox
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
arch/arm/Kconfig | 1 -
drivers/gpio/Kconfig | 1 +
drivers/gpio/gpio-imx.c | 125 ++++++++++++------------------------------------
3 files changed, 31 insertions(+), 96 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index bb9b47b..5607754 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -72,7 +72,6 @@ config ARCH_HIGHBANK
config ARCH_IMX
bool "Freescale iMX-based"
- select GENERIC_GPIO
select GPIOLIB
select COMMON_CLK
select CLKDEV_LOOKUP
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 74a4baa..5ccd35b 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -29,6 +29,7 @@ config GPIO_GENERIC_PLATFORM
config GPIO_IMX
def_bool ARCH_IMX
+ select GPIO_GENERIC
config GPIO_PL061
bool "PrimeCell PL061 GPIO support"
diff --git a/drivers/gpio/gpio-imx.c b/drivers/gpio/gpio-imx.c
index 1bf4100..9dcabfc 100644
--- a/drivers/gpio/gpio-imx.c
+++ b/drivers/gpio/gpio-imx.c
@@ -20,17 +20,11 @@
*
*/
-#include <common.h>
-#include <errno.h>
-#include <io.h>
-#include <gpio.h>
#include <init.h>
+#include <common.h>
+#include <malloc.h>
-struct imx_gpio_chip {
- void __iomem *base;
- struct gpio_chip chip;
- struct imx_gpio_regs *regs;
-};
+#include <linux/basic_mmio_gpio.h>
struct imx_gpio_regs {
unsigned int dr;
@@ -50,104 +44,45 @@ static struct imx_gpio_regs regs_imx31 = {
.psr = 0x08,
};
-static void imx_gpio_set_value(struct gpio_chip *chip, unsigned gpio, int value)
-{
- struct imx_gpio_chip *imxgpio = container_of(chip, struct imx_gpio_chip, chip);
- void __iomem *base = imxgpio->base;
- u32 val;
-
- if (!base)
- return;
-
- val = readl(base + imxgpio->regs->dr);
-
- if (value)
- val |= 1 << gpio;
- else
- val &= ~(1 << gpio);
-
- writel(val, base + imxgpio->regs->dr);
-}
-
-static int imx_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
-{
- struct imx_gpio_chip *imxgpio = container_of(chip, struct imx_gpio_chip, chip);
- void __iomem *base = imxgpio->base;
- u32 val;
-
- if (!base)
- return -EINVAL;
-
- val = readl(base + imxgpio->regs->gdir);
- val &= ~(1 << gpio);
- writel(val, base + imxgpio->regs->gdir);
-
- return 0;
-}
-
-
-static int imx_gpio_direction_output(struct gpio_chip *chip, unsigned gpio, int value)
-{
- struct imx_gpio_chip *imxgpio = container_of(chip, struct imx_gpio_chip, chip);
- void __iomem *base = imxgpio->base;
- u32 val;
-
- gpio_set_value(gpio + chip->base, value);
-
- val = readl(base + imxgpio->regs->gdir);
- val |= 1 << gpio;
- writel(val, base + imxgpio->regs->gdir);
-
- return 0;
-}
-
-static int imx_gpio_get_value(struct gpio_chip *chip, unsigned gpio)
-{
- struct imx_gpio_chip *imxgpio = container_of(chip, struct imx_gpio_chip, chip);
- void __iomem *base = imxgpio->base;
- u32 val;
-
- val = readl(base + imxgpio->regs->psr);
-
- return val & (1 << gpio) ? 1 : 0;
-}
-
-static struct gpio_ops imx_gpio_ops = {
- .direction_input = imx_gpio_direction_input,
- .direction_output = imx_gpio_direction_output,
- .get = imx_gpio_get_value,
- .set = imx_gpio_set_value,
-};
-
static int imx_gpio_probe(struct device_d *dev)
{
- struct imx_gpio_chip *imxgpio;
struct imx_gpio_regs *regs;
+ struct bgpio_chip *bgc;
+ void __iomem *base;
int ret;
ret = dev_get_drvdata(dev, (unsigned long *)®s);
if (ret)
return ret;
- imxgpio = xzalloc(sizeof(*imxgpio));
- imxgpio->base = dev_request_mem_region(dev, 0);
- imxgpio->chip.ops = &imx_gpio_ops;
- if (dev->id < 0) {
- imxgpio->chip.base = of_alias_get_id(dev->device_node, "gpio");
- if (imxgpio->chip.base < 0)
- return imxgpio->chip.base;
- imxgpio->chip.base *= 32;
- } else {
- imxgpio->chip.base = dev->id * 32;
+ bgc = xzalloc(sizeof(*bgc));
+ if (!bgc)
+ return -ENOMEM;
+
+ base = dev_request_mem_region(dev, 0);
+ if (!base) {
+ free(bgc);
+ return -EINVAL;
}
- imxgpio->chip.ngpio = 32;
- imxgpio->chip.dev = dev;
- imxgpio->regs = regs;
- gpiochip_add(&imxgpio->chip);
- dev_dbg(dev, "probed gpiochip%d with base %d\n", dev->id, imxgpio->chip.base);
+ ret = bgpio_init(bgc, dev, 4, base + regs->psr, base + regs->dr, NULL,
+ base + regs->gdir, NULL, 0);
+ if (ret) {
+ free(bgc);
+ return ret;
+ }
- return 0;
+ if (dev->id < 0) {
+ bgc->gc.base = of_alias_get_id(dev->device_node, "gpio");
+ if (bgc->gc.base < 0) {
+ free(bgc);
+ return bgc->gc.base;
+ }
+ bgc->gc.base *= 32;
+ } else
+ bgc->gc.base = dev->id * 32;
+
+ return gpiochip_add(&bgc->gc);
}
static __maybe_unused struct of_device_id imx_gpio_dt_ids[] = {
--
1.8.1.5
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 4/5] GPIO: i.MX: Cleanup driver code
2013-04-20 4:18 [PATCH 1/5] GPIO: Rename "drivers/gpio.c" to "drivers/gpiolib.c" Alexander Shiyan
` (2 preceding siblings ...)
2013-04-20 4:18 ` [PATCH 3/5] GPIO: i.MX: Rewrite driver for using generic GPIO code Alexander Shiyan
@ 2013-04-20 4:18 ` Alexander Shiyan
2013-04-20 17:04 ` Jean-Christophe PLAGNIOL-VILLARD
2013-04-22 16:58 ` Sascha Hauer
2013-04-20 4:18 ` [PATCH 5/5] Introduce coredevice_platform_driver() macro and use it for GPIO drivers Alexander Shiyan
2013-04-22 16:59 ` [PATCH 1/5] GPIO: Rename "drivers/gpio.c" to "drivers/gpiolib.c" Sascha Hauer
5 siblings, 2 replies; 13+ messages in thread
From: Alexander Shiyan @ 2013-04-20 4:18 UTC (permalink / raw)
To: barebox
This patch provides only cleanup for i.MX GPIO driver.
Indentation, reduced licence text etc.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
drivers/gpio/gpio-imx.c | 34 ++++++++++++----------------------
1 file changed, 12 insertions(+), 22 deletions(-)
diff --git a/drivers/gpio/gpio-imx.c b/drivers/gpio/gpio-imx.c
index 9dcabfc..f56346b 100644
--- a/drivers/gpio/gpio-imx.c
+++ b/drivers/gpio/gpio-imx.c
@@ -1,23 +1,14 @@
/*
- * arch/arm/mach-imx/gpio.c
+ * GPIO driver for i.MX machines
*
* author: Sascha Hauer
* Created: april 20th, 2004
* Copyright: Synertronixx GmbH
*
- * Common code for i.MX machines
- *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- *
*/
#include <init.h>
@@ -33,15 +24,15 @@ struct imx_gpio_regs {
};
static struct imx_gpio_regs regs_imx1 = {
- .dr = 0x1c,
- .gdir = 0x00,
- .psr = 0x24,
+ .dr = 0x1c,
+ .gdir = 0x00,
+ .psr = 0x24,
};
static struct imx_gpio_regs regs_imx31 = {
- .dr = 0x00,
- .gdir = 0x04,
- .psr = 0x08,
+ .dr = 0x00,
+ .gdir = 0x04,
+ .psr = 0x08,
};
static int imx_gpio_probe(struct device_d *dev)
@@ -128,15 +119,14 @@ static struct platform_device_id imx_gpio_ids[] = {
};
static struct driver_d imx_gpio_driver = {
- .name = "imx-gpio",
- .probe = imx_gpio_probe,
- .of_compatible = DRV_OF_COMPAT(imx_gpio_dt_ids),
- .id_table = imx_gpio_ids,
+ .name = "imx-gpio",
+ .probe = imx_gpio_probe,
+ .of_compatible = DRV_OF_COMPAT(imx_gpio_dt_ids),
+ .id_table = imx_gpio_ids,
};
static int imx_gpio_add(void)
{
- platform_driver_register(&imx_gpio_driver);
- return 0;
+ return platform_driver_register(&imx_gpio_driver);
}
coredevice_initcall(imx_gpio_add);
--
1.8.1.5
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 5/5] Introduce coredevice_platform_driver() macro and use it for GPIO drivers
2013-04-20 4:18 [PATCH 1/5] GPIO: Rename "drivers/gpio.c" to "drivers/gpiolib.c" Alexander Shiyan
` (3 preceding siblings ...)
2013-04-20 4:18 ` [PATCH 4/5] GPIO: i.MX: Cleanup driver code Alexander Shiyan
@ 2013-04-20 4:18 ` Alexander Shiyan
2013-04-22 16:59 ` [PATCH 1/5] GPIO: Rename "drivers/gpio.c" to "drivers/gpiolib.c" Sascha Hauer
5 siblings, 0 replies; 13+ messages in thread
From: Alexander Shiyan @ 2013-04-20 4:18 UTC (permalink / raw)
To: barebox
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
drivers/gpio/gpio-bcm2835.c | 7 +------
drivers/gpio/gpio-clps711x.c | 7 +------
drivers/gpio/gpio-generic.c | 8 +-------
drivers/gpio/gpio-imx.c | 7 +------
drivers/gpio/gpio-stmpe.c | 7 +------
include/driver.h | 6 ++++--
6 files changed, 9 insertions(+), 33 deletions(-)
diff --git a/drivers/gpio/gpio-bcm2835.c b/drivers/gpio/gpio-bcm2835.c
index cec15c9..9df8a1a 100644
--- a/drivers/gpio/gpio-bcm2835.c
+++ b/drivers/gpio/gpio-bcm2835.c
@@ -150,9 +150,4 @@ static struct driver_d bcm2835_gpio_driver = {
.probe = bcm2835_gpio_probe,
.of_compatible = DRV_OF_COMPAT(bcm2835_gpio_dt_ids),
};
-
-static int bcm2835_gpio_add(void)
-{
- return platform_driver_register(&bcm2835_gpio_driver);
-}
-coredevice_initcall(bcm2835_gpio_add);
+coredevice_platform_driver(bcm2835_gpio_driver);
diff --git a/drivers/gpio/gpio-clps711x.c b/drivers/gpio/gpio-clps711x.c
index feead51..778a8d1 100644
--- a/drivers/gpio/gpio-clps711x.c
+++ b/drivers/gpio/gpio-clps711x.c
@@ -62,9 +62,4 @@ static struct driver_d clps711x_gpio_driver = {
.name = "clps711x-gpio",
.probe = clps711x_gpio_probe,
};
-
-static __init int clps711x_gpio_register(void)
-{
- return platform_driver_register(&clps711x_gpio_driver);
-}
-coredevice_initcall(clps711x_gpio_register);
+coredevice_platform_driver(clps711x_gpio_driver);
diff --git a/drivers/gpio/gpio-generic.c b/drivers/gpio/gpio-generic.c
index a2fc400..0f49712 100644
--- a/drivers/gpio/gpio-generic.c
+++ b/drivers/gpio/gpio-generic.c
@@ -414,13 +414,7 @@ static struct driver_d bgpio_driver = {
.probe = bgpio_dev_probe,
.remove = bgpio_dev_remove,
};
-
-static int bgpio_register(void)
-{
- return platform_driver_register(&bgpio_driver);
-}
-coredevice_initcall(bgpio_register);
-
+coredevice_platform_driver(bgpio_driver);
#endif
MODULE_DESCRIPTION("Driver for basic memory-mapped GPIO controllers");
diff --git a/drivers/gpio/gpio-imx.c b/drivers/gpio/gpio-imx.c
index f56346b..17261e4 100644
--- a/drivers/gpio/gpio-imx.c
+++ b/drivers/gpio/gpio-imx.c
@@ -124,9 +124,4 @@ static struct driver_d imx_gpio_driver = {
.of_compatible = DRV_OF_COMPAT(imx_gpio_dt_ids),
.id_table = imx_gpio_ids,
};
-
-static int imx_gpio_add(void)
-{
- return platform_driver_register(&imx_gpio_driver);
-}
-coredevice_initcall(imx_gpio_add);
+coredevice_platform_driver(imx_gpio_driver);
diff --git a/drivers/gpio/gpio-stmpe.c b/drivers/gpio/gpio-stmpe.c
index d7e6404..d0319a6 100644
--- a/drivers/gpio/gpio-stmpe.c
+++ b/drivers/gpio/gpio-stmpe.c
@@ -153,9 +153,4 @@ static struct driver_d stmpe_gpio_driver = {
.name = "stmpe-gpio",
.probe = stmpe_gpio_probe,
};
-
-static int stmpe_gpio_add(void)
-{
- return platform_driver_register(&stmpe_gpio_driver);
-}
-coredevice_initcall(stmpe_gpio_add);
+coredevice_platform_driver(stmpe_gpio_driver);
diff --git a/include/driver.h b/include/driver.h
index 716f792..5e8561f 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -406,10 +406,12 @@ int platform_driver_register(struct driver_d *drv);
} \
level##_initcall(drv##_register)
-#define device_platform_driver(drv) \
- register_driver_macro(device,platform,drv)
#define console_platform_driver(drv) \
register_driver_macro(console,platform,drv)
+#define coredevice_platform_driver(drv) \
+ register_driver_macro(coredevice,platform,drv)
+#define device_platform_driver(drv) \
+ register_driver_macro(device,platform,drv)
int platform_device_register(struct device_d *new_device);
--
1.8.1.5
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 4/5] GPIO: i.MX: Cleanup driver code
2013-04-20 4:18 ` [PATCH 4/5] GPIO: i.MX: Cleanup driver code Alexander Shiyan
@ 2013-04-20 17:04 ` Jean-Christophe PLAGNIOL-VILLARD
2013-04-22 16:58 ` Sascha Hauer
1 sibling, 0 replies; 13+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-04-20 17:04 UTC (permalink / raw)
To: Alexander Shiyan; +Cc: barebox
On 08:18 Sat 20 Apr , Alexander Shiyan wrote:
> This patch provides only cleanup for i.MX GPIO driver.
> Indentation, reduced licence text etc.
no please drop it this is just noise on the history when doing blame
>
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> ---
> drivers/gpio/gpio-imx.c | 34 ++++++++++++----------------------
> 1 file changed, 12 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/gpio/gpio-imx.c b/drivers/gpio/gpio-imx.c
> index 9dcabfc..f56346b 100644
> --- a/drivers/gpio/gpio-imx.c
> +++ b/drivers/gpio/gpio-imx.c
> @@ -1,23 +1,14 @@
> /*
> - * arch/arm/mach-imx/gpio.c
> + * GPIO driver for i.MX machines
> *
> * author: Sascha Hauer
> * Created: april 20th, 2004
> * Copyright: Synertronixx GmbH
> *
> - * Common code for i.MX machines
> - *
> * This program is free software; you can redistribute it and/or modify
> * it under the terms of the GNU General Public License as published by
> * the Free Software Foundation; either version 2 of the License, or
> * (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - *
> */
>
> #include <init.h>
> @@ -33,15 +24,15 @@ struct imx_gpio_regs {
> };
>
> static struct imx_gpio_regs regs_imx1 = {
> - .dr = 0x1c,
> - .gdir = 0x00,
> - .psr = 0x24,
> + .dr = 0x1c,
> + .gdir = 0x00,
> + .psr = 0x24,
> };
>
> static struct imx_gpio_regs regs_imx31 = {
> - .dr = 0x00,
> - .gdir = 0x04,
> - .psr = 0x08,
> + .dr = 0x00,
> + .gdir = 0x04,
> + .psr = 0x08,
> };
>
> static int imx_gpio_probe(struct device_d *dev)
> @@ -128,15 +119,14 @@ static struct platform_device_id imx_gpio_ids[] = {
> };
>
> static struct driver_d imx_gpio_driver = {
> - .name = "imx-gpio",
> - .probe = imx_gpio_probe,
> - .of_compatible = DRV_OF_COMPAT(imx_gpio_dt_ids),
> - .id_table = imx_gpio_ids,
> + .name = "imx-gpio",
> + .probe = imx_gpio_probe,
> + .of_compatible = DRV_OF_COMPAT(imx_gpio_dt_ids),
> + .id_table = imx_gpio_ids,
> };
>
> static int imx_gpio_add(void)
> {
> - platform_driver_register(&imx_gpio_driver);
> - return 0;
> + return platform_driver_register(&imx_gpio_driver);
> }
> coredevice_initcall(imx_gpio_add);
> --
> 1.8.1.5
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 3/5] GPIO: i.MX: Rewrite driver for using generic GPIO code
2013-04-20 4:18 ` [PATCH 3/5] GPIO: i.MX: Rewrite driver for using generic GPIO code Alexander Shiyan
@ 2013-04-22 6:46 ` Sascha Hauer
2013-04-22 6:59 ` Re[2]: " Alexander Shiyan
0 siblings, 1 reply; 13+ messages in thread
From: Sascha Hauer @ 2013-04-22 6:46 UTC (permalink / raw)
To: Alexander Shiyan; +Cc: barebox
On Sat, Apr 20, 2013 at 08:18:50AM +0400, Alexander Shiyan wrote:
>
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> ---
> arch/arm/Kconfig | 1 -
> drivers/gpio/Kconfig | 1 +
> drivers/gpio/gpio-imx.c | 125 ++++++++++++------------------------------------
> 3 files changed, 31 insertions(+), 96 deletions(-)
>
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index bb9b47b..5607754 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -72,7 +72,6 @@ config ARCH_HIGHBANK
>
> config ARCH_IMX
> bool "Freescale iMX-based"
> - select GENERIC_GPIO
> select GPIOLIB
> select COMMON_CLK
> select CLKDEV_LOOKUP
> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> index 74a4baa..5ccd35b 100644
> --- a/drivers/gpio/Kconfig
> +++ b/drivers/gpio/Kconfig
> @@ -29,6 +29,7 @@ config GPIO_GENERIC_PLATFORM
>
> config GPIO_IMX
> def_bool ARCH_IMX
> + select GPIO_GENERIC
I'm not convinced by this change. Indeed this makes for smaller
sourcecode, but the binary gets over 1kb bigger. I think this is too
much for no additional gain.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re[2]: [PATCH 3/5] GPIO: i.MX: Rewrite driver for using generic GPIO code
2013-04-22 6:46 ` Sascha Hauer
@ 2013-04-22 6:59 ` Alexander Shiyan
2013-04-22 7:21 ` Sascha Hauer
0 siblings, 1 reply; 13+ messages in thread
From: Alexander Shiyan @ 2013-04-22 6:59 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
> On Sat, Apr 20, 2013 at 08:18:50AM +0400, Alexander Shiyan wrote:
> >
> > Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> > ---
> > arch/arm/Kconfig | 1 -
> > drivers/gpio/Kconfig | 1 +
> > drivers/gpio/gpio-imx.c | 125 ++++++++++++------------------------------------
> > 3 files changed, 31 insertions(+), 96 deletions(-)
> >
> > diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> > index bb9b47b..5607754 100644
> > --- a/arch/arm/Kconfig
> > +++ b/arch/arm/Kconfig
> > @@ -72,7 +72,6 @@ config ARCH_HIGHBANK
> >
> > config ARCH_IMX
> > bool "Freescale iMX-based"
> > - select GENERIC_GPIO
> > select GPIOLIB
> > select COMMON_CLK
> > select CLKDEV_LOOKUP
> > diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> > index 74a4baa..5ccd35b 100644
> > --- a/drivers/gpio/Kconfig
> > +++ b/drivers/gpio/Kconfig
> > @@ -29,6 +29,7 @@ config GPIO_GENERIC_PLATFORM
> >
> > config GPIO_IMX
> > def_bool ARCH_IMX
> > + select GPIO_GENERIC
>
> I'm not convinced by this change. Indeed this makes for smaller
> sourcecode, but the binary gets over 1kb bigger. I think this is too
> much for no additional gain.
The main idea of this change is reuse code if we can have multiple
targets in barebox. Probably, now is too early for this.
---
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 3/5] GPIO: i.MX: Rewrite driver for using generic GPIO code
2013-04-22 6:59 ` Re[2]: " Alexander Shiyan
@ 2013-04-22 7:21 ` Sascha Hauer
2013-04-22 9:23 ` Re[2]: " Alexander Shiyan
0 siblings, 1 reply; 13+ messages in thread
From: Sascha Hauer @ 2013-04-22 7:21 UTC (permalink / raw)
To: Alexander Shiyan; +Cc: barebox
On Mon, Apr 22, 2013 at 10:59:12AM +0400, Alexander Shiyan wrote:
> > On Sat, Apr 20, 2013 at 08:18:50AM +0400, Alexander Shiyan wrote:
> > >
> > > Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> > > ---
> > > arch/arm/Kconfig | 1 -
> > > drivers/gpio/Kconfig | 1 +
> > > drivers/gpio/gpio-imx.c | 125 ++++++++++++------------------------------------
> > > 3 files changed, 31 insertions(+), 96 deletions(-)
> > >
> > > diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> > > index bb9b47b..5607754 100644
> > > --- a/arch/arm/Kconfig
> > > +++ b/arch/arm/Kconfig
> > > @@ -72,7 +72,6 @@ config ARCH_HIGHBANK
> > >
> > > config ARCH_IMX
> > > bool "Freescale iMX-based"
> > > - select GENERIC_GPIO
> > > select GPIOLIB
> > > select COMMON_CLK
> > > select CLKDEV_LOOKUP
> > > diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> > > index 74a4baa..5ccd35b 100644
> > > --- a/drivers/gpio/Kconfig
> > > +++ b/drivers/gpio/Kconfig
> > > @@ -29,6 +29,7 @@ config GPIO_GENERIC_PLATFORM
> > >
> > > config GPIO_IMX
> > > def_bool ARCH_IMX
> > > + select GPIO_GENERIC
> >
> > I'm not convinced by this change. Indeed this makes for smaller
> > sourcecode, but the binary gets over 1kb bigger. I think this is too
> > much for no additional gain.
>
> The main idea of this change is reuse code if we can have multiple
> targets in barebox. Probably, now is too early for this.
Yeah, it may change once multiple gpio drivers are compiled into the
binary.
BTW maybe you can lower the impact of the generic gpio driver by making
the basic-mmio-gpio platform driver optional. It is not used by the i.MX
part.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re[2]: [PATCH 3/5] GPIO: i.MX: Rewrite driver for using generic GPIO code
2013-04-22 7:21 ` Sascha Hauer
@ 2013-04-22 9:23 ` Alexander Shiyan
0 siblings, 0 replies; 13+ messages in thread
From: Alexander Shiyan @ 2013-04-22 9:23 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
> > > On Sat, Apr 20, 2013 at 08:18:50AM +0400, Alexander Shiyan wrote:
> > > >
> > > > Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> > > > ---
> > > > arch/arm/Kconfig | 1 -
> > > > drivers/gpio/Kconfig | 1 +
> > > > drivers/gpio/gpio-imx.c | 125 ++++++++++++------------------------------------
> > > > 3 files changed, 31 insertions(+), 96 deletions(-)
...
> > > > config GPIO_IMX
> > > > def_bool ARCH_IMX
> > > > + select GPIO_GENERIC
> > >
> > > I'm not convinced by this change. Indeed this makes for smaller
> > > sourcecode, but the binary gets over 1kb bigger. I think this is too
> > > much for no additional gain.
> >
> > The main idea of this change is reuse code if we can have multiple
> > targets in barebox. Probably, now is too early for this.
>
> Yeah, it may change once multiple gpio drivers are compiled into the
> binary.
>
> BTW maybe you can lower the impact of the generic gpio driver by making
> the basic-mmio-gpio platform driver optional. It is not used by the i.MX
> part.
"basic-mmio-gpio" driver is a part of generic GPIO but it is already
a separate config symbol GPIO_GENERIC_PLATFORM.
In any case I will think about optimization this code.
---
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 4/5] GPIO: i.MX: Cleanup driver code
2013-04-20 4:18 ` [PATCH 4/5] GPIO: i.MX: Cleanup driver code Alexander Shiyan
2013-04-20 17:04 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2013-04-22 16:58 ` Sascha Hauer
1 sibling, 0 replies; 13+ messages in thread
From: Sascha Hauer @ 2013-04-22 16:58 UTC (permalink / raw)
To: Alexander Shiyan; +Cc: barebox
On Sat, Apr 20, 2013 at 08:18:51AM +0400, Alexander Shiyan wrote:
> This patch provides only cleanup for i.MX GPIO driver.
> Indentation, reduced licence text etc.
>
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> ---
> drivers/gpio/gpio-imx.c | 34 ++++++++++++----------------------
> 1 file changed, 12 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/gpio/gpio-imx.c b/drivers/gpio/gpio-imx.c
> index 9dcabfc..f56346b 100644
> --- a/drivers/gpio/gpio-imx.c
> +++ b/drivers/gpio/gpio-imx.c
> @@ -1,23 +1,14 @@
> /*
> - * arch/arm/mach-imx/gpio.c
> + * GPIO driver for i.MX machines
This hunk is good.
> *
> * author: Sascha Hauer
> * Created: april 20th, 2004
> * Copyright: Synertronixx GmbH
> *
> - * Common code for i.MX machines
> - *
Ok aswell.
> static int imx_gpio_add(void)
> {
> - platform_driver_register(&imx_gpio_driver);
> - return 0;
> + return platform_driver_register(&imx_gpio_driver);
Also fine. Drop the remaining hunks please.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/5] GPIO: Rename "drivers/gpio.c" to "drivers/gpiolib.c"
2013-04-20 4:18 [PATCH 1/5] GPIO: Rename "drivers/gpio.c" to "drivers/gpiolib.c" Alexander Shiyan
` (4 preceding siblings ...)
2013-04-20 4:18 ` [PATCH 5/5] Introduce coredevice_platform_driver() macro and use it for GPIO drivers Alexander Shiyan
@ 2013-04-22 16:59 ` Sascha Hauer
5 siblings, 0 replies; 13+ messages in thread
From: Sascha Hauer @ 2013-04-22 16:59 UTC (permalink / raw)
To: Alexander Shiyan; +Cc: barebox
On Sat, Apr 20, 2013 at 08:18:47AM +0400, Alexander Shiyan wrote:
> Rename "drivers/gpio.c" to "drivers/gpiolib.c".
> Reason is for understand functionality of driver.
>
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Applied 1-3
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2013-04-22 16:59 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-20 4:18 [PATCH 1/5] GPIO: Rename "drivers/gpio.c" to "drivers/gpiolib.c" Alexander Shiyan
2013-04-20 4:18 ` [PATCH] ubimkvol: Typo fix Alexander Shiyan
2013-04-20 4:18 ` [PATCH 2/5] ARM: i.MX: Move GPIO driver to drivers/gpio Alexander Shiyan
2013-04-20 4:18 ` [PATCH 3/5] GPIO: i.MX: Rewrite driver for using generic GPIO code Alexander Shiyan
2013-04-22 6:46 ` Sascha Hauer
2013-04-22 6:59 ` Re[2]: " Alexander Shiyan
2013-04-22 7:21 ` Sascha Hauer
2013-04-22 9:23 ` Re[2]: " Alexander Shiyan
2013-04-20 4:18 ` [PATCH 4/5] GPIO: i.MX: Cleanup driver code Alexander Shiyan
2013-04-20 17:04 ` Jean-Christophe PLAGNIOL-VILLARD
2013-04-22 16:58 ` Sascha Hauer
2013-04-20 4:18 ` [PATCH 5/5] Introduce coredevice_platform_driver() macro and use it for GPIO drivers Alexander Shiyan
2013-04-22 16:59 ` [PATCH 1/5] GPIO: Rename "drivers/gpio.c" to "drivers/gpiolib.c" Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox