All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/10] ARM: s3c64xx multiplatform, help needed
@ 2015-03-02 12:35 ` Arnd Bergmann
  0 siblings, 0 replies; 60+ messages in thread
From: Arnd Bergmann @ 2015-03-02 12:35 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Kukjin Kim, linux-samsung-soc, Maurus Cuelenaere, Mark Brown,
	Liam Girdwood, dmitry.torokhov, ch.naveen, a.kesavan, cw00.choi,
	jic23, Tomasz Figa, padma.v, Arnd Bergmann

Hi everyone,

I've had these patches in a private git tree for a while, and have
finally gotten around to clean them up some more for submission.
Hopefully we can get all of it merged into 4.1.

I've done this to the best of my knowledge, but some parts are
a bit tricky, so I expect that there are bugs. The trickiest
part is the touchscreen driver. I've sent it out for review
last year already, but I have not found anybody who could test
it, and it's basically a blind rewrite of an existing driver,
so it's unlikely that I got it all right.

The other parts may actually work, but it is possible that
I made a mistake with the ASoC driver, the sparseirq support
or something else.

Does anyone still have access to the hardware? I'm particularly
interested in seeing this patch set get tested on smartq
and on smdk6410, which have the majority of the hardware.

Arnd Bergmann (10):
  Input: s3c2410_ts: fix S3C_ADC dependency
  ASoC: samsung/smartq: use dynamic registration
  gpio: samsung: move gpio-samsung driver back to platform code
  ARM: s3c64xx: prepare initcalls for multiplatform
  ARM: s3c64xx: enable sparse IRQ support
  iio: exynos-adc: add experimental touchscreen support
  ARM: s3c64xx: use new adc/touchscreen driver
  ARM: s3c64xx: use common debug-ll implementation
  ARM: s3c64xx: multiplatform support
  ARM: s3c64xx: allow building without board support

 .../devicetree/bindings/arm/samsung/exynos-adc.txt |   3 +
 arch/arm/Kconfig                                   |  26 ---
 arch/arm/Kconfig.debug                             |  19 +-
 arch/arm/configs/multi_v7_defconfig                |   3 +
 arch/arm/configs/s3c6400_defconfig                 |   2 +
 arch/arm/mach-s3c64xx/Kconfig                      |  31 ++-
 arch/arm/mach-s3c64xx/Makefile                     |  23 ++-
 arch/arm/mach-s3c64xx/common.c                     |   5 +-
 arch/arm/mach-s3c64xx/cpuidle.c                    |   5 +-
 arch/arm/mach-s3c64xx/dev-uart.c                   |   1 +
 arch/arm/mach-s3c64xx/include/mach/debug-macro.S   |  38 ----
 arch/arm/mach-s3c64xx/include/mach/gpio-samsung.h  |   3 +
 arch/arm/mach-s3c64xx/include/mach/irqs.h          |  20 +-
 arch/arm/mach-s3c64xx/include/mach/pm-core.h       |   1 +
 arch/arm/mach-s3c64xx/irq-pm.c                     |   2 +-
 arch/arm/mach-s3c64xx/mach-anw6410.c               |   3 +-
 arch/arm/mach-s3c64xx/mach-crag6410-module.c       |   6 +
 arch/arm/mach-s3c64xx/mach-crag6410.c              |   2 +
 arch/arm/mach-s3c64xx/mach-hmt.c                   |   2 +
 arch/arm/mach-s3c64xx/mach-mini6410.c              |   5 +-
 arch/arm/mach-s3c64xx/mach-ncp.c                   |   2 +
 arch/arm/mach-s3c64xx/mach-real6410.c              |   6 +-
 arch/arm/mach-s3c64xx/mach-smartq.c                |  16 +-
 arch/arm/mach-s3c64xx/mach-smartq5.c               |   2 +
 arch/arm/mach-s3c64xx/mach-smartq7.c               |   2 +
 arch/arm/mach-s3c64xx/mach-smdk6400.c              |   3 +-
 arch/arm/mach-s3c64xx/mach-smdk6410.c              |   6 +-
 arch/arm/mach-s3c64xx/pl080.c                      |   4 +
 arch/arm/mach-s3c64xx/pm.c                         |   4 +
 arch/arm/mach-s3c64xx/s3c6400.c                    |   2 +-
 arch/arm/mach-s3c64xx/s3c6410.c                    |   2 +-
 arch/arm/plat-samsung/Kconfig                      |   5 +-
 arch/arm/plat-samsung/Makefile                     |   5 +-
 arch/arm/plat-samsung/devs.c                       |  22 +-
 .../gpio => arch/arm/plat-samsung}/gpio-samsung.c  |  12 +-
 arch/arm/plat-samsung/init.c                       |   5 +
 arch/arm/plat-samsung/pm.c                         |   4 -
 drivers/gpio/Kconfig                               |   7 -
 drivers/gpio/Makefile                              |   1 -
 drivers/iio/adc/exynos_adc.c                       | 222 ++++++++++++++++++++-
 drivers/input/touchscreen/Kconfig                  |   2 +-
 include/linux/platform_data/touchscreen-s3c2410.h  |   1 +
 sound/soc/samsung/smartq_wm8987.c                  |  77 +++----
 43 files changed, 408 insertions(+), 204 deletions(-)
 delete mode 100644 arch/arm/mach-s3c64xx/include/mach/debug-macro.S
 rename {drivers/gpio => arch/arm/plat-samsung}/gpio-samsung.c (99%)

-- 
2.1.0.rc2

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

* [PATCH 00/10] ARM: s3c64xx multiplatform, help needed
@ 2015-03-02 12:35 ` Arnd Bergmann
  0 siblings, 0 replies; 60+ messages in thread
From: Arnd Bergmann @ 2015-03-02 12:35 UTC (permalink / raw)
  To: linux-arm-kernel

Hi everyone,

I've had these patches in a private git tree for a while, and have
finally gotten around to clean them up some more for submission.
Hopefully we can get all of it merged into 4.1.

I've done this to the best of my knowledge, but some parts are
a bit tricky, so I expect that there are bugs. The trickiest
part is the touchscreen driver. I've sent it out for review
last year already, but I have not found anybody who could test
it, and it's basically a blind rewrite of an existing driver,
so it's unlikely that I got it all right.

The other parts may actually work, but it is possible that
I made a mistake with the ASoC driver, the sparseirq support
or something else.

Does anyone still have access to the hardware? I'm particularly
interested in seeing this patch set get tested on smartq
and on smdk6410, which have the majority of the hardware.

Arnd Bergmann (10):
  Input: s3c2410_ts: fix S3C_ADC dependency
  ASoC: samsung/smartq: use dynamic registration
  gpio: samsung: move gpio-samsung driver back to platform code
  ARM: s3c64xx: prepare initcalls for multiplatform
  ARM: s3c64xx: enable sparse IRQ support
  iio: exynos-adc: add experimental touchscreen support
  ARM: s3c64xx: use new adc/touchscreen driver
  ARM: s3c64xx: use common debug-ll implementation
  ARM: s3c64xx: multiplatform support
  ARM: s3c64xx: allow building without board support

 .../devicetree/bindings/arm/samsung/exynos-adc.txt |   3 +
 arch/arm/Kconfig                                   |  26 ---
 arch/arm/Kconfig.debug                             |  19 +-
 arch/arm/configs/multi_v7_defconfig                |   3 +
 arch/arm/configs/s3c6400_defconfig                 |   2 +
 arch/arm/mach-s3c64xx/Kconfig                      |  31 ++-
 arch/arm/mach-s3c64xx/Makefile                     |  23 ++-
 arch/arm/mach-s3c64xx/common.c                     |   5 +-
 arch/arm/mach-s3c64xx/cpuidle.c                    |   5 +-
 arch/arm/mach-s3c64xx/dev-uart.c                   |   1 +
 arch/arm/mach-s3c64xx/include/mach/debug-macro.S   |  38 ----
 arch/arm/mach-s3c64xx/include/mach/gpio-samsung.h  |   3 +
 arch/arm/mach-s3c64xx/include/mach/irqs.h          |  20 +-
 arch/arm/mach-s3c64xx/include/mach/pm-core.h       |   1 +
 arch/arm/mach-s3c64xx/irq-pm.c                     |   2 +-
 arch/arm/mach-s3c64xx/mach-anw6410.c               |   3 +-
 arch/arm/mach-s3c64xx/mach-crag6410-module.c       |   6 +
 arch/arm/mach-s3c64xx/mach-crag6410.c              |   2 +
 arch/arm/mach-s3c64xx/mach-hmt.c                   |   2 +
 arch/arm/mach-s3c64xx/mach-mini6410.c              |   5 +-
 arch/arm/mach-s3c64xx/mach-ncp.c                   |   2 +
 arch/arm/mach-s3c64xx/mach-real6410.c              |   6 +-
 arch/arm/mach-s3c64xx/mach-smartq.c                |  16 +-
 arch/arm/mach-s3c64xx/mach-smartq5.c               |   2 +
 arch/arm/mach-s3c64xx/mach-smartq7.c               |   2 +
 arch/arm/mach-s3c64xx/mach-smdk6400.c              |   3 +-
 arch/arm/mach-s3c64xx/mach-smdk6410.c              |   6 +-
 arch/arm/mach-s3c64xx/pl080.c                      |   4 +
 arch/arm/mach-s3c64xx/pm.c                         |   4 +
 arch/arm/mach-s3c64xx/s3c6400.c                    |   2 +-
 arch/arm/mach-s3c64xx/s3c6410.c                    |   2 +-
 arch/arm/plat-samsung/Kconfig                      |   5 +-
 arch/arm/plat-samsung/Makefile                     |   5 +-
 arch/arm/plat-samsung/devs.c                       |  22 +-
 .../gpio => arch/arm/plat-samsung}/gpio-samsung.c  |  12 +-
 arch/arm/plat-samsung/init.c                       |   5 +
 arch/arm/plat-samsung/pm.c                         |   4 -
 drivers/gpio/Kconfig                               |   7 -
 drivers/gpio/Makefile                              |   1 -
 drivers/iio/adc/exynos_adc.c                       | 222 ++++++++++++++++++++-
 drivers/input/touchscreen/Kconfig                  |   2 +-
 include/linux/platform_data/touchscreen-s3c2410.h  |   1 +
 sound/soc/samsung/smartq_wm8987.c                  |  77 +++----
 43 files changed, 408 insertions(+), 204 deletions(-)
 delete mode 100644 arch/arm/mach-s3c64xx/include/mach/debug-macro.S
 rename {drivers/gpio => arch/arm/plat-samsung}/gpio-samsung.c (99%)

-- 
2.1.0.rc2

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

* [PATCH 01/10] Input: s3c2410_ts: fix S3C_ADC dependency
  2015-03-02 12:35 ` Arnd Bergmann
@ 2015-03-02 12:35   ` Arnd Bergmann
  -1 siblings, 0 replies; 60+ messages in thread
From: Arnd Bergmann @ 2015-03-02 12:35 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Kukjin Kim, linux-samsung-soc, Maurus Cuelenaere, Mark Brown,
	Liam Girdwood, dmitry.torokhov, ch.naveen, a.kesavan, cw00.choi,
	jic23, Tomasz Figa, padma.v, Arnd Bergmann

S3C_ADC is only available on machines that don't do ARCH_MULTIPLATFORM,
so changing the 'select' into 'depends on' here helps us move to
ARCH_MULTIPLATFORM without introducing regressions.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/input/touchscreen/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index 58917525126e..3b4cd9ab1af0 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -326,7 +326,7 @@ config TOUCHSCREEN_ILI210X
 config TOUCHSCREEN_S3C2410
 	tristate "Samsung S3C2410/generic touchscreen input driver"
 	depends on ARCH_S3C24XX || SAMSUNG_DEV_TS
-	select S3C_ADC
+	depends on S3C_ADC
 	help
 	  Say Y here if you have the s3c2410 touchscreen.
 
-- 
2.1.0.rc2

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

* [PATCH 01/10] Input: s3c2410_ts: fix S3C_ADC dependency
@ 2015-03-02 12:35   ` Arnd Bergmann
  0 siblings, 0 replies; 60+ messages in thread
From: Arnd Bergmann @ 2015-03-02 12:35 UTC (permalink / raw)
  To: linux-arm-kernel

S3C_ADC is only available on machines that don't do ARCH_MULTIPLATFORM,
so changing the 'select' into 'depends on' here helps us move to
ARCH_MULTIPLATFORM without introducing regressions.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/input/touchscreen/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index 58917525126e..3b4cd9ab1af0 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -326,7 +326,7 @@ config TOUCHSCREEN_ILI210X
 config TOUCHSCREEN_S3C2410
 	tristate "Samsung S3C2410/generic touchscreen input driver"
 	depends on ARCH_S3C24XX || SAMSUNG_DEV_TS
-	select S3C_ADC
+	depends on S3C_ADC
 	help
 	  Say Y here if you have the s3c2410 touchscreen.
 
-- 
2.1.0.rc2

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

* [PATCH 02/10] ASoC: samsung/smartq: use dynamic registration
  2015-03-02 12:35 ` Arnd Bergmann
@ 2015-03-02 12:35   ` Arnd Bergmann
  -1 siblings, 0 replies; 60+ messages in thread
From: Arnd Bergmann @ 2015-03-02 12:35 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Kukjin Kim, linux-samsung-soc, Maurus Cuelenaere, Mark Brown,
	Liam Girdwood, dmitry.torokhov, ch.naveen, a.kesavan, cw00.choi,
	jic23, Tomasz Figa, padma.v, Arnd Bergmann

As a prerequisite for moving s3c64xx into multiplatform configurations,
we need to change the smartq audio driver to stop using hardcoded
gpio numbers from the header file, and instead pass the gpio data
through platform_data.

In order to do that, we also move the code to use module_platform_driver
and register the platform device using platform_device_register_simple
and register the gpios through the gpiod API.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-s3c64xx/mach-smartq.c | 13 +++++++
 sound/soc/samsung/smartq_wm8987.c   | 77 +++++++++++++------------------------
 2 files changed, 40 insertions(+), 50 deletions(-)

diff --git a/arch/arm/mach-s3c64xx/mach-smartq.c b/arch/arm/mach-s3c64xx/mach-smartq.c
index b3d13537a7f0..327ec1f451e3 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq.c
@@ -12,6 +12,7 @@
 #include <linux/delay.h>
 #include <linux/fb.h>
 #include <linux/gpio.h>
+#include <linux/gpio/machine.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/pwm_backlight.h>
@@ -379,6 +380,15 @@ void __init smartq_map_io(void)
 	smartq_lcd_mode_set();
 }
 
+static struct gpiod_lookup_table smartq_audio_gpios = {
+	.dev_id = "smartq-audio",
+	.table = {
+		GPIO_LOOKUP("GPL", 12, "headphone detect", 0),
+		GPIO_LOOKUP("GPK", 12, "amplifiers shutdown", 0),
+		{ },
+	},
+};
+
 void __init smartq_machine_init(void)
 {
 	s3c_i2c0_set_platdata(NULL);
@@ -397,4 +407,7 @@ void __init smartq_machine_init(void)
 	WARN_ON(smartq_wifi_init());
 
 	platform_add_devices(smartq_devices, ARRAY_SIZE(smartq_devices));
+
+	gpiod_add_lookup_table(&smartq_audio_gpios);
+	platform_device_register_simple("smartq-audio", -1, NULL, 0);
 }
diff --git a/sound/soc/samsung/smartq_wm8987.c b/sound/soc/samsung/smartq_wm8987.c
index 8291d2a5f152..7b6291fb55b9 100644
--- a/sound/soc/samsung/smartq_wm8987.c
+++ b/sound/soc/samsung/smartq_wm8987.c
@@ -13,15 +13,12 @@
  *
  */
 
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
 #include <linux/module.h>
 
 #include <sound/soc.h>
 #include <sound/jack.h>
 
-#include <mach/gpio-samsung.h>
-#include <asm/mach-types.h>
-
 #include "i2s.h"
 #include "../codecs/wm8750.h"
 
@@ -96,7 +93,7 @@ static struct snd_soc_jack_pin smartq_jack_pins[] = {
 
 static struct snd_soc_jack_gpio smartq_jack_gpios[] = {
 	{
-		.gpio		= S3C64XX_GPL(12),
+		.gpio		= -1,
 		.name		= "headphone detect",
 		.report		= SND_JACK_HEADPHONE,
 		.debounce_time	= 200,
@@ -113,7 +110,9 @@ static int smartq_speaker_event(struct snd_soc_dapm_widget *w,
 				struct snd_kcontrol *k,
 				int event)
 {
-	gpio_set_value(S3C64XX_GPK(12), SND_SOC_DAPM_EVENT_OFF(event));
+	struct gpio_desc *gpio = snd_soc_card_get_drvdata(&snd_soc_smartq);
+
+	gpiod_set_value(gpio, SND_SOC_DAPM_EVENT_OFF(event));
 
 	return 0;
 }
@@ -206,62 +205,40 @@ static struct snd_soc_card snd_soc_smartq = {
 	.num_controls = ARRAY_SIZE(wm8987_smartq_controls),
 };
 
-static struct platform_device *smartq_snd_device;
-
-static int __init smartq_init(void)
+static int smartq_probe(struct platform_device *pdev)
 {
+	struct gpio_desc *gpio;
 	int ret;
 
-	if (!machine_is_smartq7() && !machine_is_smartq5()) {
-		pr_info("Only SmartQ is supported by this ASoC driver\n");
-		return -ENODEV;
-	}
-
-	smartq_snd_device = platform_device_alloc("soc-audio", -1);
-	if (!smartq_snd_device)
-		return -ENOMEM;
-
-	platform_set_drvdata(smartq_snd_device, &snd_soc_smartq);
-
-	ret = platform_device_add(smartq_snd_device);
-	if (ret) {
-		platform_device_put(smartq_snd_device);
-		return ret;
-	}
+	platform_set_drvdata(pdev, &snd_soc_smartq);
 
 	/* Initialise GPIOs used by amplifiers */
-	ret = gpio_request(S3C64XX_GPK(12), "amplifiers shutdown");
-	if (ret) {
-		dev_err(&smartq_snd_device->dev, "Failed to register GPK12\n");
-		goto err_unregister_device;
+	gpio = devm_gpiod_get(&pdev->dev, "amplifiers shutdown",
+			      GPIOD_OUT_HIGH);
+	if (IS_ERR(gpio)) {
+		dev_err(&pdev->dev, "Failed to register GPK12\n");
+		ret = PTR_ERR(gpio);
+		goto out;
 	}
+	snd_soc_card_set_drvdata(&snd_soc_smartq, gpio);
 
-	/* Disable amplifiers */
-	ret = gpio_direction_output(S3C64XX_GPK(12), 1);
-	if (ret) {
-		dev_err(&smartq_snd_device->dev, "Failed to configure GPK12\n");
-		goto err_free_gpio_amp_shut;
-	}
-
-	return 0;
-
-err_free_gpio_amp_shut:
-	gpio_free(S3C64XX_GPK(12));
-err_unregister_device:
-	platform_device_unregister(smartq_snd_device);
+	ret = devm_snd_soc_register_card(&pdev->dev, &snd_soc_smartq);
+	if (ret)
+		dev_err(&pdev->dev, "Failed to register card\n");
 
+out:
 	return ret;
 }
 
-static void __exit smartq_exit(void)
-{
-	gpio_free(S3C64XX_GPK(12));
-
-	platform_device_unregister(smartq_snd_device);
-}
+static struct platform_driver smartq_driver = {
+	.driver = {
+		.name = "smartq-audio",
+		.owner = THIS_MODULE,
+	},
+	.probe = smartq_probe,
+};
 
-module_init(smartq_init);
-module_exit(smartq_exit);
+module_platform_driver(smartq_driver);
 
 /* Module information */
 MODULE_AUTHOR("Maurus Cuelenaere <mcuelenaere@gmail.com>");
-- 
2.1.0.rc2

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

* [PATCH 02/10] ASoC: samsung/smartq: use dynamic registration
@ 2015-03-02 12:35   ` Arnd Bergmann
  0 siblings, 0 replies; 60+ messages in thread
From: Arnd Bergmann @ 2015-03-02 12:35 UTC (permalink / raw)
  To: linux-arm-kernel

As a prerequisite for moving s3c64xx into multiplatform configurations,
we need to change the smartq audio driver to stop using hardcoded
gpio numbers from the header file, and instead pass the gpio data
through platform_data.

In order to do that, we also move the code to use module_platform_driver
and register the platform device using platform_device_register_simple
and register the gpios through the gpiod API.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-s3c64xx/mach-smartq.c | 13 +++++++
 sound/soc/samsung/smartq_wm8987.c   | 77 +++++++++++++------------------------
 2 files changed, 40 insertions(+), 50 deletions(-)

diff --git a/arch/arm/mach-s3c64xx/mach-smartq.c b/arch/arm/mach-s3c64xx/mach-smartq.c
index b3d13537a7f0..327ec1f451e3 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq.c
@@ -12,6 +12,7 @@
 #include <linux/delay.h>
 #include <linux/fb.h>
 #include <linux/gpio.h>
+#include <linux/gpio/machine.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/pwm_backlight.h>
@@ -379,6 +380,15 @@ void __init smartq_map_io(void)
 	smartq_lcd_mode_set();
 }
 
+static struct gpiod_lookup_table smartq_audio_gpios = {
+	.dev_id = "smartq-audio",
+	.table = {
+		GPIO_LOOKUP("GPL", 12, "headphone detect", 0),
+		GPIO_LOOKUP("GPK", 12, "amplifiers shutdown", 0),
+		{ },
+	},
+};
+
 void __init smartq_machine_init(void)
 {
 	s3c_i2c0_set_platdata(NULL);
@@ -397,4 +407,7 @@ void __init smartq_machine_init(void)
 	WARN_ON(smartq_wifi_init());
 
 	platform_add_devices(smartq_devices, ARRAY_SIZE(smartq_devices));
+
+	gpiod_add_lookup_table(&smartq_audio_gpios);
+	platform_device_register_simple("smartq-audio", -1, NULL, 0);
 }
diff --git a/sound/soc/samsung/smartq_wm8987.c b/sound/soc/samsung/smartq_wm8987.c
index 8291d2a5f152..7b6291fb55b9 100644
--- a/sound/soc/samsung/smartq_wm8987.c
+++ b/sound/soc/samsung/smartq_wm8987.c
@@ -13,15 +13,12 @@
  *
  */
 
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
 #include <linux/module.h>
 
 #include <sound/soc.h>
 #include <sound/jack.h>
 
-#include <mach/gpio-samsung.h>
-#include <asm/mach-types.h>
-
 #include "i2s.h"
 #include "../codecs/wm8750.h"
 
