linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] ARM: S3C64XX: Fix the memory mapped GPIOs on Cragganmore
@ 2011-12-29  1:23 Mark Brown
  2011-12-29  1:23 ` [PATCH 2/2] ARM: S3C64XX: Support GPIO LEDs " Mark Brown
  2011-12-29  4:00 ` [PATCH 1/2] ARM: S3C64XX: Fix the memory mapped GPIOs " Kukjin Kim
  0 siblings, 2 replies; 7+ messages in thread
From: Mark Brown @ 2011-12-29  1:23 UTC (permalink / raw)
  To: linux-arm-kernel

Rather than letting them get allocated dynamically where we don't know
where they are, and also name the data line resource as gpio-generic
requires that.  Without these changes the GPIOs are useless.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 arch/arm/mach-s3c64xx/include/mach/crag6410.h |    1 +
 arch/arm/mach-s3c64xx/mach-crag6410.c         |    3 ++-
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-s3c64xx/include/mach/crag6410.h b/arch/arm/mach-s3c64xx/include/mach/crag6410.h
index 5d55ab0..4cb2f951 100644
--- a/arch/arm/mach-s3c64xx/include/mach/crag6410.h
+++ b/arch/arm/mach-s3c64xx/include/mach/crag6410.h
@@ -21,5 +21,6 @@
 #define CODEC_GPIO_BASE			(GPIO_BOARD_START + 8)
 #define GLENFARCLAS_PMIC_GPIO_BASE	(GPIO_BOARD_START + 32)
 #define BANFF_PMIC_GPIO_BASE		(GPIO_BOARD_START + 64)
