Skip to contentSkip to conversation

RFC: exynos multiplatform support

PATCH New Arnd Bergmann 8 participants 50 messages Mar 5, 2013 – Apr 2, 2013

Subsystems (28)
lore
Share & tools
lore
#0 lore raw

cover RFC: exynos multiplatform support

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
Signature · 1 line
1.8.1.2
#1 lore raw

PATCH 1/23 ARM: exynos: introduce EXYNOS_ATAGS symbol

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.

---
 arch/arm/mach-exynos/Kconfig | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/arm/mach-exynos/Kconfig +15 -0
index 70f94c8..3291a72 100644
@@ -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
Signature · 1 line
1.8.1.2
#2 lore raw

PATCH 2/23 irqchip: exynos: remove dependency on mach/irqs.h

In reply to Arnd Bergmann

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.

---
 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(-)
arch/arm/mach-exynos/common.c +3 -2
index d63d399..4b4526d 100644
@@ -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.
arch/arm/mach-exynos/common.h +1 -1
index 9339bb8..ed96450 100644
@@ -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;
 
drivers/irqchip/exynos-combiner.c +60 -53

188 lines not on this page · raw message

Signature · 1 line
1.8.1.2
#3 lore raw

PATCH 3/23 tty: serial/samsung: prepare for common clock API

In reply to Arnd Bergmann

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.

---
 drivers/tty/serial/samsung.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/tty/serial/samsung.c +6 -1
index 2769a38..603f3f3 100644
@@ -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);
 	}
 
Signature · 1 line
1.8.1.2
#4 lore raw

PATCH 4/23 tty: serial/samsung: make register definitions global

In reply to Arnd Bergmann

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.

---
 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
arch/arm/mach-s3c24xx/clock-s3c2440.c +5 -0
index 04b87ec..1069b56 100644
@@ -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;
arch/arm/mach-s3c24xx/common.c +5 -0
index 6bcf87f..92e6094 100644
@@ -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, \
arch/arm/plat-samsung/include/plat/regs-serial.h +1 -281

282 lines not on this page · raw message

drivers/tty/serial/samsung.c +3 -3
index 603f3f3..729a60d 100644
@@ -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"
 
include/linux/serial_s3c.h new file +260 -0

260 lines not on this page · raw message

Signature · 1 line
1.8.1.2
#5 lore raw

PATCH 5/23 tty: serial/samsung: fix modular build

In reply to Arnd Bergmann

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.

---
 drivers/tty/serial/samsung.c | 4 ++--
 drivers/tty/serial/samsung.h | 4 +++-
 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/tty/serial/samsung.c +2 -2
index 729a60d..a3277ca 100644
@@ -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
drivers/tty/serial/samsung.h +3 -1
index 1a4bca3..00a499e 100644
@@ -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 *);
 
Signature · 1 line
1.8.1.2
#6 lore raw

PATCH 6/23 ARM: exynos: move debug-macro.S to include/debug/

In reply to Arnd Bergmann

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

---
 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
arch/arm/Kconfig.debug +8 -0
index acdddda..3c6851a 100644
@@ -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 || \
arch/arm/include/debug/exynos.S new file +39 -0
new file mode 100644
index 0000000..b17fdb7
@@ -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>
arch/arm/include/debug/samsung.S new file +87 -0

87 lines not on this page · raw message

arch/arm/mach-exynos/include/mach/debug-macro.S deleted +0 -39
deleted file mode 100644
index e0c86ea..0000000
@@ -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>
arch/arm/mach-s3c24xx/include/mach/debug-macro.S +1 -1
index 13ed33c..2558952 100644
@@ -98,4 +98,4 @@
 
 /* include the reset of the code which will do the work */
 
-#include <plat/debug-macro.S>
+#include <debug/samsung.S>
arch/arm/mach-s3c64xx/include/mach/debug-macro.S +1 -1
index c0c076a..dd9ccca 100644
@@ -35,4 +35,4 @@
  * will be fine with us.
  */
 
-#include <plat/debug-macro.S>
+#include <debug/samsung.S>
arch/arm/mach-s5p64x0/include/mach/debug-macro.S +1 -1
index e80ba3c..5e2916f 100644
@@ -30,4 +30,4 @@
 #endif
 	.endm
 
-#include <plat/debug-macro.S>
+#include <debug/samsung.S>
arch/arm/mach-s5pc100/include/mach/debug-macro.S +1 -1
index 694f759..66cb7f1 100644
@@ -36,4 +36,4 @@
  * will be fine with us.
  */
 
-#include <plat/debug-macro.S>
+#include <debug/samsung.S>
arch/arm/mach-s5pv210/include/mach/debug-macro.S +1 -1
index 79e5559..80c2199 100644
@@ -38,4 +38,4 @@
  * will be fine with us.
  */
 