@@ -96,7 +93,7 @@ static struct snd_soc_jack_pin smartq_jack_pins[] = {
 
 static struct snd_soc_jack_gpio smartq_jack_gpios[] = {
 	{
-		.gpio		= S3C64XX_GPL(12),
+		.gpio		= -1,
 		.name		= "headphone detect",
 		.report		= SND_JACK_HEADPHONE,
 		.debounce_time	= 200,
@@ -113,7 +110,9 @@ static int smartq_speaker_event(struct snd_soc_dapm_widget *w,
 				struct snd_kcontrol *k,
 				int event)
 {
-	gpio_set_value(S3C64XX_GPK(12), SND_SOC_DAPM_EVENT_OFF(event));
+	struct gpio_desc *gpio = snd_soc_card_get_drvdata(&snd_soc_smartq);
+
+	gpiod_set_value(gpio, SND_SOC_DAPM_EVENT_OFF(event));
 
 	return 0;
 }
@@ -206,62 +205,40 @@ static struct snd_soc_card snd_soc_smartq = {
 	.num_controls = ARRAY_SIZE(wm8987_smartq_controls),
 };
 
-static struct platform_device *smartq_snd_device;
-
-static int __init smartq_init(void)
+static int smartq_probe(struct platform_device *pdev)
 {
+	struct gpio_desc *gpio;
 	int ret;
 
-	if (!machine_is_smartq7() && !machine_is_smartq5()) {
-		pr_info("Only SmartQ is supported by this ASoC driver\n");
-		return -ENODEV;
-	}
-
-	smartq_snd_device = platform_device_alloc("soc-audio", -1);
-	if (!smartq_snd_device)
-		return -ENOMEM;
-
-	platform_set_drvdata(smartq_snd_device, &snd_soc_smartq);
-
-	ret = platform_device_add(smartq_snd_device);
-	if (ret) {
-		platform_device_put(smartq_snd_device);
-		return ret;
-	}
+	platform_set_drvdata(pdev, &snd_soc_smartq);
 
 	/* Initialise GPIOs used by amplifiers */
-	ret = gpio_request(S3C64XX_GPK(12), "amplifiers shutdown");
-	if (ret) {
-		dev_err(&smartq_snd_device->dev, "Failed to register GPK12\n");
-		goto err_unregister_device;
+	gpio = devm_gpiod_get(&pdev->dev, "amplifiers shutdown",
+			      GPIOD_OUT_HIGH);
+	if (IS_ERR(gpio)) {
+		dev_err(&pdev->dev, "Failed to register GPK12\n");
+		ret = PTR_ERR(gpio);
+		goto out;
 	}
+	snd_soc_card_set_drvdata(&snd_soc_smartq, gpio);
 
-	/* Disable amplifiers */
-	ret = gpio_direction_output(S3C64XX_GPK(12), 1);
-	if (ret) {
-		dev_err(&smartq_snd_device->dev, "Failed to configure GPK12\n");
-		goto err_free_gpio_amp_shut;
-	}
-
-	return 0;
-
-err_free_gpio_amp_shut:
-	gpio_free(S3C64XX_GPK(12));
-err_unregister_device:
-	platform_device_unregister(smartq_snd_device);
+	ret = devm_snd_soc_register_card(&pdev->dev, &snd_soc_smartq);
+	if (ret)
+		dev_err(&pdev->dev, "Failed to register card\n");
 
+out:
 	return ret;
 }
 
-static void __exit smartq_exit(void)
-{
-	gpio_free(S3C64XX_GPK(12));
-
-	platform_device_unregister(smartq_snd_device);
-}
+static struct platform_driver smartq_driver = {
+	.driver = {
+		.name = "smartq-audio",
+		.owner = THIS_MODULE,
+	},
+	.probe = smartq_probe,
+};
 
-module_init(smartq_init);
-module_exit(smartq_exit);
+module_platform_driver(smartq_driver);
 
 /* Module information */
 MODULE_AUTHOR("Maurus Cuelenaere <mcuelenaere@gmail.com>");
-- 
2.1.0.rc2

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

* [PATCH 03/10] gpio: samsung: move gpio-samsung driver back to platform code
  2015-03-02 12:35 ` Arnd Bergmann
@ 2015-03-02 12:35   ` Arnd Bergmann
  -1 siblings, 0 replies; 60+ messages in thread
From: Arnd Bergmann @ 2015-03-02 12:35 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Kukjin Kim, linux-samsung-soc, Maurus Cuelenaere, Mark Brown,
	Liam Girdwood, dmitry.torokhov, ch.naveen, a.kesavan, cw00.choi,
	jic23, Tomasz Figa, padma.v, Arnd Bergmann

The gpio-samsung driver is special in the sense that it
interacts directly in multiple ways with the legacy platform
code for the s3c24xx and s3c64xx platforms. In contrast,
all devicetree based machines for Samsung, including the
ones on those two SoC families use a different driver.

The header files that define the interface between the platform
code and the gpio driver are not visible when building a
kernel for ARCH_MULTIPLATFORM, which prevents us from
turning on this option for s3c64xx.

To work around this, we now move the driver back into platform
code, from where it was originally moved to as part of commit
1b39d5f2cc5c28 ("gpio/samsung: gpio-samsung.c to support
Samsung GPIOs").

The long-term plan for this driver would be to remove it
entirely, after all Samsung machines have been converted
over to boot from DT, but there is currently no timeline
for when that might happen.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/plat-samsung/Kconfig                          | 3 +++
 arch/arm/plat-samsung/Makefile                         | 2 ++
 {drivers/gpio => arch/arm/plat-samsung}/gpio-samsung.c | 0
 drivers/gpio/Kconfig                                   | 7 -------
 drivers/gpio/Makefile                                  | 1 -
 5 files changed, 5 insertions(+), 8 deletions(-)
 rename {drivers/gpio => arch/arm/plat-samsung}/gpio-samsung.c (100%)

diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index cb8e3d655d1a..1df08180f2a5 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -311,6 +311,9 @@ config SAMSUNG_WDT_RESET
 	  Compile support for system restart by triggering watchdog reset.
 	  Used on SoCs that do not provide dedicated reset control.
 
+config GPIO_SAMSUNG
+	def_bool SAMSUNG_ATAGS
+
 config DEBUG_S3C_UART
 	depends on PLAT_SAMSUNG
 	int
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
index 1a29ab1f446d..7896ddf63974 100644
--- a/arch/arm/plat-samsung/Makefile
+++ b/arch/arm/plat-samsung/Makefile
@@ -26,6 +26,8 @@ obj-$(CONFIG_SAMSUNG_DEV_BACKLIGHT)	+= dev-backlight.o
 
 obj-$(CONFIG_S3C_SETUP_CAMIF)	+= setup-camif.o
 
+obj-$(CONFIG_GPIO_SAMSUNG)     += gpio-samsung.o
+
 # PM support
 
 obj-$(CONFIG_PM_SLEEP)		+= pm-common.o
diff --git a/drivers/gpio/gpio-samsung.c b/arch/arm/plat-samsung/gpio-samsung.c
similarity index 100%
rename from drivers/gpio/gpio-samsung.c
rename to arch/arm/plat-samsung/gpio-samsung.c
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index c1e2ca3d9a51..2ebc124e1217 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -296,13 +296,6 @@ config GPIO_RCAR
 	help
 	  Say yes here to support GPIO on Renesas R-Car SoCs.
 
-config GPIO_SAMSUNG
-	bool
-	depends on PLAT_SAMSUNG
-	help
-	  Legacy GPIO support. Use only for platforms without support for
-	  pinctrl.
-
 config GPIO_SCH311X
 	tristate "SMSC SCH311x SuperI/O GPIO"
 	help
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index bdda6a94d2cd..0e48e5d89d63 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -73,7 +73,6 @@ obj-$(CONFIG_GPIO_PXA)		+= gpio-pxa.o
 obj-$(CONFIG_GPIO_RC5T583)	+= gpio-rc5t583.o
 obj-$(CONFIG_GPIO_RDC321X)	+= gpio-rdc321x.o
 obj-$(CONFIG_GPIO_RCAR)		+= gpio-rcar.o
-obj-$(CONFIG_GPIO_SAMSUNG)	+= gpio-samsung.o
 obj-$(CONFIG_ARCH_SA1100)	+= gpio-sa1100.o
 obj-$(CONFIG_GPIO_SCH)		+= gpio-sch.o
 obj-$(CONFIG_GPIO_SCH311X)	+= gpio-sch311x.o
-- 
2.1.0.rc2

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

* [PATCH 03/10] gpio: samsung: move gpio-samsung driver back to platform code
@ 2015-03-02 12:35   ` Arnd Bergmann
  0 siblings, 0 replies; 60+ messages in thread
From: Arnd Bergmann @ 2015-03-02 12:35 UTC (permalink / raw)
  To: linux-arm-kernel

The gpio-samsung driver is special in the sense that it
interacts directly in multiple ways with the legacy platform
code for the s3c24xx and s3c64xx platforms. In contrast,
all devicetree based machines for Samsung, including the
ones on those two SoC families use a different driver.

The header files that define the interface between the platform
code and the gpio driver are not visible when building a
kernel for ARCH_MULTIPLATFORM, which prevents us from
turning on this option for s3c64xx.

To work around this, we now move the driver back into platform
code, from where it was originally moved to as part of commit
1b39d5f2cc5c28 ("gpio/samsung: gpio-samsung.c to support
Samsung GPIOs").

The long-term plan for this driver would be to remove it
entirely, after all Samsung machines have been converted
over to boot from DT, but there is currently no timeline
for when that might happen.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/plat-samsung/Kconfig                          | 3 +++
 arch/arm/plat-samsung/Makefile                         | 2 ++
 {drivers/gpio => arch/arm/plat-samsung}/gpio-samsung.c | 0
 drivers/gpio/Kconfig                                   | 7 -------
 drivers/gpio/Makefile                                  | 1 -
 5 files changed, 5 insertions(+), 8 deletions(-)
 rename {drivers/gpio => arch/arm/plat-samsung}/gpio-samsung.c (100%)

diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index cb8e3d655d1a..1df08180f2a5 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -311,6 +311,9 @@ config SAMSUNG_WDT_RESET
 	  Compile support for system restart by triggering watchdog reset.
 	  Used on SoCs that do not provide dedicated reset control.
 
+config GPIO_SAMSUNG
+	def_bool SAMSUNG_ATAGS
+
 config DEBUG_S3C_UART
 	depends on PLAT_SAMSUNG
 	int
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
index 1a29ab1f446d..7896ddf63974 100644
--- a/arch/arm/plat-samsung/Makefile
+++ b/arch/arm/plat-samsung/Makefile
@@ -26,6 +26,8 @@ obj-$(CONFIG_SAMSUNG_DEV_BACKLIGHT)	+= dev-backlight.o
 
 obj-$(CONFIG_S3C_SETUP_CAMIF)	+= setup-camif.o
 
+obj-$(CONFIG_GPIO_SAMSUNG)     += gpio-samsung.o
+
 # PM support
 
 obj-$(CONFIG_PM_SLEEP)		+= pm-common.o
diff --git a/drivers/gpio/gpio-samsung.c b/arch/arm/plat-samsung/gpio-samsung.c
similarity index 100%
rename from drivers/gpio/gpio-samsung.c
rename to arch/arm/plat-samsung/gpio-samsung.c
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index c1e2ca3d9a51..2ebc124e1217 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -296,13 +296,6 @@ config GPIO_RCAR
 	help
 	  Say yes here to support GPIO on Renesas R-Car SoCs.
 
-config GPIO_SAMSUNG
-	bool
-	depends on PLAT_SAMSUNG
-	help
-	  Legacy GPIO support. Use only for platforms without support for
-	  pinctrl.
-
 config GPIO_SCH311X
 	tristate "SMSC SCH311x SuperI/O GPIO"
 	help
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index bdda6a94d2cd..0e48e5d89d63 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -73,7 +73,6 @@ obj-$(CONFIG_GPIO_PXA)		+= gpio-pxa.o
 obj-$(CONFIG_GPIO_RC5T583)	+= gpio-rc5t583.o
 obj-$(CONFIG_GPIO_RDC321X)	+= gpio-rdc321x.o
 obj-$(CONFIG_GPIO_RCAR)		+= gpio-rcar.o
-obj-$(CONFIG_GPIO_SAMSUNG)	+= gpio-samsung.o
 obj-$(CONFIG_ARCH_SA1100)	+= gpio-sa1100.o
 obj-$(CONFIG_GPIO_SCH)		+= gpio-sch.o
 obj-$(CONFIG_GPIO_SCH311X)	+= gpio-sch311x.o
-- 
2.1.0.rc2

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

* [PATCH 04/10] ARM: s3c64xx: prepare initcalls for multiplatform
  2015-03-02 12:35 ` Arnd Bergmann
@ 2015-03-02 12:35   ` Arnd Bergmann
  -1 siblings, 0 replies; 60+ messages in thread
From: Arnd Bergmann @ 2015-03-02 12:35 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Kukjin Kim, linux-samsung-soc, Maurus Cuelenaere, Mark Brown,
	Liam Girdwood, dmitry.torokhov, ch.naveen, a.kesavan, cw00.choi,
	jic23, Tomasz Figa, padma.v, Arnd Bergmann

In a multiplatform kernel, each initcall is run regardless
of the platform it is meant for, so it must not attempt to
access SoC-specific registers.

This adds 'if (soc_is_s3c64xx)' to all initcalls that are
specific to the s3c64xx platform, to prevent them from breaking
other platforms once we can build them into a combined kernel.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-s3c64xx/common.c               |  4 ++--
 arch/arm/mach-s3c64xx/cpuidle.c              |  5 ++++-
 arch/arm/mach-s3c64xx/irq-pm.c               |  2 +-
 arch/arm/mach-s3c64xx/mach-crag6410-module.c |  4 ++++
 arch/arm/mach-s3c64xx/pl080.c                |  4 ++++
 arch/arm/mach-s3c64xx/pm.c                   |  4 ++++
 arch/arm/mach-s3c64xx/s3c6400.c              |  2 +-
 arch/arm/mach-s3c64xx/s3c6410.c              |  2 +-
 arch/arm/plat-samsung/gpio-samsung.c         | 11 +++++------
 arch/arm/plat-samsung/init.c                 |  5 +++++
 10 files changed, 31 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-s3c64xx/common.c b/arch/arm/mach-s3c64xx/common.c
index 16547f2641a3..cca29aa49fd3 100644
--- a/arch/arm/mach-s3c64xx/common.c
+++ b/arch/arm/mach-s3c64xx/common.c
@@ -209,7 +209,7 @@ void __init s3c64xx_init_io(struct map_desc *mach_desc, int size)
 static __init int s3c64xx_dev_init(void)
 {
 	/* Not applicable when using DT. */
-	if (of_have_populated_dt())
+	if (of_have_populated_dt() || !soc_is_s3c64xx())
 		return 0;
 
 	subsys_system_register(&s3c64xx_subsys, NULL);
@@ -414,7 +414,7 @@ static int __init s3c64xx_init_irq_eint(void)
 	int irq;
 
 	/* On DT-enabled systems EINTs are handled by pinctrl-s3c64xx driver. */
-	if (of_have_populated_dt())
+	if (of_have_populated_dt() || !soc_is_s3c64xx())
 		return -ENODEV;
 
 	for (irq = IRQ_EINT(0); irq <= IRQ_EINT(27); irq++) {
diff --git a/arch/arm/mach-s3c64xx/cpuidle.c b/arch/arm/mach-s3c64xx/cpuidle.c
index 2eb072440dfa..92b41c2b7314 100644
--- a/arch/arm/mach-s3c64xx/cpuidle.c
+++ b/arch/arm/mach-s3c64xx/cpuidle.c
@@ -18,6 +18,7 @@
 
 #include <asm/proc-fns.h>
 
+#include <plat/cpu.h>
 #include <mach/map.h>
 
 #include "regs-sys.h"
@@ -57,6 +58,8 @@ static struct cpuidle_driver s3c64xx_cpuidle_driver = {
 
 static int __init s3c64xx_init_cpuidle(void)
 {
-	return cpuidle_register(&s3c64xx_cpuidle_driver, NULL);
+	if (soc_is_s3c64xx())
+		return cpuidle_register(&s3c64xx_cpuidle_driver, NULL);
+	return 0;
 }
 device_initcall(s3c64xx_init_cpuidle);
diff --git a/arch/arm/mach-s3c64xx/irq-pm.c b/arch/arm/mach-s3c64xx/irq-pm.c
index ae4ea7601f60..0bbf1faaee42 100644
--- a/arch/arm/mach-s3c64xx/irq-pm.c
+++ b/arch/arm/mach-s3c64xx/irq-pm.c
@@ -113,7 +113,7 @@ static struct syscore_ops s3c64xx_irq_syscore_ops = {
 static __init int s3c64xx_syscore_init(void)
 {
 	/* Appropriate drivers (pinctrl, uart) handle this when using DT. */
-	if (of_have_populated_dt())
+	if (of_have_populated_dt() || !soc_is_s3c64xx())
 		return 0;
 
 	register_syscore_ops(&s3c64xx_irq_syscore_ops);
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410-module.c b/arch/arm/mach-s3c64xx/mach-crag6410-module.c
index 9c00d83f7151..be21f06e6b3f 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410-module.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410-module.c
@@ -29,6 +29,7 @@
 
 #include <linux/platform_data/spi-s3c64xx.h>
 
+#include <plat/cpu.h>
 #include "crag6410.h"
 
 static struct s3c64xx_spi_csinfo wm0010_spi_csinfo = {
@@ -399,6 +400,9 @@ static struct i2c_driver wlf_gf_module_driver = {
 
 static int __init wlf_gf_module_register(void)
 {
+	if (!soc_is_s3c64xx())
+		return 0;
+
 	return i2c_add_driver(&wlf_gf_module_driver);
 }
 device_initcall(wlf_gf_module_register);
diff --git a/arch/arm/mach-s3c64xx/pl080.c b/arch/arm/mach-s3c64xx/pl080.c
index 901a984bddc2..89c5a62830a7 100644
--- a/arch/arm/mach-s3c64xx/pl080.c
+++ b/arch/arm/mach-s3c64xx/pl080.c
@@ -14,6 +14,7 @@
 #include <linux/amba/pl08x.h>
 #include <linux/of.h>
 
+#include <plat/cpu.h>
 #include <mach/irqs.h>
 #include <mach/map.h>
 
@@ -230,6 +231,9 @@ static AMBA_AHB_DEVICE(s3c64xx_dma1, "dma-pl080s.1", 0,
 
 static int __init s3c64xx_pl080_init(void)
 {
+	if (!soc_is_s3c64xx())
+		return 0;
+
 	/* Set all DMA configuration to be DMA, not SDMA */
 	writel(0xffffff, S3C64XX_SDMA_SEL);
 
diff --git a/arch/arm/mach-s3c64xx/pm.c b/arch/arm/mach-s3c64xx/pm.c
index aaf7bea4032f..1451d4cda324 100644
--- a/arch/arm/mach-s3c64xx/pm.c
+++ b/arch/arm/mach-s3c64xx/pm.c
@@ -22,6 +22,7 @@
 #include <mach/map.h>
 #include <mach/irqs.h>
 
+#include <plat/cpu.h>
 #include <plat/devs.h>
 #include <plat/pm.h>
 #include <plat/wakeup-mask.h>
@@ -330,6 +331,9 @@ int __init s3c64xx_pm_init(void)
 
 static __init int s3c64xx_pm_initcall(void)
 {
+	if (!soc_is_s3c64xx())
+		return 0;
+
 	pm_cpu_prep = s3c64xx_pm_prepare;
 	pm_cpu_sleep = s3c64xx_cpu_suspend;
 
diff --git a/arch/arm/mach-s3c64xx/s3c6400.c b/arch/arm/mach-s3c64xx/s3c6400.c
index 1ce48c54cd9c..0789d59e6302 100644
--- a/arch/arm/mach-s3c64xx/s3c6400.c
+++ b/arch/arm/mach-s3c64xx/s3c6400.c
@@ -81,7 +81,7 @@ static struct device s3c6400_dev = {
 static int __init s3c6400_core_init(void)
 {
 	/* Not applicable when using DT. */
-	if (of_have_populated_dt())
+	if (of_have_populated_dt() || soc_is_s3c64xx())
 		return 0;
 
 	return subsys_system_register(&s3c6400_subsys, NULL);
diff --git a/arch/arm/mach-s3c64xx/s3c6410.c b/arch/arm/mach-s3c64xx/s3c6410.c
index b2a7930548d9..273f8a1518b2 100644
--- a/arch/arm/mach-s3c64xx/s3c6410.c
+++ b/arch/arm/mach-s3c64xx/s3c6410.c
@@ -84,7 +84,7 @@ static struct device s3c6410_dev = {
 static int __init s3c6410_core_init(void)
 {
 	/* Not applicable when using DT. */
-	if (of_have_populated_dt())
+	if (of_have_populated_dt() || !soc_is_s3c64xx())
 		return 0;
 
 	return subsys_system_register(&s3c6410_subsys, NULL);
diff --git a/arch/arm/plat-samsung/gpio-samsung.c b/arch/arm/plat-samsung/gpio-samsung.c
index 7c288ba4dc87..37faa8eab78f 100644
--- a/arch/arm/plat-samsung/gpio-samsung.c
+++ b/arch/arm/plat-samsung/gpio-samsung.c
@@ -1176,14 +1176,16 @@ static __init int samsung_gpiolib_init(void)
 	 * interfaces. For legacy (non-DT) platforms this driver is used.
 	 */
 	if (of_have_populated_dt())
-		return -ENODEV;
-
-	samsung_gpiolib_set_cfg(samsung_gpio_cfgs, ARRAY_SIZE(samsung_gpio_cfgs));
+		return 0;
 
 	if (soc_is_s3c24xx()) {
+		samsung_gpiolib_set_cfg(samsung_gpio_cfgs,
+				ARRAY_SIZE(samsung_gpio_cfgs));
 		s3c24xx_gpiolib_add_chips(s3c24xx_gpios,
 				ARRAY_SIZE(s3c24xx_gpios), S3C24XX_VA_GPIO);
 	} else if (soc_is_s3c64xx()) {
+		samsung_gpiolib_set_cfg(samsung_gpio_cfgs,
+				ARRAY_SIZE(samsung_gpio_cfgs));
 		samsung_gpiolib_add_2bit_chips(s3c64xx_gpios_2bit,
 				ARRAY_SIZE(s3c64xx_gpios_2bit),
 				S3C64XX_VA_GPIO + 0xE0, 0x20);
@@ -1192,9 +1194,6 @@ static __init int samsung_gpiolib_init(void)
 				S3C64XX_VA_GPIO);
 		samsung_gpiolib_add_4bit2_chips(s3c64xx_gpios_4bit2,
 				ARRAY_SIZE(s3c64xx_gpios_4bit2));
-	} else {
-		WARN(1, "Unknown SoC in gpio-samsung, no GPIOs added\n");
-		return -ENODEV;
 	}
 
 	return 0;
diff --git a/arch/arm/plat-samsung/init.c b/arch/arm/plat-samsung/init.c
index 11fbbc26e49f..3776f7e752f0 100644
--- a/arch/arm/plat-samsung/init.c
+++ b/arch/arm/plat-samsung/init.c
@@ -152,6 +152,11 @@ static int __init s3c_arch_init(void)
 {
 	int ret;
 
+	/* init is only needed for ATAGS based platforms */
+	if (!IS_ENABLED(CONFIG_ATAGS) ||
+	    (!soc_is_s3c24xx() && !soc_is_s3c64xx()))
+		return 0;
+
 	// do the correct init for cpu
 
 	if (cpu == NULL) {
-- 
2.1.0.rc2

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

* [PATCH 04/10] ARM: s3c64xx: prepare initcalls for multiplatform
@ 2015-03-02 12:35   ` Arnd Bergmann
  0 siblings, 0 replies; 60+ messages in thread
From: Arnd Bergmann @ 2015-03-02 12:35 UTC (permalink / raw)
  To: linux-arm-kernel

In a multiplatform kernel, each initcall is run regardless
of the platform it is meant for, so it must not attempt to
access SoC-specific registers.

This adds 'if (soc_is_s3c64xx)' to all initcalls that are
specific to the s3c64xx platform, to prevent them from breaking
other platforms once we can build them into a combined kernel.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-s3c64xx/common.c               |  4 ++--
 arch/arm/mach-s3c64xx/cpuidle.c              |  5 ++++-
 arch/arm/mach-s3c64xx/irq-pm.c               |  2 +-
 arch/arm/mach-s3c64xx/mach-crag6410-module.c |  4 ++++
 arch/arm/mach-s3c64xx/pl080.c                |  4 ++++
 arch/arm/mach-s3c64xx/pm.c                   |  4 ++++
 arch/arm/mach-s3c64xx/s3c6400.c              |  2 +-
 arch/arm/mach-s3c64xx/s3c6410.c              |  2 +-
 arch/arm/plat-samsung/gpio-samsung.c         | 11 +++++------
 arch/arm/plat-samsung/init.c                 |  5 +++++
 10 files changed, 31 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-s3c64xx/common.c b/arch/arm/mach-s3c64xx/common.c
index 16547f2641a3..cca29aa49fd3 100644
--- a/arch/arm/mach-s3c64xx/common.c
+++ b/arch/arm/mach-s3c64xx/common.c
@@ -209,7 +209,7 @@ void __init s3c64xx_init_io(struct map_desc *mach_desc, int size)
 static __init int s3c64xx_dev_init(void)
 {
 	/* Not applicable when using DT. */
-	if (of_have_populated_dt())
+	if (of_have_populated_dt() || !soc_is_s3c64xx())
 		return 0;
 
 	subsys_system_register(&s3c64xx_subsys, NULL);
@@ -414,7 +414,7 @@ static int __init s3c64xx_init_irq_eint(void)
 	int irq;
 
 	/* On DT-enabled systems EINTs are handled by pinctrl-s3c64xx driver. */
-	if (of_have_populated_dt())
+	if (of_have_populated_dt() || !soc_is_s3c64xx())
 		return -ENODEV;
 
 	for (irq = IRQ_EINT(0); irq <= IRQ_EINT(27); irq++) {
diff --git a/arch/arm/mach-s3c64xx/cpuidle.c b/arch/arm/mach-s3c64xx/cpuidle.c
index 2eb072440dfa..92b41c2b7314 100644
--- a/arch/arm/mach-s3c64xx/cpuidle.c
+++ b/arch/arm/mach-s3c64xx/cpuidle.c
@@ -18,6 +18,7 @@
 
 #include <asm/proc-fns.h>
 
+#include <plat/cpu.h>
 #include <mach/map.h>
 
 #include "regs-sys.h"
@@ -57,6 +58,8 @@ static struct cpuidle_driver s3c64xx_cpuidle_driver = {
 
 static int __init s3c64xx_init_cpuidle(void)
 {
-	return cpuidle_register(&s3c64xx_cpuidle_driver, NULL);
+	if (soc_is_s3c64xx())
+		return cpuidle_register(&s3c64xx_cpuidle_driver, NULL);
+	return 0;
 }
 device_initcall(s3c64xx_init_cpuidle);
diff --git a/arch/arm/mach-s3c64xx/irq-pm.c b/arch/arm/mach-s3c64xx/irq-pm.c
index ae4ea7601f60..0bbf1faaee42 100644
--- a/arch/arm/mach-s3c64xx/irq-pm.c
+++ b/arch/arm/mach-s3c64xx/irq-pm.c
@@ -113,7 +113,7 @@ static struct syscore_ops s3c64xx_irq_syscore_ops = {
 static __init int s3c64xx_syscore_init(void)
 {
 	/* Appropriate drivers (pinctrl, uart) handle this when using DT. */
-	if (of_have_populated_dt())
+	if (of_have_populated_dt() || !soc_is_s3c64xx())
 		return 0;
 
 	register_syscore_ops(&s3c64xx_irq_syscore_ops);
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410-module.c b/arch/arm/mach-s3c64xx/mach-crag6410-module.c
index 9c00d83f7151..be21f06e6b3f 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410-module.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410-module.c
@@ -29,6 +29,7 @@
 
 #include <linux/platform_data/spi-s3c64xx.h>
 
+#include <plat/cpu.h>
 #include "crag6410.h"
 
 static struct s3c64xx_spi_csinfo wm0010_spi_csinfo = {
@@ -399,6 +400,9 @@ static struct i2c_driver wlf_gf_module_driver = {
 
 static int __init wlf_gf_module_register(void)
 {
+	if (!soc_is_s3c64xx())
+		return 0;
+
 	return i2c_add_driver(&wlf_gf_module_driver);
 }
 device_initcall(wlf_gf_module_register);
diff --git a/arch/arm/mach-s3c64xx/pl080.c b/arch/arm/mach-s3c64xx/pl080.c
index 901a984bddc2..89c5a62830a7 100644
--- a/arch/arm/mach-s3c64xx/pl080.c
+++ b/arch/arm/mach-s3c64xx/pl080.c
@@ -14,6 +14,7 @@
 #include <linux/amba/pl08x.h>
 #include <linux/of.h>
 
+#include <plat/cpu.h>
 #include <mach/irqs.h>
 #include <mach/map.h>
 
@@ -230,6 +231,9 @@ static AMBA_AHB_DEVICE(s3c64xx_dma1, "dma-pl080s.1", 0,
 
 static int __init s3c64xx_pl080_init(void)
 {
+	if (!soc_is_s3c64xx())
+		return 0;
+
 	/* Set all DMA configuration to be DMA, not SDMA */
 	writel(0xffffff, S3C64XX_SDMA_SEL);
 
diff --git a/arch/arm/mach-s3c64xx/pm.c b/arch/arm/mach-s3c64xx/pm.c
index aaf7bea4032f..1451d4cda324 100644
--- a/arch/arm/mach-s3c64xx/pm.c
+++ b/arch/arm/mach-s3c64xx/pm.c
@@ -22,6 +22,7 @@
 #include <mach/map.h>
 #include <mach/irqs.h>
 
+#include <plat/cpu.h>
 #include <plat/devs.h>
 #include <plat/pm.h>
 #include <plat/wakeup-mask.h>
@@ -330,6 +331,9 @@ int __init s3c64xx_pm_init(void)
 
 static __init int s3c64xx_pm_initcall(void)
 {
+	if (!soc_is_s3c64xx())
+		return 0;
+
 	pm_cpu_prep = s3c64xx_pm_prepare;
 	pm_cpu_sleep = s3c64xx_cpu_suspend;
 
diff --git a/arch/arm/mach-s3c64xx/s3c6400.c b/arch/arm/mach-s3c64xx/s3c6400.c
index 1ce48c54cd9c..0789d59e6302 100644
--- a/arch/arm/mach-s3c64xx/s3c6400.c
+++ b/arch/arm/mach-s3c64xx/s3c6400.c
@@ -81,7 +81,7 @@ static struct device s3c6400_dev = {
 static int __init s3c6400_core_init(void)
 {
 	/* Not applicable when using DT. */
-	if (of_have_populated_dt())
+	if (of_have_populated_dt() || soc_is_s3c64xx())
 		return 0;
 
 	return subsys_system_register(&s3c6400_subsys, NULL);
diff --git a/arch/arm/mach-s3c64xx/s3c6410.c b/arch/arm/mach-s3c64xx/s3c6410.c
index b2a7930548d9..273f8a1518b2 100644
--- a/arch/arm/mach-s3c64xx/s3c6410.c
+++ b/arch/arm/mach-s3c64xx/s3c6410.c
@@ -84,7 +84,7 @@ static struct device s3c6410_dev = {
 static int __init s3c6410_core_init(void)
 {
 	/* Not applicable when using DT. */
-	if (of_have_populated_dt())
+	if (of_have_populated_dt() || !soc_is_s3c64xx())
 		return 0;
 
 	return subsys_system_register(&s3c6410_subsys, NULL);
diff --git a/arch/arm/plat-samsung/gpio-samsung.c b/arch/arm/plat-samsung/gpio-samsung.c
index 7c288ba4dc87..37faa8eab78f 100644
--- a/arch/arm/plat-samsung/gpio-samsung.c
+++ b/arch/arm/plat-samsung/gpio-samsung.c
@@ -1176,14 +1176,16 @@ static __init int samsung_gpiolib_init(void)
 	 * interfaces. For legacy (non-DT) platforms this driver is used.
 	 */
 	if (of_have_populated_dt())
-		return -ENODEV;
-
-	samsung_gpiolib_set_cfg(samsung_gpio_cfgs, ARRAY_SIZE(samsung_gpio_cfgs));
+		return 0;
 
 	if (soc_is_s3c24xx()) {
+		samsung_gpiolib_set_cfg(samsung_gpio_cfgs,
+				ARRAY_SIZE(samsung_gpio_cfgs));
 		s3c24xx_gpiolib_add_chips(s3c24xx_gpios,
 				ARRAY_SIZE(s3c24xx_gpios), S3C24XX_VA_GPIO);
 	} else if (soc_is_s3c64xx()) {
+		samsung_gpiolib_set_cfg(samsung_gpio_cfgs,
+				ARRAY_SIZE(samsung_gpio_cfgs));
 		samsung_gpiolib_add_2bit_chips(s3c64xx_gpios_2bit,
 				ARRAY_SIZE(s3c64xx_gpios_2bit),
 				S3C64XX_VA_GPIO + 0xE0, 0x20);
@@ -1192,9 +1194,6 @@ static __init int samsung_gpiolib_init(void)
 				S3C64XX_VA_GPIO);
 		samsung_gpiolib_add_4bit2_chips(s3c64xx_gpios_4bit2,
 				ARRAY_SIZE(s3c64xx_gpios_4bit2));
-	} else {
-		WARN(1, "Unknown SoC in gpio-samsung, no GPIOs added\n");
-		return -ENODEV;
 	}
 
 	return 0;
diff --git a/arch/arm/plat-samsung/init.c b/arch/arm/plat-samsung/init.c
index 11fbbc26e49f..3776f7e752f0 100644
--- a/arch/arm/plat-samsung/init.c
+++ b/arch/arm/plat-samsung/init.c
@@ -152,6 +152,11 @@ static int __init s3c_arch_init(void)
 {
 	int ret;
 
+	/* init is only needed for ATAGS based platforms */
+	if (!IS_ENABLED(CONFIG_ATAGS) ||
+	    (!soc_is_s3c24xx() && !soc_is_s3c64xx()))
+		return 0;
+
 	// do the correct init for cpu
 
 	if (cpu == NULL) {
-- 
2.1.0.rc2

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

* [PATCH 05/10] ARM: s3c64xx: enable sparse IRQ support
  2015-03-02 12:35 ` Arnd Bergmann
@ 2015-03-02 12:35   ` Arnd Bergmann
  -1 siblings, 0 replies; 60+ messages in thread
From: Arnd Bergmann @ 2015-03-02 12:35 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Kukjin Kim, linux-samsung-soc, Maurus Cuelenaere, Mark Brown,
	Liam Girdwood, dmitry.torokhov, ch.naveen, a.kesavan, cw00.choi,
	jic23, Tomasz Figa, padma.v, Arnd Bergmann

This is another prerequisite for enabling multiplatform
support, and it is the part I am least certain about.

I assume it will cause the extra boot message "Cannot
allocate irq_descs @ IRQ%d, assuming pre-allocated" to
be printed, but otherwise work ok. This definitely needs
to be tested on real hardware to see if it works.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/Kconfig                             |  1 +
 arch/arm/mach-s3c64xx/common.c               |  1 +
 arch/arm/mach-s3c64xx/dev-uart.c             |  1 +
 arch/arm/mach-s3c64xx/include/mach/irqs.h    | 20 +++-----------------
 arch/arm/mach-s3c64xx/include/mach/pm-core.h |  1 +
 arch/arm/mach-s3c64xx/mach-anw6410.c         |  3 ++-
 arch/arm/mach-s3c64xx/mach-crag6410-module.c |  2 ++
 arch/arm/mach-s3c64xx/mach-crag6410.c        |  2 ++
 arch/arm/mach-s3c64xx/mach-hmt.c             |  2 ++
 arch/arm/mach-s3c64xx/mach-mini6410.c        |  2 ++
 arch/arm/mach-s3c64xx/mach-ncp.c             |  2 ++
 arch/arm/mach-s3c64xx/mach-real6410.c        |  3 ++-
 arch/arm/mach-s3c64xx/mach-smartq5.c         |  2 ++
 arch/arm/mach-s3c64xx/mach-smartq7.c         |  2 ++
 arch/arm/mach-s3c64xx/mach-smdk6400.c        |  3 ++-
 arch/arm/mach-s3c64xx/mach-smdk6410.c        |  3 ++-
 arch/arm/plat-samsung/gpio-samsung.c         |  1 +
 17 files changed, 30 insertions(+), 21 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 98f113833465..a6f71e402b38 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -709,6 +709,7 @@ config ARCH_S3C64XX
 	select SAMSUNG_ATAGS
 	select SAMSUNG_WAKEMASK
 	select SAMSUNG_WDT_RESET
+	select SPARSE_IRQ
 	help
 	  Samsung S3C64XX series based systems
 
diff --git a/arch/arm/mach-s3c64xx/common.c b/arch/arm/mach-s3c64xx/common.c
index cca29aa49fd3..971b4799f16d 100644
--- a/arch/arm/mach-s3c64xx/common.c
+++ b/arch/arm/mach-s3c64xx/common.c
@@ -40,6 +40,7 @@
 #include <asm/system_misc.h>
 
 #include <mach/map.h>
+#include <mach/irqs.h>
 #include <mach/hardware.h>
 #include <mach/regs-gpio.h>
 #include <mach/gpio-samsung.h>
diff --git a/arch/arm/mach-s3c64xx/dev-uart.c b/arch/arm/mach-s3c64xx/dev-uart.c
index 46e18d77ea93..a0b4f0329811 100644
--- a/arch/arm/mach-s3c64xx/dev-uart.c
+++ b/arch/arm/mach-s3c64xx/dev-uart.c
@@ -23,6 +23,7 @@
 #include <asm/mach/irq.h>
 #include <mach/hardware.h>
 #include <mach/map.h>
+#include <mach/irqs.h>
 
 #include <plat/devs.h>
 
diff --git a/arch/arm/mach-s3c64xx/include/mach/irqs.h b/arch/arm/mach-s3c64xx/include/mach/irqs.h
index 67bbd1dd04c2..3ceb00b5de07 100644
--- a/arch/arm/mach-s3c64xx/include/mach/irqs.h
+++ b/arch/arm/mach-s3c64xx/include/mach/irqs.h
@@ -156,25 +156,11 @@
 
 #define IRQ_EINT_GROUP(group, no)	(IRQ_EINT_GROUP##group##_BASE + (no))
 
-/* Define a group of interrupts for board-specific use (eg, for MFD
- * interrupt controllers). */
+/* Some boards have their own IRQs behind this */
 #define IRQ_BOARD_START (IRQ_EINT_GROUP9_BASE + IRQ_EINT_GROUP9_NR + 1)
 
-#ifdef CONFIG_MACH_WLF_CRAGG_6410
-#define IRQ_BOARD_NR 160
-#elif defined(CONFIG_SMDK6410_WM1190_EV1)
-#define IRQ_BOARD_NR 64
-#elif defined(CONFIG_SMDK6410_WM1192_EV1)
-#define IRQ_BOARD_NR 64
-#else
-#define IRQ_BOARD_NR 16
-#endif
-
-#define IRQ_BOARD_END (IRQ_BOARD_START + IRQ_BOARD_NR)
-
-/* Set the default NR_IRQS */
-
-#define NR_IRQS	(IRQ_BOARD_END + 1)
+/* Set the default nr_irqs, boards can override if necessary */
+#define S3C64XX_NR_IRQS	IRQ_BOARD_START
 
 /* Compatibility */
 
diff --git a/arch/arm/mach-s3c64xx/include/mach/pm-core.h b/arch/arm/mach-s3c64xx/include/mach/pm-core.h
index a30a1e3ffc6a..32d2ff54f82d 100644
--- a/arch/arm/mach-s3c64xx/include/mach/pm-core.h
+++ b/arch/arm/mach-s3c64xx/include/mach/pm-core.h
@@ -18,6 +18,7 @@
 #include <linux/serial_s3c.h>
 
 #include <mach/regs-gpio.h>
+#include <mach/regs-clock.h>
 
 static inline void s3c_pm_debug_init_uart(void)
 {
diff --git a/arch/arm/mach-s3c64xx/mach-anw6410.c b/arch/arm/mach-s3c64xx/mach-anw6410.c
index 6224c67f5061..347ce6009a8c 100644
--- a/arch/arm/mach-s3c64xx/mach-anw6410.c
+++ b/arch/arm/mach-s3c64xx/mach-anw6410.c
@@ -47,6 +47,7 @@
 
 #include <plat/devs.h>
 #include <plat/cpu.h>
+#include <mach/irqs.h>
 #include <mach/regs-gpio.h>
 #include <mach/gpio-samsung.h>
 #include <plat/samsung-time.h>
@@ -229,7 +230,7 @@ static void __init anw6410_machine_init(void)
 MACHINE_START(ANW6410, "A&W6410")
 	/* Maintainer: Kwangwoo Lee <kwangwoo.lee@gmail.com> */
 	.atag_offset	= 0x100,
-
+	.nr_irqs	= S3C64XX_NR_IRQS,
 	.init_irq	= s3c6410_init_irq,
 	.map_io		= anw6410_map_io,
 	.init_machine	= anw6410_machine_init,
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410-module.c b/arch/arm/mach-s3c64xx/mach-crag6410-module.c
index be21f06e6b3f..571f95cc5a53 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410-module.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410-module.c
@@ -30,6 +30,8 @@
 #include <linux/platform_data/spi-s3c64xx.h>
 
 #include <plat/cpu.h>
+#include <mach/irqs.h>
+
 #include "crag6410.h"
 
 static struct s3c64xx_spi_csinfo wm0010_spi_csinfo = {
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c
index 10b913baab28..f395a5617142 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
@@ -51,6 +51,7 @@
 #include <mach/map.h>
 #include <mach/regs-gpio.h>
 #include <mach/gpio-samsung.h>
+#include <mach/irqs.h>
 
 #include <plat/fb.h>
 #include <plat/sdhci.h>
@@ -854,6 +855,7 @@ static void __init crag6410_machine_init(void)
 MACHINE_START(WLF_CRAGG_6410, "Wolfson Cragganmore 6410")
 	/* Maintainer: Mark Brown <broonie@opensource.wolfsonmicro.com> */
 	.atag_offset	= 0x100,
+	.nr_irqs	= S3C64XX_NR_IRQS + 160,
 	.init_irq	= s3c6410_init_irq,
 	.map_io		= crag6410_map_io,
 	.init_machine	= crag6410_machine_init,
diff --git a/arch/arm/mach-s3c64xx/mach-hmt.c b/arch/arm/mach-s3c64xx/mach-hmt.c
index e4b087c58ee6..74f67c49f364 100644
--- a/arch/arm/mach-s3c64xx/mach-hmt.c
+++ b/arch/arm/mach-s3c64xx/mach-hmt.c
@@ -30,6 +30,7 @@
 #include <video/samsung_fimd.h>
 #include <mach/hardware.h>
 #include <mach/map.h>
+#include <mach/irqs.h>
 
 #include <asm/irq.h>
 #include <asm/mach-types.h>
@@ -274,6 +275,7 @@ static void __init hmt_machine_init(void)
 MACHINE_START(HMT, "Airgoo-HMT")
 	/* Maintainer: Peter Korsgaard <jacmet@sunsite.dk> */
 	.atag_offset	= 0x100,
+	.nr_irqs	= S3C64XX_NR_IRQS,
 	.init_irq	= s3c6410_init_irq,
 	.map_io		= hmt_map_io,
 	.init_machine	= hmt_machine_init,
diff --git a/arch/arm/mach-s3c64xx/mach-mini6410.c b/arch/arm/mach-s3c64xx/mach-mini6410.c
index ab61af50bfb9..3ce5842ed51b 100644
--- a/arch/arm/mach-s3c64xx/mach-mini6410.c
+++ b/arch/arm/mach-s3c64xx/mach-mini6410.c
@@ -41,6 +41,7 @@
 #include <linux/platform_data/mmc-sdhci-s3c.h>
 #include <plat/sdhci.h>
 #include <linux/platform_data/touchscreen-s3c2410.h>
+#include <mach/irqs.h>
 
 #include <video/platform_lcd.h>
 #include <video/samsung_fimd.h>
@@ -363,6 +364,7 @@ static void __init mini6410_machine_init(void)
 MACHINE_START(MINI6410, "MINI6410")
 	/* Maintainer: Darius Augulis <augulis.darius@gmail.com> */
 	.atag_offset	= 0x100,
+	.nr_irqs	= S3C64XX_NR_IRQS,
 	.init_irq	= s3c6410_init_irq,
 	.map_io		= mini6410_map_io,
 	.init_machine	= mini6410_machine_init,
diff --git a/arch/arm/mach-s3c64xx/mach-ncp.c b/arch/arm/mach-s3c64xx/mach-ncp.c
index 80cb1446f69f..23baaa04318c 100644
--- a/arch/arm/mach-s3c64xx/mach-ncp.c
+++ b/arch/arm/mach-s3c64xx/mach-ncp.c
@@ -31,6 +31,7 @@
 #include <asm/mach/map.h>
 #include <asm/mach/irq.h>
 
+#include <mach/irqs.h>
 #include <mach/hardware.h>
 #include <mach/map.h>
 
@@ -100,6 +101,7 @@ static void __init ncp_machine_init(void)
 MACHINE_START(NCP, "NCP")
 	/* Maintainer: Samsung Electronics */
 	.atag_offset	= 0x100,
+	.nr_irqs	= S3C64XX_NR_IRQS,
 	.init_irq	= s3c6410_init_irq,
 	.map_io		= ncp_map_io,
 	.init_machine	= ncp_machine_init,
diff --git a/arch/arm/mach-s3c64xx/mach-real6410.c b/arch/arm/mach-s3c64xx/mach-real6410.c
index 85fa9598b980..ca6548a1ed3b 100644
--- a/arch/arm/mach-s3c64xx/mach-real6410.c
+++ b/arch/arm/mach-s3c64xx/mach-real6410.c
@@ -33,6 +33,7 @@
 #include <mach/map.h>
 #include <mach/regs-gpio.h>
 #include <mach/gpio-samsung.h>
+#include <mach/irqs.h>
 
 #include <plat/adc.h>
 #include <plat/cpu.h>
@@ -331,7 +332,7 @@ static void __init real6410_machine_init(void)
 MACHINE_START(REAL6410, "REAL6410")
 	/* Maintainer: Darius Augulis <augulis.darius@gmail.com> */
 	.atag_offset	= 0x100,
-
+	.nr_irqs	= S3C64XX_NR_IRQS,
 	.init_irq	= s3c6410_init_irq,
 	.map_io		= real6410_map_io,
 	.init_machine	= real6410_machine_init,
diff --git a/arch/arm/mach-s3c64xx/mach-smartq5.c b/arch/arm/mach-s3c64xx/mach-smartq5.c
index 33224ab36fac..0972b6ce0ef6 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq5.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq5.c
@@ -21,6 +21,7 @@
 #include <asm/mach/arch.h>
 
 #include <video/samsung_fimd.h>
+#include <mach/irqs.h>
 #include <mach/map.h>
 #include <mach/regs-gpio.h>
 #include <mach/gpio-samsung.h>
@@ -153,6 +154,7 @@ static void __init smartq5_machine_init(void)
 MACHINE_START(SMARTQ5, "SmartQ 5")
 	/* Maintainer: Maurus Cuelenaere <mcuelenaere AT gmail DOT com> */
 	.atag_offset	= 0x100,
+	.nr_irqs	= S3C64XX_NR_IRQS,
 	.init_irq	= s3c6410_init_irq,
 	.map_io		= smartq_map_io,
 	.init_machine	= smartq5_machine_init,
diff --git a/arch/arm/mach-s3c64xx/mach-smartq7.c b/arch/arm/mach-s3c64xx/mach-smartq7.c
index fc7fece22fb0..51ac1c6c654a 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq7.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq7.c
@@ -21,6 +21,7 @@
 #include <asm/mach/arch.h>
 
 #include <video/samsung_fimd.h>
+#include <mach/irqs.h>
 #include <mach/map.h>
 #include <mach/regs-gpio.h>
 #include <mach/gpio-samsung.h>
@@ -169,6 +170,7 @@ static void __init smartq7_machine_init(void)
 MACHINE_START(SMARTQ7, "SmartQ 7")
 	/* Maintainer: Maurus Cuelenaere <mcuelenaere AT gmail DOT com> */
 	.atag_offset	= 0x100,
+	.nr_irqs	= S3C64XX_NR_IRQS,
 	.init_irq	= s3c6410_init_irq,
 	.map_io		= smartq_map_io,
 	.init_machine	= smartq7_machine_init,
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6400.c b/arch/arm/mach-s3c64xx/mach-smdk6400.c
index 6f425126a735..7d8a74fd8915 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6400.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6400.c
@@ -27,6 +27,7 @@
 #include <asm/mach/map.h>
 #include <asm/mach/irq.h>
 
+#include <mach/irqs.h>
 #include <mach/hardware.h>
 #include <mach/map.h>
 
@@ -88,7 +89,7 @@ static void __init smdk6400_machine_init(void)
 MACHINE_START(SMDK6400, "SMDK6400")
 	/* Maintainer: Ben Dooks <ben-linux@fluff.org> */
 	.atag_offset	= 0x100,
-
+	.nr_irqs	= S3C64XX_NR_IRQS,
 	.init_irq	= s3c6400_init_irq,
 	.map_io		= smdk6400_map_io,
 	.init_machine	= smdk6400_machine_init,
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6410.c b/arch/arm/mach-s3c64xx/mach-smdk6410.c
index 661eb662d051..e160eded69e1 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6410.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6410.c
@@ -51,6 +51,7 @@
 #include <asm/mach/irq.h>
 
 #include <mach/hardware.h>
+#include <mach/irqs.h>
 #include <mach/map.h>
 
 #include <asm/irq.h>
@@ -701,7 +702,7 @@ static void __init smdk6410_machine_init(void)
 MACHINE_START(SMDK6410, "SMDK6410")
 	/* Maintainer: Ben Dooks <ben-linux@fluff.org> */
 	.atag_offset	= 0x100,
-
+	.nr_irqs	= S3C64XX_NR_IRQS + 64,
 	.init_irq	= s3c6410_init_irq,
 	.map_io		= smdk6410_map_io,
 	.init_machine	= smdk6410_machine_init,
diff --git a/arch/arm/plat-samsung/gpio-samsung.c b/arch/arm/plat-samsung/gpio-samsung.c
index 37faa8eab78f..287c3df8b4c6 100644
--- a/arch/arm/plat-samsung/gpio-samsung.c
+++ b/arch/arm/plat-samsung/gpio-samsung.c
@@ -30,6 +30,7 @@
 
 #include <asm/irq.h>
 
+#include <mach/irqs.h>
 #include <mach/map.h>
 #include <mach/regs-gpio.h>
 #include <mach/gpio-samsung.h>
-- 
2.1.0.rc2

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

* [PATCH 05/10] ARM: s3c64xx: enable sparse IRQ support
@ 2015-03-02 12:35   ` Arnd Bergmann
  0 siblings, 0 replies; 60+ messages in thread
From: Arnd Bergmann @ 2015-03-02 12:35 UTC (permalink / raw)
  To: linux-arm-kernel

This is another prerequisite for enabling multiplatform
support, and it is the part I am least certain about.

I assume it will cause the extra boot message "Cannot
allocate irq_descs @ IRQ%d, assuming pre-allocated" to
be printed, but otherwise work ok. This definitely needs
to be tested on real hardware to see if it works.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/Kconfig                             |  1 +
 arch/arm/mach-s3c64xx/common.c               |  1 +
 arch/arm/mach-s3c64xx/dev-uart.c             |  1 +
 arch/arm/mach-s3c64xx/include/mach/irqs.h    | 20 +++-----------------
 arch/arm/mach-s3c64xx/include/mach/pm-core.h |  1 +
 arch/arm/mach-s3c64xx/mach-anw6410.c         |  3 ++-
 arch/arm/mach-s3c64xx/mach-crag6410-module.c |  2 ++
 arch/arm/mach-s3c64xx/mach-crag6410.c        |  2 ++
 arch/arm/mach-s3c64xx/mach-hmt.c             |  2 ++
 arch/arm/mach-s3c64xx/mach-mini6410.c        |  2 ++
 arch/arm/mach-s3c64xx/mach-ncp.c             |  2 ++
 arch/arm/mach-s3c64xx/mach-real6410.c        |  3 ++-
 arch/arm/mach-s3c64xx/mach-smartq5.c         |  2 ++
 arch/arm/mach-s3c64xx/mach-smartq7.c         |  2 ++
 arch/arm/mach-s3c64xx/mach-smdk6400.c        |  3 ++-
 arch/arm/mach-s3c64xx/mach-smdk6410.c        |  3 ++-
 arch/arm/plat-samsung/gpio-samsung.c         |  1 +
 17 files changed, 30 insertions(+), 21 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 98f113833465..a6f71e402b38 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -709,6 +709,7 @@ config ARCH_S3C64XX
 	select SAMSUNG_ATAGS
 	select SAMSUNG_WAKEMASK
 	select SAMSUNG_WDT_RESET
+	select SPARSE_IRQ
 	help
 	  Samsung S3C64XX series based systems
 
diff --git a/arch/arm/mach-s3c64xx/common.c b/arch/arm/mach-s3c64xx/common.c
index cca29aa49fd3..971b4799f16d 100644
--- a/arch/arm/mach-s3c64xx/common.c
+++ b/arch/arm/mach-s3c64xx/common.c
@@ -40,6 +40,7 @@
 #include <asm/system_misc.h>
 
 #include <mach/map.h>
+#include <mach/irqs.h>
 #include <mach/hardware.h>
 #include <mach/regs-gpio.h>
 #include <mach/gpio-samsung.h>
diff --git a/arch/arm/mach-s3c64xx/dev-uart.c b/arch/arm/mach-s3c64xx/dev-uart.c
index 46e18d77ea93..a0b4f0329811 100644
--- a/arch/arm/mach-s3c64xx/dev-uart.c
+++ b/arch/arm/mach-s3c64xx/dev-uart.c
@@ -23,6 +23,7 @@
 #include <asm/mach/irq.h>
 #include <mach/hardware.h>
 #include <mach/map.h>
+#include <mach/irqs.h>
 
 #include <plat/devs.h>
 
diff --git a/arch/arm/mach-s3c64xx/include/mach/irqs.h b/arch/arm/mach-s3c64xx/include/mach/irqs.h
index 67bbd1dd04c2..3ceb00b5de07 100644
--- a/arch/arm/mach-s3c64xx/include/mach/irqs.h
+++ b/arch/arm/mach-s3c64xx/include/mach/irqs.h
@@ -156,25 +156,11 @@
 
 #define IRQ_EINT_GROUP(group, no)	(IRQ_EINT_GROUP##group##_BASE + (no))
 
-/* Define a group of interrupts for board-specific use (eg, for MFD
- * interrupt controllers). */
+/* Some boards have their own IRQs behind this */
 #define IRQ_BOARD_START (IRQ_EINT_GROUP9_BASE + IRQ_EINT_GROUP9_NR + 1)
 
-#ifdef CONFIG_MACH_WLF_CRAGG_6410
-#define IRQ_BOARD_NR 160
-#elif defined(CONFIG_SMDK6410_WM1190_EV1)
-#define IRQ_BOARD_NR 64
-#elif defined(CONFIG_SMDK6410_WM1192_EV1)
-#define IRQ_BOARD_NR 64
-#else
-#define IRQ_BOARD_NR 16
-#endif
-
-#define IRQ_BOARD_END (IRQ_BOARD_START + IRQ_BOARD_NR)
-
-/* Set the default NR_IRQS */
-
-#define NR_IRQS	(IRQ_BOARD_END + 1)
+/* Set the default nr_irqs, boards can override if necessary */
+#define S3C64XX_NR_IRQS	IRQ_BOARD_START
 
 /* Compatibility */
 
diff --git a/arch/arm/mach-s3c64xx/include/mach/pm-core.h b/arch/arm/mach-s3c64xx/include/mach/pm-core.h
index a30a1e3ffc6a..32d2ff54f82d 100644
--- a/arch/arm/mach-s3c64xx/include/mach/pm-core.h
+++ b/arch/arm/mach-s3c64xx/include/mach/pm-core.h
@@ -18,6 +18,7 @@
 #include <linux/serial_s3c.h>
 
 #include <mach/regs-gpio.h>
+#include <mach/regs-clock.h>
 
 static inline void s3c_pm_debug_init_uart(void)
 {
diff --git a/arch/arm/mach-s3c64xx/mach-anw6410.c b/arch/arm/mach-s3c64xx/mach-anw6410.c
index 6224c67f5061..347ce6009a8c 100644
--- a/arch/arm/mach-s3c64xx/mach-anw6410.c
+++ b/arch/arm/mach-s3c64xx/mach-anw6410.c
@@ -47,6 +47,7 @@
 
 #include <plat/devs.h>
 #include <plat/cpu.h>
+#include <mach/irqs.h>
 #include <mach/regs-gpio.h>
 #include <mach/gpio-samsung.h>
 #include <plat/samsung-time.h>
@@ -229,7 +230,7 @@ static void __init anw6410_machine_init(void)
 MACHINE_START(ANW6410, "A&W6410")
 	/* Maintainer: Kwangwoo Lee <kwangwoo.lee@gmail.com> */
 	.atag_offset	= 0x100,
-
+	.nr_irqs	= S3C64XX_NR_IRQS,
 	.init_irq	= s3c6410_init_irq,
 	.map_io		= anw6410_map_io,
 	.init_machine	= anw6410_machine_init,
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410-module.c b/arch/arm/mach-s3c64xx/mach-crag6410-module.c
index be21f06e6b3f..571f95cc5a53 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410-module.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410-module.c
@@ -30,6 +30,8 @@
 #include <linux/platform_data/spi-s3c64xx.h>
 
 #include <plat/cpu.h>
+#include <mach/irqs.h>
+
 #include "crag6410.h"
 
 static struct s3c64xx_spi_csinfo wm0010_spi_csinfo = {
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c
index 10b913baab28..f395a5617142 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
@@ -51,6 +51,7 @@
 #include <mach/map.h>
 #include <mach/regs-gpio.h>
 #include <mach/gpio-samsung.h>
+#include <mach/irqs.h>
 
 #include <plat/fb.h>
 #include <plat/sdhci.h>
@@ -854,6 +855,7 @@ static void __init crag6410_machine_init(void)
 MACHINE_START(WLF_CRAGG_6410, "Wolfson Cragganmore 6410")
 	/* Maintainer: Mark Brown <broonie@opensource.wolfsonmicro.com> */
 	.atag_offset	= 0x100,
+	.nr_irqs	= S3C64XX_NR_IRQS + 160,
 	.init_irq	= s3c6410_init_irq,
 	.map_io		= crag6410_map_io,
 	.init_machine	= crag6410_machine_init,
diff --git a/arch/arm/mach-s3c64xx/mach-hmt.c b/arch/arm/mach-s3c64xx/mach-hmt.c
index e4b087c58ee6..74f67c49f364 100644
--- a/arch/arm/mach-s3c64xx/mach-hmt.c
+++ b/arch/arm/mach-s3c64xx/mach-hmt.c
@@ -30,6 +30,7 @@
 #include <video/samsung_fimd.h>
 #include <mach/hardware.h>
 #include <mach/map.h>
+#include <mach/irqs.h>
 
 #include <asm/irq.h>
 #include <asm/mach-types.h>
@@ -274,6 +275,7 @@ static void __init hmt_machine_init(void)
 MACHINE_START(HMT, "Airgoo-HMT")
 	/* Maintainer: Peter Korsgaard <jacmet@sunsite.dk> */
 	.atag_offset	= 0x100,
+	.nr_irqs	= S3C64XX_NR_IRQS,
 	.init_irq	= s3c6410_init_irq,
 	.map_io		= hmt_map_io,
 	.init_machine	= hmt_machine_init,
diff --git a/arch/arm/mach-s3c64xx/mach-mini6410.c b/arch/arm/mach-s3c64xx/mach-mini6410.c
index ab61af50bfb9..3ce5842ed51b 100644
--- a/arch/arm/mach-s3c64xx/mach-mini6410.c
+++ b/arch/arm/mach-s3c64xx/mach-mini6410.c
@@ -41,6 +41,7 @@
 #include <linux/platform_data/mmc-sdhci-s3c.h>
 #include <plat/sdhci.h>
 #include <linux/platform_data/touchscreen-s3c2410.h>
+#include <mach/irqs.h>
 
 #include <video/platform_lcd.h>
 #include <video/samsung_fimd.h>
@@ -363,6 +364,7 @@ static void __init mini6410_machine_init(void)
 MACHINE_START(MINI6410, "MINI6410")
 	/* Maintainer: Darius Augulis <augulis.darius@gmail.com> */
 	.atag_offset	= 0x100,
+	.nr_irqs	= S3C64XX_NR_IRQS,
 	.init_irq	= s3c6410_init_irq,
 	.map_io		= mini6410_map_io,
 	.init_machine	= mini6410_machine_init,
diff --git a/arch/arm/mach-s3c64xx/mach-ncp.c b/arch/arm/mach-s3c64xx/mach-ncp.c
index 80cb1446f69f..23baaa04318c 100644
--- a/arch/arm/mach-s3c64xx/mach-ncp.c
+++ b/arch/arm/mach-s3c64xx/mach-ncp.c
@@ -31,6 +31,7 @@
 #include <asm/mach/map.h>
 #include <asm/mach/irq.h>
 
+#include <mach/irqs.h>
 #include <mach/hardware.h>
 #include <mach/map.h>
 
@@ -100,6 +101,7 @@ static void __init ncp_machine_init(void)
 MACHINE_START(NCP, "NCP")
 	/* Maintainer: Samsung Electronics */
 	.atag_offset	= 0x100,
+	.nr_irqs	= S3C64XX_NR_IRQS,
 	.init_irq	= s3c6410_init_irq,
 	.map_io		= ncp_map_io,
 	.init_machine	= ncp_machine_init,
diff --git a/arch/arm/mach-s3c64xx/mach-real6410.c b/arch/arm/mach-s3c64xx/mach-real6410.c
index 85fa9598b980..ca6548a1ed3b 100644
--- a/arch/arm/mach-s3c64xx/mach-real6410.c
+++ b/arch/arm/mach-s3c64xx/mach-real6410.c
@@ -33,6 +33,7 @@
 #include <mach/map.h>
 #include <mach/regs-gpio.h>
 #include <mach/gpio-samsung.h>
+#include <mach/irqs.h>
 
 #include <plat/adc.h>
 #include <plat/cpu.h>
@@ -331,7 +332,7 @@ static void __init real6410_machine_init(void)
 MACHINE_START(REAL6410, "REAL6410")
 	/* Maintainer: Darius Augulis <augulis.darius@gmail.com> */
 	.atag_offset	= 0x100,
-
+	.nr_irqs	= S3C64XX_NR_IRQS,
 	.init_irq	= s3c6410_init_irq,
 	.map_io		= real6410_map_io,
 	.init_machine	= real6410_machine_init,
diff --git a/arch/arm/mach-s3c64xx/mach-smartq5.c b/arch/arm/mach-s3c64xx/mach-smartq5.c
index 33224ab36fac..0972b6ce0ef6 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq5.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq5.c
@@ -21,6 +21,7 @@
 #include <asm/mach/arch.h>
 
 #include <video/samsung_fimd.h>
+#include <mach/irqs.h>
 #include <mach/map.h>
 #include <mach/regs-gpio.h>
 #include <mach/gpio-samsung.h>
@@ -153,6 +154,7 @@ static void __init smartq5_machine_init(void)
 MACHINE_START(SMARTQ5, "SmartQ 5")
 	/* Maintainer: Maurus Cuelenaere <mcuelenaere AT gmail DOT com> */
 	.atag_offset	= 0x100,
+	.nr_irqs	= S3C64XX_NR_IRQS,
 	.init_irq	= s3c6410_init_irq,
 	.map_io		= smartq_map_io,
 	.init_machine	= smartq5_machine_init,
diff --git a/arch/arm/mach-s3c64xx/mach-smartq7.c b/arch/arm/mach-s3c64xx/mach-smartq7.c
index fc7fece22fb0..51ac1c6c654a 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq7.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq7.c
@@ -21,6 +21,7 @@
 #include <asm/mach/arch.h>
 
 #include <video/samsung_fimd.h>
+#include <mach/irqs.h>
 #include <mach/map.h>
 #include <mach/regs-gpio.h>
 #include <mach/gpio-samsung.h>
@@ -169,6 +170,7 @@ static void __init smartq7_machine_init(void)
 MACHINE_START(SMARTQ7, "SmartQ 7")
 	/* Maintainer: Maurus Cuelenaere <mcuelenaere AT gmail DOT com> */
 	.atag_offset	= 0x100,
+	.nr_irqs	= S3C64XX_NR_IRQS,
 	.init_irq	= s3c6410_init_irq,
 	.map_io		= smartq_map_io,
 	.init_machine	= smartq7_machine_init,
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6400.c b/arch/arm/mach-s3c64xx/mach-smdk6400.c
index 6f425126a735..7d8a74fd8915 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6400.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6400.c
@@ -27,6 +27,7 @@
 #include <asm/mach/map.h>
 #include <asm/mach/irq.h>
 
+#include <mach/irqs.h>
 #include <mach/hardware.h>
 #include <mach/map.h>
 
@@ -88,7 +89,7 @@ static void __init smdk6400_machine_init(void)
 MACHINE_START(SMDK6400, "SMDK6400")
 	/* Maintainer: Ben Dooks <ben-linux@fluff.org> */
 	.atag_offset	= 0x100,
-
+	.nr_irqs	= S3C64XX_NR_IRQS,
 	.init_irq	= s3c6400_init_irq,
 	.map_io		= smdk6400_map_io,
 	.init_machine	= smdk6400_machine_init,
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6410.c b/arch/arm/mach-s3c64xx/mach-smdk6410.c
index 661eb662d051..e160eded69e1 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6410.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6410.c
@@ -51,6 +51,7 @@
 #include <asm/mach/irq.h>
 
 #include <mach/hardware.h>
+#include <mach/irqs.h>
 #include <mach/map.h>
 
 #include <asm/irq.h>
@@ -701,7 +702,7 @@ static void __init smdk6410_machine_init(void)
 MACHINE_START(SMDK6410, "SMDK6410")
 	/* Maintainer: Ben Dooks <ben-linux@fluff.org> */
 	.atag_offset	= 0x100,
-
+	.nr_irqs	= S3C64XX_NR_IRQS + 64,
 	.init_irq	= s3c6410_init_irq,
 	.map_io		= smdk6410_map_io,
 	.init_machine	= smdk6410_machine_init,
diff --git a/arch/arm/plat-samsung/gpio-samsung.c b/arch/arm/plat-samsung/gpio-samsung.c
index 37faa8eab78f..287c3df8b4c6 100644
--- a/arch/arm/plat-samsung/gpio-samsung.c
+++ b/arch/arm/plat-samsung/gpio-samsung.c
@@ -30,6 +30,7 @@
 
 #include <asm/irq.h>
 
+#include <mach/irqs.h>
 #include <mach/map.h>
 #include <mach/regs-gpio.h>
 #include <mach/gpio-samsung.h>
-- 
2.1.0.rc2

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

* [PATCH 06/10] iio: exynos-adc: add experimental touchscreen support
  2015-03-02 12:35 ` Arnd Bergmann
@ 2015-03-02 12:35   ` Arnd Bergmann
  -1 siblings, 0 replies; 60+ messages in thread
From: Arnd Bergmann @ 2015-03-02 12:35 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Kukjin Kim, linux-samsung-soc, Maurus Cuelenaere, Mark Brown,
	Liam Girdwood, dmitry.torokhov, ch.naveen, a.kesavan, cw00.choi,
	jic23, Tomasz Figa, padma.v, Arnd Bergmann

This adds support for the touchscreen on Samsung s3c64xx.
The driver is completely untested but shows roughly how
it could be done, following the example of the at91 driver.

compared to the old plat-samsung/adc driver, there is
no support for prioritizing ts over other clients, nor
for oversampling. From my reading of the code, the
priorities didn't actually have any effect at all, but
the oversampling might be needed.

Verifying this driver is the main issue that is currently
holding up multiplatform support for s3c64xx, so any help
in testing is very much appreciated.

The current version uses the IS_REACHABLE() that is
going to be introduced in the linux-media tree, please
comment this out for testing.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 .../devicetree/bindings/arm/samsung/exynos-adc.txt |   3 +
 drivers/iio/adc/exynos_adc.c                       | 222 ++++++++++++++++++++-
 2 files changed, 218 insertions(+), 7 deletions(-)

diff --git a/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt b/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt
index f46ca9a316a2..ccaaec6014bd 100644
--- a/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt
+++ b/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt
@@ -47,6 +47,9 @@ Required properties:
 
 - samsung,syscon-phandle Contains the PMU system controller node
 			(To access the ADC_PHY register on Exynos5250/5420/5800/3250)
+Optional properties:
+- has-touchscreen:	If present, indicates that a touchscreen is
+			connected an usable.
 
 Note: child nodes can be added for auto probing from device tree.
 
diff --git a/drivers/iio/adc/exynos_adc.c b/drivers/iio/adc/exynos_adc.c
index 3a2dbb3b4926..75cd381a8181 100644
--- a/drivers/iio/adc/exynos_adc.c
+++ b/drivers/iio/adc/exynos_adc.c
@@ -35,6 +35,7 @@
 #include <linux/regulator/consumer.h>
 #include <linux/of_platform.h>
 #include <linux/err.h>
+#include <linux/input.h>
 
 #include <linux/iio/iio.h>
 #include <linux/iio/machine.h>
@@ -42,12 +43,18 @@
 #include <linux/mfd/syscon.h>
 #include <linux/regmap.h>
 
+#include <linux/platform_data/touchscreen-s3c2410.h>
+
 /* S3C/EXYNOS4412/5250 ADC_V1 registers definitions */
 #define ADC_V1_CON(x)		((x) + 0x00)
+#define ADC_V1_TSC(x)		((x) + 0x04)
 #define ADC_V1_DLY(x)		((x) + 0x08)
 #define ADC_V1_DATX(x)		((x) + 0x0C)
+#define ADC_V1_DATY(x)		((x) + 0x10)
+#define ADC_V1_UPDN(x)		((x) + 0x14)
 #define ADC_V1_INTCLR(x)	((x) + 0x18)
 #define ADC_V1_MUX(x)		((x) + 0x1c)
+#define ADC_V1_CLRINTPNDNUP(x)	((x) + 0x20)
 
 /* S3C2410 ADC registers definitions */
 #define ADC_S3C2410_MUX(x)	((x) + 0x18)
@@ -71,6 +78,30 @@
 #define ADC_S3C2410_DATX_MASK	0x3FF
 #define ADC_S3C2416_CON_RES_SEL	(1u << 3)
 
+/* touch screen always uses channel 0 */
+#define ADC_S3C2410_MUX_TS	0
+
+/* ADCTSC Register Bits */
+#define ADC_S3C2443_TSC_UD_SEN		(1u << 8)
+#define ADC_S3C2410_TSC_YM_SEN		(1u << 7)
+#define ADC_S3C2410_TSC_YP_SEN		(1u << 6)
+#define ADC_S3C2410_TSC_XM_SEN		(1u << 5)
+#define ADC_S3C2410_TSC_XP_SEN		(1u << 4)
+#define ADC_S3C2410_TSC_PULL_UP_DISABLE	(1u << 3)
+#define ADC_S3C2410_TSC_AUTO_PST	(1u << 2)
+#define ADC_S3C2410_TSC_XY_PST(x)	(((x) & 0x3) << 0)
+
+#define ADC_TSC_WAIT4INT (ADC_S3C2410_TSC_YM_SEN | \
+			 ADC_S3C2410_TSC_YP_SEN | \
+			 ADC_S3C2410_TSC_XP_SEN | \
+			 ADC_S3C2410_TSC_XY_PST(3))
+
+#define ADC_TSC_AUTOPST	(ADC_S3C2410_TSC_YM_SEN | \
+			 ADC_S3C2410_TSC_YP_SEN | \
+			 ADC_S3C2410_TSC_XP_SEN | \
+			 ADC_S3C2410_TSC_AUTO_PST | \
+			 ADC_S3C2410_TSC_XY_PST(0))
+
 /* Bit definitions for ADC_V2 */
 #define ADC_V2_CON1_SOFT_RESET	(1u << 2)
 
@@ -88,7 +119,9 @@
 /* Bit definitions common for ADC_V1 and ADC_V2 */
 #define ADC_CON_EN_START	(1u << 0)
 #define ADC_CON_EN_START_MASK	(0x3 << 0)
+#define ADC_DATX_PRESSED	(1u << 15)
 #define ADC_DATX_MASK		0xFFF
+#define ADC_DATY_MASK		0xFFF
 
 #define EXYNOS_ADC_TIMEOUT	(msecs_to_jiffies(100))
 
@@ -98,17 +131,24 @@
 struct exynos_adc {
 	struct exynos_adc_data	*data;
 	struct device		*dev;
+	struct input_dev	*input;
 	void __iomem		*regs;
 	struct regmap		*pmu_map;
 	struct clk		*clk;
 	struct clk		*sclk;
 	unsigned int		irq;
+	unsigned int		tsirq;
+	unsigned int		delay;
 	struct regulator	*vdd;
 
 	struct completion	completion;
 
 	u32			value;
 	unsigned int            version;
+
+	bool			read_ts;
+	u32			ts_x;
+	u32			ts_y;
 };
 
 struct exynos_adc_data {
@@ -197,6 +237,9 @@ static void exynos_adc_v1_init_hw(struct exynos_adc *info)
 	/* Enable 12-bit ADC resolution */
 	con1 |= ADC_V1_CON_RES;
 	writel(con1, ADC_V1_CON(info->regs));
+
+	/* set touchscreen delay */
+	writel(info->delay, ADC_V1_DLY(info->regs));
 }
 
 static void exynos_adc_v1_exit_hw(struct exynos_adc *info)
@@ -480,8 +523,8 @@ static int exynos_read_raw(struct iio_dev *indio_dev,
 	if (info->data->start_conv)
 		info->data->start_conv(info, chan->address);
 
-	timeout = wait_for_completion_timeout
-			(&info->completion, EXYNOS_ADC_TIMEOUT);
+	timeout = wait_for_completion_timeout(&info->completion,
+					      EXYNOS_ADC_TIMEOUT);
 	if (timeout == 0) {
 		dev_warn(&indio_dev->dev, "Conversion timed out! Resetting\n");
 		if (info->data->init_hw)
@@ -498,13 +541,55 @@ static int exynos_read_raw(struct iio_dev *indio_dev,
 	return ret;
 }
 
+static int exynos_read_s3c64xx_ts(struct iio_dev *indio_dev, int *x, int *y)
+{
+	struct exynos_adc *info = iio_priv(indio_dev);
+	unsigned long timeout;
+	int ret;
+
+	mutex_lock(&indio_dev->mlock);
+	info->read_ts = true;
+
+	reinit_completion(&info->completion);
+
+	writel(ADC_S3C2410_TSC_PULL_UP_DISABLE | ADC_TSC_AUTOPST,
+	       ADC_V1_TSC(info->regs));
+
+	/* Select the ts channel to be used and Trigger conversion */
+	info->data->start_conv(info, ADC_S3C2410_MUX_TS);
+
+	timeout = wait_for_completion_timeout(&info->completion,
+					      EXYNOS_ADC_TIMEOUT);
+	if (timeout == 0) {
+		dev_warn(&indio_dev->dev, "Conversion timed out! Resetting\n");
+		if (info->data->init_hw)
+			info->data->init_hw(info);
+		ret = -ETIMEDOUT;
+	} else {
+		*x = info->ts_x;
+		*y = info->ts_y;
+		ret = 0;
+	}
+
+	info->read_ts = false;
+	mutex_unlock(&indio_dev->mlock);
+
+	return ret;
+}
+
 static irqreturn_t exynos_adc_isr(int irq, void *dev_id)
 {
 	struct exynos_adc *info = (struct exynos_adc *)dev_id;
 	u32 mask = info->data->mask;
 
 	/* Read value */
-	info->value = readl(ADC_V1_DATX(info->regs)) & mask;
+	if (info->read_ts) {
+		info->ts_x = readl(ADC_V1_DATX(info->regs));
+		info->ts_y = readl(ADC_V1_DATY(info->regs));
+		writel(ADC_TSC_WAIT4INT | ADC_S3C2443_TSC_UD_SEN, ADC_V1_TSC(info->regs));
+	} else {
+		info->value = readl(ADC_V1_DATX(info->regs)) & mask;
+	}
 
 	/* clear irq */
 	if (info->data->clear_irq)
@@ -515,6 +600,46 @@ static irqreturn_t exynos_adc_isr(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
+/*
+ * Here we (ab)use a threaded interrupt handler to stay running
+ * for as long as the touchscreen remains pressed, we report
+ * a new event with the latest data and then sleep until the
+ * next timer tick. This mirrors the behavior of the old
+ * driver, with much less code.
+ */
+static irqreturn_t exynos_ts_isr(int irq, void *dev_id)
+{
+	struct exynos_adc *info = dev_id;
+	struct iio_dev *dev = dev_get_drvdata(info->dev);
+	u32 x, y;
+	bool pressed;
+	int ret;
+
+	while (info->input->users) {
+		ret = exynos_read_s3c64xx_ts(dev, &x, &y);
+		if (ret == -ETIMEDOUT)
+			break;
+
+		pressed = x & y & ADC_DATX_PRESSED;
+		if (!pressed) {
+			input_report_key(info->input, BTN_TOUCH, 0);
+			input_sync(info->input);
+			break;
+		}
+
+		input_report_abs(info->input, ABS_X, x & ADC_DATX_MASK);
+		input_report_abs(info->input, ABS_Y, y & ADC_DATY_MASK);
+		input_report_key(info->input, BTN_TOUCH, 1);
+		input_sync(info->input);
+
+		msleep(1);
+	};
+
+	writel(0, ADC_V1_CLRINTPNDNUP(info->regs));
+
+	return IRQ_HANDLED;
+}
+
 static int exynos_adc_reg_access(struct iio_dev *indio_dev,
 			      unsigned reg, unsigned writeval,
 			      unsigned *readval)
@@ -566,18 +691,70 @@ static int exynos_adc_remove_devices(struct device *dev, void *c)
 	return 0;
 }
 
+static int exynos_adc_ts_open(struct input_dev *dev)
+{
+	struct exynos_adc *info = input_get_drvdata(dev);
+
+	enable_irq(info->tsirq);
+
+	return 0;
+}
+
+static void exynos_adc_ts_close(struct input_dev *dev)
+{
+	struct exynos_adc *info = input_get_drvdata(dev);
+
+	disable_irq(info->tsirq);
+}
+
+static int exynos_adc_ts_init(struct exynos_adc *info)
+{
+	int ret;
+
+	if (info->tsirq <= 0)
+		return -ENODEV;
+
+	info->input = input_allocate_device();
+	if (!info->input)
+		return -ENOMEM;
+
+	info->input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
+	info->input->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
+
+	input_set_abs_params(info->input, ABS_X, 0, 0x3FF, 0, 0);
+	input_set_abs_params(info->input, ABS_Y, 0, 0x3FF, 0, 0);
+
+	info->input->name = "S3C24xx TouchScreen";
+	info->input->id.bustype = BUS_HOST;
+	info->input->open = exynos_adc_ts_open;
+	info->input->close = exynos_adc_ts_close;
+
+	input_set_drvdata(info->input, info);
+
+	ret = input_register_device(info->input);
+	if (ret)
+		input_free_device(info->input);
+
+	disable_irq(info->tsirq);
+	ret = request_threaded_irq(info->tsirq, NULL, exynos_ts_isr,
+				   0, "touchscreen", info);
+	if (ret)
+		input_unregister_device(info->input);
+
+	return ret;
+}
+
 static int exynos_adc_probe(struct platform_device *pdev)
 {
 	struct exynos_adc *info = NULL;
 	struct device_node *np = pdev->dev.of_node;
+	struct s3c2410_ts_mach_info *pdata = dev_get_platdata(&pdev->dev);
 	struct iio_dev *indio_dev = NULL;
 	struct resource	*mem;
+	bool has_ts = false;
 	int ret = -ENODEV;
 	int irq;
 
-	if (!np)
-		return ret;
-
 	indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(struct exynos_adc));
 	if (!indio_dev) {
 		dev_err(&pdev->dev, "failed allocating iio device\n");
@@ -613,8 +790,14 @@ static int exynos_adc_probe(struct platform_device *pdev)
 		dev_err(&pdev->dev, "no irq resource?\n");
 		return irq;
 	}
-
 	info->irq = irq;
+
+	irq = platform_get_irq(pdev, 1);
+	if (irq == -EPROBE_DEFER)
+		return irq;
+
+	info->tsirq = irq;
+
 	info->dev = &pdev->dev;
 
 	init_completion(&info->completion);
@@ -680,6 +863,22 @@ static int exynos_adc_probe(struct platform_device *pdev)
 	if (info->data->init_hw)
 		info->data->init_hw(info);
 
+	/* leave out any TS related code if unreachable */
+	if (IS_REACHABLE(CONFIG_INPUT)) {
+		has_ts = of_property_read_bool(pdev->dev.of_node,
+					       "has-touchscreen") || pdata;
+	}
+
+	if (pdata)
+		info->delay = pdata->delay;
+	else
+		info->delay = 10000;
+
+	if (has_ts)
+		ret = exynos_adc_ts_init(info);
+	if (ret)
+		goto err_iio;
+
 	ret = of_platform_populate(np, exynos_adc_match, NULL, &indio_dev->dev);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "failed adding child nodes\n");
@@ -691,6 +890,11 @@ static int exynos_adc_probe(struct platform_device *pdev)
 err_of_populate:
 	device_for_each_child(&indio_dev->dev, NULL,
 				exynos_adc_remove_devices);
+	if (has_ts) {
+		input_unregister_device(info->input);
+		free_irq(info->tsirq, info);
+	}
+err_iio:
 	iio_device_unregister(indio_dev);
 err_irq:
 	free_irq(info->irq, info);
@@ -710,6 +914,10 @@ static int exynos_adc_remove(struct platform_device *pdev)
 	struct iio_dev *indio_dev = platform_get_drvdata(pdev);
 	struct exynos_adc *info = iio_priv(indio_dev);
 
+	if (IS_REACHABLE(CONFIG_INPUT)) {
+		free_irq(info->tsirq, info);
+		input_unregister_device(info->input);
+	}
 	device_for_each_child(&indio_dev->dev, NULL,
 				exynos_adc_remove_devices);
 	iio_device_unregister(indio_dev);
-- 
2.1.0.rc2

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

* [PATCH 06/10] iio: exynos-adc: add experimental touchscreen support
@ 2015-03-02 12:35   ` Arnd Bergmann
  0 siblings, 0 replies; 60+ messages in thread
From: Arnd Bergmann @ 2015-03-02 12:35 UTC (permalink / raw)
  To: linux-arm-kernel

This adds support for the touchscreen on Samsung s3c64xx.
The driver is completely untested but shows roughly how
it could be done, following the example of the at91 driver.

compared to the old plat-samsung/adc driver, there is
no support for prioritizing ts over other clients, nor
for oversampling. From my reading of the code, the
priorities didn't actually have any effect at all, but
the oversampling might be needed.

Verifying this driver is the main issue that is currently
holding up multiplatform support for s3c64xx, so any help
in testing is very much appreciated.

The current version uses the IS_REACHABLE() that is
going to be introduced in the linux-media tree, please
comment this out for testing.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 .../devicetree/bindings/arm/samsung/exynos-adc.txt |   3 +
 drivers/iio/adc/exynos_adc.c                       | 222 ++++++++++++++++++++-
 2 files changed, 218 insertions(+), 7 deletions(-)

diff --git a/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt b/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt
index f46ca9a316a2..ccaaec6014bd 100644
--- a/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt
+++ b/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt
@@ -47,6 +47,9 @@ Required properties:
 
 - samsung,syscon-phandle Contains the PMU system controller node
 			(To access the ADC_PHY register on Exynos5250/5420/5800/3250)
+Optional properties:
+- has-touchscreen:	If present, indicates that a touchscreen is
+			connected an usable.
 
 Note: child nodes can be added for auto probing from device tree.
 
diff --git a/drivers/iio/adc/exynos_adc.c b/drivers/iio/adc/exynos_adc.c
index 3a2dbb3b4926..75cd381a8181 100644
--- a/drivers/iio/adc/exynos_adc.c
+++ b/drivers/iio/adc/exynos_adc.c
@@ -35,6 +35,7 @@
 #include <linux/regulator/consumer.h>
 #include <linux/of_platform.h>
 #include <linux/err.h>
+#include <linux/input.h>
 
 #include <linux/iio/iio.h>
 #include <linux/iio/machine.h>
@@ -42,12 +43,18 @@
 #include <linux/mfd/syscon.h>
 #include <linux/regmap.h>
 
+#include <linux/platform_data/touchscreen-s3c2410.h>
+
 /* S3C/EXYNOS4412/5250 ADC_V1 registers definitions */
 #define ADC_V1_CON(x)		((x) + 0x00)
+#define ADC_V1_TSC(x)		((x) + 0x04)
 #define ADC_V1_DLY(x)		((x) + 0x08)
 #define ADC_V1_DATX(x)		((x) + 0x0C)
+#define ADC_V1_DATY(x)		((x) + 0x10)
+#define ADC_V1_UPDN(x)		((x) + 0x14)
 #define ADC_V1_INTCLR(x)	((x) + 0x18)
 #define ADC_V1_MUX(x)		((x) + 0x1c)
+#define ADC_V1_CLRINTPNDNUP(x)	((x) + 0x20)
 
 /* S3C2410 ADC registers definitions */
 #define ADC_S3C2410_MUX(x)	((x) + 0x18)
@@ -71,6 +78,30 @@
 #define ADC_S3C2410_DATX_MASK	0x3FF
 #define ADC_S3C2416_CON_RES_SEL	(1u << 3)
 
+/* touch screen always uses channel 0 */
+#define ADC_S3C2410_MUX_TS	0
+
+/* ADCTSC Register Bits */
+#define ADC_S3C2443_TSC_UD_SEN		(1u << 8)
+#define ADC_S3C2410_TSC_YM_SEN		(1u << 7)
+#define ADC_S3C2410_TSC_YP_SEN		(1u << 6)
+#define ADC_S3C2410_TSC_XM_SEN		(1u << 5)
+#define ADC_S3C2410_TSC_XP_SEN		(1u << 4)
+#define ADC_S3C2410_TSC_PULL_UP_DISABLE	(1u << 3)
+#define ADC_S3C2410_TSC_AUTO_PST	(1u << 2)
+#define ADC_S3C2410_TSC_XY_PST(x)	(((x) & 0x3) << 0)
+
+#define ADC_TSC_WAIT4INT (ADC_S3C2410_TSC_YM_SEN | \
+			 ADC_S3C2410_TSC_YP_SEN | \
+			 ADC_S3C2410_TSC_XP_SEN | \
+			 ADC_S3C2410_TSC_XY_PST(3))
+
+#define ADC_TSC_AUTOPST	(ADC_S3C2410_TSC_YM_SEN | \
+			 ADC_S3C2410_TSC_YP_SEN | \
+			 ADC_S3C2410_TSC_XP_SEN | \
+			 ADC_S3C2410_TSC_AUTO_PST | \
+			 ADC_S3C2410_TSC_XY_PST(0))
+
 /* Bit definitions for ADC_V2 */
 #define ADC_V2_CON1_SOFT_RESET	(1u << 2)
 
@@ -88,7 +119,9 @@
 /* Bit definitions common for ADC_V1 and ADC_V2 */
 #define ADC_CON_EN_START	(1u << 0)
 #define ADC_CON_EN_START_MASK	(0x3 << 0)
+#define ADC_DATX_PRESSED	(1u << 15)
 #define ADC_DATX_MASK		0xFFF
+#define ADC_DATY_MASK		0xFFF
 
 #define EXYNOS_ADC_TIMEOUT	(msecs_to_jiffies(100))
 
@@ -98,17 +131,24 @@
 struct exynos_adc {
 	struct exynos_adc_data	*data;
 	struct device		*dev;
+	struct input_dev	*input;
 	void __iomem		*regs;
 	struct regmap		*pmu_map;
 	struct clk		*clk;
 	struct clk		*sclk;
 	unsigned int		irq;
+	unsigned int		tsirq;
+	unsigned int		delay;
 	struct regulator	*vdd;
 
 	struct completion	completion;
 
 	u32			value;
 	unsigned int            version;
+
+	bool			read_ts;
+	u32			ts_x;
+	u32			ts_y;
 };
 
 struct exynos_adc_data {
@@ -197,6 +237,9 @@ static void exynos_adc_v1_init_hw(struct exynos_adc *info)
 	/* Enable 12-bit ADC resolution */
 	con1 |= ADC_V1_CON_RES;
 	writel(con1, ADC_V1_CON(info->regs));
+
+	/* set touchscreen delay */
+	writel(info->delay, ADC_V1_DLY(info->regs));
 }
 
 static void exynos_adc_v1_exit_hw(struct exynos_adc *info)
@@ -480,8 +523,8 @@ static int exynos_read_raw(struct iio_dev *indio_dev,
 	if (info->data->start_conv)
 		info->data->start_conv(info, chan->address);
 
-	timeout = wait_for_completion_timeout
-			(&info->completion, EXYNOS_ADC_TIMEOUT);
+	timeout = wait_for_completion_timeout(&info->completion,
+					      EXYNOS_ADC_TIMEOUT);
 	if (timeout == 0) {
 		dev_warn(&indio_dev->dev, "Conversion timed out! Resetting\n");
 		if (info->data->init_hw)
@@ -498,13 +541,55 @@ static int exynos_read_raw(struct iio_dev *indio_dev,
 	return ret;
 }
 
+static int exynos_read_s3c64xx_ts(struct iio_dev *indio_dev, int *x, int *y)
+{
+	struct exynos_adc *info = iio_priv(indio_dev);
+	unsigned long timeout;
+	int ret;
+
+	mutex_lock(&indio_dev->mlock);
+	info->read_ts = true;
+
+	reinit_completion(&info->completion);
+
+	writel(ADC_S3C2410_TSC_PULL_UP_DISABLE | ADC_TSC_AUTOPST,
+	       ADC_V1_TSC(info->regs));
+
+	/* Select the ts channel to be used and Trigger conversion */
+	info->data->start_conv(info, ADC_S3C2410_MUX_TS);
+
+	timeout = wait_for_completion_timeout(&info->completion,
+					      EXYNOS_ADC_TIMEOUT);
+	if (timeout == 0) {
+		dev_warn(&indio_dev->dev, "Conversion timed out! Resetting\n");
+		if (info->data->init_hw)
+			info->data->init_hw(info);
+		ret = -ETIMEDOUT;
+	} else {
+		*x = info->ts_x;
+		*y = info->ts_y;
+		ret = 0;
+	}
+
+	info->read_ts = false;
+	mutex_unlock(&indio_dev->mlock);
+
+	return ret;
+}
+
 static irqreturn_t exynos_adc_isr(int irq, void *dev_id)
 {
 	struct exynos_adc *info = (struct exynos_adc *)dev_id;
 	u32 mask = info->data->mask;
 
 	/* Read value */
-	info->value = readl(ADC_V1_DATX(info->regs)) & mask;
+	if (info->read_ts) {
+		info->ts_x = readl(ADC_V1_DATX(info->regs));
+		info->ts_y = readl(ADC_V1_DATY(info->regs));
+		writel(ADC_TSC_WAIT4INT | ADC_S3C2443_TSC_UD_SEN, ADC_V1_TSC(info->regs));
+	} else {
+		info->value = readl(ADC_V1_DATX(info->regs)) & mask;
+	}
 
 	/* clear irq */
 	if (info->data->clear_irq)
@@ -515,6 +600,46 @@ static irqreturn_t exynos_adc_isr(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
+/*
+ * Here we (ab)use a threaded interrupt handler to stay running
+ * for as long as the touchscreen remains pressed, we report
+ * a new event with the latest data and then sleep until the
+ * next timer tick. This mirrors the behavior of the old
+ * driver, with much less code.
+ */
+static irqreturn_t exynos_ts_isr(int irq, void *dev_id)
+{
+	struct exynos_adc *info = dev_id;
+	struct iio_dev *dev = dev_get_drvdata(info->dev);
+	u32 x, y;
+	bool pressed;
+	int ret;
+
+	while (info->input->users) {
+		ret = exynos_read_s3c64xx_ts(dev, &x, &y);
+		if (ret == -ETIMEDOUT)
+			break;
+
+		pressed = x & y & ADC_DATX_PRESSED;
+		if (!pressed) {
+			input_report_key(info->input, BTN_TOUCH, 0);
+			input_sync(info->input);
+			break;
+		}
+
+		input_report_abs(info->input, ABS_X, x & ADC_DATX_MASK);
+		input_report_abs(info->input, ABS_Y, y & ADC_DATY_MASK);
+		input_report_key(info->input, BTN_TOUCH, 1);
+		input_sync(info->input);
+
+		msleep(1);
+	};
+
+	writel(0, ADC_V1_CLRINTPNDNUP(info->regs));
+
+	return IRQ_HANDLED;
+}
+
 static int exynos_adc_reg_access(struct iio_dev *indio_dev,
 			      unsigned reg, unsigned writeval,
 			      unsigned *readval)
@@ -566,18 +691,70 @@ static int exynos_adc_remove_devices(struct device *dev, void *c)
 	return 0;
 }
 
+static int exynos_adc_ts_open(struct input_dev *dev)
+{
+	struct exynos_adc *info = input_get_drvdata(dev);
+
+	enable_irq(info->tsirq);
+
+	return 0;
+}
+
+static void exynos_adc_ts_close(struct input_dev *dev)
+{
+	struct exynos_adc *info = input_get_drvdata(dev);
+
+	disable_irq(info->tsirq);
+}
+
+static int exynos_adc_ts_init(struct exynos_adc *info)
+{
+	int ret;
+
+	if (info->tsirq <= 0)
+		return -ENODEV;
+
+	info->input = input_allocate_device();
+	if (!info->input)
+		return -ENOMEM;
+
+	info->input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
+	info->input->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
+
+	input_set_abs_params(info->input, ABS_X, 0, 0x3FF, 0, 0);
+	input_set_abs_params(info->input, ABS_Y, 0, 0x3FF, 0, 0);
+
+	info->input->name = "S3C24xx TouchScreen";
+	info->input->id.bustype = BUS_HOST;
+	info->input->open = exynos_adc_ts_open;
+	info->input->close = exynos_adc_ts_close;
+
+	input_set_drvdata(info->input, info);
+
+	ret = input_register_device(info->input);
+	if (ret)
+		input_free_device(info->input);
+
+	disable_irq(info->tsirq);
+	ret = request_threaded_irq(info->tsirq, NULL, exynos_ts_isr,
+				   0, "touchscreen", info);
+	if (ret)
+		input_unregister_device(info->input);
+
+	return ret;
+}
+
 static int exynos_adc_probe(struct platform_device *pdev)
 {
 	struct exynos_adc *info = NULL;
 	struct device_node *np = pdev->dev.of_node;
+	struct s3c2410_ts_mach_info *pdata = dev_get_platdata(&pdev->dev);
 	struct iio_dev *indio_dev = NULL;
 	struct resource	*mem;
+	bool has_ts = false;
 	int ret = -ENODEV;
 	int irq;
 
-	if (!np)
-		return ret;
-
 	indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(struct exynos_adc));
 	if (!indio_dev) {
 		dev_err(&pdev->dev, "failed allocating iio device\n");
@@ -613,8 +790,14 @@ static int exynos_adc_probe(struct platform_device *pdev)
 		dev_err(&pdev->dev, "no irq resource?\n");
 		return irq;
 	}
-
 	info->irq = irq;
+
+	irq = platform_get_irq(pdev, 1);
+	if (irq == -EPROBE_DEFER)
+		return irq;
+
+	info->tsirq = irq;
+
 	info->dev = &pdev->dev;
 
 	init_completion(&info->completion);
@@ -680,6 +863,22 @@ static int exynos_adc_probe(struct platform_device *pdev)
 	if (info->data->init_hw)
 		info->data->init_hw(info);
 
+	/* leave out any TS related code if unreachable */
+	if (IS_REACHABLE(CONFIG_INPUT)) {
+		has_ts = of_property_read_bool(pdev->dev.of_node,
+					       "has-touchscreen") || pdata;
+	}
+
+	if (pdata)
+		info->delay = pdata->delay;
+	else
+		info->delay = 10000;
+
+	if (has_ts)
+		ret = exynos_adc_ts_init(info);
+	if (ret)
+		goto err_iio;
+
 	ret = of_platform_populate(np, exynos_adc_match, NULL, &indio_dev->dev);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "failed adding child nodes\n");
@@ -691,6 +890,11 @@ static int exynos_adc_probe(struct platform_device *pdev)
 err_of_populate:
 	device_for_each_child(&indio_dev->dev, NULL,
 				exynos_adc_remove_devices);
+	if (has_ts) {
+		input_unregister_device(info->input);
+		free_irq(info->tsirq, info);
+	}
+err_iio:
 	iio_device_unregister(indio_dev);
 err_irq:
 	free_irq(info->irq, info);
@@ -710,6 +914,10 @@ static int exynos_adc_remove(struct platform_device *pdev)
 	struct iio_dev *indio_dev = platform_get_drvdata(pdev);
 	struct exynos_adc *info = iio_priv(indio_dev);
 
+	if (IS_REACHABLE(CONFIG_INPUT)) {
+		free_irq(info->tsirq, info);
+		input_unregister_device(info->input);
+	}
 	device_for_each_child(&indio_dev->dev, NULL,
 				exynos_adc_remove_devices);
 	iio_device_unregister(indio_dev);
-- 
2.1.0.rc2

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

* [PATCH 07/10] ARM: s3c64xx: use new adc/touchscreen driver
  2015-03-02 12:35 ` Arnd Bergmann
@ 2015-03-02 12:36   ` Arnd Bergmann
  -1 siblings, 0 replies; 60+ messages in thread
From: Arnd Bergmann @ 2015-03-02 12:36 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Kukjin Kim, linux-samsung-soc, Maurus Cuelenaere, Mark Brown,
	Liam Girdwood, dmitry.torokhov, ch.naveen, a.kesavan, cw00.choi,
	jic23, Tomasz Figa, padma.v, Arnd Bergmann

The old ADC and touchscreen drivers are not compatible with
multiplatform support, but we can use the exynos-adc driver
as a replacement.

This changes the common device creation functions for s3c64xx
(but not s3c24xx for now) to use the new driver. To do this,
we have to pass the interrupt resources in the opposite order
and pass the platform data in the adc device node.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-s3c64xx/mach-mini6410.c             |  3 +--
 arch/arm/mach-s3c64xx/mach-real6410.c             |  3 +--
 arch/arm/mach-s3c64xx/mach-smartq.c               |  3 +--
 arch/arm/mach-s3c64xx/mach-smdk6410.c             |  3 +--
 arch/arm/plat-samsung/devs.c                      | 22 +++++-----------------
 include/linux/platform_data/touchscreen-s3c2410.h |  1 +
 6 files changed, 10 insertions(+), 25 deletions(-)

diff --git a/arch/arm/mach-s3c64xx/mach-mini6410.c b/arch/arm/mach-s3c64xx/mach-mini6410.c
index 3ce5842ed51b..ae999fb3fe6d 100644
--- a/arch/arm/mach-s3c64xx/mach-mini6410.c
+++ b/arch/arm/mach-s3c64xx/mach-mini6410.c
@@ -234,7 +234,6 @@ static struct platform_device *mini6410_devices[] __initdata = {
 	&s3c_device_fb,
 	&mini6410_lcd_powerdev,
 	&s3c_device_adc,
-	&s3c_device_ts,
 };
 
 static void __init mini6410_map_io(void)
@@ -333,7 +332,7 @@ static void __init mini6410_machine_init(void)
 	s3c_nand_set_platdata(&mini6410_nand_info);
 	s3c_fb_set_platdata(&mini6410_lcd_pdata[features.lcd_index]);
 	s3c_sdhci1_set_platdata(&mini6410_hsmmc1_pdata);
-	s3c24xx_ts_set_platdata(NULL);
+	s3c64xx_ts_set_platdata(NULL);
 
 	/* configure nCS1 width to 16 bits */
 
diff --git a/arch/arm/mach-s3c64xx/mach-real6410.c b/arch/arm/mach-s3c64xx/mach-real6410.c
index ca6548a1ed3b..4e240ffa7ac7 100644
--- a/arch/arm/mach-s3c64xx/mach-real6410.c
+++ b/arch/arm/mach-s3c64xx/mach-real6410.c
@@ -203,7 +203,6 @@ static struct platform_device *real6410_devices[] __initdata = {
 	&s3c_device_fb,
 	&s3c_device_nand,
 	&s3c_device_adc,
-	&s3c_device_ts,
 	&s3c_device_ohci,
 };
 
@@ -302,7 +301,7 @@ static void __init real6410_machine_init(void)
 
 	s3c_fb_set_platdata(&real6410_lcd_pdata[features.lcd_index]);
 	s3c_nand_set_platdata(&real6410_nand_info);
-	s3c24xx_ts_set_platdata(NULL);
+	s3c64xx_ts_set_platdata(NULL);
 
 	/* configure nCS1 width to 16 bits */
 
diff --git a/arch/arm/mach-s3c64xx/mach-smartq.c b/arch/arm/mach-s3c64xx/mach-smartq.c
index 327ec1f451e3..59ec4cd92b51 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq.c
@@ -249,7 +249,6 @@ static struct platform_device *smartq_devices[] __initdata = {
 	&s3c_device_ohci,
 	&s3c_device_rtc,
 	&samsung_device_pwm,
-	&s3c_device_ts,
 	&s3c_device_usb_hsotg,
 	&s3c64xx_device_iis0,
 	&smartq_backlight_device,
@@ -396,7 +395,7 @@ void __init smartq_machine_init(void)
 	s3c_hwmon_set_platdata(&smartq_hwmon_pdata);
 	s3c_sdhci1_set_platdata(&smartq_internal_hsmmc_pdata);
 	s3c_sdhci2_set_platdata(&smartq_internal_hsmmc_pdata);
-	s3c24xx_ts_set_platdata(&smartq_touchscreen_pdata);
+	s3c64xx_ts_set_platdata(&smartq_touchscreen_pdata);
 
 	i2c_register_board_info(0, smartq_i2c_devs,
 				ARRAY_SIZE(smartq_i2c_devs));
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6410.c b/arch/arm/mach-s3c64xx/mach-smdk6410.c
index e160eded69e1..c16b90440aa1 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6410.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6410.c
@@ -289,7 +289,6 @@ static struct platform_device *smdk6410_devices[] __initdata = {
 	&s3c_device_adc,
 	&s3c_device_cfcon,
 	&s3c_device_rtc,
-	&s3c_device_ts,
 	&s3c_device_wdt,
 };
 
@@ -664,7 +663,7 @@ static void __init smdk6410_machine_init(void)
 
 	samsung_keypad_set_platdata(&smdk6410_keypad_data);
 
-	s3c24xx_ts_set_platdata(NULL);
+	s3c64xx_ts_set_platdata(NULL);
 
 	/* configure nCS1 width to 16 bits */
 
diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c
index 83c7d154bde0..b0c7857a481c 100644
--- a/arch/arm/plat-samsung/devs.c
+++ b/arch/arm/plat-samsung/devs.c
@@ -111,12 +111,12 @@ struct platform_device s3c_device_adc = {
 #if defined(CONFIG_SAMSUNG_DEV_ADC)
 static struct resource s3c_adc_resource[] = {
 	[0] = DEFINE_RES_MEM(SAMSUNG_PA_ADC, SZ_256),
-	[1] = DEFINE_RES_IRQ(IRQ_TC),
-	[2] = DEFINE_RES_IRQ(IRQ_ADC),
+	[1] = DEFINE_RES_IRQ(IRQ_ADC),
+	[2] = DEFINE_RES_IRQ(IRQ_TC),
 };
 
 struct platform_device s3c_device_adc = {
-	.name		= "samsung-adc",
+	.name		= "exynos-adc",
 	.id		= -1,
 	.num_resources	= ARRAY_SIZE(s3c_adc_resource),
 	.resource	= s3c_adc_resource,
@@ -939,31 +939,19 @@ void __init s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *hard_s3c2410ts_
 #endif /* CONFIG_PLAT_S3C24XX */
 
 #ifdef CONFIG_SAMSUNG_DEV_TS
-static struct resource s3c_ts_resource[] = {
-	[0] = DEFINE_RES_MEM(SAMSUNG_PA_ADC, SZ_256),
-	[1] = DEFINE_RES_IRQ(IRQ_TC),
-};
-
 static struct s3c2410_ts_mach_info default_ts_data __initdata = {
 	.delay			= 10000,
 	.presc			= 49,
 	.oversampling_shift	= 2,
 };
 
-struct platform_device s3c_device_ts = {
-	.name		= "s3c64xx-ts",
-	.id		= -1,
-	.num_resources	= ARRAY_SIZE(s3c_ts_resource),
-	.resource	= s3c_ts_resource,
-};
-
-void __init s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *pd)
+void __init s3c64xx_ts_set_platdata(struct s3c2410_ts_mach_info *pd)
 {
 	if (!pd)
 		pd = &default_ts_data;
 
 	s3c_set_platdata(pd, sizeof(struct s3c2410_ts_mach_info),
-			 &s3c_device_ts);
+			 &s3c_device_adc);
 }
 #endif /* CONFIG_SAMSUNG_DEV_TS */
 
diff --git a/include/linux/platform_data/touchscreen-s3c2410.h b/include/linux/platform_data/touchscreen-s3c2410.h
index 58dc7c5ae63b..71eccaa9835d 100644
--- a/include/linux/platform_data/touchscreen-s3c2410.h
+++ b/include/linux/platform_data/touchscreen-s3c2410.h
@@ -17,6 +17,7 @@ struct s3c2410_ts_mach_info {
 };
 
 extern void s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *);
+extern void s3c64xx_ts_set_platdata(struct s3c2410_ts_mach_info *);
 
 /* defined by architecture to configure gpio */
 extern void s3c24xx_ts_cfg_gpio(struct platform_device *dev);
-- 
2.1.0.rc2

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

* [PATCH 07/10] ARM: s3c64xx: use new adc/touchscreen driver
@ 2015-03-02 12:36   ` Arnd Bergmann
  0 siblings, 0 replies; 60+ messages in thread
From: Arnd Bergmann @ 2015-03-02 12:36 UTC (permalink / raw)
  To: linux-arm-kernel

The old ADC and touchscreen drivers are not compatible with
multiplatform support, but we can use the exynos-adc driver
as a replacement.

This changes the common device creation functions for s3c64xx
(but not s3c24xx for now) to use the new driver. To do this,
we have to pass the interrupt resources in the opposite order
and pass the platform data in the adc device node.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-s3c64xx/mach-mini6410.c             |  3 +--
 arch/arm/mach-s3c64xx/mach-real6410.c             |  3 +--
 arch/arm/mach-s3c64xx/mach-smartq.c               |  3 +--
 arch/arm/mach-s3c64xx/mach-smdk6410.c             |  3 +--
 arch/arm/plat-samsung/devs.c                      | 22 +++++-----------------
 include/linux/platform_data/touchscreen-s3c2410.h |  1 +
 6 files changed, 10 insertions(+), 25 deletions(-)

diff --git a/arch/arm/mach-s3c64xx/mach-mini6410.c b/arch/arm/mach-s3c64xx/mach-mini6410.c
index 3ce5842ed51b..ae999fb3fe6d 100644
--- a/arch/arm/mach-s3c64xx/mach-mini6410.c
+++ b/arch/arm/mach-s3c64xx/mach-mini6410.c
@@ -234,7 +234,6 @@ static struct platform_device *mini6410_devices[] __initdata = {
 	&s3c_device_fb,
 	&mini6410_lcd_powerdev,
 	&s3c_device_adc,
-	&s3c_device_ts,
 };
 
 static void __init mini6410_map_io(void)
@@ -333,7 +332,7 @@ static void __init mini6410_machine_init(void)
 	s3c_nand_set_platdata(&mini6410_nand_info);
 	s3c_fb_set_platdata(&mini6410_lcd_pdata[features.lcd_index]);
 	s3c_sdhci1_set_platdata(&mini6410_hsmmc1_pdata);
-	s3c24xx_ts_set_platdata(NULL);
+	s3c64xx_ts_set_platdata(NULL);
 
 	/* configure nCS1 width to 16 bits */
 
diff --git a/arch/arm/mach-s3c64xx/mach-real6410.c b/arch/arm/mach-s3c64xx/mach-real6410.c
index ca6548a1ed3b..4e240ffa7ac7 100644
--- a/arch/arm/mach-s3c64xx/mach-real6410.c
+++ b/arch/arm/mach-s3c64xx/mach-real6410.c
@@ -203,7 +203,6 @@ static struct platform_device *real6410_devices[] __initdata = {
 	&s3c_device_fb,
 	&s3c_device_nand,
 	&s3c_device_adc,
-	&s3c_device_ts,
 	&s3c_device_ohci,
 };
 
@@ -302,7 +301,7 @@ static void __init real6410_machine_init(void)
 
 	s3c_fb_set_platdata(&real6410_lcd_pdata[features.lcd_index]);
 	s3c_nand_set_platdata(&real6410_nand_info);
-	s3c24xx_ts_set_platdata(NULL);
+	s3c64xx_ts_set_platdata(NULL);
 
 	/* configure nCS1 width to 16 bits */
 
diff --git a/arch/arm/mach-s3c64xx/mach-smartq.c b/arch/arm/mach-s3c64xx/mach-smartq.c
index 327ec1f451e3..59ec4cd92b51 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq.c
@@ -249,7 +249,6 @@ static struct platform_device *smartq_devices[] __initdata = {
 	&s3c_device_ohci,
 	&s3c_device_rtc,
 	&samsung_device_pwm,
-	&s3c_device_ts,
 	&s3c_device_usb_hsotg,
 	&s3c64xx_device_iis0,
 	&smartq_backlight_device,
@@ -396,7 +395,7 @@ void __init smartq_machine_init(void)
 	s3c_hwmon_set_platdata(&smartq_hwmon_pdata);
 	s3c_sdhci1_set_platdata(&smartq_internal_hsmmc_pdata);
 	s3c_sdhci2_set_platdata(&smartq_internal_hsmmc_pdata);
-	s3c24xx_ts_set_platdata(&smartq_touchscreen_pdata);
+	s3c64xx_ts_set_platdata(&smartq_touchscreen_pdata);
 
 	i2c_register_board_info(0, smartq_i2c_devs,
 				ARRAY_SIZE(smartq_i2c_devs));
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6410.c b/arch/arm/mach-s3c64xx/mach-smdk6410.c
index e160eded69e1..c16b90440aa1 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6410.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6410.c
@@ -289,7 +289,6 @@ static struct platform_device *smdk6410_devices[] __initdata = {
 	&s3c_device_adc,
 	&s3c_device_cfcon,
 	&s3c_device_rtc,
-	&s3c_device_ts,
 	&s3c_device_wdt,
 };
 
@@ -664,7 +663,7 @@ static void __init smdk6410_machine_init(void)
 
 	samsung_keypad_set_platdata(&smdk6410_keypad_data);
 
-	s3c24xx_ts_set_platdata(NULL);
+	s3c64xx_ts_set_platdata(NULL);
 
 	/* configure nCS1 width to 16 bits */
 
diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c
index 83c7d154bde0..b0c7857a481c 100644
--- a/arch/arm/plat-samsung/devs.c
+++ b/arch/arm/plat-samsung/devs.c
@@ -111,12 +111,12 @@ struct platform_device s3c_device_adc = {
 #if defined(CONFIG_SAMSUNG_DEV_ADC)
 static struct resource s3c_adc_resource[] = {
 	[0] = DEFINE_RES_MEM(SAMSUNG_PA_ADC, SZ_256),
-	[1] = DEFINE_RES_IRQ(IRQ_TC),
-	[2] = DEFINE_RES_IRQ(IRQ_ADC),
+	[1] = DEFINE_RES_IRQ(IRQ_ADC),
+	[2] = DEFINE_RES_IRQ(IRQ_TC),
 };
 
 struct platform_device s3c_device_adc = {
-	.name		= "samsung-adc",
+	.name		= "exynos-adc",
 	.id		= -1,
 	.num_resources	= ARRAY_SIZE(s3c_adc_resource),
 	.resource	= s3c_adc_resource,
@@ -939,31 +939,19 @@ void __init s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *hard_s3c2410ts_
 #endif /* CONFIG_PLAT_S3C24XX */
 
 #ifdef CONFIG_SAMSUNG_DEV_TS
-static struct resource s3c_ts_resource[] = {
-	[0] = DEFINE_RES_MEM(SAMSUNG_PA_ADC, SZ_256),
-	[1] = DEFINE_RES_IRQ(IRQ_TC),
-};
-
 static struct s3c2410_ts_mach_info default_ts_data __initdata = {
 	.delay			= 10000,
 	.presc			= 49,
 	.oversampling_shift	= 2,
 };
 
-struct platform_device s3c_device_ts = {
-	.name		= "s3c64xx-ts",
-	.id		= -1,
-	.num_resources	= ARRAY_SIZE(s3c_ts_resource),
-	.resource	= s3c_ts_resource,
-};
-
-void __init s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *pd)
+void __init s3c64xx_ts_set_platdata(struct s3c2410_ts_mach_info *pd)
 {
 	if (!pd)
 		pd = &default_ts_data;
 
 	s3c_set_platdata(pd, sizeof(struct s3c2410_ts_mach_info),
-			 &s3c_device_ts);
+			 &s3c_device_adc);
 }
 #endif /* CONFIG_SAMSUNG_DEV_TS */
 
diff --git a/include/linux/platform_data/touchscreen-s3c2410.h b/include/linux/platform_data/touchscreen-s3c2410.h
index 58dc7c5ae63b..71eccaa9835d 100644
--- a/include/linux/platform_data/touchscreen-s3c2410.h
+++ b/include/linux/platform_data/touchscreen-s3c2410.h
@@ -17,6 +17,7 @@ struct s3c2410_ts_mach_info {
 };
 
 extern void s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *);
+extern void s3c64xx_ts_set_platdata(struct s3c2410_ts_mach_info *);
 
 /* defined by architecture to configure gpio */
 extern void s3c24xx_ts_cfg_gpio(struct platform_device *dev);
-- 
2.1.0.rc2

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

* [PATCH 08/10] ARM: s3c64xx: use common debug-ll implementation
  2015-03-02 12:35 ` Arnd Bergmann
@ 2015-03-02 12:36   ` Arnd Bergmann
  -1 siblings, 0 replies; 60+ messages in thread
From: Arnd Bergmann @ 2015-03-02 12:36 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Kukjin Kim, linux-samsung-soc, Maurus Cuelenaere, Mark Brown,
	Liam Girdwood, dmitry.torokhov, ch.naveen, a.kesavan, cw00.choi,
	jic23, Tomasz Figa, padma.v, Arnd Bergmann

The uart on s3c64xx is essentially the same as on s3c24xx,
so we can share a single assembler file. However, the addresses
are different, and we need to add the respective Kconfig magic
to get the right addresses.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/Kconfig.debug                           | 19 +++++++++++-
 arch/arm/mach-s3c64xx/include/mach/debug-macro.S | 38 ------------------------
 2 files changed, 18 insertions(+), 39 deletions(-)
 delete mode 100644 arch/arm/mach-s3c64xx/include/mach/debug-macro.S

diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 970de7518341..7af848b0f615 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -846,6 +846,7 @@ choice
 		depends on PLAT_SAMSUNG
 		select DEBUG_EXYNOS_UART if ARCH_EXYNOS
 		select DEBUG_S3C24XX_UART if ARCH_S3C24XX
+		select DEBUG_S3C64XX_UART if ARCH_S3C64XX
 		select DEBUG_S5PV210_UART if ARCH_S5PV210
 		bool "Use Samsung S3C UART 0 for low-level debug"
 		help
@@ -857,6 +858,7 @@ choice
 		depends on PLAT_SAMSUNG
 		select DEBUG_EXYNOS_UART if ARCH_EXYNOS
 		select DEBUG_S3C24XX_UART if ARCH_S3C24XX
+		select DEBUG_S3C64XX_UART if ARCH_S3C64XX
 		select DEBUG_S5PV210_UART if ARCH_S5PV210
 		bool "Use Samsung S3C UART 1 for low-level debug"
 		help
@@ -868,6 +870,7 @@ choice
 		depends on PLAT_SAMSUNG
 		select DEBUG_EXYNOS_UART if ARCH_EXYNOS
 		select DEBUG_S3C24XX_UART if ARCH_S3C24XX
+		select DEBUG_S3C64XX_UART if ARCH_S3C64XX
 		select DEBUG_S5PV210_UART if ARCH_S5PV210
 		bool "Use Samsung S3C UART 2 for low-level debug"
 		help
@@ -878,6 +881,7 @@ choice
 	config DEBUG_S3C_UART3
 		depends on PLAT_SAMSUNG && (ARCH_EXYNOS || ARCH_S5PV210)
 		select DEBUG_EXYNOS_UART if ARCH_EXYNOS
+		select DEBUG_S3C64XX_UART if ARCH_S3C64XX
 		select DEBUG_S5PV210_UART if ARCH_S5PV210
 		bool "Use Samsung S3C UART 3 for low-level debug"
 		help
@@ -1225,6 +1229,9 @@ config DEBUG_S3C2410_UART
 config DEBUG_S3C24XX_UART
 	bool
 
+config DEBUG_S3C64XX_UART
+	bool
+
 config DEBUG_S5PV210_UART
 	bool
 
@@ -1306,7 +1313,7 @@ config DEBUG_LL_INCLUDE
 	default "debug/renesas-scif.S" if DEBUG_RMOBILE_SCIFA0
 	default "debug/renesas-scif.S" if DEBUG_RMOBILE_SCIFA1
 	default "debug/renesas-scif.S" if DEBUG_RMOBILE_SCIFA4
-	default "debug/s3c24xx.S" if DEBUG_S3C24XX_UART
+	default "debug/s3c24xx.S" if DEBUG_S3C24XX_UART || DEBUG_S3C64XX_UART
 	default "debug/s5pv210.S" if DEBUG_S5PV210_UART
 	default "debug/sirf.S" if DEBUG_SIRFSOC_UART
 	default "debug/sti.S" if DEBUG_STI_UART
@@ -1382,6 +1389,10 @@ config DEBUG_UART_PHYS
 				DEBUG_S3C2410_UART2)
 	default 0x78000000 if DEBUG_CNS3XXX
 	default 0x7c0003f8 if FOOTBRIDGE
+	default 0x7f005000 if DEBUG_S3C64XX_UART && DEBUG_S3C_UART0
+	default 0x7f005400 if DEBUG_S3C64XX_UART && DEBUG_S3C_UART1
+	default 0x7f005800 if DEBUG_S3C64XX_UART && DEBUG_S3C_UART2
+	default 0x7f005c00 if DEBUG_S3C64XX_UART && DEBUG_S3C_UART3
 	default 0x80010000 if DEBUG_ASM9260_UART
 	default 0x80070000 if DEBUG_IMX23_UART
 	default 0x80074000 if DEBUG_IMX28_UART
@@ -1439,6 +1450,7 @@ config DEBUG_UART_PHYS
 		DEBUG_RCAR_GEN2_SCIF0 || DEBUG_RCAR_GEN2_SCIF2 || \
 		DEBUG_RMOBILE_SCIFA0 || DEBUG_RMOBILE_SCIFA1 || \
 		DEBUG_RMOBILE_SCIFA4 || DEBUG_S3C24XX_UART || \
+		DEBUG_S3C64XX_UART || \
 		DEBUG_UART_BCM63XX || DEBUG_ASM9260_UART || \
 		DEBUG_SIRFSOC_UART || DEBUG_DIGICOLOR_UA0
 
@@ -1464,8 +1476,12 @@ config DEBUG_UART_VIRT
 	default 0xf4090000 if ARCH_LPC32XX
 	default 0xf4200000 if ARCH_GEMINI
 	default 0xf7000000 if DEBUG_SUN9I_UART0
+	default 0xf7000000 if DEBUG_S3C64XX_UART && DEBUG_S3C_UART0
 	default 0xf7000000 if DEBUG_S3C24XX_UART && (DEBUG_S3C_UART0 || \
 				DEBUG_S3C2410_UART0)
+	default 0xf7000400 if DEBUG_S3C64XX_UART && DEBUG_S3C_UART1
+	default 0xf7000800 if DEBUG_S3C64XX_UART && DEBUG_S3C_UART2
+	default 0xf7000c00 if DEBUG_S3C64XX_UART && DEBUG_S3C_UART3
 	default 0xf7004000 if DEBUG_S3C24XX_UART && (DEBUG_S3C_UART1 || \
 				DEBUG_S3C2410_UART1)
 	default 0xf7008000 if DEBUG_S3C24XX_UART && (DEBUG_S3C_UART2 || \
@@ -1528,6 +1544,7 @@ config DEBUG_UART_VIRT
 		DEBUG_UART_8250 || DEBUG_UART_PL01X || DEBUG_MESON_UARTAO || \
 		DEBUG_MSM_UART || DEBUG_NETX_UART || \
 		DEBUG_QCOM_UARTDM || DEBUG_S3C24XX_UART || \
+		DEBUG_S3C64XX_UART || \
 		DEBUG_UART_BCM63XX || DEBUG_ASM9260_UART || \
 		DEBUG_SIRFSOC_UART || DEBUG_DIGICOLOR_UA0
 
diff --git a/arch/arm/mach-s3c64xx/include/mach/debug-macro.S b/arch/arm/mach-s3c64xx/include/mach/debug-macro.S
deleted file mode 100644
index c9b95325b672..000000000000
--- a/arch/arm/mach-s3c64xx/include/mach/debug-macro.S
+++ /dev/null
@@ -1,38 +0,0 @@
-/* arch/arm/mach-s3c6400/include/mach/debug-macro.S
- *
- * Copyright 2008 Openmoko, Inc.
- * Copyright 2008 Simtec Electronics
- *	http://armlinux.simtec.co.uk/
- *	Ben Dooks <ben@simtec.co.uk>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
-*/
-
-/* pull in the relevant register and map files. */
-
-#include <linux/serial_s3c.h>
-#include <mach/map.h>
-
-	/* note, for the boot process to work we have to keep the UART
-	 * virtual address aligned to an 1MiB boundary for the L1
-	 * mapping the head code makes. We keep the UART virtual address
-	 * aligned and add in the offset when we load the value here.
-	 */
-
-	.macro addruart, rp, rv, tmp
-		ldr	\rp, = S3C_PA_UART
-		ldr	\rv, = (S3C_VA_UART + S3C_PA_UART & 0xfffff)
-#if CONFIG_DEBUG_S3C_UART != 0
-		add	\rp, \rp, #(0x400 * CONFIG_DEBUG_S3C_UART)
-		add	\rv, \rv, #(0x400 * CONFIG_DEBUG_S3C_UART)
-#endif
-	.endm
-
-/* include the reset of the code which will do the work, we're only
- * compiling for a single cpu processor type so the default of s3c2440
- * will be fine with us.
- */
-
-#include <debug/samsung.S>
-- 
2.1.0.rc2

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

* [PATCH 08/10] ARM: s3c64xx: use common debug-ll implementation
@ 2015-03-02 12:36   ` Arnd Bergmann
  0 siblings, 0 replies; 60+ messages in thread
From: Arnd Bergmann @ 2015-03-02 12:36 UTC (permalink / raw)
  To: linux-arm-kernel

The uart on s3c64xx is essentially the same as on s3c24xx,
so we can share a single assembler file. However, the addresses
are different, and we need to add the respective Kconfig magic
to get the right addresses.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/Kconfig.debug                           | 19 +++++++++++-
 arch/arm/mach-s3c64xx/include/mach/debug-macro.S | 38 ------------------------
 2 files changed, 18 insertions(+), 39 deletions(-)
 delete mode 100644 arch/arm/mach-s3c64xx/include/mach/debug-macro.S

diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 970de7518341..7af848b0f615 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -846,6 +846,7 @@ choice
 		depends on PLAT_SAMSUNG
 		select DEBUG_EXYNOS_UART if ARCH_EXYNOS
 		select DEBUG_S3C24XX_UART if ARCH_S3C24XX
+		select DEBUG_S3C64XX_UART if ARCH_S3C64XX
 		select DEBUG_S5PV210_UART if ARCH_S5PV210
 		bool "Use Samsung S3C UART 0 for low-level debug"
 		help
@@ -857,6 +858,7 @@ choice
 		depends on PLAT_SAMSUNG
 		select DEBUG_EXYNOS_UART if ARCH_EXYNOS
 		select DEBUG_S3C24XX_UART if ARCH_S3C24XX
+		select DEBUG_S3C64XX_UART if ARCH_S3C64XX
 		select DEBUG_S5PV210_UART if ARCH_S5PV210
 		bool "Use Samsung S3C UART 1 for low-level debug"
 		help
@@ -868,6 +870,7 @@ choice
 		depends on PLAT_SAMSUNG
 		select DEBUG_EXYNOS_UART if ARCH_EXYNOS
 		select DEBUG_S3C24XX_UART if ARCH_S3C24XX
+		select DEBUG_S3C64XX_UART if ARCH_S3C64XX
 		select DEBUG_S5PV210_UART if ARCH_S5PV210
 		bool "Use Samsung S3C UART 2 for low-level debug"
 		help
@@ -878,6 +881,7 @@ choice
 	config DEBUG_S3C_UART3
 		depends on PLAT_SAMSUNG && (ARCH_EXYNOS || ARCH_S5PV210)
 		select DEBUG_EXYNOS_UART if ARCH_EXYNOS
+		select DEBUG_S3C64XX_UART if ARCH_S3C64XX
 		select DEBUG_S5PV210_UART if ARCH_S5PV210
 		bool "Use Samsung S3C UART 3 for low-level debug"
 		help
@@ -1225,6 +1229,9 @@ config DEBUG_S3C2410_UART
 config DEBUG_S3C24XX_UART
 	bool
 
+config DEBUG_S3C64XX_UART
+	bool
+
 config DEBUG_S5PV210_UART
 	bool
 
@@ -1306,7 +1313,7 @@ config DEBUG_LL_INCLUDE
 	default "debug/renesas-scif.S" if DEBUG_RMOBILE_SCIFA0
 	default "debug/renesas-scif.S" if DEBUG_RMOBILE_SCIFA1
 	default "debug/renesas-scif.S" if DEBUG_RMOBILE_SCIFA4
-	default "debug/s3c24xx.S" if DEBUG_S3C24XX_UART
+	default "debug/s3c24xx.S" if DEBUG_S3C24XX_UART || DEBUG_S3C64XX_UART
 	default "debug/s5pv210.S" if DEBUG_S5PV210_UART
 	default "debug/sirf.S" if DEBUG_SIRFSOC_UART
 	default "debug/sti.S" if DEBUG_STI_UART
@@ -1382,6 +1389,10 @@ config DEBUG_UART_PHYS
 				DEBUG_S3C2410_UART2)
 	default 0x78000000 if DEBUG_CNS3XXX
 	default 0x7c0003f8 if FOOTBRIDGE
+	default 0x7f005000 if DEBUG_S3C64XX_UART && DEBUG_S3C_UART0
+	default 0x7f005400 if DEBUG_S3C64XX_UART && DEBUG_S3C_UART1
+	default 0x7f005800 if DEBUG_S3C64XX_UART && DEBUG_S3C_UART2
+	default 0x7f005c00 if DEBUG_S3C64XX_UART && DEBUG_S3C_UART3
 	default 0x80010000 if DEBUG_ASM9260_UART
 	default 0x80070000 if DEBUG_IMX23_UART
 	default 0x80074000 if DEBUG_IMX28_UART
@@ -1439,6 +1450,7 @@ config DEBUG_UART_PHYS
 		DEBUG_RCAR_GEN2_SCIF0 || DEBUG_RCAR_GEN2_SCIF2 || \
 		DEBUG_RMOBILE_SCIFA0 || DEBUG_RMOBILE_SCIFA1 || \
 		DEBUG_RMOBILE_SCIFA4 || DEBUG_S3C24XX_UART || \
+		DEBUG_S3C64XX_UART || \
 		DEBUG_UART_BCM63XX || DEBUG_ASM9260_UART || \
 		DEBUG_SIRFSOC_UART || DEBUG_DIGICOLOR_UA0
 
@@ -1464,8 +1476,12 @@ config DEBUG_UART_VIRT
 	default 0xf4090000 if ARCH_LPC32XX
 	default 0xf4200000 if ARCH_GEMINI
 	default 0xf7000000 if DEBUG_SUN9I_UART0
+	default 0xf7000000 if DEBUG_S3C64XX_UART && DEBUG_S3C_UART0
 	default 0xf7000000 if DEBUG_S3C24XX_UART && (DEBUG_S3C_UART0 || \
 				DEBUG_S3C2410_UART0)
+	default 0xf7000400 if DEBUG_S3C64XX_UART && DEBUG_S3C_UART1
+	default 0xf7000800 if DEBUG_S3C64XX_UART && DEBUG_S3C_UART2
+	default 0xf7000c00 if DEBUG_S3C64XX_UART && DEBUG_S3C_UART3
 	default 0xf7004000 if DEBUG_S3C24XX_UART && (DEBUG_S3C_UART1 || \
 				DEBUG_S3C2410_UART1)
 	default 0xf7008000 if DEBUG_S3C24XX_UART && (DEBUG_S3C_UART2 || \
@@ -1528,6 +1544,7 @@ config DEBUG_UART_VIRT
 		DEBUG_UART_8250 || DEBUG_UART_PL01X || DEBUG_MESON_UARTAO || \
 		DEBUG_MSM_UART || DEBUG_NETX_UART || \
 		DEBUG_QCOM_UARTDM || DEBUG_S3C24XX_UART || \
+		DEBUG_S3C64XX_UART || \
 		DEBUG_UART_BCM63XX || DEBUG_ASM9260_UART || \
 		DEBUG_SIRFSOC_UART || DEBUG_DIGICOLOR_UA0
 
diff --git a/arch/arm/mach-s3c64xx/include/mach/debug-macro.S b/arch/arm/mach-s3c64xx/include/mach/debug-macro.S
deleted file mode 100644
index c9b95325b672..000000000000
--- a/arch/arm/mach-s3c64xx/include/mach/debug-macro.S
+++ /dev/null
@@ -1,38 +0,0 @@
-/* arch/arm/mach-s3c6400/include/mach/debug-macro.S
- *
- * Copyright 2008 Openmoko, Inc.
- * Copyright 2008 Simtec Electronics
- *	http://armlinux.simtec.co.uk/
- *	Ben Dooks <ben@simtec.co.uk>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
-*/
-
-/* pull in the relevant register and map files. */
-
-#include <linux/serial_s3c.h>
-#include <mach/map.h>
-
-	/* note, for the boot process to work we have to keep the UART
-	 * virtual address aligned to an 1MiB boundary for the L1
-	 * mapping the head code makes. We keep the UART virtual address
-	 * aligned and add in the offset when we load the value here.
-	 */
-
-	.macro addruart, rp, rv, tmp
-		ldr	\rp, = S3C_PA_UART
-		ldr	\rv, = (S3C_VA_UART + S3C_PA_UART & 0xfffff)
-#if CONFIG_DEBUG_S3C_UART != 0
-		add	\rp, \rp, #(0x400 * CONFIG_DEBUG_S3C_UART)
-		add	\rv, \rv, #(0x400 * CONFIG_DEBUG_S3C_UART)
-#endif
-	.endm
-
-/* include the reset of the code which will do the work, we're only
- * compiling for a single cpu processor type so the default of s3c2440
- * will be fine with us.
- */
-
-#include <debug/samsung.S>
-- 
2.1.0.rc2

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

* [PATCH 09/10] ARM: s3c64xx: multiplatform support
  2015-03-02 12:35 ` Arnd Bergmann
@ 2015-03-02 12:36   ` Arnd Bergmann
  -1 siblings, 0 replies; 60+ messages in thread
From: Arnd Bergmann @ 2015-03-02 12:36 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Kukjin Kim, linux-samsung-soc, Maurus Cuelenaere, Mark Brown,
	Liam Girdwood, dmitry.torokhov, ch.naveen, a.kesavan, cw00.choi,
	jic23, Tomasz Figa, padma.v, Arnd Bergmann

After all preparation work is done, we can finally move the Kconfig
option for s3c64xx into ARCH_MULTIPLATFORM. This implies allowing
SAMSUNG_ATAGS for multiplatform again, but now disallowing the
ADC driver below it, as that still has dependencies on header files.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/Kconfig                    | 27 ---------------------------
 arch/arm/configs/multi_v7_defconfig |  3 +++
 arch/arm/configs/s3c6400_defconfig  |  2 ++
 arch/arm/mach-s3c64xx/Kconfig       | 22 +++++++++++++++++++++-
 arch/arm/mach-s3c64xx/Makefile      |  3 +++
 arch/arm/plat-samsung/Kconfig       |  2 +-
 arch/arm/plat-samsung/Makefile      |  3 ++-
 7 files changed, 32 insertions(+), 30 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index a6f71e402b38..0f7dd89b5eee 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -686,33 +686,6 @@ config ARCH_S3C24XX
 	  (<http://www.simtec.co.uk/products/EB110ITX/>), the IPAQ 1940 or the
 	  Samsung SMDK2410 development board (and derivatives).
 
-config ARCH_S3C64XX
-	bool "Samsung S3C64XX"
-	select ARCH_REQUIRE_GPIOLIB
-	select ARM_AMBA
-	select ARM_VIC
-	select ATAGS
-	select CLKDEV_LOOKUP
-	select CLKSRC_SAMSUNG_PWM
-	select COMMON_CLK_SAMSUNG
-	select CPU_V6K
-	select GENERIC_CLOCKEVENTS
-	select GPIO_SAMSUNG
-	select HAVE_S3C2410_I2C if I2C
-	select HAVE_S3C2410_WATCHDOG if WATCHDOG
-	select HAVE_TCM
-	select NO_IOPORT_MAP
-	select PLAT_SAMSUNG
-	select PM_GENERIC_DOMAINS if PM
-	select S3C_DEV_NAND
-	select S3C_GPIO_TRACK
-	select SAMSUNG_ATAGS
-	select SAMSUNG_WAKEMASK
-	select SAMSUNG_WDT_RESET
-	select SPARSE_IRQ
-	help
-	  Samsung S3C64XX series based systems
-
 config ARCH_DAVINCI
 	bool "TI DaVinci"
 	select ARCH_HAS_HOLES_MEMORYMODEL
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index e8a4c955241b..7bd95c167f93 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -11,6 +11,9 @@ CONFIG_MODULES=y
 CONFIG_MODULE_UNLOAD=y
 CONFIG_PARTITION_ADVANCED=y
 CONFIG_CMDLINE_PARTITION=y
+CONFIG_ARCH_MULTI_V7=y
+# CONFIG_ARCH_MULTI_V5 is not set
+# CONFIG_ARCH_MULTI_V4 is not set
 CONFIG_ARCH_VIRT=y
 CONFIG_ARCH_MVEBU=y
 CONFIG_MACH_ARMADA_370=y
diff --git a/arch/arm/configs/s3c6400_defconfig b/arch/arm/configs/s3c6400_defconfig
index e2f9fa5bb54b..e0f66936ae02 100644
--- a/arch/arm/configs/s3c6400_defconfig
+++ b/arch/arm/configs/s3c6400_defconfig
@@ -5,6 +5,8 @@ CONFIG_KALLSYMS_ALL=y
 CONFIG_MODULES=y
 CONFIG_MODULE_UNLOAD=y
 # CONFIG_BLK_DEV_BSG is not set
+CONFIG_ARCH_MULTI_V6=y
+# CONFIG_ARCH_MULTI_V7 is not set
 CONFIG_ARCH_S3C64XX=y
 CONFIG_S3C_BOOT_ERROR_RESET=y
 CONFIG_MACH_SMDK6400=y
diff --git a/arch/arm/mach-s3c64xx/Kconfig b/arch/arm/mach-s3c64xx/Kconfig
index 26ca2427e53d..8bdddee61520 100644
--- a/arch/arm/mach-s3c64xx/Kconfig
+++ b/arch/arm/mach-s3c64xx/Kconfig
@@ -2,6 +2,27 @@
 #	Simtec Electronics, Ben Dooks <ben@simtec.co.uk>
 #
 # Licensed under GPLv2
+menuconfig ARCH_S3C64XX
+	bool "Samsung S3C64XX" if ARCH_MULTI_V6
+	select ARCH_REQUIRE_GPIOLIB
+	select ARM_AMBA
+	select ARM_VIC
+	select ATAGS
+	select CLKSRC_SAMSUNG_PWM
+	select COMMON_CLK_SAMSUNG
+	select GPIO_SAMSUNG
+	select HAVE_S3C2410_I2C if I2C
+	select HAVE_S3C2410_WATCHDOG if WATCHDOG
+	select HAVE_TCM
+	select PLAT_SAMSUNG
+	select PM_GENERIC_DOMAINS if PM
+	select S3C_DEV_NAND
+	select S3C_GPIO_TRACK
+	select SAMSUNG_ATAGS
+	select SAMSUNG_WAKEMASK if PM
+	select SAMSUNG_WDT_RESET
+	help
+	  Samsung S3C64XX series based systems
 
 if ARCH_S3C64XX
 
@@ -302,7 +323,6 @@ config MACH_S3C64XX_DT
 	select CPU_S3C6410
 	select PINCTRL
 	select PINCTRL_S3C64XX
-	select USE_OF
 	help
 	  Machine support for Samsung S3C6400/S3C6410 machines with Device Tree
 	  enabled.
diff --git a/arch/arm/mach-s3c64xx/Makefile b/arch/arm/mach-s3c64xx/Makefile
index 12f67b61ca5f..46dcdf1584d6 100644
--- a/arch/arm/mach-s3c64xx/Makefile
+++ b/arch/arm/mach-s3c64xx/Makefile
@@ -5,6 +5,9 @@
 #
 # Licensed under GPLv2
 
+ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include -I$(srctree)/arch/arm/plat-samsung/include
+asflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include -I$(srctree)/arch/arm/plat-samsung/include
+
 # Core
 
 obj-y				+= common.o
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index 1df08180f2a5..6744cd28459f 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -39,7 +39,6 @@ config S3C_LOWLEVEL_UART_PORT
 
 config SAMSUNG_ATAGS
 	def_bool n
-	depends on !ARCH_MULTIPLATFORM
 	depends on ATAGS
 	help
 	   This option enables ATAGS based boot support code for
@@ -70,6 +69,7 @@ config S3C_GPIO_TRACK
 
 config S3C_ADC
 	bool "ADC common driver support"
+	depends on !ARCH_MULTIPLATFORM
 	help
 	  Core support for the ADC block found in the Samsung SoC systems
 	  for drivers such as the touchscreen and hwmon to use to share
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
index 7896ddf63974..d79bb442b914 100644
--- a/arch/arm/plat-samsung/Makefile
+++ b/arch/arm/plat-samsung/Makefile
@@ -4,7 +4,8 @@
 #
 # Licensed under GPLv2
 
-ccflags-$(CONFIG_ARCH_MULTI_V7) += -I$(srctree)/$(src)/include
+ccflags-$(CONFIG_ARCH_S3C64XX) := -I$(srctree)/arch/arm/mach-s3c64xx/include
+ccflags-$(CONFIG_ARCH_MULTIPLATFORM) += -I$(srctree)/$(src)/include
 
 # Objects we always build independent of SoC choice
 
-- 
2.1.0.rc2

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

* [PATCH 09/10] ARM: s3c64xx: multiplatform support
@ 2015-03-02 12:36   ` Arnd Bergmann
  0 siblings, 0 replies; 60+ messages in thread
From: Arnd Bergmann @ 2015-03-02 12:36 UTC (permalink / raw)
  To: linux-arm-kernel

After all preparation work is done, we can finally move the Kconfig
option for s3c64xx into ARCH_MULTIPLATFORM. This implies allowing
SAMSUNG_ATAGS for multiplatform again, but now disallowing the
ADC driver below it, as that still has dependencies on header files.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/Kconfig                    | 27 ---------------------------
 arch/arm/configs/multi_v7_defconfig |  3 +++
 arch/arm/configs/s3c6400_defconfig  |  2 ++
 arch/arm/mach-s3c64xx/Kconfig       | 22 +++++++++++++++++++++-
 arch/arm/mach-s3c64xx/Makefile      |  3 +++
 arch/arm/plat-samsung/Kconfig       |  2 +-
 arch/arm/plat-samsung/Makefile      |  3 ++-
 7 files changed, 32 insertions(+), 30 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index a6f71e402b38..0f7dd89b5eee 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -686,33 +686,6 @@ config ARCH_S3C24XX
 	  (<http://www.simtec.co.uk/products/EB110ITX/>), the IPAQ 1940 or the
 	  Samsung SMDK2410 development board (and derivatives).
 
-config ARCH_S3C64XX
-	bool "Samsung S3C64XX"
-	select ARCH_REQUIRE_GPIOLIB
-	select ARM_AMBA
-	select ARM_VIC
-	select ATAGS
-	select CLKDEV_LOOKUP
-	select CLKSRC_SAMSUNG_PWM
-	select COMMON_CLK_SAMSUNG
-	select CPU_V6K
-	select GENERIC_CLOCKEVENTS
-	select GPIO_SAMSUNG
-	select HAVE_S3C2410_I2C if I2C
-	select HAVE_S3C2410_WATCHDOG if WATCHDOG
-	select HAVE_TCM
-	select NO_IOPORT_MAP
-	select PLAT_SAMSUNG
-	select PM_GENERIC_DOMAINS if PM
-	select S3C_DEV_NAND
-	select S3C_GPIO_TRACK
-	select SAMSUNG_ATAGS
-	select SAMSUNG_WAKEMASK
-	select SAMSUNG_WDT_RESET
-	select SPARSE_IRQ
-	help
-	  Samsung S3C64XX series based systems
-
 config ARCH_DAVINCI
 	bool "TI DaVinci"
 	select ARCH_HAS_HOLES_MEMORYMODEL
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index e8a4c955241b..7bd95c167f93 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -11,6 +11,9 @@ CONFIG_MODULES=y
 CONFIG_MODULE_UNLOAD=y
 CONFIG_PARTITION_ADVANCED=y
 CONFIG_CMDLINE_PARTITION=y
+CONFIG_ARCH_MULTI_V7=y
+# CONFIG_ARCH_MULTI_V5 is not set
+# CONFIG_ARCH_MULTI_V4 is not set
 CONFIG_ARCH_VIRT=y
 CONFIG_ARCH_MVEBU=y
 CONFIG_MACH_ARMADA_370=y
diff --git a/arch/arm/configs/s3c6400_defconfig b/arch/arm/configs/s3c6400_defconfig
index e2f9fa5bb54b..e0f66936ae02 100644
--- a/arch/arm/configs/s3c6400_defconfig
+++ b/arch/arm/configs/s3c6400_defconfig
@@ -5,6 +5,8 @@ CONFIG_KALLSYMS_ALL=y
 CONFIG_MODULES=y
 CONFIG_MODULE_UNLOAD=y
 # CONFIG_BLK_DEV_BSG is not set
+CONFIG_ARCH_MULTI_V6=y
+# CONFIG_ARCH_MULTI_V7 is not set
 CONFIG_ARCH_S3C64XX=y
 CONFIG_S3C_BOOT_ERROR_RESET=y
 CONFIG_MACH_SMDK6400=y
diff --git a/arch/arm/mach-s3c64xx/Kconfig b/arch/arm/mach-s3c64xx/Kconfig
index 26ca2427e53d..8bdddee61520 100644
--- a/arch/arm/mach-s3c64xx/Kconfig
+++ b/arch/arm/mach-s3c64xx/Kconfig
@@ -2,6 +2,27 @@
 #	Simtec Electronics, Ben Dooks <ben@simtec.co.uk>
 #
 # Licensed under GPLv2
+menuconfig ARCH_S3C64XX
+	bool "Samsung S3C64XX" if ARCH_MULTI_V6
+	select ARCH_REQUIRE_GPIOLIB
+	select ARM_AMBA
+	select ARM_VIC
+	select ATAGS
+	select CLKSRC_SAMSUNG_PWM
+	select COMMON_CLK_SAMSUNG
+	select GPIO_SAMSUNG
+	select HAVE_S3C2410_I2C if I2C
+	select HAVE_S3C2410_WATCHDOG if WATCHDOG
+	select HAVE_TCM
+	select PLAT_SAMSUNG
+	select PM_GENERIC_DOMAINS if PM
+	select S3C_DEV_NAND
+	select S3C_GPIO_TRACK
+	select SAMSUNG_ATAGS
+	select SAMSUNG_WAKEMASK if PM
+	select SAMSUNG_WDT_RESET
+	help
+	  Samsung S3C64XX series based systems
 
 if ARCH_S3C64XX
 
@@ -302,7 +323,6 @@ config MACH_S3C64XX_DT
 	select CPU_S3C6410
 	select PINCTRL
 	select PINCTRL_S3C64XX
-	select USE_OF
 	help
 	  Machine support for Samsung S3C6400/S3C6410 machines with Device Tree
 	  enabled.
diff --git a/arch/arm/mach-s3c64xx/Makefile b/arch/arm/mach-s3c64xx/Makefile
index 12f67b61ca5f..46dcdf1584d6 100644
--- a/arch/arm/mach-s3c64xx/Makefile
+++ b/arch/arm/mach-s3c64xx/Makefile
@@ -5,6 +5,9 @@
 #
 # Licensed under GPLv2
 
+ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include -I$(srctree)/arch/arm/plat-samsung/include
+asflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include -I$(srctree)/arch/arm/plat-samsung/include
+
 # Core
 
 obj-y				+= common.o
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index 1df08180f2a5..6744cd28459f 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -39,7 +39,6 @@ config S3C_LOWLEVEL_UART_PORT
 
 config SAMSUNG_ATAGS
 	def_bool n
-	depends on !ARCH_MULTIPLATFORM
 	depends on ATAGS
 	help
 	   This option enables ATAGS based boot support code for
@@ -70,6 +69,7 @@ config S3C_GPIO_TRACK
 
 config S3C_ADC
 	bool "ADC common driver support"
+	depends on !ARCH_MULTIPLATFORM
 	help
 	  Core support for the ADC block found in the Samsung SoC systems
 	  for drivers such as the touchscreen and hwmon to use to share
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
index 7896ddf63974..d79bb442b914 100644
--- a/arch/arm/plat-samsung/Makefile
+++ b/arch/arm/plat-samsung/Makefile
@@ -4,7 +4,8 @@
 #
 # Licensed under GPLv2
 
-ccflags-$(CONFIG_ARCH_MULTI_V7) += -I$(srctree)/$(src)/include
+ccflags-$(CONFIG_ARCH_S3C64XX) := -I$(srctree)/arch/arm/mach-s3c64xx/include
+ccflags-$(CONFIG_ARCH_MULTIPLATFORM) += -I$(srctree)/$(src)/include
 
 # Objects we always build independent of SoC choice
 
-- 
2.1.0.rc2

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

* [PATCH 10/10] ARM: s3c64xx: allow building without board support
  2015-03-02 12:35 ` Arnd Bergmann
@ 2015-03-02 12:36   ` Arnd Bergmann
  -1 siblings, 0 replies; 60+ messages in thread
From: Arnd Bergmann @ 2015-03-02 12:36 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Kukjin Kim, linux-samsung-soc, Maurus Cuelenaere, Mark Brown,
	Liam Girdwood, dmitry.torokhov, ch.naveen, a.kesavan, cw00.choi,
	jic23, Tomasz Figa, padma.v, Arnd Bergmann

Most of the code for the s3c64xx platform is only used when booting
with ATAGS based board files, but not when using device-tree.

This tries to identify all the s3c64xx specific code that is
unneeded when CONFIG_ATAGS is not set, so we can build a smaller
DT-only kernel if configured that way.

All board support is still left intact but now depends on the
CONFIG_ATAGS symbol that users may intentionally disable.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-s3c64xx/Kconfig                     | 19 ++++++++++++++-----
 arch/arm/mach-s3c64xx/Makefile                    | 20 ++++++++++++--------
 arch/arm/mach-s3c64xx/include/mach/gpio-samsung.h |  3 +++
 arch/arm/plat-samsung/pm.c                        |  4 ----
 4 files changed, 29 insertions(+), 17 deletions(-)

diff --git a/arch/arm/mach-s3c64xx/Kconfig b/arch/arm/mach-s3c64xx/Kconfig
index 8bdddee61520..48d1fbbdef13 100644
--- a/arch/arm/mach-s3c64xx/Kconfig
+++ b/arch/arm/mach-s3c64xx/Kconfig
@@ -7,18 +7,17 @@ menuconfig ARCH_S3C64XX
 	select ARCH_REQUIRE_GPIOLIB
 	select ARM_AMBA
 	select ARM_VIC
-	select ATAGS
 	select CLKSRC_SAMSUNG_PWM
 	select COMMON_CLK_SAMSUNG
-	select GPIO_SAMSUNG
+	select GPIO_SAMSUNG if ATAGS
 	select HAVE_S3C2410_I2C if I2C
 	select HAVE_S3C2410_WATCHDOG if WATCHDOG
 	select HAVE_TCM
 	select PLAT_SAMSUNG
 	select PM_GENERIC_DOMAINS if PM
-	select S3C_DEV_NAND
-	select S3C_GPIO_TRACK
-	select SAMSUNG_ATAGS
+	select S3C_DEV_NAND if ATAGS
+	select S3C_GPIO_TRACK if ATAGS
+	select SAMSUNG_ATAGS if ATAGS
 	select SAMSUNG_WAKEMASK if PM
 	select SAMSUNG_WDT_RESET
 	help
@@ -105,6 +104,7 @@ config S3C64XX_SETUP_USB_PHY
 
 config MACH_SMDK6400
        bool "SMDK6400"
+	depends on ATAGS
 	select CPU_S3C6400
 	select S3C64XX_SETUP_SDHCI
 	select S3C_DEV_HSMMC1
@@ -115,6 +115,7 @@ config MACH_SMDK6400
 
 config MACH_ANW6410
 	bool "A&W6410"
+	depends on ATAGS
 	select CPU_S3C6410
 	select S3C64XX_SETUP_FB_24BPP
 	select S3C_DEV_FB
@@ -123,6 +124,7 @@ config MACH_ANW6410
 
 config MACH_MINI6410
 	bool "MINI6410"
+	depends on ATAGS
 	select CPU_S3C6410
 	select S3C64XX_SETUP_FB_24BPP
 	select S3C64XX_SETUP_SDHCI
@@ -138,6 +140,7 @@ config MACH_MINI6410
 
 config MACH_REAL6410
 	bool "REAL6410"
+	depends on ATAGS
 	select CPU_S3C6410
 	select S3C64XX_SETUP_FB_24BPP
 	select S3C64XX_SETUP_SDHCI
@@ -153,6 +156,7 @@ config MACH_REAL6410
 
 config MACH_SMDK6410
 	bool "SMDK6410"
+	depends on ATAGS
 	select CPU_S3C6410
 	select HAVE_S3C2410_WATCHDOG if WATCHDOG
 	select S3C64XX_SETUP_FB_24BPP
@@ -238,6 +242,7 @@ config SMDK6410_WM1192_EV1
 
 config MACH_NCP
 	bool "NCP"
+	depends on ATAGS
 	select CPU_S3C6410
 	select S3C64XX_SETUP_I2C1
 	select S3C_DEV_HSMMC1
@@ -247,6 +252,7 @@ config MACH_NCP
 
 config MACH_HMT
 	bool "Airgoo HMT"
+	depends on ATAGS
 	select CPU_S3C6410
 	select S3C64XX_SETUP_FB_24BPP
 	select S3C_DEV_FB
@@ -278,18 +284,21 @@ config MACH_SMARTQ
 
 config MACH_SMARTQ5
 	bool "SmartQ 5"
+	depends on ATAGS
 	select MACH_SMARTQ
 	help
 	    Machine support for the SmartQ 5
 
 config MACH_SMARTQ7
 	bool "SmartQ 7"
+	depends on ATAGS
 	select MACH_SMARTQ
 	help
 	    Machine support for the SmartQ 7
 
 config MACH_WLF_CRAGG_6410
 	bool "Wolfson Cragganmore 6410"
+	depends on ATAGS
 	select CPU_S3C6410
 	select I2C
 	select LEDS_GPIO_REGISTER
diff --git a/arch/arm/mach-s3c64xx/Makefile b/arch/arm/mach-s3c64xx/Makefile
index 46dcdf1584d6..9f242dac9d6d 100644
--- a/arch/arm/mach-s3c64xx/Makefile
+++ b/arch/arm/mach-s3c64xx/Makefile
@@ -8,19 +8,21 @@
 ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include -I$(srctree)/arch/arm/plat-samsung/include
 asflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include -I$(srctree)/arch/arm/plat-samsung/include
 
-# Core
+# PM
 
-obj-y				+= common.o
+obj-$(CONFIG_PM)		+= pm.o
+obj-$(CONFIG_PM_SLEEP)		+= sleep.o
+obj-$(CONFIG_CPU_IDLE)		+= cpuidle.o
 
-# Core support
+ifdef CONFIG_SAMSUNG_ATAGS
 
-obj-$(CONFIG_CPU_S3C6400)	+= s3c6400.o
-obj-$(CONFIG_CPU_S3C6410)	+= s3c6410.o
+obj-$(CONFIG_PM_SLEEP)          += irq-pm.o
 
-# PM
+# Core
 
-obj-$(CONFIG_PM)		+= pm.o irq-pm.o sleep.o
-obj-$(CONFIG_CPU_IDLE)		+= cpuidle.o
+obj-y				+= common.o
+obj-$(CONFIG_CPU_S3C6400)	+= s3c6400.o
+obj-$(CONFIG_CPU_S3C6410)	+= s3c6410.o
 
 # DMA support
 
@@ -55,4 +57,6 @@ obj-$(CONFIG_MACH_SMARTQ7)		+= mach-smartq7.o
 obj-$(CONFIG_MACH_SMDK6400)		+= mach-smdk6400.o
 obj-$(CONFIG_MACH_SMDK6410)		+= mach-smdk6410.o
 obj-$(CONFIG_MACH_WLF_CRAGG_6410)	+= mach-crag6410.o mach-crag6410-module.o
+endif
+
 obj-$(CONFIG_MACH_S3C64XX_DT)		+= mach-s3c64xx-dt.o
diff --git a/arch/arm/mach-s3c64xx/include/mach/gpio-samsung.h b/arch/arm/mach-s3c64xx/include/mach/gpio-samsung.h
index 9c81fac3b2d5..1d3636512e33 100644
--- a/arch/arm/mach-s3c64xx/include/mach/gpio-samsung.h
+++ b/arch/arm/mach-s3c64xx/include/mach/gpio-samsung.h
@@ -14,6 +14,8 @@
 #ifndef GPIO_SAMSUNG_S3C64XX_H
 #define GPIO_SAMSUNG_S3C64XX_H
 
+#ifdef CONFIG_GPIO_SAMSUNG
+
 /* GPIO bank sizes */
 #define S3C64XX_GPIO_A_NR	(8)
 #define S3C64XX_GPIO_B_NR	(7)
@@ -90,5 +92,6 @@ enum s3c_gpio_number {
 /* define the number of gpios we need to the one after the GPQ() range */
 #define GPIO_BOARD_START (S3C64XX_GPQ(S3C64XX_GPIO_Q_NR) + 1)
 
+#endif /* GPIO_SAMSUNG */
 #endif /* GPIO_SAMSUNG_S3C64XX_H */
 
diff --git a/arch/arm/plat-samsung/pm.c b/arch/arm/plat-samsung/pm.c
index f8c0f9797dcf..a6193771bbea 100644
--- a/arch/arm/plat-samsung/pm.c
+++ b/arch/arm/plat-samsung/pm.c
@@ -23,14 +23,10 @@
 #include <asm/cacheflush.h>
 #include <asm/suspend.h>
 
-#ifdef CONFIG_SAMSUNG_ATAGS
 #include <mach/map.h>
-#ifndef CONFIG_ARCH_EXYNOS
 #include <mach/regs-clock.h>
 #include <mach/regs-irq.h>
-#endif
 #include <mach/irqs.h>
-#endif
 
 #include <asm/irq.h>
 
-- 
2.1.0.rc2

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

* [PATCH 10/10] ARM: s3c64xx: allow building without board support
@ 2015-03-02 12:36   ` Arnd Bergmann
  0 siblings, 0 replies; 60+ messages in thread
From: Arnd Bergmann @ 2015-03-02 12:36 UTC (permalink / raw)
  To: linux-arm-kernel

Most of the code for the s3c64xx platform is only used when booting
with ATAGS based board files, but not when using device-tree.

This tries to identify all the s3c64xx specific code that is
unneeded when CONFIG_ATAGS is not set, so we can build a smaller
DT-only kernel if configured that way.

All board support is still left intact but now depends on the
CONFIG_ATAGS symbol that users may intentionally disable.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-s3c64xx/Kconfig                     | 19 ++++++++++++++-----
 arch/arm/mach-s3c64xx/Makefile                    | 20 ++++++++++++--------
 arch/arm/mach-s3c64xx/include/mach/gpio-samsung.h |  3 +++
 arch/arm/plat-samsung/pm.c                        |  4 ----
 4 files changed, 29 insertions(+), 17 deletions(-)

diff --git a/arch/arm/mach-s3c64xx/Kconfig b/arch/arm/mach-s3c64xx/Kconfig
index 8bdddee61520..48d1fbbdef13 100644
--- a/arch/arm/mach-s3c64xx/Kconfig
+++ b/arch/arm/mach-s3c64xx/Kconfig
@@ -7,18 +7,17 @@ menuconfig ARCH_S3C64XX
 	select ARCH_REQUIRE_GPIOLIB
 	select ARM_AMBA
 	select ARM_VIC
-	select ATAGS
 	select CLKSRC_SAMSUNG_PWM
 	select COMMON_CLK_SAMSUNG
-	select GPIO_SAMSUNG
+	select GPIO_SAMSUNG if ATAGS
 	select HAVE_S3C2410_I2C if I2C
 	select HAVE_S3C2410_WATCHDOG if WATCHDOG
 	select HAVE_TCM
 	select PLAT_SAMSUNG
 	select PM_GENERIC_DOMAINS if PM
-	select S3C_DEV_NAND
-	select S3C_GPIO_TRACK
-	select SAMSUNG_ATAGS
+	select S3C_DEV_NAND if ATAGS
+	select S3C_GPIO_TRACK if ATAGS
+	select SAMSUNG_ATAGS if ATAGS
 	select SAMSUNG_WAKEMASK if PM
 	select SAMSUNG_WDT_RESET
 	help
@@ -105,6 +104,7 @@ config S3C64XX_SETUP_USB_PHY
 
 config MACH_SMDK6400
        bool "SMDK6400"
+	depends on ATAGS
 	select CPU_S3C6400
 	select S3C64XX_SETUP_SDHCI
 	select S3C_DEV_HSMMC1
@@ -115,6 +115,7 @@ config MACH_SMDK6400
 
 config MACH_ANW6410
 	bool "A&W6410"
+	depends on ATAGS
 	select CPU_S3C6410
 	select S3C64XX_SETUP_FB_24BPP
 	select S3C_DEV_FB
@@ -123,6 +124,7 @@ config MACH_ANW6410
 
 config MACH_MINI6410
 	bool "MINI6410"
+	depends on ATAGS
 	select CPU_S3C6410
 	select S3C64XX_SETUP_FB_24BPP
 	select S3C64XX_SETUP_SDHCI
@@ -138,6 +140,7 @@ config MACH_MINI6410
 
 config MACH_REAL6410
 	bool "REAL6410"
+	depends on ATAGS
 	select CPU_S3C6410
 	select S3C64XX_SETUP_FB_24BPP
 	select S3C64XX_SETUP_SDHCI
@@ -153,6 +156,7 @@ config MACH_REAL6410
 
 config MACH_SMDK6410
 	bool "SMDK6410"
+	depends on ATAGS
 	select CPU_S3C6410
 	select HAVE_S3C2410_WATCHDOG if WATCHDOG
 	select S3C64XX_SETUP_FB_24BPP
@@ -238,6 +242,7 @@ config SMDK6410_WM1192_EV1
 
 config MACH_NCP
 	bool "NCP"
+	depends on ATAGS
 	select CPU_S3C6410
 	select S3C64XX_SETUP_I2C1
 	select S3C_DEV_HSMMC1
@@ -247,6 +252,7 @@ config MACH_NCP
 
 config MACH_HMT
 	bool "Airgoo HMT"
+	depends on ATAGS
 	select CPU_S3C6410
 	select S3C64XX_SETUP_FB_24BPP
 	select S3C_DEV_FB
@@ -278,18 +284,21 @@ config MACH_SMARTQ
 
 config MACH_SMARTQ5
 	bool "SmartQ 5"
+	depends on ATAGS
 	select MACH_SMARTQ
 	help
 	    Machine support for the SmartQ 5
 
 config MACH_SMARTQ7
 	bool "SmartQ 7"
+	depends on ATAGS
 	select MACH_SMARTQ
 	help
 	    Machine support for the SmartQ 7
 
 config MACH_WLF_CRAGG_6410
 	bool "Wolfson Cragganmore 6410"
+	depends on ATAGS
 	select CPU_S3C6410
 	select I2C
 	select LEDS_GPIO_REGISTER
diff --git a/arch/arm/mach-s3c64xx/Makefile b/arch/arm/mach-s3c64xx/Makefile
index 46dcdf1584d6..9f242dac9d6d 100644
--- a/arch/arm/mach-s3c64xx/Makefile
+++ b/arch/arm/mach-s3c64xx/Makefile
@@ -8,19 +8,21 @@
 ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include -I$(srctree)/arch/arm/plat-samsung/include
 asflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include -I$(srctree)/arch/arm/plat-samsung/include
 
-# Core
+# PM
 
-obj-y				+= common.o
+obj-$(CONFIG_PM)		+= pm.o
+obj-$(CONFIG_PM_SLEEP)		+= sleep.o
+obj-$(CONFIG_CPU_IDLE)		+= cpuidle.o
 
-# Core support
+ifdef CONFIG_SAMSUNG_ATAGS
 
-obj-$(CONFIG_CPU_S3C6400)	+= s3c6400.o
-obj-$(CONFIG_CPU_S3C6410)	+= s3c6410.o
+obj-$(CONFIG_PM_SLEEP)          += irq-pm.o
 
-# PM
+# Core
 
-obj-$(CONFIG_PM)		+= pm.o irq-pm.o sleep.o
-obj-$(CONFIG_CPU_IDLE)		+= cpuidle.o
+obj-y				+= common.o
+obj-$(CONFIG_CPU_S3C6400)	+= s3c6400.o
+obj-$(CONFIG_CPU_S3C6410)	+= s3c6410.o
 
 # DMA support
 
@@ -55,4 +57,6 @@ obj-$(CONFIG_MACH_SMARTQ7)		+= mach-smartq7.o
 obj-$(CONFIG_MACH_SMDK6400)		+= mach-smdk6400.o
 obj-$(CONFIG_MACH_SMDK6410)		+= mach-smdk6410.o
 obj-$(CONFIG_MACH_WLF_CRAGG_6410)	+= mach-crag6410.o mach-crag6410-module.o
+endif
+
 obj-$(CONFIG_MACH_S3C64XX_DT)		+= mach-s3c64xx-dt.o
diff --git a/arch/arm/mach-s3c64xx/include/mach/gpio-samsung.h b/arch/arm/mach-s3c64xx/include/mach/gpio-samsung.h
index 9c81fac3b2d5..1d3636512e33 100644
--- a/arch/arm/mach-s3c64xx/include/mach/gpio-samsung.h
+++ b/arch/arm/mach-s3c64xx/include/mach/gpio-samsung.h
@@ -14,6 +14,8 @@
 #ifndef GPIO_SAMSUNG_S3C64XX_H
 #define GPIO_SAMSUNG_S3C64XX_H
 
+#ifdef CONFIG_GPIO_SAMSUNG
+
 /* GPIO bank sizes */
 #define S3C64XX_GPIO_A_NR	(8)
 #define S3C64XX_GPIO_B_NR	(7)
@@ -90,5 +92,6 @@ enum s3c_gpio_number {
 /* define the number of gpios we need to the one after the GPQ() range */
 #define GPIO_BOARD_START (S3C64XX_GPQ(S3C64XX_GPIO_Q_NR) + 1)
 
+#endif /* GPIO_SAMSUNG */
 #endif /* GPIO_SAMSUNG_S3C64XX_H */
 
diff --git a/arch/arm/plat-samsung/pm.c b/arch/arm/plat-samsung/pm.c
index f8c0f9797dcf..a6193771bbea 100644
--- a/arch/arm/plat-samsung/pm.c
+++ b/arch/arm/plat-samsung/pm.c
@@ -23,14 +23,10 @@
 #include <asm/cacheflush.h>
 #include <asm/suspend.h>
 
-#ifdef CONFIG_SAMSUNG_ATAGS
 #include <mach/map.h>
-#ifndef CONFIG_ARCH_EXYNOS
 #include <mach/regs-clock.h>
 #include <mach/regs-irq.h>
-#endif
 #include <mach/irqs.h>
-#endif
 
 #include <asm/irq.h>
 
-- 
2.1.0.rc2

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

* Re: [PATCH 00/10] ARM: s3c64xx multiplatform, help needed
  2015-03-02 12:35 ` Arnd Bergmann
@ 2015-03-02 16:17   ` Mark Brown
  -1 siblings, 0 replies; 60+ messages in thread
From: Mark Brown @ 2015-03-02 16:17 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arm-kernel, Kukjin Kim, linux-samsung-soc,
	Maurus Cuelenaere, Liam Girdwood, dmitry.torokhov, ch.naveen,
	a.kesavan, cw00.choi, jic23, Tomasz Figa, padma.v, ckeepax

[-- Attachment #1: Type: text/plain, Size: 400 bytes --]

On Mon, Mar 02, 2015 at 01:35:53PM +0100, Arnd Bergmann wrote:

> Does anyone still have access to the hardware? I'm particularly
> interested in seeing this patch set get tested on smartq
> and on smdk6410, which have the majority of the hardware.

I and a bunch of other people still have Cragganmore, the ex-Wolfson
(added Charles here) people may also be able to locate a smdk6410.
may also be a

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* [PATCH 00/10] ARM: s3c64xx multiplatform, help needed
@ 2015-03-02 16:17   ` Mark Brown
  0 siblings, 0 replies; 60+ messages in thread
From: Mark Brown @ 2015-03-02 16:17 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Mar 02, 2015 at 01:35:53PM +0100, Arnd Bergmann wrote:

> Does anyone still have access to the hardware? I'm particularly
> interested in seeing this patch set get tested on smartq
> and on smdk6410, which have the majority of the hardware.

I and a bunch of other people still have Cragganmore, the ex-Wolfson
(added Charles here) people may also be able to locate a smdk6410.
may also be a
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150302/90d0994c/attachment-0001.sig>

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

* Re: [PATCH 00/10] ARM: s3c64xx multiplatform, help needed
  2015-03-02 12:35 ` Arnd Bergmann
@ 2015-03-02 16:53   ` Tomasz Figa
  -1 siblings, 0 replies; 60+ messages in thread
From: Tomasz Figa @ 2015-03-02 16:53 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arm-kernel, Kukjin Kim, linux-samsung-soc,
	Maurus Cuelenaere, Mark Brown, Liam Girdwood, Dmitry Torokhov,
	naveen krishna, Abhilash Kesavan, Chanwoo Choi, jic23,
	Padmavathi Venna

Hi Arnd,

Thanks a lot for these patches.

2015-03-02 21:35 GMT+09:00 Arnd Bergmann <arnd@arndb.de>:
> Hi everyone,
>
> I've had these patches in a private git tree for a while, and have
> finally gotten around to clean them up some more for submission.
> Hopefully we can get all of it merged into 4.1.
>
> I've done this to the best of my knowledge, but some parts are
> a bit tricky, so I expect that there are bugs. The trickiest
> part is the touchscreen driver. I've sent it out for review
> last year already, but I have not found anybody who could test
> it, and it's basically a blind rewrite of an existing driver,
> so it's unlikely that I got it all right.
>
> The other parts may actually work, but it is possible that
> I made a mistake with the ASoC driver, the sparseirq support
> or something else.
>
> Does anyone still have access to the hardware? I'm particularly
> interested in seeing this patch set get tested on smartq
> and on smdk6410, which have the majority of the hardware.

I still have a tiny6410, which is compatible with mini6410, so I can
test both DT and non-DT code paths. It also has a touchscreen using
the on-SoC ADC. I'll give it a try this weekend. I'll try to review
the series as well.

Best regards,
Tomasz

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

* [PATCH 00/10] ARM: s3c64xx multiplatform, help needed
@ 2015-03-02 16:53   ` Tomasz Figa
  0 siblings, 0 replies; 60+ messages in thread
From: Tomasz Figa @ 2015-03-02 16:53 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Arnd,

Thanks a lot for these patches.

2015-03-02 21:35 GMT+09:00 Arnd Bergmann <arnd@arndb.de>:
> Hi everyone,
>
> I've had these patches in a private git tree for a while, and have
> finally gotten around to clean them up some more for submission.
> Hopefully we can get all of it merged into 4.1.
>
> I've done this to the best of my knowledge, but some parts are
> a bit tricky, so I expect that there are bugs. The trickiest
> part is the touchscreen driver. I've sent it out for review
> last year already, but I have not found anybody who could test
> it, and it's basically a blind rewrite of an existing driver,
> so it's unlikely that I got it all right.
>
> The other parts may actually work, but it is possible that
> I made a mistake with the ASoC driver, the sparseirq support
> or something else.
>
> Does anyone still have access to the hardware? I'm particularly
> interested in seeing this patch set get tested on smartq
> and on smdk6410, which have the majority of the hardware.

I still have a tiny6410, which is compatible with mini6410, so I can
test both DT and non-DT code paths. It also has a touchscreen using
the on-SoC ADC. I'll give it a try this weekend. I'll try to review
the series as well.

Best regards,
Tomasz

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

* Re: [PATCH 00/10] ARM: s3c64xx multiplatform, help needed
  2015-03-02 12:35 ` Arnd Bergmann
@ 2015-03-02 17:37   ` Dmitry Torokhov
  -1 siblings, 0 replies; 60+ messages in thread
From: Dmitry Torokhov @ 2015-03-02 17:37 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arm-kernel, Kukjin Kim, linux-samsung-soc,
	Maurus Cuelenaere, Mark Brown, Liam Girdwood, ch.naveen,
	a.kesavan, cw00.choi, jic23, Tomasz Figa, padma.v,
	Vasily Khoruzhick

On Mon, Mar 02, 2015 at 01:35:53PM +0100, Arnd Bergmann wrote:
> Hi everyone,
> 
> I've had these patches in a private git tree for a while, and have
> finally gotten around to clean them up some more for submission.
> Hopefully we can get all of it merged into 4.1.
> 
> I've done this to the best of my knowledge, but some parts are
> a bit tricky, so I expect that there are bugs. The trickiest
> part is the touchscreen driver. I've sent it out for review
> last year already, but I have not found anybody who could test
> it, and it's basically a blind rewrite of an existing driver,
> so it's unlikely that I got it all right.

I think Vasily had access to hardware with s3c2410_ts at some point...

> 
> The other parts may actually work, but it is possible that
> I made a mistake with the ASoC driver, the sparseirq support
> or something else.
> 
> Does anyone still have access to the hardware? I'm particularly
> interested in seeing this patch set get tested on smartq
> and on smdk6410, which have the majority of the hardware.

Thanks.

-- 
Dmitry

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

* [PATCH 00/10] ARM: s3c64xx multiplatform, help needed
@ 2015-03-02 17:37   ` Dmitry Torokhov
  0 siblings, 0 replies; 60+ messages in thread
From: Dmitry Torokhov @ 2015-03-02 17:37 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Mar 02, 2015 at 01:35:53PM +0100, Arnd Bergmann wrote:
> Hi everyone,
> 
> I've had these patches in a private git tree for a while, and have
> finally gotten around to clean them up some more for submission.
> Hopefully we can get all of it merged into 4.1.
> 
> I've done this to the best of my knowledge, but some parts are
> a bit tricky, so I expect that there are bugs. The trickiest
> part is the touchscreen driver. I've sent it out for review
> last year already, but I have not found anybody who could test
> it, and it's basically a blind rewrite of an existing driver,
> so it's unlikely that I got it all right.

I think Vasily had access to hardware with s3c2410_ts at some point...

> 
> The other parts may actually work, but it is possible that
> I made a mistake with the ASoC driver, the sparseirq support
> or something else.
> 
> Does anyone still have access to the hardware? I'm particularly
> interested in seeing this patch set get tested on smartq
> and on smdk6410, which have the majority of the hardware.

Thanks.

-- 
Dmitry

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

* Re: [PATCH 00/10] ARM: s3c64xx multiplatform, help needed
  2015-03-02 16:17   ` Mark Brown
@ 2015-03-02 18:03     ` Charles Keepax
  -1 siblings, 0 replies; 60+ messages in thread
From: Charles Keepax @ 2015-03-02 18:03 UTC (permalink / raw)
  To: Mark Brown
  Cc: Arnd Bergmann, linux-arm-kernel, Kukjin Kim, linux-samsung-soc,
	Maurus Cuelenaere, Liam Girdwood, dmitry.torokhov, ch.naveen,
	a.kesavan, cw00.choi, jic23, Tomasz Figa, padma.v

On Mon, Mar 02, 2015 at 04:17:12PM +0000, Mark Brown wrote:
> On Mon, Mar 02, 2015 at 01:35:53PM +0100, Arnd Bergmann wrote:
> 
> > Does anyone still have access to the hardware? I'm particularly
> > interested in seeing this patch set get tested on smartq
> > and on smdk6410, which have the majority of the hardware.
> 
> I and a bunch of other people still have Cragganmore, the ex-Wolfson
> (added Charles here) people may also be able to locate a smdk6410.
> may also be a

Certainly we have Cragganmores here, I think I have seen an
smdk6410 kicking about the office unloved somewhere. I will have
a look to see if I can unearth it somewhere.

Thanks,
Charles

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

* [PATCH 00/10] ARM: s3c64xx multiplatform, help needed
@ 2015-03-02 18:03     ` Charles Keepax
  0 siblings, 0 replies; 60+ messages in thread
From: Charles Keepax @ 2015-03-02 18:03 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Mar 02, 2015 at 04:17:12PM +0000, Mark Brown wrote:
> On Mon, Mar 02, 2015 at 01:35:53PM +0100, Arnd Bergmann wrote:
> 
> > Does anyone still have access to the hardware? I'm particularly
> > interested in seeing this patch set get tested on smartq
> > and on smdk6410, which have the majority of the hardware.
> 
> I and a bunch of other people still have Cragganmore, the ex-Wolfson
> (added Charles here) people may also be able to locate a smdk6410.
> may also be a

Certainly we have Cragganmores here, I think I have seen an
smdk6410 kicking about the office unloved somewhere. I will have
a look to see if I can unearth it somewhere.

Thanks,
Charles

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

* Re: [PATCH 00/10] ARM: s3c64xx multiplatform, help needed
  2015-03-02 17:37   ` Dmitry Torokhov
@ 2015-03-02 18:14     ` Vasily Khoruzhick
  -1 siblings, 0 replies; 60+ messages in thread
From: Vasily Khoruzhick @ 2015-03-02 18:14 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Arnd Bergmann, arm-linux, Kukjin Kim, linux-samsung-soc,
	Maurus Cuelenaere, Mark Brown, Liam Girdwood, ch.naveen,
	a.kesavan, cw00.choi, jic23, Tomasz Figa, padma.v

On Mon, Mar 2, 2015 at 8:37 PM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:

> I think Vasily had access to hardware with s3c2410_ts at some point...

Hi,

Yep, I have s3c24xx hardware to test rewritten s3c2410_ts driver. Will
try it this weekend.

Regards,
Vasily

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

* [PATCH 00/10] ARM: s3c64xx multiplatform, help needed
@ 2015-03-02 18:14     ` Vasily Khoruzhick
  0 siblings, 0 replies; 60+ messages in thread
From: Vasily Khoruzhick @ 2015-03-02 18:14 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Mar 2, 2015 at 8:37 PM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:

> I think Vasily had access to hardware with s3c2410_ts at some point...

Hi,

Yep, I have s3c24xx hardware to test rewritten s3c2410_ts driver. Will
try it this weekend.

Regards,
Vasily

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

* Re: [PATCH 00/10] ARM: s3c64xx multiplatform, help needed
  2015-03-02 16:53   ` Tomasz Figa
@ 2015-03-02 19:04     ` Kukjin Kim
  -1 siblings, 0 replies; 60+ messages in thread
From: Kukjin Kim @ 2015-03-02 19:04 UTC (permalink / raw)
  To: Tomasz Figa
  Cc: Arnd Bergmann, linux-arm-kernel, Kukjin Kim, linux-samsung-soc,
	Maurus Cuelenaere, Mark Brown, Liam Girdwood, Dmitry Torokhov,
	naveen krishna, Abhilash Kesavan, Chanwoo Choi, jic23,
	Padmavathi Venna

On 03/03/15 01:53, Tomasz Figa wrote:
> Hi Arnd,
> 
Hi,

> Thanks a lot for these patches.
> 
> 2015-03-02 21:35 GMT+09:00 Arnd Bergmann <arnd@arndb.de>:
>> Hi everyone,
>>
>> I've had these patches in a private git tree for a while, and have
>> finally gotten around to clean them up some more for submission.
>> Hopefully we can get all of it merged into 4.1.
>>
Sure,

>> I've done this to the best of my knowledge, but some parts are
>> a bit tricky, so I expect that there are bugs. The trickiest
>> part is the touchscreen driver. I've sent it out for review
>> last year already, but I have not found anybody who could test
>> it, and it's basically a blind rewrite of an existing driver,
>> so it's unlikely that I got it all right.
>>
>> The other parts may actually work, but it is possible that
>> I made a mistake with the ASoC driver, the sparseirq support
>> or something else.
>>
>> Does anyone still have access to the hardware? I'm particularly
>> interested in seeing this patch set get tested on smartq
>> and on smdk6410, which have the majority of the hardware.
> 
> I still have a tiny6410, which is compatible with mini6410, so I can
> test both DT and non-DT code paths. It also has a touchscreen using
> the on-SoC ADC. I'll give it a try this weekend. I'll try to review
> the series as well.
> 
I also have smdk6410 board on my desk and maybe I can test this series
in the weekend. If anything I'll let you know.

Thanks,
Kukjin

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

* [PATCH 00/10] ARM: s3c64xx multiplatform, help needed
@ 2015-03-02 19:04     ` Kukjin Kim
  0 siblings, 0 replies; 60+ messages in thread
From: Kukjin Kim @ 2015-03-02 19:04 UTC (permalink / raw)
  To: linux-arm-kernel

On 03/03/15 01:53, Tomasz Figa wrote:
> Hi Arnd,
> 
Hi,

> Thanks a lot for these patches.
> 
> 2015-03-02 21:35 GMT+09:00 Arnd Bergmann <arnd@arndb.de>:
>> Hi everyone,
>>
>> I've had these patches in a private git tree for a while, and have
>> finally gotten around to clean them up some more for submission.
>> Hopefully we can get all of it merged into 4.1.
>>
Sure,

>> I've done this to the best of my knowledge, but some parts are
>> a bit tricky, so I expect that there are bugs. The trickiest
>> part is the touchscreen driver. I've sent it out for review
>> last year already, but I have not found anybody who could test
>> it, and it's basically a blind rewrite of an existing driver,
>> so it's unlikely that I got it all right.
>>
>> The other parts may actually work, but it is possible that
>> I made a mistake with the ASoC driver, the sparseirq support
>> or something else.
>>
>> Does anyone still have access to the hardware? I'm particularly
>> interested in seeing this patch set get tested on smartq
>> and on smdk6410, which have the majority of the hardware.
> 
> I still have a tiny6410, which is compatible with mini6410, so I can
> test both DT and non-DT code paths. It also has a touchscreen using
> the on-SoC ADC. I'll give it a try this weekend. I'll try to review
> the series as well.
> 
I also have smdk6410 board on my desk and maybe I can test this series
in the weekend. If anything I'll let you know.

Thanks,
Kukjin

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

* Re: [PATCH 00/10] ARM: s3c64xx multiplatform, help needed
  2015-03-02 12:35 ` Arnd Bergmann
@ 2015-03-02 20:48   ` Arnd Bergmann
  -1 siblings, 0 replies; 60+ messages in thread
From: Arnd Bergmann @ 2015-03-02 20:48 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-samsung-soc, padma.v, dmitry.torokhov, Maurus Cuelenaere,
	Liam Girdwood, Tomasz Figa, cw00.choi, Mark Brown, Kukjin Kim,
	a.kesavan, ch.naveen, jic23

On Monday 02 March 2015 13:35:53 Arnd Bergmann wrote:
> Hi everyone,
> 
> I've had these patches in a private git tree for a while, and have
> finally gotten around to clean them up some more for submission.
> Hopefully we can get all of it merged into 4.1.
> 
> I've done this to the best of my knowledge, but some parts are
> a bit tricky, so I expect that there are bugs. The trickiest
> part is the touchscreen driver. I've sent it out for review
> last year already, but I have not found anybody who could test
> it, and it's basically a blind rewrite of an existing driver,
> so it's unlikely that I got it all right.
> 
> The other parts may actually work, but it is possible that
> I made a mistake with the ASoC driver, the sparseirq support
> or something else.
> 
> Does anyone still have access to the hardware? I'm particularly
> interested in seeing this patch set get tested on smartq
> and on smdk6410, which have the majority of the hardware.
> 

I should have mentioned, this series (and the respective bits
for realview, mmp, and orion) is now at
http://git.kernel.org/cgit/linux/kernel/git/arnd/playground.git/log/?h=multiplatform-4.0-rc1

	Arnd

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

* [PATCH 00/10] ARM: s3c64xx multiplatform, help needed
@ 2015-03-02 20:48   ` Arnd Bergmann
  0 siblings, 0 replies; 60+ messages in thread
From: Arnd Bergmann @ 2015-03-02 20:48 UTC (permalink / raw)
  To: linux-arm-kernel

On Monday 02 March 2015 13:35:53 Arnd Bergmann wrote:
> Hi everyone,
> 
> I've had these patches in a private git tree for a while, and have
> finally gotten around to clean them up some more for submission.
> Hopefully we can get all of it merged into 4.1.
> 
> I've done this to the best of my knowledge, but some parts are
> a bit tricky, so I expect that there are bugs. The trickiest
> part is the touchscreen driver. I've sent it out for review
> last year already, but I have not found anybody who could test
> it, and it's basically a blind rewrite of an existing driver,
> so it's unlikely that I got it all right.
> 
> The other parts may actually work, but it is possible that
> I made a mistake with the ASoC driver, the sparseirq support
> or something else.
> 
> Does anyone still have access to the hardware? I'm particularly
> interested in seeing this patch set get tested on smartq
> and on smdk6410, which have the majority of the hardware.
> 

I should have mentioned, this series (and the respective bits
for realview, mmp, and orion) is now at
http://git.kernel.org/cgit/linux/kernel/git/arnd/playground.git/log/?h=multiplatform-4.0-rc1

	Arnd

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

* Re: [PATCH 02/10] ASoC: samsung/smartq: use dynamic registration
  2015-03-02 12:35   ` Arnd Bergmann
@ 2015-03-03 14:14     ` Mark Brown
  -1 siblings, 0 replies; 60+ messages in thread
From: Mark Brown @ 2015-03-03 14:14 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arm-kernel, Kukjin Kim, linux-samsung-soc,
	Maurus Cuelenaere, Liam Girdwood, dmitry.torokhov, ch.naveen,
	a.kesavan, cw00.choi, jic23, Tomasz Figa, padma.v

[-- Attachment #1: Type: text/plain, Size: 341 bytes --]

On Mon, Mar 02, 2015 at 01:35:55PM +0100, Arnd Bergmann wrote:
> As a prerequisite for moving s3c64xx into multiplatform configurations,
> we need to change the smartq audio driver to stop using hardcoded
> gpio numbers from the header file, and instead pass the gpio data
> through platform_data.

Acked-by: Mark Brown <broonie@kernel.org>

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* [PATCH 02/10] ASoC: samsung/smartq: use dynamic registration
@ 2015-03-03 14:14     ` Mark Brown
  0 siblings, 0 replies; 60+ messages in thread
From: Mark Brown @ 2015-03-03 14:14 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Mar 02, 2015 at 01:35:55PM +0100, Arnd Bergmann wrote:
> As a prerequisite for moving s3c64xx into multiplatform configurations,
> we need to change the smartq audio driver to stop using hardcoded
> gpio numbers from the header file, and instead pass the gpio data
> through platform_data.

Acked-by: Mark Brown <broonie@kernel.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150303/b36dbcb7/attachment-0001.sig>

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

* Re: [PATCH 01/10] Input: s3c2410_ts: fix S3C_ADC dependency
  2015-03-02 12:35   ` Arnd Bergmann
@ 2015-03-04 23:05     ` Dmitry Torokhov
  -1 siblings, 0 replies; 60+ messages in thread
From: Dmitry Torokhov @ 2015-03-04 23:05 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arm-kernel, Kukjin Kim, linux-samsung-soc,
	Maurus Cuelenaere, Mark Brown, Liam Girdwood, ch.naveen,
	a.kesavan, cw00.choi, jic23, Tomasz Figa, padma.v

On Mon, Mar 02, 2015 at 01:35:54PM +0100, Arnd Bergmann wrote:
> S3C_ADC is only available on machines that don't do ARCH_MULTIPLATFORM,
> so changing the 'select' into 'depends on' here helps us move to
> ARCH_MULTIPLATFORM without introducing regressions.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

> ---
>  drivers/input/touchscreen/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
> index 58917525126e..3b4cd9ab1af0 100644
> --- a/drivers/input/touchscreen/Kconfig
> +++ b/drivers/input/touchscreen/Kconfig
> @@ -326,7 +326,7 @@ config TOUCHSCREEN_ILI210X
>  config TOUCHSCREEN_S3C2410
>  	tristate "Samsung S3C2410/generic touchscreen input driver"
>  	depends on ARCH_S3C24XX || SAMSUNG_DEV_TS
> -	select S3C_ADC
> +	depends on S3C_ADC
>  	help
>  	  Say Y here if you have the s3c2410 touchscreen.
>  
> -- 
> 2.1.0.rc2
> 

-- 
Dmitry

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

* [PATCH 01/10] Input: s3c2410_ts: fix S3C_ADC dependency
@ 2015-03-04 23:05     ` Dmitry Torokhov
  0 siblings, 0 replies; 60+ messages in thread
From: Dmitry Torokhov @ 2015-03-04 23:05 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Mar 02, 2015 at 01:35:54PM +0100, Arnd Bergmann wrote:
> S3C_ADC is only available on machines that don't do ARCH_MULTIPLATFORM,
> so changing the 'select' into 'depends on' here helps us move to
> ARCH_MULTIPLATFORM without introducing regressions.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

> ---
>  drivers/input/touchscreen/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
> index 58917525126e..3b4cd9ab1af0 100644
> --- a/drivers/input/touchscreen/Kconfig
> +++ b/drivers/input/touchscreen/Kconfig
> @@ -326,7 +326,7 @@ config TOUCHSCREEN_ILI210X
>  config TOUCHSCREEN_S3C2410
>  	tristate "Samsung S3C2410/generic touchscreen input driver"
>  	depends on ARCH_S3C24XX || SAMSUNG_DEV_TS
> -	select S3C_ADC
> +	depends on S3C_ADC
>  	help
>  	  Say Y here if you have the s3c2410 touchscreen.
>  
> -- 
> 2.1.0.rc2
> 

-- 
Dmitry

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

* Re: [PATCH 06/10] iio: exynos-adc: add experimental touchscreen support
  2015-03-02 12:35   ` Arnd Bergmann
@ 2015-03-04 23:10     ` Dmitry Torokhov
  -1 siblings, 0 replies; 60+ messages in thread
From: Dmitry Torokhov @ 2015-03-04 23:10 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arm-kernel, Kukjin Kim, linux-samsung-soc,
	Maurus Cuelenaere, Mark Brown, Liam Girdwood, ch.naveen,
	a.kesavan, cw00.choi, jic23, Tomasz Figa, padma.v

Hi Arnd,

On Mon, Mar 02, 2015 at 01:35:59PM +0100, Arnd Bergmann wrote:
> This adds support for the touchscreen on Samsung s3c64xx.
> The driver is completely untested but shows roughly how
> it could be done, following the example of the at91 driver.
> 
> compared to the old plat-samsung/adc driver, there is
> no support for prioritizing ts over other clients, nor
> for oversampling. From my reading of the code, the
> priorities didn't actually have any effect at all, but
> the oversampling might be needed.
> 
> Verifying this driver is the main issue that is currently
> holding up multiplatform support for s3c64xx, so any help
> in testing is very much appreciated.
> 
> The current version uses the IS_REACHABLE() that is
> going to be introduced in the linux-media tree, please
> comment this out for testing.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
>  .../devicetree/bindings/arm/samsung/exynos-adc.txt |   3 +
>  drivers/iio/adc/exynos_adc.c                       | 222 ++++++++++++++++++++-
>  2 files changed, 218 insertions(+), 7 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt b/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt
> index f46ca9a316a2..ccaaec6014bd 100644
> --- a/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt
> +++ b/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt
> @@ -47,6 +47,9 @@ Required properties:
>  
>  - samsung,syscon-phandle Contains the PMU system controller node
>  			(To access the ADC_PHY register on Exynos5250/5420/5800/3250)
> +Optional properties:
> +- has-touchscreen:	If present, indicates that a touchscreen is
> +			connected an usable.
>  
>  Note: child nodes can be added for auto probing from device tree.
>  
> diff --git a/drivers/iio/adc/exynos_adc.c b/drivers/iio/adc/exynos_adc.c
> index 3a2dbb3b4926..75cd381a8181 100644
> --- a/drivers/iio/adc/exynos_adc.c
> +++ b/drivers/iio/adc/exynos_adc.c
> @@ -35,6 +35,7 @@
>  #include <linux/regulator/consumer.h>
>  #include <linux/of_platform.h>
>  #include <linux/err.h>
> +#include <linux/input.h>
>  
>  #include <linux/iio/iio.h>
>  #include <linux/iio/machine.h>
> @@ -42,12 +43,18 @@
>  #include <linux/mfd/syscon.h>
>  #include <linux/regmap.h>
>  
> +#include <linux/platform_data/touchscreen-s3c2410.h>
> +
>  /* S3C/EXYNOS4412/5250 ADC_V1 registers definitions */
>  #define ADC_V1_CON(x)		((x) + 0x00)
> +#define ADC_V1_TSC(x)		((x) + 0x04)
>  #define ADC_V1_DLY(x)		((x) + 0x08)
>  #define ADC_V1_DATX(x)		((x) + 0x0C)
> +#define ADC_V1_DATY(x)		((x) + 0x10)
> +#define ADC_V1_UPDN(x)		((x) + 0x14)
>  #define ADC_V1_INTCLR(x)	((x) + 0x18)
>  #define ADC_V1_MUX(x)		((x) + 0x1c)
> +#define ADC_V1_CLRINTPNDNUP(x)	((x) + 0x20)
>  
>  /* S3C2410 ADC registers definitions */
>  #define ADC_S3C2410_MUX(x)	((x) + 0x18)
> @@ -71,6 +78,30 @@
>  #define ADC_S3C2410_DATX_MASK	0x3FF
>  #define ADC_S3C2416_CON_RES_SEL	(1u << 3)
>  
> +/* touch screen always uses channel 0 */
> +#define ADC_S3C2410_MUX_TS	0
> +
> +/* ADCTSC Register Bits */
> +#define ADC_S3C2443_TSC_UD_SEN		(1u << 8)
> +#define ADC_S3C2410_TSC_YM_SEN		(1u << 7)
> +#define ADC_S3C2410_TSC_YP_SEN		(1u << 6)
> +#define ADC_S3C2410_TSC_XM_SEN		(1u << 5)
> +#define ADC_S3C2410_TSC_XP_SEN		(1u << 4)
> +#define ADC_S3C2410_TSC_PULL_UP_DISABLE	(1u << 3)
> +#define ADC_S3C2410_TSC_AUTO_PST	(1u << 2)
> +#define ADC_S3C2410_TSC_XY_PST(x)	(((x) & 0x3) << 0)
> +
> +#define ADC_TSC_WAIT4INT (ADC_S3C2410_TSC_YM_SEN | \
> +			 ADC_S3C2410_TSC_YP_SEN | \
> +			 ADC_S3C2410_TSC_XP_SEN | \
> +			 ADC_S3C2410_TSC_XY_PST(3))
> +
> +#define ADC_TSC_AUTOPST	(ADC_S3C2410_TSC_YM_SEN | \
> +			 ADC_S3C2410_TSC_YP_SEN | \
> +			 ADC_S3C2410_TSC_XP_SEN | \
> +			 ADC_S3C2410_TSC_AUTO_PST | \
> +			 ADC_S3C2410_TSC_XY_PST(0))
> +
>  /* Bit definitions for ADC_V2 */
>  #define ADC_V2_CON1_SOFT_RESET	(1u << 2)
>  
> @@ -88,7 +119,9 @@
>  /* Bit definitions common for ADC_V1 and ADC_V2 */
>  #define ADC_CON_EN_START	(1u << 0)
>  #define ADC_CON_EN_START_MASK	(0x3 << 0)
> +#define ADC_DATX_PRESSED	(1u << 15)
>  #define ADC_DATX_MASK		0xFFF
> +#define ADC_DATY_MASK		0xFFF
>  
>  #define EXYNOS_ADC_TIMEOUT	(msecs_to_jiffies(100))
>  
> @@ -98,17 +131,24 @@
>  struct exynos_adc {
>  	struct exynos_adc_data	*data;
>  	struct device		*dev;
> +	struct input_dev	*input;
>  	void __iomem		*regs;
>  	struct regmap		*pmu_map;
>  	struct clk		*clk;
>  	struct clk		*sclk;
>  	unsigned int		irq;
> +	unsigned int		tsirq;
> +	unsigned int		delay;
>  	struct regulator	*vdd;
>  
>  	struct completion	completion;
>  
>  	u32			value;
>  	unsigned int            version;
> +
> +	bool			read_ts;
> +	u32			ts_x;
> +	u32			ts_y;
>  };
>  
>  struct exynos_adc_data {
> @@ -197,6 +237,9 @@ static void exynos_adc_v1_init_hw(struct exynos_adc *info)
>  	/* Enable 12-bit ADC resolution */
>  	con1 |= ADC_V1_CON_RES;
>  	writel(con1, ADC_V1_CON(info->regs));
> +
> +	/* set touchscreen delay */
> +	writel(info->delay, ADC_V1_DLY(info->regs));
>  }
>  
>  static void exynos_adc_v1_exit_hw(struct exynos_adc *info)
> @@ -480,8 +523,8 @@ static int exynos_read_raw(struct iio_dev *indio_dev,
>  	if (info->data->start_conv)
>  		info->data->start_conv(info, chan->address);
>  
> -	timeout = wait_for_completion_timeout
> -			(&info->completion, EXYNOS_ADC_TIMEOUT);
> +	timeout = wait_for_completion_timeout(&info->completion,
> +					      EXYNOS_ADC_TIMEOUT);
>  	if (timeout == 0) {
>  		dev_warn(&indio_dev->dev, "Conversion timed out! Resetting\n");
>  		if (info->data->init_hw)
> @@ -498,13 +541,55 @@ static int exynos_read_raw(struct iio_dev *indio_dev,
>  	return ret;
>  }
>  
> +static int exynos_read_s3c64xx_ts(struct iio_dev *indio_dev, int *x, int *y)
> +{
> +	struct exynos_adc *info = iio_priv(indio_dev);
> +	unsigned long timeout;
> +	int ret;
> +
> +	mutex_lock(&indio_dev->mlock);
> +	info->read_ts = true;
> +
> +	reinit_completion(&info->completion);
> +
> +	writel(ADC_S3C2410_TSC_PULL_UP_DISABLE | ADC_TSC_AUTOPST,
> +	       ADC_V1_TSC(info->regs));
> +
> +	/* Select the ts channel to be used and Trigger conversion */
> +	info->data->start_conv(info, ADC_S3C2410_MUX_TS);
> +
> +	timeout = wait_for_completion_timeout(&info->completion,
> +					      EXYNOS_ADC_TIMEOUT);
> +	if (timeout == 0) {
> +		dev_warn(&indio_dev->dev, "Conversion timed out! Resetting\n");
> +		if (info->data->init_hw)
> +			info->data->init_hw(info);
> +		ret = -ETIMEDOUT;
> +	} else {
> +		*x = info->ts_x;
> +		*y = info->ts_y;
> +		ret = 0;
> +	}
> +
> +	info->read_ts = false;
> +	mutex_unlock(&indio_dev->mlock);
> +
> +	return ret;
> +}
> +
>  static irqreturn_t exynos_adc_isr(int irq, void *dev_id)
>  {
>  	struct exynos_adc *info = (struct exynos_adc *)dev_id;
>  	u32 mask = info->data->mask;
>  
>  	/* Read value */
> -	info->value = readl(ADC_V1_DATX(info->regs)) & mask;
> +	if (info->read_ts) {
> +		info->ts_x = readl(ADC_V1_DATX(info->regs));
> +		info->ts_y = readl(ADC_V1_DATY(info->regs));
> +		writel(ADC_TSC_WAIT4INT | ADC_S3C2443_TSC_UD_SEN, ADC_V1_TSC(info->regs));
> +	} else {
> +		info->value = readl(ADC_V1_DATX(info->regs)) & mask;
> +	}
>  
>  	/* clear irq */
>  	if (info->data->clear_irq)
> @@ -515,6 +600,46 @@ static irqreturn_t exynos_adc_isr(int irq, void *dev_id)
>  	return IRQ_HANDLED;
>  }
>  
> +/*
> + * Here we (ab)use a threaded interrupt handler to stay running
> + * for as long as the touchscreen remains pressed, we report
> + * a new event with the latest data and then sleep until the
> + * next timer tick. This mirrors the behavior of the old
> + * driver, with much less code.
> + */
> +static irqreturn_t exynos_ts_isr(int irq, void *dev_id)
> +{
> +	struct exynos_adc *info = dev_id;
> +	struct iio_dev *dev = dev_get_drvdata(info->dev);
> +	u32 x, y;
> +	bool pressed;
> +	int ret;
> +
> +	while (info->input->users) {
> +		ret = exynos_read_s3c64xx_ts(dev, &x, &y);
> +		if (ret == -ETIMEDOUT)
> +			break;
> +
> +		pressed = x & y & ADC_DATX_PRESSED;
> +		if (!pressed) {
> +			input_report_key(info->input, BTN_TOUCH, 0);
> +			input_sync(info->input);
> +			break;
> +		}
> +
> +		input_report_abs(info->input, ABS_X, x & ADC_DATX_MASK);
> +		input_report_abs(info->input, ABS_Y, y & ADC_DATY_MASK);
> +		input_report_key(info->input, BTN_TOUCH, 1);
> +		input_sync(info->input);
> +
> +		msleep(1);
> +	};
> +
> +	writel(0, ADC_V1_CLRINTPNDNUP(info->regs));
> +
> +	return IRQ_HANDLED;
> +}
> +
>  static int exynos_adc_reg_access(struct iio_dev *indio_dev,
>  			      unsigned reg, unsigned writeval,
>  			      unsigned *readval)
> @@ -566,18 +691,70 @@ static int exynos_adc_remove_devices(struct device *dev, void *c)
>  	return 0;
>  }
>  
> +static int exynos_adc_ts_open(struct input_dev *dev)
> +{
> +	struct exynos_adc *info = input_get_drvdata(dev);
> +
> +	enable_irq(info->tsirq);
> +
> +	return 0;
> +}
> +
> +static void exynos_adc_ts_close(struct input_dev *dev)
> +{
> +	struct exynos_adc *info = input_get_drvdata(dev);
> +
> +	disable_irq(info->tsirq);
> +}
> +
> +static int exynos_adc_ts_init(struct exynos_adc *info)
> +{
> +	int ret;
> +
> +	if (info->tsirq <= 0)
> +		return -ENODEV;
> +
> +	info->input = input_allocate_device();
> +	if (!info->input)
> +		return -ENOMEM;
> +
> +	info->input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
> +	info->input->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
> +
> +	input_set_abs_params(info->input, ABS_X, 0, 0x3FF, 0, 0);
> +	input_set_abs_params(info->input, ABS_Y, 0, 0x3FF, 0, 0);
> +
> +	info->input->name = "S3C24xx TouchScreen";
> +	info->input->id.bustype = BUS_HOST;
> +	info->input->open = exynos_adc_ts_open;
> +	info->input->close = exynos_adc_ts_close;
> +
> +	input_set_drvdata(info->input, info);
> +
> +	ret = input_register_device(info->input);
> +	if (ret)
> +		input_free_device(info->input);


If you fail to register input device are you sure you want to continue
and register interrupt?

> +
> +	disable_irq(info->tsirq);
> +	ret = request_threaded_irq(info->tsirq, NULL, exynos_ts_isr,
> +				   0, "touchscreen", info);
> +	if (ret)
> +		input_unregister_device(info->input);
> +
> +	return ret;
> +}
> +
>  static int exynos_adc_probe(struct platform_device *pdev)
>  {
>  	struct exynos_adc *info = NULL;
>  	struct device_node *np = pdev->dev.of_node;
> +	struct s3c2410_ts_mach_info *pdata = dev_get_platdata(&pdev->dev);
>  	struct iio_dev *indio_dev = NULL;
>  	struct resource	*mem;
> +	bool has_ts = false;
>  	int ret = -ENODEV;
>  	int irq;
>  
> -	if (!np)
> -		return ret;
> -
>  	indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(struct exynos_adc));
>  	if (!indio_dev) {
>  		dev_err(&pdev->dev, "failed allocating iio device\n");
> @@ -613,8 +790,14 @@ static int exynos_adc_probe(struct platform_device *pdev)
>  		dev_err(&pdev->dev, "no irq resource?\n");
>  		return irq;
>  	}
> -
>  	info->irq = irq;
> +
> +	irq = platform_get_irq(pdev, 1);
> +	if (irq == -EPROBE_DEFER)
> +		return irq;
> +
> +	info->tsirq = irq;
> +
>  	info->dev = &pdev->dev;
>  
>  	init_completion(&info->completion);
> @@ -680,6 +863,22 @@ static int exynos_adc_probe(struct platform_device *pdev)
>  	if (info->data->init_hw)
>  		info->data->init_hw(info);
>  
> +	/* leave out any TS related code if unreachable */
> +	if (IS_REACHABLE(CONFIG_INPUT)) {
> +		has_ts = of_property_read_bool(pdev->dev.of_node,
> +					       "has-touchscreen") || pdata;
> +	}
> +
> +	if (pdata)
> +		info->delay = pdata->delay;
> +	else
> +		info->delay = 10000;
> +
> +	if (has_ts)
> +		ret = exynos_adc_ts_init(info);
> +	if (ret)
> +		goto err_iio;
> +
>  	ret = of_platform_populate(np, exynos_adc_match, NULL, &indio_dev->dev);
>  	if (ret < 0) {
>  		dev_err(&pdev->dev, "failed adding child nodes\n");
> @@ -691,6 +890,11 @@ static int exynos_adc_probe(struct platform_device *pdev)
>  err_of_populate:
>  	device_for_each_child(&indio_dev->dev, NULL,
>  				exynos_adc_remove_devices);
> +	if (has_ts) {
> +		input_unregister_device(info->input);
> +		free_irq(info->tsirq, info);
> +	}
> +err_iio:
>  	iio_device_unregister(indio_dev);
>  err_irq:
>  	free_irq(info->irq, info);
> @@ -710,6 +914,10 @@ static int exynos_adc_remove(struct platform_device *pdev)
>  	struct iio_dev *indio_dev = platform_get_drvdata(pdev);
>  	struct exynos_adc *info = iio_priv(indio_dev);
>  
> +	if (IS_REACHABLE(CONFIG_INPUT)) {
> +		free_irq(info->tsirq, info);
> +		input_unregister_device(info->input);
> +	}
>  	device_for_each_child(&indio_dev->dev, NULL,
>  				exynos_adc_remove_devices);
>  	iio_device_unregister(indio_dev);
> -- 
> 2.1.0.rc2
> 

Thanks.

-- 
Dmitry

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

* [PATCH 06/10] iio: exynos-adc: add experimental touchscreen support
@ 2015-03-04 23:10     ` Dmitry Torokhov
  0 siblings, 0 replies; 60+ messages in thread
From: Dmitry Torokhov @ 2015-03-04 23:10 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Arnd,

On Mon, Mar 02, 2015 at 01:35:59PM +0100, Arnd Bergmann wrote:
> This adds support for the touchscreen on Samsung s3c64xx.
> The driver is completely untested but shows roughly how
> it could be done, following the example of the at91 driver.
> 
> compared to the old plat-samsung/adc driver, there is
> no support for prioritizing ts over other clients, nor
> for oversampling. From my reading of the code, the
> priorities didn't actually have any effect at all, but
> the oversampling might be needed.
> 
> Verifying this driver is the main issue that is currently
> holding up multiplatform support for s3c64xx, so any help
> in testing is very much appreciated.
> 
> The current version uses the IS_REACHABLE() that is
> going to be introduced in the linux-media tree, please
> comment this out for testing.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
>  .../devicetree/bindings/arm/samsung/exynos-adc.txt |   3 +
>  drivers/iio/adc/exynos_adc.c                       | 222 ++++++++++++++++++++-
>  2 files changed, 218 insertions(+), 7 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt b/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt
> index f46ca9a316a2..ccaaec6014bd 100644
> --- a/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt
> +++ b/Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt
> @@ -47,6 +47,9 @@ Required properties:
>  
>  - samsung,syscon-phandle Contains the PMU system controller node
>  			(To access the ADC_PHY register on Exynos5250/5420/5800/3250)
> +Optional properties:
> +- has-touchscreen:	If present, indicates that a touchscreen is
> +			connected an usable.
>  
>  Note: child nodes can be added for auto probing from device tree.
>  
> diff --git a/drivers/iio/adc/exynos_adc.c b/drivers/iio/adc/exynos_adc.c
> index 3a2dbb3b4926..75cd381a8181 100644
> --- a/drivers/iio/adc/exynos_adc.c
> +++ b/drivers/iio/adc/exynos_adc.c
> @@ -35,6 +35,7 @@
>  #include <linux/regulator/consumer.h>
>  #include <linux/of_platform.h>
>  #include <linux/err.h>
> +#include <linux/input.h>
>  
>  #include <linux/iio/iio.h>
>  #include <linux/iio/machine.h>
> @@ -42,12 +43,18 @@
>  #include <linux/mfd/syscon.h>
>  #include <linux/regmap.h>
>  
> +#include <linux/platform_data/touchscreen-s3c2410.h>
> +
>  /* S3C/EXYNOS4412/5250 ADC_V1 registers definitions */
>  #define ADC_V1_CON(x)		((x) + 0x00)
> +#define ADC_V1_TSC(x)		((x) + 0x04)
>  #define ADC_V1_DLY(x)		((x) + 0x08)
>  #define ADC_V1_DATX(x)		((x) + 0x0C)
> +#define ADC_V1_DATY(x)		((x) + 0x10)
> +#define ADC_V1_UPDN(x)		((x) + 0x14)
>  #define ADC_V1_INTCLR(x)	((x) + 0x18)
>  #define ADC_V1_MUX(x)		((x) + 0x1c)
> +#define ADC_V1_CLRINTPNDNUP(x)	((x) + 0x20)
>  
>  /* S3C2410 ADC registers definitions */
>  #define ADC_S3C2410_MUX(x)	((x) + 0x18)
> @@ -71,6 +78,30 @@
>  #define ADC_S3C2410_DATX_MASK	0x3FF
>  #define ADC_S3C2416_CON_RES_SEL	(1u << 3)
>  
> +/* touch screen always uses channel 0 */
> +#define ADC_S3C2410_MUX_TS	0
> +
> +/* ADCTSC Register Bits */
> +#define ADC_S3C2443_TSC_UD_SEN		(1u << 8)
> +#define ADC_S3C2410_TSC_YM_SEN		(1u << 7)
> +#define ADC_S3C2410_TSC_YP_SEN		(1u << 6)
> +#define ADC_S3C2410_TSC_XM_SEN		(1u << 5)
> +#define ADC_S3C2410_TSC_XP_SEN		(1u << 4)
> +#define ADC_S3C2410_TSC_PULL_UP_DISABLE	(1u << 3)
> +#define ADC_S3C2410_TSC_AUTO_PST	(1u << 2)
> +#define ADC_S3C2410_TSC_XY_PST(x)	(((x) & 0x3) << 0)
> +
> +#define ADC_TSC_WAIT4INT (ADC_S3C2410_TSC_YM_SEN | \
> +			 ADC_S3C2410_TSC_YP_SEN | \
> +			 ADC_S3C2410_TSC_XP_SEN | \
> +			 ADC_S3C2410_TSC_XY_PST(3))
> +
> +#define ADC_TSC_AUTOPST	(ADC_S3C2410_TSC_YM_SEN | \
> +			 ADC_S3C2410_TSC_YP_SEN | \
> +			 ADC_S3C2410_TSC_XP_SEN | \
> +			 ADC_S3C2410_TSC_AUTO_PST | \
> +			 ADC_S3C2410_TSC_XY_PST(0))
> +
>  /* Bit definitions for ADC_V2 */
>  #define ADC_V2_CON1_SOFT_RESET	(1u << 2)
>  
> @@ -88,7 +119,9 @@
>  /* Bit definitions common for ADC_V1 and ADC_V2 */
>  #define ADC_CON_EN_START	(1u << 0)
>  #define ADC_CON_EN_START_MASK	(0x3 << 0)
> +#define ADC_DATX_PRESSED	(1u << 15)
>  #define ADC_DATX_MASK		0xFFF
> +#define ADC_DATY_MASK		0xFFF
>  
>  #define EXYNOS_ADC_TIMEOUT	(msecs_to_jiffies(100))
>  
> @@ -98,17 +131,24 @@
>  struct exynos_adc {
>  	struct exynos_adc_data	*data;
>  	struct device		*dev;
> +	struct input_dev	*input;
>  	void __iomem		*regs;
>  	struct regmap		*pmu_map;
>  	struct clk		*clk;
>  	struct clk		*sclk;
>  	unsigned int		irq;
> +	unsigned int		tsirq;
> +	unsigned int		delay;
>  	struct regulator	*vdd;
>  
>  	struct completion	completion;
>  
>  	u32			value;
>  	unsigned int            version;
> +
> +	bool			read_ts;
> +	u32			ts_x;
> +	u32			ts_y;
>  };
>  
>  struct exynos_adc_data {
> @@ -197,6 +237,9 @@ static void exynos_adc_v1_init_hw(struct exynos_adc *info)
>  	/* Enable 12-bit ADC resolution */
>  	con1 |= ADC_V1_CON_RES;
>  	writel(con1, ADC_V1_CON(info->regs));
> +
> +	/* set touchscreen delay */
> +	writel(info->delay, ADC_V1_DLY(info->regs));
>  }
>  
>  static void exynos_adc_v1_exit_hw(struct exynos_adc *info)
> @@ -480,8 +523,8 @@ static int exynos_read_raw(struct iio_dev *indio_dev,
>  	if (info->data->start_conv)
>  		info->data->start_conv(info, chan->address);
>  
> -	timeout = wait_for_completion_timeout
> -			(&info->completion, EXYNOS_ADC_TIMEOUT);
> +	timeout = wait_for_completion_timeout(&info->completion,
> +					      EXYNOS_ADC_TIMEOUT);
>  	if (timeout == 0) {
>  		dev_warn(&indio_dev->dev, "Conversion timed out! Resetting\n");
>  		if (info->data->init_hw)
> @@ -498,13 +541,55 @@ static int exynos_read_raw(struct iio_dev *indio_dev,
>  	return ret;
>  }
>  
> +static int exynos_read_s3c64xx_ts(struct iio_dev *indio_dev, int *x, int *y)
> +{
> +	struct exynos_adc *info = iio_priv(indio_dev);
> +	unsigned long timeout;
> +	int ret;
> +
> +	mutex_lock(&indio_dev->mlock);
> +	info->read_ts = true;
> +
> +	reinit_completion(&info->completion);
> +
> +	writel(ADC_S3C2410_TSC_PULL_UP_DISABLE | ADC_TSC_AUTOPST,
> +	       ADC_V1_TSC(info->regs));
> +
> +	/* Select the ts channel to be used and Trigger conversion */
> +	info->data->start_conv(info, ADC_S3C2410_MUX_TS);
> +
> +	timeout = wait_for_completion_timeout(&info->completion,
> +					      EXYNOS_ADC_TIMEOUT);
> +	if (timeout == 0) {
> +		dev_warn(&indio_dev->dev, "Conversion timed out! Resetting\n");
> +		if (info->data->init_hw)
> +			info->data->init_hw(info);
> +		ret = -ETIMEDOUT;
> +	} else {
> +		*x = info->ts_x;
> +		*y = info->ts_y;
> +		ret = 0;
> +	}
> +
> +	info->read_ts = false;
> +	mutex_unlock(&indio_dev->mlock);
> +
> +	return ret;
> +}
> +
>  static irqreturn_t exynos_adc_isr(int irq, void *dev_id)
>  {
>  	struct exynos_adc *info = (struct exynos_adc *)dev_id;
>  	u32 mask = info->data->mask;
>  
>  	/* Read value */
> -	info->value = readl(ADC_V1_DATX(info->regs)) & mask;
> +	if (info->read_ts) {
> +		info->ts_x = readl(ADC_V1_DATX(info->regs));
> +		info->ts_y = readl(ADC_V1_DATY(info->regs));
> +		writel(ADC_TSC_WAIT4INT | ADC_S3C2443_TSC_UD_SEN, ADC_V1_TSC(info->regs));
> +	} else {
> +		info->value = readl(ADC_V1_DATX(info->regs)) & mask;
> +	}
>  
>  	/* clear irq */
>  	if (info->data->clear_irq)
> @@ -515,6 +600,46 @@ static irqreturn_t exynos_adc_isr(int irq, void *dev_id)
>  	return IRQ_HANDLED;
>  }
>  
> +/*
> + * Here we (ab)use a threaded interrupt handler to stay running
> + * for as long as the touchscreen remains pressed, we report
> + * a new event with the latest data and then sleep until the
> + * next timer tick. This mirrors the behavior of the old
> + * driver, with much less code.
> + */
> +static irqreturn_t exynos_ts_isr(int irq, void *dev_id)
> +{
> +	struct exynos_adc *info = dev_id;
> +	struct iio_dev *dev = dev_get_drvdata(info->dev);
> +	u32 x, y;
> +	bool pressed;
> +	int ret;
> +
> +	while (info->input->users) {
> +		ret = exynos_read_s3c64xx_ts(dev, &x, &y);
> +		if (ret == -ETIMEDOUT)
> +			break;
> +
> +		pressed = x & y & ADC_DATX_PRESSED;
> +		if (!pressed) {
> +			input_report_key(info->input, BTN_TOUCH, 0);
> +			input_sync(info->input);
> +			break;
> +		}
> +
> +		input_report_abs(info->input, ABS_X, x & ADC_DATX_MASK);
> +		input_report_abs(info->input, ABS_Y, y & ADC_DATY_MASK);
> +		input_report_key(info->input, BTN_TOUCH, 1);
> +		input_sync(info->input);
> +
> +		msleep(1);
> +	};
> +
> +	writel(0, ADC_V1_CLRINTPNDNUP(info->regs));
> +
> +	return IRQ_HANDLED;
> +}
> +
>  static int exynos_adc_reg_access(struct iio_dev *indio_dev,
>  			      unsigned reg, unsigned writeval,
>  			      unsigned *readval)
> @@ -566,18 +691,70 @@ static int exynos_adc_remove_devices(struct device *dev, void *c)
>  	return 0;
>  }
>  
> +static int exynos_adc_ts_open(struct input_dev *dev)
> +{
> +	struct exynos_adc *info = input_get_drvdata(dev);
> +
> +	enable_irq(info->tsirq);
> +
> +	return 0;
> +}
> +
> +static void exynos_adc_ts_close(struct input_dev *dev)
> +{
> +	struct exynos_adc *info = input_get_drvdata(dev);
> +
> +	disable_irq(info->tsirq);
> +}
> +
> +static int exynos_adc_ts_init(struct exynos_adc *info)
> +{
> +	int ret;
> +
> +	if (info->tsirq <= 0)
> +		return -ENODEV;
> +
> +	info->input = input_allocate_device();
> +	if (!info->input)
> +		return -ENOMEM;
> +
> +	info->input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
> +	info->input->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
> +
> +	input_set_abs_params(info->input, ABS_X, 0, 0x3FF, 0, 0);
> +	input_set_abs_params(info->input, ABS_Y, 0, 0x3FF, 0, 0);
> +
> +	info->input->name = "S3C24xx TouchScreen";
> +	info->input->id.bustype = BUS_HOST;
> +	info->input->open = exynos_adc_ts_open;
> +	info->input->close = exynos_adc_ts_close;
> +
> +	input_set_drvdata(info->input, info);
> +
> +	ret = input_register_device(info->input);
> +	if (ret)
> +		input_free_device(info->input);


If you fail to register input device are you sure you want to continue
and register interrupt?

> +
> +	disable_irq(info->tsirq);
> +	ret = request_threaded_irq(info->tsirq, NULL, exynos_ts_isr,
> +				   0, "touchscreen", info);
> +	if (ret)
> +		input_unregister_device(info->input);
> +
> +	return ret;
> +}
> +
>  static int exynos_adc_probe(struct platform_device *pdev)
>  {
>  	struct exynos_adc *info = NULL;
>  	struct device_node *np = pdev->dev.of_node;
> +	struct s3c2410_ts_mach_info *pdata = dev_get_platdata(&pdev->dev);
>  	struct iio_dev *indio_dev = NULL;
>  	struct resource	*mem;
> +	bool has_ts = false;
>  	int ret = -ENODEV;
>  	int irq;
>  
> -	if (!np)
> -		return ret;
> -
>  	indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(struct exynos_adc));
>  	if (!indio_dev) {
>  		dev_err(&pdev->dev, "failed allocating iio device\n");
> @@ -613,8 +790,14 @@ static int exynos_adc_probe(struct platform_device *pdev)
>  		dev_err(&pdev->dev, "no irq resource?\n");
>  		return irq;
>  	}
> -
>  	info->irq = irq;
> +
> +	irq = platform_get_irq(pdev, 1);
> +	if (irq == -EPROBE_DEFER)
> +		return irq;
> +
> +	info->tsirq = irq;
> +
>  	info->dev = &pdev->dev;
>  
>  	init_completion(&info->completion);
> @@ -680,6 +863,22 @@ static int exynos_adc_probe(struct platform_device *pdev)
>  	if (info->data->init_hw)
>  		info->data->init_hw(info);
>  
> +	/* leave out any TS related code if unreachable */
> +	if (IS_REACHABLE(CONFIG_INPUT)) {
> +		has_ts = of_property_read_bool(pdev->dev.of_node,
> +					       "has-touchscreen") || pdata;
> +	}
> +
> +	if (pdata)
> +		info->delay = pdata->delay;
> +	else
> +		info->delay = 10000;
> +
> +	if (has_ts)
> +		ret = exynos_adc_ts_init(info);
> +	if (ret)
> +		goto err_iio;
> +
>  	ret = of_platform_populate(np, exynos_adc_match, NULL, &indio_dev->dev);
>  	if (ret < 0) {
>  		dev_err(&pdev->dev, "failed adding child nodes\n");
> @@ -691,6 +890,11 @@ static int exynos_adc_probe(struct platform_device *pdev)
>  err_of_populate:
>  	device_for_each_child(&indio_dev->dev, NULL,
>  				exynos_adc_remove_devices);
> +	if (has_ts) {
> +		input_unregister_device(info->input);
> +		free_irq(info->tsirq, info);
> +	}
> +err_iio:
>  	iio_device_unregister(indio_dev);
>  err_irq:
>  	free_irq(info->irq, info);
> @@ -710,6 +914,10 @@ static int exynos_adc_remove(struct platform_device *pdev)
>  	struct iio_dev *indio_dev = platform_get_drvdata(pdev);
>  	struct exynos_adc *info = iio_priv(indio_dev);
>  
> +	if (IS_REACHABLE(CONFIG_INPUT)) {
> +		free_irq(info->tsirq, info);
> +		input_unregister_device(info->input);
> +	}
>  	device_for_each_child(&indio_dev->dev, NULL,
>  				exynos_adc_remove_devices);
>  	iio_device_unregister(indio_dev);
> -- 
> 2.1.0.rc2
> 

Thanks.

-- 
Dmitry

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

* Re: [PATCH 05/10] ARM: s3c64xx: enable sparse IRQ support
  2015-03-02 12:35   ` Arnd Bergmann
@ 2015-03-06 17:43     ` Charles Keepax
  -1 siblings, 0 replies; 60+ messages in thread
From: Charles Keepax @ 2015-03-06 17:43 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arm-kernel, linux-samsung-soc, padma.v, dmitry.torokhov,
	Maurus Cuelenaere, Liam Girdwood, Tomasz Figa, cw00.choi,
	Mark Brown, Kukjin Kim, a.kesavan, ch.naveen, jic23

On Mon, Mar 02, 2015 at 01:35:58PM +0100, Arnd Bergmann wrote:
> This is another prerequisite for enabling multiplatform
> support, and it is the part I am least certain about.
> 
> I assume it will cause the extra boot message "Cannot
> allocate irq_descs @ IRQ%d, assuming pre-allocated" to
> be printed, but otherwise work ok. This definitely needs
> to be tested on real hardware to see if it works.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---

This one appears to cause some problems with the IRQs on
Cragganmore, I need to look into it a bit more but it looks like
one of the PMICs can't allocate its IRQs:

[    0.961455] wm831x 1-0034: WM8311 revision C
[    0.965066] wm831x 1-0034: Failed to allocate IRQs: -17

And the CODEC can't request its IRQ:

[    4.252735] arizona spi0.1: WM5102 revision C
[    4.269763] arizona spi0.1: Failed to request primary IRQ 263: -22

Hopefully I can look into this a little more next week.

Thanks,
Charles

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

* [PATCH 05/10] ARM: s3c64xx: enable sparse IRQ support
@ 2015-03-06 17:43     ` Charles Keepax
  0 siblings, 0 replies; 60+ messages in thread
From: Charles Keepax @ 2015-03-06 17:43 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Mar 02, 2015 at 01:35:58PM +0100, Arnd Bergmann wrote:
> This is another prerequisite for enabling multiplatform
> support, and it is the part I am least certain about.
> 
> I assume it will cause the extra boot message "Cannot
> allocate irq_descs @ IRQ%d, assuming pre-allocated" to
> be printed, but otherwise work ok. This definitely needs
> to be tested on real hardware to see if it works.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---

This one appears to cause some problems with the IRQs on
Cragganmore, I need to look into it a bit more but it looks like
one of the PMICs can't allocate its IRQs:

[    0.961455] wm831x 1-0034: WM8311 revision C
[    0.965066] wm831x 1-0034: Failed to allocate IRQs: -17

And the CODEC can't request its IRQ:

[    4.252735] arizona spi0.1: WM5102 revision C
[    4.269763] arizona spi0.1: Failed to request primary IRQ 263: -22

Hopefully I can look into this a little more next week.

Thanks,
Charles

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

* Re: [PATCH 05/10] ARM: s3c64xx: enable sparse IRQ support
  2015-03-06 17:43     ` Charles Keepax
@ 2015-03-08 18:56       ` Mark Brown
  -1 siblings, 0 replies; 60+ messages in thread
From: Mark Brown @ 2015-03-08 18:56 UTC (permalink / raw)
  To: Charles Keepax
  Cc: Arnd Bergmann, linux-arm-kernel, linux-samsung-soc, padma.v,
	dmitry.torokhov, Maurus Cuelenaere, Liam Girdwood, Tomasz Figa,
	cw00.choi, Kukjin Kim, a.kesavan, ch.naveen, jic23

[-- Attachment #1: Type: text/plain, Size: 679 bytes --]

On Fri, Mar 06, 2015 at 05:43:16PM +0000, Charles Keepax wrote:

> Cragganmore, I need to look into it a bit more but it looks like
> one of the PMICs can't allocate its IRQs:

> [    0.961455] wm831x 1-0034: WM8311 revision C
> [    0.965066] wm831x 1-0034: Failed to allocate IRQs: -17

> And the CODEC can't request its IRQ:

> [    4.252735] arizona spi0.1: WM5102 revision C
> [    4.269763] arizona spi0.1: Failed to request primary IRQ 263: -22

> Hopefully I can look into this a little more next week.

The second is a knock on from the first - the CODEC interrupt line is
connected to the PMIC so since the PMIC can't allocate its IRQ range the
CODEC can't request it.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* [PATCH 05/10] ARM: s3c64xx: enable sparse IRQ support
@ 2015-03-08 18:56       ` Mark Brown
  0 siblings, 0 replies; 60+ messages in thread
From: Mark Brown @ 2015-03-08 18:56 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Mar 06, 2015 at 05:43:16PM +0000, Charles Keepax wrote:

> Cragganmore, I need to look into it a bit more but it looks like
> one of the PMICs can't allocate its IRQs:

> [    0.961455] wm831x 1-0034: WM8311 revision C
> [    0.965066] wm831x 1-0034: Failed to allocate IRQs: -17

> And the CODEC can't request its IRQ:

> [    4.252735] arizona spi0.1: WM5102 revision C
> [    4.269763] arizona spi0.1: Failed to request primary IRQ 263: -22

> Hopefully I can look into this a little more next week.

The second is a knock on from the first - the CODEC interrupt line is
connected to the PMIC so since the PMIC can't allocate its IRQ range the
CODEC can't request it.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150308/8268abcb/attachment.sig>

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

* Re: [PATCH 05/10] ARM: s3c64xx: enable sparse IRQ support
  2015-03-06 17:43     ` Charles Keepax
@ 2015-03-08 21:42       ` Arnd Bergmann
  -1 siblings, 0 replies; 60+ messages in thread
From: Arnd Bergmann @ 2015-03-08 21:42 UTC (permalink / raw)
  To: Charles Keepax
  Cc: linux-arm-kernel, linux-samsung-soc, padma.v, dmitry.torokhov,
	Maurus Cuelenaere, Liam Girdwood, Tomasz Figa, cw00.choi,
	Mark Brown, Kukjin Kim, a.kesavan, ch.naveen, jic23

On Friday 06 March 2015 17:43:16 Charles Keepax wrote:
> On Mon, Mar 02, 2015 at 01:35:58PM +0100, Arnd Bergmann wrote:
> > This is another prerequisite for enabling multiplatform
> > support, and it is the part I am least certain about.
> > 
> > I assume it will cause the extra boot message "Cannot
> > allocate irq_descs @ IRQ%d, assuming pre-allocated" to
> > be printed, but otherwise work ok. This definitely needs
> > to be tested on real hardware to see if it works.
> > 
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > ---
> 
> This one appears to cause some problems with the IRQs on
> Cragganmore, I need to look into it a bit more but it looks like
> one of the PMICs can't allocate its IRQs:
> 
> [    0.961455] wm831x 1-0034: WM8311 revision C
> [    0.965066] wm831x 1-0034: Failed to allocate IRQs: -17
> 
> And the CODEC can't request its IRQ:
> 
> [    4.252735] arizona spi0.1: WM5102 revision C
> [    4.269763] arizona spi0.1: Failed to request primary IRQ 263: -22
> 
> Hopefully I can look into this a little more next week.
> 

My interpretation is that I mistakenly set the .nr_irqs value for
craggamore to include all irqs that the board has, while the
wm831x tries to allocate the irq descriptors itself and fails if
they are already allocated. If that is the only problem here, it
would get fixed by this change:

diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c
index f395a5617142..cbe353a5450e 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
@@ -855,7 +855,7 @@ static void __init crag6410_machine_init(void)
 MACHINE_START(WLF_CRAGG_6410, "Wolfson Cragganmore 6410")
 	/* Maintainer: Mark Brown <broonie@opensource.wolfsonmicro.com> */
 	.atag_offset	= 0x100,
-	.nr_irqs	= S3C64XX_NR_IRQS + 160,
+	.nr_irqs	= S3C64XX_NR_IRQS,
 	.init_irq	= s3c6410_init_irq,
 	.map_io		= crag6410_map_io,
 	.init_machine	= crag6410_machine_init,

The samsung-gpio driver does not allocate irq descriptors for itself
though, otherwise we could make the S3C64XX_NR_IRQS number smaller.

	Arnd

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

* [PATCH 05/10] ARM: s3c64xx: enable sparse IRQ support
@ 2015-03-08 21:42       ` Arnd Bergmann
  0 siblings, 0 replies; 60+ messages in thread
From: Arnd Bergmann @ 2015-03-08 21:42 UTC (permalink / raw)
  To: linux-arm-kernel

On Friday 06 March 2015 17:43:16 Charles Keepax wrote:
> On Mon, Mar 02, 2015 at 01:35:58PM +0100, Arnd Bergmann wrote:
> > This is another prerequisite for enabling multiplatform
> > support, and it is the part I am least certain about.
> > 
> > I assume it will cause the extra boot message "Cannot
> > allocate irq_descs @ IRQ%d, assuming pre-allocated" to
> > be printed, but otherwise work ok. This definitely needs
> > to be tested on real hardware to see if it works.
> > 
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > ---
> 
> This one appears to cause some problems with the IRQs on
> Cragganmore, I need to look into it a bit more but it looks like
> one of the PMICs can't allocate its IRQs:
> 
> [    0.961455] wm831x 1-0034: WM8311 revision C
> [    0.965066] wm831x 1-0034: Failed to allocate IRQs: -17
> 
> And the CODEC can't request its IRQ:
> 
> [    4.252735] arizona spi0.1: WM5102 revision C
> [    4.269763] arizona spi0.1: Failed to request primary IRQ 263: -22
> 
> Hopefully I can look into this a little more next week.
> 

My interpretation is that I mistakenly set the .nr_irqs value for
craggamore to include all irqs that the board has, while the
wm831x tries to allocate the irq descriptors itself and fails if
they are already allocated. If that is the only problem here, it
would get fixed by this change:

diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c
index f395a5617142..cbe353a5450e 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
@@ -855,7 +855,7 @@ static void __init crag6410_machine_init(void)
 MACHINE_START(WLF_CRAGG_6410, "Wolfson Cragganmore 6410")
 	/* Maintainer: Mark Brown <broonie@opensource.wolfsonmicro.com> */
 	.atag_offset	= 0x100,
-	.nr_irqs	= S3C64XX_NR_IRQS + 160,
+	.nr_irqs	= S3C64XX_NR_IRQS,
 	.init_irq	= s3c6410_init_irq,
 	.map_io		= crag6410_map_io,
 	.init_machine	= crag6410_machine_init,

The samsung-gpio driver does not allocate irq descriptors for itself
though, otherwise we could make the S3C64XX_NR_IRQS number smaller.

	Arnd

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

* Re: [PATCH 06/10] iio: exynos-adc: add experimental touchscreen support
  2015-03-04 23:10     ` Dmitry Torokhov
@ 2015-03-12 17:01       ` Arnd Bergmann
  -1 siblings, 0 replies; 60+ messages in thread
From: Arnd Bergmann @ 2015-03-12 17:01 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Dmitry Torokhov, jic23, linux-samsung-soc, padma.v,
	Maurus Cuelenaere, Liam Girdwood, Tomasz Figa, cw00.choi,
	Mark Brown, Kukjin Kim, a.kesavan, ch.naveen

On Wednesday 04 March 2015 15:10:00 Dmitry Torokhov wrote:
> > +static int exynos_adc_ts_init(struct exynos_adc *info)
> > +{
> > +     int ret;
> > +
> > +     if (info->tsirq <= 0)
> > +             return -ENODEV;
> > +
> > +     info->input = input_allocate_device();
> > +     if (!info->input)
> > +             return -ENOMEM;
> > +
> > +     info->input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
> > +     info->input->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
> > +
> > +     input_set_abs_params(info->input, ABS_X, 0, 0x3FF, 0, 0);
> > +     input_set_abs_params(info->input, ABS_Y, 0, 0x3FF, 0, 0);
> > +
> > +     info->input->name = "S3C24xx TouchScreen";
> > +     info->input->id.bustype = BUS_HOST;
> > +     info->input->open = exynos_adc_ts_open;
> > +     info->input->close = exynos_adc_ts_close;
> > +
> > +     input_set_drvdata(info->input, info);
> > +
> > +     ret = input_register_device(info->input);
> > +     if (ret)
> > +             input_free_device(info->input);
> 
> 
> If you fail to register input device are you sure you want to continue
> and register interrupt?
> 
> > +
> > +     disable_irq(info->tsirq);
> > +     ret = request_threaded_irq(info->tsirq, NULL, exynos_ts_isr,
> > +                                0, "touchscreen", info);
> > +     if (ret)
> > +             input_unregister_device(info->input);
> > +
> > +     return ret;
> > +}

Sorry for the delayed reply, I've now folded in this patch:


diff --git a/drivers/iio/adc/exynos_adc.c b/drivers/iio/adc/exynos_adc.c
index 75cd381a8181..d11cd604562c 100644
--- a/drivers/iio/adc/exynos_adc.c
+++ b/drivers/iio/adc/exynos_adc.c
@@ -732,8 +732,10 @@ static int exynos_adc_ts_init(struct exynos_adc *info)
 	input_set_drvdata(info->input, info);
 
 	ret = input_register_device(info->input);
-	if (ret)
+	if (ret) {
 		input_free_device(info->input);
+		return ret;
+	}
 
 	disable_irq(info->tsirq);
 	ret = request_threaded_irq(info->tsirq, NULL, exynos_ts_isr,


	Arnd

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

* [PATCH 06/10] iio: exynos-adc: add experimental touchscreen support
@ 2015-03-12 17:01       ` Arnd Bergmann
  0 siblings, 0 replies; 60+ messages in thread
From: Arnd Bergmann @ 2015-03-12 17:01 UTC (permalink / raw)
  To: linux-arm-kernel

On Wednesday 04 March 2015 15:10:00 Dmitry Torokhov wrote:
> > +static int exynos_adc_ts_init(struct exynos_adc *info)
> > +{
> > +     int ret;
> > +
> > +     if (info->tsirq <= 0)
> > +             return -ENODEV;
> > +
> > +     info->input = input_allocate_device();
> > +     if (!info->input)
> > +             return -ENOMEM;
> > +
> > +     info->input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
> > +     info->input->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
> > +
> > +     input_set_abs_params(info->input, ABS_X, 0, 0x3FF, 0, 0);
> > +     input_set_abs_params(info->input, ABS_Y, 0, 0x3FF, 0, 0);
> > +
> > +     info->input->name = "S3C24xx TouchScreen";
> > +     info->input->id.bustype = BUS_HOST;
> > +     info->input->open = exynos_adc_ts_open;
> > +     info->input->close = exynos_adc_ts_close;
> > +
> > +     input_set_drvdata(info->input, info);
> > +
> > +     ret = input_register_device(info->input);
> > +     if (ret)
> > +             input_free_device(info->input);
> 
> 
> If you fail to register input device are you sure you want to continue
> and register interrupt?
> 
> > +
> > +     disable_irq(info->tsirq);
> > +     ret = request_threaded_irq(info->tsirq, NULL, exynos_ts_isr,
> > +                                0, "touchscreen", info);
> > +     if (ret)
> > +             input_unregister_device(info->input);
> > +
> > +     return ret;
> > +}

Sorry for the delayed reply, I've now folded in this patch:


diff --git a/drivers/iio/adc/exynos_adc.c b/drivers/iio/adc/exynos_adc.c
index 75cd381a8181..d11cd604562c 100644
--- a/drivers/iio/adc/exynos_adc.c
+++ b/drivers/iio/adc/exynos_adc.c
@@ -732,8 +732,10 @@ static int exynos_adc_ts_init(struct exynos_adc *info)
 	input_set_drvdata(info->input, info);
 
 	ret = input_register_device(info->input);
-	if (ret)
+	if (ret) {
 		input_free_device(info->input);
+		return ret;
+	}
 
 	disable_irq(info->tsirq);
 	ret = request_threaded_irq(info->tsirq, NULL, exynos_ts_isr,


	Arnd

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

* Re: [PATCH 05/10] ARM: s3c64xx: enable sparse IRQ support
  2015-03-08 21:42       ` Arnd Bergmann
@ 2015-03-18  0:02         ` Mark Brown
  -1 siblings, 0 replies; 60+ messages in thread
From: Mark Brown @ 2015-03-18  0:02 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Charles Keepax, linux-arm-kernel, linux-samsung-soc, padma.v,
	dmitry.torokhov, Maurus Cuelenaere, Liam Girdwood, Tomasz Figa,
	cw00.choi, Kukjin Kim, a.kesavan, ch.naveen, jic23

[-- Attachment #1: Type: text/plain, Size: 2559 bytes --]

On Sun, Mar 08, 2015 at 10:42:59PM +0100, Arnd Bergmann wrote:
> On Friday 06 March 2015 17:43:16 Charles Keepax wrote:

> > This one appears to cause some problems with the IRQs on
> > Cragganmore, I need to look into it a bit more but it looks like
> > one of the PMICs can't allocate its IRQs:

> > [    0.961455] wm831x 1-0034: WM8311 revision C
> > [    0.965066] wm831x 1-0034: Failed to allocate IRQs: -17

> > And the CODEC can't request its IRQ:

> > [    4.252735] arizona spi0.1: WM5102 revision C
> > [    4.269763] arizona spi0.1: Failed to request primary IRQ 263: -22

> > Hopefully I can look into this a little more next week.

> My interpretation is that I mistakenly set the .nr_irqs value for
> craggamore to include all irqs that the board has, while the
> wm831x tries to allocate the irq descriptors itself and fails if
> they are already allocated. If that is the only problem here, it
> would get fixed by this change:

> diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c
> index f395a5617142..cbe353a5450e 100644
> --- a/arch/arm/mach-s3c64xx/mach-crag6410.c
> +++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
> @@ -855,7 +855,7 @@ static void __init crag6410_machine_init(void)
>  MACHINE_START(WLF_CRAGG_6410, "Wolfson Cragganmore 6410")
>  	/* Maintainer: Mark Brown <broonie@opensource.wolfsonmicro.com> */
>  	.atag_offset	= 0x100,
> -	.nr_irqs	= S3C64XX_NR_IRQS + 160,
> +	.nr_irqs	= S3C64XX_NR_IRQS,
>  	.init_irq	= s3c6410_init_irq,
>  	.map_io		= crag6410_map_io,
>  	.init_machine	= crag6410_machine_init,

> The samsung-gpio driver does not allocate irq descriptors for itself
> though, otherwise we could make the S3C64XX_NR_IRQS number smaller.

That's not the only thing, I'm still seeing an issue even with the
change above.  The VICs are also complaining about preallocated
descriptors, but they just assume the descriptors were preallocated and
carry on happily.  I'd also expect this to be affecting both wm831xs but
it's only affecting the WM8311 on the base board, not the primary
WM8312, so this seems to be a red herring.

I rather suspect that the issue is at least partly that the interrupt
numbering is off - the CODEC has 24 interrupts allocated to it in
crag6410.h which is nowhere near enough and the PMICs have 32 each
rather than the 58 they need.  This is broken for the existing code too
so we should get a fix to make that right in before anything else.  A
trivial change to fix that doesn't seem to have helped though but I
probably just miscounted or something.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* [PATCH 05/10] ARM: s3c64xx: enable sparse IRQ support
@ 2015-03-18  0:02         ` Mark Brown
  0 siblings, 0 replies; 60+ messages in thread
From: Mark Brown @ 2015-03-18  0:02 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, Mar 08, 2015 at 10:42:59PM +0100, Arnd Bergmann wrote:
> On Friday 06 March 2015 17:43:16 Charles Keepax wrote:

> > This one appears to cause some problems with the IRQs on
> > Cragganmore, I need to look into it a bit more but it looks like
> > one of the PMICs can't allocate its IRQs:

> > [    0.961455] wm831x 1-0034: WM8311 revision C
> > [    0.965066] wm831x 1-0034: Failed to allocate IRQs: -17

> > And the CODEC can't request its IRQ:

> > [    4.252735] arizona spi0.1: WM5102 revision C
> > [    4.269763] arizona spi0.1: Failed to request primary IRQ 263: -22

> > Hopefully I can look into this a little more next week.

> My interpretation is that I mistakenly set the .nr_irqs value for
> craggamore to include all irqs that the board has, while the
> wm831x tries to allocate the irq descriptors itself and fails if
> they are already allocated. If that is the only problem here, it
> would get fixed by this change:

> diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c
> index f395a5617142..cbe353a5450e 100644
> --- a/arch/arm/mach-s3c64xx/mach-crag6410.c
> +++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
> @@ -855,7 +855,7 @@ static void __init crag6410_machine_init(void)
>  MACHINE_START(WLF_CRAGG_6410, "Wolfson Cragganmore 6410")
>  	/* Maintainer: Mark Brown <broonie@opensource.wolfsonmicro.com> */
>  	.atag_offset	= 0x100,
> -	.nr_irqs	= S3C64XX_NR_IRQS + 160,
> +	.nr_irqs	= S3C64XX_NR_IRQS,
>  	.init_irq	= s3c6410_init_irq,
>  	.map_io		= crag6410_map_io,
>  	.init_machine	= crag6410_machine_init,

> The samsung-gpio driver does not allocate irq descriptors for itself
> though, otherwise we could make the S3C64XX_NR_IRQS number smaller.

That's not the only thing, I'm still seeing an issue even with the
change above.  The VICs are also complaining about preallocated
descriptors, but they just assume the descriptors were preallocated and
carry on happily.  I'd also expect this to be affecting both wm831xs but
it's only affecting the WM8311 on the base board, not the primary
WM8312, so this seems to be a red herring.

I rather suspect that the issue is at least partly that the interrupt
numbering is off - the CODEC has 24 interrupts allocated to it in
crag6410.h which is nowhere near enough and the PMICs have 32 each
rather than the 58 they need.  This is broken for the existing code too
so we should get a fix to make that right in before anything else.  A
trivial change to fix that doesn't seem to have helped though but I
probably just miscounted or something.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150318/b2825b0a/attachment.sig>

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

* Re: [PATCH 05/10] ARM: s3c64xx: enable sparse IRQ support
  2015-03-18  0:02         ` Mark Brown
@ 2015-03-21 16:38           ` Charles Keepax
  -1 siblings, 0 replies; 60+ messages in thread
From: Charles Keepax @ 2015-03-21 16:38 UTC (permalink / raw)
  To: Mark Brown
  Cc: Arnd Bergmann, linux-arm-kernel, linux-samsung-soc, padma.v,
	dmitry.torokhov, Maurus Cuelenaere, Liam Girdwood, Tomasz Figa,
	cw00.choi, Kukjin Kim, a.kesavan, ch.naveen, jic23

On Wed, Mar 18, 2015 at 12:02:34AM +0000, Mark Brown wrote:
> On Sun, Mar 08, 2015 at 10:42:59PM +0100, Arnd Bergmann wrote:
> > On Friday 06 March 2015 17:43:16 Charles Keepax wrote:
> > diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c
> > index f395a5617142..cbe353a5450e 100644
> > --- a/arch/arm/mach-s3c64xx/mach-crag6410.c
> > +++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
> > @@ -855,7 +855,7 @@ static void __init crag6410_machine_init(void)
> >  MACHINE_START(WLF_CRAGG_6410, "Wolfson Cragganmore 6410")
> >  	/* Maintainer: Mark Brown <broonie@opensource.wolfsonmicro.com> */
> >  	.atag_offset	= 0x100,
> > -	.nr_irqs	= S3C64XX_NR_IRQS + 160,
> > +	.nr_irqs	= S3C64XX_NR_IRQS,
> >  	.init_irq	= s3c6410_init_irq,
> >  	.map_io		= crag6410_map_io,
> >  	.init_machine	= crag6410_machine_init,
> 
> > The samsung-gpio driver does not allocate irq descriptors for itself
> > though, otherwise we could make the S3C64XX_NR_IRQS number smaller.
> 
> That's not the only thing, I'm still seeing an issue even with the
> change above.  The VICs are also complaining about preallocated
> descriptors, but they just assume the descriptors were preallocated and
> carry on happily.  I'd also expect this to be affecting both wm831xs but
> it's only affecting the WM8311 on the base board, not the primary
> WM8312, so this seems to be a red herring.
> 
> I rather suspect that the issue is at least partly that the interrupt
> numbering is off - the CODEC has 24 interrupts allocated to it in
> crag6410.h which is nowhere near enough and the PMICs have 32 each
> rather than the 58 they need.  This is broken for the existing code too
> so we should get a fix to make that right in before anything else.  A
> trivial change to fix that doesn't seem to have helped though but I
> probably just miscounted or something.

Ok guys very sorry about the massive delay in looking at this
again, I have been a bit swamped lately. I think I see what is
going on here.

The fix from Arnd there definitely helped, but still doesn't
quite work and those defines you are talking about there are
actually for the GPIOs so they are a bit of a red herring. There
are two PMICs as you mention one of which is given a fixed IRQ
base and the other which allocates it own. The problem appears to
be that the one which allocates its own IRQ base takes the space
that is specified as the fixed base for the other PMIC. Which
then fails to allocate its IRQs.

So adding a bit of an offset into the PMIC with the fixed IRQ
base fixes the problem. Although I am not sure if it would be
better to move both PMICs onto a fixed IRQ base so there is no
chance of the clashing. Any thoughts?

Thanks,
Charles

Applying this diff, on top of Arnd's fixup, gets everything
working for me:

diff --git a/arch/arm/mach-s3c64xx/crag6410.h
b/arch/arm/mach-s3c64xx/crag6410.h
index 7bc6668..59c5f44 100644
--- a/arch/arm/mach-s3c64xx/crag6410.h
+++ b/arch/arm/mach-s3c64xx/crag6410.h
@@ -13,7 +13,7 @@

 #include <mach/gpio-samsung.h>

-#define GLENFARCLAS_PMIC_IRQ_BASE      IRQ_BOARD_START
+#define GLENFARCLAS_PMIC_IRQ_BASE      IRQ_BOARD_START + 256

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

* [PATCH 05/10] ARM: s3c64xx: enable sparse IRQ support
@ 2015-03-21 16:38           ` Charles Keepax
  0 siblings, 0 replies; 60+ messages in thread
From: Charles Keepax @ 2015-03-21 16:38 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Mar 18, 2015 at 12:02:34AM +0000, Mark Brown wrote:
> On Sun, Mar 08, 2015 at 10:42:59PM +0100, Arnd Bergmann wrote:
> > On Friday 06 March 2015 17:43:16 Charles Keepax wrote:
> > diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c
> > index f395a5617142..cbe353a5450e 100644
> > --- a/arch/arm/mach-s3c64xx/mach-crag6410.c
> > +++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
> > @@ -855,7 +855,7 @@ static void __init crag6410_machine_init(void)
> >  MACHINE_START(WLF_CRAGG_6410, "Wolfson Cragganmore 6410")
> >  	/* Maintainer: Mark Brown <broonie@opensource.wolfsonmicro.com> */
> >  	.atag_offset	= 0x100,
> > -	.nr_irqs	= S3C64XX_NR_IRQS + 160,
> > +	.nr_irqs	= S3C64XX_NR_IRQS,
> >  	.init_irq	= s3c6410_init_irq,
> >  	.map_io		= crag6410_map_io,
> >  	.init_machine	= crag6410_machine_init,
> 
> > The samsung-gpio driver does not allocate irq descriptors for itself
> > though, otherwise we could make the S3C64XX_NR_IRQS number smaller.
> 
> That's not the only thing, I'm still seeing an issue even with the
> change above.  The VICs are also complaining about preallocated
> descriptors, but they just assume the descriptors were preallocated and
> carry on happily.  I'd also expect this to be affecting both wm831xs but
> it's only affecting the WM8311 on the base board, not the primary
> WM8312, so this seems to be a red herring.
> 
> I rather suspect that the issue is at least partly that the interrupt
> numbering is off - the CODEC has 24 interrupts allocated to it in
> crag6410.h which is nowhere near enough and the PMICs have 32 each
> rather than the 58 they need.  This is broken for the existing code too
> so we should get a fix to make that right in before anything else.  A
> trivial change to fix that doesn't seem to have helped though but I
> probably just miscounted or something.

Ok guys very sorry about the massive delay in looking at this
again, I have been a bit swamped lately. I think I see what is
going on here.

The fix from Arnd there definitely helped, but still doesn't
quite work and those defines you are talking about there are
actually for the GPIOs so they are a bit of a red herring. There
are two PMICs as you mention one of which is given a fixed IRQ
base and the other which allocates it own. The problem appears to
be that the one which allocates its own IRQ base takes the space
that is specified as the fixed base for the other PMIC. Which
then fails to allocate its IRQs.

So adding a bit of an offset into the PMIC with the fixed IRQ
base fixes the problem. Although I am not sure if it would be
better to move both PMICs onto a fixed IRQ base so there is no
chance of the clashing. Any thoughts?

Thanks,
Charles

Applying this diff, on top of Arnd's fixup, gets everything
working for me:

diff --git a/arch/arm/mach-s3c64xx/crag6410.h
b/arch/arm/mach-s3c64xx/crag6410.h
index 7bc6668..59c5f44 100644
--- a/arch/arm/mach-s3c64xx/crag6410.h
+++ b/arch/arm/mach-s3c64xx/crag6410.h
@@ -13,7 +13,7 @@

 #include <mach/gpio-samsung.h>

-#define GLENFARCLAS_PMIC_IRQ_BASE      IRQ_BOARD_START
+#define GLENFARCLAS_PMIC_IRQ_BASE      IRQ_BOARD_START + 256

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

* Re: [PATCH 10/10] ARM: s3c64xx: allow building without board support
  2015-03-02 12:36   ` Arnd Bergmann
@ 2015-03-21 17:17     ` Charles Keepax
  -1 siblings, 0 replies; 60+ messages in thread
From: Charles Keepax @ 2015-03-21 17:17 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arm-kernel, linux-samsung-soc, padma.v, dmitry.torokhov,
	Maurus Cuelenaere, Liam Girdwood, Tomasz Figa, cw00.choi,
	Mark Brown, Kukjin Kim, a.kesavan, ch.naveen, jic23

On Mon, Mar 02, 2015 at 01:36:03PM +0100, Arnd Bergmann wrote:
> Most of the code for the s3c64xx platform is only used when booting
> with ATAGS based board files, but not when using device-tree.
> 
> This tries to identify all the s3c64xx specific code that is
> unneeded when CONFIG_ATAGS is not set, so we can build a smaller
> DT-only kernel if configured that way.
> 
> All board support is still left intact but now depends on the
> CONFIG_ATAGS symbol that users may intentionally disable.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---

Rest of this series doesn't seem to cause me any problems on
Cragganmore.

Thanks,
Charles

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

* [PATCH 10/10] ARM: s3c64xx: allow building without board support
@ 2015-03-21 17:17     ` Charles Keepax
  0 siblings, 0 replies; 60+ messages in thread
From: Charles Keepax @ 2015-03-21 17:17 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Mar 02, 2015 at 01:36:03PM +0100, Arnd Bergmann wrote:
> Most of the code for the s3c64xx platform is only used when booting
> with ATAGS based board files, but not when using device-tree.
> 
> This tries to identify all the s3c64xx specific code that is
> unneeded when CONFIG_ATAGS is not set, so we can build a smaller
> DT-only kernel if configured that way.
> 
> All board support is still left intact but now depends on the
> CONFIG_ATAGS symbol that users may intentionally disable.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---

Rest of this series doesn't seem to cause me any problems on
Cragganmore.

Thanks,
Charles

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

* Re: [PATCH 05/10] ARM: s3c64xx: enable sparse IRQ support
  2015-03-21 16:38           ` Charles Keepax
@ 2015-03-21 18:22             ` Mark Brown
  -1 siblings, 0 replies; 60+ messages in thread
From: Mark Brown @ 2015-03-21 18:22 UTC (permalink / raw)
  To: Charles Keepax
  Cc: Arnd Bergmann, linux-arm-kernel, linux-samsung-soc, padma.v,
	dmitry.torokhov, Maurus Cuelenaere, Liam Girdwood, Tomasz Figa,
	cw00.choi, Kukjin Kim, a.kesavan, ch.naveen, jic23

[-- Attachment #1: Type: text/plain, Size: 339 bytes --]

On Sat, Mar 21, 2015 at 04:38:21PM +0000, Charles Keepax wrote:

> So adding a bit of an offset into the PMIC with the fixed IRQ
> base fixes the problem. Although I am not sure if it would be
> better to move both PMICs onto a fixed IRQ base so there is no
> chance of the clashing. Any thoughts?

Yes, that sounds like the safest thing.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* [PATCH 05/10] ARM: s3c64xx: enable sparse IRQ support
@ 2015-03-21 18:22             ` Mark Brown
  0 siblings, 0 replies; 60+ messages in thread
From: Mark Brown @ 2015-03-21 18:22 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Mar 21, 2015 at 04:38:21PM +0000, Charles Keepax wrote:

> So adding a bit of an offset into the PMIC with the fixed IRQ
> base fixes the problem. Although I am not sure if it would be
> better to move both PMICs onto a fixed IRQ base so there is no
> chance of the clashing. Any thoughts?

Yes, that sounds like the safest thing.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150321/7762cffd/attachment.sig>

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

* Re: [PATCH 05/10] ARM: s3c64xx: enable sparse IRQ support
  2015-03-18  0:02         ` Mark Brown
@ 2015-03-22  2:54           ` Arnd Bergmann
  -1 siblings, 0 replies; 60+ messages in thread
From: Arnd Bergmann @ 2015-03-22  2:54 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Mark Brown, linux-samsung-soc, padma.v, dmitry.torokhov,
	Maurus Cuelenaere, Liam Girdwood, Tomasz Figa, cw00.choi,
	Kukjin Kim, jic23, a.kesavan, Charles Keepax, ch.naveen

On Wednesday 18 March 2015, Mark Brown wrote:
> On Sun, Mar 08, 2015 at 10:42:59PM +0100, Arnd Bergmann wrote:

> > diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c
> > index f395a5617142..cbe353a5450e 100644
> > --- a/arch/arm/mach-s3c64xx/mach-crag6410.c
> > +++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
> > @@ -855,7 +855,7 @@ static void __init crag6410_machine_init(void)
> >  MACHINE_START(WLF_CRAGG_6410, "Wolfson Cragganmore 6410")
> >       /* Maintainer: Mark Brown <broonie@opensource.wolfsonmicro.com> */
> >       .atag_offset    = 0x100,
> > -     .nr_irqs        = S3C64XX_NR_IRQS + 160,
> > +     .nr_irqs        = S3C64XX_NR_IRQS,
> >       .init_irq       = s3c6410_init_irq,
> >       .map_io         = crag6410_map_io,
> >       .init_machine   = crag6410_machine_init,
> 
> > The samsung-gpio driver does not allocate irq descriptors for itself
> > though, otherwise we could make the S3C64XX_NR_IRQS number smaller.
> 
> That's not the only thing, I'm still seeing an issue even with the
> change above.  The VICs are also complaining about preallocated
> descriptors, but they just assume the descriptors were preallocated and
> carry on happily.

Yes, that is the behavior I expected to see. The VIC driver would be
fine in theory with allocating the descriptors dynamically, but
the secondary irqchip (s3c_irq_eint) would need significant changes.

IIRC, another problem is the way that the first NR_IRQS_LEGACY interrupts
are always preallocated, but would not need to, once we fix the eint.
	Arnd

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

* [PATCH 05/10] ARM: s3c64xx: enable sparse IRQ support
@ 2015-03-22  2:54           ` Arnd Bergmann
  0 siblings, 0 replies; 60+ messages in thread
From: Arnd Bergmann @ 2015-03-22  2:54 UTC (permalink / raw)
  To: linux-arm-kernel

On Wednesday 18 March 2015, Mark Brown wrote:
> On Sun, Mar 08, 2015 at 10:42:59PM +0100, Arnd Bergmann wrote:

> > diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c
> > index f395a5617142..cbe353a5450e 100644
> > --- a/arch/arm/mach-s3c64xx/mach-crag6410.c
> > +++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
> > @@ -855,7 +855,7 @@ static void __init crag6410_machine_init(void)
> >  MACHINE_START(WLF_CRAGG_6410, "Wolfson Cragganmore 6410")
> >       /* Maintainer: Mark Brown <broonie@opensource.wolfsonmicro.com> */
> >       .atag_offset    = 0x100,
> > -     .nr_irqs        = S3C64XX_NR_IRQS + 160,
> > +     .nr_irqs        = S3C64XX_NR_IRQS,
> >       .init_irq       = s3c6410_init_irq,
> >       .map_io         = crag6410_map_io,
> >       .init_machine   = crag6410_machine_init,
> 
> > The samsung-gpio driver does not allocate irq descriptors for itself
> > though, otherwise we could make the S3C64XX_NR_IRQS number smaller.
> 
> That's not the only thing, I'm still seeing an issue even with the
> change above.  The VICs are also complaining about preallocated
> descriptors, but they just assume the descriptors were preallocated and
> carry on happily.

Yes, that is the behavior I expected to see. The VIC driver would be
fine in theory with allocating the descriptors dynamically, but
the secondary irqchip (s3c_irq_eint) would need significant changes.

IIRC, another problem is the way that the first NR_IRQS_LEGACY interrupts
are always preallocated, but would not need to, once we fix the eint.
	Arnd

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

end of thread, other threads:[~2015-03-22  2:55 UTC | newest]

Thread overview: 60+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-02 12:35 [PATCH 00/10] ARM: s3c64xx multiplatform, help needed Arnd Bergmann
2015-03-02 12:35 ` Arnd Bergmann
2015-03-02 12:35 ` [PATCH 01/10] Input: s3c2410_ts: fix S3C_ADC dependency Arnd Bergmann
2015-03-02 12:35   ` Arnd Bergmann
2015-03-04 23:05   ` Dmitry Torokhov
2015-03-04 23:05     ` Dmitry Torokhov
2015-03-02 12:35 ` [PATCH 02/10] ASoC: samsung/smartq: use dynamic registration Arnd Bergmann
2015-03-02 12:35   ` Arnd Bergmann
2015-03-03 14:14   ` Mark Brown
2015-03-03 14:14     ` Mark Brown
2015-03-02 12:35 ` [PATCH 03/10] gpio: samsung: move gpio-samsung driver back to platform code Arnd Bergmann
2015-03-02 12:35   ` Arnd Bergmann
2015-03-02 12:35 ` [PATCH 04/10] ARM: s3c64xx: prepare initcalls for multiplatform Arnd Bergmann
2015-03-02 12:35   ` Arnd Bergmann
2015-03-02 12:35 ` [PATCH 05/10] ARM: s3c64xx: enable sparse IRQ support Arnd Bergmann
2015-03-02 12:35   ` Arnd Bergmann
2015-03-06 17:43   ` Charles Keepax
2015-03-06 17:43     ` Charles Keepax
2015-03-08 18:56     ` Mark Brown
2015-03-08 18:56       ` Mark Brown
2015-03-08 21:42     ` Arnd Bergmann
2015-03-08 21:42       ` Arnd Bergmann
2015-03-18  0:02       ` Mark Brown
2015-03-18  0:02         ` Mark Brown
2015-03-21 16:38         ` Charles Keepax
2015-03-21 16:38           ` Charles Keepax
2015-03-21 18:22           ` Mark Brown
2015-03-21 18:22             ` Mark Brown
2015-03-22  2:54         ` Arnd Bergmann
2015-03-22  2:54           ` Arnd Bergmann
2015-03-02 12:35 ` [PATCH 06/10] iio: exynos-adc: add experimental touchscreen support Arnd Bergmann
2015-03-02 12:35   ` Arnd Bergmann
2015-03-04 23:10   ` Dmitry Torokhov
2015-03-04 23:10     ` Dmitry Torokhov
2015-03-12 17:01     ` Arnd Bergmann
2015-03-12 17:01       ` Arnd Bergmann
2015-03-02 12:36 ` [PATCH 07/10] ARM: s3c64xx: use new adc/touchscreen driver Arnd Bergmann
2015-03-02 12:36   ` Arnd Bergmann
2015-03-02 12:36 ` [PATCH 08/10] ARM: s3c64xx: use common debug-ll implementation Arnd Bergmann
2015-03-02 12:36   ` Arnd Bergmann
2015-03-02 12:36 ` [PATCH 09/10] ARM: s3c64xx: multiplatform support Arnd Bergmann
2015-03-02 12:36   ` Arnd Bergmann
2015-03-02 12:36 ` [PATCH 10/10] ARM: s3c64xx: allow building without board support Arnd Bergmann
2015-03-02 12:36   ` Arnd Bergmann
2015-03-21 17:17   ` Charles Keepax
2015-03-21 17:17     ` Charles Keepax
2015-03-02 16:17 ` [PATCH 00/10] ARM: s3c64xx multiplatform, help needed Mark Brown
2015-03-02 16:17   ` Mark Brown
2015-03-02 18:03   ` Charles Keepax
2015-03-02 18:03     ` Charles Keepax
2015-03-02 16:53 ` Tomasz Figa
2015-03-02 16:53   ` Tomasz Figa
2015-03-02 19:04   ` Kukjin Kim
2015-03-02 19:04     ` Kukjin Kim
2015-03-02 17:37 ` Dmitry Torokhov
2015-03-02 17:37   ` Dmitry Torokhov
2015-03-02 18:14   ` Vasily Khoruzhick
2015-03-02 18:14     ` Vasily Khoruzhick
2015-03-02 20:48 ` Arnd Bergmann
2015-03-02 20:48   ` Arnd Bergmann

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.