Skip to contentSkip to conversation

ARM: S3C24XX: move some code from plat to mach directory

PATCH New Heiko Stübner 2 participants 6 messages May 8, 2012 – May 9, 2012

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

v2 cover ARM: S3C24XX: move some code from plat to mach directory

Again the series of small moves of common code from the plat-s3c24xx to the mach-s3c24xx directory.

This time without the wrong handled irq.c . Hopefully I'll get time to do it properly later.

As the dev-uart.c move breaks the resource patch by Tushar Behera, I updated the patch to fix the correct code and will submit it as a v2 to the resource series.

Heiko Stuebner (4):
ARM: S3C24XX: move plat-s3c24xx/cpu.c
ARM: S3C24XX: move plat-s3c24xx/dev-uart.c into common.c
ARM: S3C24XX: move common power-management code to mach-s3c24xx
ARM: S3C24XX: move common clock init into common.c

 arch/arm/mach-s3c24xx/Makefile                     |    6 +
 .../{plat-s3c24xx/cpu.c => mach-s3c24xx/common.c}  |   93 ++++++++++++++++++-
 arch/arm/{plat-s3c24xx => mach-s3c24xx}/irq-pm.c   |    0
 arch/arm/{plat-s3c24xx => mach-s3c24xx}/pm.c       |    0
 arch/arm/{plat-s3c24xx => mach-s3c24xx}/sleep.S    |    0
 arch/arm/plat-s3c24xx/Makefile                     |    6 -
 arch/arm/plat-s3c24xx/clock.c                      |   59 ------------
 arch/arm/plat-s3c24xx/dev-uart.c                   |  100 --------------------
 8 files changed, 98 insertions(+), 166 deletions(-)
 rename arch/arm/{plat-s3c24xx/cpu.c => mach-s3c24xx/common.c} (75%)
 rename arch/arm/{plat-s3c24xx => mach-s3c24xx}/irq-pm.c (100%)
 rename arch/arm/{plat-s3c24xx => mach-s3c24xx}/pm.c (100%)
 rename arch/arm/{plat-s3c24xx => mach-s3c24xx}/sleep.S (100%)
 delete mode 100644 arch/arm/plat-s3c24xx/clock.c
 delete mode 100644 arch/arm/plat-s3c24xx/dev-uart.c
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH v2 1/4 ARM: S3C24XX: move plat-s3c24xx/cpu.c

Following the model of s3c64xx cpu.c becomes common.c in mach-s3c24xx, to got more common code added later on.

---
 arch/arm/mach-s3c24xx/Makefile                     |    2 ++
 .../{plat-s3c24xx/cpu.c => mach-s3c24xx/common.c}  |    2 +-
 arch/arm/plat-s3c24xx/Makefile                     |    1 -
 3 files changed, 3 insertions(+), 2 deletions(-)
 rename arch/arm/{plat-s3c24xx/cpu.c => mach-s3c24xx/common.c} (99%)
arch/arm/mach-s3c24xx/Makefile +2 -0
index d0f3a92..d56b990 100644
@@ -14,6 +14,8 @@ obj-				:=
 
 # core
 
+obj-y				+= common.o
+
 obj-$(CONFIG_CPU_S3C2410)	+= s3c2410.o
 obj-$(CONFIG_S3C2410_DMA)	+= dma-s3c2410.o
 obj-$(CONFIG_S3C2410_PM)	+= pm-s3c2410.o sleep-s3c2410.o
arch/arm/mach-s3c24xx/common.c renamed from arch/arm/plat-s3c24xx/cpu.c +1 -1
similarity index 99%
rename from arch/arm/plat-s3c24xx/cpu.c
rename to arch/arm/mach-s3c24xx/common.c
index 290942d..dc9927b 100644
@@ -4,7 +4,7 @@
  *	http://www.simtec.co.uk/products/SWLINUX/
  *	Ben Dooks <[email protected]>
  *
- * S3C24XX CPU Support
+ * Common code for S3C24XX machines
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
arch/arm/plat-s3c24xx/Makefile +0 -1
index 2467b80..f7fe935 100644
@@ -12,7 +12,6 @@ obj-				:=
 
 # Core files
 