-#include <plat/debug-macro.S>
+#include <debug/samsung.S>
arch/arm/plat-samsung/include/plat/debug-macro.S deleted +0 -87

87 lines not on this page · raw message

Signature · 1 line
1.8.1.2
#7 lore raw

PATCH 7/23 i2c: s3c2410: make header file local

In reply to 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.

---
 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
arch/arm/mach-s3c24xx/mach-rx1950.c +0 -1
index 1f9ba2a..43f3ac5 100644
@@ -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"
arch/arm/plat-samsung/devs.c +0 -1
index 51afedd..76209c9 100644
@@ -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>
arch/arm/plat-samsung/include/plat/regs-iic.h deleted +0 -56

56 lines not on this page · raw message

drivers/i2c/busses/i2c-s3c2410.c +2 -1
index f6b880b..d042ad0 100644
@@ -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)
drivers/i2c/busses/i2c-s3c2410.h new file +56 -0

56 lines not on this page · raw message

Signature · 1 line
1.8.1.2
#8 lore raw

PATCH 7/23 i2c: s3c2410: make header file local

Am Dienstag, 5. M?rz 2013, 18:42:17 schrieb Arnd Bergmann:

Quoted 4 lines

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

#9 lore raw

PATCH 8/23 mmc: sdhci-s3c: remove platform dependencies

In reply to Arnd Bergmann

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.

---
 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
arch/arm/mach-exynos/setup-sdhci-gpio.c +1 -1
index e8d08bf..d5b98c8 100644
@@ -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)
arch/arm/mach-s5pc100/setup-sdhci-gpio.c +0 -1
index 03c02d0..6010c03 100644
@@ -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)
arch/arm/mach-s5pv210/setup-sdhci-gpio.c +0 -1
index 3e3ac05..0512ada 100644
@@ -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)
arch/arm/plat-samsung/include/plat/regs-sdhci.h deleted +0 -87

87 lines not on this page · raw message

arch/arm/plat-samsung/include/plat/sdhci.h +1 -55

68 lines not on this page · raw message

drivers/mmc/host/Kconfig +1 -1
index d88219e..d054744 100644
@@ -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
drivers/mmc/host/sdhci-s3c-regs.h new file +87 -0

87 lines not on this page · raw message

drivers/mmc/host/sdhci-s3c.c +2 -3
index 7363efe..e4f52b5 100644
@@ -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)
include/linux/platform_data/mmc-sdhci-s3c.h new file +56 -0

56 lines not on this page · raw message

Signature · 1 line
1.8.1.2
#10 lore raw

PATCH 9/23 usb: exynos: do not include plat/usb-phy.h

In reply to Arnd Bergmann

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.

---
 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(-)
arch/arm/mach-exynos/setup-usb-phy.c +4 -4
index b81cc56..6af4066 100644
@@ -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;
arch/arm/mach-s3c64xx/setup-usb-phy.c +2 -2
index c8174d9..ca960bd 100644
@@ -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;
arch/arm/mach-s5pv210/setup-usb-phy.c +2 -2
index 356a090..b2ee533 100644
@@ -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;
arch/arm/plat-samsung/include/plat/usb-phy.h +1 -4
index 959bcdb..ab34dfa 100644
@@ -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);
drivers/usb/host/ehci-s5p.c +0 -1
index 20ebf6a..7dc9c15 100644
@@ -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)
drivers/usb/host/ohci-exynos.c +0 -1
index e3b7e85..b5b5977 100644
@@ -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;
Signature · 1 line
1.8.1.2
#11 lore raw

PATCH 10/23 exynos: remove unnecessary header inclusions

In reply to Arnd Bergmann

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.

---
 drivers/media/platform/exynos-gsc/gsc-regs.c | 1 -
 drivers/media/platform/s5p-tv/sii9234_drv.c  | 3 ---
 2 files changed, 4 deletions(-)
drivers/media/platform/exynos-gsc/gsc-regs.c +0 -1
index 6f5b5a4..e22d147 100644
@@ -12,7 +12,6 @@
 
 #include <linux/io.h>
 #include <linux/delay.h>
-#include <mach/map.h>
 
 #include "gsc-core.h"
 
drivers/media/platform/s5p-tv/sii9234_drv.c +0 -3
index d90d228..39b77d2 100644
@@ -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>
 
Signature · 1 line
1.8.1.2
#12 lore raw

PATCH 10/23 exynos: remove unnecessary header inclusions

Quoted 9 lines · Arnd Bergmann

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.

---
 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.

Quoted 19 lines
 2 files changed, 4 deletions(-)
drivers/media/platform/exynos-gsc/gsc-regs.c +0 -1
index 6f5b5a4..e22d147 100644
@@ -12,7 +12,6 @@
 
 #include <linux/io.h>
 #include <linux/delay.h>
