linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/23] RFC: exynos multiplatform support
@ 2013-03-05 17:42 Arnd Bergmann
  2013-03-05 17:42 ` [PATCH 01/23] ARM: exynos: introduce EXYNOS_ATAGS symbol Arnd Bergmann
                   ` (25 more replies)
  0 siblings, 26 replies; 49+ messages in thread
From: Arnd Bergmann @ 2013-03-05 17:42 UTC (permalink / raw)
  To: linux-arm-kernel

Hi everyone,

Although I'm not present at the Linaro Connect hacking
sessions, I am participating remotely and have tried
hacking on multiplatform support for Exynos. This patch
set is far from complete, but I think the patches
can be useful anyway.

The series gets increasingly fishy towards the end,
and we should probably not apply any of the last nine
patches as-is, nor do I expect everything to work, since
I have not tested them at all.

With this patch set, we can build mach-exynos as part
of a multiplatform kernel, with the following caveats:

* Only DT based boards are supported
* Moving to common-clk breaks things including cpufreq
  and others. Thomas is working on a patch for this
* We disable the gpio implementation, which also breaks
  stuff, but Thomas has a patch already
* Using the generic DMA engine API in SPI and ASoC
  means they no longer work on S3C
* I did not like the solution for the UART driver, but
  could also not think of a better one.
* The FB_S3C, S3C2410_WATCHDOG and S3C_ADC drivers
  are left as an exercise to the reader, they are
  currently disabled with multiplatform
* sparsemem support is not available on multiplatform

The patches are based on v3.9-rc1 and I have pushed
the git branch to

git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc.git testing/exynos-multiplatform

I have not yet added subsystem maintainers to Cc on the
patches, I'd like to coordinate with the other people
involved first, so see if they already have patches
for the same drivers.

	Arnd

Arnd Bergmann (23):
  ARM: exynos: introduce EXYNOS_ATAGS symbol
  irqchip: exynos: remove dependency on mach/irqs.h
  tty: serial/samsung: prepare for common clock API
  tty: serial/samsung: make register definitions global
  tty: serial/samsung: fix modular build
  ARM: exynos: move debug-macro.S to include/debug/
  i2c: s3c2410: make header file local
  mmc: sdhci-s3c: remove platform dependencies
  usb: exynos: do not include plat/usb-phy.h
  [media] exynos: remove unnecessary header inclusions
  video/exynos: remove unnecessary header inclusions
  thermal/exynos: remove unnecessary header inclusions
  mtd: onenand/samsung: make regs-onenand.h file local
  rtc: s3c: make header file local
  spi: s3c64xx: move to generic dmaengine API
  pwm: samsung: repair the worst MMIO abuses
  ASoC: samsung: move plat/ headers to local directory
  ASoC: samsung: convert to dmaengine API
  ASoC: samsung: use irq resource for idma
  ARM: exynos: prepare for sparse IRQ
  ARM: exynos: hack to disable private clock code
  ARM: exynos: work around missing gpio code on multiplatform
  ARM: exynos: experimental multiplatform support

 arch/arm/Kconfig                                  |  11 +-
 arch/arm/Kconfig.debug                            |   8 +
 arch/arm/include/debug/exynos.S                   |  39 +++
 arch/arm/include/debug/samsung.S                  |  87 +++++++
 arch/arm/mach-exynos/Kconfig                      |  36 ++-
 arch/arm/mach-exynos/Makefile                     |   5 +
 arch/arm/mach-exynos/common.c                     |  14 +-
 arch/arm/mach-exynos/common.h                     |   2 +-
 arch/arm/mach-exynos/dev-audio.c                  |   1 +
 arch/arm/mach-exynos/dev-uart.c                   |   1 +
 arch/arm/mach-exynos/include/mach/debug-macro.S   |  39 ---
 arch/arm/mach-exynos/include/mach/gpio.h          |   2 +
 arch/arm/mach-exynos/include/mach/irqs.h          |   5 +-
 arch/arm/mach-exynos/mach-armlex4210.c            |   3 +
 arch/arm/mach-exynos/mach-exynos4-dt.c            |   2 +
 arch/arm/mach-exynos/mach-exynos5-dt.c            |   2 +
 arch/arm/mach-exynos/mach-nuri.c                  |   2 +
 arch/arm/mach-exynos/mach-origen.c                |   3 +
 arch/arm/mach-exynos/mach-smdk4x12.c              |   2 +
 arch/arm/mach-exynos/mach-smdkv310.c              |   3 +
 arch/arm/mach-exynos/setup-i2c0.c                 |   3 +-
 arch/arm/mach-exynos/setup-sdhci-gpio.c           |   2 +-
 arch/arm/mach-exynos/setup-usb-phy.c              |   8 +-
 arch/arm/mach-s3c24xx/clock-s3c2440.c             |   5 +
 arch/arm/mach-s3c24xx/common.c                    |   5 +
 arch/arm/mach-s3c24xx/dma-s3c2410.c               |   2 -
 arch/arm/mach-s3c24xx/dma-s3c2412.c               |   2 -
 arch/arm/mach-s3c24xx/dma-s3c2440.c               |   2 -
 arch/arm/mach-s3c24xx/dma-s3c2443.c               |   2 -
 arch/arm/mach-s3c24xx/include/mach/debug-macro.S  |   2 +-
 arch/arm/mach-s3c24xx/mach-rx1950.c               |   1 -
 arch/arm/mach-s3c64xx/include/mach/debug-macro.S  |   2 +-
 arch/arm/mach-s3c64xx/include/mach/gpio.h         |   4 +
 arch/arm/mach-s3c64xx/setup-usb-phy.c             |   4 +-
 arch/arm/mach-s5p64x0/include/mach/debug-macro.S  |   2 +-
 arch/arm/mach-s5pc100/include/mach/debug-macro.S  |   2 +-
 arch/arm/mach-s5pc100/setup-sdhci-gpio.c          |   1 -
 arch/arm/mach-s5pv210/include/mach/debug-macro.S  |   2 +-
 arch/arm/mach-s5pv210/setup-sdhci-gpio.c          |   1 -
 arch/arm/mach-s5pv210/setup-usb-phy.c             |   4 +-
 arch/arm/plat-samsung/Kconfig                     |   5 +
 arch/arm/plat-samsung/Makefile                    |   3 +
 arch/arm/plat-samsung/clock-clksrc.c              |   3 +
 arch/arm/plat-samsung/devs.c                      |  17 +-
 arch/arm/plat-samsung/include/plat/debug-macro.S  |  87 -------
 arch/arm/plat-samsung/include/plat/gpio-core.h    |   3 +
 arch/arm/plat-samsung/include/plat/regs-ac97.h    |  67 -----
 arch/arm/plat-samsung/include/plat/regs-iic.h     |  56 -----
 arch/arm/plat-samsung/include/plat/regs-iis.h     |  70 ------
 arch/arm/plat-samsung/include/plat/regs-onenand.h |  63 -----
 arch/arm/plat-samsung/include/plat/regs-rtc.h     |  71 ------
 arch/arm/plat-samsung/include/plat/regs-sdhci.h   |  87 -------
 arch/arm/plat-samsung/include/plat/regs-serial.h  | 282 +---------------------
 arch/arm/plat-samsung/include/plat/sdhci.h        |  56 +----
 arch/arm/plat-samsung/include/plat/usb-phy.h      |   5 +-
 arch/arm/plat-samsung/irq-vic-timer.c             |   1 +
 arch/arm/plat-samsung/pm-gpio.c                   |   1 +
 arch/arm/plat-samsung/pm.c                        |   1 +
 arch/arm/plat-samsung/s5p-clock.c                 |   3 +
 arch/arm/plat-samsung/s5p-irq.c                   |   1 +
 drivers/cpufreq/Kconfig.arm                       |   4 +-
 drivers/devfreq/Kconfig                           |   1 +
 drivers/gpio/Makefile                             |   2 +-
 drivers/i2c/busses/i2c-s3c2410.c                  |   3 +-
 drivers/i2c/busses/i2c-s3c2410.h                  |  56 +++++
 drivers/irqchip/exynos-combiner.c                 | 113 +++++----
 drivers/media/platform/exynos-gsc/gsc-regs.c      |   1 -
 drivers/media/platform/s5p-tv/sii9234_drv.c       |   3 -
 drivers/mmc/host/Kconfig                          |   2 +-
 drivers/mmc/host/sdhci-s3c-regs.h                 |  87 +++++++
 drivers/mmc/host/sdhci-s3c.c                      |   5 +-
 drivers/mtd/onenand/samsung.c                     |   4 +-
 drivers/mtd/onenand/samsung.h                     |  61 +++++
 drivers/pwm/pwm-samsung.c                         |  60 +++--
 drivers/rtc/rtc-s3c.c                             |   3 +-
 drivers/rtc/rtc-s3c.h                             |  70 ++++++
 drivers/spi/spi-s3c64xx.c                         | 107 ++++----
 drivers/thermal/exynos_thermal.c                  |   2 -
 drivers/tty/serial/samsung.c                      |  17 +-
 drivers/tty/serial/samsung.h                      |   4 +-
 drivers/usb/host/ehci-s5p.c                       |   1 -
 drivers/usb/host/ohci-exynos.c                    |   1 -
 drivers/video/Kconfig                             |   2 +-
 drivers/video/exynos/exynos_mipi_dsi.c            |   2 -
 drivers/video/exynos/exynos_mipi_dsi_common.c     |   2 -
 drivers/video/exynos/exynos_mipi_dsi_lowlevel.c   |   2 -
 drivers/watchdog/Kconfig                          |   1 +
 include/linux/platform_data/mmc-sdhci-s3c.h       |  56 +++++
 include/linux/platform_data/spi-s3c64xx.h         |   3 +
 include/linux/serial_s3c.h                        | 260 ++++++++++++++++++++
 sound/soc/samsung/ac97.c                          |  17 +-
 sound/soc/samsung/dma.c                           | 104 ++++----
 sound/soc/samsung/dma.h                           |   4 +-
 sound/soc/samsung/h1940_uda1380.c                 |   2 +-
 sound/soc/samsung/i2s.c                           |   9 +-
 sound/soc/samsung/idma.c                          |  10 +-
 sound/soc/samsung/neo1973_wm8753.c                |   2 +-
 sound/soc/samsung/pcm.c                           |  13 -
 sound/soc/samsung/regs-ac97.h                     |  67 +++++
 sound/soc/samsung/regs-iis.h                      |  70 ++++++
 sound/soc/samsung/rx1950_uda1380.c                |   2 +-
 sound/soc/samsung/s3c2412-i2s.c                   |  10 -
 sound/soc/samsung/s3c24xx-i2s.c                   |  12 +-
 sound/soc/samsung/s3c24xx_uda134x.c               |   2 +-
 sound/soc/samsung/spdif.c                         |   6 -
 105 files changed, 1262 insertions(+), 1208 deletions(-)
 create mode 100644 arch/arm/include/debug/exynos.S
 create mode 100644 arch/arm/include/debug/samsung.S
 delete mode 100644 arch/arm/mach-exynos/include/mach/debug-macro.S
 delete mode 100644 arch/arm/plat-samsung/include/plat/debug-macro.S
 delete mode 100644 arch/arm/plat-samsung/include/plat/regs-ac97.h
 delete mode 100644 arch/arm/plat-samsung/include/plat/regs-iic.h
 delete mode 100644 arch/arm/plat-samsung/include/plat/regs-iis.h
 delete mode 100644 arch/arm/plat-samsung/include/plat/regs-onenand.h
 delete mode 100644 arch/arm/plat-samsung/include/plat/regs-rtc.h
 delete mode 100644 arch/arm/plat-samsung/include/plat/regs-sdhci.h
 create mode 100644 drivers/i2c/busses/i2c-s3c2410.h
 create mode 100644 drivers/mmc/host/sdhci-s3c-regs.h
 create mode 100644 drivers/mtd/onenand/samsung.h
 create mode 100644 drivers/rtc/rtc-s3c.h
 create mode 100644 include/linux/platform_data/mmc-sdhci-s3c.h
 create mode 100644 include/linux/serial_s3c.h
 create mode 100644 sound/soc/samsung/regs-ac97.h
 create mode 100644 sound/soc/samsung/regs-iis.h

-- 
1.8.1.2

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

* [PATCH 01/23] ARM: exynos: introduce EXYNOS_ATAGS symbol
  2013-03-05 17:42 [PATCH 00/23] RFC: exynos multiplatform support Arnd Bergmann
@ 2013-03-05 17:42 ` Arnd Bergmann
  2013-03-05 17:42 ` [PATCH 02/23] irqchip: exynos: remove dependency on mach/irqs.h Arnd Bergmann
                   ` (24 subsequent siblings)
  25 siblings, 0 replies; 49+ messages in thread
From: Arnd Bergmann @ 2013-03-05 17:42 UTC (permalink / raw)
  To: linux-arm-kernel

As a preparation for multiplatform support, this introduces
a new Kconfig symbol to split the ATAGS based EXYNOS platforms
from the DT based ones. Turning off CONFIG_EXYNOS_ATAGS disables
all platforms that are not yet converted to DT, and we can
have code that relies on DT checking for this symbol being
disabled.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-exynos/Kconfig | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index 70f94c8..3291a72 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -176,7 +176,20 @@ config EXYNOS_SETUP_SPI
 	help
 	  Common setup code for SPI GPIO configurations.
 
+
+config EXYNOS_ATAGS
+	bool "ATAGS based boot for EXYNOS (deprecated)"
+	depends on ARCH_EXYNOS_SINGLE
+	depends on ATAGS
+	default y
+	help
+	  The EXYNOS platform is moving towards being completely probed
+	  through device tree. This enables support for board files using
+	  the traditional ATAGS boot format.
+	  Note that this option is not available for multiplatform builds.
+
 # machine support
+if EXYNOS_ATAGS
 
 if ARCH_EXYNOS4
 
@@ -400,6 +413,8 @@ config MACH_SMDK4412
 	  Machine support for Samsung SMDK4412
 endif
 
+endif
+
 comment "Flattened Device Tree based board for EXYNOS SoCs"
 
 config MACH_EXYNOS4_DT
-- 
1.8.1.2

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

* [PATCH 02/23] irqchip: exynos: remove dependency on mach/irqs.h
  2013-03-05 17:42 [PATCH 00/23] RFC: exynos multiplatform support Arnd Bergmann
  2013-03-05 17:42 ` [PATCH 01/23] ARM: exynos: introduce EXYNOS_ATAGS symbol Arnd Bergmann
@ 2013-03-05 17:42 ` Arnd Bergmann
  2013-03-05 17:42 ` [PATCH 03/23] tty: serial/samsung: prepare for common clock API Arnd Bergmann
                   ` (23 subsequent siblings)
  25 siblings, 0 replies; 49+ messages in thread
From: Arnd Bergmann @ 2013-03-05 17:42 UTC (permalink / raw)
  To: linux-arm-kernel

As a preparation for multiplatform, this changes the exynos
"combiner" irqchip to no longer make any assumptions about
using specific IRQ numbers or the number of combiners in the
system.

For this, we have to revert to always initializing the combiner
explicitly from architecture code, rather than using the new
irqchip_init function as we should. The problem is the
dependency on the IRQ base value for the combiner, which is
currently hardcoded in the mach/irqs.h file. Once that file
becomes unused, we can move to irqchip_init again.

Getting rid of the dependency on the number of combiners
actually cleans up the code, because we also remove the
global combiner_data array and pass dynamically allocated
pointers through the irq domain instead.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-exynos/common.c     |   5 +-
 arch/arm/mach-exynos/common.h     |   2 +-
 drivers/irqchip/exynos-combiner.c | 113 ++++++++++++++++++++------------------
 3 files changed, 64 insertions(+), 56 deletions(-)

diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index d63d399..4b4526d 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -443,6 +443,7 @@ static void __init exynos5_init_clocks(int xtal)
 
 void __init exynos4_init_irq(void)
 {
+	struct device_node *dn;
 	unsigned int gic_bank_offset;
 
 	gic_bank_offset = soc_is_exynos4412() ? 0x4000 : 0x8000;
@@ -454,8 +455,8 @@ void __init exynos4_init_irq(void)
 		irqchip_init();
 #endif
 
-	if (!of_have_populated_dt())
-		combiner_init(S5P_VA_COMBINER_BASE, NULL);
+	dn = of_find_compatible_node(NULL, NULL, "samsung,exynos4210-combiner");
+	combiner_init(S5P_VA_COMBINER_BASE, COMBINER_IRQ(0, 0), dn);
 
 	/*
 	 * The parameters of s5p_init_irq() are for VIC init.
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index 9339bb8..ed96450 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -61,7 +61,7 @@ void exynos4212_register_clocks(void);
 #endif
 
 struct device_node;
-void combiner_init(void __iomem *combiner_base, struct device_node *np);
+void combiner_init(void __iomem *combiner_base, int irq_base, struct device_node *np);
 
 extern struct smp_operations exynos_smp_ops;
 
diff --git a/drivers/irqchip/exynos-combiner.c b/drivers/irqchip/exynos-combiner.c
index 04d86a9..1276d4e 100644
--- a/drivers/irqchip/exynos-combiner.c
+++ b/drivers/irqchip/exynos-combiner.c
@@ -15,9 +15,13 @@
 #include <linux/irqdomain.h>
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
-#include <asm/mach/irq.h>
+#include <linux/slab.h>
 
+#ifdef CONFIG_EXYNOS_ATAGS
 #include <plat/cpu.h>
+#endif
+
+#include <asm/mach/irq.h>
 
 #include "irqchip.h"
 
@@ -25,6 +29,8 @@
 #define COMBINER_ENABLE_CLEAR	0x4
 #define COMBINER_INT_STATUS	0xC
 
+#define IRQ_IN_COMBINER		8
+
 static DEFINE_SPINLOCK(irq_controller_lock);
 
 struct combiner_chip_data {
@@ -33,9 +39,6 @@ struct combiner_chip_data {
 	void __iomem *base;
 };
 
-static struct irq_domain *combiner_irq_domain;
-static struct combiner_chip_data combiner_data[MAX_COMBINER_NR];
-
 static inline void __iomem *combiner_base(struct irq_data *data)
 {
 	struct combiner_chip_data *combiner_data =
@@ -93,35 +96,6 @@ static struct irq_chip combiner_chip = {
 	.irq_unmask	= combiner_unmask_irq,
 };
 
-static void __init combiner_cascade_irq(unsigned int combiner_nr, unsigned int irq)
-{
-	unsigned int max_nr;
-
-	if (soc_is_exynos5250())
-		max_nr = EXYNOS5_MAX_COMBINER_NR;
-	else
-		max_nr = EXYNOS4_MAX_COMBINER_NR;
-
-	if (combiner_nr >= max_nr)
-		BUG();
-	if (irq_set_handler_data(irq, &combiner_data[combiner_nr]) != 0)
-		BUG();
-	irq_set_chained_handler(irq, combiner_handle_cascade_irq);
-}
-
-static void __init combiner_init_one(unsigned int combiner_nr,
-				     void __iomem *base)
-{
-	combiner_data[combiner_nr].base = base;
-	combiner_data[combiner_nr].irq_offset = irq_find_mapping(
-		combiner_irq_domain, combiner_nr * MAX_IRQ_IN_COMBINER);
-	combiner_data[combiner_nr].irq_mask = 0xff << ((combiner_nr % 4) << 3);
-
-	/* Disable all interrupts */
-	__raw_writel(combiner_data[combiner_nr].irq_mask,
-		     base + COMBINER_ENABLE_CLEAR);
-}
-
 #ifdef CONFIG_OF
 static int combiner_irq_domain_xlate(struct irq_domain *d,
 				     struct device_node *controller,
@@ -135,7 +109,7 @@ static int combiner_irq_domain_xlate(struct irq_domain *d,
 	if (intsize < 2)
 		return -EINVAL;
 
-	*out_hwirq = intspec[0] * MAX_IRQ_IN_COMBINER + intspec[1];
+	*out_hwirq = intspec[0] * IRQ_IN_COMBINER + intspec[1];
 	*out_type = 0;
 
 	return 0;
@@ -154,6 +128,8 @@ static int combiner_irq_domain_xlate(struct irq_domain *d,
 static int combiner_irq_domain_map(struct irq_domain *d, unsigned int irq,
 				   irq_hw_number_t hw)
 {
+	struct combiner_chip_data *combiner_data = d->host_data;
+
 	irq_set_chip_and_handler(irq, &combiner_chip, handle_level_irq);
 	irq_set_chip_data(irq, &combiner_data[hw >> 3]);
 	set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
@@ -167,49 +143,80 @@ static struct irq_domain_ops combiner_irq_domain_ops = {
 };
 
 void __init combiner_init(void __iomem *combiner_base,
+			  int plat_irq_base,
 			  struct device_node *np)
 {
 	int i, irq, irq_base;
 	unsigned int max_nr, nr_irq;
+	struct irq_domain *domain;
+	struct combiner_chip_data *combiner_data;
 
-	if (np) {
-		if (of_property_read_u32(np, "samsung,combiner-nr", &max_nr)) {
-			pr_warning("%s: number of combiners not specified, "
-				"setting default as %d.\n",
-				__func__, EXYNOS4_MAX_COMBINER_NR);
-			max_nr = EXYNOS4_MAX_COMBINER_NR;
-		}
-	} else {
+	max_nr = 0;
+	if (of_property_read_u32(np, "samsung,combiner-nr", &max_nr)) {
+#ifdef CONFIG_EXYNOS_ATAGS
 		max_nr = soc_is_exynos5250() ? EXYNOS5_MAX_COMBINER_NR :
-						EXYNOS4_MAX_COMBINER_NR;
+					       EXYNOS4_MAX_COMBINER_NR;
+		pr_warning("%s: number of combiners not specified, "
+			   "setting default as %d.\n", __func__, max_nr);
+#endif
 	}
-	nr_irq = max_nr * MAX_IRQ_IN_COMBINER;
+	if (!max_nr)
+		return;
+
+	nr_irq = max_nr * IRQ_IN_COMBINER;
 
-	irq_base = irq_alloc_descs(COMBINER_IRQ(0, 0), 1, nr_irq, 0);
+	irq_base = irq_alloc_descs(plat_irq_base, 1, nr_irq, 0);
 	if (IS_ERR_VALUE(irq_base)) {
-		irq_base = COMBINER_IRQ(0, 0);
+		irq_base = plat_irq_base;
 		pr_warning("%s: irq desc alloc failed. Continuing with %d as linux irq base\n", __func__, irq_base);
 	}
 
-	combiner_irq_domain = irq_domain_add_legacy(np, nr_irq, irq_base, 0,
-				&combiner_irq_domain_ops, &combiner_data);
-	if (WARN_ON(!combiner_irq_domain)) {
+	combiner_data = kcalloc(max_nr, sizeof *combiner_data, GFP_KERNEL);
+	if (WARN_ON(!combiner_data)) {
+		pr_warning("%s: combiner data alloc failed\n", __func__);
+		return;
+	}
+
+	domain = irq_domain_add_legacy(np, nr_irq, irq_base, 0,
+				&combiner_irq_domain_ops, combiner_data);
+	if (WARN_ON(!domain)) {
 		pr_warning("%s: irq domain init failed\n", __func__);
 		return;
 	}
 
 	for (i = 0; i < max_nr; i++) {
-		combiner_init_one(i, combiner_base + (i >> 2) * 0x10);
+		struct combiner_chip_data *data = &combiner_data[i];
+
+		data->base = combiner_base + (i >> 2) * 0x10;
+		data->irq_offset = irq_find_mapping(domain,
+				   i * IRQ_IN_COMBINER);
+		data->irq_mask = 0xff << ((i % 4) << 3);
+
+		/* Disable all interrupts */
+		__raw_writel(data->irq_mask,
+			     data->base + COMBINER_ENABLE_CLEAR);
+
+#ifdef CONFIG_EXYNOS_ATAGS
 		irq = IRQ_SPI(i);
+#else
+		irq = 0;
+#endif
 #ifdef CONFIG_OF
 		if (np)
 			irq = irq_of_parse_and_map(np, i);
 #endif
-		combiner_cascade_irq(i, irq);
+		if (irq_set_handler_data(irq, &combiner_data[i]) != 0)
+			BUG();
+		irq_set_chained_handler(irq, combiner_handle_cascade_irq);
 	}
 }
 
-#ifdef CONFIG_OF
+#ifdef CONFIG_EXYNOS_IRQDOMAIN_CONVERSION_COMPLETE
+/*
+ * we can only renable this one after all hardcoded IRQ numbers
+ * are gone from DT booted systems and we can allow picking
+ * an arbitrary irq_base.
+ */ 
 static int __init combiner_of_init(struct device_node *np,
 				   struct device_node *parent)
 {
@@ -221,7 +228,7 @@ static int __init combiner_of_init(struct device_node *np,
 		return -ENXIO;
 	}
 
-	combiner_init(combiner_base, np);
+	combiner_init(combiner_base, -1, np);
 
 	return 0;
 }
-- 
1.8.1.2

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

* [PATCH 03/23] tty: serial/samsung: prepare for common clock API
  2013-03-05 17:42 [PATCH 00/23] RFC: exynos multiplatform support Arnd Bergmann
  2013-03-05 17:42 ` [PATCH 01/23] ARM: exynos: introduce EXYNOS_ATAGS symbol Arnd Bergmann
  2013-03-05 17:42 ` [PATCH 02/23] irqchip: exynos: remove dependency on mach/irqs.h Arnd Bergmann
@ 2013-03-05 17:42 ` Arnd Bergmann
  2013-03-05 17:42 ` [PATCH 04/23] tty: serial/samsung: make register definitions global Arnd Bergmann
                   ` (22 subsequent siblings)
  25 siblings, 0 replies; 49+ messages in thread
From: Arnd Bergmann @ 2013-03-05 17:42 UTC (permalink / raw)
  To: linux-arm-kernel

With the common clock interface, there is no way to
provide the "clock_source" sysfs attribute for the
samsung serial ports. Given that this file was
purely informational and had fixed contents, we have
reason to believe that no user space programs
were relying on it.

The sysfs file is not documented in the ABI docs.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/tty/serial/samsung.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index 2769a38..603f3f3 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -1179,6 +1179,7 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport,
 	return 0;
 }
 
+#ifdef CONFIG_SAMSUNG_CLOCK
 static ssize_t s3c24xx_serial_show_clksrc(struct device *dev,
 					  struct device_attribute *attr,
 					  char *buf)
@@ -1194,7 +1195,7 @@ static ssize_t s3c24xx_serial_show_clksrc(struct device *dev,
 }
 
 static DEVICE_ATTR(clock_source, S_IRUGO, s3c24xx_serial_show_clksrc, NULL);
-
+#endif
 
 /* Device driver serial port probe */
 
@@ -1252,9 +1253,11 @@ static int s3c24xx_serial_probe(struct platform_device *pdev)
 	uart_add_one_port(&s3c24xx_uart_drv, &ourport->port);
 	platform_set_drvdata(pdev, &ourport->port);
 
+#ifdef CONFIG_SAMSUNG_CLOCK
 	ret = device_create_file(&pdev->dev, &dev_attr_clock_source);
 	if (ret < 0)
 		dev_err(&pdev->dev, "failed to add clock source attr.\n");
+#endif
 
 	ret = s3c24xx_serial_cpufreq_register(ourport);
 	if (ret < 0)
@@ -1272,7 +1275,9 @@ static int s3c24xx_serial_remove(struct platform_device *dev)
 
 	if (port) {
 		s3c24xx_serial_cpufreq_deregister(to_ourport(port));
+#ifdef CONFIG_SAMSUNG_CLOCK
 		device_remove_file(&dev->dev, &dev_attr_clock_source);
+#endif
 		uart_remove_one_port(&s3c24xx_uart_drv, port);
 	}
 
-- 
1.8.1.2

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

* [PATCH 04/23] tty: serial/samsung: make register definitions global
  2013-03-05 17:42 [PATCH 00/23] RFC: exynos multiplatform support Arnd Bergmann
                   ` (2 preceding siblings ...)
  2013-03-05 17:42 ` [PATCH 03/23] tty: serial/samsung: prepare for common clock API Arnd Bergmann
@ 2013-03-05 17:42 ` Arnd Bergmann
  2013-03-05 17:42 ` [PATCH 05/23] tty: serial/samsung: fix modular build Arnd Bergmann
                   ` (21 subsequent siblings)
  25 siblings, 0 replies; 49+ messages in thread
From: Arnd Bergmann @ 2013-03-05 17:42 UTC (permalink / raw)
  To: linux-arm-kernel

The registers for the Samsung S3C serial port are currently defined in
the platform specific arch/arm/plat-samsung/include/plat/regs-serial.h
file, which is not visible to multiplatform capable drivers.

Unfortunately, it is not possible to move the file into a more local
place as we should normally try to, because the same registers
may be used in one of four places:

* In the driver itself
* In platform-independent ARM code for early debug output
* In platform_data definitions
* In the Samsung platform power management code

I have also found no way to logically split out a platform_data
file, other than possibly move everything into
include/linux/platform_data, which also felt wrong. The only
part of this file that makes sense to keep specific to the s3c24xx
platform are the virtual and physical addresses defined here,
which are needed in no other location.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-s3c24xx/clock-s3c2440.c            |   5 +
 arch/arm/mach-s3c24xx/common.c                   |   5 +
 arch/arm/plat-samsung/include/plat/regs-serial.h | 282 +----------------------
 drivers/tty/serial/samsung.c                     |   6 +-
 include/linux/serial_s3c.h                       | 260 +++++++++++++++++++++
 5 files changed, 274 insertions(+), 284 deletions(-)
 create mode 100644 include/linux/serial_s3c.h

diff --git a/arch/arm/mach-s3c24xx/clock-s3c2440.c b/arch/arm/mach-s3c24xx/clock-s3c2440.c
index 04b87ec..1069b56 100644
--- a/arch/arm/mach-s3c24xx/clock-s3c2440.c
+++ b/arch/arm/mach-s3c24xx/clock-s3c2440.c
@@ -123,6 +123,11 @@ static struct clk s3c2440_clk_ac97 = {
 	.ctrlbit	= S3C2440_CLKCON_AC97,
 };
 
+#define S3C24XX_VA_UART0      (S3C_VA_UART)
+#define S3C24XX_VA_UART1      (S3C_VA_UART + 0x4000 )
+#define S3C24XX_VA_UART2      (S3C_VA_UART + 0x8000 )
+#define S3C24XX_VA_UART3      (S3C_VA_UART + 0xC000 )
+
 static unsigned long  s3c2440_fclk_n_getrate(struct clk *clk)
 {
 	unsigned long ucon0, ucon1, ucon2, divisor;
diff --git a/arch/arm/mach-s3c24xx/common.c b/arch/arm/mach-s3c24xx/common.c
index 6bcf87f..92e6094 100644
--- a/arch/arm/mach-s3c24xx/common.c
+++ b/arch/arm/mach-s3c24xx/common.c
@@ -239,6 +239,11 @@ void __init s3c24xx_init_io(struct map_desc *mach_desc, int size)
 
 /* Serial port registrations */
 
+#define S3C2410_PA_UART0      (S3C24XX_PA_UART)
+#define S3C2410_PA_UART1      (S3C24XX_PA_UART + 0x4000 )
+#define S3C2410_PA_UART2      (S3C24XX_PA_UART + 0x8000 )
+#define S3C2443_PA_UART3      (S3C24XX_PA_UART + 0xC000 )
+
 static struct resource s3c2410_uart0_resource[] = {
 	[0] = DEFINE_RES_MEM(S3C2410_PA_UART0, SZ_16K),
 	[1] = DEFINE_RES_NAMED(IRQ_S3CUART_RX0, \
diff --git a/arch/arm/plat-samsung/include/plat/regs-serial.h b/arch/arm/plat-samsung/include/plat/regs-serial.h
index 29c26a8..f05f2af 100644
--- a/arch/arm/plat-samsung/include/plat/regs-serial.h
+++ b/arch/arm/plat-samsung/include/plat/regs-serial.h
@@ -1,281 +1 @@
-/* arch/arm/plat-samsung/include/plat/regs-serial.h
- *
- *  From linux/include/asm-arm/hardware/serial_s3c2410.h
- *
- *  Internal header file for Samsung S3C2410 serial ports (UART0-2)
- *
- *  Copyright (C) 2002 Shane Nay (shane at minirl.com)
- *
- *  Additional defines, Copyright 2003 Simtec Electronics (linux at simtec.co.uk)
- *
- *  Adapted from:
- *
- *  Internal header file for MX1ADS serial ports (UART1 & 2)
- *
- *  Copyright (C) 2002 Shane Nay (shane at minirl.com)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
-
-#ifndef __ASM_ARM_REGS_SERIAL_H
-#define __ASM_ARM_REGS_SERIAL_H
-
-#define S3C24XX_VA_UART0      (S3C_VA_UART)
-#define S3C24XX_VA_UART1      (S3C_VA_UART + 0x4000 )
-#define S3C24XX_VA_UART2      (S3C_VA_UART + 0x8000 )
-#define S3C24XX_VA_UART3      (S3C_VA_UART + 0xC000 )
-
-#define S3C2410_PA_UART0      (S3C24XX_PA_UART)
-#define S3C2410_PA_UART1      (S3C24XX_PA_UART + 0x4000 )
-#define S3C2410_PA_UART2      (S3C24XX_PA_UART + 0x8000 )
-#define S3C2443_PA_UART3      (S3C24XX_PA_UART + 0xC000 )
-
-#define S3C2410_URXH	  (0x24)
-#define S3C2410_UTXH	  (0x20)
-#define S3C2410_ULCON	  (0x00)
-#define S3C2410_UCON	  (0x04)
-#define S3C2410_UFCON	  (0x08)
-#define S3C2410_UMCON	  (0x0C)
-#define S3C2410_UBRDIV	  (0x28)
-#define S3C2410_UTRSTAT	  (0x10)
-#define S3C2410_UERSTAT	  (0x14)
-#define S3C2410_UFSTAT	  (0x18)
-#define S3C2410_UMSTAT	  (0x1C)
-
-#define S3C2410_LCON_CFGMASK	  ((0xF<<3)|(0x3))
-
-#define S3C2410_LCON_CS5	  (0x0)
-#define S3C2410_LCON_CS6	  (0x1)
-#define S3C2410_LCON_CS7	  (0x2)
-#define S3C2410_LCON_CS8	  (0x3)
-#define S3C2410_LCON_CSMASK	  (0x3)
-
-#define S3C2410_LCON_PNONE	  (0x0)
-#define S3C2410_LCON_PEVEN	  (0x5 << 3)
-#define S3C2410_LCON_PODD	  (0x4 << 3)
-#define S3C2410_LCON_PMASK	  (0x7 << 3)
-
-#define S3C2410_LCON_STOPB	  (1<<2)
-#define S3C2410_LCON_IRM          (1<<6)
-
-#define S3C2440_UCON_CLKMASK	  (3<<10)
-#define S3C2440_UCON_CLKSHIFT	  (10)
-#define S3C2440_UCON_PCLK	  (0<<10)
-#define S3C2440_UCON_UCLK	  (1<<10)
-#define S3C2440_UCON_PCLK2	  (2<<10)
-#define S3C2440_UCON_FCLK	  (3<<10)
-#define S3C2443_UCON_EPLL	  (3<<10)
-
-#define S3C6400_UCON_CLKMASK	(3<<10)
-#define S3C6400_UCON_CLKSHIFT	(10)
-#define S3C6400_UCON_PCLK	(0<<10)
-#define S3C6400_UCON_PCLK2	(2<<10)
-#define S3C6400_UCON_UCLK0	(1<<10)
-#define S3C6400_UCON_UCLK1	(3<<10)
-
-#define S3C2440_UCON2_FCLK_EN	  (1<<15)
-#define S3C2440_UCON0_DIVMASK	  (15 << 12)
-#define S3C2440_UCON1_DIVMASK	  (15 << 12)
-#define S3C2440_UCON2_DIVMASK	  (7 << 12)
-#define S3C2440_UCON_DIVSHIFT	  (12)
-
-#define S3C2412_UCON_CLKMASK	(3<<10)
-#define S3C2412_UCON_CLKSHIFT	(10)
-#define S3C2412_UCON_UCLK	(1<<10)
-#define S3C2412_UCON_USYSCLK	(3<<10)
-#define S3C2412_UCON_PCLK	(0<<10)
-#define S3C2412_UCON_PCLK2	(2<<10)
-
-#define S3C2410_UCON_CLKMASK	(1 << 10)
-#define S3C2410_UCON_CLKSHIFT	(10)
-#define S3C2410_UCON_UCLK	  (1<<10)
-#define S3C2410_UCON_SBREAK	  (1<<4)
-
-#define S3C2410_UCON_TXILEVEL	  (1<<9)
-#define S3C2410_UCON_RXILEVEL	  (1<<8)
-#define S3C2410_UCON_TXIRQMODE	  (1<<2)
-#define S3C2410_UCON_RXIRQMODE	  (1<<0)
-#define S3C2410_UCON_RXFIFO_TOI	  (1<<7)
-#define S3C2443_UCON_RXERR_IRQEN  (1<<6)
-#define S3C2443_UCON_LOOPBACK	  (1<<5)
-
-#define S3C2410_UCON_DEFAULT	  (S3C2410_UCON_TXILEVEL  | \
-				   S3C2410_UCON_RXILEVEL  | \
-				   S3C2410_UCON_TXIRQMODE | \
-				   S3C2410_UCON_RXIRQMODE | \
-				   S3C2410_UCON_RXFIFO_TOI)
-
-#define S3C2410_UFCON_FIFOMODE	  (1<<0)
-#define S3C2410_UFCON_TXTRIG0	  (0<<6)
-#define S3C2410_UFCON_RXTRIG8	  (1<<4)
-#define S3C2410_UFCON_RXTRIG12	  (2<<4)
-
-/* S3C2440 FIFO trigger levels */
-#define S3C2440_UFCON_RXTRIG1	  (0<<4)
-#define S3C2440_UFCON_RXTRIG8	  (1<<4)
-#define S3C2440_UFCON_RXTRIG16	  (2<<4)
-#define S3C2440_UFCON_RXTRIG32	  (3<<4)
-
-#define S3C2440_UFCON_TXTRIG0	  (0<<6)
-#define S3C2440_UFCON_TXTRIG16	  (1<<6)
-#define S3C2440_UFCON_TXTRIG32	  (2<<6)
-#define S3C2440_UFCON_TXTRIG48	  (3<<6)
-
-#define S3C2410_UFCON_RESETBOTH	  (3<<1)
-#define S3C2410_UFCON_RESETTX	  (1<<2)
-#define S3C2410_UFCON_RESETRX	  (1<<1)
-
-#define S3C2410_UFCON_DEFAULT	  (S3C2410_UFCON_FIFOMODE | \
-				   S3C2410_UFCON_TXTRIG0  | \
-				   S3C2410_UFCON_RXTRIG8 )
-
-#define	S3C2410_UMCOM_AFC	  (1<<4)
-#define	S3C2410_UMCOM_RTS_LOW	  (1<<0)
-
-#define S3C2412_UMCON_AFC_63	(0<<5)		/* same as s3c2443 */
-#define S3C2412_UMCON_AFC_56	(1<<5)
-#define S3C2412_UMCON_AFC_48	(2<<5)
-#define S3C2412_UMCON_AFC_40	(3<<5)
-#define S3C2412_UMCON_AFC_32	(4<<5)
-#define S3C2412_UMCON_AFC_24	(5<<5)
-#define S3C2412_UMCON_AFC_16	(6<<5)
-#define S3C2412_UMCON_AFC_8	(7<<5)
-
-#define S3C2410_UFSTAT_TXFULL	  (1<<9)
-#define S3C2410_UFSTAT_RXFULL	  (1<<8)
-#define S3C2410_UFSTAT_TXMASK	  (15<<4)
-#define S3C2410_UFSTAT_TXSHIFT	  (4)
-#define S3C2410_UFSTAT_RXMASK	  (15<<0)
-#define S3C2410_UFSTAT_RXSHIFT	  (0)
-
-/* UFSTAT S3C2443 same as S3C2440 */
-#define S3C2440_UFSTAT_TXFULL	  (1<<14)
-#define S3C2440_UFSTAT_RXFULL	  (1<<6)
-#define S3C2440_UFSTAT_TXSHIFT	  (8)
-#define S3C2440_UFSTAT_RXSHIFT	  (0)
-#define S3C2440_UFSTAT_TXMASK	  (63<<8)
-#define S3C2440_UFSTAT_RXMASK	  (63)
-
-#define S3C2410_UTRSTAT_TXE	  (1<<2)
-#define S3C2410_UTRSTAT_TXFE	  (1<<1)
-#define S3C2410_UTRSTAT_RXDR	  (1<<0)
-
-#define S3C2410_UERSTAT_OVERRUN	  (1<<0)
-#define S3C2410_UERSTAT_FRAME	  (1<<2)
-#define S3C2410_UERSTAT_BREAK	  (1<<3)
-#define S3C2443_UERSTAT_PARITY	  (1<<1)
-
-#define S3C2410_UERSTAT_ANY	  (S3C2410_UERSTAT_OVERRUN | \
-				   S3C2410_UERSTAT_FRAME | \
-				   S3C2410_UERSTAT_BREAK)
-
-#define S3C2410_UMSTAT_CTS	  (1<<0)
-#define S3C2410_UMSTAT_DeltaCTS	  (1<<2)
-
-#define S3C2443_DIVSLOT		  (0x2C)
-
-/* S3C64XX interrupt registers. */
-#define S3C64XX_UINTP		0x30
-#define S3C64XX_UINTSP		0x34
-#define S3C64XX_UINTM		0x38
-
-#define S3C64XX_UINTM_RXD	(0)
-#define S3C64XX_UINTM_TXD	(2)
-#define S3C64XX_UINTM_RXD_MSK	(1 << S3C64XX_UINTM_RXD)
-#define S3C64XX_UINTM_TXD_MSK	(1 << S3C64XX_UINTM_TXD)
-
-/* Following are specific to S5PV210 */
-#define S5PV210_UCON_CLKMASK	(1<<10)
-#define S5PV210_UCON_CLKSHIFT	(10)
-#define S5PV210_UCON_PCLK	(0<<10)
-#define S5PV210_UCON_UCLK	(1<<10)
-
-#define S5PV210_UFCON_TXTRIG0	(0<<8)
-#define S5PV210_UFCON_TXTRIG4	(1<<8)
-#define S5PV210_UFCON_TXTRIG8	(2<<8)
-#define S5PV210_UFCON_TXTRIG16	(3<<8)
-#define S5PV210_UFCON_TXTRIG32	(4<<8)
-#define S5PV210_UFCON_TXTRIG64	(5<<8)
-#define S5PV210_UFCON_TXTRIG128 (6<<8)
-#define S5PV210_UFCON_TXTRIG256 (7<<8)
-
-#define S5PV210_UFCON_RXTRIG1	(0<<4)
-#define S5PV210_UFCON_RXTRIG4	(1<<4)
-#define S5PV210_UFCON_RXTRIG8	(2<<4)
-#define S5PV210_UFCON_RXTRIG16	(3<<4)
-#define S5PV210_UFCON_RXTRIG32	(4<<4)
-#define S5PV210_UFCON_RXTRIG64	(5<<4)
-#define S5PV210_UFCON_RXTRIG128	(6<<4)
-#define S5PV210_UFCON_RXTRIG256	(7<<4)
-
-#define S5PV210_UFSTAT_TXFULL	(1<<24)
-#define S5PV210_UFSTAT_RXFULL	(1<<8)
-#define S5PV210_UFSTAT_TXMASK	(255<<16)
-#define S5PV210_UFSTAT_TXSHIFT	(16)
-#define S5PV210_UFSTAT_RXMASK	(255<<0)
-#define S5PV210_UFSTAT_RXSHIFT	(0)
-
-#define S3C2410_UCON_CLKSEL0	(1 << 0)
-#define S3C2410_UCON_CLKSEL1	(1 << 1)
-#define S3C2410_UCON_CLKSEL2	(1 << 2)
-#define S3C2410_UCON_CLKSEL3	(1 << 3)
-
-/* Default values for s5pv210 UCON and UFCON uart registers */
-#define S5PV210_UCON_DEFAULT	(S3C2410_UCON_TXILEVEL |	\
-				 S3C2410_UCON_RXILEVEL |	\
-				 S3C2410_UCON_TXIRQMODE |	\
-				 S3C2410_UCON_RXIRQMODE |	\
-				 S3C2410_UCON_RXFIFO_TOI |	\
-				 S3C2443_UCON_RXERR_IRQEN)
-
-#define S5PV210_UFCON_DEFAULT	(S3C2410_UFCON_FIFOMODE |	\
-				 S5PV210_UFCON_TXTRIG4 |	\
-				 S5PV210_UFCON_RXTRIG4)
-
-#ifndef __ASSEMBLY__
-
-/* configuration structure for per-machine configurations for the
- * serial port
- *
- * the pointer is setup by the machine specific initialisation from the
- * arch/arm/mach-s3c2410/ directory.
-*/
-
-struct s3c2410_uartcfg {
-	unsigned char	   hwport;	 /* hardware port number */
-	unsigned char	   unused;
-	unsigned short	   flags;
-	upf_t		   uart_flags;	 /* default uart flags */
-	unsigned int	   clk_sel;
-
-	unsigned int	   has_fracval;
-
-	unsigned long	   ucon;	 /* value of ucon for port */
-	unsigned long	   ulcon;	 /* value of ulcon for port */
-	unsigned long	   ufcon;	 /* value of ufcon for port */
-};
-
-/* s3c24xx_uart_devs
- *
- * this is exported from the core as we cannot use driver_register(),
- * or platform_add_device() before the console_initcall()
-*/
-
-extern struct platform_device *s3c24xx_uart_devs[4];
-
-#endif /* __ASSEMBLY__ */
-
-#endif /* __ASM_ARM_REGS_SERIAL_H */
-
+#include <linux/serial_s3c.h>
diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index 603f3f3..729a60d 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -39,6 +39,7 @@
 #include <linux/tty_flip.h>
 #include <linux/serial_core.h>
 #include <linux/serial.h>
+#include <linux/serial_s3c.h>
 #include <linux/delay.h>
 #include <linux/clk.h>
 #include <linux/cpufreq.h>
@@ -46,10 +47,9 @@
 
 #include <asm/irq.h>
 
-#include <mach/hardware.h>
-
-#include <plat/regs-serial.h>
+#ifdef CONFIG_SAMSUNG_CLOCK
 #include <plat/clock.h>
+#endif
 
 #include "samsung.h"
 
diff --git a/include/linux/serial_s3c.h b/include/linux/serial_s3c.h
new file mode 100644
index 0000000..907d9d1
--- /dev/null
+++ b/include/linux/serial_s3c.h
@@ -0,0 +1,260 @@
+/*
+ *  Internal header file for Samsung S3C2410 serial ports (UART0-2)
+ *
+ *  Copyright (C) 2002 Shane Nay (shane at minirl.com)
+ *
+ *  Additional defines, Copyright 2003 Simtec Electronics (linux at simtec.co.uk)
+ *
+ *  Adapted from:
+ *
+ *  Internal header file for MX1ADS serial ports (UART1 & 2)
+ *
+ *  Copyright (C) 2002 Shane Nay (shane at minirl.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+#ifndef __ASM_ARM_REGS_SERIAL_H
+#define __ASM_ARM_REGS_SERIAL_H
+
+#define S3C2410_URXH	  (0x24)
+#define S3C2410_UTXH	  (0x20)
+#define S3C2410_ULCON	  (0x00)
+#define S3C2410_UCON	  (0x04)
+#define S3C2410_UFCON	  (0x08)
+#define S3C2410_UMCON	  (0x0C)
+#define S3C2410_UBRDIV	  (0x28)
+#define S3C2410_UTRSTAT	  (0x10)
+#define S3C2410_UERSTAT	  (0x14)
+#define S3C2410_UFSTAT	  (0x18)
+#define S3C2410_UMSTAT	  (0x1C)
+
+#define S3C2410_LCON_CFGMASK	  ((0xF<<3)|(0x3))
+
+#define S3C2410_LCON_CS5	  (0x0)
+#define S3C2410_LCON_CS6	  (0x1)
+#define S3C2410_LCON_CS7	  (0x2)
+#define S3C2410_LCON_CS8	  (0x3)
+#define S3C2410_LCON_CSMASK	  (0x3)
+
+#define S3C2410_LCON_PNONE	  (0x0)
+#define S3C2410_LCON_PEVEN	  (0x5 << 3)
+#define S3C2410_LCON_PODD	  (0x4 << 3)
+#define S3C2410_LCON_PMASK	  (0x7 << 3)
+
+#define S3C2410_LCON_STOPB	  (1<<2)
+#define S3C2410_LCON_IRM          (1<<6)
+
+#define S3C2440_UCON_CLKMASK	  (3<<10)
+#define S3C2440_UCON_CLKSHIFT	  (10)
+#define S3C2440_UCON_PCLK	  (0<<10)
+#define S3C2440_UCON_UCLK	  (1<<10)
+#define S3C2440_UCON_PCLK2	  (2<<10)
+#define S3C2440_UCON_FCLK	  (3<<10)
+#define S3C2443_UCON_EPLL	  (3<<10)
+
+#define S3C6400_UCON_CLKMASK	(3<<10)
+#define S3C6400_UCON_CLKSHIFT	(10)
+#define S3C6400_UCON_PCLK	(0<<10)
+#define S3C6400_UCON_PCLK2	(2<<10)
+#define S3C6400_UCON_UCLK0	(1<<10)
+#define S3C6400_UCON_UCLK1	(3<<10)
+
+#define S3C2440_UCON2_FCLK_EN	  (1<<15)
+#define S3C2440_UCON0_DIVMASK	  (15 << 12)
+#define S3C2440_UCON1_DIVMASK	  (15 << 12)
+#define S3C2440_UCON2_DIVMASK	  (7 << 12)
+#define S3C2440_UCON_DIVSHIFT	  (12)
+
+#define S3C2412_UCON_CLKMASK	(3<<10)
+#define S3C2412_UCON_CLKSHIFT	(10)
+#define S3C2412_UCON_UCLK	(1<<10)
+#define S3C2412_UCON_USYSCLK	(3<<10)
+#define S3C2412_UCON_PCLK	(0<<10)
+#define S3C2412_UCON_PCLK2	(2<<10)
+
+#define S3C2410_UCON_CLKMASK	(1 << 10)
+#define S3C2410_UCON_CLKSHIFT	(10)
+#define S3C2410_UCON_UCLK	  (1<<10)
+#define S3C2410_UCON_SBREAK	  (1<<4)
+
+#define S3C2410_UCON_TXILEVEL	  (1<<9)
+#define S3C2410_UCON_RXILEVEL	  (1<<8)
+#define S3C2410_UCON_TXIRQMODE	  (1<<2)
+#define S3C2410_UCON_RXIRQMODE	  (1<<0)
+#define S3C2410_UCON_RXFIFO_TOI	  (1<<7)
+#define S3C2443_UCON_RXERR_IRQEN  (1<<6)
+#define S3C2443_UCON_LOOPBACK	  (1<<5)
+
+#define S3C2410_UCON_DEFAULT	  (S3C2410_UCON_TXILEVEL  | \
+				   S3C2410_UCON_RXILEVEL  | \
+				   S3C2410_UCON_TXIRQMODE | \
+				   S3C2410_UCON_RXIRQMODE | \
+				   S3C2410_UCON_RXFIFO_TOI)
+
+#define S3C2410_UFCON_FIFOMODE	  (1<<0)
+#define S3C2410_UFCON_TXTRIG0	  (0<<6)
+#define S3C2410_UFCON_RXTRIG8	  (1<<4)
+#define S3C2410_UFCON_RXTRIG12	  (2<<4)
+
+/* S3C2440 FIFO trigger levels */
+#define S3C2440_UFCON_RXTRIG1	  (0<<4)
+#define S3C2440_UFCON_RXTRIG8	  (1<<4)
+#define S3C2440_UFCON_RXTRIG16	  (2<<4)
+#define S3C2440_UFCON_RXTRIG32	  (3<<4)
+
+#define S3C2440_UFCON_TXTRIG0	  (0<<6)
+#define S3C2440_UFCON_TXTRIG16	  (1<<6)
+#define S3C2440_UFCON_TXTRIG32	  (2<<6)
+#define S3C2440_UFCON_TXTRIG48	  (3<<6)
+
+#define S3C2410_UFCON_RESETBOTH	  (3<<1)
+#define S3C2410_UFCON_RESETTX	  (1<<2)
+#define S3C2410_UFCON_RESETRX	  (1<<1)
+
+#define S3C2410_UFCON_DEFAULT	  (S3C2410_UFCON_FIFOMODE | \
+				   S3C2410_UFCON_TXTRIG0  | \
+				   S3C2410_UFCON_RXTRIG8 )
+
+#define	S3C2410_UMCOM_AFC	  (1<<4)
+#define	S3C2410_UMCOM_RTS_LOW	  (1<<0)
+
+#define S3C2412_UMCON_AFC_63	(0<<5)		/* same as s3c2443 */
+#define S3C2412_UMCON_AFC_56	(1<<5)
+#define S3C2412_UMCON_AFC_48	(2<<5)
+#define S3C2412_UMCON_AFC_40	(3<<5)
+#define S3C2412_UMCON_AFC_32	(4<<5)
+#define S3C2412_UMCON_AFC_24	(5<<5)
+#define S3C2412_UMCON_AFC_16	(6<<5)
+#define S3C2412_UMCON_AFC_8	(7<<5)
+
+#define S3C2410_UFSTAT_TXFULL	  (1<<9)
+#define S3C2410_UFSTAT_RXFULL	  (1<<8)
+#define S3C2410_UFSTAT_TXMASK	  (15<<4)
+#define S3C2410_UFSTAT_TXSHIFT	  (4)
+#define S3C2410_UFSTAT_RXMASK	  (15<<0)
+#define S3C2410_UFSTAT_RXSHIFT	  (0)
+
+/* UFSTAT S3C2443 same as S3C2440 */
+#define S3C2440_UFSTAT_TXFULL	  (1<<14)
+#define S3C2440_UFSTAT_RXFULL	  (1<<6)
+#define S3C2440_UFSTAT_TXSHIFT	  (8)
+#define S3C2440_UFSTAT_RXSHIFT	  (0)
+#define S3C2440_UFSTAT_TXMASK	  (63<<8)
+#define S3C2440_UFSTAT_RXMASK	  (63)
+
+#define S3C2410_UTRSTAT_TXE	  (1<<2)
+#define S3C2410_UTRSTAT_TXFE	  (1<<1)
+#define S3C2410_UTRSTAT_RXDR	  (1<<0)
+
+#define S3C2410_UERSTAT_OVERRUN	  (1<<0)
+#define S3C2410_UERSTAT_FRAME	  (1<<2)
+#define S3C2410_UERSTAT_BREAK	  (1<<3)
+#define S3C2443_UERSTAT_PARITY	  (1<<1)
+
+#define S3C2410_UERSTAT_ANY	  (S3C2410_UERSTAT_OVERRUN | \
+				   S3C2410_UERSTAT_FRAME | \
+				   S3C2410_UERSTAT_BREAK)
+
+#define S3C2410_UMSTAT_CTS	  (1<<0)
+#define S3C2410_UMSTAT_DeltaCTS	  (1<<2)
+
+#define S3C2443_DIVSLOT		  (0x2C)
+
+/* S3C64XX interrupt registers. */
+#define S3C64XX_UINTP		0x30
+#define S3C64XX_UINTSP		0x34
+#define S3C64XX_UINTM		0x38
+
+#define S3C64XX_UINTM_RXD	(0)
+#define S3C64XX_UINTM_TXD	(2)
+#define S3C64XX_UINTM_RXD_MSK	(1 << S3C64XX_UINTM_RXD)
+#define S3C64XX_UINTM_TXD_MSK	(1 << S3C64XX_UINTM_TXD)
+
+/* Following are specific to S5PV210 */
+#define S5PV210_UCON_CLKMASK	(1<<10)
+#define S5PV210_UCON_CLKSHIFT	(10)
+#define S5PV210_UCON_PCLK	(0<<10)
+#define S5PV210_UCON_UCLK	(1<<10)
+
+#define S5PV210_UFCON_TXTRIG0	(0<<8)
+#define S5PV210_UFCON_TXTRIG4	(1<<8)
+#define S5PV210_UFCON_TXTRIG8	(2<<8)
+#define S5PV210_UFCON_TXTRIG16	(3<<8)
+#define S5PV210_UFCON_TXTRIG32	(4<<8)
+#define S5PV210_UFCON_TXTRIG64	(5<<8)
+#define S5PV210_UFCON_TXTRIG128 (6<<8)
+#define S5PV210_UFCON_TXTRIG256 (7<<8)
+
+#define S5PV210_UFCON_RXTRIG1	(0<<4)
+#define S5PV210_UFCON_RXTRIG4	(1<<4)
+#define S5PV210_UFCON_RXTRIG8	(2<<4)
+#define S5PV210_UFCON_RXTRIG16	(3<<4)
+#define S5PV210_UFCON_RXTRIG32	(4<<4)
+#define S5PV210_UFCON_RXTRIG64	(5<<4)
+#define S5PV210_UFCON_RXTRIG128	(6<<4)
+#define S5PV210_UFCON_RXTRIG256	(7<<4)
+
+#define S5PV210_UFSTAT_TXFULL	(1<<24)
+#define S5PV210_UFSTAT_RXFULL	(1<<8)
+#define S5PV210_UFSTAT_TXMASK	(255<<16)
+#define S5PV210_UFSTAT_TXSHIFT	(16)
+#define S5PV210_UFSTAT_RXMASK	(255<<0)
+#define S5PV210_UFSTAT_RXSHIFT	(0)
+
+#define S3C2410_UCON_CLKSEL0	(1 << 0)
+#define S3C2410_UCON_CLKSEL1	(1 << 1)
+#define S3C2410_UCON_CLKSEL2	(1 << 2)
+#define S3C2410_UCON_CLKSEL3	(1 << 3)
+
+/* Default values for s5pv210 UCON and UFCON uart registers */
+#define S5PV210_UCON_DEFAULT	(S3C2410_UCON_TXILEVEL |	\
+				 S3C2410_UCON_RXILEVEL |	\
+				 S3C2410_UCON_TXIRQMODE |	\
+				 S3C2410_UCON_RXIRQMODE |	\
+				 S3C2410_UCON_RXFIFO_TOI |	\
+				 S3C2443_UCON_RXERR_IRQEN)
+
+#define S5PV210_UFCON_DEFAULT	(S3C2410_UFCON_FIFOMODE |	\
+				 S5PV210_UFCON_TXTRIG4 |	\
+				 S5PV210_UFCON_RXTRIG4)
+
+#ifndef __ASSEMBLY__
+
+/* configuration structure for per-machine configurations for the
+ * serial port
+ *
+ * the pointer is setup by the machine specific initialisation from the
+ * arch/arm/mach-s3c2410/ directory.
+*/
+
+struct s3c2410_uartcfg {
+	unsigned char	   hwport;	 /* hardware port number */
+	unsigned char	   unused;
+	unsigned short	   flags;
+	upf_t		   uart_flags;	 /* default uart flags */
+	unsigned int	   clk_sel;
+
+	unsigned int	   has_fracval;
+
+	unsigned long	   ucon;	 /* value of ucon for port */
+	unsigned long	   ulcon;	 /* value of ulcon for port */
+	unsigned long	   ufcon;	 /* value of ufcon for port */
+};
+
+#endif /* __ASSEMBLY__ */
+
+#endif /* __ASM_ARM_REGS_SERIAL_H */
+
-- 
1.8.1.2

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

* [PATCH 05/23] tty: serial/samsung: fix modular build
  2013-03-05 17:42 [PATCH 00/23] RFC: exynos multiplatform support Arnd Bergmann
                   ` (3 preceding siblings ...)
  2013-03-05 17:42 ` [PATCH 04/23] tty: serial/samsung: make register definitions global Arnd Bergmann
@ 2013-03-05 17:42 ` Arnd Bergmann
  2013-03-05 17:42 ` [PATCH 06/23] ARM: exynos: move debug-macro.S to include/debug/ Arnd Bergmann
                   ` (20 subsequent siblings)
  25 siblings, 0 replies; 49+ messages in thread
From: Arnd Bergmann @ 2013-03-05 17:42 UTC (permalink / raw)
  To: linux-arm-kernel

There are a few bugs in the samsung serial driver when
built as a loadable module, which makes the console
code unavailable, as well as giving no access to
the 'printascii' early debug function. This adds
the appropriate compile time conditionals.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/tty/serial/samsung.c | 4 ++--
 drivers/tty/serial/samsung.h | 4 +++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index 729a60d..a3277ca 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -894,7 +894,7 @@ console_initcall(s3c24xx_serial_console_init);
 #define S3C24XX_SERIAL_CONSOLE NULL
 #endif
 
-#ifdef CONFIG_CONSOLE_POLL
+#if defined(CONFIG_SERIAL_SAMSUNG_CONSOLE) && defined(CONFIG_CONSOLE_POLL)
 static int s3c24xx_serial_get_poll_char(struct uart_port *port);
 static void s3c24xx_serial_put_poll_char(struct uart_port *port,
 			 unsigned char c);
@@ -918,7 +918,7 @@ static struct uart_ops s3c24xx_serial_ops = {
 	.request_port	= s3c24xx_serial_request_port,
 	.config_port	= s3c24xx_serial_config_port,
 	.verify_port	= s3c24xx_serial_verify_port,
-#ifdef CONFIG_CONSOLE_POLL
+#if defined(CONFIG_SERIAL_SAMSUNG_CONSOLE) && defined(CONFIG_CONSOLE_POLL)
 	.poll_get_char = s3c24xx_serial_get_poll_char,
 	.poll_put_char = s3c24xx_serial_put_poll_char,
 #endif
diff --git a/drivers/tty/serial/samsung.h b/drivers/tty/serial/samsung.h
index 1a4bca3..00a499e 100644
--- a/drivers/tty/serial/samsung.h
+++ b/drivers/tty/serial/samsung.h
@@ -76,7 +76,9 @@ struct s3c24xx_uart_port {
 #define wr_regb(port, reg, val) __raw_writeb(val, portaddr(port, reg))
 #define wr_regl(port, reg, val) __raw_writel(val, portaddr(port, reg))
 
-#ifdef CONFIG_SERIAL_SAMSUNG_DEBUG
+#if defined(CONFIG_SERIAL_SAMSUNG_DEBUG) && \
+    defined(CONFIG_DEBUG_LL) && \
+    !defined(MODULE)
 
 extern void printascii(const char *);
 
-- 
1.8.1.2

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

* [PATCH 06/23] ARM: exynos: move debug-macro.S to include/debug/
  2013-03-05 17:42 [PATCH 00/23] RFC: exynos multiplatform support Arnd Bergmann
                   ` (4 preceding siblings ...)
  2013-03-05 17:42 ` [PATCH 05/23] tty: serial/samsung: fix modular build Arnd Bergmann
@ 2013-03-05 17:42 ` Arnd Bergmann
  2013-03-05 17:42 ` [PATCH 07/23] i2c: s3c2410: make header file local Arnd Bergmann
                   ` (19 subsequent siblings)
  25 siblings, 0 replies; 49+ messages in thread
From: Arnd Bergmann @ 2013-03-05 17:42 UTC (permalink / raw)
  To: linux-arm-kernel

The move is necessary to support early debug output
on exynos with multiplatform configurations. This
implies also moving the plat/debug-macro.S file, but
we are leaving the remaining users of that file
in place, to avoid adding large numbers of extra
configuration options to Kconfig.debug

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/Kconfig.debug                           |  8 +++
 arch/arm/include/debug/exynos.S                  | 39 +++++++++++
 arch/arm/include/debug/samsung.S                 | 87 ++++++++++++++++++++++++
 arch/arm/mach-exynos/include/mach/debug-macro.S  | 39 -----------
 arch/arm/mach-s3c24xx/include/mach/debug-macro.S |  2 +-
 arch/arm/mach-s3c64xx/include/mach/debug-macro.S |  2 +-
 arch/arm/mach-s5p64x0/include/mach/debug-macro.S |  2 +-
 arch/arm/mach-s5pc100/include/mach/debug-macro.S |  2 +-
 arch/arm/mach-s5pv210/include/mach/debug-macro.S |  2 +-
 arch/arm/plat-samsung/include/plat/debug-macro.S | 87 ------------------------
 10 files changed, 139 insertions(+), 131 deletions(-)
 create mode 100644 arch/arm/include/debug/exynos.S
 create mode 100644 arch/arm/include/debug/samsung.S
 delete mode 100644 arch/arm/mach-exynos/include/mach/debug-macro.S
 delete mode 100644 arch/arm/plat-samsung/include/plat/debug-macro.S

diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index acdddda..3c6851a 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -330,6 +330,7 @@ choice
 
 	config DEBUG_S3C_UART0
 		depends on PLAT_SAMSUNG
+		select DEBUG_EXYNOS_UART if ARCH_EXYNOS
 		bool "Use S3C UART 0 for low-level debug"
 		help
 		  Say Y here if you want the debug print routines to direct
@@ -341,6 +342,7 @@ choice
 
 	config DEBUG_S3C_UART1
 		depends on PLAT_SAMSUNG
+		select DEBUG_EXYNOS_UART if ARCH_EXYNOS
 		bool "Use S3C UART 1 for low-level debug"
 		help
 		  Say Y here if you want the debug print routines to direct
@@ -352,6 +354,7 @@ choice
 
 	config DEBUG_S3C_UART2
 		depends on PLAT_SAMSUNG
+		select DEBUG_EXYNOS_UART if ARCH_EXYNOS
 		bool "Use S3C UART 2 for low-level debug"
 		help
 		  Say Y here if you want the debug print routines to direct
@@ -363,6 +366,7 @@ choice
 
 	config DEBUG_S3C_UART3
 		depends on PLAT_SAMSUNG && ARCH_EXYNOS
+		select DEBUG_EXYNOS_UART
 		bool "Use S3C UART 3 for low-level debug"
 		help
 		  Say Y here if you want the debug print routines to direct
@@ -485,6 +489,9 @@ choice
 
 endchoice
 
+config DEBUG_EXYNOS_UART
+	bool
+
 config DEBUG_IMX_UART_PORT
 	int "i.MX Debug UART Port Selection" if DEBUG_IMX1_UART || \
 						DEBUG_IMX25_UART || \
@@ -579,6 +586,7 @@ endchoice
 
 config DEBUG_LL_INCLUDE
 	string
+	default "debug/exynos.S" if DEBUG_EXYNOS_UART
 	default "debug/icedcc.S" if DEBUG_ICEDCC
 	default "debug/imx.S" if DEBUG_IMX1_UART || \
 				 DEBUG_IMX25_UART || \
diff --git a/arch/arm/include/debug/exynos.S b/arch/arm/include/debug/exynos.S
new file mode 100644
index 0000000..b17fdb7
--- /dev/null
+++ b/arch/arm/include/debug/exynos.S
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com
+ *
+ * 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. */
+
+#define S3C_ADDR_BASE   0xF6000000
+#define S3C_VA_UART	S3C_ADDR_BASE + 0x01000000
+#define EXYNOS4_PA_UART	0x13800000
+#define EXYNOS5_PA_UART	0x12C00000
+
+	/* 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
+		mrc	p15, 0, \tmp, c0, c0, 0
+		and	\tmp, \tmp, #0xf0
+		teq	\tmp, #0xf0		@@ A15
+		ldreq	\rp, =EXYNOS5_PA_UART
+		movne	\rp, #EXYNOS4_PA_UART	@@ EXYNOS4
+		ldr	\rv, =S3C_VA_UART
+#if CONFIG_DEBUG_S3C_UART != 0
+		add	\rp, \rp, #(0x10000 * CONFIG_DEBUG_S3C_UART)
+		add	\rv, \rv, #(0x10000 * CONFIG_DEBUG_S3C_UART)
+#endif
+	.endm
+
+#define fifo_full fifo_full_s5pv210
+#define fifo_level fifo_level_s5pv210
+
+#include <debug/samsung.S>
diff --git a/arch/arm/include/debug/samsung.S b/arch/arm/include/debug/samsung.S
new file mode 100644
index 0000000..8d8d922
--- /dev/null
+++ b/arch/arm/include/debug/samsung.S
@@ -0,0 +1,87 @@
+/* arch/arm/plat-samsung/include/plat/debug-macro.S
+ *
+ * Copyright 2005, 2007 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.
+*/
+
+#include <linux/serial_s3c.h>
+
+/* The S5PV210/S5PC110 implementations are as belows. */
+
+	.macro fifo_level_s5pv210 rd, rx
+		ldr	\rd, [\rx, # S3C2410_UFSTAT]
+		and	\rd, \rd, #S5PV210_UFSTAT_TXMASK
+	.endm
+
+	.macro  fifo_full_s5pv210 rd, rx
+		ldr	\rd, [\rx, # S3C2410_UFSTAT]
+		tst	\rd, #S5PV210_UFSTAT_TXFULL
+	.endm
+
+/* The S3C2440 implementations are used by default as they are the
+ * most widely re-used */
+
+	.macro fifo_level_s3c2440 rd, rx
+		ldr	\rd, [\rx, # S3C2410_UFSTAT]
+		and	\rd, \rd, #S3C2440_UFSTAT_TXMASK
+	.endm
+
+#ifndef fifo_level
+#define fifo_level fifo_level_s3c2440
+#endif
+
+	.macro  fifo_full_s3c2440 rd, rx
+		ldr	\rd, [\rx, # S3C2410_UFSTAT]
+		tst	\rd, #S3C2440_UFSTAT_TXFULL
+	.endm
+
+#ifndef fifo_full
+#define fifo_full fifo_full_s3c2440
+#endif
+
+	.macro	senduart,rd,rx
+		strb 	\rd, [\rx, # S3C2410_UTXH]
+	.endm
+
+	.macro	busyuart, rd, rx
+		ldr	\rd, [\rx, # S3C2410_UFCON]
+		tst	\rd, #S3C2410_UFCON_FIFOMODE	@ fifo enabled?
+		beq	1001f				@
+		@ FIFO enabled...
+1003:
+		fifo_full \rd, \rx
+		bne	1003b
+		b	1002f
+
+1001:
+		@ busy waiting for non fifo
+		ldr	\rd, [\rx, # S3C2410_UTRSTAT]
+		tst	\rd, #S3C2410_UTRSTAT_TXFE
+		beq	1001b
+
+1002:		@ exit busyuart
+	.endm
+
+	.macro	waituart,rd,rx
+		ldr	\rd, [\rx, # S3C2410_UFCON]
+		tst	\rd, #S3C2410_UFCON_FIFOMODE	@ fifo enabled?
+		beq	1001f				@
+		@ FIFO enabled...
+1003:
+		fifo_level \rd, \rx
+		teq	\rd, #0
+		bne	1003b
+		b	1002f
+1001:
+		@ idle waiting for non fifo
+		ldr	\rd, [\rx, # S3C2410_UTRSTAT]
+		tst	\rd, #S3C2410_UTRSTAT_TXFE
+		beq	1001b
+
+1002:		@ exit busyuart
+	.endm
diff --git a/arch/arm/mach-exynos/include/mach/debug-macro.S b/arch/arm/mach-exynos/include/mach/debug-macro.S
deleted file mode 100644
index e0c86ea..0000000
--- a/arch/arm/mach-exynos/include/mach/debug-macro.S
+++ /dev/null
@@ -1,39 +0,0 @@
-/* linux/arch/arm/mach-exynos4/include/mach/debug-macro.S
- *
- * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
- *		http://www.samsung.com
- *
- * Based on arch/arm/mach-s3c6400/include/mach/debug-macro.S
- *
- * 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 <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
-		mrc	p15, 0, \tmp, c0, c0, 0
-		and	\tmp, \tmp, #0xf0
-		teq	\tmp, #0xf0		@@ A15
-		ldreq	\rp, =EXYNOS5_PA_UART
-		movne	\rp, #EXYNOS4_PA_UART	@@ EXYNOS4
-		ldr	\rv, =S3C_VA_UART
-#if CONFIG_DEBUG_S3C_UART != 0
-		add	\rp, \rp, #(0x10000 * CONFIG_DEBUG_S3C_UART)
-		add	\rv, \rv, #(0x10000 * CONFIG_DEBUG_S3C_UART)
-#endif
-	.endm
-
-#define fifo_full fifo_full_s5pv210
-#define fifo_level fifo_level_s5pv210
-
-#include <plat/debug-macro.S>
diff --git a/arch/arm/mach-s3c24xx/include/mach/debug-macro.S b/arch/arm/mach-s3c24xx/include/mach/debug-macro.S
index 13ed33c..2558952 100644
--- a/arch/arm/mach-s3c24xx/include/mach/debug-macro.S
+++ b/arch/arm/mach-s3c24xx/include/mach/debug-macro.S
@@ -98,4 +98,4 @@
 
 /* include the reset of the code which will do the work */
 
-#include <plat/debug-macro.S>
+#include <debug/samsung.S>
diff --git a/arch/arm/mach-s3c64xx/include/mach/debug-macro.S b/arch/arm/mach-s3c64xx/include/mach/debug-macro.S
index c0c076a..dd9ccca 100644
--- a/arch/arm/mach-s3c64xx/include/mach/debug-macro.S
+++ b/arch/arm/mach-s3c64xx/include/mach/debug-macro.S
@@ -35,4 +35,4 @@
  * will be fine with us.
  */
 
-#include <plat/debug-macro.S>
+#include <debug/samsung.S>
diff --git a/arch/arm/mach-s5p64x0/include/mach/debug-macro.S b/arch/arm/mach-s5p64x0/include/mach/debug-macro.S
index e80ba3c..5e2916f 100644
--- a/arch/arm/mach-s5p64x0/include/mach/debug-macro.S
+++ b/arch/arm/mach-s5p64x0/include/mach/debug-macro.S
@@ -30,4 +30,4 @@
 #endif
 	.endm
 
-#include <plat/debug-macro.S>
+#include <debug/samsung.S>
diff --git a/arch/arm/mach-s5pc100/include/mach/debug-macro.S b/arch/arm/mach-s5pc100/include/mach/debug-macro.S
index 694f759..66cb7f1 100644
--- a/arch/arm/mach-s5pc100/include/mach/debug-macro.S
+++ b/arch/arm/mach-s5pc100/include/mach/debug-macro.S
@@ -36,4 +36,4 @@
  * will be fine with us.
  */
 
-#include <plat/debug-macro.S>
+#include <debug/samsung.S>
diff --git a/arch/arm/mach-s5pv210/include/mach/debug-macro.S b/arch/arm/mach-s5pv210/include/mach/debug-macro.S
index 79e5559..80c2199 100644
--- a/arch/arm/mach-s5pv210/include/mach/debug-macro.S
+++ b/arch/arm/mach-s5pv210/include/mach/debug-macro.S
@@ -38,4 +38,4 @@
  * will be fine with us.
  */
 
-#include <plat/debug-macro.S>
+#include <debug/samsung.S>
diff --git a/arch/arm/plat-samsung/include/plat/debug-macro.S b/arch/arm/plat-samsung/include/plat/debug-macro.S
deleted file mode 100644
index f3a9cff..0000000
--- a/arch/arm/plat-samsung/include/plat/debug-macro.S
+++ /dev/null
@@ -1,87 +0,0 @@
-/* arch/arm/plat-samsung/include/plat/debug-macro.S
- *
- * Copyright 2005, 2007 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.
-*/
-
-#include <plat/regs-serial.h>
-
-/* The S5PV210/S5PC110 implementations are as belows. */
-
-	.macro fifo_level_s5pv210 rd, rx
-		ldr	\rd, [\rx, # S3C2410_UFSTAT]
-		and	\rd, \rd, #S5PV210_UFSTAT_TXMASK
-	.endm
-
-	.macro  fifo_full_s5pv210 rd, rx
-		ldr	\rd, [\rx, # S3C2410_UFSTAT]
-		tst	\rd, #S5PV210_UFSTAT_TXFULL
-	.endm
-
-/* The S3C2440 implementations are used by default as they are the
- * most widely re-used */
-
-	.macro fifo_level_s3c2440 rd, rx
-		ldr	\rd, [\rx, # S3C2410_UFSTAT]
-		and	\rd, \rd, #S3C2440_UFSTAT_TXMASK
-	.endm
-
-#ifndef fifo_level
-#define fifo_level fifo_level_s3c2440
-#endif
-
-	.macro  fifo_full_s3c2440 rd, rx
-		ldr	\rd, [\rx, # S3C2410_UFSTAT]
-		tst	\rd, #S3C2440_UFSTAT_TXFULL
-	.endm
-
-#ifndef fifo_full
-#define fifo_full fifo_full_s3c2440
-#endif
-
-	.macro	senduart,rd,rx
-		strb 	\rd, [\rx, # S3C2410_UTXH]
-	.endm
-
-	.macro	busyuart, rd, rx
-		ldr	\rd, [\rx, # S3C2410_UFCON]
-		tst	\rd, #S3C2410_UFCON_FIFOMODE	@ fifo enabled?
-		beq	1001f				@
-		@ FIFO enabled...
-1003:
-		fifo_full \rd, \rx
-		bne	1003b
-		b	1002f
-
-1001:
-		@ busy waiting for non fifo
-		ldr	\rd, [\rx, # S3C2410_UTRSTAT]
-		tst	\rd, #S3C2410_UTRSTAT_TXFE
-		beq	1001b
-
-1002:		@ exit busyuart
-	.endm
-
-	.macro	waituart,rd,rx
-		ldr	\rd, [\rx, # S3C2410_UFCON]
-		tst	\rd, #S3C2410_UFCON_FIFOMODE	@ fifo enabled?
-		beq	1001f				@
-		@ FIFO enabled...
-1003:
-		fifo_level \rd, \rx
-		teq	\rd, #0
-		bne	1003b
-		b	1002f
-1001:
-		@ idle waiting for non fifo
-		ldr	\rd, [\rx, # S3C2410_UTRSTAT]
-		tst	\rd, #S3C2410_UTRSTAT_TXFE
-		beq	1001b
-
-1002:		@ exit busyuart
-	.endm
-- 
1.8.1.2

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

* [PATCH 07/23] i2c: s3c2410: make header file local
  2013-03-05 17:42 [PATCH 00/23] RFC: exynos multiplatform support Arnd Bergmann
                   ` (5 preceding siblings ...)
  2013-03-05 17:42 ` [PATCH 06/23] ARM: exynos: move debug-macro.S to include/debug/ Arnd Bergmann
@ 2013-03-05 17:42 ` Arnd Bergmann
  2013-04-02 20:36   ` Heiko Stübner
  2013-03-05 17:42 ` [PATCH 08/23] mmc: sdhci-s3c: remove platform dependencies Arnd Bergmann
                   ` (18 subsequent siblings)
  25 siblings, 1 reply; 49+ messages in thread
From: Arnd Bergmann @ 2013-03-05 17:42 UTC (permalink / raw)
  To: linux-arm-kernel

No other file in the kernel besides i2c-s3c2410.c uses
the current plat/regs-iic.h, so we can simply move the
header file to live in the same directory as the driver,
as a preparation to multiplatform builds.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-s3c24xx/mach-rx1950.c           |  1 -
 arch/arm/plat-samsung/devs.c                  |  1 -
 arch/arm/plat-samsung/include/plat/regs-iic.h | 56 ---------------------------
 drivers/i2c/busses/i2c-s3c2410.c              |  3 +-
 drivers/i2c/busses/i2c-s3c2410.h              | 56 +++++++++++++++++++++++++++
 5 files changed, 58 insertions(+), 59 deletions(-)
 delete mode 100644 arch/arm/plat-samsung/include/plat/regs-iic.h
 create mode 100644 drivers/i2c/busses/i2c-s3c2410.h

diff --git a/arch/arm/mach-s3c24xx/mach-rx1950.c b/arch/arm/mach-s3c24xx/mach-rx1950.c
index 1f9ba2a..43f3ac5 100644
--- a/arch/arm/mach-s3c24xx/mach-rx1950.c
+++ b/arch/arm/mach-s3c24xx/mach-rx1950.c
@@ -56,7 +56,6 @@
 #include <plat/cpu.h>
 #include <plat/devs.h>
 #include <plat/pm.h>
-#include <plat/regs-iic.h>
 #include <plat/regs-serial.h>
 
 #include "common.h"
diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c
index 51afedd..76209c9 100644
--- a/arch/arm/plat-samsung/devs.c
+++ b/arch/arm/plat-samsung/devs.c
@@ -62,7 +62,6 @@
 #include <linux/platform_data/usb-s3c2410_udc.h>
 #include <linux/platform_data/usb-ohci-s3c2410.h>
 #include <plat/usb-phy.h>
-#include <plat/regs-iic.h>
 #include <plat/regs-serial.h>
 #include <plat/regs-spi.h>
 #include <linux/platform_data/spi-s3c64xx.h>
diff --git a/arch/arm/plat-samsung/include/plat/regs-iic.h b/arch/arm/plat-samsung/include/plat/regs-iic.h
deleted file mode 100644
index 2f7c17d..0000000
--- a/arch/arm/plat-samsung/include/plat/regs-iic.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* arch/arm/mach-s3c2410/include/mach/regs-iic.h
- *
- * Copyright (c) 2004 Simtec Electronics <linux@simtec.co.uk>
- *		http://www.simtec.co.uk/products/SWLINUX/
- *
- * 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.
- *
- * S3C2410 I2C Controller
-*/
-
-#ifndef __ASM_ARCH_REGS_IIC_H
-#define __ASM_ARCH_REGS_IIC_H __FILE__
-
-/* see s3c2410x user guide, v1.1, section 9 (p447) for more info */
-
-#define S3C2410_IICREG(x) (x)
-
-#define S3C2410_IICCON    S3C2410_IICREG(0x00)
-#define S3C2410_IICSTAT   S3C2410_IICREG(0x04)
-#define S3C2410_IICADD    S3C2410_IICREG(0x08)
-#define S3C2410_IICDS     S3C2410_IICREG(0x0C)
-#define S3C2440_IICLC	  S3C2410_IICREG(0x10)
-
-#define S3C2410_IICCON_ACKEN		(1<<7)
-#define S3C2410_IICCON_TXDIV_16		(0<<6)
-#define S3C2410_IICCON_TXDIV_512	(1<<6)
-#define S3C2410_IICCON_IRQEN		(1<<5)
-#define S3C2410_IICCON_IRQPEND		(1<<4)
-#define S3C2410_IICCON_SCALE(x)		((x)&15)
-#define S3C2410_IICCON_SCALEMASK	(0xf)
-
-#define S3C2410_IICSTAT_MASTER_RX	(2<<6)
-#define S3C2410_IICSTAT_MASTER_TX	(3<<6)
-#define S3C2410_IICSTAT_SLAVE_RX	(0<<6)
-#define S3C2410_IICSTAT_SLAVE_TX	(1<<6)
-#define S3C2410_IICSTAT_MODEMASK	(3<<6)
-
-#define S3C2410_IICSTAT_START		(1<<5)
-#define S3C2410_IICSTAT_BUSBUSY		(1<<5)
-#define S3C2410_IICSTAT_TXRXEN		(1<<4)
-#define S3C2410_IICSTAT_ARBITR		(1<<3)
-#define S3C2410_IICSTAT_ASSLAVE		(1<<2)
-#define S3C2410_IICSTAT_ADDR0		(1<<1)
-#define S3C2410_IICSTAT_LASTBIT		(1<<0)
-
-#define S3C2410_IICLC_SDA_DELAY0	(0 << 0)
-#define S3C2410_IICLC_SDA_DELAY5	(1 << 0)
-#define S3C2410_IICLC_SDA_DELAY10	(2 << 0)
-#define S3C2410_IICLC_SDA_DELAY15	(3 << 0)
-#define S3C2410_IICLC_SDA_DELAY_MASK	(3 << 0)
-
-#define S3C2410_IICLC_FILTER_ON		(1<<2)
-
-#endif /* __ASM_ARCH_REGS_IIC_H */
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index f6b880b..d042ad0 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -42,9 +42,10 @@
 
 #include <asm/irq.h>
 
-#include <plat/regs-iic.h>
 #include <linux/platform_data/i2c-s3c2410.h>
 
+#include "i2c-s3c2410.h"
+
 /* Treat S3C2410 as baseline hardware, anything else is supported via quirks */
 #define QUIRK_S3C2440		(1 << 0)
 #define QUIRK_HDMIPHY		(1 << 1)
diff --git a/drivers/i2c/busses/i2c-s3c2410.h b/drivers/i2c/busses/i2c-s3c2410.h
new file mode 100644
index 0000000..2f7c17d
--- /dev/null
+++ b/drivers/i2c/busses/i2c-s3c2410.h
@@ -0,0 +1,56 @@
+/* arch/arm/mach-s3c2410/include/mach/regs-iic.h
+ *
+ * Copyright (c) 2004 Simtec Electronics <linux@simtec.co.uk>
+ *		http://www.simtec.co.uk/products/SWLINUX/
+ *
+ * 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.
+ *
+ * S3C2410 I2C Controller
+*/
+
+#ifndef __ASM_ARCH_REGS_IIC_H
+#define __ASM_ARCH_REGS_IIC_H __FILE__
+
+/* see s3c2410x user guide, v1.1, section 9 (p447) for more info */
+
+#define S3C2410_IICREG(x) (x)
+
+#define S3C2410_IICCON    S3C2410_IICREG(0x00)
+#define S3C2410_IICSTAT   S3C2410_IICREG(0x04)
+#define S3C2410_IICADD    S3C2410_IICREG(0x08)
+#define S3C2410_IICDS     S3C2410_IICREG(0x0C)
+#define S3C2440_IICLC	  S3C2410_IICREG(0x10)
+
+#define S3C2410_IICCON_ACKEN		(1<<7)
+#define S3C2410_IICCON_TXDIV_16		(0<<6)
+#define S3C2410_IICCON_TXDIV_512	(1<<6)
+#define S3C2410_IICCON_IRQEN		(1<<5)
+#define S3C2410_IICCON_IRQPEND		(1<<4)
+#define S3C2410_IICCON_SCALE(x)		((x)&15)
+#define S3C2410_IICCON_SCALEMASK	(0xf)
+
+#define S3C2410_IICSTAT_MASTER_RX	(2<<6)
+#define S3C2410_IICSTAT_MASTER_TX	(3<<6)
+#define S3C2410_IICSTAT_SLAVE_RX	(0<<6)
+#define S3C2410_IICSTAT_SLAVE_TX	(1<<6)
+#define S3C2410_IICSTAT_MODEMASK	(3<<6)
+
+#define S3C2410_IICSTAT_START		(1<<5)
+#define S3C2410_IICSTAT_BUSBUSY		(1<<5)
+#define S3C2410_IICSTAT_TXRXEN		(1<<4)
+#define S3C2410_IICSTAT_ARBITR		(1<<3)
+#define S3C2410_IICSTAT_ASSLAVE		(1<<2)
+#define S3C2410_IICSTAT_ADDR0		(1<<1)
+#define S3C2410_IICSTAT_LASTBIT		(1<<0)
+
+#define S3C2410_IICLC_SDA_DELAY0	(0 << 0)
+#define S3C2410_IICLC_SDA_DELAY5	(1 << 0)
+#define S3C2410_IICLC_SDA_DELAY10	(2 << 0)
+#define S3C2410_IICLC_SDA_DELAY15	(3 << 0)
+#define S3C2410_IICLC_SDA_DELAY_MASK	(3 << 0)
+
+#define S3C2410_IICLC_FILTER_ON		(1<<2)
+
+#endif /* __ASM_ARCH_REGS_IIC_H */
-- 
1.8.1.2

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

* [PATCH 08/23] mmc: sdhci-s3c: remove platform dependencies
  2013-03-05 17:42 [PATCH 00/23] RFC: exynos multiplatform support Arnd Bergmann
                   ` (6 preceding siblings ...)
  2013-03-05 17:42 ` [PATCH 07/23] i2c: s3c2410: make header file local Arnd Bergmann
@ 2013-03-05 17:42 ` Arnd Bergmann
  2013-03-05 17:42 ` [PATCH 09/23] usb: exynos: do not include plat/usb-phy.h Arnd Bergmann
                   ` (17 subsequent siblings)
  25 siblings, 0 replies; 49+ messages in thread
From: Arnd Bergmann @ 2013-03-05 17:42 UTC (permalink / raw)
  To: linux-arm-kernel

plat/regs-sdhci.h is not used anywhere but in the sdhci-s3c
driver, so it can become a local file there and all other
inclusions removed.

plat/sdhci.h is used only to define the platform devices,
and with the exception of the platform_data structure not
needed by the driver, so we can split out the platform_data
definition instead and leave the rest to platform code.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-exynos/setup-sdhci-gpio.c         |  2 +-
 arch/arm/mach-s5pc100/setup-sdhci-gpio.c        |  1 -
 arch/arm/mach-s5pv210/setup-sdhci-gpio.c        |  1 -
 arch/arm/plat-samsung/include/plat/regs-sdhci.h | 87 -------------------------
 arch/arm/plat-samsung/include/plat/sdhci.h      | 56 +---------------
 drivers/mmc/host/Kconfig                        |  2 +-
 drivers/mmc/host/sdhci-s3c-regs.h               | 87 +++++++++++++++++++++++++
 drivers/mmc/host/sdhci-s3c.c                    |  5 +-
 include/linux/platform_data/mmc-sdhci-s3c.h     | 56 ++++++++++++++++
 9 files changed, 148 insertions(+), 149 deletions(-)
 delete mode 100644 arch/arm/plat-samsung/include/plat/regs-sdhci.h
 create mode 100644 drivers/mmc/host/sdhci-s3c-regs.h
 create mode 100644 include/linux/platform_data/mmc-sdhci-s3c.h

diff --git a/arch/arm/mach-exynos/setup-sdhci-gpio.c b/arch/arm/mach-exynos/setup-sdhci-gpio.c
index e8d08bf..d5b98c8 100644
--- a/arch/arm/mach-exynos/setup-sdhci-gpio.c
+++ b/arch/arm/mach-exynos/setup-sdhci-gpio.c
@@ -19,8 +19,8 @@
 #include <linux/mmc/host.h>
 #include <linux/mmc/card.h>
 
+#include <mach/gpio.h>
 #include <plat/gpio-cfg.h>
-#include <plat/regs-sdhci.h>
 #include <plat/sdhci.h>
 
 void exynos4_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
diff --git a/arch/arm/mach-s5pc100/setup-sdhci-gpio.c b/arch/arm/mach-s5pc100/setup-sdhci-gpio.c
index 03c02d0..6010c03 100644
--- a/arch/arm/mach-s5pc100/setup-sdhci-gpio.c
+++ b/arch/arm/mach-s5pc100/setup-sdhci-gpio.c
@@ -19,7 +19,6 @@
 #include <linux/mmc/card.h>
 
 #include <plat/gpio-cfg.h>
-#include <plat/regs-sdhci.h>
 #include <plat/sdhci.h>
 
 void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
diff --git a/arch/arm/mach-s5pv210/setup-sdhci-gpio.c b/arch/arm/mach-s5pv210/setup-sdhci-gpio.c
index 3e3ac05..0512ada 100644
--- a/arch/arm/mach-s5pv210/setup-sdhci-gpio.c
+++ b/arch/arm/mach-s5pv210/setup-sdhci-gpio.c
@@ -20,7 +20,6 @@
 #include <linux/mmc/card.h>
 
 #include <plat/gpio-cfg.h>
-#include <plat/regs-sdhci.h>
 #include <plat/sdhci.h>
 
 void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
diff --git a/arch/arm/plat-samsung/include/plat/regs-sdhci.h b/arch/arm/plat-samsung/include/plat/regs-sdhci.h
deleted file mode 100644
index e34049a..0000000
--- a/arch/arm/plat-samsung/include/plat/regs-sdhci.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* linux/arch/arm/plat-s3c/include/plat/regs-sdhci.h
- *
- * Copyright 2008 Openmoko, Inc.
- * Copyright 2008 Simtec Electronics
- *	http://armlinux.simtec.co.uk/
- *	Ben Dooks <ben@simtec.co.uk>
- *
- * S3C Platform - SDHCI (HSMMC) register definitions
- *
- * 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.
-*/
-
-#ifndef __PLAT_S3C_SDHCI_REGS_H
-#define __PLAT_S3C_SDHCI_REGS_H __FILE__
-
-#define S3C_SDHCI_CONTROL2			(0x80)
-#define S3C_SDHCI_CONTROL3			(0x84)
-#define S3C64XX_SDHCI_CONTROL4			(0x8C)
-
-#define S3C64XX_SDHCI_CTRL2_ENSTAASYNCCLR	(1 << 31)
-#define S3C64XX_SDHCI_CTRL2_ENCMDCNFMSK		(1 << 30)
-#define S3C_SDHCI_CTRL2_CDINVRXD3		(1 << 29)
-#define S3C_SDHCI_CTRL2_SLCARDOUT		(1 << 28)
-
-#define S3C_SDHCI_CTRL2_FLTCLKSEL_MASK		(0xf << 24)
-#define S3C_SDHCI_CTRL2_FLTCLKSEL_SHIFT		(24)
-#define S3C_SDHCI_CTRL2_FLTCLKSEL(_x)		((_x) << 24)
-
-#define S3C_SDHCI_CTRL2_LVLDAT_MASK		(0xff << 16)
-#define S3C_SDHCI_CTRL2_LVLDAT_SHIFT		(16)
-#define S3C_SDHCI_CTRL2_LVLDAT(_x)		((_x) << 16)
-
-#define S3C_SDHCI_CTRL2_ENFBCLKTX		(1 << 15)
-#define S3C_SDHCI_CTRL2_ENFBCLKRX		(1 << 14)
-#define S3C_SDHCI_CTRL2_SDCDSEL			(1 << 13)
-#define S3C_SDHCI_CTRL2_SDSIGPC			(1 << 12)
-#define S3C_SDHCI_CTRL2_ENBUSYCHKTXSTART	(1 << 11)
-
-#define S3C_SDHCI_CTRL2_DFCNT_MASK		(0x3 << 9)
-#define S3C_SDHCI_CTRL2_DFCNT_SHIFT		(9)
-#define S3C_SDHCI_CTRL2_DFCNT_NONE		(0x0 << 9)
-#define S3C_SDHCI_CTRL2_DFCNT_4SDCLK		(0x1 << 9)
-#define S3C_SDHCI_CTRL2_DFCNT_16SDCLK		(0x2 << 9)
-#define S3C_SDHCI_CTRL2_DFCNT_64SDCLK		(0x3 << 9)
-
-#define S3C_SDHCI_CTRL2_ENCLKOUTHOLD		(1 << 8)
-#define S3C_SDHCI_CTRL2_RWAITMODE		(1 << 7)
-#define S3C_SDHCI_CTRL2_DISBUFRD		(1 << 6)
-#define S3C_SDHCI_CTRL2_SELBASECLK_MASK		(0x3 << 4)
-#define S3C_SDHCI_CTRL2_SELBASECLK_SHIFT	(4)
-#define S3C_SDHCI_CTRL2_PWRSYNC			(1 << 3)
-#define S3C_SDHCI_CTRL2_ENCLKOUTMSKCON		(1 << 1)
-#define S3C_SDHCI_CTRL2_HWINITFIN		(1 << 0)
-
-#define S3C_SDHCI_CTRL3_FCSEL3			(1 << 31)
-#define S3C_SDHCI_CTRL3_FCSEL2			(1 << 23)
-#define S3C_SDHCI_CTRL3_FCSEL1			(1 << 15)
-#define S3C_SDHCI_CTRL3_FCSEL0			(1 << 7)
-
-#define S3C_SDHCI_CTRL3_FIA3_MASK		(0x7f << 24)
-#define S3C_SDHCI_CTRL3_FIA3_SHIFT		(24)
-#define S3C_SDHCI_CTRL3_FIA3(_x)		((_x) << 24)
-
-#define S3C_SDHCI_CTRL3_FIA2_MASK		(0x7f << 16)
-#define S3C_SDHCI_CTRL3_FIA2_SHIFT		(16)
-#define S3C_SDHCI_CTRL3_FIA2(_x)		((_x) << 16)
-
-#define S3C_SDHCI_CTRL3_FIA1_MASK		(0x7f << 8)
-#define S3C_SDHCI_CTRL3_FIA1_SHIFT		(8)
-#define S3C_SDHCI_CTRL3_FIA1(_x)		((_x) << 8)
-
-#define S3C_SDHCI_CTRL3_FIA0_MASK		(0x7f << 0)
-#define S3C_SDHCI_CTRL3_FIA0_SHIFT		(0)
-#define S3C_SDHCI_CTRL3_FIA0(_x)		((_x) << 0)
-
-#define S3C64XX_SDHCI_CONTROL4_DRIVE_MASK	(0x3 << 16)
-#define S3C64XX_SDHCI_CONTROL4_DRIVE_SHIFT	(16)
-#define S3C64XX_SDHCI_CONTROL4_DRIVE_2mA	(0x0 << 16)
-#define S3C64XX_SDHCI_CONTROL4_DRIVE_4mA	(0x1 << 16)
-#define S3C64XX_SDHCI_CONTROL4_DRIVE_7mA	(0x2 << 16)
-#define S3C64XX_SDHCI_CONTROL4_DRIVE_9mA	(0x3 << 16)
-
-#define S3C64XX_SDHCI_CONTROL4_BUSY		(1)
-
-#endif /* __PLAT_S3C_SDHCI_REGS_H */
diff --git a/arch/arm/plat-samsung/include/plat/sdhci.h b/arch/arm/plat-samsung/include/plat/sdhci.h
index 9b87f38..1e0aab0 100644
--- a/arch/arm/plat-samsung/include/plat/sdhci.h
+++ b/arch/arm/plat-samsung/include/plat/sdhci.h
@@ -18,62 +18,9 @@
 #ifndef __PLAT_S3C_SDHCI_H
 #define __PLAT_S3C_SDHCI_H __FILE__
 
+#include <linux/platform_data/mmc-sdhci-s3c.h>
 #include <plat/devs.h>
 
-struct platform_device;
-struct mmc_host;
-struct mmc_card;
-struct mmc_ios;
-
-enum cd_types {
-	S3C_SDHCI_CD_INTERNAL,	/* use mmc internal CD line */
-	S3C_SDHCI_CD_EXTERNAL,	/* use external callback */
-	S3C_SDHCI_CD_GPIO,	/* use external gpio pin for CD line */
-	S3C_SDHCI_CD_NONE,	/* no CD line, use polling to detect card */
-	S3C_SDHCI_CD_PERMANENT,	/* no CD line, card permanently wired to host */
-};
-
-/**
- * struct s3c_sdhci_platdata() - Platform device data for Samsung SDHCI
- * @max_width: The maximum number of data bits supported.
- * @host_caps: Standard MMC host capabilities bit field.
- * @host_caps2: The second standard MMC host capabilities bit field.
- * @cd_type: Type of Card Detection method (see cd_types enum above)
- * @ext_cd_init: Initialize external card detect subsystem. Called on
- *		 sdhci-s3c driver probe when cd_type == S3C_SDHCI_CD_EXTERNAL.
- *		 notify_func argument is a callback to the sdhci-s3c driver
- *		 that triggers the card detection event. Callback arguments:
- *		 dev is pointer to platform device of the host controller,
- *		 state is new state of the card (0 - removed, 1 - inserted).
- * @ext_cd_cleanup: Cleanup external card detect subsystem. Called on
- *		 sdhci-s3c driver remove when cd_type == S3C_SDHCI_CD_EXTERNAL.
- *		 notify_func argument is the same callback as for ext_cd_init.
- * @ext_cd_gpio: gpio pin used for external CD line, valid only if
- *		 cd_type == S3C_SDHCI_CD_GPIO
- * @ext_cd_gpio_invert: invert values for external CD gpio line
- * @cfg_gpio: Configure the GPIO for a specific card bit-width
- *
- * Initialisation data specific to either the machine or the platform
- * for the device driver to use or call-back when configuring gpio or
- * card speed information.
-*/
-struct s3c_sdhci_platdata {
-	unsigned int	max_width;
-	unsigned int	host_caps;
-	unsigned int	host_caps2;
-	unsigned int	pm_caps;
-	enum cd_types	cd_type;
-
-	int		ext_cd_gpio;
-	bool		ext_cd_gpio_invert;
-	int	(*ext_cd_init)(void (*notify_func)(struct platform_device *,
-						   int state));
-	int	(*ext_cd_cleanup)(void (*notify_func)(struct platform_device *,
-						      int state));
-
-	void	(*cfg_gpio)(struct platform_device *dev, int width);
-};
-
 /* s3c_sdhci_set_platdata() - common helper for setting SDHCI platform data
  * @pd: The default platform data for this device.
  * @set: Pointer to the platform data to fill in.
@@ -378,5 +325,4 @@ static inline void s3c_sdhci_setname(int id, char *name)
 		break;
 	}
 }
-
 #endif /* __PLAT_S3C_SDHCI_H */
diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
index d88219e..d054744 100644
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
@@ -180,7 +180,7 @@ config MMC_SDHCI_TEGRA
 
 config MMC_SDHCI_S3C
 	tristate "SDHCI support on Samsung S3C SoC"
-	depends on MMC_SDHCI && PLAT_SAMSUNG
+	depends on MMC_SDHCI && PLAT_SAMSUNG_SINGLE
 	help
 	  This selects the Secure Digital Host Controller Interface (SDHCI)
 	  often referrered to as the HSMMC block in some of the Samsung S3C
diff --git a/drivers/mmc/host/sdhci-s3c-regs.h b/drivers/mmc/host/sdhci-s3c-regs.h
new file mode 100644
index 0000000..e34049a
--- /dev/null
+++ b/drivers/mmc/host/sdhci-s3c-regs.h
@@ -0,0 +1,87 @@
+/* linux/arch/arm/plat-s3c/include/plat/regs-sdhci.h
+ *
+ * Copyright 2008 Openmoko, Inc.
+ * Copyright 2008 Simtec Electronics
+ *	http://armlinux.simtec.co.uk/
+ *	Ben Dooks <ben@simtec.co.uk>
+ *
+ * S3C Platform - SDHCI (HSMMC) register definitions
+ *
+ * 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.
+*/
+
+#ifndef __PLAT_S3C_SDHCI_REGS_H
+#define __PLAT_S3C_SDHCI_REGS_H __FILE__
+
+#define S3C_SDHCI_CONTROL2			(0x80)
+#define S3C_SDHCI_CONTROL3			(0x84)
+#define S3C64XX_SDHCI_CONTROL4			(0x8C)
+
+#define S3C64XX_SDHCI_CTRL2_ENSTAASYNCCLR	(1 << 31)
+#define S3C64XX_SDHCI_CTRL2_ENCMDCNFMSK		(1 << 30)
+#define S3C_SDHCI_CTRL2_CDINVRXD3		(1 << 29)
+#define S3C_SDHCI_CTRL2_SLCARDOUT		(1 << 28)
+
+#define S3C_SDHCI_CTRL2_FLTCLKSEL_MASK		(0xf << 24)
+#define S3C_SDHCI_CTRL2_FLTCLKSEL_SHIFT		(24)
+#define S3C_SDHCI_CTRL2_FLTCLKSEL(_x)		((_x) << 24)
+
+#define S3C_SDHCI_CTRL2_LVLDAT_MASK		(0xff << 16)
+#define S3C_SDHCI_CTRL2_LVLDAT_SHIFT		(16)
+#define S3C_SDHCI_CTRL2_LVLDAT(_x)		((_x) << 16)
+
+#define S3C_SDHCI_CTRL2_ENFBCLKTX		(1 << 15)
+#define S3C_SDHCI_CTRL2_ENFBCLKRX		(1 << 14)
+#define S3C_SDHCI_CTRL2_SDCDSEL			(1 << 13)
+#define S3C_SDHCI_CTRL2_SDSIGPC			(1 << 12)
+#define S3C_SDHCI_CTRL2_ENBUSYCHKTXSTART	(1 << 11)
+
+#define S3C_SDHCI_CTRL2_DFCNT_MASK		(0x3 << 9)
+#define S3C_SDHCI_CTRL2_DFCNT_SHIFT		(9)
+#define S3C_SDHCI_CTRL2_DFCNT_NONE		(0x0 << 9)
+#define S3C_SDHCI_CTRL2_DFCNT_4SDCLK		(0x1 << 9)
+#define S3C_SDHCI_CTRL2_DFCNT_16SDCLK		(0x2 << 9)
+#define S3C_SDHCI_CTRL2_DFCNT_64SDCLK		(0x3 << 9)
+
+#define S3C_SDHCI_CTRL2_ENCLKOUTHOLD		(1 << 8)
+#define S3C_SDHCI_CTRL2_RWAITMODE		(1 << 7)
+#define S3C_SDHCI_CTRL2_DISBUFRD		(1 << 6)
+#define S3C_SDHCI_CTRL2_SELBASECLK_MASK		(0x3 << 4)
+#define S3C_SDHCI_CTRL2_SELBASECLK_SHIFT	(4)
+#define S3C_SDHCI_CTRL2_PWRSYNC			(1 << 3)
+#define S3C_SDHCI_CTRL2_ENCLKOUTMSKCON		(1 << 1)
+#define S3C_SDHCI_CTRL2_HWINITFIN		(1 << 0)
+
+#define S3C_SDHCI_CTRL3_FCSEL3			(1 << 31)
+#define S3C_SDHCI_CTRL3_FCSEL2			(1 << 23)
+#define S3C_SDHCI_CTRL3_FCSEL1			(1 << 15)
+#define S3C_SDHCI_CTRL3_FCSEL0			(1 << 7)
+
+#define S3C_SDHCI_CTRL3_FIA3_MASK		(0x7f << 24)
+#define S3C_SDHCI_CTRL3_FIA3_SHIFT		(24)
+#define S3C_SDHCI_CTRL3_FIA3(_x)		((_x) << 24)
+
+#define S3C_SDHCI_CTRL3_FIA2_MASK		(0x7f << 16)
+#define S3C_SDHCI_CTRL3_FIA2_SHIFT		(16)
+#define S3C_SDHCI_CTRL3_FIA2(_x)		((_x) << 16)
+
+#define S3C_SDHCI_CTRL3_FIA1_MASK		(0x7f << 8)
+#define S3C_SDHCI_CTRL3_FIA1_SHIFT		(8)
+#define S3C_SDHCI_CTRL3_FIA1(_x)		((_x) << 8)
+
+#define S3C_SDHCI_CTRL3_FIA0_MASK		(0x7f << 0)
+#define S3C_SDHCI_CTRL3_FIA0_SHIFT		(0)
+#define S3C_SDHCI_CTRL3_FIA0(_x)		((_x) << 0)
+
+#define S3C64XX_SDHCI_CONTROL4_DRIVE_MASK	(0x3 << 16)
+#define S3C64XX_SDHCI_CONTROL4_DRIVE_SHIFT	(16)
+#define S3C64XX_SDHCI_CONTROL4_DRIVE_2mA	(0x0 << 16)
+#define S3C64XX_SDHCI_CONTROL4_DRIVE_4mA	(0x1 << 16)
+#define S3C64XX_SDHCI_CONTROL4_DRIVE_7mA	(0x2 << 16)
+#define S3C64XX_SDHCI_CONTROL4_DRIVE_9mA	(0x3 << 16)
+
+#define S3C64XX_SDHCI_CONTROL4_BUSY		(1)
+
+#endif /* __PLAT_S3C_SDHCI_REGS_H */
diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
index 7363efe..e4f52b5 100644
--- a/drivers/mmc/host/sdhci-s3c.c
+++ b/drivers/mmc/host/sdhci-s3c.c
@@ -15,6 +15,7 @@
 #include <linux/delay.h>
 #include <linux/dma-mapping.h>
 #include <linux/platform_device.h>
+#include <linux/platform_data/mmc-sdhci-s3c.h>
 #include <linux/slab.h>
 #include <linux/clk.h>
 #include <linux/io.h>
@@ -28,9 +29,7 @@
 
 #include <linux/mmc/host.h>
 
-#include <plat/sdhci.h>
-#include <plat/regs-sdhci.h>
-
+#include "sdhci-s3c-regs.h"
 #include "sdhci.h"
 
 #define MAX_BUS_CLK	(4)
diff --git a/include/linux/platform_data/mmc-sdhci-s3c.h b/include/linux/platform_data/mmc-sdhci-s3c.h
new file mode 100644
index 0000000..249f023
--- /dev/null
+++ b/include/linux/platform_data/mmc-sdhci-s3c.h
@@ -0,0 +1,56 @@
+#ifndef __PLATFORM_DATA_SDHCI_S3C_H
+#define __PLATFORM_DATA_SDHCI_S3C_H
+
+struct platform_device;
+
+enum cd_types {
+	S3C_SDHCI_CD_INTERNAL,	/* use mmc internal CD line */
+	S3C_SDHCI_CD_EXTERNAL,	/* use external callback */
+	S3C_SDHCI_CD_GPIO,	/* use external gpio pin for CD line */
+	S3C_SDHCI_CD_NONE,	/* no CD line, use polling to detect card */
+	S3C_SDHCI_CD_PERMANENT,	/* no CD line, card permanently wired to host */
+};
+
+/**
+ * struct s3c_sdhci_platdata() - Platform device data for Samsung SDHCI
+ * @max_width: The maximum number of data bits supported.
+ * @host_caps: Standard MMC host capabilities bit field.
+ * @host_caps2: The second standard MMC host capabilities bit field.
+ * @cd_type: Type of Card Detection method (see cd_types enum above)
+ * @ext_cd_init: Initialize external card detect subsystem. Called on
+ *		 sdhci-s3c driver probe when cd_type == S3C_SDHCI_CD_EXTERNAL.
+ *		 notify_func argument is a callback to the sdhci-s3c driver
+ *		 that triggers the card detection event. Callback arguments:
+ *		 dev is pointer to platform device of the host controller,
+ *		 state is new state of the card (0 - removed, 1 - inserted).
+ * @ext_cd_cleanup: Cleanup external card detect subsystem. Called on
+ *		 sdhci-s3c driver remove when cd_type == S3C_SDHCI_CD_EXTERNAL.
+ *		 notify_func argument is the same callback as for ext_cd_init.
+ * @ext_cd_gpio: gpio pin used for external CD line, valid only if
+ *		 cd_type == S3C_SDHCI_CD_GPIO
+ * @ext_cd_gpio_invert: invert values for external CD gpio line
+ * @cfg_gpio: Configure the GPIO for a specific card bit-width
+ *
+ * Initialisation data specific to either the machine or the platform
+ * for the device driver to use or call-back when configuring gpio or
+ * card speed information.
+*/
+struct s3c_sdhci_platdata {
+	unsigned int	max_width;
+	unsigned int	host_caps;
+	unsigned int	host_caps2;
+	unsigned int	pm_caps;
+	enum cd_types	cd_type;
+
+	int		ext_cd_gpio;
+	bool		ext_cd_gpio_invert;
+	int	(*ext_cd_init)(void (*notify_func)(struct platform_device *,
+						   int state));
+	int	(*ext_cd_cleanup)(void (*notify_func)(struct platform_device *,
+						      int state));
+
+	void	(*cfg_gpio)(struct platform_device *dev, int width);
+};
+
+
+#endif /* __PLATFORM_DATA_SDHCI_S3C_H */
-- 
1.8.1.2

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

* [PATCH 09/23] usb: exynos: do not include plat/usb-phy.h
  2013-03-05 17:42 [PATCH 00/23] RFC: exynos multiplatform support Arnd Bergmann
                   ` (7 preceding siblings ...)
  2013-03-05 17:42 ` [PATCH 08/23] mmc: sdhci-s3c: remove platform dependencies Arnd Bergmann
@ 2013-03-05 17:42 ` Arnd Bergmann
  2013-03-05 17:42 ` [PATCH 10/23] [media] exynos: remove unnecessary header inclusions Arnd Bergmann
                   ` (16 subsequent siblings)
  25 siblings, 0 replies; 49+ messages in thread
From: Arnd Bergmann @ 2013-03-05 17:42 UTC (permalink / raw)
  To: linux-arm-kernel

The definitions have moved to include/linux/usb/samsung-usb-phy.h,
and plat/usb-phy.h is unavailable from drivers in a multiplatform
configuration.

Also fix up the plat/usb-phy.h header file to use the definitions
from the new header instead of providing a separate copy.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-exynos/setup-usb-phy.c         | 8 ++++----
 arch/arm/mach-s3c64xx/setup-usb-phy.c        | 4 ++--
 arch/arm/mach-s5pv210/setup-usb-phy.c        | 4 ++--
 arch/arm/plat-samsung/include/plat/usb-phy.h | 5 +----
 drivers/usb/host/ehci-s5p.c                  | 1 -
 drivers/usb/host/ohci-exynos.c               | 1 -
 6 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/arch/arm/mach-exynos/setup-usb-phy.c b/arch/arm/mach-exynos/setup-usb-phy.c
index b81cc56..6af4066 100644
--- a/arch/arm/mach-exynos/setup-usb-phy.c
+++ b/arch/arm/mach-exynos/setup-usb-phy.c
@@ -204,9 +204,9 @@ static int exynos4210_usb_phy1_exit(struct platform_device *pdev)
 
 int s5p_usb_phy_init(struct platform_device *pdev, int type)
 {
-	if (type == S5P_USB_PHY_DEVICE)
+	if (type == USB_PHY_TYPE_DEVICE)
 		return exynos4210_usb_phy0_init(pdev);
-	else if (type == S5P_USB_PHY_HOST)
+	else if (type == USB_PHY_TYPE_HOST)
 		return exynos4210_usb_phy1_init(pdev);
 
 	return -EINVAL;
@@ -214,9 +214,9 @@ int s5p_usb_phy_init(struct platform_device *pdev, int type)
 
 int s5p_usb_phy_exit(struct platform_device *pdev, int type)
 {
-	if (type == S5P_USB_PHY_DEVICE)
+	if (type == USB_PHY_TYPE_DEVICE)
 		return exynos4210_usb_phy0_exit(pdev);
-	else if (type == S5P_USB_PHY_HOST)
+	else if (type == USB_PHY_TYPE_HOST)
 		return exynos4210_usb_phy1_exit(pdev);
 
 	return -EINVAL;
diff --git a/arch/arm/mach-s3c64xx/setup-usb-phy.c b/arch/arm/mach-s3c64xx/setup-usb-phy.c
index c8174d9..ca960bd 100644
--- a/arch/arm/mach-s3c64xx/setup-usb-phy.c
+++ b/arch/arm/mach-s3c64xx/setup-usb-phy.c
@@ -76,7 +76,7 @@ static int s3c_usb_otgphy_exit(struct platform_device *pdev)
 
 int s5p_usb_phy_init(struct platform_device *pdev, int type)
 {
-	if (type == S5P_USB_PHY_DEVICE)
+	if (type == USB_PHY_TYPE_DEVICE)
 		return s3c_usb_otgphy_init(pdev);
 
 	return -EINVAL;
@@ -84,7 +84,7 @@ int s5p_usb_phy_init(struct platform_device *pdev, int type)
 
 int s5p_usb_phy_exit(struct platform_device *pdev, int type)
 {
-	if (type == S5P_USB_PHY_DEVICE)
+	if (type == USB_PHY_TYPE_DEVICE)
 		return s3c_usb_otgphy_exit(pdev);
 
 	return -EINVAL;
diff --git a/arch/arm/mach-s5pv210/setup-usb-phy.c b/arch/arm/mach-s5pv210/setup-usb-phy.c
index 356a090..b2ee533 100644
--- a/arch/arm/mach-s5pv210/setup-usb-phy.c
+++ b/arch/arm/mach-s5pv210/setup-usb-phy.c
@@ -80,7 +80,7 @@ static int s5pv210_usb_otgphy_exit(struct platform_device *pdev)
 
 int s5p_usb_phy_init(struct platform_device *pdev, int type)
 {
-	if (type == S5P_USB_PHY_DEVICE)
+	if (type == USB_PHY_TYPE_DEVICE)
 		return s5pv210_usb_otgphy_init(pdev);
 
 	return -EINVAL;
@@ -88,7 +88,7 @@ int s5p_usb_phy_init(struct platform_device *pdev, int type)
 
 int s5p_usb_phy_exit(struct platform_device *pdev, int type)
 {
-	if (type == S5P_USB_PHY_DEVICE)
+	if (type == USB_PHY_TYPE_DEVICE)
 		return s5pv210_usb_otgphy_exit(pdev);
 
 	return -EINVAL;
diff --git a/arch/arm/plat-samsung/include/plat/usb-phy.h b/arch/arm/plat-samsung/include/plat/usb-phy.h
index 959bcdb..ab34dfa 100644
--- a/arch/arm/plat-samsung/include/plat/usb-phy.h
+++ b/arch/arm/plat-samsung/include/plat/usb-phy.h
@@ -11,10 +11,7 @@
 #ifndef __PLAT_SAMSUNG_USB_PHY_H
 #define __PLAT_SAMSUNG_USB_PHY_H __FILE__
 
-enum s5p_usb_phy_type {
-	S5P_USB_PHY_DEVICE,
-	S5P_USB_PHY_HOST,
-};
+#include <linux/usb/samsung_usb_phy.h>
 
 extern int s5p_usb_phy_init(struct platform_device *pdev, int type);
 extern int s5p_usb_phy_exit(struct platform_device *pdev, int type);
diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c
index 20ebf6a..7dc9c15 100644
--- a/drivers/usb/host/ehci-s5p.c
+++ b/drivers/usb/host/ehci-s5p.c
@@ -19,7 +19,6 @@
 #include <linux/platform_data/usb-ehci-s5p.h>
 #include <linux/usb/phy.h>
 #include <linux/usb/samsung_usb_phy.h>
-#include <plat/usb-phy.h>
 
 #define EHCI_INSNREG00(base)			(base + 0x90)
 #define EHCI_INSNREG00_ENA_INCR16		(0x1 << 25)
diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c
index e3b7e85..b5b5977 100644
--- a/drivers/usb/host/ohci-exynos.c
+++ b/drivers/usb/host/ohci-exynos.c
@@ -17,7 +17,6 @@
 #include <linux/platform_data/usb-exynos.h>
 #include <linux/usb/phy.h>
 #include <linux/usb/samsung_usb_phy.h>
-#include <plat/usb-phy.h>
 
 struct exynos_ohci_hcd {
 	struct device *dev;
-- 
1.8.1.2

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

* [PATCH 10/23] [media] exynos: remove unnecessary header inclusions
  2013-03-05 17:42 [PATCH 00/23] RFC: exynos multiplatform support Arnd Bergmann
                   ` (8 preceding siblings ...)
  2013-03-05 17:42 ` [PATCH 09/23] usb: exynos: do not include plat/usb-phy.h Arnd Bergmann
@ 2013-03-05 17:42 ` Arnd Bergmann
  2013-04-02 13:08   ` Sylwester Nawrocki
  2013-03-05 17:42 ` [PATCH 11/23] video/exynos: " Arnd Bergmann
                   ` (15 subsequent siblings)
  25 siblings, 1 reply; 49+ messages in thread
From: Arnd Bergmann @ 2013-03-05 17:42 UTC (permalink / raw)
  To: linux-arm-kernel

In multiplatform configurations, we cannot include headers
provided by only the exynos platform. Fortunately a number
of drivers that include those headers do not actually need
them, so we can just remove the inclusions.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/media/platform/exynos-gsc/gsc-regs.c | 1 -
 drivers/media/platform/s5p-tv/sii9234_drv.c  | 3 ---
 2 files changed, 4 deletions(-)

diff --git a/drivers/media/platform/exynos-gsc/gsc-regs.c b/drivers/media/platform/exynos-gsc/gsc-regs.c
index 6f5b5a4..e22d147 100644
--- a/drivers/media/platform/exynos-gsc/gsc-regs.c
+++ b/drivers/media/platform/exynos-gsc/gsc-regs.c
@@ -12,7 +12,6 @@
 
 #include <linux/io.h>
 #include <linux/delay.h>
-#include <mach/map.h>
 
 #include "gsc-core.h"
 
diff --git a/drivers/media/platform/s5p-tv/sii9234_drv.c b/drivers/media/platform/s5p-tv/sii9234_drv.c
index d90d228..39b77d2 100644
--- a/drivers/media/platform/s5p-tv/sii9234_drv.c
+++ b/drivers/media/platform/s5p-tv/sii9234_drv.c
@@ -23,9 +23,6 @@
 #include <linux/regulator/machine.h>
 #include <linux/slab.h>
 
-#include <mach/gpio.h>
-#include <plat/gpio-cfg.h>
-
 #include <media/sii9234.h>
 #include <media/v4l2-subdev.h>
 
-- 
1.8.1.2

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

* [PATCH 11/23] video/exynos: remove unnecessary header inclusions
  2013-03-05 17:42 [PATCH 00/23] RFC: exynos multiplatform support Arnd Bergmann
                   ` (9 preceding siblings ...)
  2013-03-05 17:42 ` [PATCH 10/23] [media] exynos: remove unnecessary header inclusions Arnd Bergmann
@ 2013-03-05 17:42 ` Arnd Bergmann
  2013-03-05 17:42 ` [PATCH 12/23] thermal/exynos: " Arnd Bergmann
                   ` (14 subsequent siblings)
  25 siblings, 0 replies; 49+ messages in thread
From: Arnd Bergmann @ 2013-03-05 17:42 UTC (permalink / raw)
  To: linux-arm-kernel

In multiplatform configurations, we cannot include headers
provided by only the exynos platform. Fortunately a number
of drivers that include those headers do not actually need
them, so we can just remove the inclusions.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/video/exynos/exynos_mipi_dsi.c          | 2 --
 drivers/video/exynos/exynos_mipi_dsi_common.c   | 2 --
 drivers/video/exynos/exynos_mipi_dsi_lowlevel.c | 2 --
 3 files changed, 6 deletions(-)

diff --git a/drivers/video/exynos/exynos_mipi_dsi.c b/drivers/video/exynos/exynos_mipi_dsi.c
index fac7df6..3dd43ca 100644
--- a/drivers/video/exynos/exynos_mipi_dsi.c
+++ b/drivers/video/exynos/exynos_mipi_dsi.c
@@ -35,8 +35,6 @@
 
 #include <video/exynos_mipi_dsim.h>
 
-#include <plat/fb.h>
-
 #include "exynos_mipi_dsi_common.h"
 #include "exynos_mipi_dsi_lowlevel.h"
 
diff --git a/drivers/video/exynos/exynos_mipi_dsi_common.c b/drivers/video/exynos/exynos_mipi_dsi_common.c
index c70cb89..520fc9b 100644
--- a/drivers/video/exynos/exynos_mipi_dsi_common.c
+++ b/drivers/video/exynos/exynos_mipi_dsi_common.c
@@ -31,8 +31,6 @@
 #include <video/mipi_display.h>
 #include <video/exynos_mipi_dsim.h>
 
-#include <mach/map.h>
-
 #include "exynos_mipi_dsi_regs.h"
 #include "exynos_mipi_dsi_lowlevel.h"
 #include "exynos_mipi_dsi_common.h"
diff --git a/drivers/video/exynos/exynos_mipi_dsi_lowlevel.c b/drivers/video/exynos/exynos_mipi_dsi_lowlevel.c
index 95cb99a..15c5abd 100644
--- a/drivers/video/exynos/exynos_mipi_dsi_lowlevel.c
+++ b/drivers/video/exynos/exynos_mipi_dsi_lowlevel.c
@@ -26,8 +26,6 @@
 
 #include <video/exynos_mipi_dsim.h>
 
-#include <mach/map.h>
-
 #include "exynos_mipi_dsi_regs.h"
 
 void exynos_mipi_dsi_func_reset(struct mipi_dsim_device *dsim)
-- 
1.8.1.2

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

* [PATCH 12/23] thermal/exynos: remove unnecessary header inclusions
  2013-03-05 17:42 [PATCH 00/23] RFC: exynos multiplatform support Arnd Bergmann
                   ` (10 preceding siblings ...)
  2013-03-05 17:42 ` [PATCH 11/23] video/exynos: " Arnd Bergmann
@ 2013-03-05 17:42 ` Arnd Bergmann
  2013-03-05 17:42 ` [PATCH 13/23] mtd: onenand/samsung: make regs-onenand.h file local Arnd Bergmann
                   ` (13 subsequent siblings)
  25 siblings, 0 replies; 49+ messages in thread
From: Arnd Bergmann @ 2013-03-05 17:42 UTC (permalink / raw)
  To: linux-arm-kernel

In multiplatform configurations, we cannot include headers
provided by only the exynos platform. Fortunately a number
of drivers that include those headers do not actually need
them, so we can just remove the inclusions.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/thermal/exynos_thermal.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/thermal/exynos_thermal.c b/drivers/thermal/exynos_thermal.c
index e04ebd8..8dd7984 100644
--- a/drivers/thermal/exynos_thermal.c
+++ b/drivers/thermal/exynos_thermal.c
@@ -39,8 +39,6 @@
 #include <linux/cpu_cooling.h>
 #include <linux/of.h>
 
-#include <plat/cpu.h>
-
 /* Exynos generic registers */
 #define EXYNOS_TMU_REG_TRIMINFO		0x0
 #define EXYNOS_TMU_REG_CONTROL		0x20
-- 
1.8.1.2

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

* [PATCH 13/23] mtd: onenand/samsung: make regs-onenand.h file local
  2013-03-05 17:42 [PATCH 00/23] RFC: exynos multiplatform support Arnd Bergmann
                   ` (11 preceding siblings ...)
  2013-03-05 17:42 ` [PATCH 12/23] thermal/exynos: " Arnd Bergmann
@ 2013-03-05 17:42 ` Arnd Bergmann
  2013-03-05 17:42 ` [PATCH 14/23] rtc: s3c: make header " Arnd Bergmann
                   ` (12 subsequent siblings)
  25 siblings, 0 replies; 49+ messages in thread
From: Arnd Bergmann @ 2013-03-05 17:42 UTC (permalink / raw)
  To: linux-arm-kernel

Nothing uses the NAND register definitions other than the
actual driver, so we can move the header file into the
same local directory, which lets us build it in a multiplatform
configuration.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/plat-samsung/include/plat/regs-onenand.h | 63 -----------------------
 drivers/mtd/onenand/samsung.c                     |  4 +-
 drivers/mtd/onenand/samsung.h                     | 61 ++++++++++++++++++++++
 3 files changed, 63 insertions(+), 65 deletions(-)
 delete mode 100644 arch/arm/plat-samsung/include/plat/regs-onenand.h
 create mode 100644 drivers/mtd/onenand/samsung.h

diff --git a/arch/arm/plat-samsung/include/plat/regs-onenand.h b/arch/arm/plat-samsung/include/plat/regs-onenand.h
deleted file mode 100644
index 930ea8b..0000000
--- a/arch/arm/plat-samsung/include/plat/regs-onenand.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * linux/arch/arm/plat-s3c/include/plat/regs-onenand.h
- *
- *  Copyright (C) 2008-2010 Samsung Electronics
- *  Kyungmin Park <kyungmin.park@samsung.com>
- *
- * 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.
- */
-#ifndef __SAMSUNG_ONENAND_H__
-#define __SAMSUNG_ONENAND_H__
-
-#include <mach/hardware.h>
-
-/*
- * OneNAND Controller
- */
-#define MEM_CFG_OFFSET		0x0000
-#define BURST_LEN_OFFSET	0x0010
-#define MEM_RESET_OFFSET	0x0020
-#define INT_ERR_STAT_OFFSET	0x0030
-#define INT_ERR_MASK_OFFSET	0x0040
-#define INT_ERR_ACK_OFFSET	0x0050
-#define ECC_ERR_STAT_OFFSET	0x0060
-#define MANUFACT_ID_OFFSET	0x0070
-#define DEVICE_ID_OFFSET	0x0080
-#define DATA_BUF_SIZE_OFFSET	0x0090
-#define BOOT_BUF_SIZE_OFFSET	0x00A0
-#define BUF_AMOUNT_OFFSET	0x00B0
-#define TECH_OFFSET		0x00C0
-#define FBA_WIDTH_OFFSET	0x00D0
-#define FPA_WIDTH_OFFSET	0x00E0
-#define FSA_WIDTH_OFFSET	0x00F0
-#define TRANS_SPARE_OFFSET	0x0140
-#define DBS_DFS_WIDTH_OFFSET	0x0160
-#define INT_PIN_ENABLE_OFFSET	0x01A0
-#define ACC_CLOCK_OFFSET	0x01C0
-#define FLASH_VER_ID_OFFSET	0x01F0
-#define FLASH_AUX_CNTRL_OFFSET	0x0300		/* s3c64xx only */
-
-#define ONENAND_MEM_RESET_HOT	0x3
-#define ONENAND_MEM_RESET_COLD	0x2
-#define ONENAND_MEM_RESET_WARM	0x1
-
-#define CACHE_OP_ERR		(1 << 13)
-#define RST_CMP			(1 << 12)
-#define RDY_ACT			(1 << 11)
-#define INT_ACT			(1 << 10)
-#define UNSUP_CMD		(1 << 9)
-#define LOCKED_BLK		(1 << 8)
-#define BLK_RW_CMP		(1 << 7)
-#define ERS_CMP			(1 << 6)
-#define PGM_CMP			(1 << 5)
-#define LOAD_CMP		(1 << 4)
-#define ERS_FAIL		(1 << 3)
-#define PGM_FAIL		(1 << 2)
-#define INT_TO			(1 << 1)
-#define LD_FAIL_ECC_ERR		(1 << 0)
-
-#define TSRF			(1 << 0)
-
-#endif
diff --git a/drivers/mtd/onenand/samsung.c b/drivers/mtd/onenand/samsung.c
index 33f2a8f..2cf7408 100644
--- a/drivers/mtd/onenand/samsung.c
+++ b/drivers/mtd/onenand/samsung.c
@@ -23,11 +23,11 @@
 #include <linux/mtd/partitions.h>
 #include <linux/dma-mapping.h>
 #include <linux/interrupt.h>
+#include <linux/io.h>
 
 #include <asm/mach/flash.h>
-#include <plat/regs-onenand.h>
 
-#include <linux/io.h>
+#include "samsung.h"
 
 enum soc_type {
 	TYPE_S3C6400,
diff --git a/drivers/mtd/onenand/samsung.h b/drivers/mtd/onenand/samsung.h
new file mode 100644
index 0000000..c4a80e6
--- /dev/null
+++ b/drivers/mtd/onenand/samsung.h
@@ -0,0 +1,61 @@
+/*
+ * linux/arch/arm/plat-s3c/include/plat/regs-onenand.h
+ *
+ *  Copyright (C) 2008-2010 Samsung Electronics
+ *  Kyungmin Park <kyungmin.park@samsung.com>
+ *
+ * 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.
+ */
+#ifndef __SAMSUNG_ONENAND_H__
+#define __SAMSUNG_ONENAND_H__
+
+/*
+ * OneNAND Controller
+ */
+#define MEM_CFG_OFFSET		0x0000
+#define BURST_LEN_OFFSET	0x0010
+#define MEM_RESET_OFFSET	0x0020
+#define INT_ERR_STAT_OFFSET	0x0030
+#define INT_ERR_MASK_OFFSET	0x0040
+#define INT_ERR_ACK_OFFSET	0x0050
+#define ECC_ERR_STAT_OFFSET	0x0060
+#define MANUFACT_ID_OFFSET	0x0070
+#define DEVICE_ID_OFFSET	0x0080
+#define DATA_BUF_SIZE_OFFSET	0x0090
+#define BOOT_BUF_SIZE_OFFSET	0x00A0
+#define BUF_AMOUNT_OFFSET	0x00B0
+#define TECH_OFFSET		0x00C0
+#define FBA_WIDTH_OFFSET	0x00D0
+#define FPA_WIDTH_OFFSET	0x00E0
+#define FSA_WIDTH_OFFSET	0x00F0
+#define TRANS_SPARE_OFFSET	0x0140
+#define DBS_DFS_WIDTH_OFFSET	0x0160
+#define INT_PIN_ENABLE_OFFSET	0x01A0
+#define ACC_CLOCK_OFFSET	0x01C0
+#define FLASH_VER_ID_OFFSET	0x01F0
+#define FLASH_AUX_CNTRL_OFFSET	0x0300		/* s3c64xx only */
+
+#define ONENAND_MEM_RESET_HOT	0x3
+#define ONENAND_MEM_RESET_COLD	0x2
+#define ONENAND_MEM_RESET_WARM	0x1
+
+#define CACHE_OP_ERR		(1 << 13)
+#define RST_CMP			(1 << 12)
+#define RDY_ACT			(1 << 11)
+#define INT_ACT			(1 << 10)
+#define UNSUP_CMD		(1 << 9)
+#define LOCKED_BLK		(1 << 8)
+#define BLK_RW_CMP		(1 << 7)
+#define ERS_CMP			(1 << 6)
+#define PGM_CMP			(1 << 5)
+#define LOAD_CMP		(1 << 4)
+#define ERS_FAIL		(1 << 3)
+#define PGM_FAIL		(1 << 2)
+#define INT_TO			(1 << 1)
+#define LD_FAIL_ECC_ERR		(1 << 0)
+
+#define TSRF			(1 << 0)
+
+#endif
-- 
1.8.1.2

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

* [PATCH 14/23] rtc: s3c: make header file local
  2013-03-05 17:42 [PATCH 00/23] RFC: exynos multiplatform support Arnd Bergmann
                   ` (12 preceding siblings ...)
  2013-03-05 17:42 ` [PATCH 13/23] mtd: onenand/samsung: make regs-onenand.h file local Arnd Bergmann
@ 2013-03-05 17:42 ` Arnd Bergmann
  2013-03-05 17:42 ` [PATCH 15/23] spi: s3c64xx: move to generic dmaengine API Arnd Bergmann
                   ` (11 subsequent siblings)
  25 siblings, 0 replies; 49+ messages in thread
From: Arnd Bergmann @ 2013-03-05 17:42 UTC (permalink / raw)
  To: linux-arm-kernel

Nothing outside of the rtc driver includes plat/regs-rtc.h,
so we can simply move the file into the same directory,
which allows us to build the file as platform-independent
code.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/plat-samsung/include/plat/regs-rtc.h | 71 ---------------------------
 drivers/rtc/rtc-s3c.c                         |  3 +-
 drivers/rtc/rtc-s3c.h                         | 70 ++++++++++++++++++++++++++
 3 files changed, 71 insertions(+), 73 deletions(-)
 delete mode 100644 arch/arm/plat-samsung/include/plat/regs-rtc.h
 create mode 100644 drivers/rtc/rtc-s3c.h

diff --git a/arch/arm/plat-samsung/include/plat/regs-rtc.h b/arch/arm/plat-samsung/include/plat/regs-rtc.h
deleted file mode 100644
index 0f8263e..0000000
--- a/arch/arm/plat-samsung/include/plat/regs-rtc.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* arch/arm/mach-s3c2410/include/mach/regs-rtc.h
- *
- * Copyright (c) 2003 Simtec Electronics <linux@simtec.co.uk>
- *		      http://www.simtec.co.uk/products/SWLINUX/
- *
- * 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.
- *
- * S3C2410 Internal RTC register definition
-*/
-
-#ifndef __ASM_ARCH_REGS_RTC_H
-#define __ASM_ARCH_REGS_RTC_H __FILE__
-
-#define S3C2410_RTCREG(x) (x)
-#define S3C2410_INTP		S3C2410_RTCREG(0x30)
-#define S3C2410_INTP_ALM	(1 << 1)
-#define S3C2410_INTP_TIC	(1 << 0)
-
-#define S3C2410_RTCCON		S3C2410_RTCREG(0x40)
-#define S3C2410_RTCCON_RTCEN	(1 << 0)
-#define S3C2410_RTCCON_CNTSEL	(1 << 2)
-#define S3C2410_RTCCON_CLKRST	(1 << 3)
-#define S3C2443_RTCCON_TICSEL	(1 << 4)
-#define S3C64XX_RTCCON_TICEN	(1 << 8)
-
-#define S3C2410_TICNT		S3C2410_RTCREG(0x44)
-#define S3C2410_TICNT_ENABLE	(1 << 7)
-
-/* S3C2443: tick count is 15 bit wide
- * TICNT[6:0] contains upper 7 bits
- * TICNT1[7:0] contains lower 8 bits
- */
-#define S3C2443_TICNT_PART(x)	((x & 0x7f00) >> 8)
-#define S3C2443_TICNT1		S3C2410_RTCREG(0x4C)
-#define S3C2443_TICNT1_PART(x)	(x & 0xff)
-
-/* S3C2416: tick count is 32 bit wide
- * TICNT[6:0] contains bits [14:8]
- * TICNT1[7:0] contains lower 8 bits
- * TICNT2[16:0] contains upper 17 bits
- */
-#define S3C2416_TICNT2		S3C2410_RTCREG(0x48)
-#define S3C2416_TICNT2_PART(x)	((x & 0xffff8000) >> 15)
-
-#define S3C2410_RTCALM		S3C2410_RTCREG(0x50)
-#define S3C2410_RTCALM_ALMEN	(1 << 6)
-#define S3C2410_RTCALM_YEAREN	(1 << 5)
-#define S3C2410_RTCALM_MONEN	(1 << 4)
-#define S3C2410_RTCALM_DAYEN	(1 << 3)
-#define S3C2410_RTCALM_HOUREN	(1 << 2)
-#define S3C2410_RTCALM_MINEN	(1 << 1)
-#define S3C2410_RTCALM_SECEN	(1 << 0)
-
-#define S3C2410_ALMSEC		S3C2410_RTCREG(0x54)
-#define S3C2410_ALMMIN		S3C2410_RTCREG(0x58)
-#define S3C2410_ALMHOUR		S3C2410_RTCREG(0x5c)
-
-#define S3C2410_ALMDATE		S3C2410_RTCREG(0x60)
-#define S3C2410_ALMMON		S3C2410_RTCREG(0x64)
-#define S3C2410_ALMYEAR		S3C2410_RTCREG(0x68)
-
-#define S3C2410_RTCSEC		S3C2410_RTCREG(0x70)
-#define S3C2410_RTCMIN		S3C2410_RTCREG(0x74)
-#define S3C2410_RTCHOUR		S3C2410_RTCREG(0x78)
-#define S3C2410_RTCDATE		S3C2410_RTCREG(0x7c)
-#define S3C2410_RTCMON		S3C2410_RTCREG(0x84)
-#define S3C2410_RTCYEAR		S3C2410_RTCREG(0x88)
-
-#endif /* __ASM_ARCH_REGS_RTC_H */
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index fb994e9..7995f79 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -29,9 +29,8 @@
 #include <linux/uaccess.h>
 #include <linux/io.h>
 
-#include <mach/hardware.h>
 #include <asm/irq.h>
-#include <plat/regs-rtc.h>
+#include "rtc-s3c.h"
 
 enum s3c_cpu_type {
 	TYPE_S3C2410,
diff --git a/drivers/rtc/rtc-s3c.h b/drivers/rtc/rtc-s3c.h
new file mode 100644
index 0000000..004b61a
--- /dev/null
+++ b/drivers/rtc/rtc-s3c.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2003 Simtec Electronics <linux@simtec.co.uk>
+ *		      http://www.simtec.co.uk/products/SWLINUX/
+ *
+ * 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.
+ *
+ * S3C2410 Internal RTC register definition
+*/
+
+#ifndef __ASM_ARCH_REGS_RTC_H
+#define __ASM_ARCH_REGS_RTC_H __FILE__
+
+#define S3C2410_RTCREG(x) (x)
+#define S3C2410_INTP		S3C2410_RTCREG(0x30)
+#define S3C2410_INTP_ALM	(1 << 1)
+#define S3C2410_INTP_TIC	(1 << 0)
+
+#define S3C2410_RTCCON		S3C2410_RTCREG(0x40)
+#define S3C2410_RTCCON_RTCEN	(1 << 0)
+#define S3C2410_RTCCON_CNTSEL	(1 << 2)
+#define S3C2410_RTCCON_CLKRST	(1 << 3)
+#define S3C2443_RTCCON_TICSEL	(1 << 4)
+#define S3C64XX_RTCCON_TICEN	(1 << 8)
+
+#define S3C2410_TICNT		S3C2410_RTCREG(0x44)
+#define S3C2410_TICNT_ENABLE	(1 << 7)
+
+/* S3C2443: tick count is 15 bit wide
+ * TICNT[6:0] contains upper 7 bits
+ * TICNT1[7:0] contains lower 8 bits
+ */
+#define S3C2443_TICNT_PART(x)	((x & 0x7f00) >> 8)
+#define S3C2443_TICNT1		S3C2410_RTCREG(0x4C)
+#define S3C2443_TICNT1_PART(x)	(x & 0xff)
+
+/* S3C2416: tick count is 32 bit wide
+ * TICNT[6:0] contains bits [14:8]
+ * TICNT1[7:0] contains lower 8 bits
+ * TICNT2[16:0] contains upper 17 bits
+ */
+#define S3C2416_TICNT2		S3C2410_RTCREG(0x48)
+#define S3C2416_TICNT2_PART(x)	((x & 0xffff8000) >> 15)
+
+#define S3C2410_RTCALM		S3C2410_RTCREG(0x50)
+#define S3C2410_RTCALM_ALMEN	(1 << 6)
+#define S3C2410_RTCALM_YEAREN	(1 << 5)
+#define S3C2410_RTCALM_MONEN	(1 << 4)
+#define S3C2410_RTCALM_DAYEN	(1 << 3)
+#define S3C2410_RTCALM_HOUREN	(1 << 2)
+#define S3C2410_RTCALM_MINEN	(1 << 1)
+#define S3C2410_RTCALM_SECEN	(1 << 0)
+
+#define S3C2410_ALMSEC		S3C2410_RTCREG(0x54)
+#define S3C2410_ALMMIN		S3C2410_RTCREG(0x58)
+#define S3C2410_ALMHOUR		S3C2410_RTCREG(0x5c)
+
+#define S3C2410_ALMDATE		S3C2410_RTCREG(0x60)
+#define S3C2410_ALMMON		S3C2410_RTCREG(0x64)
+#define S3C2410_ALMYEAR		S3C2410_RTCREG(0x68)
+
+#define S3C2410_RTCSEC		S3C2410_RTCREG(0x70)
+#define S3C2410_RTCMIN		S3C2410_RTCREG(0x74)
+#define S3C2410_RTCHOUR		S3C2410_RTCREG(0x78)
+#define S3C2410_RTCDATE		S3C2410_RTCREG(0x7c)
+#define S3C2410_RTCMON		S3C2410_RTCREG(0x84)
+#define S3C2410_RTCYEAR		S3C2410_RTCREG(0x88)
+
+#endif /* __ASM_ARCH_REGS_RTC_H */
-- 
1.8.1.2

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

* [PATCH 15/23] spi: s3c64xx: move to generic dmaengine API
  2013-03-05 17:42 [PATCH 00/23] RFC: exynos multiplatform support Arnd Bergmann
                   ` (13 preceding siblings ...)
  2013-03-05 17:42 ` [PATCH 14/23] rtc: s3c: make header " Arnd Bergmann
@ 2013-03-05 17:42 ` Arnd Bergmann
  2013-03-06  9:14   ` Padma Venkat
  2013-03-05 17:42 ` [PATCH 16/23] pwm: samsung: repair the worst MMIO abuses Arnd Bergmann
                   ` (10 subsequent siblings)
  25 siblings, 1 reply; 49+ messages in thread
From: Arnd Bergmann @ 2013-03-05 17:42 UTC (permalink / raw)
  To: linux-arm-kernel

The spi-s3c64xx uses a Samsung proprietary interface for
talking to the DMA engine, which does not work with
multiplatform kernels. Since the driver can also operate
in PIO mode without any DMA, older platforms that do
not support the DMA engine API will still work, although
slower.

The conversion was rather mechanical, since the samsung
interface is just a shallow wrapper around the dmaengine
interface.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/plat-samsung/devs.c              |  10 +++
 drivers/spi/spi-s3c64xx.c                 | 107 ++++++++++++++----------------
 include/linux/platform_data/spi-s3c64xx.h |   3 +
 3 files changed, 62 insertions(+), 58 deletions(-)

diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c
index 76209c9..58fb02a 100644
--- a/arch/arm/plat-samsung/devs.c
+++ b/arch/arm/plat-samsung/devs.c
@@ -10,6 +10,7 @@
  * published by the Free Software Foundation.
 */
 
+#include <linux/amba/pl330.h>
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/interrupt.h>
@@ -1551,6 +1552,9 @@ void __init s3c64xx_spi0_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
 	pd.num_cs = num_cs;
 	pd.src_clk_nr = src_clk_nr;
 	pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi0_cfg_gpio;
+#ifdef CONFIG_PL330_DMA
+	pd.filter = pl330_filter;
+#endif
 
 	s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi0);
 }
@@ -1589,6 +1593,9 @@ void __init s3c64xx_spi1_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
 	pd.num_cs = num_cs;
 	pd.src_clk_nr = src_clk_nr;
 	pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi1_cfg_gpio;
+#ifdef CONFIG_PL330_DMA
+	pd.filter = pl330_filter;
+#endif
 
 	s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi1);
 }
@@ -1627,6 +1634,9 @@ void __init s3c64xx_spi2_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
 	pd.num_cs = num_cs;
 	pd.src_clk_nr = src_clk_nr;
 	pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi2_cfg_gpio;
+#ifdef CONFIG_PL330_DMA
+	pd.filter = pl330_filter;
+#endif
 
 	s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi2);
 }
diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index e862ab8..9be07a6 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -22,8 +22,10 @@
 #include <linux/workqueue.h>
 #include <linux/interrupt.h>
 #include <linux/delay.h>
+#include <linux/amba/pl330.h>
 #include <linux/clk.h>
 #include <linux/dma-mapping.h>
+#include <linux/dmaengine.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
 #include <linux/spi/spi.h>
@@ -31,7 +33,6 @@
 #include <linux/of.h>
 #include <linux/of_gpio.h>
 
-#include <mach/dma.h>
 #include <linux/platform_data/spi-s3c64xx.h>
 
 #define MAX_SPI_PORTS		3
@@ -131,9 +132,9 @@
 #define TXBUSY    (1<<3)
 
 struct s3c64xx_spi_dma_data {
-	unsigned		ch;
+	struct dma_chan *ch;
 	enum dma_transfer_direction direction;
-	enum dma_ch	dmach;
+	unsigned int request;
 };
 
 /**
@@ -195,16 +196,11 @@ struct s3c64xx_spi_driver_data {
 	unsigned                        cur_speed;
 	struct s3c64xx_spi_dma_data	rx_dma;
 	struct s3c64xx_spi_dma_data	tx_dma;
-	struct samsung_dma_ops		*ops;
 	struct s3c64xx_spi_port_config	*port_conf;
 	unsigned int			port_id;
 	unsigned long			gpios[4];
 };
 
-static struct s3c2410_dma_client s3c64xx_spi_dma_client = {
-	.name = "samsung-spi-dma",
-};
-
 static void flush_fifo(struct s3c64xx_spi_driver_data *sdd)
 {
 	void __iomem *regs = sdd->regs;
@@ -285,50 +281,42 @@ static void prepare_dma(struct s3c64xx_spi_dma_data *dma,
 					unsigned len, dma_addr_t buf)
 {
 	struct s3c64xx_spi_driver_data *sdd;
-	struct samsung_dma_prep info;
-	struct samsung_dma_config config;
+	struct dma_slave_config config;
+	struct scatterlist sg;
+	struct dma_async_tx_descriptor *desc;
 
 	if (dma->direction == DMA_DEV_TO_MEM) {
 		sdd = container_of((void *)dma,
 			struct s3c64xx_spi_driver_data, rx_dma);
-		config.direction = sdd->rx_dma.direction;
-		config.fifo = sdd->sfr_start + S3C64XX_SPI_RX_DATA;
-		config.width = sdd->cur_bpw / 8;
-		sdd->ops->config(sdd->rx_dma.ch, &config);
+		config.direction = dma->direction;
+		config.src_addr = sdd->sfr_start + S3C64XX_SPI_RX_DATA;
+		config.src_addr_width = sdd->cur_bpw / 8;
+		config.src_maxburst = 1;
+		dmaengine_slave_config(dma->ch, &config);
 	} else {
 		sdd = container_of((void *)dma,
 			struct s3c64xx_spi_driver_data, tx_dma);
-		config.direction =  sdd->tx_dma.direction;
-		config.fifo = sdd->sfr_start + S3C64XX_SPI_TX_DATA;
-		config.width = sdd->cur_bpw / 8;
-		sdd->ops->config(sdd->tx_dma.ch, &config);
+		config.direction = dma->direction;
+		config.dst_addr = sdd->sfr_start + S3C64XX_SPI_TX_DATA;
+		config.dst_addr_width = sdd->cur_bpw / 8;
+		config.dst_maxburst = 1;
+		dmaengine_slave_config(dma->ch, &config);
 	}
 
-	info.cap = DMA_SLAVE;
-	info.len = len;
-	info.fp = s3c64xx_spi_dmacb;
-	info.fp_param = dma;
-	info.direction = dma->direction;
-	info.buf = buf;
+	sg_init_table(&sg, 1);
+	sg_dma_len(&sg) = len;
+	sg_set_page(&sg, pfn_to_page(PFN_DOWN(buf)),
+		    len, offset_in_page(buf));
+	sg_dma_address(&sg) = buf;
 
-	sdd->ops->prepare(dma->ch, &info);
-	sdd->ops->trigger(dma->ch);
-}
+	desc = dmaengine_prep_slave_sg(dma->ch,
+		&sg, 1, dma->direction, DMA_PREP_INTERRUPT);
 
-static int acquire_dma(struct s3c64xx_spi_driver_data *sdd)
-{
-	struct samsung_dma_req req;
-	struct device *dev = &sdd->pdev->dev;
+	desc->callback = s3c64xx_spi_dmacb;
+	desc->callback_param = dma;
 
-	sdd->ops = samsung_dma_get_ops();
-
-	req.cap = DMA_SLAVE;
-	req.client = &s3c64xx_spi_dma_client;
-
-	sdd->rx_dma.ch = sdd->ops->request(sdd->rx_dma.dmach, &req, dev, "rx");
-	sdd->tx_dma.ch = sdd->ops->request(sdd->tx_dma.dmach, &req, dev, "tx");
-
-	return 1;
+	dmaengine_submit(desc);
+	dma_async_issue_pending(dma->ch);
 }
 
 static void enable_datapath(struct s3c64xx_spi_driver_data *sdd,
@@ -713,9 +701,9 @@ static int s3c64xx_spi_transfer_one_message(struct spi_master *master,
 		}
 
 		/* Polling method for xfers not bigger than FIFO capacity */
-		if (xfer->len <= ((FIFO_LVL_MASK(sdd) >> 1) + 1))
-			use_dma = 0;
-		else
+		use_dma = 0;
+		if (sdd->rx_dma.ch && sdd->tx_dma.ch &&
+		    (xfer->len > ((FIFO_LVL_MASK(sdd) >> 1) + 1)))
 			use_dma = 1;
 
 		spin_lock_irqsave(&sdd->lock, flags);
@@ -750,10 +738,10 @@ static int s3c64xx_spi_transfer_one_message(struct spi_master *master,
 			if (use_dma) {
 				if (xfer->tx_buf != NULL
 						&& (sdd->state & TXBUSY))
-					sdd->ops->stop(sdd->tx_dma.ch);
+					dmaengine_terminate_all(sdd->tx_dma.ch);
 				if (xfer->rx_buf != NULL
 						&& (sdd->state & RXBUSY))
-					sdd->ops->stop(sdd->rx_dma.ch);
+					dmaengine_terminate_all(sdd->rx_dma.ch);
 			}
 
 			goto out;
@@ -793,11 +781,18 @@ out:
 static int s3c64xx_spi_prepare_transfer(struct spi_master *spi)
 {
 	struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(spi);
+	dma_filter_fn filter = sdd->cntrlr_info->filter;
+	struct device *dev = &sdd->pdev->dev;
+	dma_cap_mask_t mask;
 
-	/* Acquire DMA channels */
-	while (!acquire_dma(sdd))
-		usleep_range(10000, 11000);
+	dma_cap_zero(mask);
+	dma_cap_set(DMA_SLAVE, mask);
 
+	/* Acquire DMA channels */
+	sdd->rx_dma.ch = dma_request_slave_channel_compat(mask, filter,
+				(void*)sdd->rx_dma.request, dev, "rx");
+	sdd->tx_dma.ch = dma_request_slave_channel_compat(mask, filter,
+				(void*)sdd->tx_dma.request, dev, "tx");
 	pm_runtime_get_sync(&sdd->pdev->dev);
 
 	return 0;
@@ -808,11 +803,10 @@ static int s3c64xx_spi_unprepare_transfer(struct spi_master *spi)
 	struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(spi);
 
 	/* Free DMA channels */
-	sdd->ops->release(sdd->rx_dma.ch, &s3c64xx_spi_dma_client);
-	sdd->ops->release(sdd->tx_dma.ch, &s3c64xx_spi_dma_client);
+	dma_release_channel(sdd->rx_dma.ch);
+	dma_release_channel(sdd->tx_dma.ch);
 
 	pm_runtime_put(&sdd->pdev->dev);
-
 	return 0;
 }
 
@@ -1149,7 +1143,6 @@ static inline struct s3c64xx_spi_port_config *s3c64xx_spi_get_port_config(
 static int s3c64xx_spi_probe(struct platform_device *pdev)
 {
 	struct resource	*mem_res;
-	struct resource	*res;
 	struct s3c64xx_spi_driver_data *sdd;
 	struct s3c64xx_spi_info *sci = pdev->dev.platform_data;
 	struct spi_master *master;
@@ -1207,15 +1200,15 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
 	}
 
 	sdd->cur_bpw = 8;
-
 	if (!sdd->pdev->dev.of_node) {
+		struct resource	*res;
 		res = platform_get_resource(pdev, IORESOURCE_DMA,  0);
 		if (!res) {
 			dev_err(&pdev->dev, "Unable to get SPI tx dma "
 					"resource\n");
 			return -ENXIO;
 		}
-		sdd->tx_dma.dmach = res->start;
+		sdd->tx_dma.request = res->start;
 
 		res = platform_get_resource(pdev, IORESOURCE_DMA,  1);
 		if (!res) {
@@ -1223,12 +1216,11 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
 					"resource\n");
 			return -ENXIO;
 		}
-		sdd->rx_dma.dmach = res->start;
+		sdd->rx_dma.request = res->start;
 	}
 
 	sdd->tx_dma.direction = DMA_MEM_TO_DEV;
 	sdd->rx_dma.direction = DMA_DEV_TO_MEM;
-
 	master->dev.of_node = pdev->dev.of_node;
 	master->bus_num = sdd->port_id;
 	master->setup = s3c64xx_spi_setup;
@@ -1314,8 +1306,7 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
 					sdd->port_id, master->num_chipselect);
 	dev_dbg(&pdev->dev, "\tIOmem=[0x%x-0x%x]\tDMA=[Rx-%d, Tx-%d]\n",
 					mem_res->end, mem_res->start,
-					sdd->rx_dma.dmach, sdd->tx_dma.dmach);
-
+					sdd->rx_dma.request, sdd->tx_dma.request);
 	pm_runtime_enable(&pdev->dev);
 
 	return 0;
diff --git a/include/linux/platform_data/spi-s3c64xx.h b/include/linux/platform_data/spi-s3c64xx.h
index ceba18d..8447f63 100644
--- a/include/linux/platform_data/spi-s3c64xx.h
+++ b/include/linux/platform_data/spi-s3c64xx.h
@@ -11,6 +11,8 @@
 #ifndef __S3C64XX_PLAT_SPI_H
 #define __S3C64XX_PLAT_SPI_H
 
+#include <linux/dmaengine.h>
+
 struct platform_device;
 
 /**
@@ -38,6 +40,7 @@ struct s3c64xx_spi_info {
 	int src_clk_nr;
 	int num_cs;
 	int (*cfg_gpio)(void);
+	dma_filter_fn filter;
 };
 
 /**
-- 
1.8.1.2

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

* [PATCH 16/23] pwm: samsung: repair the worst MMIO abuses
  2013-03-05 17:42 [PATCH 00/23] RFC: exynos multiplatform support Arnd Bergmann
                   ` (14 preceding siblings ...)
  2013-03-05 17:42 ` [PATCH 15/23] spi: s3c64xx: move to generic dmaengine API Arnd Bergmann
@ 2013-03-05 17:42 ` Arnd Bergmann
  2013-03-05 17:42 ` [PATCH 17/23] ASoC: samsung: move plat/ headers to local directory Arnd Bergmann
                   ` (9 subsequent siblings)
  25 siblings, 0 replies; 49+ messages in thread
From: Arnd Bergmann @ 2013-03-05 17:42 UTC (permalink / raw)
  To: linux-arm-kernel

The Samsung PWM driver uses "magic" pointers that are mapped
at boot time to point its MMIO registers. This fails horribly
with a multiplatform kernel, which can not rely on platform
specific header files to contain the right values, aside from
this being a really bad idea in general.

This changes the driver to at least pass an __iomem token
around in the device structure to dereference that. Fixing
the platform code is much harder, so we'll leave that
until we have a DT binding for pwm-samsung, which may require
other changes in this area. Since we are already touching
every MMIO accessor in this driver, let's also use the
proper readl_relaxed variant rather than __raw_readl.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/pwm/pwm-samsung.c | 60 +++++++++++++++++++++++++++++++++--------------
 1 file changed, 42 insertions(+), 18 deletions(-)

diff --git a/drivers/pwm/pwm-samsung.c b/drivers/pwm/pwm-samsung.c
index 5207e6c..9d7234d 100644
--- a/drivers/pwm/pwm-samsung.c
+++ b/drivers/pwm/pwm-samsung.c
@@ -22,9 +22,25 @@
 #include <linux/io.h>
 #include <linux/pwm.h>
 
-#include <mach/map.h>
+#ifndef CONFIG_ARCH_MULTIPLATFORM
+/*
+ * This is gross: the platform maps the timer at a fixed
+ * virtual address and expects us to use that address
+ * rather than a proper resource. This should get done properly
+ * when we get a DT binding for this driver.
+ */
+#include <plat/map-base.h>
+static inline void dummy(void)
+{
+	BUILD_BUG_ON(S3C_VA_TIMER != IOMEM(0xf6300000));
+}
+#else
+#define S3C_VA_TIMER IOMEM(0xf6300000);
+#endif
 
-#include <plat/regs-timer.h>
+#define S3C2410_TCON		8
+#define S3C2410_TCNTB(tmr)	(0x0c + (tmr)*0x0c + 0x00)
+#define S3C2410_TCMPB(tmr)	(0x0c + (tmr)*0x0c + 0x04)
 
 struct s3c_chip {
 	struct platform_device	*pdev;
@@ -38,6 +54,7 @@ struct s3c_chip {
 
 	unsigned char		 tcon_base;
 	unsigned char		 pwm_id;
+	void __iomem		*base;
 	struct pwm_chip		 chip;
 };
 
@@ -65,9 +82,9 @@ static int s3c_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
 
 	local_irq_save(flags);
 
-	tcon = __raw_readl(S3C2410_TCON);
+	tcon = readl_relaxed(s3c->base + S3C2410_TCON);
 	tcon |= pwm_tcon_start(s3c);
-	__raw_writel(tcon, S3C2410_TCON);
+	writel_relaxed(tcon, s3c->base + S3C2410_TCON);
 
 	local_irq_restore(flags);
 
@@ -82,9 +99,9 @@ static void s3c_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm)
 
 	local_irq_save(flags);
 
-	tcon = __raw_readl(S3C2410_TCON);
+	tcon = readl_relaxed(s3c->base + S3C2410_TCON);
 	tcon &= ~pwm_tcon_start(s3c);
-	__raw_writel(tcon, S3C2410_TCON);
+	writel_relaxed(tcon, s3c->base + S3C2410_TCON);
 
 	local_irq_restore(flags);
 }
@@ -133,8 +150,8 @@ static int s3c_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
 	/* The TCMP and TCNT can be read without a lock, they're not
 	 * shared between the timers. */
 
-	tcmp = __raw_readl(S3C2410_TCMPB(s3c->pwm_id));
-	tcnt = __raw_readl(S3C2410_TCNTB(s3c->pwm_id));
+	tcmp = readl_relaxed(s3c->base + S3C2410_TCMPB(s3c->pwm_id));
+	tcnt = readl_relaxed(s3c->base + S3C2410_TCNTB(s3c->pwm_id));
 
 	period = NS_IN_HZ / period_ns;
 
@@ -177,16 +194,16 @@ static int s3c_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
 
 	local_irq_save(flags);
 
-	__raw_writel(tcmp, S3C2410_TCMPB(s3c->pwm_id));
-	__raw_writel(tcnt, S3C2410_TCNTB(s3c->pwm_id));
+	writel_relaxed(tcmp, s3c->base + S3C2410_TCMPB(s3c->pwm_id));
+	writel_relaxed(tcnt, s3c->base + S3C2410_TCNTB(s3c->pwm_id));
 
-	tcon = __raw_readl(S3C2410_TCON);
+	tcon = readl_relaxed(s3c->base + S3C2410_TCON);
 	tcon |= pwm_tcon_manulupdate(s3c);
 	tcon |= pwm_tcon_autoreload(s3c);
-	__raw_writel(tcon, S3C2410_TCON);
+	writel_relaxed(tcon, s3c->base + S3C2410_TCON);
 
 	tcon &= ~pwm_tcon_manulupdate(s3c);
-	__raw_writel(tcon, S3C2410_TCON);
+	writel_relaxed(tcon, s3c->base + S3C2410_TCON);
 
 	local_irq_restore(flags);
 
@@ -207,6 +224,7 @@ static int s3c_pwm_probe(struct platform_device *pdev)
 	unsigned long flags;
 	unsigned long tcon;
 	unsigned int id = pdev->id;
+	struct resource *res;
 	int ret;
 
 	if (id == 4) {
@@ -220,6 +238,12 @@ static int s3c_pwm_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 
+	/* try to get a proper base address, fall back to S3C_VA_TIMER */
+	s3c->base = S3C_VA_TIMER;
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (res)
+		s3c->base = devm_ioremap(dev, res->start, resource_size(res));
+
 	/* calculate base of control bits in TCON */
 	s3c->tcon_base = id == 0 ? 0 : (id * 4) + 4;
 	s3c->pwm_id = id;
@@ -245,9 +269,9 @@ static int s3c_pwm_probe(struct platform_device *pdev)
 
 	local_irq_save(flags);
 
-	tcon = __raw_readl(S3C2410_TCON);
+	tcon = readl_relaxed(s3c->base + S3C2410_TCON);
 	tcon |= pwm_tcon_invert(s3c);
-	__raw_writel(tcon, S3C2410_TCON);
+	writel_relaxed(tcon, s3c->base + S3C2410_TCON);
 
 	local_irq_restore(flags);
 
@@ -258,7 +282,7 @@ static int s3c_pwm_probe(struct platform_device *pdev)
 	}
 
 	pwm_dbg(s3c, "config bits %02x\n",
-		(__raw_readl(S3C2410_TCON) >> s3c->tcon_base) & 0x0f);
+		(readl_relaxed(s3c->base + S3C2410_TCON) >> s3c->tcon_base) & 0x0f);
 
 	dev_info(dev, "tin at %lu, tdiv at %lu, tin=%sclk, base %d\n",
 		 clk_get_rate(s3c->clk),
@@ -310,9 +334,9 @@ static int s3c_pwm_resume(struct platform_device *pdev)
 	unsigned long tcon;
 
 	/* Restore invertion */
-	tcon = __raw_readl(S3C2410_TCON);
+	tcon = readl_relaxed(s3c->base + S3C2410_TCON);
 	tcon |= pwm_tcon_invert(s3c);
-	__raw_writel(tcon, S3C2410_TCON);
+	writel_relaxed(tcon, s3c->base + S3C2410_TCON);
 
 	return 0;
 }
-- 
1.8.1.2

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

* [PATCH 17/23] ASoC: samsung: move plat/ headers to local directory
  2013-03-05 17:42 [PATCH 00/23] RFC: exynos multiplatform support Arnd Bergmann
                   ` (15 preceding siblings ...)
  2013-03-05 17:42 ` [PATCH 16/23] pwm: samsung: repair the worst MMIO abuses Arnd Bergmann
@ 2013-03-05 17:42 ` Arnd Bergmann
  2013-03-05 17:42 ` [PATCH 18/23] ASoC: samsung: convert to dmaengine API Arnd Bergmann
                   ` (8 subsequent siblings)
  25 siblings, 0 replies; 49+ messages in thread
From: Arnd Bergmann @ 2013-03-05 17:42 UTC (permalink / raw)
  To: linux-arm-kernel

The plat/iis.h and plat/ac97.h files in the samsung platform are
only needed by the ASoC drivers, so they can be moved into the
same directory, as one more step towards a multiplatform build.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-s3c24xx/dma-s3c2410.c            |  2 -
 arch/arm/mach-s3c24xx/dma-s3c2412.c            |  2 -
 arch/arm/mach-s3c24xx/dma-s3c2440.c            |  2 -
 arch/arm/mach-s3c24xx/dma-s3c2443.c            |  2 -
 arch/arm/plat-samsung/include/plat/regs-ac97.h | 67 ------------------------
 arch/arm/plat-samsung/include/plat/regs-iis.h  | 70 --------------------------
 sound/soc/samsung/ac97.c                       |  2 +-
 sound/soc/samsung/h1940_uda1380.c              |  2 +-
 sound/soc/samsung/neo1973_wm8753.c             |  2 +-
 sound/soc/samsung/regs-ac97.h                  | 67 ++++++++++++++++++++++++
 sound/soc/samsung/regs-iis.h                   | 70 ++++++++++++++++++++++++++
 sound/soc/samsung/rx1950_uda1380.c             |  2 +-
 sound/soc/samsung/s3c24xx-i2s.c                |  2 +-
 sound/soc/samsung/s3c24xx_uda134x.c            |  2 +-
 14 files changed, 143 insertions(+), 151 deletions(-)
 delete mode 100644 arch/arm/plat-samsung/include/plat/regs-ac97.h
 delete mode 100644 arch/arm/plat-samsung/include/plat/regs-iis.h
 create mode 100644 sound/soc/samsung/regs-ac97.h
 create mode 100644 sound/soc/samsung/regs-iis.h

diff --git a/arch/arm/mach-s3c24xx/dma-s3c2410.c b/arch/arm/mach-s3c24xx/dma-s3c2410.c
index 25d085a..a4a13c9 100644
--- a/arch/arm/mach-s3c24xx/dma-s3c2410.c
+++ b/arch/arm/mach-s3c24xx/dma-s3c2410.c
@@ -25,11 +25,9 @@
 
 #include <plat/regs-serial.h>
 #include <mach/regs-gpio.h>
-#include <plat/regs-ac97.h>
 #include <plat/regs-dma.h>
 #include <mach/regs-lcd.h>
 #include <mach/regs-sdi.h>
-#include <plat/regs-iis.h>
 #include <plat/regs-spi.h>
 
 static struct s3c24xx_dma_map __initdata s3c2410_dma_mappings[] = {
diff --git a/arch/arm/mach-s3c24xx/dma-s3c2412.c b/arch/arm/mach-s3c24xx/dma-s3c2412.c
index d2408ba..6eaa7a4 100644
--- a/arch/arm/mach-s3c24xx/dma-s3c2412.c
+++ b/arch/arm/mach-s3c24xx/dma-s3c2412.c
@@ -25,11 +25,9 @@
 
 #include <plat/regs-serial.h>
 #include <mach/regs-gpio.h>
-#include <plat/regs-ac97.h>
 #include <plat/regs-dma.h>
 #include <mach/regs-lcd.h>
 #include <mach/regs-sdi.h>
-#include <plat/regs-iis.h>
 #include <plat/regs-spi.h>
 
 #define MAP(x) { (x)| DMA_CH_VALID, (x)| DMA_CH_VALID, (x)| DMA_CH_VALID, (x)| DMA_CH_VALID }
diff --git a/arch/arm/mach-s3c24xx/dma-s3c2440.c b/arch/arm/mach-s3c24xx/dma-s3c2440.c
index 0b86e74..477d450 100644
--- a/arch/arm/mach-s3c24xx/dma-s3c2440.c
+++ b/arch/arm/mach-s3c24xx/dma-s3c2440.c
@@ -25,11 +25,9 @@
 
 #include <plat/regs-serial.h>
 #include <mach/regs-gpio.h>
-#include <plat/regs-ac97.h>
 #include <plat/regs-dma.h>
 #include <mach/regs-lcd.h>
 #include <mach/regs-sdi.h>
-#include <plat/regs-iis.h>
 #include <plat/regs-spi.h>
 
 static struct s3c24xx_dma_map __initdata s3c2440_dma_mappings[] = {
diff --git a/arch/arm/mach-s3c24xx/dma-s3c2443.c b/arch/arm/mach-s3c24xx/dma-s3c2443.c
index 0553625..80a8d56 100644
--- a/arch/arm/mach-s3c24xx/dma-s3c2443.c
+++ b/arch/arm/mach-s3c24xx/dma-s3c2443.c
@@ -25,11 +25,9 @@
 
 #include <plat/regs-serial.h>
 #include <mach/regs-gpio.h>
-#include <plat/regs-ac97.h>
 #include <plat/regs-dma.h>
 #include <mach/regs-lcd.h>
 #include <mach/regs-sdi.h>
-#include <plat/regs-iis.h>
 #include <plat/regs-spi.h>
 
 #define MAP(x) { \
diff --git a/arch/arm/plat-samsung/include/plat/regs-ac97.h b/arch/arm/plat-samsung/include/plat/regs-ac97.h
deleted file mode 100644
index c3878f7..0000000
--- a/arch/arm/plat-samsung/include/plat/regs-ac97.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* arch/arm/mach-s3c2410/include/mach/regs-ac97.h
- *
- * Copyright (c) 2006 Simtec Electronics <linux@simtec.co.uk>
- *		http://www.simtec.co.uk/products/SWLINUX/
- *
- * 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.
- *
- * S3C2440 AC97 Controller
-*/
-
-#ifndef __ASM_ARCH_REGS_AC97_H
-#define __ASM_ARCH_REGS_AC97_H __FILE__
-
-#define S3C_AC97_GLBCTRL				(0x00)
-
-#define S3C_AC97_GLBCTRL_CODECREADYIE			(1<<22)
-#define S3C_AC97_GLBCTRL_PCMOUTURIE			(1<<21)
-#define S3C_AC97_GLBCTRL_PCMINORIE			(1<<20)
-#define S3C_AC97_GLBCTRL_MICINORIE			(1<<19)
-#define S3C_AC97_GLBCTRL_PCMOUTTIE			(1<<18)
-#define S3C_AC97_GLBCTRL_PCMINTIE			(1<<17)
-#define S3C_AC97_GLBCTRL_MICINTIE			(1<<16)
-#define S3C_AC97_GLBCTRL_PCMOUTTM_OFF			(0<<12)
-#define S3C_AC97_GLBCTRL_PCMOUTTM_PIO			(1<<12)
-#define S3C_AC97_GLBCTRL_PCMOUTTM_DMA			(2<<12)
-#define S3C_AC97_GLBCTRL_PCMOUTTM_MASK			(3<<12)
-#define S3C_AC97_GLBCTRL_PCMINTM_OFF			(0<<10)
-#define S3C_AC97_GLBCTRL_PCMINTM_PIO			(1<<10)
-#define S3C_AC97_GLBCTRL_PCMINTM_DMA			(2<<10)
-#define S3C_AC97_GLBCTRL_PCMINTM_MASK			(3<<10)
-#define S3C_AC97_GLBCTRL_MICINTM_OFF			(0<<8)
-#define S3C_AC97_GLBCTRL_MICINTM_PIO			(1<<8)
-#define S3C_AC97_GLBCTRL_MICINTM_DMA			(2<<8)
-#define S3C_AC97_GLBCTRL_MICINTM_MASK			(3<<8)
-#define S3C_AC97_GLBCTRL_TRANSFERDATAENABLE		(1<<3)
-#define S3C_AC97_GLBCTRL_ACLINKON			(1<<2)
-#define S3C_AC97_GLBCTRL_WARMRESET			(1<<1)
-#define S3C_AC97_GLBCTRL_COLDRESET			(1<<0)
-
-#define S3C_AC97_GLBSTAT				(0x04)
-
-#define S3C_AC97_GLBSTAT_CODECREADY			(1<<22)
-#define S3C_AC97_GLBSTAT_PCMOUTUR			(1<<21)
-#define S3C_AC97_GLBSTAT_PCMINORI			(1<<20)
-#define S3C_AC97_GLBSTAT_MICINORI			(1<<19)
-#define S3C_AC97_GLBSTAT_PCMOUTTI			(1<<18)
-#define S3C_AC97_GLBSTAT_PCMINTI			(1<<17)
-#define S3C_AC97_GLBSTAT_MICINTI			(1<<16)
-#define S3C_AC97_GLBSTAT_MAINSTATE_IDLE			(0<<0)
-#define S3C_AC97_GLBSTAT_MAINSTATE_INIT			(1<<0)
-#define S3C_AC97_GLBSTAT_MAINSTATE_READY		(2<<0)
-#define S3C_AC97_GLBSTAT_MAINSTATE_ACTIVE		(3<<0)
-#define S3C_AC97_GLBSTAT_MAINSTATE_LP			(4<<0)
-#define S3C_AC97_GLBSTAT_MAINSTATE_WARM			(5<<0)
-
-#define S3C_AC97_CODEC_CMD				(0x08)
-
-#define S3C_AC97_CODEC_CMD_READ				(1<<23)
-
-#define S3C_AC97_STAT					(0x0c)
-#define S3C_AC97_PCM_ADDR				(0x10)
-#define S3C_AC97_PCM_DATA				(0x18)
-#define S3C_AC97_MIC_DATA				(0x1C)
-
-#endif /* __ASM_ARCH_REGS_AC97_H */
diff --git a/arch/arm/plat-samsung/include/plat/regs-iis.h b/arch/arm/plat-samsung/include/plat/regs-iis.h
deleted file mode 100644
index a18d35e..0000000
--- a/arch/arm/plat-samsung/include/plat/regs-iis.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* arch/arm/plat-samsung/include/plat/regs-iis.h
- *
- * Copyright (c) 2003 Simtec Electronics <linux@simtec.co.uk>
- *		      http://www.simtec.co.uk/products/SWLINUX/
- *
- * 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.
- *
- * S3C2410 IIS register definition
-*/
-
-#ifndef __ASM_ARCH_REGS_IIS_H
-#define __ASM_ARCH_REGS_IIS_H
-
-#define S3C2410_IISCON			(0x00)
-
-#define S3C2410_IISCON_LRINDEX		(1 << 8)
-#define S3C2410_IISCON_TXFIFORDY	(1 << 7)
-#define S3C2410_IISCON_RXFIFORDY	(1 << 6)
-#define S3C2410_IISCON_TXDMAEN		(1 << 5)
-#define S3C2410_IISCON_RXDMAEN		(1 << 4)
-#define S3C2410_IISCON_TXIDLE		(1 << 3)
-#define S3C2410_IISCON_RXIDLE		(1 << 2)
-#define S3C2410_IISCON_PSCEN		(1 << 1)
-#define S3C2410_IISCON_IISEN		(1 << 0)
-
-#define S3C2410_IISMOD			(0x04)
-
-#define S3C2440_IISMOD_MPLL		(1 << 9)
-#define S3C2410_IISMOD_SLAVE		(1 << 8)
-#define S3C2410_IISMOD_NOXFER		(0 << 6)
-#define S3C2410_IISMOD_RXMODE		(1 << 6)
-#define S3C2410_IISMOD_TXMODE		(2 << 6)
-#define S3C2410_IISMOD_TXRXMODE		(3 << 6)
-#define S3C2410_IISMOD_LR_LLOW		(0 << 5)
-#define S3C2410_IISMOD_LR_RLOW		(1 << 5)
-#define S3C2410_IISMOD_IIS		(0 << 4)
-#define S3C2410_IISMOD_MSB		(1 << 4)
-#define S3C2410_IISMOD_8BIT		(0 << 3)
-#define S3C2410_IISMOD_16BIT		(1 << 3)
-#define S3C2410_IISMOD_BITMASK		(1 << 3)
-#define S3C2410_IISMOD_256FS		(0 << 2)
-#define S3C2410_IISMOD_384FS		(1 << 2)
-#define S3C2410_IISMOD_16FS		(0 << 0)
-#define S3C2410_IISMOD_32FS		(1 << 0)
-#define S3C2410_IISMOD_48FS		(2 << 0)
-#define S3C2410_IISMOD_FS_MASK		(3 << 0)
-
-#define S3C2410_IISPSR			(0x08)
-
-#define S3C2410_IISPSR_INTMASK		(31 << 5)
-#define S3C2410_IISPSR_INTSHIFT		(5)
-#define S3C2410_IISPSR_EXTMASK		(31 << 0)
-#define S3C2410_IISPSR_EXTSHFIT		(0)
-
-#define S3C2410_IISFCON			(0x0c)
-
-#define S3C2410_IISFCON_TXDMA		(1 << 15)
-#define S3C2410_IISFCON_RXDMA		(1 << 14)
-#define S3C2410_IISFCON_TXENABLE	(1 << 13)
-#define S3C2410_IISFCON_RXENABLE	(1 << 12)
-#define S3C2410_IISFCON_TXMASK		(0x3f << 6)
-#define S3C2410_IISFCON_TXSHIFT		(6)
-#define S3C2410_IISFCON_RXMASK		(0x3f)
-#define S3C2410_IISFCON_RXSHIFT		(0)
-
-#define S3C2410_IISFIFO			(0x10)
-
-#endif /* __ASM_ARCH_REGS_IIS_H */
diff --git a/sound/soc/samsung/ac97.c b/sound/soc/samsung/ac97.c
index 0df3c56..c76abdf 100644
--- a/sound/soc/samsung/ac97.c
+++ b/sound/soc/samsung/ac97.c
@@ -20,7 +20,7 @@
 #include <sound/soc.h>
 
 #include <mach/dma.h>
-#include <plat/regs-ac97.h>
+#include "regs-ac97.h"
 #include <linux/platform_data/asoc-s3c.h>
 
 #include "dma.h"
diff --git a/sound/soc/samsung/h1940_uda1380.c b/sound/soc/samsung/h1940_uda1380.c
index 15a3817..fa91376 100644
--- a/sound/soc/samsung/h1940_uda1380.c
+++ b/sound/soc/samsung/h1940_uda1380.c
@@ -20,7 +20,7 @@
 #include <sound/soc.h>
 #include <sound/jack.h>
 
-#include <plat/regs-iis.h>
+#include "regs-iis.h"
 #include <asm/mach-types.h>
 
 #include "s3c24xx-i2s.h"
diff --git a/sound/soc/samsung/neo1973_wm8753.c b/sound/soc/samsung/neo1973_wm8753.c
index a301d8c..ccc601d 100644
--- a/sound/soc/samsung/neo1973_wm8753.c
+++ b/sound/soc/samsung/neo1973_wm8753.c
@@ -21,7 +21,7 @@
 #include <sound/soc.h>
 
 #include <asm/mach-types.h>
-#include <plat/regs-iis.h>
+#include "regs-iis.h"
 #include <mach/gta02.h>
 
 #include "../codecs/wm8753.h"
diff --git a/sound/soc/samsung/regs-ac97.h b/sound/soc/samsung/regs-ac97.h
new file mode 100644
index 0000000..c3878f7
--- /dev/null
+++ b/sound/soc/samsung/regs-ac97.h
@@ -0,0 +1,67 @@
+/* arch/arm/mach-s3c2410/include/mach/regs-ac97.h
+ *
+ * Copyright (c) 2006 Simtec Electronics <linux@simtec.co.uk>
+ *		http://www.simtec.co.uk/products/SWLINUX/
+ *
+ * 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.
+ *
+ * S3C2440 AC97 Controller
+*/
+
+#ifndef __ASM_ARCH_REGS_AC97_H
+#define __ASM_ARCH_REGS_AC97_H __FILE__
+
+#define S3C_AC97_GLBCTRL				(0x00)
+
+#define S3C_AC97_GLBCTRL_CODECREADYIE			(1<<22)
+#define S3C_AC97_GLBCTRL_PCMOUTURIE			(1<<21)
+#define S3C_AC97_GLBCTRL_PCMINORIE			(1<<20)
+#define S3C_AC97_GLBCTRL_MICINORIE			(1<<19)
+#define S3C_AC97_GLBCTRL_PCMOUTTIE			(1<<18)
+#define S3C_AC97_GLBCTRL_PCMINTIE			(1<<17)
+#define S3C_AC97_GLBCTRL_MICINTIE			(1<<16)
+#define S3C_AC97_GLBCTRL_PCMOUTTM_OFF			(0<<12)
+#define S3C_AC97_GLBCTRL_PCMOUTTM_PIO			(1<<12)
+#define S3C_AC97_GLBCTRL_PCMOUTTM_DMA			(2<<12)
+#define S3C_AC97_GLBCTRL_PCMOUTTM_MASK			(3<<12)
+#define S3C_AC97_GLBCTRL_PCMINTM_OFF			(0<<10)
+#define S3C_AC97_GLBCTRL_PCMINTM_PIO			(1<<10)
+#define S3C_AC97_GLBCTRL_PCMINTM_DMA			(2<<10)
+#define S3C_AC97_GLBCTRL_PCMINTM_MASK			(3<<10)
+#define S3C_AC97_GLBCTRL_MICINTM_OFF			(0<<8)
+#define S3C_AC97_GLBCTRL_MICINTM_PIO			(1<<8)
+#define S3C_AC97_GLBCTRL_MICINTM_DMA			(2<<8)
+#define S3C_AC97_GLBCTRL_MICINTM_MASK			(3<<8)
+#define S3C_AC97_GLBCTRL_TRANSFERDATAENABLE		(1<<3)
+#define S3C_AC97_GLBCTRL_ACLINKON			(1<<2)
+#define S3C_AC97_GLBCTRL_WARMRESET			(1<<1)
+#define S3C_AC97_GLBCTRL_COLDRESET			(1<<0)
+
+#define S3C_AC97_GLBSTAT				(0x04)
+
+#define S3C_AC97_GLBSTAT_CODECREADY			(1<<22)
+#define S3C_AC97_GLBSTAT_PCMOUTUR			(1<<21)
+#define S3C_AC97_GLBSTAT_PCMINORI			(1<<20)
+#define S3C_AC97_GLBSTAT_MICINORI			(1<<19)
+#define S3C_AC97_GLBSTAT_PCMOUTTI			(1<<18)
+#define S3C_AC97_GLBSTAT_PCMINTI			(1<<17)
+#define S3C_AC97_GLBSTAT_MICINTI			(1<<16)
+#define S3C_AC97_GLBSTAT_MAINSTATE_IDLE			(0<<0)
+#define S3C_AC97_GLBSTAT_MAINSTATE_INIT			(1<<0)
+#define S3C_AC97_GLBSTAT_MAINSTATE_READY		(2<<0)
+#define S3C_AC97_GLBSTAT_MAINSTATE_ACTIVE		(3<<0)
+#define S3C_AC97_GLBSTAT_MAINSTATE_LP			(4<<0)
+#define S3C_AC97_GLBSTAT_MAINSTATE_WARM			(5<<0)
+
+#define S3C_AC97_CODEC_CMD				(0x08)
+
+#define S3C_AC97_CODEC_CMD_READ				(1<<23)
+
+#define S3C_AC97_STAT					(0x0c)
+#define S3C_AC97_PCM_ADDR				(0x10)
+#define S3C_AC97_PCM_DATA				(0x18)
+#define S3C_AC97_MIC_DATA				(0x1C)
+
+#endif /* __ASM_ARCH_REGS_AC97_H */
diff --git a/sound/soc/samsung/regs-iis.h b/sound/soc/samsung/regs-iis.h
new file mode 100644
index 0000000..a18d35e
--- /dev/null
+++ b/sound/soc/samsung/regs-iis.h
@@ -0,0 +1,70 @@
+/* arch/arm/plat-samsung/include/plat/regs-iis.h
+ *
+ * Copyright (c) 2003 Simtec Electronics <linux@simtec.co.uk>
+ *		      http://www.simtec.co.uk/products/SWLINUX/
+ *
+ * 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.
+ *
+ * S3C2410 IIS register definition
+*/
+
+#ifndef __ASM_ARCH_REGS_IIS_H
+#define __ASM_ARCH_REGS_IIS_H
+
+#define S3C2410_IISCON			(0x00)
+
+#define S3C2410_IISCON_LRINDEX		(1 << 8)
+#define S3C2410_IISCON_TXFIFORDY	(1 << 7)
+#define S3C2410_IISCON_RXFIFORDY	(1 << 6)
+#define S3C2410_IISCON_TXDMAEN		(1 << 5)
+#define S3C2410_IISCON_RXDMAEN		(1 << 4)
+#define S3C2410_IISCON_TXIDLE		(1 << 3)
+#define S3C2410_IISCON_RXIDLE		(1 << 2)
+#define S3C2410_IISCON_PSCEN		(1 << 1)
+#define S3C2410_IISCON_IISEN		(1 << 0)
+
+#define S3C2410_IISMOD			(0x04)
+
+#define S3C2440_IISMOD_MPLL		(1 << 9)
+#define S3C2410_IISMOD_SLAVE		(1 << 8)
+#define S3C2410_IISMOD_NOXFER		(0 << 6)
+#define S3C2410_IISMOD_RXMODE		(1 << 6)
+#define S3C2410_IISMOD_TXMODE		(2 << 6)
+#define S3C2410_IISMOD_TXRXMODE		(3 << 6)
+#define S3C2410_IISMOD_LR_LLOW		(0 << 5)
+#define S3C2410_IISMOD_LR_RLOW		(1 << 5)
+#define S3C2410_IISMOD_IIS		(0 << 4)
+#define S3C2410_IISMOD_MSB		(1 << 4)
+#define S3C2410_IISMOD_8BIT		(0 << 3)
+#define S3C2410_IISMOD_16BIT		(1 << 3)
+#define S3C2410_IISMOD_BITMASK		(1 << 3)
+#define S3C2410_IISMOD_256FS		(0 << 2)
+#define S3C2410_IISMOD_384FS		(1 << 2)
+#define S3C2410_IISMOD_16FS		(0 << 0)
+#define S3C2410_IISMOD_32FS		(1 << 0)
+#define S3C2410_IISMOD_48FS		(2 << 0)
+#define S3C2410_IISMOD_FS_MASK		(3 << 0)
+
+#define S3C2410_IISPSR			(0x08)
+
+#define S3C2410_IISPSR_INTMASK		(31 << 5)
+#define S3C2410_IISPSR_INTSHIFT		(5)
+#define S3C2410_IISPSR_EXTMASK		(31 << 0)
+#define S3C2410_IISPSR_EXTSHFIT		(0)
+
+#define S3C2410_IISFCON			(0x0c)
+
+#define S3C2410_IISFCON_TXDMA		(1 << 15)
+#define S3C2410_IISFCON_RXDMA		(1 << 14)
+#define S3C2410_IISFCON_TXENABLE	(1 << 13)
+#define S3C2410_IISFCON_RXENABLE	(1 << 12)
+#define S3C2410_IISFCON_TXMASK		(0x3f << 6)
+#define S3C2410_IISFCON_TXSHIFT		(6)
+#define S3C2410_IISFCON_RXMASK		(0x3f)
+#define S3C2410_IISFCON_RXSHIFT		(0)
+
+#define S3C2410_IISFIFO			(0x10)
+
+#endif /* __ASM_ARCH_REGS_IIS_H */
diff --git a/sound/soc/samsung/rx1950_uda1380.c b/sound/soc/samsung/rx1950_uda1380.c
index a5826ea..704460a 100644
--- a/sound/soc/samsung/rx1950_uda1380.c
+++ b/sound/soc/samsung/rx1950_uda1380.c
@@ -24,7 +24,7 @@
 #include <sound/soc.h>
 #include <sound/jack.h>
 
-#include <plat/regs-iis.h>
+#include "regs-iis.h"
 #include <asm/mach-types.h>
 
 #include "s3c24xx-i2s.h"
diff --git a/sound/soc/samsung/s3c24xx-i2s.c b/sound/soc/samsung/s3c24xx-i2s.c
index 13f6dd1..a7b17c1 100644
--- a/sound/soc/samsung/s3c24xx-i2s.c
+++ b/sound/soc/samsung/s3c24xx-i2s.c
@@ -24,7 +24,7 @@
 #include <sound/pcm_params.h>
 
 #include <mach/dma.h>
-#include <plat/regs-iis.h>
+#include "regs-iis.h"
 
 #include "dma.h"
 #include "s3c24xx-i2s.h"
diff --git a/sound/soc/samsung/s3c24xx_uda134x.c b/sound/soc/samsung/s3c24xx_uda134x.c
index 333e1b7..1b7b52b 100644
--- a/sound/soc/samsung/s3c24xx_uda134x.c
+++ b/sound/soc/samsung/s3c24xx_uda134x.c
@@ -18,7 +18,7 @@
 #include <sound/soc.h>
 #include <sound/s3c24xx_uda134x.h>
 
-#include <plat/regs-iis.h>
+#include "regs-iis.h"
 
 #include "s3c24xx-i2s.h"
 
-- 
1.8.1.2

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

* [PATCH 18/23] ASoC: samsung: convert to dmaengine API
  2013-03-05 17:42 [PATCH 00/23] RFC: exynos multiplatform support Arnd Bergmann
                   ` (16 preceding siblings ...)
  2013-03-05 17:42 ` [PATCH 17/23] ASoC: samsung: move plat/ headers to local directory Arnd Bergmann
@ 2013-03-05 17:42 ` Arnd Bergmann
  2013-03-06  8:58   ` Padma Venkat
  2013-03-05 17:42 ` [PATCH 19/23] ASoC: samsung: use irq resource for idma Arnd Bergmann
                   ` (7 subsequent siblings)
  25 siblings, 1 reply; 49+ messages in thread
From: Arnd Bergmann @ 2013-03-05 17:42 UTC (permalink / raw)
  To: linux-arm-kernel

In order to build the exynos kernel with CONFIG_ARCH_MULTIPLATFORM,
we must convert all users of the Samsung private DMA interface to
the generic dmaengine API. This converts the sound/soc drivers,
breaking the older s3c platforms in the process, since they do not
support the dmaengine interface yet.

This patch must not get mainlined until mach-s3c* is also converted,
but can be used for testing in the meantime.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 sound/soc/samsung/ac97.c        |  15 ------
 sound/soc/samsung/dma.c         | 104 +++++++++++++++++++++-------------------
 sound/soc/samsung/dma.h         |   4 +-
 sound/soc/samsung/i2s.c         |   9 +---
 sound/soc/samsung/pcm.c         |  13 -----
 sound/soc/samsung/s3c2412-i2s.c |  10 ----
 sound/soc/samsung/s3c24xx-i2s.c |  10 ----
 sound/soc/samsung/spdif.c       |   6 ---
 8 files changed, 57 insertions(+), 114 deletions(-)

diff --git a/sound/soc/samsung/ac97.c b/sound/soc/samsung/ac97.c
index c76abdf..214f454 100644
--- a/sound/soc/samsung/ac97.c
+++ b/sound/soc/samsung/ac97.c
@@ -39,30 +39,15 @@ struct s3c_ac97_info {
 };
 static struct s3c_ac97_info s3c_ac97;
 
-static struct s3c2410_dma_client s3c_dma_client_out = {
-	.name = "AC97 PCMOut"
-};
-
-static struct s3c2410_dma_client s3c_dma_client_in = {
-	.name = "AC97 PCMIn"
-};
-
-static struct s3c2410_dma_client s3c_dma_client_micin = {
-	.name = "AC97 MicIn"
-};
-
 static struct s3c_dma_params s3c_ac97_pcm_out = {
-	.client		= &s3c_dma_client_out,
 	.dma_size	= 4,
 };
 
 static struct s3c_dma_params s3c_ac97_pcm_in = {
-	.client		= &s3c_dma_client_in,
 	.dma_size	= 4,
 };
 
 static struct s3c_dma_params s3c_ac97_mic_in = {
-	.client		= &s3c_dma_client_micin,
 	.dma_size	= 4,
 };
 
diff --git a/sound/soc/samsung/dma.c b/sound/soc/samsung/dma.c
index 21b7926..67b8dcc 100644
--- a/sound/soc/samsung/dma.c
+++ b/sound/soc/samsung/dma.c
@@ -16,14 +16,14 @@
 
 #include <linux/slab.h>
 #include <linux/dma-mapping.h>
+#include <linux/dmaengine.h>
 #include <linux/module.h>
+#include <linux/amba/pl330.h>
 
 #include <sound/soc.h>
 #include <sound/pcm_params.h>
 
 #include <asm/dma.h>
-#include <mach/hardware.h>
-#include <mach/dma.h>
 
 #include "dma.h"
 
@@ -67,12 +67,16 @@ static void audio_buffdone(void *data);
  * place a dma buffer onto the queue for the dma system
  * to handle.
  */
+
 static void dma_enqueue(struct snd_pcm_substream *substream)
 {
 	struct runtime_data *prtd = substream->runtime->private_data;
 	dma_addr_t pos = prtd->dma_pos;
+	unsigned long period = prtd->dma_period;
 	unsigned int limit;
-	struct samsung_dma_prep dma_info;
+	enum dma_transfer_direction direction;
+	struct dma_chan *chan = prtd->params->ch;
+	struct dma_async_tx_descriptor *desc;
 
 	pr_debug("Entered %s\n", __func__);
 
@@ -81,29 +85,30 @@ static void dma_enqueue(struct snd_pcm_substream *substream)
 	pr_debug("%s: loaded %d, limit %d\n",
 				__func__, prtd->dma_loaded, limit);
 
-	dma_info.cap = (samsung_dma_has_circular() ? DMA_CYCLIC : DMA_SLAVE);
-	dma_info.direction =
-		(substream->stream == SNDRV_PCM_STREAM_PLAYBACK
-		? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM);
-	dma_info.fp = audio_buffdone;
-	dma_info.fp_param = substream;
-	dma_info.period = prtd->dma_period;
-	dma_info.len = prtd->dma_period*limit;
+	direction = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK
+		     ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM);
 
 	while (prtd->dma_loaded < limit) {
 		pr_debug("dma_loaded: %d\n", prtd->dma_loaded);
 
-		if ((pos + dma_info.period) > prtd->dma_end) {
-			dma_info.period  = prtd->dma_end - pos;
+		if ((pos + period) > prtd->dma_end) {
+			period  = prtd->dma_end - pos;
 			pr_debug("%s: corrected dma len %ld\n",
-					__func__, dma_info.period);
+					__func__, period);
 		}
 
-		dma_info.buf = pos;
-		prtd->params->ops->prepare(prtd->params->ch, &dma_info);
+		desc = dmaengine_prep_dma_cyclic(chan, pos,
+			 prtd->dma_period*limit, period, direction,
+			DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
+
+		if (desc) {
+			desc->callback = audio_buffdone;
+			desc->callback_param = substream;
+			dmaengine_submit(desc);
+		}
 
 		prtd->dma_loaded++;
-		pos += prtd->dma_period;
+		pos += period;
 		if (pos >= prtd->dma_end)
 			pos = prtd->dma_start;
 	}
@@ -125,13 +130,6 @@ static void audio_buffdone(void *data)
 
 		if (substream)
 			snd_pcm_period_elapsed(substream);
-
-		spin_lock(&prtd->lock);
-		if (!samsung_dma_has_circular()) {
-			prtd->dma_loaded--;
-			dma_enqueue(substream);
-		}
-		spin_unlock(&prtd->lock);
 	}
 }
 
@@ -144,8 +142,6 @@ static int dma_hw_params(struct snd_pcm_substream *substream,
 	unsigned long totbytes = params_buffer_bytes(params);
 	struct s3c_dma_params *dma =
 		snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
-	struct samsung_dma_req req;
-	struct samsung_dma_config config;
 
 	pr_debug("Entered %s\n", __func__);
 
@@ -157,26 +153,37 @@ static int dma_hw_params(struct snd_pcm_substream *substream,
 	/* this may get called several times by oss emulation
 	 * with different params -HW */
 	if (prtd->params == NULL) {
+		struct dma_slave_config config;
+		dma_cap_mask_t mask;
+
 		/* prepare DMA */
 		prtd->params = dma;
 
-		pr_debug("params %p, client %p, channel %d\n", prtd->params,
-			prtd->params->client, prtd->params->channel);
-
-		prtd->params->ops = samsung_dma_get_ops();
-
-		req.cap = (samsung_dma_has_circular() ?
-			DMA_CYCLIC : DMA_SLAVE);
-		req.client = prtd->params->client;
-		config.direction =
-			(substream->stream == SNDRV_PCM_STREAM_PLAYBACK
-			? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM);
-		config.width = prtd->params->dma_size;
-		config.fifo = prtd->params->dma_addr;
-		prtd->params->ch = prtd->params->ops->request(
-				prtd->params->channel, &req, rtd->cpu_dai->dev,
-				prtd->params->ch_name);
-		prtd->params->ops->config(prtd->params->ch, &config);
+		pr_debug("params %p, channel %d\n", prtd->params,
+			 prtd->params->channel);
+
+		dma_cap_zero(mask);
+		dma_cap_set(DMA_CYCLIC, mask);
+
+		prtd->params->ch = dma_request_slave_channel_compat(mask,
+			pl330_filter, (void *)prtd->params->channel,
+			rtd->cpu_dai->dev, prtd->params->ch_name);
+
+		memset(&config, 0, sizeof(struct dma_slave_config));
+
+		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+			config.direction = DMA_MEM_TO_DEV;
+			config.dst_addr = prtd->params->dma_size;
+			config.dst_addr_width = prtd->params->dma_addr;
+			config.dst_maxburst = 1;
+			dmaengine_slave_config(prtd->params->ch, &config);
+		} else {
+			config.direction = DMA_DEV_TO_MEM;
+			config.src_addr = prtd->params->dma_addr;
+			config.src_addr_width = prtd->params->dma_size;
+			config.src_maxburst = 1;
+			dmaengine_slave_config(prtd->params->ch, &config);
+		}
 	}
 
 	snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
@@ -203,9 +210,8 @@ static int dma_hw_free(struct snd_pcm_substream *substream)
 	snd_pcm_set_runtime_buffer(substream, NULL);
 
 	if (prtd->params) {
-		prtd->params->ops->flush(prtd->params->ch);
-		prtd->params->ops->release(prtd->params->ch,
-					prtd->params->client);
+		dmaengine_terminate_all(prtd->params->ch);
+		dma_release_channel(prtd->params->ch);
 		prtd->params = NULL;
 	}
 
@@ -225,7 +231,7 @@ static int dma_prepare(struct snd_pcm_substream *substream)
 		return 0;
 
 	/* flush the DMA channel */
-	prtd->params->ops->flush(prtd->params->ch);
+	dmaengine_terminate_all(prtd->params->ch);
 
 	prtd->dma_loaded = 0;
 	prtd->dma_pos = prtd->dma_start;
@@ -248,12 +254,12 @@ static int dma_trigger(struct snd_pcm_substream *substream, int cmd)
 	switch (cmd) {
 	case SNDRV_PCM_TRIGGER_START:
 		prtd->state |= ST_RUNNING;
-		prtd->params->ops->trigger(prtd->params->ch);
+		dma_async_issue_pending(prtd->params->ch);
 		break;
 
 	case SNDRV_PCM_TRIGGER_STOP:
 		prtd->state &= ~ST_RUNNING;
-		prtd->params->ops->stop(prtd->params->ch);
+		dmaengine_terminate_all(prtd->params->ch);
 		break;
 
 	default:
diff --git a/sound/soc/samsung/dma.h b/sound/soc/samsung/dma.h
index 189a7a6..f7381be 100644
--- a/sound/soc/samsung/dma.h
+++ b/sound/soc/samsung/dma.h
@@ -13,12 +13,10 @@
 #define _S3C_AUDIO_H
 
 struct s3c_dma_params {
-	struct s3c2410_dma_client *client;	/* stream identifier */
 	int channel;				/* Channel ID */
 	dma_addr_t dma_addr;
 	int dma_size;			/* Size of the DMA transfer */
-	unsigned ch;
-	struct samsung_dma_ops *ops;
+	struct dma_chan *ch;
 	char *ch_name;
 };
 
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index d7231e3..2eed7a3 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -18,12 +18,11 @@
 #include <linux/of.h>
 #include <linux/of_gpio.h>
 #include <linux/pm_runtime.h>
+#include <linux/dmaengine.h>
 
 #include <sound/soc.h>
 #include <sound/pcm_params.h>
 
-#include <mach/dma.h>
-
 #include <linux/platform_data/asoc-s3c.h>
 
 #include "dma.h"
@@ -1183,11 +1182,7 @@ static int samsung_i2s_probe(struct platform_device *pdev)
 
 	pri_dai->dma_playback.dma_addr = regs_base + I2STXD;
 	pri_dai->dma_capture.dma_addr = regs_base + I2SRXD;
-	pri_dai->dma_playback.client =
-		(struct s3c2410_dma_client *)&pri_dai->dma_playback;
 	pri_dai->dma_playback.ch_name = "tx";
-	pri_dai->dma_capture.client =
-		(struct s3c2410_dma_client *)&pri_dai->dma_capture;
 	pri_dai->dma_capture.ch_name = "rx";
 	pri_dai->dma_playback.dma_size = 4;
 	pri_dai->dma_capture.dma_size = 4;
@@ -1205,8 +1200,6 @@ static int samsung_i2s_probe(struct platform_device *pdev)
 			goto err;
 		}
 		sec_dai->dma_playback.dma_addr = regs_base + I2STXDS;
-		sec_dai->dma_playback.client =
-			(struct s3c2410_dma_client *)&sec_dai->dma_playback;
 		sec_dai->dma_playback.ch_name = "tx-sec";
 
 		if (!np) {
diff --git a/sound/soc/samsung/pcm.c b/sound/soc/samsung/pcm.c
index 13bab79..525b2d2 100644
--- a/sound/soc/samsung/pcm.c
+++ b/sound/soc/samsung/pcm.c
@@ -20,7 +20,6 @@
 #include <sound/pcm_params.h>
 
 #include <linux/platform_data/asoc-s3c.h>
-#include <mach/dma.h>
 
 #include "dma.h"
 #include "pcm.h"
@@ -132,32 +131,20 @@ struct s3c_pcm_info {
 	struct s3c_dma_params	*dma_capture;
 };
 
-static struct s3c2410_dma_client s3c_pcm_dma_client_out = {
-	.name		= "PCM Stereo out"
-};
-
-static struct s3c2410_dma_client s3c_pcm_dma_client_in = {
-	.name		= "PCM Stereo in"
-};
-
 static struct s3c_dma_params s3c_pcm_stereo_out[] = {
 	[0] = {
-		.client		= &s3c_pcm_dma_client_out,
 		.dma_size	= 4,
 	},
 	[1] = {
-		.client		= &s3c_pcm_dma_client_out,
 		.dma_size	= 4,
 	},
 };
 
 static struct s3c_dma_params s3c_pcm_stereo_in[] = {
 	[0] = {
-		.client		= &s3c_pcm_dma_client_in,
 		.dma_size	= 4,
 	},
 	[1] = {
-		.client		= &s3c_pcm_dma_client_in,
 		.dma_size	= 4,
 	},
 };
diff --git a/sound/soc/samsung/s3c2412-i2s.c b/sound/soc/samsung/s3c2412-i2s.c
index 2213377..d43f00e 100644
--- a/sound/soc/samsung/s3c2412-i2s.c
+++ b/sound/soc/samsung/s3c2412-i2s.c
@@ -31,23 +31,13 @@
 #include "regs-i2s-v2.h"
 #include "s3c2412-i2s.h"
 
-static struct s3c2410_dma_client s3c2412_dma_client_out = {
-	.name		= "I2S PCM Stereo out"
-};
-
-static struct s3c2410_dma_client s3c2412_dma_client_in = {
-	.name		= "I2S PCM Stereo in"
-};
-
 static struct s3c_dma_params s3c2412_i2s_pcm_stereo_out = {
-	.client		= &s3c2412_dma_client_out,
 	.channel	= DMACH_I2S_OUT,
 	.dma_addr	= S3C2410_PA_IIS + S3C2412_IISTXD,
 	.dma_size	= 4,
 };
 
 static struct s3c_dma_params s3c2412_i2s_pcm_stereo_in = {
-	.client		= &s3c2412_dma_client_in,
 	.channel	= DMACH_I2S_IN,
 	.dma_addr	= S3C2410_PA_IIS + S3C2412_IISRXD,
 	.dma_size	= 4,
diff --git a/sound/soc/samsung/s3c24xx-i2s.c b/sound/soc/samsung/s3c24xx-i2s.c
index a7b17c1..d68c23d 100644
--- a/sound/soc/samsung/s3c24xx-i2s.c
+++ b/sound/soc/samsung/s3c24xx-i2s.c
@@ -29,23 +29,13 @@
 #include "dma.h"
 #include "s3c24xx-i2s.h"
 
-static struct s3c2410_dma_client s3c24xx_dma_client_out = {
-	.name = "I2S PCM Stereo out"
-};
-
-static struct s3c2410_dma_client s3c24xx_dma_client_in = {
-	.name = "I2S PCM Stereo in"
-};
-
 static struct s3c_dma_params s3c24xx_i2s_pcm_stereo_out = {
-	.client		= &s3c24xx_dma_client_out,
 	.channel	= DMACH_I2S_OUT,
 	.dma_addr	= S3C2410_PA_IIS + S3C2410_IISFIFO,
 	.dma_size	= 2,
 };
 
 static struct s3c_dma_params s3c24xx_i2s_pcm_stereo_in = {
-	.client		= &s3c24xx_dma_client_in,
 	.channel	= DMACH_I2S_IN,
 	.dma_addr	= S3C2410_PA_IIS + S3C2410_IISFIFO,
 	.dma_size	= 2,
diff --git a/sound/soc/samsung/spdif.c b/sound/soc/samsung/spdif.c
index 5008e5b..5c78c78 100644
--- a/sound/soc/samsung/spdif.c
+++ b/sound/soc/samsung/spdif.c
@@ -18,7 +18,6 @@
 #include <sound/pcm_params.h>
 
 #include <linux/platform_data/asoc-s3c.h>
-#include <mach/dma.h>
 
 #include "dma.h"
 #include "spdif.h"
@@ -94,10 +93,6 @@ struct samsung_spdif_info {
 	struct s3c_dma_params	*dma_playback;
 };
 
-static struct s3c2410_dma_client spdif_dma_client_out = {
-	.name		= "S/PDIF Stereo out",
-};
-
 static struct s3c_dma_params spdif_stereo_out;
 static struct samsung_spdif_info spdif_info;
 
@@ -431,7 +426,6 @@ static int spdif_probe(struct platform_device *pdev)
 	}
 
 	spdif_stereo_out.dma_size = 2;
-	spdif_stereo_out.client = &spdif_dma_client_out;
 	spdif_stereo_out.dma_addr = mem_res->start + DATA_OUTBUF;
 	spdif_stereo_out.channel = dma_res->start;
 
-- 
1.8.1.2

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

* [PATCH 19/23] ASoC: samsung: use irq resource for idma
  2013-03-05 17:42 [PATCH 00/23] RFC: exynos multiplatform support Arnd Bergmann
                   ` (17 preceding siblings ...)
  2013-03-05 17:42 ` [PATCH 18/23] ASoC: samsung: convert to dmaengine API Arnd Bergmann
@ 2013-03-05 17:42 ` Arnd Bergmann
  2013-03-05 17:42 ` [PATCH 20/23] ARM: exynos: prepare for sparse IRQ Arnd Bergmann
                   ` (6 subsequent siblings)
  25 siblings, 0 replies; 49+ messages in thread
From: Arnd Bergmann @ 2013-03-05 17:42 UTC (permalink / raw)
  To: linux-arm-kernel

With multiplatform kernels, we cannot use hardwired IRQ
numbers in device drivers. This changes the idma driver
to use a proper resource, like all other drivers do.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/plat-samsung/devs.c |  6 ++++++
 sound/soc/samsung/idma.c     | 10 ++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c
index 58fb02a..ec912e4 100644
--- a/arch/arm/plat-samsung/devs.c
+++ b/arch/arm/plat-samsung/devs.c
@@ -146,14 +146,20 @@ struct platform_device s3c_device_camif = {
 
 /* ASOC DMA */
 
+#ifdef CONFIG_PLAT_S5P 
+static struct resource samsung_asoc_idma_resource = DEFINE_RES_IRQ(IRQ_I2S0);
+
 struct platform_device samsung_asoc_idma = {
 	.name		= "samsung-idma",
 	.id		= -1,
+	.num_resources	= 1,
+	.resource	= &samsung_asoc_idma_resource,
 	.dev		= {
 		.dma_mask		= &samsung_device_dma_mask,
 		.coherent_dma_mask	= DMA_BIT_MASK(32),
 	}
 };
+#endif
 
 /* FB */
 
diff --git a/sound/soc/samsung/idma.c b/sound/soc/samsung/idma.c
index a07950b..f36a541 100644
--- a/sound/soc/samsung/idma.c
+++ b/sound/soc/samsung/idma.c
@@ -68,6 +68,8 @@ static struct idma_info {
 	dma_addr_t	lp_tx_addr;
 } idma;
 
+static int idma_irq;
+
 static void idma_getpos(dma_addr_t *src)
 {
 	*src = idma.lp_tx_addr +
@@ -305,7 +307,7 @@ static int idma_open(struct snd_pcm_substream *substream)
 	if (prtd == NULL)
 		return -ENOMEM;
 
-	ret = request_irq(IRQ_I2S0, iis_irq, 0, "i2s", prtd);
+	ret = request_irq(idma_irq, iis_irq, 0, "i2s", prtd);
 	if (ret < 0) {
 		pr_err("fail to claim i2s irq , ret = %d\n", ret);
 		kfree(prtd);
@@ -324,7 +326,7 @@ static int idma_close(struct snd_pcm_substream *substream)
 	struct snd_pcm_runtime *runtime = substream->runtime;
 	struct idma_ctrl *prtd = runtime->private_data;
 
-	free_irq(IRQ_I2S0, prtd);
+	free_irq(idma_irq, prtd);
 
 	if (!prtd)
 		pr_err("idma_close called with prtd == NULL\n");
@@ -418,6 +420,10 @@ static struct snd_soc_platform_driver asoc_idma_platform = {
 
 static int asoc_idma_platform_probe(struct platform_device *pdev)
 {
+	idma_irq = platform_get_irq(pdev, 0);
+	if (idma_irq < 0)
+		return idma_irq;
+
 	return snd_soc_register_platform(&pdev->dev, &asoc_idma_platform);
 }
 
-- 
1.8.1.2

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

* [PATCH 20/23] ARM: exynos: prepare for sparse IRQ
  2013-03-05 17:42 [PATCH 00/23] RFC: exynos multiplatform support Arnd Bergmann
                   ` (18 preceding siblings ...)
  2013-03-05 17:42 ` [PATCH 19/23] ASoC: samsung: use irq resource for idma Arnd Bergmann
@ 2013-03-05 17:42 ` Arnd Bergmann
  2013-03-05 17:42 ` [PATCH 21/23] ARM: exynos: hack to disable private clock code Arnd Bergmann
                   ` (5 subsequent siblings)
  25 siblings, 0 replies; 49+ messages in thread
From: Arnd Bergmann @ 2013-03-05 17:42 UTC (permalink / raw)
  To: linux-arm-kernel

When we enable CONFIG_SPARSE_IRQ, we have to set the
value of NR_IRQS in the machine_desc for legacy IRQ
domains, and any file referring to the number of
interrupts or a specific number must include the
mach/irqs.h header file explicitly.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-exynos/dev-uart.c          | 1 +
 arch/arm/mach-exynos/include/mach/irqs.h | 5 ++++-
 arch/arm/mach-exynos/mach-armlex4210.c   | 2 ++
 arch/arm/mach-exynos/mach-exynos4-dt.c   | 2 ++
 arch/arm/mach-exynos/mach-exynos5-dt.c   | 2 ++
 arch/arm/mach-exynos/mach-nuri.c         | 2 ++
 arch/arm/mach-exynos/mach-origen.c       | 2 ++
 arch/arm/mach-exynos/mach-smdk4x12.c     | 2 ++
 arch/arm/mach-exynos/mach-smdkv310.c     | 3 +++
 arch/arm/plat-samsung/irq-vic-timer.c    | 1 +
 arch/arm/plat-samsung/pm.c               | 1 +
 arch/arm/plat-samsung/s5p-irq.c          | 1 +
 12 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-exynos/dev-uart.c b/arch/arm/mach-exynos/dev-uart.c
index 7c42f4b..c48aff0 100644
--- a/arch/arm/mach-exynos/dev-uart.c
+++ b/arch/arm/mach-exynos/dev-uart.c
@@ -20,6 +20,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-exynos/include/mach/irqs.h b/arch/arm/mach-exynos/include/mach/irqs.h
index 1f4dc35..8bd5dde 100644
--- a/arch/arm/mach-exynos/include/mach/irqs.h
+++ b/arch/arm/mach-exynos/include/mach/irqs.h
@@ -466,7 +466,10 @@
 #define IRQ_TIMER_BASE			(IRQ_GPIO_END + 64)
 
 /* Set the default NR_IRQS */
+#define EXYNOS_NR_IRQS			(IRQ_TIMER_BASE + IRQ_TIMER_COUNT)
 
-#define NR_IRQS				(IRQ_TIMER_BASE + IRQ_TIMER_COUNT)
+#ifndef CONFIG_SPARSE_IRQ
+#define NR_IRQS				EXYNOS_NR_IRQS
+#endif
 
 #endif /* __ASM_ARCH_IRQS_H */
diff --git a/arch/arm/mach-exynos/mach-armlex4210.c b/arch/arm/mach-exynos/mach-armlex4210.c
index 685f291..cb95992 100644
--- a/arch/arm/mach-exynos/mach-armlex4210.c
+++ b/arch/arm/mach-exynos/mach-armlex4210.c
@@ -25,6 +25,7 @@
 #include <plat/regs-srom.h>
 #include <plat/sdhci.h>
 
+#include <mach/irqs.h>
 #include <mach/map.h>
 
 #include "common.h"
@@ -197,6 +198,7 @@ static void __init armlex4210_machine_init(void)
 MACHINE_START(ARMLEX4210, "ARMLEX4210")
 	/* Maintainer: Alim Akhtar <alim.akhtar@samsung.com> */
 	.atag_offset	= 0x100,
+	.nr_irqs	= EXYNOS_NR_IRQS,
 	.smp		= smp_ops(exynos_smp_ops),
 	.init_irq	= exynos4_init_irq,
 	.map_io		= armlex4210_map_io,
diff --git a/arch/arm/mach-exynos/mach-exynos4-dt.c b/arch/arm/mach-exynos/mach-exynos4-dt.c
index 3358088..55aa611 100644
--- a/arch/arm/mach-exynos/mach-exynos4-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos4-dt.c
@@ -16,6 +16,7 @@
 
 #include <asm/mach/arch.h>
 #include <mach/map.h>
+#include <mach/irqs.h>
 
 #include <plat/cpu.h>
 #include <plat/regs-serial.h>
@@ -137,6 +138,7 @@ static char const *exynos4_dt_compat[] __initdata = {
 
 DT_MACHINE_START(EXYNOS4210_DT, "Samsung Exynos4 (Flattened Device Tree)")
 	/* Maintainer: Thomas Abraham <thomas.abraham@linaro.org> */
+	.nr_irqs	= EXYNOS_NR_IRQS,
 	.smp		= smp_ops(exynos_smp_ops),
 	.init_irq	= exynos4_init_irq,
 	.map_io		= exynos4_dt_map_io,
diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c b/arch/arm/mach-exynos/mach-exynos5-dt.c
index acaeb14..c674e7f 100644
--- a/arch/arm/mach-exynos/mach-exynos5-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
@@ -17,6 +17,7 @@
 
 #include <asm/mach/arch.h>
 #include <mach/map.h>
+#include <mach/irqs.h>
 #include <mach/regs-pmu.h>
 
 #include <plat/cpu.h>
@@ -211,6 +212,7 @@ static void __init exynos5_reserve(void)
 
 DT_MACHINE_START(EXYNOS5_DT, "SAMSUNG EXYNOS5 (Flattened Device Tree)")
 	/* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
+	.nr_irqs	= EXYNOS_NR_IRQS,
 	.init_irq	= exynos5_init_irq,
 	.smp		= smp_ops(exynos_smp_ops),
 	.map_io		= exynos5_dt_map_io,
diff --git a/arch/arm/mach-exynos/mach-nuri.c b/arch/arm/mach-exynos/mach-nuri.c
index 1ea7973..fee0885 100644
--- a/arch/arm/mach-exynos/mach-nuri.c
+++ b/arch/arm/mach-exynos/mach-nuri.c
@@ -53,6 +53,7 @@
 #include <plat/fimc-core.h>
 #include <plat/camport.h>
 
+#include <mach/irqs.h>
 #include <mach/map.h>
 
 #include "common.h"
@@ -1375,6 +1376,7 @@ static void __init nuri_machine_init(void)
 MACHINE_START(NURI, "NURI")
 	/* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */
 	.atag_offset	= 0x100,
+	.nr_irqs	= EXYNOS_NR_IRQS,
 	.smp		= smp_ops(exynos_smp_ops),
 	.init_irq	= exynos4_init_irq,
 	.map_io		= nuri_map_io,
diff --git a/arch/arm/mach-exynos/mach-origen.c b/arch/arm/mach-exynos/mach-origen.c
index 579d2d1..d1849d1 100644
--- a/arch/arm/mach-exynos/mach-origen.c
+++ b/arch/arm/mach-exynos/mach-origen.c
@@ -46,6 +46,7 @@
 #include <plat/hdmi.h>
 
 #include <mach/map.h>
+#include <mach/irqs.h>
 
 #include <drm/exynos_drm.h>
 #include "common.h"
@@ -810,6 +811,7 @@ static void __init origen_machine_init(void)
 MACHINE_START(ORIGEN, "ORIGEN")
 	/* Maintainer: JeongHyeon Kim <jhkim@insignal.co.kr> */
 	.atag_offset	= 0x100,
+	.nr_irqs	= EXYNOS_NR_IRQS,
 	.smp		= smp_ops(exynos_smp_ops),
 	.init_irq	= exynos4_init_irq,
 	.map_io		= origen_map_io,
diff --git a/arch/arm/mach-exynos/mach-smdk4x12.c b/arch/arm/mach-exynos/mach-smdk4x12.c
index fe61496..46c7fc7 100644
--- a/arch/arm/mach-exynos/mach-smdk4x12.c
+++ b/arch/arm/mach-exynos/mach-smdk4x12.c
@@ -39,6 +39,7 @@
 #include <plat/regs-serial.h>
 #include <plat/sdhci.h>
 
+#include <mach/irqs.h>
 #include <mach/map.h>
 
 #include <drm/exynos_drm.h>
@@ -385,6 +386,7 @@ MACHINE_START(SMDK4412, "SMDK4412")
 	/* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
 	/* Maintainer: Changhwan Youn <chaos.youn@samsung.com> */
 	.atag_offset	= 0x100,
+	.nr_irqs	= EXYNOS_NR_IRQS,
 	.smp		= smp_ops(exynos_smp_ops),
 	.init_irq	= exynos4_init_irq,
 	.map_io		= smdk4x12_map_io,
diff --git a/arch/arm/mach-exynos/mach-smdkv310.c b/arch/arm/mach-exynos/mach-smdkv310.c
index d716729..5187687 100644
--- a/arch/arm/mach-exynos/mach-smdkv310.c
+++ b/arch/arm/mach-exynos/mach-smdkv310.c
@@ -43,6 +43,7 @@
 #include <plat/clock.h>
 #include <plat/hdmi.h>
 
+#include <mach/irqs.h>
 #include <mach/map.h>
 
 #include <drm/exynos_drm.h>
@@ -419,6 +420,7 @@ MACHINE_START(SMDKV310, "SMDKV310")
 	/* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
 	/* Maintainer: Changhwan Youn <chaos.youn@samsung.com> */
 	.atag_offset	= 0x100,
+	.nr_irqs	= EXYNOS_NR_IRQS,
 	.smp		= smp_ops(exynos_smp_ops),
 	.init_irq	= exynos4_init_irq,
 	.map_io		= smdkv310_map_io,
@@ -431,6 +433,7 @@ MACHINE_END
 MACHINE_START(SMDKC210, "SMDKC210")
 	/* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
 	.atag_offset	= 0x100,
+	.nr_irqs	= EXYNOS_NR_IRQS,
 	.smp		= smp_ops(exynos_smp_ops),
 	.init_irq	= exynos4_init_irq,
 	.map_io		= smdkv310_map_io,
diff --git a/arch/arm/plat-samsung/irq-vic-timer.c b/arch/arm/plat-samsung/irq-vic-timer.c
index f980cf3..1113066 100644
--- a/arch/arm/plat-samsung/irq-vic-timer.c
+++ b/arch/arm/plat-samsung/irq-vic-timer.c
@@ -19,6 +19,7 @@
 #include <linux/io.h>
 
 #include <mach/map.h>
+#include <mach/irqs.h>
 #include <plat/cpu.h>
 #include <plat/irq-vic-timer.h>
 #include <plat/regs-timer.h>
diff --git a/arch/arm/plat-samsung/pm.c b/arch/arm/plat-samsung/pm.c
index 002b147..53210ec 100644
--- a/arch/arm/plat-samsung/pm.c
+++ b/arch/arm/plat-samsung/pm.c
@@ -27,6 +27,7 @@
 #include <plat/regs-serial.h>
 #include <mach/regs-clock.h>
 #include <mach/regs-irq.h>
+#include <mach/irqs.h>
 #include <asm/irq.h>
 
 #include <plat/pm.h>
diff --git a/arch/arm/plat-samsung/s5p-irq.c b/arch/arm/plat-samsung/s5p-irq.c
index 103e371..ff1a760 100644
--- a/arch/arm/plat-samsung/s5p-irq.c
+++ b/arch/arm/plat-samsung/s5p-irq.c
@@ -15,6 +15,7 @@
 #include <linux/io.h>
 #include <linux/irqchip/arm-vic.h>
 
+#include <mach/irqs.h>
 #include <mach/map.h>
 #include <plat/regs-timer.h>
 #include <plat/cpu.h>
-- 
1.8.1.2

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

* [PATCH 21/23] ARM: exynos: hack to disable private clock code
  2013-03-05 17:42 [PATCH 00/23] RFC: exynos multiplatform support Arnd Bergmann
                   ` (19 preceding siblings ...)
  2013-03-05 17:42 ` [PATCH 20/23] ARM: exynos: prepare for sparse IRQ Arnd Bergmann
@ 2013-03-05 17:42 ` Arnd Bergmann
  2013-03-05 17:42 ` [PATCH 22/23] ARM: exynos: work around missing gpio code on multiplatform Arnd Bergmann
                   ` (4 subsequent siblings)
  25 siblings, 0 replies; 49+ messages in thread
From: Arnd Bergmann @ 2013-03-05 17:42 UTC (permalink / raw)
  To: linux-arm-kernel

Multiplatform kernels rely on the common clock implementation,
which conflicts with Samsung's own implementation of the same
interface. This disables all code that provides or requires
the nonstandard version.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-exynos/Makefile        | 2 ++
 arch/arm/mach-exynos/common.c        | 6 ++++++
 arch/arm/plat-samsung/clock-clksrc.c | 3 +++
 arch/arm/plat-samsung/s5p-clock.c    | 3 +++
 drivers/cpufreq/Kconfig.arm          | 4 +++-
 drivers/devfreq/Kconfig              | 1 +
 6 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-exynos/Makefile b/arch/arm/mach-exynos/Makefile
index 435757e..b0dcf7d 100644
--- a/arch/arm/mach-exynos/Makefile
+++ b/arch/arm/mach-exynos/Makefile
@@ -13,10 +13,12 @@ obj-				:=
 # Core
 
 obj-$(CONFIG_ARCH_EXYNOS)	+= common.o
+ifdef CONFIG_SAMSUNG_CLOCK
 obj-$(CONFIG_ARCH_EXYNOS4)	+= clock-exynos4.o
 obj-$(CONFIG_CPU_EXYNOS4210)	+= clock-exynos4210.o
 obj-$(CONFIG_SOC_EXYNOS4212)	+= clock-exynos4212.o
 obj-$(CONFIG_SOC_EXYNOS5250)	+= clock-exynos5.o
+endif
 
 obj-$(CONFIG_PM)		+= pm.o
 obj-$(CONFIG_PM_GENERIC_DOMAINS) += pm_domains.o
diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index 4b4526d..504d50e 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -404,6 +404,9 @@ static void __init exynos5_map_io(void)
 
 static void __init exynos4_init_clocks(int xtal)
 {
+	if (!IS_ENABLED(CONFIG_SAMSUNG_CLOCK))
+		return;
+
 	printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
 
 	s3c24xx_register_baseclocks(xtal);
@@ -425,6 +428,9 @@ static void __init exynos5440_map_io(void)
 
 static void __init exynos5_init_clocks(int xtal)
 {
+	if (!IS_ENABLED(CONFIG_SAMSUNG_CLOCK))
+		return;
+
 	printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
 
 	/* EXYNOS5440 can support only common clock framework */
diff --git a/arch/arm/plat-samsung/clock-clksrc.c b/arch/arm/plat-samsung/clock-clksrc.c
index 786a410..094fde9 100644
--- a/arch/arm/plat-samsung/clock-clksrc.c
+++ b/arch/arm/plat-samsung/clock-clksrc.c
@@ -179,6 +179,9 @@ void __init s3c_register_clksrc(struct clksrc_clk *clksrc, int size)
 {
 	int ret;
 
+	if (!IS_ENABLED(CONFIG_SAMSUNG_CLOCK))
+		return;
+
 	for (; size > 0; size--, clksrc++) {
 		if (!clksrc->reg_div.reg && !clksrc->reg_src.reg)
 			printk(KERN_ERR "%s: clock %s has no registers set\n",
diff --git a/arch/arm/plat-samsung/s5p-clock.c b/arch/arm/plat-samsung/s5p-clock.c
index 48a1599..0e22618 100644
--- a/arch/arm/plat-samsung/s5p-clock.c
+++ b/arch/arm/plat-samsung/s5p-clock.c
@@ -286,6 +286,9 @@ void __init s5p_register_clocks(unsigned long xtal_freq)
 {
 	int ret;
 
+	if (!IS_ENABLED(CONFIG_SAMSUNG_CLOCK))
+		return;
+
 	clk_ext_xtal_mux.rate = xtal_freq;
 
 	ret = s3c24xx_register_clocks(s5p_clks, ARRAY_SIZE(s5p_clks));
diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm
index 030ddf6..b6fb4fa 100644
--- a/drivers/cpufreq/Kconfig.arm
+++ b/drivers/cpufreq/Kconfig.arm
@@ -51,7 +51,7 @@ config ARM_S5PV210_CPUFREQ
 
 config ARM_EXYNOS_CPUFREQ
 	bool "SAMSUNG EXYNOS SoCs"
-	depends on ARCH_EXYNOS
+	depends on ARCH_EXYNOS && SAMSUNG_CLOCK
 	default y
 	help
 	  This adds the CPUFreq driver common part for Samsung
@@ -59,6 +59,7 @@ config ARM_EXYNOS_CPUFREQ
 
 	  If in doubt, say N.
 
+if ARM_EXYNOS_CPUFREQ
 config ARM_EXYNOS4210_CPUFREQ
 	def_bool CPU_EXYNOS4210
 	help
@@ -76,6 +77,7 @@ config ARM_EXYNOS5250_CPUFREQ
 	help
 	  This adds the CPUFreq driver for Samsung EXYNOS5250
 	  SoC.
+endif
 
 config ARM_KIRKWOOD_CPUFREQ
 	def_bool ARCH_KIRKWOOD && OF
diff --git a/drivers/devfreq/Kconfig b/drivers/devfreq/Kconfig
index 0f079be..d4f9a24 100644
--- a/drivers/devfreq/Kconfig
+++ b/drivers/devfreq/Kconfig
@@ -68,6 +68,7 @@ comment "DEVFREQ Drivers"
 config ARM_EXYNOS4_BUS_DEVFREQ
 	bool "ARM Exynos4210/4212/4412 Memory Bus DEVFREQ Driver"
 	depends on CPU_EXYNOS4210 || CPU_EXYNOS4212 || CPU_EXYNOS4412
+	depends on SAMSUNG_CLOCK
 	select ARCH_HAS_OPP
 	select DEVFREQ_GOV_SIMPLE_ONDEMAND
 	help
-- 
1.8.1.2

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

* [PATCH 22/23] ARM: exynos: work around missing gpio code on multiplatform
  2013-03-05 17:42 [PATCH 00/23] RFC: exynos multiplatform support Arnd Bergmann
                   ` (20 preceding siblings ...)
  2013-03-05 17:42 ` [PATCH 21/23] ARM: exynos: hack to disable private clock code Arnd Bergmann
@ 2013-03-05 17:42 ` Arnd Bergmann
  2013-03-05 17:42 ` [PATCH 23/23] ARM: exynos: experimental multiplatform support Arnd Bergmann
                   ` (3 subsequent siblings)
  25 siblings, 0 replies; 49+ messages in thread
From: Arnd Bergmann @ 2013-03-05 17:42 UTC (permalink / raw)
  To: linux-arm-kernel

With CONFIG_ARCH_MULTIPLATFORM, we can no longer have
our own mach/gpio.h included by the kernel-wide linux/gpio.h
header, and disabling the gpio-samsung driver means we cannot
use any of the private interfaces. This patch disables
all code referring to the driver and gets things to build
again, but surely breaks a lot of stuff in the process.

Thomas Abraham alrady has a proper set of patches to
address this.

Do not apply.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-exynos/Makefile                  | 2 ++
 arch/arm/mach-exynos/common.c                  | 3 +++
 arch/arm/mach-exynos/dev-audio.c               | 1 +
 arch/arm/mach-exynos/include/mach/gpio.h       | 2 ++
 arch/arm/mach-exynos/mach-armlex4210.c         | 1 +
 arch/arm/mach-exynos/mach-origen.c             | 1 +
 arch/arm/mach-exynos/setup-i2c0.c              | 3 ++-
 arch/arm/mach-s3c64xx/include/mach/gpio.h      | 4 ++++
 arch/arm/plat-samsung/include/plat/gpio-core.h | 3 +++
 arch/arm/plat-samsung/pm-gpio.c                | 1 +
 drivers/gpio/Makefile                          | 2 +-
 11 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-exynos/Makefile b/arch/arm/mach-exynos/Makefile
index b0dcf7d..e2f1742 100644
--- a/arch/arm/mach-exynos/Makefile
+++ b/arch/arm/mach-exynos/Makefile
@@ -50,7 +50,9 @@ obj-$(CONFIG_MACH_EXYNOS5_DT)		+= mach-exynos5-dt.o
 # device support
 
 obj-y					+= dev-uart.o
+ifdef CONFIG_ARCH_EXYNOS_SINGLE
 obj-$(CONFIG_ARCH_EXYNOS4)		+= dev-audio.o
+endif
 obj-$(CONFIG_EXYNOS4_DEV_AHCI)		+= dev-ahci.o
 obj-$(CONFIG_EXYNOS_DEV_DMA)		+= dma.o
 obj-$(CONFIG_EXYNOS4_DEV_USB_OHCI)	+= dev-ohci.o
diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index 504d50e..59607b5 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -37,6 +37,7 @@
 #include <mach/regs-irq.h>
 #include <mach/regs-pmu.h>
 #include <mach/regs-gpio.h>
+#include <mach/gpio.h>
 
 #include <plat/cpu.h>
 #include <plat/clock.h>
@@ -745,10 +746,12 @@ static int exynos_irq_eint_set_type(struct irq_data *data, unsigned int type)
 	__raw_writel(ctrl, EINT_CON(exynos_eint_base, data->irq));
 	spin_unlock(&eint_lock);
 
+#ifdef CONFIG_ARCH_EXYNOS_SINGLE
 	if (soc_is_exynos5250())
 		s3c_gpio_cfgpin(exynos5_irq_to_gpio(data->irq), S3C_GPIO_SFN(0xf));
 	else
 		s3c_gpio_cfgpin(exynos4_irq_to_gpio(data->irq), S3C_GPIO_SFN(0xf));
+#endif
 
 	return 0;
 }
diff --git a/arch/arm/mach-exynos/dev-audio.c b/arch/arm/mach-exynos/dev-audio.c
index c662c89..25b173b 100644
--- a/arch/arm/mach-exynos/dev-audio.c
+++ b/arch/arm/mach-exynos/dev-audio.c
@@ -21,6 +21,7 @@
 #include <mach/map.h>
 #include <mach/dma.h>
 #include <mach/irqs.h>
+#include <mach/gpio.h>
 
 #define EXYNOS4_AUDSS_INT_MEM	(0x03000000)
 
diff --git a/arch/arm/mach-exynos/include/mach/gpio.h b/arch/arm/mach-exynos/include/mach/gpio.h
index eb24f1e..88c6d26 100644
--- a/arch/arm/mach-exynos/include/mach/gpio.h
+++ b/arch/arm/mach-exynos/include/mach/gpio.h
@@ -284,6 +284,8 @@ enum exynos5_gpio_number {
 
 /* define the number of gpios */
 
+#ifdef CONFIG_MACH_EXYNOS_SINGLE
 #define ARCH_NR_GPIOS		(CONFIG_SAMSUNG_GPIO_EXTRA + S3C_GPIO_END)
+#endif
 
 #endif /* __ASM_ARCH_GPIO_H */
diff --git a/arch/arm/mach-exynos/mach-armlex4210.c b/arch/arm/mach-exynos/mach-armlex4210.c
index cb95992..2a8e7c1 100644
--- a/arch/arm/mach-exynos/mach-armlex4210.c
+++ b/arch/arm/mach-exynos/mach-armlex4210.c
@@ -27,6 +27,7 @@
 
 #include <mach/irqs.h>
 #include <mach/map.h>
+#include <mach/gpio.h>
 
 #include "common.h"
 
diff --git a/arch/arm/mach-exynos/mach-origen.c b/arch/arm/mach-exynos/mach-origen.c
index d1849d1..72650e2 100644
--- a/arch/arm/mach-exynos/mach-origen.c
+++ b/arch/arm/mach-exynos/mach-origen.c
@@ -47,6 +47,7 @@
 
 #include <mach/map.h>
 #include <mach/irqs.h>
+#include <mach/gpio.h>
 
 #include <drm/exynos_drm.h>
 #include "common.h"
diff --git a/arch/arm/mach-exynos/setup-i2c0.c b/arch/arm/mach-exynos/setup-i2c0.c
index e2d9dfb..95acd62 100644
--- a/arch/arm/mach-exynos/setup-i2c0.c
+++ b/arch/arm/mach-exynos/setup-i2c0.c
@@ -17,10 +17,11 @@ struct platform_device; /* don't need the contents */
 #include <linux/platform_data/i2c-s3c2410.h>
 #include <plat/gpio-cfg.h>
 #include <plat/cpu.h>
+#include <mach/gpio.h>
 
 void s3c_i2c0_cfg_gpio(struct platform_device *dev)
 {
-	if (soc_is_exynos5250() || soc_is_exynos5440())
+	if (soc_is_exynos5250() || soc_is_exynos5440() || !IS_ENABLED(CONFIG_ARCH_EXYNOS_SINGLE))
 		/* will be implemented with gpio function */
 		return;
 
diff --git a/arch/arm/mach-s3c64xx/include/mach/gpio.h b/arch/arm/mach-s3c64xx/include/mach/gpio.h
index 8b540c4..95be5b5 100644
--- a/arch/arm/mach-s3c64xx/include/mach/gpio.h
+++ b/arch/arm/mach-s3c64xx/include/mach/gpio.h
@@ -11,6 +11,8 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
 */
+#ifndef __MACH_GPIO_H
+#define __MACH_GPIO_H
 
 /* GPIO bank sizes */
 #define S3C64XX_GPIO_A_NR	(8)
@@ -91,3 +93,5 @@ enum s3c_gpio_number {
 #define BOARD_NR_GPIOS	(16 + CONFIG_SAMSUNG_GPIO_EXTRA)
 
 #define ARCH_NR_GPIOS	(GPIO_BOARD_START + BOARD_NR_GPIOS)
+
+#endif /* __MACH_GPIO_H */
diff --git a/arch/arm/plat-samsung/include/plat/gpio-core.h b/arch/arm/plat-samsung/include/plat/gpio-core.h
index cf5aae5..103a958 100644
--- a/arch/arm/plat-samsung/include/plat/gpio-core.h
+++ b/arch/arm/plat-samsung/include/plat/gpio-core.h
@@ -101,6 +101,9 @@ extern struct samsung_gpio_chip *s3c_gpios[S3C_GPIO_END];
 
 static inline struct samsung_gpio_chip *samsung_gpiolib_getchip(unsigned int chip)
 {
+	if (!IS_ENABLED(CONFIG_ARCH_EXYNOS_SINGLE))
+		return NULL;
+
 	return (chip < S3C_GPIO_END) ? s3c_gpios[chip] : NULL;
 }
 #else
diff --git a/arch/arm/plat-samsung/pm-gpio.c b/arch/arm/plat-samsung/pm-gpio.c
index c2ff92c..b24c159 100644
--- a/arch/arm/plat-samsung/pm-gpio.c
+++ b/arch/arm/plat-samsung/pm-gpio.c
@@ -19,6 +19,7 @@
 #include <linux/io.h>
 #include <linux/gpio.h>
 
+#include <mach/gpio.h>
 #include <plat/gpio-core.h>
 #include <plat/pm.h>
 
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 22e07bc..91ed0f9 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -57,7 +57,7 @@ obj-$(CONFIG_GPIO_PL061)	+= gpio-pl061.o
 obj-$(CONFIG_GPIO_PXA)		+= gpio-pxa.o
 obj-$(CONFIG_GPIO_RC5T583)	+= gpio-rc5t583.o
 obj-$(CONFIG_GPIO_RDC321X)	+= gpio-rdc321x.o
-obj-$(CONFIG_PLAT_SAMSUNG)	+= gpio-samsung.o
+obj-$(CONFIG_PLAT_SAMSUNG_SINGLE) += gpio-samsung.o
 obj-$(CONFIG_ARCH_SA1100)	+= gpio-sa1100.o
 obj-$(CONFIG_GPIO_SCH)		+= gpio-sch.o
 obj-$(CONFIG_GPIO_SODAVILLE)	+= gpio-sodaville.o
-- 
1.8.1.2

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

* [PATCH 23/23] ARM: exynos: experimental multiplatform support
  2013-03-05 17:42 [PATCH 00/23] RFC: exynos multiplatform support Arnd Bergmann
                   ` (21 preceding siblings ...)
  2013-03-05 17:42 ` [PATCH 22/23] ARM: exynos: work around missing gpio code on multiplatform Arnd Bergmann
@ 2013-03-05 17:42 ` Arnd Bergmann
  2013-03-05 18:27 ` [PATCH 00/23] RFC: exynos " Tony Lindgren
                   ` (2 subsequent siblings)
  25 siblings, 0 replies; 49+ messages in thread
From: Arnd Bergmann @ 2013-03-05 17:42 UTC (permalink / raw)
  To: linux-arm-kernel

This enables the exynos platform to be selected as part
of a CONFIG_ARCH_MULTIPLATFORM kernel. This still
breaks a number of drivers, which we will have to
enable again one by one. Single-platform configurations
should not be impacted by this.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/Kconfig               | 11 ++---------
 arch/arm/mach-exynos/Kconfig   | 21 +++++++++++++++++----
 arch/arm/mach-exynos/Makefile  |  1 +
 arch/arm/plat-samsung/Kconfig  |  5 +++++
 arch/arm/plat-samsung/Makefile |  3 +++
 drivers/video/Kconfig          |  2 +-
 drivers/watchdog/Kconfig       |  1 +
 7 files changed, 30 insertions(+), 14 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 5b71469..56b62f5 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -854,18 +854,11 @@ config ARCH_S5PV210
 	help
 	  Samsung S5PV210/S5PC110 series based systems
 
-config ARCH_EXYNOS
+config ARCH_EXYNOS_SINGLE
 	bool "Samsung EXYNOS"
 	select ARCH_HAS_CPUFREQ
 	select ARCH_HAS_HOLES_MEMORYMODEL
 	select ARCH_SPARSEMEM_ENABLE
-	select CLKDEV_LOOKUP
-	select CPU_V7
-	select GENERIC_CLOCKEVENTS
-	select HAVE_CLK
-	select HAVE_S3C2410_I2C if I2C
-	select HAVE_S3C2410_WATCHDOG if WATCHDOG
-	select HAVE_S3C_RTC if RTC_CLASS
 	select NEED_MACH_GPIO_H
 	select NEED_MACH_MEMORY_H
 	help
@@ -1650,7 +1643,7 @@ config LOCAL_TIMERS
 	bool "Use local timer interrupts"
 	depends on SMP
 	default y
-	select HAVE_ARM_TWD if (!ARCH_MSM_SCORPIONMP && !EXYNOS4_MCT)
+	select HAVE_ARM_TWD if (!ARCH_MSM_SCORPIONMP)
 	help
 	  Enable support for local timers on SMP platforms, rather then the
 	  legacy IPI broadcast method.  Local timers allows the system
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index 3291a72..1f2e7dc 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -7,6 +7,19 @@
 
 # Configuration options for the EXYNOS4
 
+config ARCH_EXYNOS
+	bool "Samsung EXYNOS" if ARCH_MULTI_V7
+	default ARCH_EXYNOS_SINGLE
+	select CLKDEV_LOOKUP
+	select CPU_V7
+	select GENERIC_CLOCKEVENTS
+	select HAVE_CLK
+	select HAVE_S3C2410_I2C if I2C
+	select HAVE_S3C2410_WATCHDOG if WATCHDOG
+	select HAVE_S3C_RTC if RTC_CLASS
+	help
+	  Support for SAMSUNG's EXYNOS SoCs (EXYNOS4/5)
+
 if ARCH_EXYNOS
 
 menu "SAMSUNG EXYNOS SoCs Support"
@@ -35,7 +48,7 @@ config CPU_EXYNOS4210
 	select PM_GENERIC_DOMAINS
 	select S5P_PM if PM
 	select S5P_SLEEP if PM
-	select SAMSUNG_DMADEV
+	select SAMSUNG_DMADEV if ARCH_EXYNOS_SINGLE
 	help
 	  Enable EXYNOS4210 CPU support
 
@@ -45,7 +58,7 @@ config SOC_EXYNOS4212
 	depends on ARCH_EXYNOS4
 	select S5P_PM if PM
 	select S5P_SLEEP if PM
-	select SAMSUNG_DMADEV
+	select SAMSUNG_DMADEV if ARCH_EXYNOS_SINGLE
 	help
 	  Enable EXYNOS4212 SoC support
 
@@ -53,7 +66,7 @@ config SOC_EXYNOS4412
 	bool "SAMSUNG EXYNOS4412"
 	default y
 	depends on ARCH_EXYNOS4
-	select SAMSUNG_DMADEV
+	select SAMSUNG_DMADEV if ARCH_EXYNOS_SINGLE
 	help
 	  Enable EXYNOS4412 SoC support
 
@@ -64,7 +77,7 @@ config SOC_EXYNOS5250
 	select S5P_PM if PM
 	select S5P_SLEEP if PM
 	select S5P_DEV_MFC
-	select SAMSUNG_DMADEV
+	select SAMSUNG_DMADEV if ARCH_EXYNOS_SINGLE
 	help
 	  Enable EXYNOS5250 SoC support
 
diff --git a/arch/arm/mach-exynos/Makefile b/arch/arm/mach-exynos/Makefile
index e2f1742..646b79e 100644
--- a/arch/arm/mach-exynos/Makefile
+++ b/arch/arm/mach-exynos/Makefile
@@ -4,6 +4,7 @@
 #		http://www.samsung.com/
 #
 # Licensed under GPLv2
+ccflags-$(CONFIG_ARCH_MULTIPLATFORM) += -I$(srctree)/$(src)/include -I$(srctree)/arch/arm/plat-samsung/include
 
 obj-y				:=
 obj-m				:=
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index a9d5216..b6669db 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -13,6 +13,10 @@ config PLAT_SAMSUNG
 	help
 	  Base platform code for all Samsung SoC based systems
 
+config PLAT_SAMSUNG_SINGLE
+	def_bool PLAT_SAMSUNG && !ARCH_MULTIPLATFORM
+	
+
 config PLAT_S5P
 	bool
 	depends on (ARCH_S5P64X0 || ARCH_S5PC100 || ARCH_S5PV210 || ARCH_EXYNOS)
@@ -178,6 +182,7 @@ config S5P_DEV_UART
 
 config S3C_ADC
 	bool "ADC common driver support"
+	depends on PLAT_SAMSUNG_SINGLE
 	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 3a7c64d..78f560e 100644
--- a/arch/arm/plat-samsung/Makefile
+++ b/arch/arm/plat-samsung/Makefile
@@ -4,6 +4,9 @@
 #
 # Licensed under GPLv2
 
+ccflags-$(CONFIG_ARCH_MULTI_V7) += -I$(srctree)/$(src)/include
+ccflags-$(CONFIG_ARCH_EXYNOS)	+= -I$(srctree)/arch/arm/mach-exynos/include
+
 obj-y				:=
 obj-m				:=
 obj-n				:= dummy.o
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 4c1546f..05a4a59 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -2048,7 +2048,7 @@ config FB_TMIO_ACCELL
 config FB_S3C
 	tristate "Samsung S3C framebuffer support"
 	depends on FB && (CPU_S3C2416 || ARCH_S3C64XX || ARCH_S5P64X0 || \
-		ARCH_S5PC100 || ARCH_S5PV210 || ARCH_EXYNOS)
+		ARCH_S5PC100 || ARCH_S5PV210 || ARCH_EXYNOS_SINGLE)
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 9fcc70c..f39337b 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -187,6 +187,7 @@ config HAVE_S3C2410_WATCHDOG
 config S3C2410_WATCHDOG
 	tristate "S3C2410 Watchdog"
 	depends on HAVE_S3C2410_WATCHDOG
+	depends on PLAT_SAMSUNG_SINGLE
 	select WATCHDOG_CORE
 	help
 	  Watchdog timer block in the Samsung SoCs. This will reboot
-- 
1.8.1.2

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

* [PATCH 00/23] RFC: exynos multiplatform support
  2013-03-05 17:42 [PATCH 00/23] RFC: exynos multiplatform support Arnd Bergmann
                   ` (22 preceding siblings ...)
  2013-03-05 17:42 ` [PATCH 23/23] ARM: exynos: experimental multiplatform support Arnd Bergmann
@ 2013-03-05 18:27 ` Tony Lindgren
  2013-03-05 18:28 ` Tomasz Figa
  2013-03-05 20:50 ` Heiko Stübner
  25 siblings, 0 replies; 49+ messages in thread
From: Tony Lindgren @ 2013-03-05 18:27 UTC (permalink / raw)
  To: linux-arm-kernel

* Arnd Bergmann <arnd@arndb.de> [130305 09:51]:
> Hi everyone,
> 
> Although I'm not present at the Linaro Connect hacking
> sessions, I am participating remotely and have tried
> hacking on multiplatform support for Exynos. This patch
> set is far from complete, but I think the patches
> can be useful anyway.
> 
> The series gets increasingly fishy towards the end,
> and we should probably not apply any of the last nine
> patches as-is, nor do I expect everything to work, since
> I have not tested them at all.
> 
> With this patch set, we can build mach-exynos as part
> of a multiplatform kernel, with the following caveats:
> 
> * Only DT based boards are supported
> * Moving to common-clk breaks things including cpufreq
>   and others. Thomas is working on a patch for this
> * We disable the gpio implementation, which also breaks
>   stuff, but Thomas has a patch already
> * Using the generic DMA engine API in SPI and ASoC
>   means they no longer work on S3C
> * I did not like the solution for the UART driver, but
>   could also not think of a better one.
> * The FB_S3C, S3C2410_WATCHDOG and S3C_ADC drivers
>   are left as an exercise to the reader, they are
>   currently disabled with multiplatform
> * sparsemem support is not available on multiplatform

For booting, you might want to add fixing up of the initcalls
to your checklist too as that can easily cause surprises to
other SoCs.

Regards,

Tony

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

* [PATCH 00/23] RFC: exynos multiplatform support
  2013-03-05 17:42 [PATCH 00/23] RFC: exynos multiplatform support Arnd Bergmann
                   ` (23 preceding siblings ...)
  2013-03-05 18:27 ` [PATCH 00/23] RFC: exynos " Tony Lindgren
@ 2013-03-05 18:28 ` Tomasz Figa
  2013-03-05 19:19   ` Arnd Bergmann
  2013-03-05 20:50 ` Heiko Stübner
  25 siblings, 1 reply; 49+ messages in thread
From: Tomasz Figa @ 2013-03-05 18:28 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Arnd,

First of all, thanks for your great effort on making Exynos multiplatform-
friendly.

I have added my two cents inline.

On Tuesday 05 of March 2013 18:42:10 Arnd Bergmann wrote:
> Hi everyone,
> 
> Although I'm not present at the Linaro Connect hacking
> sessions, I am participating remotely and have tried
> hacking on multiplatform support for Exynos. This patch
> set is far from complete, but I think the patches
> can be useful anyway.
> 
> The series gets increasingly fishy towards the end,
> and we should probably not apply any of the last nine
> patches as-is, nor do I expect everything to work, since
> I have not tested them at all.
> 
> With this patch set, we can build mach-exynos as part
> of a multiplatform kernel, with the following caveats:
> 
> * Only DT based boards are supported

As far as I'm aware, there are plans to drop non-DT Exynos support. Kgene 
should know more on this.

> * Moving to common-clk breaks things including cpufreq
>   and others. Thomas is working on a patch for this

We have several patches internally for fixing things up to run correclty with 
common-clk. I'll see if we can post some patches.

> * We disable the gpio implementation, which also breaks
>   stuff, but Thomas has a patch already

The legacy GPIO code is needed only for non-DT case. DT-case uses the new 
pinctrl-samsung driver, which is (AFAIK) multiplatform-aware.

> * Using the generic DMA engine API in SPI and ASoC
>   means they no longer work on S3C
> * I did not like the solution for the UART driver, but
>   could also not think of a better one.
> * The FB_S3C, S3C2410_WATCHDOG and S3C_ADC drivers
>   are left as an exercise to the reader, they are
>   currently disabled with multiplatform
> * sparsemem support is not available on multiplatform

There was some discussion some time ago whether we really need sparsemem on 
Exynos. If I remember correctly, it turned out that we don't. So this is not 
really an issue.

> The patches are based on v3.9-rc1 and I have pushed
> the git branch to
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc.git
> testing/exynos-multiplatform
> 
> I have not yet added subsystem maintainers to Cc on the
> patches, I'd like to coordinate with the other people
> involved first, so see if they already have patches
> for the same drivers.
> 
> 	Arnd
> 
> Arnd Bergmann (23):
>   ARM: exynos: introduce EXYNOS_ATAGS symbol
>   irqchip: exynos: remove dependency on mach/irqs.h
>   tty: serial/samsung: prepare for common clock API
>   tty: serial/samsung: make register definitions global
>   tty: serial/samsung: fix modular build
>   ARM: exynos: move debug-macro.S to include/debug/
>   i2c: s3c2410: make header file local
>   mmc: sdhci-s3c: remove platform dependencies
>   usb: exynos: do not include plat/usb-phy.h
>   [media] exynos: remove unnecessary header inclusions
>   video/exynos: remove unnecessary header inclusions
>   thermal/exynos: remove unnecessary header inclusions
>   mtd: onenand/samsung: make regs-onenand.h file local
>   rtc: s3c: make header file local
>   spi: s3c64xx: move to generic dmaengine API
>   pwm: samsung: repair the worst MMIO abuses

I'm currently working (in my free time) on a series of cleanup patches 
sanitizing Samsung PWM code for S3C64xx and S5PV210 DT (and multiplatform) 
support.

On those platforms it is a bit more complex case as there are two blocks of 
code that access the same hardware - samsung-time (using two PWM channels for 
clocksource and clock events) and pwm-samsung.

Hopefully, I will have some patches ready soon.

Best regards,
-- 
Tomasz Figa
Samsung Poland R&D Center
SW Solution Development, Kernel and System Framework

>   ASoC: samsung: move plat/ headers to local directory
>   ASoC: samsung: convert to dmaengine API
>   ASoC: samsung: use irq resource for idma
>   ARM: exynos: prepare for sparse IRQ
>   ARM: exynos: hack to disable private clock code
>   ARM: exynos: work around missing gpio code on multiplatform
>   ARM: exynos: experimental multiplatform support
> 
>  arch/arm/Kconfig                                  |  11 +-
>  arch/arm/Kconfig.debug                            |   8 +
>  arch/arm/include/debug/exynos.S                   |  39 +++
>  arch/arm/include/debug/samsung.S                  |  87 +++++++
>  arch/arm/mach-exynos/Kconfig                      |  36 ++-
>  arch/arm/mach-exynos/Makefile                     |   5 +
>  arch/arm/mach-exynos/common.c                     |  14 +-
>  arch/arm/mach-exynos/common.h                     |   2 +-
>  arch/arm/mach-exynos/dev-audio.c                  |   1 +
>  arch/arm/mach-exynos/dev-uart.c                   |   1 +
>  arch/arm/mach-exynos/include/mach/debug-macro.S   |  39 ---
>  arch/arm/mach-exynos/include/mach/gpio.h          |   2 +
>  arch/arm/mach-exynos/include/mach/irqs.h          |   5 +-
>  arch/arm/mach-exynos/mach-armlex4210.c            |   3 +
>  arch/arm/mach-exynos/mach-exynos4-dt.c            |   2 +
>  arch/arm/mach-exynos/mach-exynos5-dt.c            |   2 +
>  arch/arm/mach-exynos/mach-nuri.c                  |   2 +
>  arch/arm/mach-exynos/mach-origen.c                |   3 +
>  arch/arm/mach-exynos/mach-smdk4x12.c              |   2 +
>  arch/arm/mach-exynos/mach-smdkv310.c              |   3 +
>  arch/arm/mach-exynos/setup-i2c0.c                 |   3 +-
>  arch/arm/mach-exynos/setup-sdhci-gpio.c           |   2 +-
>  arch/arm/mach-exynos/setup-usb-phy.c              |   8 +-
>  arch/arm/mach-s3c24xx/clock-s3c2440.c             |   5 +
>  arch/arm/mach-s3c24xx/common.c                    |   5 +
>  arch/arm/mach-s3c24xx/dma-s3c2410.c               |   2 -
>  arch/arm/mach-s3c24xx/dma-s3c2412.c               |   2 -
>  arch/arm/mach-s3c24xx/dma-s3c2440.c               |   2 -
>  arch/arm/mach-s3c24xx/dma-s3c2443.c               |   2 -
>  arch/arm/mach-s3c24xx/include/mach/debug-macro.S  |   2 +-
>  arch/arm/mach-s3c24xx/mach-rx1950.c               |   1 -
>  arch/arm/mach-s3c64xx/include/mach/debug-macro.S  |   2 +-
>  arch/arm/mach-s3c64xx/include/mach/gpio.h         |   4 +
>  arch/arm/mach-s3c64xx/setup-usb-phy.c             |   4 +-
>  arch/arm/mach-s5p64x0/include/mach/debug-macro.S  |   2 +-
>  arch/arm/mach-s5pc100/include/mach/debug-macro.S  |   2 +-
>  arch/arm/mach-s5pc100/setup-sdhci-gpio.c          |   1 -
>  arch/arm/mach-s5pv210/include/mach/debug-macro.S  |   2 +-
>  arch/arm/mach-s5pv210/setup-sdhci-gpio.c          |   1 -
>  arch/arm/mach-s5pv210/setup-usb-phy.c             |   4 +-
>  arch/arm/plat-samsung/Kconfig                     |   5 +
>  arch/arm/plat-samsung/Makefile                    |   3 +
>  arch/arm/plat-samsung/clock-clksrc.c              |   3 +
>  arch/arm/plat-samsung/devs.c                      |  17 +-
>  arch/arm/plat-samsung/include/plat/debug-macro.S  |  87 -------
>  arch/arm/plat-samsung/include/plat/gpio-core.h    |   3 +
>  arch/arm/plat-samsung/include/plat/regs-ac97.h    |  67 -----
>  arch/arm/plat-samsung/include/plat/regs-iic.h     |  56 -----
>  arch/arm/plat-samsung/include/plat/regs-iis.h     |  70 ------
>  arch/arm/plat-samsung/include/plat/regs-onenand.h |  63 -----
>  arch/arm/plat-samsung/include/plat/regs-rtc.h     |  71 ------
>  arch/arm/plat-samsung/include/plat/regs-sdhci.h   |  87 -------
>  arch/arm/plat-samsung/include/plat/regs-serial.h  | 282
> +--------------------- arch/arm/plat-samsung/include/plat/sdhci.h        | 
> 56 +----
>  arch/arm/plat-samsung/include/plat/usb-phy.h      |   5 +-
>  arch/arm/plat-samsung/irq-vic-timer.c             |   1 +
>  arch/arm/plat-samsung/pm-gpio.c                   |   1 +
>  arch/arm/plat-samsung/pm.c                        |   1 +
>  arch/arm/plat-samsung/s5p-clock.c                 |   3 +
>  arch/arm/plat-samsung/s5p-irq.c                   |   1 +
>  drivers/cpufreq/Kconfig.arm                       |   4 +-
>  drivers/devfreq/Kconfig                           |   1 +
>  drivers/gpio/Makefile                             |   2 +-
>  drivers/i2c/busses/i2c-s3c2410.c                  |   3 +-
>  drivers/i2c/busses/i2c-s3c2410.h                  |  56 +++++
>  drivers/irqchip/exynos-combiner.c                 | 113 +++++----
>  drivers/media/platform/exynos-gsc/gsc-regs.c      |   1 -
>  drivers/media/platform/s5p-tv/sii9234_drv.c       |   3 -
>  drivers/mmc/host/Kconfig                          |   2 +-
>  drivers/mmc/host/sdhci-s3c-regs.h                 |  87 +++++++
>  drivers/mmc/host/sdhci-s3c.c                      |   5 +-
>  drivers/mtd/onenand/samsung.c                     |   4 +-
>  drivers/mtd/onenand/samsung.h                     |  61 +++++
>  drivers/pwm/pwm-samsung.c                         |  60 +++--
>  drivers/rtc/rtc-s3c.c                             |   3 +-
>  drivers/rtc/rtc-s3c.h                             |  70 ++++++
>  drivers/spi/spi-s3c64xx.c                         | 107 ++++----
>  drivers/thermal/exynos_thermal.c                  |   2 -
>  drivers/tty/serial/samsung.c                      |  17 +-
>  drivers/tty/serial/samsung.h                      |   4 +-
>  drivers/usb/host/ehci-s5p.c                       |   1 -
>  drivers/usb/host/ohci-exynos.c                    |   1 -
>  drivers/video/Kconfig                             |   2 +-
>  drivers/video/exynos/exynos_mipi_dsi.c            |   2 -
>  drivers/video/exynos/exynos_mipi_dsi_common.c     |   2 -
>  drivers/video/exynos/exynos_mipi_dsi_lowlevel.c   |   2 -
>  drivers/watchdog/Kconfig                          |   1 +
>  include/linux/platform_data/mmc-sdhci-s3c.h       |  56 +++++
>  include/linux/platform_data/spi-s3c64xx.h         |   3 +
>  include/linux/serial_s3c.h                        | 260
> ++++++++++++++++++++ sound/soc/samsung/ac97.c                          | 
> 17 +-
>  sound/soc/samsung/dma.c                           | 104 ++++----
>  sound/soc/samsung/dma.h                           |   4 +-
>  sound/soc/samsung/h1940_uda1380.c                 |   2 +-
>  sound/soc/samsung/i2s.c                           |   9 +-
>  sound/soc/samsung/idma.c                          |  10 +-
>  sound/soc/samsung/neo1973_wm8753.c                |   2 +-
>  sound/soc/samsung/pcm.c                           |  13 -
>  sound/soc/samsung/regs-ac97.h                     |  67 +++++
>  sound/soc/samsung/regs-iis.h                      |  70 ++++++
>  sound/soc/samsung/rx1950_uda1380.c                |   2 +-
>  sound/soc/samsung/s3c2412-i2s.c                   |  10 -
>  sound/soc/samsung/s3c24xx-i2s.c                   |  12 +-
>  sound/soc/samsung/s3c24xx_uda134x.c               |   2 +-
>  sound/soc/samsung/spdif.c                         |   6 -
>  105 files changed, 1262 insertions(+), 1208 deletions(-)
>  create mode 100644 arch/arm/include/debug/exynos.S
>  create mode 100644 arch/arm/include/debug/samsung.S
>  delete mode 100644 arch/arm/mach-exynos/include/mach/debug-macro.S
>  delete mode 100644 arch/arm/plat-samsung/include/plat/debug-macro.S
>  delete mode 100644 arch/arm/plat-samsung/include/plat/regs-ac97.h
>  delete mode 100644 arch/arm/plat-samsung/include/plat/regs-iic.h
>  delete mode 100644 arch/arm/plat-samsung/include/plat/regs-iis.h
>  delete mode 100644 arch/arm/plat-samsung/include/plat/regs-onenand.h
>  delete mode 100644 arch/arm/plat-samsung/include/plat/regs-rtc.h
>  delete mode 100644 arch/arm/plat-samsung/include/plat/regs-sdhci.h
>  create mode 100644 drivers/i2c/busses/i2c-s3c2410.h
>  create mode 100644 drivers/mmc/host/sdhci-s3c-regs.h
>  create mode 100644 drivers/mtd/onenand/samsung.h
>  create mode 100644 drivers/rtc/rtc-s3c.h
>  create mode 100644 include/linux/platform_data/mmc-sdhci-s3c.h
>  create mode 100644 include/linux/serial_s3c.h
>  create mode 100644 sound/soc/samsung/regs-ac97.h
>  create mode 100644 sound/soc/samsung/regs-iis.h

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

* [PATCH 00/23] RFC: exynos multiplatform support
  2013-03-05 18:28 ` Tomasz Figa
@ 2013-03-05 19:19   ` Arnd Bergmann
  2013-03-05 22:48     ` Tomasz Figa
  0 siblings, 1 reply; 49+ messages in thread
From: Arnd Bergmann @ 2013-03-05 19:19 UTC (permalink / raw)
  To: linux-arm-kernel

On Tuesday 05 March 2013, Tomasz Figa wrote:
> > 
> > With this patch set, we can build mach-exynos as part
> > of a multiplatform kernel, with the following caveats:
> > 
> > * Only DT based boards are supported
> 
> As far as I'm aware, there are plans to drop non-DT Exynos support. Kgene 
> should know more on this.

Yes, that was my understanding as well. It might not actually be too 
hard to get multiplatform working with the ATAGS based board files
(we do that on some of the other platforms), but there is probably
no reason to try hard.
 
> > * Moving to common-clk breaks things including cpufreq
> >   and others. Thomas is working on a patch for this
> 
> We have several patches internally for fixing things up to run correclty with 
> common-clk. I'll see if we can post some patches.

Ok, excellent.

> > * We disable the gpio implementation, which also breaks
> >   stuff, but Thomas has a patch already
> 
> The legacy GPIO code is needed only for non-DT case. DT-case uses the new 
> pinctrl-samsung driver, which is (AFAIK) multiplatform-aware.

Please have a closer look at the "ARM: exynos: work around missing gpio
code on multiplatform" patch, I think there a few files I had to touch
that actually rely on the legacy gpio code:

* the pm-gpio.c file
* the s3c_i2c0_cfg_gpio function
* the eint irqchip

If none of these are needed for DT-based systems, we should probably
build that code conditionally based on the CONFIG_EXYNOS_ATAGS symbol
I introduced.

> > * sparsemem support is not available on multiplatform
> 
> There was some discussion some time ago whether we really need sparsemem on 
> Exynos. If I remember correctly, it turned out that we don't. So this is not 
> really an issue.

Ok, good.
 
> > Arnd Bergmann (23):
> >   ARM: exynos: introduce EXYNOS_ATAGS symbol
> >   irqchip: exynos: remove dependency on mach/irqs.h
> >   tty: serial/samsung: prepare for common clock API
> >   tty: serial/samsung: make register definitions global
> >   tty: serial/samsung: fix modular build
> >   ARM: exynos: move debug-macro.S to include/debug/
> >   i2c: s3c2410: make header file local
> >   mmc: sdhci-s3c: remove platform dependencies
> >   usb: exynos: do not include plat/usb-phy.h
> >   [media] exynos: remove unnecessary header inclusions
> >   video/exynos: remove unnecessary header inclusions
> >   thermal/exynos: remove unnecessary header inclusions
> >   mtd: onenand/samsung: make regs-onenand.h file local
> >   rtc: s3c: make header file local
> >   spi: s3c64xx: move to generic dmaengine API
> >   pwm: samsung: repair the worst MMIO abuses
> 
> I'm currently working (in my free time) on a series of cleanup patches 
> sanitizing Samsung PWM code for S3C64xx and S5PV210 DT (and multiplatform) 
> support.

Ah, nice.

> On those platforms it is a bit more complex case as there are two blocks of 
> code that access the same hardware - samsung-time (using two PWM channels for 
> clocksource and clock events) and pwm-samsung.
> 
> Hopefully, I will have some patches ready soon.

How are you planning to solve this? Do you want to have a combined driver that
registers both a clocksource and a pwm?

	Arnd

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

* [PATCH 00/23] RFC: exynos multiplatform support
  2013-03-05 17:42 [PATCH 00/23] RFC: exynos multiplatform support Arnd Bergmann
                   ` (24 preceding siblings ...)
  2013-03-05 18:28 ` Tomasz Figa
@ 2013-03-05 20:50 ` Heiko Stübner
  2013-03-05 21:24   ` Arnd Bergmann
  25 siblings, 1 reply; 49+ messages in thread
From: Heiko Stübner @ 2013-03-05 20:50 UTC (permalink / raw)
  To: linux-arm-kernel

Am Dienstag, 5. M?rz 2013, 18:42:10 schrieb Arnd Bergmann:
> Hi everyone,
> 
> Although I'm not present at the Linaro Connect hacking
> sessions, I am participating remotely and have tried
> hacking on multiplatform support for Exynos. This patch
> set is far from complete, but I think the patches
> can be useful anyway.
> 
> The series gets increasingly fishy towards the end,
> and we should probably not apply any of the last nine
> patches as-is, nor do I expect everything to work, since
> I have not tested them at all.
> 
> With this patch set, we can build mach-exynos as part
> of a multiplatform kernel, with the following caveats:
> 
> * Only DT based boards are supported
> * Moving to common-clk breaks things including cpufreq
>   and others. Thomas is working on a patch for this
> * We disable the gpio implementation, which also breaks
>   stuff, but Thomas has a patch already
> * Using the generic DMA engine API in SPI and ASoC
>   means they no longer work on S3C

If I remember correctly Kgene mentioning some time back, that someone was 
working on converting the s3c dma to dmaengine, but I never heard anything 
more about it.

So personally I would be grateful, for people not breaking my devices :-) .


On an unrelated note, exists some sort of documentation for creating dmaengine 
drivers somewhere? Documentation/* seems to always be only targetted at device 
driver writers and my own DMA knowledge is still stuck at the theoretical 
level they teach in generic operating-systems university courses.


Heiko
 

> * I did not like the solution for the UART driver, but
>   could also not think of a better one.
> * The FB_S3C, S3C2410_WATCHDOG and S3C_ADC drivers
>   are left as an exercise to the reader, they are
>   currently disabled with multiplatform
> * sparsemem support is not available on multiplatform
> 
> The patches are based on v3.9-rc1 and I have pushed
> the git branch to
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc.git
> testing/exynos-multiplatform
> 
> I have not yet added subsystem maintainers to Cc on the
> patches, I'd like to coordinate with the other people
> involved first, so see if they already have patches
> for the same drivers.
> 
> 	Arnd
> 
> Arnd Bergmann (23):
>   ARM: exynos: introduce EXYNOS_ATAGS symbol
>   irqchip: exynos: remove dependency on mach/irqs.h
>   tty: serial/samsung: prepare for common clock API
>   tty: serial/samsung: make register definitions global
>   tty: serial/samsung: fix modular build
>   ARM: exynos: move debug-macro.S to include/debug/
>   i2c: s3c2410: make header file local
>   mmc: sdhci-s3c: remove platform dependencies
>   usb: exynos: do not include plat/usb-phy.h
>   [media] exynos: remove unnecessary header inclusions
>   video/exynos: remove unnecessary header inclusions
>   thermal/exynos: remove unnecessary header inclusions
>   mtd: onenand/samsung: make regs-onenand.h file local
>   rtc: s3c: make header file local
>   spi: s3c64xx: move to generic dmaengine API
>   pwm: samsung: repair the worst MMIO abuses
>   ASoC: samsung: move plat/ headers to local directory
>   ASoC: samsung: convert to dmaengine API
>   ASoC: samsung: use irq resource for idma
>   ARM: exynos: prepare for sparse IRQ
>   ARM: exynos: hack to disable private clock code
>   ARM: exynos: work around missing gpio code on multiplatform
>   ARM: exynos: experimental multiplatform support
> 
>  arch/arm/Kconfig                                  |  11 +-
>  arch/arm/Kconfig.debug                            |   8 +
>  arch/arm/include/debug/exynos.S                   |  39 +++
>  arch/arm/include/debug/samsung.S                  |  87 +++++++
>  arch/arm/mach-exynos/Kconfig                      |  36 ++-
>  arch/arm/mach-exynos/Makefile                     |   5 +
>  arch/arm/mach-exynos/common.c                     |  14 +-
>  arch/arm/mach-exynos/common.h                     |   2 +-
>  arch/arm/mach-exynos/dev-audio.c                  |   1 +
>  arch/arm/mach-exynos/dev-uart.c                   |   1 +
>  arch/arm/mach-exynos/include/mach/debug-macro.S   |  39 ---
>  arch/arm/mach-exynos/include/mach/gpio.h          |   2 +
>  arch/arm/mach-exynos/include/mach/irqs.h          |   5 +-
>  arch/arm/mach-exynos/mach-armlex4210.c            |   3 +
>  arch/arm/mach-exynos/mach-exynos4-dt.c            |   2 +
>  arch/arm/mach-exynos/mach-exynos5-dt.c            |   2 +
>  arch/arm/mach-exynos/mach-nuri.c                  |   2 +
>  arch/arm/mach-exynos/mach-origen.c                |   3 +
>  arch/arm/mach-exynos/mach-smdk4x12.c              |   2 +
>  arch/arm/mach-exynos/mach-smdkv310.c              |   3 +
>  arch/arm/mach-exynos/setup-i2c0.c                 |   3 +-
>  arch/arm/mach-exynos/setup-sdhci-gpio.c           |   2 +-
>  arch/arm/mach-exynos/setup-usb-phy.c              |   8 +-
>  arch/arm/mach-s3c24xx/clock-s3c2440.c             |   5 +
>  arch/arm/mach-s3c24xx/common.c                    |   5 +
>  arch/arm/mach-s3c24xx/dma-s3c2410.c               |   2 -
>  arch/arm/mach-s3c24xx/dma-s3c2412.c               |   2 -
>  arch/arm/mach-s3c24xx/dma-s3c2440.c               |   2 -
>  arch/arm/mach-s3c24xx/dma-s3c2443.c               |   2 -
>  arch/arm/mach-s3c24xx/include/mach/debug-macro.S  |   2 +-
>  arch/arm/mach-s3c24xx/mach-rx1950.c               |   1 -
>  arch/arm/mach-s3c64xx/include/mach/debug-macro.S  |   2 +-
>  arch/arm/mach-s3c64xx/include/mach/gpio.h         |   4 +
>  arch/arm/mach-s3c64xx/setup-usb-phy.c             |   4 +-
>  arch/arm/mach-s5p64x0/include/mach/debug-macro.S  |   2 +-
>  arch/arm/mach-s5pc100/include/mach/debug-macro.S  |   2 +-
>  arch/arm/mach-s5pc100/setup-sdhci-gpio.c          |   1 -
>  arch/arm/mach-s5pv210/include/mach/debug-macro.S  |   2 +-
>  arch/arm/mach-s5pv210/setup-sdhci-gpio.c          |   1 -
>  arch/arm/mach-s5pv210/setup-usb-phy.c             |   4 +-
>  arch/arm/plat-samsung/Kconfig                     |   5 +
>  arch/arm/plat-samsung/Makefile                    |   3 +
>  arch/arm/plat-samsung/clock-clksrc.c              |   3 +
>  arch/arm/plat-samsung/devs.c                      |  17 +-
>  arch/arm/plat-samsung/include/plat/debug-macro.S  |  87 -------
>  arch/arm/plat-samsung/include/plat/gpio-core.h    |   3 +
>  arch/arm/plat-samsung/include/plat/regs-ac97.h    |  67 -----
>  arch/arm/plat-samsung/include/plat/regs-iic.h     |  56 -----
>  arch/arm/plat-samsung/include/plat/regs-iis.h     |  70 ------
>  arch/arm/plat-samsung/include/plat/regs-onenand.h |  63 -----
>  arch/arm/plat-samsung/include/plat/regs-rtc.h     |  71 ------
>  arch/arm/plat-samsung/include/plat/regs-sdhci.h   |  87 -------
>  arch/arm/plat-samsung/include/plat/regs-serial.h  | 282
> +--------------------- arch/arm/plat-samsung/include/plat/sdhci.h        |
>  56 +----
>  arch/arm/plat-samsung/include/plat/usb-phy.h      |   5 +-
>  arch/arm/plat-samsung/irq-vic-timer.c             |   1 +
>  arch/arm/plat-samsung/pm-gpio.c                   |   1 +
>  arch/arm/plat-samsung/pm.c                        |   1 +
>  arch/arm/plat-samsung/s5p-clock.c                 |   3 +
>  arch/arm/plat-samsung/s5p-irq.c                   |   1 +
>  drivers/cpufreq/Kconfig.arm                       |   4 +-
>  drivers/devfreq/Kconfig                           |   1 +
>  drivers/gpio/Makefile                             |   2 +-
>  drivers/i2c/busses/i2c-s3c2410.c                  |   3 +-
>  drivers/i2c/busses/i2c-s3c2410.h                  |  56 +++++
>  drivers/irqchip/exynos-combiner.c                 | 113 +++++----
>  drivers/media/platform/exynos-gsc/gsc-regs.c      |   1 -
>  drivers/media/platform/s5p-tv/sii9234_drv.c       |   3 -
>  drivers/mmc/host/Kconfig                          |   2 +-
>  drivers/mmc/host/sdhci-s3c-regs.h                 |  87 +++++++
>  drivers/mmc/host/sdhci-s3c.c                      |   5 +-
>  drivers/mtd/onenand/samsung.c                     |   4 +-
>  drivers/mtd/onenand/samsung.h                     |  61 +++++
>  drivers/pwm/pwm-samsung.c                         |  60 +++--
>  drivers/rtc/rtc-s3c.c                             |   3 +-
>  drivers/rtc/rtc-s3c.h                             |  70 ++++++
>  drivers/spi/spi-s3c64xx.c                         | 107 ++++----
>  drivers/thermal/exynos_thermal.c                  |   2 -
>  drivers/tty/serial/samsung.c                      |  17 +-
>  drivers/tty/serial/samsung.h                      |   4 +-
>  drivers/usb/host/ehci-s5p.c                       |   1 -
>  drivers/usb/host/ohci-exynos.c                    |   1 -
>  drivers/video/Kconfig                             |   2 +-
>  drivers/video/exynos/exynos_mipi_dsi.c            |   2 -
>  drivers/video/exynos/exynos_mipi_dsi_common.c     |   2 -
>  drivers/video/exynos/exynos_mipi_dsi_lowlevel.c   |   2 -
>  drivers/watchdog/Kconfig                          |   1 +
>  include/linux/platform_data/mmc-sdhci-s3c.h       |  56 +++++
>  include/linux/platform_data/spi-s3c64xx.h         |   3 +
>  include/linux/serial_s3c.h                        | 260
> ++++++++++++++++++++ sound/soc/samsung/ac97.c                          | 
> 17 +-
>  sound/soc/samsung/dma.c                           | 104 ++++----
>  sound/soc/samsung/dma.h                           |   4 +-
>  sound/soc/samsung/h1940_uda1380.c                 |   2 +-
>  sound/soc/samsung/i2s.c                           |   9 +-
>  sound/soc/samsung/idma.c                          |  10 +-
>  sound/soc/samsung/neo1973_wm8753.c                |   2 +-
>  sound/soc/samsung/pcm.c                           |  13 -
>  sound/soc/samsung/regs-ac97.h                     |  67 +++++
>  sound/soc/samsung/regs-iis.h                      |  70 ++++++
>  sound/soc/samsung/rx1950_uda1380.c                |   2 +-
>  sound/soc/samsung/s3c2412-i2s.c                   |  10 -
>  sound/soc/samsung/s3c24xx-i2s.c                   |  12 +-
>  sound/soc/samsung/s3c24xx_uda134x.c               |   2 +-
>  sound/soc/samsung/spdif.c                         |   6 -
>  105 files changed, 1262 insertions(+), 1208 deletions(-)
>  create mode 100644 arch/arm/include/debug/exynos.S
>  create mode 100644 arch/arm/include/debug/samsung.S
>  delete mode 100644 arch/arm/mach-exynos/include/mach/debug-macro.S
>  delete mode 100644 arch/arm/plat-samsung/include/plat/debug-macro.S
>  delete mode 100644 arch/arm/plat-samsung/include/plat/regs-ac97.h
>  delete mode 100644 arch/arm/plat-samsung/include/plat/regs-iic.h
>  delete mode 100644 arch/arm/plat-samsung/include/plat/regs-iis.h
>  delete mode 100644 arch/arm/plat-samsung/include/plat/regs-onenand.h
>  delete mode 100644 arch/arm/plat-samsung/include/plat/regs-rtc.h
>  delete mode 100644 arch/arm/plat-samsung/include/plat/regs-sdhci.h
>  create mode 100644 drivers/i2c/busses/i2c-s3c2410.h
>  create mode 100644 drivers/mmc/host/sdhci-s3c-regs.h
>  create mode 100644 drivers/mtd/onenand/samsung.h
>  create mode 100644 drivers/rtc/rtc-s3c.h
>  create mode 100644 include/linux/platform_data/mmc-sdhci-s3c.h
>  create mode 100644 include/linux/serial_s3c.h
>  create mode 100644 sound/soc/samsung/regs-ac97.h
>  create mode 100644 sound/soc/samsung/regs-iis.h

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

* [PATCH 00/23] RFC: exynos multiplatform support
  2013-03-05 20:50 ` Heiko Stübner
@ 2013-03-05 21:24   ` Arnd Bergmann
  2013-03-05 21:54     ` Arnd Bergmann
  0 siblings, 1 reply; 49+ messages in thread
From: Arnd Bergmann @ 2013-03-05 21:24 UTC (permalink / raw)
  To: linux-arm-kernel

On Tuesday 05 March 2013, Heiko St?bner wrote:
> If I remember correctly Kgene mentioning some time back, that someone was 
> working on converting the s3c dma to dmaengine, but I never heard anything 
> more about it.

Ok, let's see if we can find out what happened to that.

> So personally I would be grateful, for people not breaking my devices :-) .

I'm sure we can find a way. It's also clear that the current s3c_dma
does not have a bright future.

> On an unrelated note, exists some sort of documentation for creating dmaengine 
> drivers somewhere? Documentation/* seems to always be only targetted at device 
> driver writers and my own DMA knowledge is still stuck at the theoretical 
> level they teach in generic operating-systems university courses.

I think we only have Documentation/dmaengine.txt, which is targetted at
people using the dmaengine API, not at someone writing a driver.

I have only limited experience myself, but I know that it comes down
to filling the operations of a struct dma_device. A slight complication
is that the dmaengine interface handles both memory-to-memory transfers
and slave device transfers (the slave being the device that you are
talking to), and you have to know which parts are relevant for your
use case. You probably only need the slave interface, but it can seem
like it's bolted to the side of the original API.

drivers/dma/mxs-dma.c looks like a reasonable driver that one can
use as an example. The s3c64xx_dma code is also interesting because
it has both an implementation of the s3c_dma interface in
arch/arm/mach-s3c64xx/dma.c and one using the generic interface in
drivers/dma/amba-pl08x.c. The latter also implements a "virtual
channel" concept that you probably don't need.

	Arnd

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

* [PATCH 00/23] RFC: exynos multiplatform support
  2013-03-05 21:24   ` Arnd Bergmann
@ 2013-03-05 21:54     ` Arnd Bergmann
  2013-03-05 22:12       ` Tomasz Figa
  2013-03-05 22:25       ` Heiko Stübner
  0 siblings, 2 replies; 49+ messages in thread
From: Arnd Bergmann @ 2013-03-05 21:54 UTC (permalink / raw)
  To: linux-arm-kernel

On Tuesday 05 March 2013, Arnd Bergmann wrote:
> The s3c64xx_dma code is also interesting because
> it has both an implementation of the s3c_dma interface in
> arch/arm/mach-s3c64xx/dma.c and one using the generic interface in
> drivers/dma/amba-pl08x.c. 

This actually brings me to an interesting idea: the s3c64xx SPI driver
is used with the regular dmaengine API and pl330 on S5P and Exynos,
but with the s3c-dma interface and pl080 on S3C64xx.

If we just convert S3C64xx to use the pl080 dmaengine driver
instead, we can apply my SPI patch without breaking anything.

We still need a solution for the ASoC drivers, but they are
not as essential. We could probably move the wrapper files
from plat-samsung/*dma*.c to sounds/soc/samsung when that becomes
the only remaining user.

There is also drivers/mmc/host/s3cmci.c, which uses the s3c-dma
interface, but it is only used on s3c24xx, not s3c64xx or later.

	Arnd

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

* [PATCH 00/23] RFC: exynos multiplatform support
  2013-03-05 21:54     ` Arnd Bergmann
@ 2013-03-05 22:12       ` Tomasz Figa
  2013-03-05 22:21         ` Arnd Bergmann
  2013-03-05 22:25       ` Heiko Stübner
  1 sibling, 1 reply; 49+ messages in thread
From: Tomasz Figa @ 2013-03-05 22:12 UTC (permalink / raw)
  To: linux-arm-kernel

On Tuesday 05 of March 2013 21:54:22 Arnd Bergmann wrote:
> On Tuesday 05 March 2013, Arnd Bergmann wrote:
> > The s3c64xx_dma code is also interesting because
> > it has both an implementation of the s3c_dma interface in
> > arch/arm/mach-s3c64xx/dma.c and one using the generic interface in
> > drivers/dma/amba-pl08x.c.
> 
> This actually brings me to an interesting idea: the s3c64xx SPI driver
> is used with the regular dmaengine API and pl330 on S5P and Exynos,
> but with the s3c-dma interface and pl080 on S3C64xx.
> 
> If we just convert S3C64xx to use the pl080 dmaengine driver
> instead, we can apply my SPI patch without breaking anything.

AFAIR, the PL080 in S3C64xx is a slightly customized variant and requires 
some modifications to the driver. However I'm saying this only based on 
what I remember from the past, as I haven't checked current version of the 
driver yet, so it's possible that it has been modified already.

I believe I will eventually have to take a look at it anyway, as it's a 
necessary step towards S3C64xx DT support.

Best regards,
Tomasz

> We still need a solution for the ASoC drivers, but they are
> not as essential. We could probably move the wrapper files
> from plat-samsung/*dma*.c to sounds/soc/samsung when that becomes
> the only remaining user.
> 
> There is also drivers/mmc/host/s3cmci.c, which uses the s3c-dma
> interface, but it is only used on s3c24xx, not s3c64xx or later.
> 
> 	Arnd
> --
> To unsubscribe from this list: send the line "unsubscribe
> linux-samsung-soc" in the body of a message to
> majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 00/23] RFC: exynos multiplatform support
  2013-03-05 22:12       ` Tomasz Figa
@ 2013-03-05 22:21         ` Arnd Bergmann
  0 siblings, 0 replies; 49+ messages in thread
From: Arnd Bergmann @ 2013-03-05 22:21 UTC (permalink / raw)
  To: linux-arm-kernel

On Tuesday 05 March 2013, Tomasz Figa wrote:
> AFAIR, the PL080 in S3C64xx is a slightly customized variant and requires 
> some modifications to the driver. However I'm saying this only based on 
> what I remember from the past, as I haven't checked current version of the 
> driver yet, so it's possible that it has been modified already.
> 
> I believe I will eventually have to take a look at it anyway, as it's a 
> necessary step towards S3C64xx DT support.

Ok. Let me know if you need any help adding DT support to the pl08x driver.
It would be nice to have that for SPEAr, Versatile and lpce32xx as well.

All three currently have full DT support except for the DMA binding,
since the common code for that was only added in 3.9-rc1.

	Arnd

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

* [PATCH 00/23] RFC: exynos multiplatform support
  2013-03-05 21:54     ` Arnd Bergmann
  2013-03-05 22:12       ` Tomasz Figa
@ 2013-03-05 22:25       ` Heiko Stübner
  2013-03-05 22:43         ` Arnd Bergmann
  1 sibling, 1 reply; 49+ messages in thread
From: Heiko Stübner @ 2013-03-05 22:25 UTC (permalink / raw)
  To: linux-arm-kernel

Am Dienstag, 5. M?rz 2013, 22:54:22 schrieb Arnd Bergmann:
> On Tuesday 05 March 2013, Arnd Bergmann wrote:
> > The s3c64xx_dma code is also interesting because
> > it has both an implementation of the s3c_dma interface in
> > arch/arm/mach-s3c64xx/dma.c and one using the generic interface in
> > drivers/dma/amba-pl08x.c.
> 
> This actually brings me to an interesting idea: the s3c64xx SPI driver
> is used with the regular dmaengine API and pl330 on S5P and Exynos,
> but with the s3c-dma interface and pl080 on S3C64xx.
>
> If we just convert S3C64xx to use the pl080 dmaengine driver
> instead, we can apply my SPI patch without breaking anything.

The S3C24XX starting from S3C2443 (including S3C2416 and S3C2450) also use the
s3c64xx-spi driver.

My argument has of course the problem of me seemingly being the only user of
it currently and it being stuff not in mainline yet [0] :-) .

But on the other hand, it's no use anyway staying attached to old cruft, so
it also wouldn't be a problem to go your way. I'll just try to come up with
a dmaengine driver for s3c24xx after common-clk and pinctrl ;-) .


[0] https://github.com/mmind/linux-es600/blob/topic/es600-devel/arch/arm/mach-
s3c24xx/mach-as090.c#L138


> We still need a solution for the ASoC drivers, but they are
> not as essential. We could probably move the wrapper files
> from plat-samsung/*dma*.c to sounds/soc/samsung when that becomes
> the only remaining user.

In ASoC there is also a clear distinction between the different SoC
generations. SND_SAMSUNG_I2S /_PCM /_AC97 ... is only used by newer SoCs
while SND_S3C24XX_I2S and SND_S3C_I2SV2_SOC is used by the legacy SoCs.

Of course "my subarch" is bitten again, as it's using the new sound
interface, but the same as above applies.


Heiko

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

* [PATCH 00/23] RFC: exynos multiplatform support
  2013-03-05 22:25       ` Heiko Stübner
@ 2013-03-05 22:43         ` Arnd Bergmann
  0 siblings, 0 replies; 49+ messages in thread
From: Arnd Bergmann @ 2013-03-05 22:43 UTC (permalink / raw)
  To: linux-arm-kernel

On Tuesday 05 March 2013, Heiko St?bner wrote:
> Am Dienstag, 5. M?rz 2013, 22:54:22 schrieb Arnd Bergmann:
> > On Tuesday 05 March 2013, Arnd Bergmann wrote:
> 
> > We still need a solution for the ASoC drivers, but they are
> > not as essential. We could probably move the wrapper files
> > from plat-samsung/*dma*.c to sounds/soc/samsung when that becomes
> > the only remaining user.
> 
> In ASoC there is also a clear distinction between the different SoC
> generations. SND_SAMSUNG_I2S /_PCM /_AC97 ... is only used by newer SoCs
> while SND_S3C24XX_I2S and SND_S3C_I2SV2_SOC is used by the legacy SoCs.

Well, the only file that really needs to get changed is dma.c, which
seems to be used by both the old and the new drivers.

	Arnd

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

* [PATCH 00/23] RFC: exynos multiplatform support
  2013-03-05 19:19   ` Arnd Bergmann
@ 2013-03-05 22:48     ` Tomasz Figa
  2013-03-06 10:50       ` Arnd Bergmann
  2013-03-06 22:14       ` Heiko Stübner
  0 siblings, 2 replies; 49+ messages in thread
From: Tomasz Figa @ 2013-03-05 22:48 UTC (permalink / raw)
  To: linux-arm-kernel

On Tuesday 05 of March 2013 19:19:02 Arnd Bergmann wrote:
> On Tuesday 05 March 2013, Tomasz Figa wrote:
> > > With this patch set, we can build mach-exynos as part
> > > of a multiplatform kernel, with the following caveats:
> > > 
> > > * Only DT based boards are supported
> > 
> > As far as I'm aware, there are plans to drop non-DT Exynos support.
> > Kgene should know more on this.
> 
> Yes, that was my understanding as well. It might not actually be too
> hard to get multiplatform working with the ATAGS based board files
> (we do that on some of the other platforms), but there is probably
> no reason to try hard.
> 
> > > * Moving to common-clk breaks things including cpufreq
> > > 
> > >   and others. Thomas is working on a patch for this
> > 
> > We have several patches internally for fixing things up to run
> > correclty with common-clk. I'll see if we can post some patches.
> 
> Ok, excellent.
> 
> > > * We disable the gpio implementation, which also breaks
> > > 
> > >   stuff, but Thomas has a patch already
> > 
> > The legacy GPIO code is needed only for non-DT case. DT-case uses the
> > new pinctrl-samsung driver, which is (AFAIK) multiplatform-aware.
> 
> Please have a closer look at the "ARM: exynos: work around missing gpio
> code on multiplatform" patch, I think there a few files I had to touch
> that actually rely on the legacy gpio code:
> 
> * the pm-gpio.c file
> * the s3c_i2c0_cfg_gpio function
> * the eint irqchip
> 
> If none of these are needed for DT-based systems, we should probably
> build that code conditionally based on the CONFIG_EXYNOS_ATAGS symbol
> I introduced.

Yes, none of them are needed for DT-based systems.

> > > * sparsemem support is not available on multiplatform
> > 
> > There was some discussion some time ago whether we really need
> > sparsemem on Exynos. If I remember correctly, it turned out that we
> > don't. So this is not really an issue.
> 
> Ok, good.
> 
> > > Arnd Bergmann (23):
> > >   ARM: exynos: introduce EXYNOS_ATAGS symbol
> > >   irqchip: exynos: remove dependency on mach/irqs.h
> > >   tty: serial/samsung: prepare for common clock API
> > >   tty: serial/samsung: make register definitions global
> > >   tty: serial/samsung: fix modular build
> > >   ARM: exynos: move debug-macro.S to include/debug/
> > >   i2c: s3c2410: make header file local
> > >   mmc: sdhci-s3c: remove platform dependencies
> > >   usb: exynos: do not include plat/usb-phy.h
> > >   [media] exynos: remove unnecessary header inclusions
> > >   video/exynos: remove unnecessary header inclusions
> > >   thermal/exynos: remove unnecessary header inclusions
> > >   mtd: onenand/samsung: make regs-onenand.h file local
> > >   rtc: s3c: make header file local
> > >   spi: s3c64xx: move to generic dmaengine API
> > >   pwm: samsung: repair the worst MMIO abuses
> > 
> > I'm currently working (in my free time) on a series of cleanup patches
> > sanitizing Samsung PWM code for S3C64xx and S5PV210 DT (and
> > multiplatform) support.
> 
> Ah, nice.
> 
> > On those platforms it is a bit more complex case as there are two
> > blocks of code that access the same hardware - samsung-time (using
> > two PWM channels for clocksource and clock events) and pwm-samsung.
> > 
> > Hopefully, I will have some patches ready soon.
> 
> How are you planning to solve this? Do you want to have a combined
> driver that registers both a clocksource and a pwm?

Let's start with a quick introduction to the s3c-pwm hardware. Each 
channel has its own timer value, compare and reload value registers, so 
they don't need any extra locking. However there are additional shared 
configuration registers, containing things such as start and reload bits 
for all channels, prescaler and main divisor values, etc. Those registers 
needs synchronization.

Now there are several possible approaches:

1) A brute force one - two separate drivers, based on the fact that the
   clocksource driver will be used only on uniprocessor systems, so
   a simple _irqsave when accessing a shared register in both will 
   guarantee correct synchronization.

2) Two separate drivers with some synchronized shared code accessing 
   registers (_start, _stop, _set_reload, _set_prescaler, _set_divisor, 
   etc.; all using a shared spinlock).

3) Single driver registering PWM channels, clocksource and clock event 
   device. This does not seem like a bad idea, since the whole code for 
   configuration of the PWM block would reside in one location and there 
   would be no redundancy. However there is a question where such driver 
   should be placed - drivers/clocksource, drivers/pwm, or maybe somewhere 
   else?

Personally I wanted to go with first option, which would require least 
amount of changes to existing code, at a cost of some code duplication 
(but some PWM code is duplicated already).

Best regards,
Tomasz

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

* [PATCH 18/23] ASoC: samsung: convert to dmaengine API
  2013-03-05 17:42 ` [PATCH 18/23] ASoC: samsung: convert to dmaengine API Arnd Bergmann
@ 2013-03-06  8:58   ` Padma Venkat
  2013-03-06 12:01     ` Arnd Bergmann
  0 siblings, 1 reply; 49+ messages in thread
From: Padma Venkat @ 2013-03-06  8:58 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Arnd,

On Tue, Mar 5, 2013 at 11:12 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> In order to build the exynos kernel with CONFIG_ARCH_MULTIPLATFORM,
> we must convert all users of the Samsung private DMA interface to
> the generic dmaengine API. This converts the sound/soc drivers,
> breaking the older s3c platforms in the process, since they do not
> support the dmaengine interface yet.
>
> This patch must not get mainlined until mach-s3c* is also converted,
> but can be used for testing in the meantime.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  sound/soc/samsung/ac97.c        |  15 ------
>  sound/soc/samsung/dma.c         | 104 +++++++++++++++++++++-------------------
>  sound/soc/samsung/dma.h         |   4 +-
>  sound/soc/samsung/i2s.c         |   9 +---
>  sound/soc/samsung/pcm.c         |  13 -----
>  sound/soc/samsung/s3c2412-i2s.c |  10 ----
>  sound/soc/samsung/s3c24xx-i2s.c |  10 ----
>  sound/soc/samsung/spdif.c       |   6 ---
>  8 files changed, 57 insertions(+), 114 deletions(-)
>
> diff --git a/sound/soc/samsung/ac97.c b/sound/soc/samsung/ac97.c
> index c76abdf..214f454 100644
> --- a/sound/soc/samsung/ac97.c
> +++ b/sound/soc/samsung/ac97.c
> @@ -39,30 +39,15 @@ struct s3c_ac97_info {
>  };
>  static struct s3c_ac97_info s3c_ac97;
>
> -static struct s3c2410_dma_client s3c_dma_client_out = {
> -       .name = "AC97 PCMOut"
> -};
> -
> -static struct s3c2410_dma_client s3c_dma_client_in = {
> -       .name = "AC97 PCMIn"
> -};
> -
> -static struct s3c2410_dma_client s3c_dma_client_micin = {
> -       .name = "AC97 MicIn"
> -};
> -
>  static struct s3c_dma_params s3c_ac97_pcm_out = {
> -       .client         = &s3c_dma_client_out,
>         .dma_size       = 4,
>  };
>
>  static struct s3c_dma_params s3c_ac97_pcm_in = {
> -       .client         = &s3c_dma_client_in,
>         .dma_size       = 4,
>  };
>
>  static struct s3c_dma_params s3c_ac97_mic_in = {
> -       .client         = &s3c_dma_client_micin,
>         .dma_size       = 4,
>  };
>
> diff --git a/sound/soc/samsung/dma.c b/sound/soc/samsung/dma.c
> index 21b7926..67b8dcc 100644
> --- a/sound/soc/samsung/dma.c
> +++ b/sound/soc/samsung/dma.c
> @@ -16,14 +16,14 @@
>
>  #include <linux/slab.h>
>  #include <linux/dma-mapping.h>
> +#include <linux/dmaengine.h>
>  #include <linux/module.h>
> +#include <linux/amba/pl330.h>
>
>  #include <sound/soc.h>
>  #include <sound/pcm_params.h>
>
>  #include <asm/dma.h>
> -#include <mach/hardware.h>
> -#include <mach/dma.h>
>
>  #include "dma.h"
>
> @@ -67,12 +67,16 @@ static void audio_buffdone(void *data);
>   * place a dma buffer onto the queue for the dma system
>   * to handle.
>   */
> +
>  static void dma_enqueue(struct snd_pcm_substream *substream)
>  {
>         struct runtime_data *prtd = substream->runtime->private_data;
>         dma_addr_t pos = prtd->dma_pos;
> +       unsigned long period = prtd->dma_period;
>         unsigned int limit;
> -       struct samsung_dma_prep dma_info;
> +       enum dma_transfer_direction direction;
> +       struct dma_chan *chan = prtd->params->ch;
> +       struct dma_async_tx_descriptor *desc;
>
>         pr_debug("Entered %s\n", __func__);
>
> @@ -81,29 +85,30 @@ static void dma_enqueue(struct snd_pcm_substream *substream)
>         pr_debug("%s: loaded %d, limit %d\n",
>                                 __func__, prtd->dma_loaded, limit);
>
> -       dma_info.cap = (samsung_dma_has_circular() ? DMA_CYCLIC : DMA_SLAVE);
> -       dma_info.direction =
> -               (substream->stream == SNDRV_PCM_STREAM_PLAYBACK
> -               ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM);
> -       dma_info.fp = audio_buffdone;
> -       dma_info.fp_param = substream;
> -       dma_info.period = prtd->dma_period;
> -       dma_info.len = prtd->dma_period*limit;
> +       direction = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK
> +                    ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM);
>
>         while (prtd->dma_loaded < limit) {
>                 pr_debug("dma_loaded: %d\n", prtd->dma_loaded);
>
> -               if ((pos + dma_info.period) > prtd->dma_end) {
> -                       dma_info.period  = prtd->dma_end - pos;
> +               if ((pos + period) > prtd->dma_end) {
> +                       period  = prtd->dma_end - pos;
>                         pr_debug("%s: corrected dma len %ld\n",
> -                                       __func__, dma_info.period);
> +                                       __func__, period);
>                 }
>
> -               dma_info.buf = pos;
> -               prtd->params->ops->prepare(prtd->params->ch, &dma_info);
> +               desc = dmaengine_prep_dma_cyclic(chan, pos,
> +                        prtd->dma_period*limit, period, direction,
> +                       DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
> +
> +               if (desc) {
> +                       desc->callback = audio_buffdone;
> +                       desc->callback_param = substream;
> +                       dmaengine_submit(desc);
> +               }
>
>                 prtd->dma_loaded++;
> -               pos += prtd->dma_period;
> +               pos += period;
>                 if (pos >= prtd->dma_end)
>                         pos = prtd->dma_start;
>         }
> @@ -125,13 +130,6 @@ static void audio_buffdone(void *data)
>
>                 if (substream)
>                         snd_pcm_period_elapsed(substream);
> -
> -               spin_lock(&prtd->lock);
> -               if (!samsung_dma_has_circular()) {
> -                       prtd->dma_loaded--;
> -                       dma_enqueue(substream);
> -               }
> -               spin_unlock(&prtd->lock);
>         }
>  }
>
> @@ -144,8 +142,6 @@ static int dma_hw_params(struct snd_pcm_substream *substream,
>         unsigned long totbytes = params_buffer_bytes(params);
>         struct s3c_dma_params *dma =
>                 snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
> -       struct samsung_dma_req req;
> -       struct samsung_dma_config config;
>
>         pr_debug("Entered %s\n", __func__);
>
> @@ -157,26 +153,37 @@ static int dma_hw_params(struct snd_pcm_substream *substream,
>         /* this may get called several times by oss emulation
>          * with different params -HW */
>         if (prtd->params == NULL) {
> +               struct dma_slave_config config;
> +               dma_cap_mask_t mask;
> +
>                 /* prepare DMA */
>                 prtd->params = dma;
>
> -               pr_debug("params %p, client %p, channel %d\n", prtd->params,
> -                       prtd->params->client, prtd->params->channel);
> -
> -               prtd->params->ops = samsung_dma_get_ops();
> -
> -               req.cap = (samsung_dma_has_circular() ?
> -                       DMA_CYCLIC : DMA_SLAVE);
> -               req.client = prtd->params->client;
> -               config.direction =
> -                       (substream->stream == SNDRV_PCM_STREAM_PLAYBACK
> -                       ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM);
> -               config.width = prtd->params->dma_size;
> -               config.fifo = prtd->params->dma_addr;
> -               prtd->params->ch = prtd->params->ops->request(
> -                               prtd->params->channel, &req, rtd->cpu_dai->dev,
> -                               prtd->params->ch_name);
> -               prtd->params->ops->config(prtd->params->ch, &config);
> +               pr_debug("params %p, channel %d\n", prtd->params,
> +                        prtd->params->channel);
> +
> +               dma_cap_zero(mask);
> +               dma_cap_set(DMA_CYCLIC, mask);
> +
> +               prtd->params->ch = dma_request_slave_channel_compat(mask,
> +                       pl330_filter, (void *)prtd->params->channel,
> +                       rtd->cpu_dai->dev, prtd->params->ch_name);
> +
> +               memset(&config, 0, sizeof(struct dma_slave_config));
> +
> +               if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
> +                       config.direction = DMA_MEM_TO_DEV;
> +                       config.dst_addr = prtd->params->dma_size;
> +                       config.dst_addr_width = prtd->params->dma_addr;

dma_addr and dma_size got interchanged.

Except the above one I tested this patch on 5250. It's working fine.

> +                       config.dst_maxburst = 1;
> +                       dmaengine_slave_config(prtd->params->ch, &config);
> +               } else {
> +                       config.direction = DMA_DEV_TO_MEM;
> +                       config.src_addr = prtd->params->dma_addr;
> +                       config.src_addr_width = prtd->params->dma_size;
> +                       config.src_maxburst = 1;
> +                       dmaengine_slave_config(prtd->params->ch, &config);
> +               }
>         }
>
>         snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
> @@ -203,9 +210,8 @@ static int dma_hw_free(struct snd_pcm_substream *substream)
>         snd_pcm_set_runtime_buffer(substream, NULL);
>
>         if (prtd->params) {
> -               prtd->params->ops->flush(prtd->params->ch);
> -               prtd->params->ops->release(prtd->params->ch,
> -                                       prtd->params->client);
> +               dmaengine_terminate_all(prtd->params->ch);
> +               dma_release_channel(prtd->params->ch);
>                 prtd->params = NULL;
>         }
>
> @@ -225,7 +231,7 @@ static int dma_prepare(struct snd_pcm_substream *substream)
>                 return 0;
>
>         /* flush the DMA channel */
> -       prtd->params->ops->flush(prtd->params->ch);
> +       dmaengine_terminate_all(prtd->params->ch);
>
>         prtd->dma_loaded = 0;
>         prtd->dma_pos = prtd->dma_start;
> @@ -248,12 +254,12 @@ static int dma_trigger(struct snd_pcm_substream *substream, int cmd)
>         switch (cmd) {
>         case SNDRV_PCM_TRIGGER_START:
>                 prtd->state |= ST_RUNNING;
> -               prtd->params->ops->trigger(prtd->params->ch);
> +               dma_async_issue_pending(prtd->params->ch);
>                 break;
>
>         case SNDRV_PCM_TRIGGER_STOP:
>                 prtd->state &= ~ST_RUNNING;
> -               prtd->params->ops->stop(prtd->params->ch);
> +               dmaengine_terminate_all(prtd->params->ch);
>                 break;
>
>         default:
> diff --git a/sound/soc/samsung/dma.h b/sound/soc/samsung/dma.h
> index 189a7a6..f7381be 100644
> --- a/sound/soc/samsung/dma.h
> +++ b/sound/soc/samsung/dma.h
> @@ -13,12 +13,10 @@
>  #define _S3C_AUDIO_H
>
>  struct s3c_dma_params {
> -       struct s3c2410_dma_client *client;      /* stream identifier */
>         int channel;                            /* Channel ID */
>         dma_addr_t dma_addr;
>         int dma_size;                   /* Size of the DMA transfer */
> -       unsigned ch;
> -       struct samsung_dma_ops *ops;
> +       struct dma_chan *ch;
>         char *ch_name;
>  };
>
> diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
> index d7231e3..2eed7a3 100644
> --- a/sound/soc/samsung/i2s.c
> +++ b/sound/soc/samsung/i2s.c
> @@ -18,12 +18,11 @@
>  #include <linux/of.h>
>  #include <linux/of_gpio.h>
>  #include <linux/pm_runtime.h>
> +#include <linux/dmaengine.h>
>
>  #include <sound/soc.h>
>  #include <sound/pcm_params.h>
>
> -#include <mach/dma.h>
> -
>  #include <linux/platform_data/asoc-s3c.h>
>
>  #include "dma.h"
> @@ -1183,11 +1182,7 @@ static int samsung_i2s_probe(struct platform_device *pdev)
>
>         pri_dai->dma_playback.dma_addr = regs_base + I2STXD;
>         pri_dai->dma_capture.dma_addr = regs_base + I2SRXD;
> -       pri_dai->dma_playback.client =
> -               (struct s3c2410_dma_client *)&pri_dai->dma_playback;
>         pri_dai->dma_playback.ch_name = "tx";
> -       pri_dai->dma_capture.client =
> -               (struct s3c2410_dma_client *)&pri_dai->dma_capture;
>         pri_dai->dma_capture.ch_name = "rx";
>         pri_dai->dma_playback.dma_size = 4;
>         pri_dai->dma_capture.dma_size = 4;
> @@ -1205,8 +1200,6 @@ static int samsung_i2s_probe(struct platform_device *pdev)
>                         goto err;
>                 }
>                 sec_dai->dma_playback.dma_addr = regs_base + I2STXDS;
> -               sec_dai->dma_playback.client =
> -                       (struct s3c2410_dma_client *)&sec_dai->dma_playback;
>                 sec_dai->dma_playback.ch_name = "tx-sec";
>
>                 if (!np) {
> diff --git a/sound/soc/samsung/pcm.c b/sound/soc/samsung/pcm.c
> index 13bab79..525b2d2 100644
> --- a/sound/soc/samsung/pcm.c
> +++ b/sound/soc/samsung/pcm.c
> @@ -20,7 +20,6 @@
>  #include <sound/pcm_params.h>
>
>  #include <linux/platform_data/asoc-s3c.h>
> -#include <mach/dma.h>
>
>  #include "dma.h"
>  #include "pcm.h"
> @@ -132,32 +131,20 @@ struct s3c_pcm_info {
>         struct s3c_dma_params   *dma_capture;
>  };
>
> -static struct s3c2410_dma_client s3c_pcm_dma_client_out = {
> -       .name           = "PCM Stereo out"
> -};
> -
> -static struct s3c2410_dma_client s3c_pcm_dma_client_in = {
> -       .name           = "PCM Stereo in"
> -};
> -
>  static struct s3c_dma_params s3c_pcm_stereo_out[] = {
>         [0] = {
> -               .client         = &s3c_pcm_dma_client_out,
>                 .dma_size       = 4,
>         },
>         [1] = {
> -               .client         = &s3c_pcm_dma_client_out,
>                 .dma_size       = 4,
>         },
>  };
>
>  static struct s3c_dma_params s3c_pcm_stereo_in[] = {
>         [0] = {
> -               .client         = &s3c_pcm_dma_client_in,
>                 .dma_size       = 4,
>         },
>         [1] = {
> -               .client         = &s3c_pcm_dma_client_in,
>                 .dma_size       = 4,
>         },
>  };
> diff --git a/sound/soc/samsung/s3c2412-i2s.c b/sound/soc/samsung/s3c2412-i2s.c
> index 2213377..d43f00e 100644
> --- a/sound/soc/samsung/s3c2412-i2s.c
> +++ b/sound/soc/samsung/s3c2412-i2s.c
> @@ -31,23 +31,13 @@
>  #include "regs-i2s-v2.h"
>  #include "s3c2412-i2s.h"
>
> -static struct s3c2410_dma_client s3c2412_dma_client_out = {
> -       .name           = "I2S PCM Stereo out"
> -};
> -
> -static struct s3c2410_dma_client s3c2412_dma_client_in = {
> -       .name           = "I2S PCM Stereo in"
> -};
> -
>  static struct s3c_dma_params s3c2412_i2s_pcm_stereo_out = {
> -       .client         = &s3c2412_dma_client_out,
>         .channel        = DMACH_I2S_OUT,
>         .dma_addr       = S3C2410_PA_IIS + S3C2412_IISTXD,
>         .dma_size       = 4,
>  };
>
>  static struct s3c_dma_params s3c2412_i2s_pcm_stereo_in = {
> -       .client         = &s3c2412_dma_client_in,
>         .channel        = DMACH_I2S_IN,
>         .dma_addr       = S3C2410_PA_IIS + S3C2412_IISRXD,
>         .dma_size       = 4,
> diff --git a/sound/soc/samsung/s3c24xx-i2s.c b/sound/soc/samsung/s3c24xx-i2s.c
> index a7b17c1..d68c23d 100644
> --- a/sound/soc/samsung/s3c24xx-i2s.c
> +++ b/sound/soc/samsung/s3c24xx-i2s.c
> @@ -29,23 +29,13 @@
>  #include "dma.h"
>  #include "s3c24xx-i2s.h"
>
> -static struct s3c2410_dma_client s3c24xx_dma_client_out = {
> -       .name = "I2S PCM Stereo out"
> -};
> -
> -static struct s3c2410_dma_client s3c24xx_dma_client_in = {
> -       .name = "I2S PCM Stereo in"
> -};
> -
>  static struct s3c_dma_params s3c24xx_i2s_pcm_stereo_out = {
> -       .client         = &s3c24xx_dma_client_out,
>         .channel        = DMACH_I2S_OUT,
>         .dma_addr       = S3C2410_PA_IIS + S3C2410_IISFIFO,
>         .dma_size       = 2,
>  };
>
>  static struct s3c_dma_params s3c24xx_i2s_pcm_stereo_in = {
> -       .client         = &s3c24xx_dma_client_in,
>         .channel        = DMACH_I2S_IN,
>         .dma_addr       = S3C2410_PA_IIS + S3C2410_IISFIFO,
>         .dma_size       = 2,
> diff --git a/sound/soc/samsung/spdif.c b/sound/soc/samsung/spdif.c
> index 5008e5b..5c78c78 100644
> --- a/sound/soc/samsung/spdif.c
> +++ b/sound/soc/samsung/spdif.c
> @@ -18,7 +18,6 @@
>  #include <sound/pcm_params.h>
>
>  #include <linux/platform_data/asoc-s3c.h>
> -#include <mach/dma.h>
>
>  #include "dma.h"
>  #include "spdif.h"
> @@ -94,10 +93,6 @@ struct samsung_spdif_info {
>         struct s3c_dma_params   *dma_playback;
>  };
>
> -static struct s3c2410_dma_client spdif_dma_client_out = {
> -       .name           = "S/PDIF Stereo out",
> -};
> -
>  static struct s3c_dma_params spdif_stereo_out;
>  static struct samsung_spdif_info spdif_info;
>
> @@ -431,7 +426,6 @@ static int spdif_probe(struct platform_device *pdev)
>         }
>
>         spdif_stereo_out.dma_size = 2;
> -       spdif_stereo_out.client = &spdif_dma_client_out;
>         spdif_stereo_out.dma_addr = mem_res->start + DATA_OUTBUF;
>         spdif_stereo_out.channel = dma_res->start;
>
> --
> 1.8.1.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Thanks
Padma

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

* [PATCH 15/23] spi: s3c64xx: move to generic dmaengine API
  2013-03-05 17:42 ` [PATCH 15/23] spi: s3c64xx: move to generic dmaengine API Arnd Bergmann
@ 2013-03-06  9:14   ` Padma Venkat
  0 siblings, 0 replies; 49+ messages in thread
From: Padma Venkat @ 2013-03-06  9:14 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Arnd,

On Tue, Mar 5, 2013 at 11:12 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> The spi-s3c64xx uses a Samsung proprietary interface for
> talking to the DMA engine, which does not work with
> multiplatform kernels. Since the driver can also operate
> in PIO mode without any DMA, older platforms that do
> not support the DMA engine API will still work, although
> slower.
>
> The conversion was rather mechanical, since the samsung
> interface is just a shallow wrapper around the dmaengine
> interface.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  arch/arm/plat-samsung/devs.c              |  10 +++
>  drivers/spi/spi-s3c64xx.c                 | 107 ++++++++++++++----------------
>  include/linux/platform_data/spi-s3c64xx.h |   3 +
>  3 files changed, 62 insertions(+), 58 deletions(-)
>
> diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c
> index 76209c9..58fb02a 100644
> --- a/arch/arm/plat-samsung/devs.c
> +++ b/arch/arm/plat-samsung/devs.c
> @@ -10,6 +10,7 @@
>   * published by the Free Software Foundation.
>  */
>
> +#include <linux/amba/pl330.h>
>  #include <linux/kernel.h>
>  #include <linux/types.h>
>  #include <linux/interrupt.h>
> @@ -1551,6 +1552,9 @@ void __init s3c64xx_spi0_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
>         pd.num_cs = num_cs;
>         pd.src_clk_nr = src_clk_nr;
>         pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi0_cfg_gpio;
> +#ifdef CONFIG_PL330_DMA
> +       pd.filter = pl330_filter;
> +#endif
>
>         s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi0);
>  }
> @@ -1589,6 +1593,9 @@ void __init s3c64xx_spi1_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
>         pd.num_cs = num_cs;
>         pd.src_clk_nr = src_clk_nr;
>         pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi1_cfg_gpio;
> +#ifdef CONFIG_PL330_DMA
> +       pd.filter = pl330_filter;
> +#endif
>
>         s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi1);
>  }
> @@ -1627,6 +1634,9 @@ void __init s3c64xx_spi2_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
>         pd.num_cs = num_cs;
>         pd.src_clk_nr = src_clk_nr;
>         pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi2_cfg_gpio;
> +#ifdef CONFIG_PL330_DMA
> +       pd.filter = pl330_filter;
> +#endif
>
>         s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi2);
>  }
> diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
> index e862ab8..9be07a6 100644
> --- a/drivers/spi/spi-s3c64xx.c
> +++ b/drivers/spi/spi-s3c64xx.c
> @@ -22,8 +22,10 @@
>  #include <linux/workqueue.h>
>  #include <linux/interrupt.h>
>  #include <linux/delay.h>
> +#include <linux/amba/pl330.h>
>  #include <linux/clk.h>
>  #include <linux/dma-mapping.h>
> +#include <linux/dmaengine.h>
>  #include <linux/platform_device.h>
>  #include <linux/pm_runtime.h>
>  #include <linux/spi/spi.h>
> @@ -31,7 +33,6 @@
>  #include <linux/of.h>
>  #include <linux/of_gpio.h>
>
> -#include <mach/dma.h>
>  #include <linux/platform_data/spi-s3c64xx.h>
>
>  #define MAX_SPI_PORTS          3
> @@ -131,9 +132,9 @@
>  #define TXBUSY    (1<<3)
>
>  struct s3c64xx_spi_dma_data {
> -       unsigned                ch;
> +       struct dma_chan *ch;
>         enum dma_transfer_direction direction;
> -       enum dma_ch     dmach;
> +       unsigned int request;
>  };
>
>  /**
> @@ -195,16 +196,11 @@ struct s3c64xx_spi_driver_data {
>         unsigned                        cur_speed;
>         struct s3c64xx_spi_dma_data     rx_dma;
>         struct s3c64xx_spi_dma_data     tx_dma;
> -       struct samsung_dma_ops          *ops;
>         struct s3c64xx_spi_port_config  *port_conf;
>         unsigned int                    port_id;
>         unsigned long                   gpios[4];
>  };
>
> -static struct s3c2410_dma_client s3c64xx_spi_dma_client = {
> -       .name = "samsung-spi-dma",
> -};
> -
>  static void flush_fifo(struct s3c64xx_spi_driver_data *sdd)
>  {
>         void __iomem *regs = sdd->regs;
> @@ -285,50 +281,42 @@ static void prepare_dma(struct s3c64xx_spi_dma_data *dma,
>                                         unsigned len, dma_addr_t buf)
>  {
>         struct s3c64xx_spi_driver_data *sdd;
> -       struct samsung_dma_prep info;
> -       struct samsung_dma_config config;
> +       struct dma_slave_config config;
> +       struct scatterlist sg;
> +       struct dma_async_tx_descriptor *desc;
>
>         if (dma->direction == DMA_DEV_TO_MEM) {
>                 sdd = container_of((void *)dma,
>                         struct s3c64xx_spi_driver_data, rx_dma);
> -               config.direction = sdd->rx_dma.direction;
> -               config.fifo = sdd->sfr_start + S3C64XX_SPI_RX_DATA;
> -               config.width = sdd->cur_bpw / 8;
> -               sdd->ops->config(sdd->rx_dma.ch, &config);
> +               config.direction = dma->direction;
> +               config.src_addr = sdd->sfr_start + S3C64XX_SPI_RX_DATA;
> +               config.src_addr_width = sdd->cur_bpw / 8;
> +               config.src_maxburst = 1;
> +               dmaengine_slave_config(dma->ch, &config);
>         } else {
>                 sdd = container_of((void *)dma,
>                         struct s3c64xx_spi_driver_data, tx_dma);
> -               config.direction =  sdd->tx_dma.direction;
> -               config.fifo = sdd->sfr_start + S3C64XX_SPI_TX_DATA;
> -               config.width = sdd->cur_bpw / 8;
> -               sdd->ops->config(sdd->tx_dma.ch, &config);
> +               config.direction = dma->direction;
> +               config.dst_addr = sdd->sfr_start + S3C64XX_SPI_TX_DATA;
> +               config.dst_addr_width = sdd->cur_bpw / 8;
> +               config.dst_maxburst = 1;
> +               dmaengine_slave_config(dma->ch, &config);
>         }
>
> -       info.cap = DMA_SLAVE;
> -       info.len = len;
> -       info.fp = s3c64xx_spi_dmacb;
> -       info.fp_param = dma;
> -       info.direction = dma->direction;
> -       info.buf = buf;
> +       sg_init_table(&sg, 1);
> +       sg_dma_len(&sg) = len;
> +       sg_set_page(&sg, pfn_to_page(PFN_DOWN(buf)),
> +                   len, offset_in_page(buf));
> +       sg_dma_address(&sg) = buf;
>
> -       sdd->ops->prepare(dma->ch, &info);
> -       sdd->ops->trigger(dma->ch);
> -}
> +       desc = dmaengine_prep_slave_sg(dma->ch,
> +               &sg, 1, dma->direction, DMA_PREP_INTERRUPT);
>
> -static int acquire_dma(struct s3c64xx_spi_driver_data *sdd)
> -{
> -       struct samsung_dma_req req;
> -       struct device *dev = &sdd->pdev->dev;
> +       desc->callback = s3c64xx_spi_dmacb;
> +       desc->callback_param = dma;
>
> -       sdd->ops = samsung_dma_get_ops();
> -
> -       req.cap = DMA_SLAVE;
> -       req.client = &s3c64xx_spi_dma_client;
> -
> -       sdd->rx_dma.ch = sdd->ops->request(sdd->rx_dma.dmach, &req, dev, "rx");
> -       sdd->tx_dma.ch = sdd->ops->request(sdd->tx_dma.dmach, &req, dev, "tx");
> -
> -       return 1;
> +       dmaengine_submit(desc);
> +       dma_async_issue_pending(dma->ch);
>  }
>
>  static void enable_datapath(struct s3c64xx_spi_driver_data *sdd,
> @@ -713,9 +701,9 @@ static int s3c64xx_spi_transfer_one_message(struct spi_master *master,
>                 }
>
>                 /* Polling method for xfers not bigger than FIFO capacity */
> -               if (xfer->len <= ((FIFO_LVL_MASK(sdd) >> 1) + 1))
> -                       use_dma = 0;
> -               else
> +               use_dma = 0;
> +               if (sdd->rx_dma.ch && sdd->tx_dma.ch &&
> +                   (xfer->len > ((FIFO_LVL_MASK(sdd) >> 1) + 1)))
>                         use_dma = 1;
>
>                 spin_lock_irqsave(&sdd->lock, flags);
> @@ -750,10 +738,10 @@ static int s3c64xx_spi_transfer_one_message(struct spi_master *master,
>                         if (use_dma) {
>                                 if (xfer->tx_buf != NULL
>                                                 && (sdd->state & TXBUSY))
> -                                       sdd->ops->stop(sdd->tx_dma.ch);
> +                                       dmaengine_terminate_all(sdd->tx_dma.ch);
>                                 if (xfer->rx_buf != NULL
>                                                 && (sdd->state & RXBUSY))
> -                                       sdd->ops->stop(sdd->rx_dma.ch);
> +                                       dmaengine_terminate_all(sdd->rx_dma.ch);
>                         }
>
>                         goto out;
> @@ -793,11 +781,18 @@ out:
>  static int s3c64xx_spi_prepare_transfer(struct spi_master *spi)
>  {
>         struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(spi);
> +       dma_filter_fn filter = sdd->cntrlr_info->filter;
> +       struct device *dev = &sdd->pdev->dev;
> +       dma_cap_mask_t mask;
>
> -       /* Acquire DMA channels */
> -       while (!acquire_dma(sdd))
> -               usleep_range(10000, 11000);
> +       dma_cap_zero(mask);
> +       dma_cap_set(DMA_SLAVE, mask);
>
> +       /* Acquire DMA channels */
> +       sdd->rx_dma.ch = dma_request_slave_channel_compat(mask, filter,
> +                               (void*)sdd->rx_dma.request, dev, "rx");
> +       sdd->tx_dma.ch = dma_request_slave_channel_compat(mask, filter,
> +                               (void*)sdd->tx_dma.request, dev, "tx");
>         pm_runtime_get_sync(&sdd->pdev->dev);
>
>         return 0;
> @@ -808,11 +803,10 @@ static int s3c64xx_spi_unprepare_transfer(struct spi_master *spi)
>         struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(spi);
>
>         /* Free DMA channels */
> -       sdd->ops->release(sdd->rx_dma.ch, &s3c64xx_spi_dma_client);
> -       sdd->ops->release(sdd->tx_dma.ch, &s3c64xx_spi_dma_client);
> +       dma_release_channel(sdd->rx_dma.ch);
> +       dma_release_channel(sdd->tx_dma.ch);
>
>         pm_runtime_put(&sdd->pdev->dev);
> -
>         return 0;
>  }
>
> @@ -1149,7 +1143,6 @@ static inline struct s3c64xx_spi_port_config *s3c64xx_spi_get_port_config(
>  static int s3c64xx_spi_probe(struct platform_device *pdev)
>  {
>         struct resource *mem_res;
> -       struct resource *res;
>         struct s3c64xx_spi_driver_data *sdd;
>         struct s3c64xx_spi_info *sci = pdev->dev.platform_data;
>         struct spi_master *master;
> @@ -1207,15 +1200,15 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
>         }
>
>         sdd->cur_bpw = 8;
> -
>         if (!sdd->pdev->dev.of_node) {
> +               struct resource *res;
>                 res = platform_get_resource(pdev, IORESOURCE_DMA,  0);
>                 if (!res) {
>                         dev_err(&pdev->dev, "Unable to get SPI tx dma "
>                                         "resource\n");
>                         return -ENXIO;
>                 }
> -               sdd->tx_dma.dmach = res->start;
> +               sdd->tx_dma.request = res->start;
>
>                 res = platform_get_resource(pdev, IORESOURCE_DMA,  1);
>                 if (!res) {
> @@ -1223,12 +1216,11 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
>                                         "resource\n");
>                         return -ENXIO;
>                 }
> -               sdd->rx_dma.dmach = res->start;
> +               sdd->rx_dma.request = res->start;
>         }
>
>         sdd->tx_dma.direction = DMA_MEM_TO_DEV;
>         sdd->rx_dma.direction = DMA_DEV_TO_MEM;
> -
>         master->dev.of_node = pdev->dev.of_node;
>         master->bus_num = sdd->port_id;
>         master->setup = s3c64xx_spi_setup;
> @@ -1314,8 +1306,7 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
>                                         sdd->port_id, master->num_chipselect);
>         dev_dbg(&pdev->dev, "\tIOmem=[0x%x-0x%x]\tDMA=[Rx-%d, Tx-%d]\n",
>                                         mem_res->end, mem_res->start,
> -                                       sdd->rx_dma.dmach, sdd->tx_dma.dmach);
> -
> +                                       sdd->rx_dma.request, sdd->tx_dma.request);
>         pm_runtime_enable(&pdev->dev);
>
>         return 0;
> diff --git a/include/linux/platform_data/spi-s3c64xx.h b/include/linux/platform_data/spi-s3c64xx.h
> index ceba18d..8447f63 100644
> --- a/include/linux/platform_data/spi-s3c64xx.h
> +++ b/include/linux/platform_data/spi-s3c64xx.h
> @@ -11,6 +11,8 @@
>  #ifndef __S3C64XX_PLAT_SPI_H
>  #define __S3C64XX_PLAT_SPI_H
>
> +#include <linux/dmaengine.h>
> +
>  struct platform_device;
>
>  /**
> @@ -38,6 +40,7 @@ struct s3c64xx_spi_info {
>         int src_clk_nr;
>         int num_cs;
>         int (*cfg_gpio)(void);
> +       dma_filter_fn filter;
>  };
>

This one also tested on exynos5250. It's working fine.

Thanks
Padma
>  /**
> --
> 1.8.1.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 00/23] RFC: exynos multiplatform support
  2013-03-05 22:48     ` Tomasz Figa
@ 2013-03-06 10:50       ` Arnd Bergmann
  2013-03-06 12:34         ` Thierry Reding
  2013-03-06 22:14       ` Heiko Stübner
  1 sibling, 1 reply; 49+ messages in thread
From: Arnd Bergmann @ 2013-03-06 10:50 UTC (permalink / raw)
  To: linux-arm-kernel

On Tuesday 05 March 2013, Tomasz Figa wrote:
> On Tuesday 05 of March 2013 19:19:02 Arnd Bergmann wrote:

> > If none of these are needed for DT-based systems, we should probably
> > build that code conditionally based on the CONFIG_EXYNOS_ATAGS symbol
> > I introduced.
> 
> Yes, none of them are needed for DT-based systems.

Ah, good. I'll try to make more code conditional then.
 
> > How are you planning to solve this? Do you want to have a combined
> > driver that registers both a clocksource and a pwm?
> 
> Let's start with a quick introduction to the s3c-pwm hardware. Each 
> channel has its own timer value, compare and reload value registers, so 
> they don't need any extra locking. However there are additional shared 
> configuration registers, containing things such as start and reload bits 
> for all channels, prescaler and main divisor values, etc. Those registers 
> needs synchronization.
> 
> Now there are several possible approaches:
> 
> 1) A brute force one - two separate drivers, based on the fact that the
>    clocksource driver will be used only on uniprocessor systems, so
>    a simple _irqsave when accessing a shared register in both will 
>    guarantee correct synchronization.
> 
> 2) Two separate drivers with some synchronized shared code accessing 
>    registers (_start, _stop, _set_reload, _set_prescaler, _set_divisor, 
>    etc.; all using a shared spinlock).
> 
> 3) Single driver registering PWM channels, clocksource and clock event 
>    device. This does not seem like a bad idea, since the whole code for 
>    configuration of the PWM block would reside in one location and there 
>    would be no redundancy. However there is a question where such driver 
>    should be placed - drivers/clocksource, drivers/pwm, or maybe somewhere 
>    else?
> 
> Personally I wanted to go with first option, which would require least 
> amount of changes to existing code, at a cost of some code duplication 
> (but some PWM code is duplicated already).

I would prefer option 3. That is also easier to implement with a straightforward
DT binding that defines a single node with the clock registers. The location
doesn't have an obvious answer, but I would probably put them into
drivers/clocksource if the PWM maintainer agrees.

Option 2 would probably come down to having a trivial MFD driver exposing
a regmap. You can probably reuse drivers/mfd/syscon.c for this and make
the node compatible with "syscon" to designate the clock registers as
a system-wide resource, making the other device nodes register-less.

	Arnd

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

* [PATCH 18/23] ASoC: samsung: convert to dmaengine API
  2013-03-06  8:58   ` Padma Venkat
@ 2013-03-06 12:01     ` Arnd Bergmann
  0 siblings, 0 replies; 49+ messages in thread
From: Arnd Bergmann @ 2013-03-06 12:01 UTC (permalink / raw)
  To: linux-arm-kernel

On Wednesday 06 March 2013, Padma Venkat wrote:

> > +               if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
> > +                       config.direction = DMA_MEM_TO_DEV;
> > +                       config.dst_addr = prtd->params->dma_size;
> > +                       config.dst_addr_width = prtd->params->dma_addr;
> 
> dma_addr and dma_size got interchanged.

Ok, fixed.

> Except the above one I tested this patch on 5250. It's working fine.

Thanks a lot for testing this!

	Arnd

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

* [PATCH 00/23] RFC: exynos multiplatform support
  2013-03-06 10:50       ` Arnd Bergmann
@ 2013-03-06 12:34         ` Thierry Reding
  2013-03-06 22:57           ` Tomasz Figa
  2013-03-07  3:02           ` Arnd Bergmann
  0 siblings, 2 replies; 49+ messages in thread
From: Thierry Reding @ 2013-03-06 12:34 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Mar 06, 2013 at 10:50:42AM +0000, Arnd Bergmann wrote:
> On Tuesday 05 March 2013, Tomasz Figa wrote:
> > On Tuesday 05 of March 2013 19:19:02 Arnd Bergmann wrote:
> 
> > > If none of these are needed for DT-based systems, we should probably
> > > build that code conditionally based on the CONFIG_EXYNOS_ATAGS symbol
> > > I introduced.
> > 
> > Yes, none of them are needed for DT-based systems.
> 
> Ah, good. I'll try to make more code conditional then.
>  
> > > How are you planning to solve this? Do you want to have a combined
> > > driver that registers both a clocksource and a pwm?
> > 
> > Let's start with a quick introduction to the s3c-pwm hardware. Each 
> > channel has its own timer value, compare and reload value registers, so 
> > they don't need any extra locking. However there are additional shared 
> > configuration registers, containing things such as start and reload bits 
> > for all channels, prescaler and main divisor values, etc. Those registers 
> > needs synchronization.
> > 
> > Now there are several possible approaches:
> > 
> > 1) A brute force one - two separate drivers, based on the fact that the
> >    clocksource driver will be used only on uniprocessor systems, so
> >    a simple _irqsave when accessing a shared register in both will 
> >    guarantee correct synchronization.
> > 
> > 2) Two separate drivers with some synchronized shared code accessing 
> >    registers (_start, _stop, _set_reload, _set_prescaler, _set_divisor, 
> >    etc.; all using a shared spinlock).
> > 
> > 3) Single driver registering PWM channels, clocksource and clock event 
> >    device. This does not seem like a bad idea, since the whole code for 
> >    configuration of the PWM block would reside in one location and there 
> >    would be no redundancy. However there is a question where such driver 
> >    should be placed - drivers/clocksource, drivers/pwm, or maybe somewhere 
> >    else?
> > 
> > Personally I wanted to go with first option, which would require least 
> > amount of changes to existing code, at a cost of some code duplication 
> > (but some PWM code is duplicated already).
> 
> I would prefer option 3. That is also easier to implement with a straightforward
> DT binding that defines a single node with the clock registers. The location
> doesn't have an obvious answer, but I would probably put them into
> drivers/clocksource if the PWM maintainer agrees.
> 
> Option 2 would probably come down to having a trivial MFD driver exposing
> a regmap. You can probably reuse drivers/mfd/syscon.c for this and make
> the node compatible with "syscon" to designate the clock registers as
> a system-wide resource, making the other device nodes register-less.

I think option 2 is the standard method if one hardware block provides
several logical devices. I find it to be a pretty nice solution to this
problem. We also have precedent in the PWM subsystem. The TWL chips for
instance use it to create a platform device which is later driven by a
PWM driver.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130306/fdd76f07/attachment.sig>

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

* [PATCH 00/23] RFC: exynos multiplatform support
  2013-03-05 22:48     ` Tomasz Figa
  2013-03-06 10:50       ` Arnd Bergmann
@ 2013-03-06 22:14       ` Heiko Stübner
  2013-03-06 22:55         ` Tomasz Figa
  1 sibling, 1 reply; 49+ messages in thread
From: Heiko Stübner @ 2013-03-06 22:14 UTC (permalink / raw)
  To: linux-arm-kernel

Am Dienstag, 5. M?rz 2013, 23:48:45 schrieb Tomasz Figa:
> On Tuesday 05 of March 2013 19:19:02 Arnd Bergmann wrote:
> > On Tuesday 05 March 2013, Tomasz Figa wrote:
> > > > With this patch set, we can build mach-exynos as part
> > > > of a multiplatform kernel, with the following caveats:
> > > > 
> > > > * Only DT based boards are supported
> > > 
> > > As far as I'm aware, there are plans to drop non-DT Exynos support.
> > > Kgene should know more on this.
> > 
> > Yes, that was my understanding as well. It might not actually be too
> > hard to get multiplatform working with the ATAGS based board files
> > (we do that on some of the other platforms), but there is probably
> > no reason to try hard.
> > 
> > > > * Moving to common-clk breaks things including cpufreq
> > > > 
> > > >   and others. Thomas is working on a patch for this
> > > 
> > > We have several patches internally for fixing things up to run
> > > correclty with common-clk. I'll see if we can post some patches.
> > 
> > Ok, excellent.
> > 
> > > > * We disable the gpio implementation, which also breaks
> > > > 
> > > >   stuff, but Thomas has a patch already
> > > 
> > > The legacy GPIO code is needed only for non-DT case. DT-case uses the
> > > new pinctrl-samsung driver, which is (AFAIK) multiplatform-aware.
> > 
> > Please have a closer look at the "ARM: exynos: work around missing gpio
> > code on multiplatform" patch, I think there a few files I had to touch
> > that actually rely on the legacy gpio code:
> > 
> > * the pm-gpio.c file
> > * the s3c_i2c0_cfg_gpio function
> > * the eint irqchip
> > 
> > If none of these are needed for DT-based systems, we should probably
> > build that code conditionally based on the CONFIG_EXYNOS_ATAGS symbol
> > I introduced.
> 
> Yes, none of them are needed for DT-based systems.
> 
> > > > * sparsemem support is not available on multiplatform
> > > 
> > > There was some discussion some time ago whether we really need
> > > sparsemem on Exynos. If I remember correctly, it turned out that we
> > > don't. So this is not really an issue.
> > 
> > Ok, good.
> > 
> > > > Arnd Bergmann (23):
> > > >   ARM: exynos: introduce EXYNOS_ATAGS symbol
> > > >   irqchip: exynos: remove dependency on mach/irqs.h
> > > >   tty: serial/samsung: prepare for common clock API
> > > >   tty: serial/samsung: make register definitions global
> > > >   tty: serial/samsung: fix modular build
> > > >   ARM: exynos: move debug-macro.S to include/debug/
> > > >   i2c: s3c2410: make header file local
> > > >   mmc: sdhci-s3c: remove platform dependencies
> > > >   usb: exynos: do not include plat/usb-phy.h
> > > >   [media] exynos: remove unnecessary header inclusions
> > > >   video/exynos: remove unnecessary header inclusions
> > > >   thermal/exynos: remove unnecessary header inclusions
> > > >   mtd: onenand/samsung: make regs-onenand.h file local
> > > >   rtc: s3c: make header file local
> > > >   spi: s3c64xx: move to generic dmaengine API
> > > >   pwm: samsung: repair the worst MMIO abuses
> > > 
> > > I'm currently working (in my free time) on a series of cleanup patches
> > > sanitizing Samsung PWM code for S3C64xx and S5PV210 DT (and
> > > multiplatform) support.
> > 
> > Ah, nice.
> > 
> > > On those platforms it is a bit more complex case as there are two
> > > blocks of code that access the same hardware - samsung-time (using
> > > two PWM channels for clocksource and clock events) and pwm-samsung.
> > > 
> > > Hopefully, I will have some patches ready soon.
> > 
> > How are you planning to solve this? Do you want to have a combined
> > driver that registers both a clocksource and a pwm?
> 
> Let's start with a quick introduction to the s3c-pwm hardware. Each
> channel has its own timer value, compare and reload value registers, so
> they don't need any extra locking. However there are additional shared
> configuration registers, containing things such as start and reload bits
> for all channels, prescaler and main divisor values, etc. Those registers
> needs synchronization.
> 
> Now there are several possible approaches:
> 
> 1) A brute force one - two separate drivers, based on the fact that the
>    clocksource driver will be used only on uniprocessor systems, so
>    a simple _irqsave when accessing a shared register in both will
>    guarantee correct synchronization.
> 
> 2) Two separate drivers with some synchronized shared code accessing
>    registers (_start, _stop, _set_reload, _set_prescaler, _set_divisor,
>    etc.; all using a shared spinlock).
> 
> 3) Single driver registering PWM channels, clocksource and clock event
>    device. This does not seem like a bad idea, since the whole code for
>    configuration of the PWM block would reside in one location and there
>    would be no redundancy. However there is a question where such driver
>    should be placed - drivers/clocksource, drivers/pwm, or maybe somewhere
>    else?
> 
> Personally I wanted to go with first option, which would require least
> amount of changes to existing code, at a cost of some code duplication
> (but some PWM code is duplicated already).


Do you also want to include the prescaler and divider handling (that is
currently sitting pwm-clock.c in plat-samsung) into this new driver?

Because for my current common-clk work I ported the pwm-clock stuff to the
common-clk-fw to keep the timer running. Unfinished code below. The pwm and
time drivers do not use the TCFG registers at the beginning of the block.

Either way is fine with me, I just want to prevent me doing more cleanups
there, when the right way is thru your new driver :-)


Heiko


unfinished but working clk-pwm.c:

/*
 * Copyright (c) 2007 Simtec Electronics
 * Copyright (c) 2007, 2008 Ben Dooks
 *	Ben Dooks <ben-linux@fluff.org>
 * Copyright (c) 2013 Heiko Stuebner <heiko@sntech.de>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License.
 *
 * Common Clock Framework support for Samsung pwm clocks
*/

#include <linux/clk.h>
#include <linux/clkdev.h>
#include <linux/clk-provider.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/syscore_ops.h>
#include <linux/io.h>

#include <plat/cpu.h>
#include <mach/map.h>

#include "clk.h"

/* Each of the timers 0 through 5 go through the following
 * clock tree, with the inputs depending on the timers.
 *
 * pclk ---- [ prescaler 0 ] -+---> timer 0
 *			      +---> timer 1
 *
 * pclk ---- [ prescaler 1 ] -+---> timer 2
 *			      +---> timer 3
 *			      \---> timer 4
 *
 * Which are fed into the timers as so:
 *
 * prescaled 0 ---- [ div 2,4,8,16 ] ---\
 *				       [mux] -> timer 0
 * tclk 0 ------------------------------/
 *
 * prescaled 0 ---- [ div 2,4,8,16 ] ---\
 *				       [mux] -> timer 1
 * tclk 0 ------------------------------/
 *
 *
 * prescaled 1 ---- [ div 2,4,8,16 ] ---\
 *				       [mux] -> timer 2
 * tclk 1 ------------------------------/
 *
 * prescaled 1 ---- [ div 2,4,8,16 ] ---\
 *				       [mux] -> timer 3
 * tclk 1 ------------------------------/
 *
 * prescaled 1 ---- [ div 2,4,8, 16 ] --\
 *				       [mux] -> timer 4
 * tclk 1 ------------------------------/
 *
 * Since the mux and the divider are tied together in the
 * same register space, it is impossible to set the parent
 * and the rate at the same time. To avoid this, we add an
 * intermediate 'prescaled-and-divided' clock to select
 * as the parent for the timer input clock called tdiv.
 *
 * prescaled clk --> pwm-tdiv ---\
 *                             [ mux ] --> timer X
 * tclk -------------------------/
*/

enum pwm_clks {
	none,

	tclk0, tclk1, tdiv0, tdiv1, tdiv2, tdiv3, tdiv4,
	tin0, tin1, tin2, tin3, tin4,

	nr_clks,
};

/* the soc types */
enum supported_socs {
	S3C24XX,
	S3C64XX, /* also S5PC100 */
	S5P64XX,
};

/* clock controller register offsets */
#define TCFG0	0
#define TCFG1	0x4

static DEFINE_SPINLOCK(lock);
static int current_soc;
static void __iomem *reg_base;
static struct clk **clk_table;
#ifdef CONFIG_OF
static struct clk_onecell_data clk_data;
#endif

#ifdef CONFIG_PM_SLEEP
static struct samsung_clk_reg_dump reg_dump[2] = {
  { .offset = TCFG0 },
  { .offset = TCFG1 },
};

static int samsung_clk_pwm_suspend(void)
{
	reg_dump[0].value = readl_relaxed(reg_base + reg_dump[0].offset);
	reg_dump[1].value = readl_relaxed(reg_base + reg_dump[1].offset);
	return 0;
}

static void samsung_clk_pwm_resume(void)
{
	writel_relaxed(reg_dump[0].value, reg_base + reg_dump[0].offset);
	writel_relaxed(reg_dump[1].value, reg_base + reg_dump[1].offset);
}

static struct syscore_ops samsung_clk_pwm_syscore_ops = {
	.suspend	= samsung_clk_pwm_suspend,
	.resume		= samsung_clk_pwm_resume,
};
#endif /* CONFIG_PM_SLEEP */

#define S3C2410_TCFG1_MUX_TCLK    (4 << 0)
#define S3C64XX_TCFG1_MUX_TCLK    (5 << 0)

/**
 * pwm_cfg_src_is_tclk() - return whether the given mux config is a tclk
 * @tcfg: The timer TCFG1 register bits shifted down to 0.
 *
 * Return true if the given configuration from TCFG1 is a TCLK instead
 * any of the TDIV clocks.
 */
static inline int pwm_cfg_src_is_tclk(unsigned long tcfg)
{
	if (current_soc == S3C24XX)
		return tcfg == S3C2410_TCFG1_MUX_TCLK;
	else if (current_soc == S3C64XX)
		return tcfg >= S3C64XX_TCFG1_MUX_TCLK;
	else if (current_soc == S5P64XX)
		return 0;
	else
		return tcfg == S3C64XX_TCFG1_MUX_TCLK;
}

struct clk_tdiv {
	struct clk_divider 	divider;
	const struct clk_ops 	*ops;
	void __iomem 		*reg;
	unsigned int		divisor;
};

static inline struct clk_tdiv *to_clk_tdiv(struct clk_hw *hw)
{
	struct clk_divider *divider = container_of(hw, struct clk_divider, hw);

	return container_of(divider, struct clk_tdiv, divider);
}

static unsigned long clk_tdiv_recalc_rate(struct clk_hw *hw,
					 unsigned long parent_rate)
{
	struct clk_tdiv *tdiv = to_clk_tdiv(hw);
	unsigned long tcfg1 = readl_relaxed(tdiv->reg);

	tcfg1 >>= tdiv->divider.shift;
	tcfg1 &= ((1 << (tdiv->divider.width)) - 1);

	if (pwm_cfg_src_is_tclk(tcfg1))
		return parent_rate / tdiv->divisor;
	else
		return tdiv->ops->recalc_rate(&tdiv->divider.hw, parent_rate);

}

static long clk_tdiv_round_rate(struct clk_hw *hw, unsigned long rate,
			       unsigned long *parent_rate)
{
	struct clk_tdiv *tdiv = to_clk_tdiv(hw);

	return tdiv->ops->round_rate(&tdiv->divider.hw, rate, parent_rate);
}

static int clk_tdiv_set_rate(struct clk_hw *hw, unsigned long rate,
			    unsigned long parent_rate)
{
	struct clk_tdiv *tdiv = to_clk_tdiv(hw);
	unsigned long tcfg1 = readl_relaxed(tdiv->reg);
	unsigned long divisor;
	int ret = 0;

	tcfg1 >>= tdiv->divider.shift;
	tcfg1 &= ((1 << (tdiv->divider.width)) - 1);

	rate = tdiv->ops->round_rate(&tdiv->divider.hw, rate, &parent_rate);
	divisor = parent_rate / rate;

	if (divisor > 16)
		return -EINVAL;

	tdiv->divisor = divisor;

	/* Update the current MUX settings if we are currently
	 * selected as the clock source for this clock. */

	if (!pwm_cfg_src_is_tclk(tcfg1))
		ret = tdiv->ops->set_rate(&tdiv->divider.hw, rate, parent_rate);

	return ret;
}

static struct clk_ops clk_tdiv_ops = {
	.recalc_rate = clk_tdiv_recalc_rate,
	.round_rate = clk_tdiv_round_rate,
	.set_rate = clk_tdiv_set_rate,
};

static struct clk *samsung_clk_register_tdiv(const char *name,
		const char *parent_name, unsigned long flags,
		void __iomem *reg, u8 shift,
		u8 clk_divider_flags, const struct clk_div_table *table)
{
	unsigned long tcfg1;
	const struct clk_div_table *clkt;
	struct clk_tdiv *tdiv;
	struct clk *clk;
	struct clk_init_data init;

	tdiv = kzalloc(sizeof(struct clk_tdiv), GFP_KERNEL);
	if (!tdiv)
		return ERR_PTR(-ENOMEM);

	init.name = name;
	init.ops = &clk_tdiv_ops;
	init.flags = flags;
	init.parent_names = (parent_name ? &parent_name: NULL);
	init.num_parents = (parent_name ? 1 : 0);

	/* struct clk_divider assignments */
	tdiv->divider.reg = reg;
	tdiv->divider.shift = shift;
	tdiv->divider.width = 4;
	tdiv->divider.flags = clk_divider_flags;
	tdiv->divider.lock = &lock;
	tdiv->divider.hw.init = &init;
	tdiv->divider.table = table;
	tdiv->ops = &clk_divider_ops;

	tcfg1 = readl_relaxed(reg);
	tcfg1 >>= tdiv->divider.shift;
	tcfg1 &= ((1 << (tdiv->divider.width)) - 1);

	tdiv->reg = reg;

	tdiv->divisor = 1;
	for (clkt = table; clkt->div; clkt++)
		if (clkt->val == tcfg1)
			tdiv->divisor = clkt->div;

	clk = clk_register(NULL, &tdiv->divider.hw);
	if (IS_ERR(clk))
		kfree(tdiv);

	return clk;
}

struct clk_tin {
	struct clk_hw	hw;
	void __iomem	*reg;
	u8		shift;
	u8		width;
	spinlock_t	*lock;
};

#define to_clk_tin(_hw) container_of(_hw, struct clk_tin, hw)

static u8 clk_tin_get_parent(struct clk_hw *hw)
{
	struct clk_tin *tin = to_clk_tin(hw);
	unsigned long tcfg1 = readl_relaxed(tin->reg);

	tcfg1 >>= tin->shift;
	tcfg1 &= ((1 << (tin->width)) - 1);

	/* assume tclk is parent 0 and tdiv is parent 1 */
	return pwm_cfg_src_is_tclk(tcfg1) ? 0 : 1;
}

static int clk_tin_set_parent(struct clk_hw *hw, u8 index)
{
	struct clk_tin *tin = to_clk_tin(hw);
	struct clk *tdiv;
	struct clk *prescaler;
	unsigned long tcfg1;
	unsigned long flags = 0;
	unsigned long div;
	int bits;

	switch (index) {
	case 0:
		if (current_soc == S3C24XX)
			bits = S3C2410_TCFG1_MUX_TCLK << tin->shift;
		else if (current_soc == S5P64XX)
			bits = 0;
		else
			bits = S3C64XX_TCFG1_MUX_TCLK << tin->shift;
		break;
	case 1:
		tdiv = clk_get(NULL, hw->init->parent_names[0]);

		prescaler = clk_get_parent(tdiv);
		div = clk_get_rate(prescaler) / clk_get_rate(tdiv);

		bits = (current_soc == S3C24XX) ? (ilog2(div) - 1) : ilog2(div);
		bits &= ((1 << (tin->width)) - 1);
		bits <<= tin->shift;

		clk_put(tdiv);
		break;
	default:
		return -EINVAL;
	}

	spin_lock_irqsave(tin->lock, flags);

	tcfg1 = readl_relaxed(tin->reg);
	tcfg1 &= ~(((1 << tin->width) - 1) << tin->shift);
	tcfg1 |= bits;
	writel_relaxed(tcfg1, tin->reg);

	spin_unlock_irqrestore(tin->lock, flags);

	return 0;
}

static const struct clk_ops clk_tin_ops = {
	.get_parent = clk_tin_get_parent,
	.set_parent = clk_tin_set_parent,
};

static struct clk *samsung_clk_register_tin(const char *name,
		const char **parent_names, u8 num_parents,
		void __iomem *reg, u8 shift, u8 width)
{
	struct clk_tin *tin;
	struct clk *clk;
	struct clk_init_data init;

	/* allocate the mux */
	tin = kzalloc(sizeof(struct clk_tin), GFP_KERNEL);
	if (!tin) {
		pr_err("%s: could not allocate tin clk\n", __func__);
		return ERR_PTR(-ENOMEM);
	}

	init.name = name;
	init.ops = &clk_tin_ops;
	init.parent_names = parent_names;
	init.num_parents = num_parents;

	/* struct clk_mux assignments */
	tin->reg = reg;
	tin->shift = shift;
	tin->width = width;
	tin->lock = &lock;
	tin->hw.init = &init;

	clk = clk_register(NULL, &tin->hw);

	if (IS_ERR(clk))
		kfree(tin);

	return clk;
}


PNAME(tin0_p) = { "pwm-tclk0", "pwm-tdiv0" };
PNAME(tin1_p) = { "pwm-tclk0", "pwm-tdiv1" };
PNAME(tin2_p) = { "pwm-tclk1", "pwm-tdiv2" };
PNAME(tin3_p) = { "pwm-tclk1", "pwm-tdiv3" };
PNAME(tin4_p) = { "pwm-tclk1", "pwm-tdiv4" };

static struct clk_div_table tdiv_s3c24xx_d[] = {
	{ .val = 0, .div = 2 },
	{ .val = 1, .div = 4 },
	{ .val = 2, .div = 8 },
	{ .val = 3, .div = 16 },
	{ .div = 0 },
};
struct samsung_div_clock pwm_s3c24xx_tdiv_dividers[] __initdata = {
	DIV_T(tdiv0, "pwm-tdiv0", "pwm-scaler0", TCFG1, 0, 4, tdiv_s3c24xx_d),
	DIV_T(tdiv1, "pwm-tdiv1", "pwm-scaler0", TCFG1, 4, 4, tdiv_s3c24xx_d),
	DIV_T(tdiv2, "pwm-tdiv2", "pwm-scaler1", TCFG1, 8, 4, tdiv_s3c24xx_d),
	DIV_T(tdiv3, "pwm-tdiv3", "pwm-scaler1", TCFG1, 12, 4, tdiv_s3c24xx_d),
	DIV_T(tdiv4, "pwm-tdiv4", "pwm-scaler1", TCFG1, 16, 4, tdiv_s3c24xx_d),
};

static struct clk_div_table tdiv_s3c64xx_d[] = {
	{ .val = 0, .div = 1 },
	{ .val = 1, .div = 2 },
	{ .val = 2, .div = 4 },
	{ .val = 3, .div = 8 },
	{ .val = 4, .div = 16 },
	{ .div = 0 },
};
struct samsung_div_clock pwm_s3c64xx_tdiv_dividers[] __initdata = {
	DIV_T(tdiv0, "pwm-tdiv0", "pwm-scaler0", TCFG1, 0, 4, tdiv_s3c64xx_d),
	DIV_T(tdiv1, "pwm-tdiv1", "pwm-scaler0", TCFG1, 4, 4, tdiv_s3c64xx_d),
	DIV_T(tdiv2, "pwm-tdiv2", "pwm-scaler1", TCFG1, 8, 4, tdiv_s3c64xx_d),
	DIV_T(tdiv3, "pwm-tdiv3", "pwm-scaler1", TCFG1, 12, 4, tdiv_s3c64xx_d),
	DIV_T(tdiv4, "pwm-tdiv4", "pwm-scaler1", TCFG1, 16, 4, tdiv_s3c64xx_d),
};

struct samsung_mux_clock pwm_tin[] __initdata = {
	MUX(tin0, "pwm-tin0", tin0_p, TCFG1, 0, 4),
	MUX(tin1, "pwm-tin1", tin1_p, TCFG1, 4, 4),
	MUX(tin2, "pwm-tin2", tin2_p, TCFG1, 8, 4),
	MUX(tin3, "pwm-tin3", tin3_p, TCFG1, 12, 4),
	MUX(tin4, "pwm-tin4", tin4_p, TCFG1, 16, 4),
};

struct samsung_clock_alias pwm_aliases[] __initdata = {
	ALIAS(tdiv0, "s3c24xx-pwm.0", "pwm-tdiv"),
	ALIAS(tdiv1, "s3c24xx-pwm.1", "pwm-tdiv"),
	ALIAS(tdiv2, "s3c24xx-pwm.2", "pwm-tdiv"),
	ALIAS(tdiv3, "s3c24xx-pwm.3", "pwm-tdiv"),
	ALIAS(tdiv4, "s3c24xx-pwm.4", "pwm-tdiv"),
	ALIAS(tin0, "s3c24xx-pwm.0", "pwm-tin"),
	ALIAS(tin1, "s3c24xx-pwm.1", "pwm-tin"),
	ALIAS(tin2, "s3c24xx-pwm.2", "pwm-tin"),
	ALIAS(tin3, "s3c24xx-pwm.3", "pwm-tin"),
	ALIAS(tin4, "s3c24xx-pwm.4", "pwm-tin"),
};


#ifdef CONFIG_OF
static struct of_device_id pwm_clk_ids[] __initdata = {
	{ .compatible = "samsung,s3c24xx-clock-pwm",
			.data = (void *)S3C24XX, },
	{ .compatible = "samsung,s3c64xx-clock-pwm",
			.data = (void *)S3C64XX, },
	{ .compatible = "samsung,s5p64xx-clock-pwm",
			.data = (void *)S5P64XX, },
	{ },
};
#endif


void __init samsung_pwm_clk_init(struct device_node *np)
{
	struct clk *clk;
	struct samsung_div_clock *tdiv_list;
	struct samsung_mux_clock *tin_list;
	struct samsung_clock_alias *alias_list;
	unsigned int idx;
	int ret;

	if (np) {
		const struct of_device_id *match;
		match = of_match_node(pwm_clk_ids, np);
		current_soc = (u32)match->data;

		reg_base = of_iomap(np, 0);
		if (!reg_base)
			panic("%s: failed to map registers\n", __func__);
	} else {
		reg_base = S3C_VA_TIMER;
		if (soc_is_s3c24xx())
			current_soc = S3C24XX;
		else if (soc_is_s3c64xx() || soc_is_s5pc100())
			current_soc = S3C64XX;
		else if (soc_is_s5p6440() || soc_is_s5p6450())
			current_soc = S5P64XX;
		else
			panic("%s: unable to determine soc\n", __func__);
	}

	clk_table = kzalloc(sizeof(struct clk *) * nr_clks, GFP_KERNEL);
	if (!clk_table)
		panic("could not allocate clock lookup table\n");

#ifdef CONFIG_OF
	clk_data.clks = clk_table;
	clk_data.clk_num = nr_clks;
	of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
#endif

#ifdef CONFIG_PM_SLEEP
	register_syscore_ops(&samsung_clk_pwm_syscore_ops);
#endif


	clk = clk_register_fixed_rate(NULL, "pwm-tclk0", NULL, CLK_IS_ROOT, 0);
	clk = clk_register_fixed_rate(NULL, "pwm-tclk1", NULL, CLK_IS_ROOT, 0);

	clk = clk_register_divider(NULL, "pwm-scaler0", "pwm", 0, reg_base + TCFG0, 0, 8, 0, &lock);
	clk = clk_register_divider(NULL, "pwm-scaler1", "pwm", 0, reg_base + TCFG0, 8, 8, 0, &lock);

	tdiv_list = (current_soc == S3C24XX) ? pwm_s3c24xx_tdiv_dividers
					      : pwm_s3c64xx_tdiv_dividers;

	for (idx = 0; idx < 5; idx++, tdiv_list++) {
		clk = samsung_clk_register_tdiv(tdiv_list->name, tdiv_list->parent_name,
				tdiv_list->flags, reg_base + tdiv_list->offset,
				tdiv_list->shift, tdiv_list->div_flags, tdiv_list->table);
		if (IS_ERR(clk)) {
			pr_err("%s: failed to register clock %s\n", __func__,
				tdiv_list->name);
			continue;
		}

		if (clk_table && tdiv_list->id)
			clk_table[tdiv_list->id] = clk;
	}

	tin_list = pwm_tin;
	for (idx = 0; idx < 5; idx++, tin_list++) {
		clk = samsung_clk_register_tin(tin_list->name,
				tin_list->parent_names, tin_list->num_parents,
				reg_base + tin_list->offset, tin_list->shift,
				tin_list->width);

		if (IS_ERR(clk)) {
			pr_err("%s: failed to register clock %s\n", __func__,
				tin_list->name);
			continue;
		}

		if (clk_table && tin_list->id)
			clk_table[tin_list->id] = clk;
	}

	alias_list = pwm_aliases;
	for (idx = 0; idx < ARRAY_SIZE(pwm_aliases); idx++, alias_list++) {
		if (!alias_list->id) {
			pr_err("%s: clock id missing for index %d\n", __func__,
				idx);
			continue;
		}

		clk = clk_table[alias_list->id];
		if (!clk) {
			pr_err("%s: failed to find clock %d\n", __func__,
				alias_list->id);
			continue;
		}

		ret = clk_register_clkdev(clk, alias_list->alias,
					  alias_list->dev_name);
		if (ret)
			pr_err("%s: failed to register lookup %s\n",
						__func__, alias_list->alias);
	}
}

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

* [PATCH 00/23] RFC: exynos multiplatform support
  2013-03-06 22:14       ` Heiko Stübner
@ 2013-03-06 22:55         ` Tomasz Figa
  0 siblings, 0 replies; 49+ messages in thread
From: Tomasz Figa @ 2013-03-06 22:55 UTC (permalink / raw)
  To: linux-arm-kernel

On Wednesday 06 of March 2013 23:14:56 Heiko St?bner wrote:
> Am Dienstag, 5. M?rz 2013, 23:48:45 schrieb Tomasz Figa:
> > On Tuesday 05 of March 2013 19:19:02 Arnd Bergmann wrote:
> > > On Tuesday 05 March 2013, Tomasz Figa wrote:
> > > > > With this patch set, we can build mach-exynos as part
> > > > > of a multiplatform kernel, with the following caveats:
> > > > > 
> > > > > * Only DT based boards are supported
> > > > 
> > > > As far as I'm aware, there are plans to drop non-DT Exynos
> > > > support.
> > > > Kgene should know more on this.
> > > 
> > > Yes, that was my understanding as well. It might not actually be too
> > > hard to get multiplatform working with the ATAGS based board files
> > > (we do that on some of the other platforms), but there is probably
> > > no reason to try hard.
> > > 
> > > > > * Moving to common-clk breaks things including cpufreq
> > > > > 
> > > > >   and others. Thomas is working on a patch for this
> > > > 
> > > > We have several patches internally for fixing things up to run
> > > > correclty with common-clk. I'll see if we can post some patches.
> > > 
> > > Ok, excellent.
> > > 
> > > > > * We disable the gpio implementation, which also breaks
> > > > > 
> > > > >   stuff, but Thomas has a patch already
> > > > 
> > > > The legacy GPIO code is needed only for non-DT case. DT-case uses
> > > > the
> > > > new pinctrl-samsung driver, which is (AFAIK) multiplatform-aware.
> > > 
> > > Please have a closer look at the "ARM: exynos: work around missing
> > > gpio
> > > code on multiplatform" patch, I think there a few files I had to
> > > touch
> > > that actually rely on the legacy gpio code:
> > > 
> > > * the pm-gpio.c file
> > > * the s3c_i2c0_cfg_gpio function
> > > * the eint irqchip
> > > 
> > > If none of these are needed for DT-based systems, we should probably
> > > build that code conditionally based on the CONFIG_EXYNOS_ATAGS
> > > symbol
> > > I introduced.
> > 
> > Yes, none of them are needed for DT-based systems.
> > 
> > > > > * sparsemem support is not available on multiplatform
> > > > 
> > > > There was some discussion some time ago whether we really need
> > > > sparsemem on Exynos. If I remember correctly, it turned out that
> > > > we
> > > > don't. So this is not really an issue.
> > > 
> > > Ok, good.
> > > 
> > > > > Arnd Bergmann (23):
> > > > >   ARM: exynos: introduce EXYNOS_ATAGS symbol
> > > > >   irqchip: exynos: remove dependency on mach/irqs.h
> > > > >   tty: serial/samsung: prepare for common clock API
> > > > >   tty: serial/samsung: make register definitions global
> > > > >   tty: serial/samsung: fix modular build
> > > > >   ARM: exynos: move debug-macro.S to include/debug/
> > > > >   i2c: s3c2410: make header file local
> > > > >   mmc: sdhci-s3c: remove platform dependencies
> > > > >   usb: exynos: do not include plat/usb-phy.h
> > > > >   [media] exynos: remove unnecessary header inclusions
> > > > >   video/exynos: remove unnecessary header inclusions
> > > > >   thermal/exynos: remove unnecessary header inclusions
> > > > >   mtd: onenand/samsung: make regs-onenand.h file local
> > > > >   rtc: s3c: make header file local
> > > > >   spi: s3c64xx: move to generic dmaengine API
> > > > >   pwm: samsung: repair the worst MMIO abuses
> > > > 
> > > > I'm currently working (in my free time) on a series of cleanup
> > > > patches
> > > > sanitizing Samsung PWM code for S3C64xx and S5PV210 DT (and
> > > > multiplatform) support.
> > > 
> > > Ah, nice.
> > > 
> > > > On those platforms it is a bit more complex case as there are two
> > > > blocks of code that access the same hardware - samsung-time (using
> > > > two PWM channels for clocksource and clock events) and
> > > > pwm-samsung.
> > > > 
> > > > Hopefully, I will have some patches ready soon.
> > > 
> > > How are you planning to solve this? Do you want to have a combined
> > > driver that registers both a clocksource and a pwm?
> > 
> > Let's start with a quick introduction to the s3c-pwm hardware. Each
> > channel has its own timer value, compare and reload value registers,
> > so
> > they don't need any extra locking. However there are additional shared
> > configuration registers, containing things such as start and reload
> > bits for all channels, prescaler and main divisor values, etc. Those
> > registers needs synchronization.
> > 
> > Now there are several possible approaches:
> > 
> > 1) A brute force one - two separate drivers, based on the fact that
> > the
> > 
> >    clocksource driver will be used only on uniprocessor systems, so
> >    a simple _irqsave when accessing a shared register in both will
> >    guarantee correct synchronization.
> > 
> > 2) Two separate drivers with some synchronized shared code accessing
> > 
> >    registers (_start, _stop, _set_reload, _set_prescaler,
> >    _set_divisor,
> >    etc.; all using a shared spinlock).
> > 
> > 3) Single driver registering PWM channels, clocksource and clock event
> > 
> >    device. This does not seem like a bad idea, since the whole code
> >    for
> >    configuration of the PWM block would reside in one location and
> >    there
> >    would be no redundancy. However there is a question where such
> >    driver
> >    should be placed - drivers/clocksource, drivers/pwm, or maybe
> >    somewhere
> >    else?
> > 
> > Personally I wanted to go with first option, which would require least
> > amount of changes to existing code, at a cost of some code duplication
> > (but some PWM code is duplicated already).
> 
> Do you also want to include the prescaler and divider handling (that is
> currently sitting pwm-clock.c in plat-samsung) into this new driver?

Yes.

I don't think we need a full fledged clock driver for PWM prescalers and 
dividers, because they don't provide any clocks to be used by other 
peripherals, but rather simply control frequency of timers.

> Because for my current common-clk work I ported the pwm-clock stuff to
> the common-clk-fw to keep the timer running. Unfinished code below. The
> pwm and time drivers do not use the TCFG registers at the beginning of
> the block.
> 
> Either way is fine with me, I just want to prevent me doing more
> cleanups there, when the right way is thru your new driver :-)
>
> Heiko

OK. From my side, I hope I will manage to post first version of my patches 
this week (or weekend).

Best regards,
Tomasz
 
> 
> unfinished but working clk-pwm.c:
> 
> /*
>  * Copyright (c) 2007 Simtec Electronics
>  * Copyright (c) 2007, 2008 Ben Dooks
>  *	Ben Dooks <ben-linux@fluff.org>
>  * Copyright (c) 2013 Heiko Stuebner <heiko@sntech.de>
>  *
>  * This program is free software; you can redistribute it and/or modify
>  * it under the terms of the GNU General Public License as published by
>  * the Free Software Foundation; either version 2 of the License.
>  *
>  * Common Clock Framework support for Samsung pwm clocks
> */
> 
> #include <linux/clk.h>
> #include <linux/clkdev.h>
> #include <linux/clk-provider.h>
> #include <linux/of.h>
> #include <linux/of_address.h>
> #include <linux/syscore_ops.h>
> #include <linux/io.h>
> 
> #include <plat/cpu.h>
> #include <mach/map.h>
> 
> #include "clk.h"
> 
> /* Each of the timers 0 through 5 go through the following
>  * clock tree, with the inputs depending on the timers.
>  *
>  * pclk ---- [ prescaler 0 ] -+---> timer 0
>  *			      +---> timer 1
>  *
>  * pclk ---- [ prescaler 1 ] -+---> timer 2
>  *			      +---> timer 3
>  *			      \---> timer 4
>  *
>  * Which are fed into the timers as so:
>  *
>  * prescaled 0 ---- [ div 2,4,8,16 ] ---\
>  *				       [mux] -> timer 0
>  * tclk 0 ------------------------------/
>  *
>  * prescaled 0 ---- [ div 2,4,8,16 ] ---\
>  *				       [mux] -> timer 1
>  * tclk 0 ------------------------------/
>  *
>  *
>  * prescaled 1 ---- [ div 2,4,8,16 ] ---\
>  *				       [mux] -> timer 2
>  * tclk 1 ------------------------------/
>  *
>  * prescaled 1 ---- [ div 2,4,8,16 ] ---\
>  *				       [mux] -> timer 3
>  * tclk 1 ------------------------------/
>  *
>  * prescaled 1 ---- [ div 2,4,8, 16 ] --\
>  *				       [mux] -> timer 4
>  * tclk 1 ------------------------------/
>  *
>  * Since the mux and the divider are tied together in the
>  * same register space, it is impossible to set the parent
>  * and the rate at the same time. To avoid this, we add an
>  * intermediate 'prescaled-and-divided' clock to select
>  * as the parent for the timer input clock called tdiv.
>  *
>  * prescaled clk --> pwm-tdiv ---\
>  *                             [ mux ] --> timer X
>  * tclk -------------------------/
> */
> 
> enum pwm_clks {
> 	none,
> 
> 	tclk0, tclk1, tdiv0, tdiv1, tdiv2, tdiv3, tdiv4,
> 	tin0, tin1, tin2, tin3, tin4,
> 
> 	nr_clks,
> };
> 
> /* the soc types */
> enum supported_socs {
> 	S3C24XX,
> 	S3C64XX, /* also S5PC100 */
> 	S5P64XX,
> };
> 
> /* clock controller register offsets */
> #define TCFG0	0
> #define TCFG1	0x4
> 
> static DEFINE_SPINLOCK(lock);
> static int current_soc;
> static void __iomem *reg_base;
> static struct clk **clk_table;
> #ifdef CONFIG_OF
> static struct clk_onecell_data clk_data;
> #endif
> 
> #ifdef CONFIG_PM_SLEEP
> static struct samsung_clk_reg_dump reg_dump[2] = {
>   { .offset = TCFG0 },
>   { .offset = TCFG1 },
> };
> 
> static int samsung_clk_pwm_suspend(void)
> {
> 	reg_dump[0].value = readl_relaxed(reg_base + reg_dump[0].offset);
> 	reg_dump[1].value = readl_relaxed(reg_base + reg_dump[1].offset);
> 	return 0;
> }
> 
> static void samsung_clk_pwm_resume(void)
> {
> 	writel_relaxed(reg_dump[0].value, reg_base + reg_dump[0].offset);
> 	writel_relaxed(reg_dump[1].value, reg_base + reg_dump[1].offset);
> }
> 
> static struct syscore_ops samsung_clk_pwm_syscore_ops = {
> 	.suspend	= samsung_clk_pwm_suspend,
> 	.resume		= samsung_clk_pwm_resume,
> };
> #endif /* CONFIG_PM_SLEEP */
> 
> #define S3C2410_TCFG1_MUX_TCLK    (4 << 0)
> #define S3C64XX_TCFG1_MUX_TCLK    (5 << 0)
> 
> /**
>  * pwm_cfg_src_is_tclk() - return whether the given mux config is a tclk
> * @tcfg: The timer TCFG1 register bits shifted down to 0.
>  *
>  * Return true if the given configuration from TCFG1 is a TCLK instead
>  * any of the TDIV clocks.
>  */
> static inline int pwm_cfg_src_is_tclk(unsigned long tcfg)
> {
> 	if (current_soc == S3C24XX)
> 		return tcfg == S3C2410_TCFG1_MUX_TCLK;
> 	else if (current_soc == S3C64XX)
> 		return tcfg >= S3C64XX_TCFG1_MUX_TCLK;
> 	else if (current_soc == S5P64XX)
> 		return 0;
> 	else
> 		return tcfg == S3C64XX_TCFG1_MUX_TCLK;
> }
> 
> struct clk_tdiv {
> 	struct clk_divider 	divider;
> 	const struct clk_ops 	*ops;
> 	void __iomem 		*reg;
> 	unsigned int		divisor;
> };
> 
> static inline struct clk_tdiv *to_clk_tdiv(struct clk_hw *hw)
> {
> 	struct clk_divider *divider = container_of(hw, struct clk_divider, 
hw);
> 
> 	return container_of(divider, struct clk_tdiv, divider);
> }
> 
> static unsigned long clk_tdiv_recalc_rate(struct clk_hw *hw,
> 					 unsigned long parent_rate)
> {
> 	struct clk_tdiv *tdiv = to_clk_tdiv(hw);
> 	unsigned long tcfg1 = readl_relaxed(tdiv->reg);
> 
> 	tcfg1 >>= tdiv->divider.shift;
> 	tcfg1 &= ((1 << (tdiv->divider.width)) - 1);
> 
> 	if (pwm_cfg_src_is_tclk(tcfg1))
> 		return parent_rate / tdiv->divisor;
> 	else
> 		return tdiv->ops->recalc_rate(&tdiv->divider.hw, parent_rate);
> 
> }
> 
> static long clk_tdiv_round_rate(struct clk_hw *hw, unsigned long rate,
> 			       unsigned long *parent_rate)
> {
> 	struct clk_tdiv *tdiv = to_clk_tdiv(hw);
> 
> 	return tdiv->ops->round_rate(&tdiv->divider.hw, rate, parent_rate);
> }
> 
> static int clk_tdiv_set_rate(struct clk_hw *hw, unsigned long rate,
> 			    unsigned long parent_rate)
> {
> 	struct clk_tdiv *tdiv = to_clk_tdiv(hw);
> 	unsigned long tcfg1 = readl_relaxed(tdiv->reg);
> 	unsigned long divisor;
> 	int ret = 0;
> 
> 	tcfg1 >>= tdiv->divider.shift;
> 	tcfg1 &= ((1 << (tdiv->divider.width)) - 1);
> 
> 	rate = tdiv->ops->round_rate(&tdiv->divider.hw, rate, &parent_rate);
> 	divisor = parent_rate / rate;
> 
> 	if (divisor > 16)
> 		return -EINVAL;
> 
> 	tdiv->divisor = divisor;
> 
> 	/* Update the current MUX settings if we are currently
> 	 * selected as the clock source for this clock. */
> 
> 	if (!pwm_cfg_src_is_tclk(tcfg1))
> 		ret = tdiv->ops->set_rate(&tdiv->divider.hw, rate, 
parent_rate);
> 
> 	return ret;
> }
> 
> static struct clk_ops clk_tdiv_ops = {
> 	.recalc_rate = clk_tdiv_recalc_rate,
> 	.round_rate = clk_tdiv_round_rate,
> 	.set_rate = clk_tdiv_set_rate,
> };
> 
> static struct clk *samsung_clk_register_tdiv(const char *name,
> 		const char *parent_name, unsigned long flags,
> 		void __iomem *reg, u8 shift,
> 		u8 clk_divider_flags, const struct clk_div_table *table)
> {
> 	unsigned long tcfg1;
> 	const struct clk_div_table *clkt;
> 	struct clk_tdiv *tdiv;
> 	struct clk *clk;
> 	struct clk_init_data init;
> 
> 	tdiv = kzalloc(sizeof(struct clk_tdiv), GFP_KERNEL);
> 	if (!tdiv)
> 		return ERR_PTR(-ENOMEM);
> 
> 	init.name = name;
> 	init.ops = &clk_tdiv_ops;
> 	init.flags = flags;
> 	init.parent_names = (parent_name ? &parent_name: NULL);
> 	init.num_parents = (parent_name ? 1 : 0);
> 
> 	/* struct clk_divider assignments */
> 	tdiv->divider.reg = reg;
> 	tdiv->divider.shift = shift;
> 	tdiv->divider.width = 4;
> 	tdiv->divider.flags = clk_divider_flags;
> 	tdiv->divider.lock = &lock;
> 	tdiv->divider.hw.init = &init;
> 	tdiv->divider.table = table;
> 	tdiv->ops = &clk_divider_ops;
> 
> 	tcfg1 = readl_relaxed(reg);
> 	tcfg1 >>= tdiv->divider.shift;
> 	tcfg1 &= ((1 << (tdiv->divider.width)) - 1);
> 
> 	tdiv->reg = reg;
> 
> 	tdiv->divisor = 1;
> 	for (clkt = table; clkt->div; clkt++)
> 		if (clkt->val == tcfg1)
> 			tdiv->divisor = clkt->div;
> 
> 	clk = clk_register(NULL, &tdiv->divider.hw);
> 	if (IS_ERR(clk))
> 		kfree(tdiv);
> 
> 	return clk;
> }
> 
> struct clk_tin {
> 	struct clk_hw	hw;
> 	void __iomem	*reg;
> 	u8		shift;
> 	u8		width;
> 	spinlock_t	*lock;
> };
> 
> #define to_clk_tin(_hw) container_of(_hw, struct clk_tin, hw)
> 
> static u8 clk_tin_get_parent(struct clk_hw *hw)
> {
> 	struct clk_tin *tin = to_clk_tin(hw);
> 	unsigned long tcfg1 = readl_relaxed(tin->reg);
> 
> 	tcfg1 >>= tin->shift;
> 	tcfg1 &= ((1 << (tin->width)) - 1);
> 
> 	/* assume tclk is parent 0 and tdiv is parent 1 */
> 	return pwm_cfg_src_is_tclk(tcfg1) ? 0 : 1;
> }
> 
> static int clk_tin_set_parent(struct clk_hw *hw, u8 index)
> {
> 	struct clk_tin *tin = to_clk_tin(hw);
> 	struct clk *tdiv;
> 	struct clk *prescaler;
> 	unsigned long tcfg1;
> 	unsigned long flags = 0;
> 	unsigned long div;
> 	int bits;
> 
> 	switch (index) {
> 	case 0:
> 		if (current_soc == S3C24XX)
> 			bits = S3C2410_TCFG1_MUX_TCLK << tin->shift;
> 		else if (current_soc == S5P64XX)
> 			bits = 0;
> 		else
> 			bits = S3C64XX_TCFG1_MUX_TCLK << tin->shift;
> 		break;
> 	case 1:
> 		tdiv = clk_get(NULL, hw->init->parent_names[0]);
> 
> 		prescaler = clk_get_parent(tdiv);
> 		div = clk_get_rate(prescaler) / clk_get_rate(tdiv);
> 
> 		bits = (current_soc == S3C24XX) ? (ilog2(div) - 1) : 
ilog2(div);
> 		bits &= ((1 << (tin->width)) - 1);
> 		bits <<= tin->shift;
> 
> 		clk_put(tdiv);
> 		break;
> 	default:
> 		return -EINVAL;
> 	}
> 
> 	spin_lock_irqsave(tin->lock, flags);
> 
> 	tcfg1 = readl_relaxed(tin->reg);
> 	tcfg1 &= ~(((1 << tin->width) - 1) << tin->shift);
> 	tcfg1 |= bits;
> 	writel_relaxed(tcfg1, tin->reg);
> 
> 	spin_unlock_irqrestore(tin->lock, flags);
> 
> 	return 0;
> }
> 
> static const struct clk_ops clk_tin_ops = {
> 	.get_parent = clk_tin_get_parent,
> 	.set_parent = clk_tin_set_parent,
> };
> 
> static struct clk *samsung_clk_register_tin(const char *name,
> 		const char **parent_names, u8 num_parents,
> 		void __iomem *reg, u8 shift, u8 width)
> {
> 	struct clk_tin *tin;
> 	struct clk *clk;
> 	struct clk_init_data init;
> 
> 	/* allocate the mux */
> 	tin = kzalloc(sizeof(struct clk_tin), GFP_KERNEL);
> 	if (!tin) {
> 		pr_err("%s: could not allocate tin clk\n", __func__);
> 		return ERR_PTR(-ENOMEM);
> 	}
> 
> 	init.name = name;
> 	init.ops = &clk_tin_ops;
> 	init.parent_names = parent_names;
> 	init.num_parents = num_parents;
> 
> 	/* struct clk_mux assignments */
> 	tin->reg = reg;
> 	tin->shift = shift;
> 	tin->width = width;
> 	tin->lock = &lock;
> 	tin->hw.init = &init;
> 
> 	clk = clk_register(NULL, &tin->hw);
> 
> 	if (IS_ERR(clk))
> 		kfree(tin);
> 
> 	return clk;
> }
> 
> 
> PNAME(tin0_p) = { "pwm-tclk0", "pwm-tdiv0" };
> PNAME(tin1_p) = { "pwm-tclk0", "pwm-tdiv1" };
> PNAME(tin2_p) = { "pwm-tclk1", "pwm-tdiv2" };
> PNAME(tin3_p) = { "pwm-tclk1", "pwm-tdiv3" };
> PNAME(tin4_p) = { "pwm-tclk1", "pwm-tdiv4" };
> 
> static struct clk_div_table tdiv_s3c24xx_d[] = {
> 	{ .val = 0, .div = 2 },
> 	{ .val = 1, .div = 4 },
> 	{ .val = 2, .div = 8 },
> 	{ .val = 3, .div = 16 },
> 	{ .div = 0 },
> };
> struct samsung_div_clock pwm_s3c24xx_tdiv_dividers[] __initdata = {
> 	DIV_T(tdiv0, "pwm-tdiv0", "pwm-scaler0", TCFG1, 0, 4, 
tdiv_s3c24xx_d),
> 	DIV_T(tdiv1, "pwm-tdiv1", "pwm-scaler0", TCFG1, 4, 4, 
tdiv_s3c24xx_d),
> 	DIV_T(tdiv2, "pwm-tdiv2", "pwm-scaler1", TCFG1, 8, 4, 
tdiv_s3c24xx_d),
> 	DIV_T(tdiv3, "pwm-tdiv3", "pwm-scaler1", TCFG1, 12, 4, 
tdiv_s3c24xx_d),
> DIV_T(tdiv4, "pwm-tdiv4", "pwm-scaler1", TCFG1, 16, 4, tdiv_s3c24xx_d),
> };
> 
> static struct clk_div_table tdiv_s3c64xx_d[] = {
> 	{ .val = 0, .div = 1 },
> 	{ .val = 1, .div = 2 },
> 	{ .val = 2, .div = 4 },
> 	{ .val = 3, .div = 8 },
> 	{ .val = 4, .div = 16 },
> 	{ .div = 0 },
> };
> struct samsung_div_clock pwm_s3c64xx_tdiv_dividers[] __initdata = {
> 	DIV_T(tdiv0, "pwm-tdiv0", "pwm-scaler0", TCFG1, 0, 4, 
tdiv_s3c64xx_d),
> 	DIV_T(tdiv1, "pwm-tdiv1", "pwm-scaler0", TCFG1, 4, 4, 
tdiv_s3c64xx_d),
> 	DIV_T(tdiv2, "pwm-tdiv2", "pwm-scaler1", TCFG1, 8, 4, 
tdiv_s3c64xx_d),
> 	DIV_T(tdiv3, "pwm-tdiv3", "pwm-scaler1", TCFG1, 12, 4, 
tdiv_s3c64xx_d),
> DIV_T(tdiv4, "pwm-tdiv4", "pwm-scaler1", TCFG1, 16, 4, tdiv_s3c64xx_d),
> };
> 
> struct samsung_mux_clock pwm_tin[] __initdata = {
> 	MUX(tin0, "pwm-tin0", tin0_p, TCFG1, 0, 4),
> 	MUX(tin1, "pwm-tin1", tin1_p, TCFG1, 4, 4),
> 	MUX(tin2, "pwm-tin2", tin2_p, TCFG1, 8, 4),
> 	MUX(tin3, "pwm-tin3", tin3_p, TCFG1, 12, 4),
> 	MUX(tin4, "pwm-tin4", tin4_p, TCFG1, 16, 4),
> };
> 
> struct samsung_clock_alias pwm_aliases[] __initdata = {
> 	ALIAS(tdiv0, "s3c24xx-pwm.0", "pwm-tdiv"),
> 	ALIAS(tdiv1, "s3c24xx-pwm.1", "pwm-tdiv"),
> 	ALIAS(tdiv2, "s3c24xx-pwm.2", "pwm-tdiv"),
> 	ALIAS(tdiv3, "s3c24xx-pwm.3", "pwm-tdiv"),
> 	ALIAS(tdiv4, "s3c24xx-pwm.4", "pwm-tdiv"),
> 	ALIAS(tin0, "s3c24xx-pwm.0", "pwm-tin"),
> 	ALIAS(tin1, "s3c24xx-pwm.1", "pwm-tin"),
> 	ALIAS(tin2, "s3c24xx-pwm.2", "pwm-tin"),
> 	ALIAS(tin3, "s3c24xx-pwm.3", "pwm-tin"),
> 	ALIAS(tin4, "s3c24xx-pwm.4", "pwm-tin"),
> };
> 
> 
> #ifdef CONFIG_OF
> static struct of_device_id pwm_clk_ids[] __initdata = {
> 	{ .compatible = "samsung,s3c24xx-clock-pwm",
> 			.data = (void *)S3C24XX, },
> 	{ .compatible = "samsung,s3c64xx-clock-pwm",
> 			.data = (void *)S3C64XX, },
> 	{ .compatible = "samsung,s5p64xx-clock-pwm",
> 			.data = (void *)S5P64XX, },
> 	{ },
> };
> #endif
> 
> 
> void __init samsung_pwm_clk_init(struct device_node *np)
> {
> 	struct clk *clk;
> 	struct samsung_div_clock *tdiv_list;
> 	struct samsung_mux_clock *tin_list;
> 	struct samsung_clock_alias *alias_list;
> 	unsigned int idx;
> 	int ret;
> 
> 	if (np) {
> 		const struct of_device_id *match;
> 		match = of_match_node(pwm_clk_ids, np);
> 		current_soc = (u32)match->data;
> 
> 		reg_base = of_iomap(np, 0);
> 		if (!reg_base)
> 			panic("%s: failed to map registers\n", __func__);
> 	} else {
> 		reg_base = S3C_VA_TIMER;
> 		if (soc_is_s3c24xx())
> 			current_soc = S3C24XX;
> 		else if (soc_is_s3c64xx() || soc_is_s5pc100())
> 			current_soc = S3C64XX;
> 		else if (soc_is_s5p6440() || soc_is_s5p6450())
> 			current_soc = S5P64XX;
> 		else
> 			panic("%s: unable to determine soc\n", __func__);
> 	}
> 
> 	clk_table = kzalloc(sizeof(struct clk *) * nr_clks, GFP_KERNEL);
> 	if (!clk_table)
> 		panic("could not allocate clock lookup table\n");
> 
> #ifdef CONFIG_OF
> 	clk_data.clks = clk_table;
> 	clk_data.clk_num = nr_clks;
> 	of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
> #endif
> 
> #ifdef CONFIG_PM_SLEEP
> 	register_syscore_ops(&samsung_clk_pwm_syscore_ops);
> #endif
> 
> 
> 	clk = clk_register_fixed_rate(NULL, "pwm-tclk0", NULL, CLK_IS_ROOT, 
0);
> clk = clk_register_fixed_rate(NULL, "pwm-tclk1", NULL, CLK_IS_ROOT, 0);
> 
> 	clk = clk_register_divider(NULL, "pwm-scaler0", "pwm", 0, reg_base +
> TCFG0, 0, 8, 0, &lock); clk = clk_register_divider(NULL, "pwm-scaler1",
> "pwm", 0, reg_base + TCFG0, 8, 8, 0, &lock);
> 
> 	tdiv_list = (current_soc == S3C24XX) ? pwm_s3c24xx_tdiv_dividers
> 
> 					      : pwm_s3c64xx_tdiv_dividers;
> 
> 	for (idx = 0; idx < 5; idx++, tdiv_list++) {
> 		clk = samsung_clk_register_tdiv(tdiv_list->name,
> tdiv_list->parent_name, tdiv_list->flags, reg_base + tdiv_list->offset,
> 				tdiv_list->shift, tdiv_list->div_flags, tdiv_list-
>table);
> 		if (IS_ERR(clk)) {
> 			pr_err("%s: failed to register clock %s\n", __func__,
> 				tdiv_list->name);
> 			continue;
> 		}
> 
> 		if (clk_table && tdiv_list->id)
> 			clk_table[tdiv_list->id] = clk;
> 	}
> 
> 	tin_list = pwm_tin;
> 	for (idx = 0; idx < 5; idx++, tin_list++) {
> 		clk = samsung_clk_register_tin(tin_list->name,
> 				tin_list->parent_names, tin_list->num_parents,
> 				reg_base + tin_list->offset, tin_list->shift,
> 				tin_list->width);
> 
> 		if (IS_ERR(clk)) {
> 			pr_err("%s: failed to register clock %s\n", __func__,
> 				tin_list->name);
> 			continue;
> 		}
> 
> 		if (clk_table && tin_list->id)
> 			clk_table[tin_list->id] = clk;
> 	}
> 
> 	alias_list = pwm_aliases;
> 	for (idx = 0; idx < ARRAY_SIZE(pwm_aliases); idx++, alias_list++) {
> 		if (!alias_list->id) {
> 			pr_err("%s: clock id missing for index %d\n", __func__,
> 				idx);
> 			continue;
> 		}
> 
> 		clk = clk_table[alias_list->id];
> 		if (!clk) {
> 			pr_err("%s: failed to find clock %d\n", __func__,
> 				alias_list->id);
> 			continue;
> 		}
> 
> 		ret = clk_register_clkdev(clk, alias_list->alias,
> 					  alias_list->dev_name);
> 		if (ret)
> 			pr_err("%s: failed to register lookup %s\n",
> 						__func__, alias_list->alias);
> 	}
> }

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

* [PATCH 00/23] RFC: exynos multiplatform support
  2013-03-06 12:34         ` Thierry Reding
@ 2013-03-06 22:57           ` Tomasz Figa
  2013-03-07  3:02           ` Arnd Bergmann
  1 sibling, 0 replies; 49+ messages in thread
From: Tomasz Figa @ 2013-03-06 22:57 UTC (permalink / raw)
  To: linux-arm-kernel

On Wednesday 06 of March 2013 13:34:26 Thierry Reding wrote:
> On Wed, Mar 06, 2013 at 10:50:42AM +0000, Arnd Bergmann wrote:
> > On Tuesday 05 March 2013, Tomasz Figa wrote:
> > > On Tuesday 05 of March 2013 19:19:02 Arnd Bergmann wrote:
> > > > If none of these are needed for DT-based systems, we should
> > > > probably
> > > > build that code conditionally based on the CONFIG_EXYNOS_ATAGS
> > > > symbol
> > > > I introduced.
> > > 
> > > Yes, none of them are needed for DT-based systems.
> > 
> > Ah, good. I'll try to make more code conditional then.
> > 
> > > > How are you planning to solve this? Do you want to have a combined
> > > > driver that registers both a clocksource and a pwm?
> > > 
> > > Let's start with a quick introduction to the s3c-pwm hardware. Each
> > > channel has its own timer value, compare and reload value registers,
> > > so
> > > they don't need any extra locking. However there are additional
> > > shared
> > > configuration registers, containing things such as start and reload
> > > bits for all channels, prescaler and main divisor values, etc.
> > > Those registers needs synchronization.
> > > 
> > > Now there are several possible approaches:
> > > 
> > > 1) A brute force one - two separate drivers, based on the fact that
> > > the
> > > 
> > >    clocksource driver will be used only on uniprocessor systems, so
> > >    a simple _irqsave when accessing a shared register in both will
> > >    guarantee correct synchronization.
> > > 
> > > 2) Two separate drivers with some synchronized shared code accessing
> > > 
> > >    registers (_start, _stop, _set_reload, _set_prescaler,
> > >    _set_divisor,
> > >    etc.; all using a shared spinlock).
> > > 
> > > 3) Single driver registering PWM channels, clocksource and clock
> > > event
> > > 
> > >    device. This does not seem like a bad idea, since the whole code
> > >    for
> > >    configuration of the PWM block would reside in one location and
> > >    there
> > >    would be no redundancy. However there is a question where such
> > >    driver
> > >    should be placed - drivers/clocksource, drivers/pwm, or maybe
> > >    somewhere
> > >    else?
> > > 
> > > Personally I wanted to go with first option, which would require
> > > least
> > > amount of changes to existing code, at a cost of some code
> > > duplication
> > > (but some PWM code is duplicated already).
> > 
> > I would prefer option 3. That is also easier to implement with a
> > straightforward DT binding that defines a single node with the clock
> > registers. The location doesn't have an obvious answer, but I would
> > probably put them into drivers/clocksource if the PWM maintainer
> > agrees.
> > 
> > Option 2 would probably come down to having a trivial MFD driver
> > exposing a regmap. You can probably reuse drivers/mfd/syscon.c for
> > this and make the node compatible with "syscon" to designate the
> > clock registers as a system-wide resource, making the other device
> > nodes register-less.
> I think option 2 is the standard method if one hardware block provides
> several logical devices. I find it to be a pretty nice solution to this
> problem. We also have precedent in the PWM subsystem. The TWL chips for
> instance use it to create a platform device which is later driven by a
> PWM driver.

I prefer this option over 3), because current driver files could be easily 
reused (just cleaned up and moved into appropriate directories), which 
would minimize the amount of needed changes.

Another reason for having two separate drivers is that on Exynos SoCs the 
PWM block is not used for timers at all, just for PWM outputs, so the 
whole part responsible for clocksource would be useless.

Best regards,
Tomasz

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

* [PATCH 00/23] RFC: exynos multiplatform support
  2013-03-06 12:34         ` Thierry Reding
  2013-03-06 22:57           ` Tomasz Figa
@ 2013-03-07  3:02           ` Arnd Bergmann
  2013-03-07  7:22             ` Thierry Reding
  1 sibling, 1 reply; 49+ messages in thread
From: Arnd Bergmann @ 2013-03-07  3:02 UTC (permalink / raw)
  To: linux-arm-kernel

On Wednesday 06 March 2013, Thierry Reding wrote:
> > Option 2 would probably come down to having a trivial MFD driver exposing
> > a regmap. You can probably reuse drivers/mfd/syscon.c for this and make
> > the node compatible with "syscon" to designate the clock registers as
> > a system-wide resource, making the other device nodes register-less.
> 
> I think option 2 is the standard method if one hardware block provides
> several logical devices. I find it to be a pretty nice solution to this
> problem. We also have precedent in the PWM subsystem. The TWL chips for
> instance use it to create a platform device which is later driven by a
> PWM driver.

One difference though is that the TWL chip is a heterogenous MFD that has
a lot of different sub-devices, where in case of Exynos the timer device
has a set of identical units, each of which can be used either as a PWM or
as a clocksource or other timer.

	Arnd

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

* [PATCH 00/23] RFC: exynos multiplatform support
  2013-03-07  3:02           ` Arnd Bergmann
@ 2013-03-07  7:22             ` Thierry Reding
  2013-03-08  0:40               ` Tomasz Figa
  0 siblings, 1 reply; 49+ messages in thread
From: Thierry Reding @ 2013-03-07  7:22 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Mar 07, 2013 at 03:02:46AM +0000, Arnd Bergmann wrote:
> On Wednesday 06 March 2013, Thierry Reding wrote:
> > > Option 2 would probably come down to having a trivial MFD driver exposing
> > > a regmap. You can probably reuse drivers/mfd/syscon.c for this and make
> > > the node compatible with "syscon" to designate the clock registers as
> > > a system-wide resource, making the other device nodes register-less.
> > 
> > I think option 2 is the standard method if one hardware block provides
> > several logical devices. I find it to be a pretty nice solution to this
> > problem. We also have precedent in the PWM subsystem. The TWL chips for
> > instance use it to create a platform device which is later driven by a
> > PWM driver.
> 
> One difference though is that the TWL chip is a heterogenous MFD that has
> a lot of different sub-devices, where in case of Exynos the timer device
> has a set of identical units, each of which can be used either as a PWM or
> as a clocksource or other timer.

I didn't know that. However I still making this an MFD driver is a good
fit because it'll move the logic of defining the mode of each unit is
kept in a parent driver which can instantiate the proper child devices
for the corresponding subsystems.

One big disadvantage of this approach is that if this is continued there
is a risk that MFD will turn into a dump for all kinds of devices that
provide more than a single service.

So if people prefer option 3 I'm fine with it as well.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130307/44a92c5e/attachment.sig>

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

* [PATCH 00/23] RFC: exynos multiplatform support
  2013-03-07  7:22             ` Thierry Reding
@ 2013-03-08  0:40               ` Tomasz Figa
  2013-03-08 12:52                 ` Arnd Bergmann
  0 siblings, 1 reply; 49+ messages in thread
From: Tomasz Figa @ 2013-03-08  0:40 UTC (permalink / raw)
  To: linux-arm-kernel

On Thursday 07 of March 2013 08:22:03 Thierry Reding wrote:
> On Thu, Mar 07, 2013 at 03:02:46AM +0000, Arnd Bergmann wrote:
> > On Wednesday 06 March 2013, Thierry Reding wrote:
> > > > Option 2 would probably come down to having a trivial MFD driver
> > > > exposing a regmap. You can probably reuse drivers/mfd/syscon.c
> > > > for this and make the node compatible with "syscon" to designate
> > > > the clock registers as a system-wide resource, making the other
> > > > device nodes register-less.> > 
> > > I think option 2 is the standard method if one hardware block
> > > provides
> > > several logical devices. I find it to be a pretty nice solution to
> > > this
> > > problem. We also have precedent in the PWM subsystem. The TWL chips
> > > for
> > > instance use it to create a platform device which is later driven by
> > > a
> > > PWM driver.
> > 
> > One difference though is that the TWL chip is a heterogenous MFD that
> > has a lot of different sub-devices, where in case of Exynos the timer
> > device has a set of identical units, each of which can be used either
> > as a PWM or as a clocksource or other timer.
> 
> I didn't know that. However I still making this an MFD driver is a good
> fit because it'll move the logic of defining the mode of each unit is
> kept in a parent driver which can instantiate the proper child devices
> for the corresponding subsystems.
> 
> One big disadvantage of this approach is that if this is continued there
> is a risk that MFD will turn into a dump for all kinds of devices that
> provide more than a single service.
> 
> So if people prefer option 3 I'm fine with it as well.

I have a question regarding making this an MFD driver.

As you know, the main clocksource driver must be initialized early, from 
init_time callback of machine_desc. How does using the MFD subsystem fit 
into this scheme?

P.S. I'm still not convinced about any benefits of options 2 and 3 over 
option 1, which has the obvious advantage of requiring least amount of 
changes to existing code and not binding the PWM and clocksource drivers 
together (on Exynos SoCs only the PWM driver is used, clocksource is 
handled by different hardware block - MCT).

Best regards,
Tomasz

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

* [PATCH 00/23] RFC: exynos multiplatform support
  2013-03-08  0:40               ` Tomasz Figa
@ 2013-03-08 12:52                 ` Arnd Bergmann
  0 siblings, 0 replies; 49+ messages in thread
From: Arnd Bergmann @ 2013-03-08 12:52 UTC (permalink / raw)
  To: linux-arm-kernel

On Friday 08 March 2013, Tomasz Figa wrote:
> I have a question regarding making this an MFD driver.
> 
> As you know, the main clocksource driver must be initialized early, from 
> init_time callback of machine_desc. How does using the MFD subsystem fit 
> into this scheme?
> 
> P.S. I'm still not convinced about any benefits of options 2 and 3 over 
> option 1, which has the obvious advantage of requiring least amount of 
> changes to existing code and not binding the PWM and clocksource drivers 
> together (on Exynos SoCs only the PWM driver is used, clocksource is 
> handled by different hardware block - MCT).

I think the main motivation for the MFD here is that you have a shared
register set, which would be described as a single device node in DT
as its natural representation, but it's not easy to have two drivers
be responsible for the same platform device. Similarly, the Linux
resource handling tries hard to ensure that multiple device drivers
do not share a single register set.

If you have an MFD driver, that could bind do the platform_device created
from the DT device node, and provide a simple interface for both the
timer and the pwm driver to talk to, without exposing those registers
directly. Or you could use the syscon regmap approach to expose
those registers in a more controlled way. With syscon, you don't actually
have to write an MFD driver but could just use the one that is already
there.

Since you want the timer driver to be available really early, you could
also make that timer driver the master and expose an interface for
the PWM driver to use.

	Arnd

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

* [PATCH 10/23] [media] exynos: remove unnecessary header inclusions
  2013-03-05 17:42 ` [PATCH 10/23] [media] exynos: remove unnecessary header inclusions Arnd Bergmann
@ 2013-04-02 13:08   ` Sylwester Nawrocki
  0 siblings, 0 replies; 49+ messages in thread
From: Sylwester Nawrocki @ 2013-04-02 13:08 UTC (permalink / raw)
  To: linux-arm-kernel

On 03/05/2013 06:42 PM, Arnd Bergmann wrote:
> In multiplatform configurations, we cannot include headers
> provided by only the exynos platform. Fortunately a number
> of drivers that include those headers do not actually need
> them, so we can just remove the inclusions.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/media/platform/exynos-gsc/gsc-regs.c | 1 -
>  drivers/media/platform/s5p-tv/sii9234_drv.c  | 3 ---

Cc: linux-media at vger.kernel.org

Thanks Arnd. I have applied this patch to my tree for 3.10.

>  2 files changed, 4 deletions(-)
> 
> diff --git a/drivers/media/platform/exynos-gsc/gsc-regs.c b/drivers/media/platform/exynos-gsc/gsc-regs.c
> index 6f5b5a4..e22d147 100644
> --- a/drivers/media/platform/exynos-gsc/gsc-regs.c
> +++ b/drivers/media/platform/exynos-gsc/gsc-regs.c
> @@ -12,7 +12,6 @@
>  
>  #include <linux/io.h>
>  #include <linux/delay.h>
> -#include <mach/map.h>
>  
>  #include "gsc-core.h"
>  
> diff --git a/drivers/media/platform/s5p-tv/sii9234_drv.c b/drivers/media/platform/s5p-tv/sii9234_drv.c
> index d90d228..39b77d2 100644
> --- a/drivers/media/platform/s5p-tv/sii9234_drv.c
> +++ b/drivers/media/platform/s5p-tv/sii9234_drv.c
> @@ -23,9 +23,6 @@
>  #include <linux/regulator/machine.h>
>  #include <linux/slab.h>
>  
> -#include <mach/gpio.h>
> -#include <plat/gpio-cfg.h>
> -
>  #include <media/sii9234.h>
>  #include <media/v4l2-subdev.h>

--

Regards,
Sylwester

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

* [PATCH 07/23] i2c: s3c2410: make header file local
  2013-03-05 17:42 ` [PATCH 07/23] i2c: s3c2410: make header file local Arnd Bergmann
@ 2013-04-02 20:36   ` Heiko Stübner
  0 siblings, 0 replies; 49+ messages in thread
From: Heiko Stübner @ 2013-04-02 20:36 UTC (permalink / raw)
  To: linux-arm-kernel

Am Dienstag, 5. M?rz 2013, 18:42:17 schrieb Arnd Bergmann:
> No other file in the kernel besides i2c-s3c2410.c uses
> the current plat/regs-iic.h, so we can simply move the
> header file to live in the same directory as the driver,
> as a preparation to multiplatform builds.

A patch doing the same is already sitting in the i2c for-next branch [0].


Heiko



[0] https://git.kernel.org/cgit/linux/kernel/git/wsa/linux.git/commit/?h=i2c/for-next&id=e636602ac2613da8c1777cb42443223994be4107

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

end of thread, other threads:[~2013-04-02 20:36 UTC | newest]

Thread overview: 49+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-05 17:42 [PATCH 00/23] RFC: exynos multiplatform support Arnd Bergmann
2013-03-05 17:42 ` [PATCH 01/23] ARM: exynos: introduce EXYNOS_ATAGS symbol Arnd Bergmann
2013-03-05 17:42 ` [PATCH 02/23] irqchip: exynos: remove dependency on mach/irqs.h Arnd Bergmann
2013-03-05 17:42 ` [PATCH 03/23] tty: serial/samsung: prepare for common clock API Arnd Bergmann
2013-03-05 17:42 ` [PATCH 04/23] tty: serial/samsung: make register definitions global Arnd Bergmann
2013-03-05 17:42 ` [PATCH 05/23] tty: serial/samsung: fix modular build Arnd Bergmann
2013-03-05 17:42 ` [PATCH 06/23] ARM: exynos: move debug-macro.S to include/debug/ Arnd Bergmann
2013-03-05 17:42 ` [PATCH 07/23] i2c: s3c2410: make header file local Arnd Bergmann
2013-04-02 20:36   ` Heiko Stübner
2013-03-05 17:42 ` [PATCH 08/23] mmc: sdhci-s3c: remove platform dependencies Arnd Bergmann
2013-03-05 17:42 ` [PATCH 09/23] usb: exynos: do not include plat/usb-phy.h Arnd Bergmann
2013-03-05 17:42 ` [PATCH 10/23] [media] exynos: remove unnecessary header inclusions Arnd Bergmann
2013-04-02 13:08   ` Sylwester Nawrocki
2013-03-05 17:42 ` [PATCH 11/23] video/exynos: " Arnd Bergmann
2013-03-05 17:42 ` [PATCH 12/23] thermal/exynos: " Arnd Bergmann
2013-03-05 17:42 ` [PATCH 13/23] mtd: onenand/samsung: make regs-onenand.h file local Arnd Bergmann
2013-03-05 17:42 ` [PATCH 14/23] rtc: s3c: make header " Arnd Bergmann
2013-03-05 17:42 ` [PATCH 15/23] spi: s3c64xx: move to generic dmaengine API Arnd Bergmann
2013-03-06  9:14   ` Padma Venkat
2013-03-05 17:42 ` [PATCH 16/23] pwm: samsung: repair the worst MMIO abuses Arnd Bergmann
2013-03-05 17:42 ` [PATCH 17/23] ASoC: samsung: move plat/ headers to local directory Arnd Bergmann
2013-03-05 17:42 ` [PATCH 18/23] ASoC: samsung: convert to dmaengine API Arnd Bergmann
2013-03-06  8:58   ` Padma Venkat
2013-03-06 12:01     ` Arnd Bergmann
2013-03-05 17:42 ` [PATCH 19/23] ASoC: samsung: use irq resource for idma Arnd Bergmann
2013-03-05 17:42 ` [PATCH 20/23] ARM: exynos: prepare for sparse IRQ Arnd Bergmann
2013-03-05 17:42 ` [PATCH 21/23] ARM: exynos: hack to disable private clock code Arnd Bergmann
2013-03-05 17:42 ` [PATCH 22/23] ARM: exynos: work around missing gpio code on multiplatform Arnd Bergmann
2013-03-05 17:42 ` [PATCH 23/23] ARM: exynos: experimental multiplatform support Arnd Bergmann
2013-03-05 18:27 ` [PATCH 00/23] RFC: exynos " Tony Lindgren
2013-03-05 18:28 ` Tomasz Figa
2013-03-05 19:19   ` Arnd Bergmann
2013-03-05 22:48     ` Tomasz Figa
2013-03-06 10:50       ` Arnd Bergmann
2013-03-06 12:34         ` Thierry Reding
2013-03-06 22:57           ` Tomasz Figa
2013-03-07  3:02           ` Arnd Bergmann
2013-03-07  7:22             ` Thierry Reding
2013-03-08  0:40               ` Tomasz Figa
2013-03-08 12:52                 ` Arnd Bergmann
2013-03-06 22:14       ` Heiko Stübner
2013-03-06 22:55         ` Tomasz Figa
2013-03-05 20:50 ` Heiko Stübner
2013-03-05 21:24   ` Arnd Bergmann
2013-03-05 21:54     ` Arnd Bergmann
2013-03-05 22:12       ` Tomasz Figa
2013-03-05 22:21         ` Arnd Bergmann
2013-03-05 22:25       ` Heiko Stübner
2013-03-05 22:43         ` Arnd Bergmann

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