-obj-y				+= cpu.o
 obj-y				+= irq.o
 obj-y				+= dev-uart.o
 obj-y				+= clock.o
Signature · 1 line
1.7.5.4
#2 lore raw

PATCH v2 2/4 ARM: S3C24XX: move plat-s3c24xx/dev-uart.c into common.c

In reply to Heiko Stübner

The uart devices are used on all s3c24xx machines, so they can reside in the common code for all machines.

---
 arch/arm/mach-s3c24xx/common.c   |   73 +++++++++++++++++++++++++++
 arch/arm/plat-s3c24xx/Makefile   |    1 -
 arch/arm/plat-s3c24xx/dev-uart.c |  100 --------------------------------------
 3 files changed, 73 insertions(+), 101 deletions(-)
 delete mode 100644 arch/arm/plat-s3c24xx/dev-uart.c
arch/arm/mach-s3c24xx/common.c +73 -0
index dc9927b..5e4ac34 100644
@@ -234,3 +234,76 @@ void __init s3c24xx_init_io(struct map_desc *mach_desc, int size)
 
 	s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
 }
+
+/* Serial port registrations */
+
+static struct resource s3c2410_uart0_resource[] = {
+	[0] = {
+		.start = S3C2410_PA_UART0,
+		.end   = S3C2410_PA_UART0 + 0x3fff,
+		.flags = IORESOURCE_MEM,
+	},
+	[1] = {
+		.start = IRQ_S3CUART_RX0,
+		.end   = IRQ_S3CUART_ERR0,
+		.flags = IORESOURCE_IRQ,
+	}
+};
+
+static struct resource s3c2410_uart1_resource[] = {
+	[0] = {
+		.start = S3C2410_PA_UART1,
+		.end   = S3C2410_PA_UART1 + 0x3fff,
+		.flags = IORESOURCE_MEM,
+	},
+	[1] = {
+		.start = IRQ_S3CUART_RX1,
+		.end   = IRQ_S3CUART_ERR1,
+		.flags = IORESOURCE_IRQ,
+	}
+};
+
+static struct resource s3c2410_uart2_resource[] = {
+	[0] = {
+		.start = S3C2410_PA_UART2,
+		.end   = S3C2410_PA_UART2 + 0x3fff,
+		.flags = IORESOURCE_MEM,
+	},
+	[1] = {
+		.start = IRQ_S3CUART_RX2,
+		.end   = IRQ_S3CUART_ERR2,
+		.flags = IORESOURCE_IRQ,
+	}
+};
+
+static struct resource s3c2410_uart3_resource[] = {
+	[0] = {
+		.start = S3C2443_PA_UART3,
+		.end   = S3C2443_PA_UART3 + 0x3fff,
+		.flags = IORESOURCE_MEM,
+	},
+	[1] = {
+		.start = IRQ_S3CUART_RX3,
+		.end   = IRQ_S3CUART_ERR3,
+		.flags = IORESOURCE_IRQ,
+	},
+};
+
+struct s3c24xx_uart_resources s3c2410_uart_resources[] __initdata = {
+	[0] = {
+		.resources	= s3c2410_uart0_resource,
+		.nr_resources	= ARRAY_SIZE(s3c2410_uart0_resource),
+	},
+	[1] = {
+		.resources	= s3c2410_uart1_resource,
+		.nr_resources	= ARRAY_SIZE(s3c2410_uart1_resource),
+	},
+	[2] = {
+		.resources	= s3c2410_uart2_resource,
+		.nr_resources	= ARRAY_SIZE(s3c2410_uart2_resource),
+	},
+	[3] = {
+		.resources	= s3c2410_uart3_resource,
+		.nr_resources	= ARRAY_SIZE(s3c2410_uart3_resource),
+	},
+};
arch/arm/plat-s3c24xx/Makefile +0 -1
index f7fe935..1e3126a 100644
@@ -13,7 +13,6 @@ obj-				:=
 # Core files
 
 obj-y				+= irq.o
-obj-y				+= dev-uart.o
 obj-y				+= clock.o
 obj-$(CONFIG_S3C24XX_DCLK)	+= clock-dclk.o
 