-#include <mach/map.h>
 
 #include "gsc-core.h"
 
drivers/media/platform/s5p-tv/sii9234_drv.c +0 -0
index d90d228..39b77d2 100644

drivers/media/platform/s5p-tv/sii9234_drv.c line 27

Quoted 8 lines
drivers/media/platform/s5p-tv/sii9234_drv.c +0 -3
@@ -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

#13 lore raw

Re: [PATCH 10/23] [media] exynos: remove unnecessary header inclusions

Quoted 6 lines · Sylwester Nawrocki
Quoted 5 lines · Arnd Bergmann

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.

Quoted 6 lines
Quoted 4 lines
---
 drivers/media/platform/exynos-gsc/gsc-regs.c | 1 -
 drivers/media/platform/s5p-tv/sii9234_drv.c  | 3 ---

Uhh, now really added it to Cc.

Quoted 34 lines

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

Quoted 19 lines
 2 files changed, 4 deletions(-)
drivers/media/platform/exynos-gsc/gsc-regs.c +0 -1
index 6f5b5a4..e22d147 100644
@@ -12,7 +12,6 @@
 
 #include <linux/io.h>
 #include <linux/delay.h>
-#include <mach/map.h>
 
 #include "gsc-core.h"
 
drivers/media/platform/s5p-tv/sii9234_drv.c +0 -0
index d90d228..39b77d2 100644

drivers/media/platform/s5p-tv/sii9234_drv.c line 27

Quoted 8 lines
drivers/media/platform/s5p-tv/sii9234_drv.c +0 -3
@@ -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

#14 lore raw

PATCH 11/23 video/exynos: remove unnecessary header inclusions

In reply to Arnd Bergmann

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.

---
 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(-)
drivers/video/exynos/exynos_mipi_dsi.c +0 -2
index fac7df6..3dd43ca 100644
@@ -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"
 
drivers/video/exynos/exynos_mipi_dsi_common.c +0 -2
index c70cb89..520fc9b 100644
@@ -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"
drivers/video/exynos/exynos_mipi_dsi_lowlevel.c +0 -2
index 95cb99a..15c5abd 100644
@@ -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)
Signature · 1 line
1.8.1.2
#15 lore raw

PATCH 12/23 thermal/exynos: remove unnecessary header inclusions

In reply to Arnd Bergmann

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.

---
 drivers/thermal/exynos_thermal.c | 2 --
 1 file changed, 2 deletions(-)
drivers/thermal/exynos_thermal.c +0 -2
index e04ebd8..8dd7984 100644
@@ -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
Signature · 1 line
1.8.1.2
#16 lore raw

PATCH 13/23 mtd: onenand/samsung: make regs-onenand.h file local

In reply to Arnd Bergmann

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.

---
 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
arch/arm/plat-samsung/include/plat/regs-onenand.h deleted +0 -63
deleted file mode 100644
index 930ea8b..0000000
@@ -1,63 +0,0 @@
-/*
- * linux/arch/arm/plat-s3c/include/plat/regs-onenand.h
- *
- *  Copyright (C) 2008-2010 Samsung Electronics
- *  Kyungmin Park <[email protected]>
- *
- * 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
drivers/mtd/onenand/samsung.c +2 -2
index 33f2a8f..2cf7408 100644
@@ -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,
drivers/mtd/onenand/samsung.h new file +61 -0

61 lines not on this page · raw message

Signature · 1 line
1.8.1.2
#17 lore raw

PATCH 14/23 rtc: s3c: make header file local

In reply to Arnd Bergmann

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.

---
 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
arch/arm/plat-samsung/include/plat/regs-rtc.h deleted +0 -71
deleted file mode 100644
index 0f8263e..0000000
@@ -1,71 +0,0 @@
-/* arch/arm/mach-s3c2410/include/mach/regs-rtc.h
- *
- * Copyright (c) 2003 Simtec Electronics <[email protected]>
- *		      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 */
drivers/rtc/rtc-s3c.c +1 -2
index fb994e9..7995f79 100644
@@ -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,
drivers/rtc/rtc-s3c.h new file +70 -0

70 lines not on this page · raw message

Signature · 1 line
1.8.1.2
#18 lore raw

PATCH 15/23 spi: s3c64xx: move to generic dmaengine API

In reply to Arnd Bergmann

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.

---
 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(-)
arch/arm/plat-samsung/devs.c +10 -0
index 76209c9..58fb02a 100644
@@ -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);
 }
drivers/spi/spi-s3c64xx.c +49 -58

222 lines not on this page · raw message