+#define MMGPIO_GPIO_BASE		(GPIO_BOARD_START + 96)
 
 #endif
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c
index 2e699b9..d0308f0 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
@@ -261,6 +261,7 @@ static struct platform_device crag6410_dm9k_device = {
 
 static struct resource crag6410_mmgpio_resource[] = {
 	[0] = {
+		.name	= "dat",
 		.start	= S3C64XX_PA_XM0CSN4 + 1,
 		.end	= S3C64XX_PA_XM0CSN4 + 1,
 		.flags	= IORESOURCE_MEM,
@@ -273,7 +274,7 @@ static struct platform_device crag6410_mmgpio = {
 	.resource	= crag6410_mmgpio_resource,
 	.num_resources	= ARRAY_SIZE(crag6410_mmgpio_resource),
 	.dev.platform_data = &(struct bgpio_pdata) {
-		.base	= -1,
+		.base	= MMGPIO_GPIO_BASE,
 	},
 };
 
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] ARM: S3C64XX: Support GPIO LEDs on Cragganmore
  2011-12-29  1:23 [PATCH 1/2] ARM: S3C64XX: Fix the memory mapped GPIOs on Cragganmore Mark Brown
@ 2011-12-29  1:23 ` Mark Brown
  2011-12-29  4:01   ` Kukjin Kim
  2011-12-29  4:00 ` [PATCH 1/2] ARM: S3C64XX: Fix the memory mapped GPIOs " Kukjin Kim
  1 sibling, 1 reply; 7+ messages in thread
From: Mark Brown @ 2011-12-29  1:23 UTC (permalink / raw)
  To: linux-arm-kernel

Cragganmore has a bank of 8 LEDs connected to the memory mapped GPIO
bank, mostly intended for low level diagnostics. Register these with
the LED subsystem for runtime use.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 arch/arm/mach-s3c64xx/Kconfig         |    1 +
 arch/arm/mach-s3c64xx/mach-crag6410.c |   51 +++++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-s3c64xx/Kconfig b/arch/arm/mach-s3c64xx/Kconfig
index dd20c66..dc45123 100644
--- a/arch/arm/mach-s3c64xx/Kconfig
+++ b/arch/arm/mach-s3c64xx/Kconfig
@@ -296,5 +296,6 @@ config MACH_WLF_CRAGG_6410
 	select S3C64XX_DEV_SPI0
 	select SAMSUNG_GPIO_EXTRA128
 	select I2C
+	select LEDS_GPIO_REGISTER
 	help
 	  Machine support for the Wolfson Cragganmore S3C6410 variant.
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c
index d0308f0..139d16e 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
@@ -19,6 +19,7 @@
 #include <linux/io.h>
 #include <linux/init.h>
 #include <linux/gpio.h>
+#include <linux/leds.h>
 #include <linux/delay.h>
 #include <linux/mmc/host.h>
 #include <linux/regulator/machine.h>
@@ -710,6 +711,54 @@ static struct s3c_sdhci_platdata crag6410_hsmmc0_pdata = {
 	.host_caps		= MMC_CAP_POWER_OFF_CARD,
 };
 
+static const struct gpio_led gpio_leds[] = {
+	{
+		.name = "d13:green:",
+		.gpio = MMGPIO_GPIO_BASE + 0,
+		.default_state = LEDS_GPIO_DEFSTATE_ON,
+	},
+	{
+		.name = "d14:green:",
+		.gpio = MMGPIO_GPIO_BASE + 1,
+		.default_state = LEDS_GPIO_DEFSTATE_ON,
+	},
+	{
+		.name = "d15:green:",
+		.gpio = MMGPIO_GPIO_BASE + 2,
+		.default_state = LEDS_GPIO_DEFSTATE_ON,
+	},
+	{
+		.name = "d16:green:",
+		.gpio = MMGPIO_GPIO_BASE + 3,
+		.default_state = LEDS_GPIO_DEFSTATE_ON,
+	},
+	{
+		.name = "d17:green:",
+		.gpio = MMGPIO_GPIO_BASE + 4,
+		.default_state = LEDS_GPIO_DEFSTATE_ON,
+	},
+	{
+		.name = "d18:green:",
+		.gpio = MMGPIO_GPIO_BASE + 5,
+		.default_state = LEDS_GPIO_DEFSTATE_ON,
+	},
+	{
+		.name = "d19:green:",
+		.gpio = MMGPIO_GPIO_BASE + 6,
+		.default_state = LEDS_GPIO_DEFSTATE_ON,
+	},
+	{
+		.name = "d20:green:",
+		.gpio = MMGPIO_GPIO_BASE + 7,
+		.default_state = LEDS_GPIO_DEFSTATE_ON,
+	},
+};
+
+static const struct gpio_led_platform_data gpio_leds_pdata = {
+	.leds = gpio_leds,
+	.num_leds = ARRAY_SIZE(gpio_leds),
+};
+
 static void __init crag6410_machine_init(void)
 {
 	/* Open drain IRQs need pullups */
@@ -743,6 +792,8 @@ static void __init crag6410_machine_init(void)
 
 	platform_add_devices(crag6410_devices, ARRAY_SIZE(crag6410_devices));
 
+	gpio_led_register_device(-1, &gpio_leds_pdata);
+
 	regulator_has_full_constraints();
 
 	s3c64xx_pm_init();
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 1/2] ARM: S3C64XX: Fix the memory mapped GPIOs on Cragganmore
  2011-12-29  1:23 [PATCH 1/2] ARM: S3C64XX: Fix the memory mapped GPIOs on Cragganmore Mark Brown
  2011-12-29  1:23 ` [PATCH 2/2] ARM: S3C64XX: Support GPIO LEDs " Mark Brown
@ 2011-12-29  4:00 ` Kukjin Kim
  2011-12-29 10:34   ` Mark Brown
  1 sibling, 1 reply; 7+ messages in thread
From: Kukjin Kim @ 2011-12-29  4:00 UTC (permalink / raw)
  To: linux-arm-kernel

Mark Brown wrote:
> 
> Rather than letting them get allocated dynamically where we don't know
> where they are, and also name the data line resource as gpio-generic
> requires that.  Without these changes the GPIOs are useless.
> 
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
> ---
>  arch/arm/mach-s3c64xx/include/mach/crag6410.h |    1 +
>  arch/arm/mach-s3c64xx/mach-crag6410.c         |    3 ++-
>  2 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/arm/mach-s3c64xx/include/mach/crag6410.h
> b/arch/arm/mach-s3c64xx/include/mach/crag6410.h
> index 5d55ab0..4cb2f951 100644
> --- a/arch/arm/mach-s3c64xx/include/mach/crag6410.h
> +++ b/arch/arm/mach-s3c64xx/include/mach/crag6410.h
> @@ -21,5 +21,6 @@
>  #define CODEC_GPIO_BASE			(GPIO_BOARD_START + 8)
>  #define GLENFARCLAS_PMIC_GPIO_BASE	(GPIO_BOARD_START + 32)
>  #define BANFF_PMIC_GPIO_BASE		(GPIO_BOARD_START + 64)
> +#define MMGPIO_GPIO_BASE		(GPIO_BOARD_START + 96)
> 
>  #endif
> diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-
> s3c64xx/mach-crag6410.c
> index 2e699b9..d0308f0 100644
> --- a/arch/arm/mach-s3c64xx/mach-crag6410.c
> +++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
> @@ -261,6 +261,7 @@ static struct platform_device crag6410_dm9k_device = {
> 
>  static struct resource crag6410_mmgpio_resource[] = {
>  	[0] = {
> +		.name	= "dat",
>  		.start	= S3C64XX_PA_XM0CSN4 + 1,
>  		.end	= S3C64XX_PA_XM0CSN4 + 1,
>  		.flags	= IORESOURCE_MEM,
> @@ -273,7 +274,7 @@ static struct platform_device crag6410_mmgpio = {
>  	.resource	= crag6410_mmgpio_resource,
>  	.num_resources	= ARRAY_SIZE(crag6410_mmgpio_resource),
>  	.dev.platform_data = &(struct bgpio_pdata) {
> -		.base	= -1,
> +		.base	= MMGPIO_GPIO_BASE,
>  	},
>  };
> 
> --
> 1.7.7.3

Looks ok to me, will apply.

And Mark, how about using DEFINE_RES_XXX() like following?

---
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c
b/arch/arm/mach-s3c64xx/mach-crag6410.c
index d04b654..2dadf92 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
@@ -17,6 +17,8 @@
 #include <linux/platform_device.h>
 #include <linux/fb.h>
 #include <linux/io.h>
+#include <linux/ioport.h>
+
 #include <linux/init.h>
 #include <linux/gpio.h>
 #include <linux/delay.h>
@@ -225,21 +227,9 @@ static struct platform_device crag6410_gpio_keydev = {
 };
 
 static struct resource crag6410_dm9k_resource[] = {
-	[0] = {
-		.start	= S3C64XX_PA_XM0CSN5,
-		.end	= S3C64XX_PA_XM0CSN5 + 1,
-		.flags	= IORESOURCE_MEM,
-	},
-	[1] = {
-		.start	= S3C64XX_PA_XM0CSN5 + (1 << 8),
-		.end	= S3C64XX_PA_XM0CSN5 + (1 << 8) + 1,
-		.flags	= IORESOURCE_MEM,
-	},
-	[2] = {
-		.start	= S3C_EINT(17),
-		.end	= S3C_EINT(17),
-		.flags	= IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
-	},
+	[0] = DEFINE_RES_MEM(S3C64XX_PA_XM0CSN5, 2),
+	[1] = DEFINE_RES_MEM(S3C64XX_PA_XM0CSN5 + (1 << 8), 2),
+	[2] = DEFINE_RES_NAMED(S3C_EINT(17), 1, NULL, IORESOURCE_IRQ |
IRQRESOURCE_IRQ_HIGHLEVEL),
 };
 
 static struct dm9000_plat_data mini6410_dm9k_pdata = {
@@ -255,11 +245,7 @@ static struct platform_device crag6410_dm9k_device = {
 };
 
 static struct resource crag6410_mmgpio_resource[] = {
-	[0] = {
-		.start	= S3C64XX_PA_XM0CSN4 + 1,
-		.end	= S3C64XX_PA_XM0CSN4 + 1,
-		.flags	= IORESOURCE_MEM,
-	},
+	[0] = DEFINE_RES_MEM(S3C64XX_PA_XM0CSN4, 2),
 };
 
 static struct platform_device crag6410_mmgpio = {
---

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] ARM: S3C64XX: Support GPIO LEDs on Cragganmore
  2011-12-29  1:23 ` [PATCH 2/2] ARM: S3C64XX: Support GPIO LEDs " Mark Brown
@ 2011-12-29  4:01   ` Kukjin Kim
  0 siblings, 0 replies; 7+ messages in thread
From: Kukjin Kim @ 2011-12-29  4:01 UTC (permalink / raw)
  To: linux-arm-kernel

Mark Brown wrote:
> 
> Cragganmore has a bank of 8 LEDs connected to the memory mapped GPIO
> bank, mostly intended for low level diagnostics. Register these with
> the LED subsystem for runtime use.
> 
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
> ---
>  arch/arm/mach-s3c64xx/Kconfig         |    1 +
>  arch/arm/mach-s3c64xx/mach-crag6410.c |   51
> +++++++++++++++++++++++++++++++++
>  2 files changed, 52 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mach-s3c64xx/Kconfig b/arch/arm/mach-s3c64xx/Kconfig
> index dd20c66..dc45123 100644
> --- a/arch/arm/mach-s3c64xx/Kconfig
> +++ b/arch/arm/mach-s3c64xx/Kconfig
> @@ -296,5 +296,6 @@ config MACH_WLF_CRAGG_6410
>  	select S3C64XX_DEV_SPI0
>  	select SAMSUNG_GPIO_EXTRA128
>  	select I2C
> +	select LEDS_GPIO_REGISTER
>  	help
>  	  Machine support for the Wolfson Cragganmore S3C6410 variant.
> diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-
> s3c64xx/mach-crag6410.c
> index d0308f0..139d16e 100644
> --- a/arch/arm/mach-s3c64xx/mach-crag6410.c
> +++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
> @@ -19,6 +19,7 @@
>  #include <linux/io.h>
>  #include <linux/init.h>
>  #include <linux/gpio.h>
> +#include <linux/leds.h>
>  #include <linux/delay.h>
>  #include <linux/mmc/host.h>
>  #include <linux/regulator/machine.h>
> @@ -710,6 +711,54 @@ static struct s3c_sdhci_platdata
> crag6410_hsmmc0_pdata = {
>  	.host_caps		= MMC_CAP_POWER_OFF_CARD,
>  };
> 
> +static const struct gpio_led gpio_leds[] = {
> +	{
> +		.name = "d13:green:",
> +		.gpio = MMGPIO_GPIO_BASE + 0,
> +		.default_state = LEDS_GPIO_DEFSTATE_ON,
> +	},
> +	{
> +		.name = "d14:green:",
> +		.gpio = MMGPIO_GPIO_BASE + 1,
> +		.default_state = LEDS_GPIO_DEFSTATE_ON,
> +	},
> +	{
> +		.name = "d15:green:",
> +		.gpio = MMGPIO_GPIO_BASE + 2,
> +		.default_state = LEDS_GPIO_DEFSTATE_ON,
> +	},
> +	{
> +		.name = "d16:green:",
> +		.gpio = MMGPIO_GPIO_BASE + 3,
> +		.default_state = LEDS_GPIO_DEFSTATE_ON,
> +	},
> +	{
> +		.name = "d17:green:",
> +		.gpio = MMGPIO_GPIO_BASE + 4,
> +		.default_state = LEDS_GPIO_DEFSTATE_ON,
> +	},
> +	{
> +		.name = "d18:green:",
> +		.gpio = MMGPIO_GPIO_BASE + 5,
> +		.default_state = LEDS_GPIO_DEFSTATE_ON,
> +	},
> +	{
> +		.name = "d19:green:",
> +		.gpio = MMGPIO_GPIO_BASE + 6,
> +		.default_state = LEDS_GPIO_DEFSTATE_ON,
> +	},
> +	{
> +		.name = "d20:green:",
> +		.gpio = MMGPIO_GPIO_BASE + 7,
> +		.default_state = LEDS_GPIO_DEFSTATE_ON,
> +	},
> +};
> +
> +static const struct gpio_led_platform_data gpio_leds_pdata = {
> +	.leds = gpio_leds,
> +	.num_leds = ARRAY_SIZE(gpio_leds),
> +};
> +
>  static void __init crag6410_machine_init(void)
>  {
>  	/* Open drain IRQs need pullups */
> @@ -743,6 +792,8 @@ static void __init crag6410_machine_init(void)
> 
>  	platform_add_devices(crag6410_devices,
> ARRAY_SIZE(crag6410_devices));
> 
> +	gpio_led_register_device(-1, &gpio_leds_pdata);
> +
>  	regulator_has_full_constraints();
> 
>  	s3c64xx_pm_init();
> --
> 1.7.7.3

OK, will apply.
Thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] ARM: S3C64XX: Fix the memory mapped GPIOs on Cragganmore
  2011-12-29  4:00 ` [PATCH 1/2] ARM: S3C64XX: Fix the memory mapped GPIOs " Kukjin Kim
@ 2011-12-29 10:34   ` Mark Brown
  2011-12-30  2:00     ` Kukjin Kim
  0 siblings, 1 reply; 7+ messages in thread
From: Mark Brown @ 2011-12-29 10:34 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Dec 29, 2011 at 01:00:04PM +0900, Kukjin Kim wrote:

> And Mark, how about using DEFINE_RES_XXX() like following?

That's fine, though the mmgpio one does need to have the name added.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] ARM: S3C64XX: Fix the memory mapped GPIOs on Cragganmore
  2011-12-29 10:34   ` Mark Brown
@ 2011-12-30  2:00     ` Kukjin Kim
  2011-12-30  2:03       ` Mark Brown
  0 siblings, 1 reply; 7+ messages in thread
From: Kukjin Kim @ 2011-12-30  2:00 UTC (permalink / raw)
  To: linux-arm-kernel

Mark Brown wrote:
> 
> On Thu, Dec 29, 2011 at 01:00:04PM +0900, Kukjin Kim wrote:
> 
> > And Mark, how about using DEFINE_RES_XXX() like following?
> 
> That's fine, though the mmgpio one does need to have the name added.

Yeah, it's  a little bit...so I'm sorting it out with others for next time
:)

Happy New Year!!!
Thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] ARM: S3C64XX: Fix the memory mapped GPIOs on Cragganmore
  2011-12-30  2:00     ` Kukjin Kim
@ 2011-12-30  2:03       ` Mark Brown
  0 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2011-12-30  2:03 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Dec 30, 2011 at 11:00:17AM +0900, Kukjin Kim wrote:

> Yeah, it's  a little bit...so I'm sorting it out with others for next time
> :)

If you leave it for long enough I'll probably get round to doing it
myself.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-12-30  2:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-29  1:23 [PATCH 1/2] ARM: S3C64XX: Fix the memory mapped GPIOs on Cragganmore Mark Brown
2011-12-29  1:23 ` [PATCH 2/2] ARM: S3C64XX: Support GPIO LEDs " Mark Brown
2011-12-29  4:01   ` Kukjin Kim
2011-12-29  4:00 ` [PATCH 1/2] ARM: S3C64XX: Fix the memory mapped GPIOs " Kukjin Kim
2011-12-29 10:34   ` Mark Brown
2011-12-30  2:00     ` Kukjin Kim
2011-12-30  2:03       ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).