arch/arm/plat-s3c24xx/dev-uart.c deleted +0 -100

100 lines not on this page · raw message

Signature · 1 line
1.7.5.4
#3 lore raw

PATCH v2 3/4 ARM: S3C24XX: move common power-management code to mach-s3c24xx

In reply to Heiko Stübner

This is the basic power-management code used by all s3c24xx machines.

---
 arch/arm/mach-s3c24xx/Makefile                   |    4 ++++
 arch/arm/{plat-s3c24xx => mach-s3c24xx}/irq-pm.c |    0
 arch/arm/{plat-s3c24xx => mach-s3c24xx}/pm.c     |    0
 arch/arm/{plat-s3c24xx => mach-s3c24xx}/sleep.S  |    0
 arch/arm/plat-s3c24xx/Makefile                   |    3 ---
 5 files changed, 4 insertions(+), 3 deletions(-)
 rename arch/arm/{plat-s3c24xx => mach-s3c24xx}/irq-pm.c (100%)
 rename arch/arm/{plat-s3c24xx => mach-s3c24xx}/pm.c (100%)
 rename arch/arm/{plat-s3c24xx => mach-s3c24xx}/sleep.S (100%)
arch/arm/mach-s3c24xx/Makefile +4 -0
index d56b990..0ab6ab1 100644
@@ -35,6 +35,10 @@ obj-$(CONFIG_S3C2440_DMA)	+= dma-s3c2440.o
 
 obj-$(CONFIG_CPU_S3C2443)	+= s3c2443.o irq-s3c2443.o clock-s3c2443.o
 
+# PM
+
+obj-$(CONFIG_PM)		+= pm.o irq-pm.o sleep.o
+
 # common code
 
 obj-$(CONFIG_S3C2443_COMMON)	+= common-s3c2443.o
arch/arm/mach-s3c24xx/irq-pm.c renamed from arch/arm/plat-s3c24xx/irq-pm.c +0 -0
similarity index 100%
rename from arch/arm/plat-s3c24xx/irq-pm.c
rename to arch/arm/mach-s3c24xx/irq-pm.c
arch/arm/mach-s3c24xx/pm.c renamed from arch/arm/plat-s3c24xx/pm.c +0 -0
similarity index 100%
rename from arch/arm/plat-s3c24xx/pm.c
rename to arch/arm/mach-s3c24xx/pm.c
arch/arm/mach-s3c24xx/sleep.S renamed from arch/arm/plat-s3c24xx/sleep.S +0 -0
similarity index 100%
rename from arch/arm/plat-s3c24xx/sleep.S
rename to arch/arm/mach-s3c24xx/sleep.S
arch/arm/plat-s3c24xx/Makefile +0 -3
index 1e3126a..a07bbc9 100644
@@ -21,9 +21,6 @@ obj-$(CONFIG_CPU_FREQ_S3C24XX_DEBUGFS) += cpu-freq-debugfs.o
 
 # Architecture dependent builds
 
-obj-$(CONFIG_PM)		+= pm.o
-obj-$(CONFIG_PM)		+= irq-pm.o
-obj-$(CONFIG_PM)		+= sleep.o
 obj-$(CONFIG_S3C2410_CLOCK)	+= s3c2410-clock.o
 obj-$(CONFIG_S3C24XX_DMA)	+= dma.o
 obj-$(CONFIG_S3C2410_IOTIMING)	+= s3c2410-iotiming.o
Signature · 1 line
1.7.5.4
#4 lore raw

PATCH v2 4/4 ARM: S3C24XX: move common clock init into common.c

In reply to Heiko Stübner
---
 arch/arm/mach-s3c24xx/common.c |   18 ++++++++++++
 arch/arm/plat-s3c24xx/Makefile |    1 -
 arch/arm/plat-s3c24xx/clock.c  |   59 ----------------------------------------
 3 files changed, 18 insertions(+), 60 deletions(-)
 delete mode 100644 arch/arm/plat-s3c24xx/clock.c