include/linux/platform_data/spi-s3c64xx.h +3 -0
index ceba18d..8447f63 100644
@@ -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;
 };
 
 /**
Signature · 1 line
1.8.1.2
#19 lore raw

PATCH 15/23 spi: s3c64xx: move to generic dmaengine API

Hi Arnd,

Quoted 313 lines · Arnd Bergmann

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.

---
 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(-)
arch/arm/plat-samsung/devs.c +10 -0
index 76209c9..58fb02a 100644
@@ -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);
 }
drivers/spi/spi-s3c64xx.c +49 -58
index e862ab8..9be07a6 100644
@@ -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;
include/linux/platform_data/spi-s3c64xx.h +2 -0
index ceba18d..8447f63 100644
@@ -11,6 +11,8 @@
 #ifndef __S3C64XX_PLAT_SPI_H
 #define __S3C64XX_PLAT_SPI_H
 
+#include <linux/dmaengine.h>
+
 struct platform_device;
 
 /**

include/linux/platform_data/spi-s3c64xx.h struct s3c64xx_spi_info { · line 45

Quoted 6 lines
include/linux/platform_data/spi-s3c64xx.h +1 -0
@@ -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

Quoted 8 lines
include/linux/platform_data/spi-s3c64xx.h +0 -1
 /**
--

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

#20 lore raw

PATCH 16/23 pwm: samsung: repair the worst MMIO abuses

In reply to Arnd Bergmann

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.

---
 drivers/pwm/pwm-samsung.c | 60 +++++++++++++++++++++++++++++++++--------------
 1 file changed, 42 insertions(+), 18 deletions(-)
drivers/pwm/pwm-samsung.c +42 -18
index 5207e6c..9d7234d 100644
@@ -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;
 }
Signature · 1 line
1.8.1.2
#21 lore raw

PATCH 17/23 ASoC: samsung: move plat/ headers to local directory

In reply to Arnd Bergmann

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.

---
 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
arch/arm/mach-s3c24xx/dma-s3c2410.c +0 -2
index 25d085a..a4a13c9 100644
@@ -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[] = {
arch/arm/mach-s3c24xx/dma-s3c2412.c +0 -2
index d2408ba..6eaa7a4 100644
@@ -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 }
arch/arm/mach-s3c24xx/dma-s3c2440.c +0 -2
index 0b86e74..477d450 100644
@@ -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[] = {
arch/arm/mach-s3c24xx/dma-s3c2443.c +0 -2
index 0553625..80a8d56 100644
@@ -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) { \
arch/arm/plat-samsung/include/plat/regs-ac97.h deleted +0 -67

67 lines not on this page · raw message

arch/arm/plat-samsung/include/plat/regs-iis.h deleted +0 -70

70 lines not on this page · raw message

sound/soc/samsung/ac97.c +1 -1
index 0df3c56..c76abdf 100644
@@ -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"
sound/soc/samsung/h1940_uda1380.c +1 -1
index 15a3817..fa91376 100644
@@ -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"
sound/soc/samsung/neo1973_wm8753.c +1 -1
index a301d8c..ccc601d 100644
@@ -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"
sound/soc/samsung/regs-ac97.h new file +67 -0

67 lines not on this page · raw message

sound/soc/samsung/regs-iis.h new file +70 -0

70 lines not on this page · raw message

sound/soc/samsung/rx1950_uda1380.c +1 -1
index a5826ea..704460a 100644
@@ -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"
sound/soc/samsung/s3c24xx-i2s.c +1 -1
index 13f6dd1..a7b17c1 100644
@@ -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"
sound/soc/samsung/s3c24xx_uda134x.c +1 -1
index 333e1b7..1b7b52b 100644
@@ -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"
 
Signature · 1 line
1.8.1.2
#22 lore raw

PATCH 18/23 ASoC: samsung: convert to dmaengine API

In reply to Arnd Bergmann

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.

---
 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(-)
sound/soc/samsung/ac97.c +0 -15
index c76abdf..214f454 100644
@@ -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,
 };
 
sound/soc/samsung/dma.c +55 -49

185 lines not on this page · raw message

sound/soc/samsung/dma.h +1 -3
index 189a7a6..f7381be 100644
@@ -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;
 };
 
sound/soc/samsung/i2s.c +1 -8
index d7231e3..2eed7a3 100644
@@ -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) {
sound/soc/samsung/pcm.c +0 -13
index 13bab79..525b2d2 100644
@@ -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,
 	},
 };
sound/soc/samsung/s3c2412-i2s.c +0 -10
index 2213377..d43f00e 100644
@@ -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,
sound/soc/samsung/s3c24xx-i2s.c +0 -10
index a7b17c1..d68c23d 100644
@@ -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,
sound/soc/samsung/spdif.c +0 -6
index 5008e5b..5c78c78 100644
@@ -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;
 
Signature · 1 line
1.8.1.2
#23 lore raw

PATCH 18/23 ASoC: samsung: convert to dmaengine API

Hi Arnd,

Quoted 196 lines · Arnd Bergmann

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.

---
 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(-)
sound/soc/samsung/ac97.c +0 -15
index c76abdf..214f454 100644
@@ -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,
 };
 
sound/soc/samsung/dma.c +31 -43
index 21b7926..67b8dcc 100644
@@ -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);
+

sound/soc/samsung/dma.c static int dma_hw_params(struct snd_pcm_substream *substream, · line 177

Quoted 10 lines
sound/soc/samsung/dma.c +10 -0
+               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.

Quoted 240 lines
sound/soc/samsung/dma.c +14 -6
+                       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:
sound/soc/samsung/dma.h +1 -3
index 189a7a6..f7381be 100644
@@ -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;
 };
 
sound/soc/samsung/i2s.c +1 -8
index d7231e3..2eed7a3 100644
@@ -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) {
sound/soc/samsung/pcm.c +0 -13
index 13bab79..525b2d2 100644
@@ -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,
        },
 };
sound/soc/samsung/s3c2412-i2s.c +0 -10
index 2213377..d43f00e 100644
@@ -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,
sound/soc/samsung/s3c24xx-i2s.c +0 -10
index a7b17c1..d68c23d 100644
@@ -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,
sound/soc/samsung/spdif.c +0 -7
index 5008e5b..5c78c78 100644
@@ -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

Quoted 4 lines

--
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

#24 lore raw

PATCH 18/23 ASoC: samsung: convert to dmaengine API

Quoted 6 lines · Padma Venkat

sound/soc/samsung/dma.c static int dma_hw_params(struct snd_pcm_substream *substream, · line 177

Quoted 4 lines
sound/soc/samsung/dma.c +4 -0
+               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.

Quoted 1 line

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

Thanks a lot for testing this!

Arnd

#25 lore raw

PATCH 19/23 ASoC: samsung: use irq resource for idma

In reply to Arnd Bergmann

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.

---
 arch/arm/plat-samsung/devs.c |  6 ++++++
 sound/soc/samsung/idma.c     | 10 ++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)
arch/arm/plat-samsung/devs.c +6 -0
index 58fb02a..ec912e4 100644
@@ -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 */
 
