Skip to contentSkip to conversation

ARM: ux500: delete UART static map

PATCH New Linus Walleij 2 participants 3 messages May 14, 2015 – Jul 31, 2015

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

PATCH 1/10 ARM: ux500: delete UART static map

Delete the static maps for the Ux500 UARTs and rely on debug_ll_io_init() to do the trick. commit f87b95dd2e4a8832b1d6034f15a5324db42608a0 "ARM: ux500: move debugmacro to debug includes" defined the necessary addruart macro two years ago.

---
 arch/arm/mach-ux500/cpu-db8500.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)
arch/arm/mach-ux500/cpu-db8500.c +1 -11
index 537a7753afc1..391d329a7e88 100644
@@ -43,12 +43,6 @@ static struct prcmu_pdata db8500_prcmu_pdata = {
 	.legacy_offset	= DB8500_PRCMU_LEGACY_OFFSET,
 };
 
-/* minimum static i/o mapping required to boot U8500 platforms */
-static struct map_desc u8500_uart_io_desc[] __initdata = {
-	__IO_DEV_DESC(U8500_UART0_BASE, SZ_4K),
-	__IO_DEV_DESC(U8500_UART2_BASE, SZ_4K),
-};
-
 /*  U8500 and U9540 common io_desc */
 static struct map_desc u8500_common_io_desc[] __initdata = {
 	/* SCU base also covers GIC CPU BASE and TWD with its 4K page */
@@ -73,11 +67,7 @@ static struct map_desc u9540_io_desc[] __initdata = {
 
 static void __init u8500_map_io(void)
 {
-	/*
-	 * Map the UARTs early so that the DEBUG_LL stuff continues to work.
-	 */
-	iotable_init(u8500_uart_io_desc, ARRAY_SIZE(u8500_uart_io_desc));
-
+	debug_ll_io_init();
 	ux500_map_io();
 
 	iotable_init(u8500_common_io_desc, ARRAY_SIZE(u8500_common_io_desc));
Signature · 1 line
1.9.3
#1 lore raw

PATCH 1/10 ARM: ux500: delete UART static map

Quoted 5 lines · On Thursday 14 May 2015 18:12:27 Linus Walleij wrote:

Delete the static maps for the Ux500 UARTs and rely on debug_ll_io_init() to do the trick. commit f87b95dd2e4a8832b1d6034f15a5324db42608a0 "ARM: ux500: move debugmacro to debug includes" defined the necessary addruart macro two years ago.

Hi Linus,

The whole series turned out even nicer than I expected, great work!

I've taken a closer look at the remaining early map for the soc ID and found that this is essentially not needed either. I also found some more dead code, so here is what I came up with. Does this look reasonable to you?

Arnd

 arch/arm/mach-ux500/Makefile                  |   3 +-
 arch/arm/mach-ux500/board-mop500-regulators.c |  72 -------
 arch/arm/mach-ux500/cache-l2x0.c              |  57 ------
 arch/arm/mach-ux500/cpu-db8500.c              |  32 ++++
 arch/arm/mach-ux500/cpu.c                     |  36 +---
 arch/arm/mach-ux500/id.c                      |  53 ++----
 arch/arm/mach-ux500/id.h                      | 121 ------------
 arch/arm/mach-ux500/setup.h                   |   3 +-
 arch/arm/mach-ux500/timer.c                   |  48 -----
 drivers/clk/ux500/Makefile                    |   1 -
 drivers/clk/ux500/u8500_clk.c                 | 525 ----------------------------------------------------
 drivers/clocksource/clksrc-dbx500-prcmu.c     |   6 +-
 include/linux/platform_data/clk-ux500.h       |   3 -
 13 files changed, 61 insertions(+), 899 deletions(-)
arch/arm/mach-ux500/Makefile +1 -2
index 4418a5078833..b4f1847f0188 100644
@@ -2,8 +2,7 @@
 # Makefile for the linux kernel, U8500 machine.
 #
 
-obj-y				:= cpu.o id.o timer.o pm.o
-obj-$(CONFIG_CACHE_L2X0)	+= cache-l2x0.o
+obj-y				:= cpu.o id.o pm.o
 obj-$(CONFIG_UX500_SOC_DB8500)	+= cpu-db8500.o
 obj-$(CONFIG_MACH_MOP500)	+= board-mop500-regulators.o \
 				board-mop500-audio.o
arch/arm/mach-ux500/board-mop500-regulators.c +0 -72

75 lines not on this page · raw message

arch/arm/mach-ux500/cache-l2x0.c deleted +0 -57

57 lines not on this page · raw message

arch/arm/mach-ux500/cpu-db8500.c +32 -0
index 537a7753afc1..47d0f9ddd14f 100644
@@ -88,6 +88,27 @@ static void __init u8500_map_io(void)
 		iotable_init(u8500_io_desc, ARRAY_SIZE(u8500_io_desc));
 }
 
+void __init ux500_timer_init(void)
+{
+	if (of_machine_is_compatible("st-ericsson,u8500")
+		u8500_of_clk_init(U8500_CLKRST1_BASE,
+				  U8500_CLKRST2_BASE,
+				  U8500_CLKRST3_BASE,
+				  U8500_CLKRST5_BASE,
+				  U8500_CLKRST6_BASE);
+
+	else if (of_machine_is_compatible("st-ericsson,u9540")
+		u9540_clk_init(U8500_CLKRST1_BASE, U8500_CLKRST2_BASE,
+			       U8500_CLKRST3_BASE, U8500_CLKRST5_BASE,
+			       U8500_CLKRST6_BASE);
+	else if (of_machine_is_compatible("st-ericsson,u8540")
+		u8540_clk_init(U8500_CLKRST1_BASE, U8500_CLKRST2_BASE,
+			       U8500_CLKRST3_BASE, U8500_CLKRST5_BASE,
+			       U8500_CLKRST6_BASE);
+
+	clocksource_of_init();
+}
+
 /*
  * The PMU IRQ lines of two cores are wired together into a single interrupt.
  * Bounce the interrupt to the other core if it's not ours.
@@ -131,6 +152,14 @@ static struct device * __init db8500_soc_device_init(void)
 	return ux500_soc_device_init(soc_id);
 }
 
+static void ux500_l2c310_write_sec(unsigned long val, unsigned reg)
+{
+	/*
+	 * We can't write to secure registers as we are in non-secure
+	 * mode, until we have some SMI service available.
+	 */
+}
+
 static struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {
 	/* Requires call-back bindings. */
 	OF_DEV_AUXDATA("arm,cortex-a9-pmu", 0, "arm-pmu", &db8500_pmu_platdata),
@@ -189,6 +218,9 @@ static const char * stericsson_dt_platform_compat[] = {
 };
 
 DT_MACHINE_START(U8500_DT, "ST-Ericsson Ux5x0 platform (Device Tree Support)")
+	.l2c_aux_val	= 0,
+	.l2c_aux_mask	= ~0,
+	.l2c_write_sec	= ux500_l2c310_write_sec,
 	.smp            = smp_ops(ux500_smp_ops),
 	.map_io		= u8500_map_io,
 	.init_irq	= ux500_init_irq,
arch/arm/mach-ux500/cpu.c +8 -28
index 6ced0f680262..99042ea0bc3a 100644
@@ -55,37 +55,15 @@ void __init ux500_init_irq(void)
 	gic_set_irqchip_flags(IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MASK_ON_SUSPEND);
 	irqchip_init();
 
-	/*
-	 * Init clocks here so that they are available for system timer
-	 * initialization.
-	 */
-	if (cpu_is_u8500_family()) {
-		prcmu_early_init(U8500_PRCMU_BASE, SZ_8K - 1);
-		ux500_pm_init(U8500_PRCMU_BASE, SZ_8K - 1);
-
-		u8500_of_clk_init(U8500_CLKRST1_BASE,
-				  U8500_CLKRST2_BASE,
-				  U8500_CLKRST3_BASE,
-				  U8500_CLKRST5_BASE,
-				  U8500_CLKRST6_BASE);
-	} else if (cpu_is_u9540()) {
-		prcmu_early_init(U8500_PRCMU_BASE, SZ_8K - 1);
-		ux500_pm_init(U8500_PRCMU_BASE, SZ_8K - 1);
-		u9540_clk_init(U8500_CLKRST1_BASE, U8500_CLKRST2_BASE,
-			       U8500_CLKRST3_BASE, U8500_CLKRST5_BASE,
-			       U8500_CLKRST6_BASE);
-	} else if (cpu_is_u8540()) {
-		prcmu_early_init(U8500_PRCMU_BASE, SZ_8K + SZ_4K - 1);
-		ux500_pm_init(U8500_PRCMU_BASE, SZ_8K + SZ_4K - 1);
-		u8540_clk_init(U8500_CLKRST1_BASE, U8500_CLKRST2_BASE,
-			       U8500_CLKRST3_BASE, U8500_CLKRST5_BASE,
-			       U8500_CLKRST6_BASE);
-	}
+	prcmu_early_init(U8500_PRCMU_BASE, SZ_8K + SZ_4K - 1);
+	ux500_pm_init(U8500_PRCMU_BASE, SZ_8K + SZ_4K - 1);
 }
 
+static struct dbx500_asic_id dbx500_id;
+
 static const char * __init ux500_get_machine(void)
 {
-	return kasprintf(GFP_KERNEL, "DB%4x", dbx500_partnumber());
+	return kasprintf(GFP_KERNEL, "DB%4x", dbx500_id.partnumber);
 }
 
 static const char * __init ux500_get_family(void)
@@ -95,7 +73,7 @@ static const char * __init ux500_get_family(void)
 
 static const char * __init ux500_get_revision(void)
 {
-	unsigned int rev = dbx500_revision();
+	unsigned int rev = dbx500_id.revision;
 
 	if (rev == 0x01)
 		return kasprintf(GFP_KERNEL, "%s", "ED");
@@ -138,6 +116,8 @@ struct device * __init ux500_soc_device_init(const char *soc_id)
 	if (!soc_dev_attr)
 		return ERR_PTR(-ENOMEM);
 
+	ux500_asic_id(&dbx500_id);
+
 	soc_info_populate(soc_dev_attr, soc_id);
 
 	soc_dev = soc_device_register(soc_dev_attr);
arch/arm/mach-ux500/id.c +14 -39

85 lines not on this page · raw message

arch/arm/mach-ux500/id.h +0 -121

125 lines not on this page · raw message

arch/arm/mach-ux500/setup.h +2 -1
index 2dea8b59d222..c24004dba2aa 100644
@@ -18,7 +18,8 @@
 
 void ux500_restart(enum reboot_mode mode, const char *cmd);
 
-void __init ux500_map_io(void);
+struct dbx500_asic_id;
+void __init ux500_asic_id(struct dbx500_asic_id *id);
 
 extern void __init ux500_init_irq(void);
 
arch/arm/mach-ux500/timer.c deleted +0 -48

48 lines not on this page · raw message

drivers/clk/ux500/Makefile +0 -1
index 521483f0ba33..f3baef29859c 100644
@@ -9,7 +9,6 @@ obj-y += clk-sysctrl.o
 
 # Clock definitions
 obj-y += u8500_of_clk.o
-obj-y += u8500_clk.o
 obj-y += u9540_clk.o
 obj-y += u8540_clk.o
 
drivers/clk/ux500/u8500_clk.c deleted +0 -525

525 lines not on this page · raw message

drivers/clocksource/clksrc-dbx500-prcmu.c +4 -2
index b375106844d8..76b12750d449 100644
@@ -63,9 +63,9 @@ static u64 notrace dbx500_prcmu_sched_clock_read(void)
 
 #endif
 
-void __init clksrc_dbx500_prcmu_init(void __iomem *base)
+static void __init clksrc_dbx500_prcmu_init(struct device_node *node)
 {
-	clksrc_dbx500_timer_base = base;
+	clksrc_dbx500_timer_base = of_iomap(node, 0);
 
 	/*
 	 * The A9 sub system expects the timer to be configured as
@@ -85,3 +85,5 @@ void __init clksrc_dbx500_prcmu_init(void __iomem *base)
 #endif
 	clocksource_register_hz(&clocksource_dbx500_prcmu, RATE_32K);
 }
+
+CLOCKSOURCE_OF_DECLARE(dbx500_prcmu, "stericsson,db8500-prcmu-timer-4", clksrc_dbx500_prcmu_init);
include/linux/platform_data/clk-ux500.h +0 -3
index 97baf831e071..68afd8b6950b 100644
@@ -12,9 +12,6 @@
 
 void u8500_of_clk_init(u32 clkrst1_base, u32 clkrst2_base, u32 clkrst3_base,
 		       u32 clkrst5_base, u32 clkrst6_base);
-
-void u8500_clk_init(u32 clkrst1_base, u32 clkrst2_base, u32 clkrst3_base,
-		    u32 clkrst5_base, u32 clkrst6_base);
 void u9540_clk_init(u32 clkrst1_base, u32 clkrst2_base, u32 clkrst3_base,
 		    u32 clkrst5_base, u32 clkrst6_base);
 void u8540_clk_init(u32 clkrst1_base, u32 clkrst2_base, u32 clkrst3_base,
#2 lore raw

PATCH 1/10 ARM: ux500: delete UART static map

Quoted 7 lines · Arnd Bergmann
Quoted 5 lines · On Thursday 14 May 2015 18:12:27 Linus Walleij wrote:

Delete the static maps for the Ux500 UARTs and rely on debug_ll_io_init() to do the trick. commit f87b95dd2e4a8832b1d6034f15a5324db42608a0 "ARM: ux500: move debugmacro to debug includes" defined the necessary addruart macro two years ago.

Quoted 8 lines

Hi Linus,

The whole series turned out even nicer than I expected, great work!

I've taken a closer look at the remaining early map for the soc ID and found that this is essentially not needed either. I also found some more dead code, so here is what I came up with. Does this look reasonable to you?

I got some spare cycles so I'm churning through this on a case-by-case basis. Sometimes it doesn't work (regulators used for audio) sometimes it needs a bigger workaround. Adding your Suggested-by to the resulting patches as I go along. Also tidied up SMP boot and some more.

Yours,
Linus Walleij