arch/arm/mach-s3c24xx/common.c +18 -0
index 5e4ac34..d42423a 100644
@@ -41,6 +41,7 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
+#include <mach/regs-clock.h>
 #include <mach/regs-gpio.h>
 #include <plat/regs-serial.h>
 
@@ -52,6 +53,8 @@
 #include <plat/s3c2416.h>
 #include <plat/s3c244x.h>
 #include <plat/s3c2443.h>
+#include <plat/cpu-freq.h>
+#include <plat/pll.h>
 
 /* table of supported CPUs */
 
@@ -307,3 +310,18 @@ struct s3c24xx_uart_resources s3c2410_uart_resources[] __initdata = {
 		.nr_resources	= ARRAY_SIZE(s3c2410_uart3_resource),
 	},
 };
+
+/* initialise all the clocks */
+
+void __init_or_cpufreq s3c24xx_setup_clocks(unsigned long fclk,
+					   unsigned long hclk,
+					   unsigned long pclk)
+{
+	clk_upll.rate = s3c24xx_get_pll(__raw_readl(S3C2410_UPLLCON),
+					clk_xtal.rate);
+
+	clk_mpll.rate = fclk;
+	clk_h.rate = hclk;
+	clk_p.rate = pclk;
+	clk_f.rate = fclk;
+}
arch/arm/plat-s3c24xx/Makefile +0 -1
index a07bbc9..9f60549c 100644
@@ -13,7 +13,6 @@ obj-				:=
 # Core files
 
 obj-y				+= irq.o
-obj-y				+= clock.o
 obj-$(CONFIG_S3C24XX_DCLK)	+= clock-dclk.o
 
 obj-$(CONFIG_CPU_FREQ_S3C24XX)	+= cpu-freq.o
arch/arm/plat-s3c24xx/clock.c deleted +0 -59

59 lines not on this page · raw message

Signature · 1 line
1.7.5.4
#5 lore raw

v2 cover ARM: S3C24XX: move some code from plat to mach directory

In reply to Heiko Stübner
Quoted 38 lines · Heiko St?bner

Again the series of small moves of common code from the plat-s3c24xx to the
mach-s3c24xx directory.

This time without the wrong handled irq.c . Hopefully I'll get time to do it
properly later.

As the dev-uart.c move breaks the resource patch by Tushar Behera, I updated
the patch to fix the correct code and will submit it as a v2 to the resource
series.

Heiko Stuebner (4):
ARM: S3C24XX: move plat-s3c24xx/cpu.c
ARM: S3C24XX: move plat-s3c24xx/dev-uart.c into common.c
ARM: S3C24XX: move common power-management code to mach-s3c24xx
ARM: S3C24XX: move common clock init into common.c

 arch/arm/mach-s3c24xx/Makefile                     |    6 +
 .../{plat-s3c24xx/cpu.c => mach-s3c24xx/common.c}  |   93
++++++++++++++++++-
 arch/arm/{plat-s3c24xx => mach-s3c24xx}/irq-pm.c   |    0
 arch/arm/{plat-s3c24xx => mach-s3c24xx}/pm.c       |    0
 arch/arm/{plat-s3c24xx => mach-s3c24xx}/sleep.S    |    0
 arch/arm/plat-s3c24xx/Makefile                     |    6 -
 arch/arm/plat-s3c24xx/clock.c                      |   59 ------------
 arch/arm/plat-s3c24xx/dev-uart.c                   |  100 --------------------
 8 files changed, 98 insertions(+), 166 deletions(-)
 rename arch/arm/{plat-s3c24xx/cpu.c => mach-s3c24xx/common.c} (75%)
 rename arch/arm/{plat-s3c24xx => mach-s3c24xx}/irq-pm.c (100%)
 rename arch/arm/{plat-s3c24xx => mach-s3c24xx}/pm.c (100%)
 rename arch/arm/{plat-s3c24xx => mach-s3c24xx}/sleep.S (100%)
 delete mode 100644 arch/arm/plat-s3c24xx/clock.c
 delete mode 100644 arch/arm/plat-s3c24xx/dev-uart.c
Quoted 2 lines

--
1.7.5.4

Thanks for your re-posting.
Looks better. Will apply this series instead.

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.