sound/soc/samsung/idma.c +8 -2
index a07950b..f36a541 100644
@@ -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);
 }
 
Signature · 1 line
1.8.1.2
#26 lore raw

PATCH 20/23 ARM: exynos: prepare for sparse IRQ

In reply to Arnd Bergmann

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.

---
 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(-)
arch/arm/mach-exynos/dev-uart.c +1 -0
index 7c42f4b..c48aff0 100644
@@ -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>
 
arch/arm/mach-exynos/include/mach/irqs.h +4 -1
index 1f4dc35..8bd5dde 100644
@@ -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 */
arch/arm/mach-exynos/mach-armlex4210.c +2 -0
index 685f291..cb95992 100644
@@ -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 <[email protected]> */
 	.atag_offset	= 0x100,
+	.nr_irqs	= EXYNOS_NR_IRQS,
 	.smp		= smp_ops(exynos_smp_ops),
 	.init_irq	= exynos4_init_irq,
 	.map_io		= armlex4210_map_io,
arch/arm/mach-exynos/mach-exynos4-dt.c +2 -0
index 3358088..55aa611 100644
@@ -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 <[email protected]> */
+	.nr_irqs	= EXYNOS_NR_IRQS,
 	.smp		= smp_ops(exynos_smp_ops),
 	.init_irq	= exynos4_init_irq,
 	.map_io		= exynos4_dt_map_io,
arch/arm/mach-exynos/mach-exynos5-dt.c +2 -0
index acaeb14..c674e7f 100644
@@ -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 <[email protected]> */
+	.nr_irqs	= EXYNOS_NR_IRQS,
 	.init_irq	= exynos5_init_irq,
 	.smp		= smp_ops(exynos_smp_ops),
 	.map_io		= exynos5_dt_map_io,
arch/arm/mach-exynos/mach-nuri.c +2 -0
index 1ea7973..fee0885 100644
@@ -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 <[email protected]> */
 	.atag_offset	= 0x100,
+	.nr_irqs	= EXYNOS_NR_IRQS,
 	.smp		= smp_ops(exynos_smp_ops),
 	.init_irq	= exynos4_init_irq,
 	.map_io		= nuri_map_io,
arch/arm/mach-exynos/mach-origen.c +2 -0
index 579d2d1..d1849d1 100644
@@ -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 <[email protected]> */
 	.atag_offset	= 0x100,
+	.nr_irqs	= EXYNOS_NR_IRQS,
 	.smp		= smp_ops(exynos_smp_ops),
 	.init_irq	= exynos4_init_irq,
 	.map_io		= origen_map_io,
arch/arm/mach-exynos/mach-smdk4x12.c +2 -0
index fe61496..46c7fc7 100644
@@ -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 <[email protected]> */
 	/* Maintainer: Changhwan Youn <[email protected]> */
 	.atag_offset	= 0x100,
+	.nr_irqs	= EXYNOS_NR_IRQS,
 	.smp		= smp_ops(exynos_smp_ops),
 	.init_irq	= exynos4_init_irq,
 	.map_io		= smdk4x12_map_io,
arch/arm/mach-exynos/mach-smdkv310.c +3 -0
index d716729..5187687 100644
@@ -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 <[email protected]> */
 	/* Maintainer: Changhwan Youn <[email protected]> */
 	.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 <[email protected]> */
 	.atag_offset	= 0x100,
+	.nr_irqs	= EXYNOS_NR_IRQS,
 	.smp		= smp_ops(exynos_smp_ops),
 	.init_irq	= exynos4_init_irq,
 	.map_io		= smdkv310_map_io,
arch/arm/plat-samsung/irq-vic-timer.c +1 -0
index f980cf3..1113066 100644
@@ -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>
arch/arm/plat-samsung/pm.c +1 -0
index 002b147..53210ec 100644
@@ -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>
arch/arm/plat-samsung/s5p-irq.c +1 -0
index 103e371..ff1a760 100644
@@ -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>
Signature · 1 line
1.8.1.2
#27 lore raw

PATCH 21/23 ARM: exynos: hack to disable private clock code

In reply to Arnd Bergmann

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.

---
 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(-)
arch/arm/mach-exynos/Makefile +2 -0
index 435757e..b0dcf7d 100644
@@ -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
arch/arm/mach-exynos/common.c +6 -0
index 4b4526d..504d50e 100644
@@ -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 */
arch/arm/plat-samsung/clock-clksrc.c +3 -0
index 786a410..094fde9 100644
@@ -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",
arch/arm/plat-samsung/s5p-clock.c +3 -0
index 48a1599..0e22618 100644
@@ -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));
drivers/cpufreq/Kconfig.arm +3 -1
index 030ddf6..b6fb4fa 100644
@@ -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
drivers/devfreq/Kconfig +1 -0
index 0f079be..d4f9a24 100644
@@ -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
Signature · 1 line
1.8.1.2
#28 lore raw

PATCH 22/23 ARM: exynos: work around missing gpio code on multiplatform

In reply to Arnd Bergmann

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.

---
 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(-)
arch/arm/mach-exynos/Makefile +2 -0
index b0dcf7d..e2f1742 100644
@@ -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
arch/arm/mach-exynos/common.c +3 -0
index 504d50e..59607b5 100644
@@ -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;
 }
arch/arm/mach-exynos/dev-audio.c +1 -0
index c662c89..25b173b 100644
@@ -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)
 
arch/arm/mach-exynos/include/mach/gpio.h +2 -0
index eb24f1e..88c6d26 100644
@@ -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 */
arch/arm/mach-exynos/mach-armlex4210.c +1 -0
index cb95992..2a8e7c1 100644
@@ -27,6 +27,7 @@
 
 #include <mach/irqs.h>
 #include <mach/map.h>
+#include <mach/gpio.h>
 
 #include "common.h"
 
arch/arm/mach-exynos/mach-origen.c +1 -0
index d1849d1..72650e2 100644
@@ -47,6 +47,7 @@
 
 #include <mach/map.h>
 #include <mach/irqs.h>
+#include <mach/gpio.h>
 
 #include <drm/exynos_drm.h>
 #include "common.h"
arch/arm/mach-exynos/setup-i2c0.c +2 -1
index e2d9dfb..95acd62 100644
@@ -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;
 
arch/arm/mach-s3c64xx/include/mach/gpio.h +4 -0
index 8b540c4..95be5b5 100644
@@ -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 */
arch/arm/plat-samsung/include/plat/gpio-core.h +3 -0
index cf5aae5..103a958 100644
@@ -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
arch/arm/plat-samsung/pm-gpio.c +1 -0
index c2ff92c..b24c159 100644
@@ -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>
 
drivers/gpio/Makefile +1 -1
index 22e07bc..91ed0f9 100644
@@ -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
Signature · 1 line
1.8.1.2
#29 lore raw

PATCH 23/23 ARM: exynos: experimental multiplatform support

In reply to Arnd Bergmann

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.

---
 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(-)
arch/arm/Kconfig +2 -9
index 5b71469..56b62f5 100644
@@ -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
arch/arm/mach-exynos/Kconfig +17 -4
index 3291a72..1f2e7dc 100644
@@ -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
 
arch/arm/mach-exynos/Makefile +1 -0
index e2f1742..646b79e 100644
@@ -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				:=
arch/arm/plat-samsung/Kconfig +5 -0
index a9d5216..b6669db 100644
@@ -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
arch/arm/plat-samsung/Makefile +3 -0
index 3a7c64d..78f560e 100644
@@ -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
drivers/video/Kconfig +1 -1
index 4c1546f..05a4a59 100644
@@ -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
drivers/watchdog/Kconfig +1 -0
index 9fcc70c..f39337b 100644
@@ -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
Signature · 1 line
1.8.1.2
#30 lore raw

cover RFC: exynos multiplatform support

In reply to Arnd Bergmann
Quoted 16 lines · 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:

Quoted 13 lines

* 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

#31 lore raw

cover RFC: exynos multiplatform support

In reply to Arnd Bergmann

Hi Arnd,

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

I have added my two cents inline.

Quoted 13 lines · 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.

Quoted 4 lines

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.

Quoted 2 lines

* 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.

Quoted 2 lines

* 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.

Quoted 8 lines

* 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.

Quoted 22 lines

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

Quoted 8 lines

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,

Signature · 3 lines
Tomasz Figa
Samsung Poland R&D Center
SW Solution Development, Kernel and System Framework
Quoted 134 lines

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
#32 lore raw

cover RFC: exynos multiplatform support

Quoted 8 lines · Tomasz Figa
Quoted 5 lines

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.

Quoted 5 lines
Quoted 2 lines

* 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.

Quoted 5 lines
Quoted 2 lines

* 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.

Quoted 5 lines
Quoted 1 line

* 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.

Quoted 18 lines
Quoted 9 lines

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

Quoted 8 lines

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

Quoted 3 lines

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.

Quoted 5 lines

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

#33 lore raw

cover RFC: exynos multiplatform support

Quoted 34 lines · On Tuesday 05 of March 2013 19:19:02 Arnd Bergmann wrote:
Quoted 7 lines · Tomasz Figa
Quoted 4 lines

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.

Quoted 6 lines
Quoted 3 lines

* 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.

Quoted 6 lines
Quoted 3 lines

* 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:

Quoted 7 lines

* 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.

Quoted 32 lines
Quoted 5 lines
Quoted 1 line

* 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.

Quoted 18 lines
Quoted 9 lines

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

Quoted 8 lines

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

Quoted 3 lines

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.

Quoted 8 lines
Quoted 5 lines

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

#34 lore raw

cover RFC: exynos multiplatform support

Quoted 7 lines · Tomasz Figa
Quoted 3 lines · 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.

Quoted 28 lines
Quoted 2 lines

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?

Quoted 3 lines

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

#35 lore raw

cover RFC: exynos multiplatform support

Quoted 48 lines · Arnd Bergmann
Quoted 7 lines · Tomasz Figa
Quoted 3 lines · 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.

Quoted 28 lines
Quoted 2 lines

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?

Quoted 3 lines

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.

Quoted 4 lines

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>

#36 lore raw

cover RFC: exynos multiplatform support

Quoted 70 lines · On Wednesday 06 of March 2013 13:34:26 Thierry Reding wrote:
Quoted 64 lines · Arnd Bergmann
Quoted 8 lines · Tomasz Figa
Quoted 5 lines · 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.

Quoted 40 lines
Quoted 2 lines

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?

Quoted 5 lines

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.

Quoted 5 lines

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.

Quoted 5 lines

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

#37 lore raw

cover RFC: exynos multiplatform support

In reply to Thierry Reding
Quoted 10 lines · Thierry Reding
Quoted 4 lines

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

#38 lore raw

cover RFC: exynos multiplatform support

Quoted 12 lines · Arnd Bergmann
Quoted 10 lines · Thierry Reding
Quoted 4 lines

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.

Quoted 4 lines

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>

#39 lore raw

cover RFC: exynos multiplatform support

Quoted 27 lines · On Thursday 07 of March 2013 08:22:03 Thierry Reding wrote:
Quoted 16 lines · Arnd Bergmann
Quoted 5 lines · Thierry Reding
Quoted 5 lines

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.> >

Quoted 9 lines

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.

Quoted 4 lines

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.

Quoted 5 lines

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

#40 lore raw

cover RFC: exynos multiplatform support

Quoted 11 lines · Tomasz Figa

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

#41 lore raw

cover RFC: exynos multiplatform support

In reply to Tomasz Figa

Am Dienstag, 5. M?rz 2013, 23:48:45 schrieb Tomasz Figa:

Quoted 111 lines · On Tuesday 05 of March 2013 19:19:02 Arnd Bergmann wrote:
Quoted 34 lines · Tomasz Figa
Quoted 7 lines
Quoted 4 lines

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.

Quoted 6 lines
Quoted 3 lines

* 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.

Quoted 6 lines
Quoted 3 lines

* 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:

Quoted 7 lines

* 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.

Quoted 32 lines
Quoted 5 lines
Quoted 1 line

* 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.

Quoted 18 lines
Quoted 9 lines

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

Quoted 8 lines

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

Quoted 3 lines

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.

Quoted 8 lines
Quoted 5 lines

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?

Quoted 3 lines

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 <[email protected]>
* Copyright (c) 2013 Heiko Stuebner <[email protected]>
*
* 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);
	}
}
#42 lore raw

cover RFC: exynos multiplatform support

Quoted 130 lines · 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:

Quoted 129 lines · On Tuesday 05 of March 2013 19:19:02 Arnd Bergmann wrote:
Quoted 38 lines · Tomasz Figa
Quoted 8 lines
Quoted 4 lines

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.

Quoted 6 lines
Quoted 3 lines

* 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.

Quoted 7 lines
Quoted 3 lines

* 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:

Quoted 8 lines

* 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.

Quoted 39 lines
Quoted 6 lines
Quoted 1 line

* 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.

Quoted 18 lines
Quoted 9 lines

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

Quoted 8 lines

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

Quoted 4 lines

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.

Quoted 5 lines

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.

Quoted 4 lines
Quoted 1 line

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?

Quoted 6 lines
Quoted 3 lines

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.

Quoted 9 lines

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

Quoted 155 lines

unfinished but working clk-pwm.c:

/*
* Copyright (c) 2007 Simtec Electronics
* Copyright (c) 2007, 2008 Ben Dooks
* Ben Dooks <[email protected]>
* Copyright (c) 2013 Heiko Stuebner <[email protected]>
*
* 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;
};
Quoted 3 lines

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

hw);

Quoted 45 lines
	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;
Quoted 7 lines
	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);

Quoted 99 lines
	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;
Quoted 8 lines
		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);

Quoted 68 lines
		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" };

Quoted 9 lines
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),

Quoted 1 line
	DIV_T(tdiv1, "pwm-tdiv1", "pwm-scaler0", TCFG1, 4, 4, 

tdiv_s3c24xx_d),

Quoted 1 line
	DIV_T(tdiv2, "pwm-tdiv2", "pwm-scaler1", TCFG1, 8, 4, 

tdiv_s3c24xx_d),

Quoted 1 line
	DIV_T(tdiv3, "pwm-tdiv3", "pwm-scaler1", TCFG1, 12, 4, 

tdiv_s3c24xx_d),

Quoted 13 lines

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),

Quoted 1 line
	DIV_T(tdiv1, "pwm-tdiv1", "pwm-scaler0", TCFG1, 4, 4, 

tdiv_s3c64xx_d),

Quoted 1 line
	DIV_T(tdiv2, "pwm-tdiv2", "pwm-scaler1", TCFG1, 8, 4, 

tdiv_s3c64xx_d),

Quoted 1 line
	DIV_T(tdiv3, "pwm-tdiv3", "pwm-scaler1", TCFG1, 12, 4, 

tdiv_s3c64xx_d),

Quoted 75 lines

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);
Quoted 8 lines

#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);

Quoted 64 lines

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);
	}
}
#43 lore raw

cover RFC: exynos multiplatform support

In reply to Arnd Bergmann

Am Dienstag, 5. M?rz 2013, 18:42:10 schrieb Arnd Bergmann:

Quoted 16 lines

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:

Quoted 7 lines

* 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

Quoted 171 lines

* 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
#44 lore raw

cover RFC: exynos multiplatform support

Quoted 3 lines · Heiko St?bner

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.

Quoted 1 line

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.

Quoted 4 lines

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

#45 lore raw

cover RFC: exynos multiplatform support

Quoted 4 lines · Arnd Bergmann

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

#46 lore raw

cover RFC: exynos multiplatform support

Quoted 6 lines · On Tuesday 05 of March 2013 21:54:22 Arnd Bergmann wrote:
Quoted 4 lines · Arnd Bergmann

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.

Quoted 6 lines

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

Quoted 14 lines

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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#47 lore raw

cover RFC: exynos multiplatform support

Quoted 7 lines · Tomasz Figa

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

#48 lore raw

cover RFC: exynos multiplatform support

In reply to Arnd Bergmann

Am Dienstag, 5. M?rz 2013, 22:54:22 schrieb Arnd Bergmann:

Quoted 6 lines · Arnd Bergmann
Quoted 4 lines

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.

Quoted 6 lines

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

Quoted 4 lines

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

#49 lore raw

cover RFC: exynos multiplatform support

Quoted 11 lines · Heiko St?bner

Am Dienstag, 5. M?rz 2013, 22:54:22 schrieb Arnd Bergmann:

Quoted 6 lines · Arnd Bergmann

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