Skip to contentSkip to conversation

ARM: AT91: Add DT support to AT91RM9200 System Timer

PATCH New Joachim Eastwood 4 participants 15 messages Oct 11, 2012 – Oct 15, 2012

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

PATCH 1/4 ARM: AT91: Add DT support to AT91RM9200 System Timer

Based on AT91 PIT DT patch from Jean-Christophe PLAGNIOL-VILLARD.

---
 .../devicetree/bindings/arm/atmel-at91.txt         |  6 +++
 arch/arm/mach-at91/at91rm9200_time.c               | 63 +++++++++++++++++++++-
 2 files changed, 67 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/arm/atmel-at91.txt +6 -0
index ecc81e3..8adc9a8 100644
@@ -7,6 +7,12 @@ PIT Timer required properties:
 - interrupts: Should contain interrupt for the PIT which is the IRQ line
   shared across all System Controller members.
 
+System Timer (ST) required properties:
+- compatible: Should be "atmel,at91rm9200-st"
+- reg: Should contain registers location and length
+- interrupts: Should contain interrupt for the ST which is the IRQ line
+  shared across all System Controller members.
+
 TC/TCLIB Timer required properties:
 - compatible: Should be "atmel,<chip>-pit".
   <chip> can be "at91rm9200" or "at91sam9x5"
arch/arm/mach-at91/at91rm9200_time.c +61 -2

95 lines not on this page · raw message

Signature · 1 line
1.7.12.2
#1 lore raw

PATCH 2/4 ARM: AT91: Add usart/tc DT clock lookup to AT91RM9200

---
 arch/arm/mach-at91/at91rm9200.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/arm/mach-at91/at91rm9200.c +13 -0
index b4f0565..eef3f53 100644
@@ -188,6 +188,19 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.2", &ssc2_clk),
 	CLKDEV_CON_DEV_ID(NULL, "i2c-at91rm9200", &twi_clk),
+	/* usart lookup table for DT entries */
+	CLKDEV_CON_DEV_ID("usart", "fffff200.serial", &mck),
+	CLKDEV_CON_DEV_ID("usart", "fffc0000.serial", &usart0_clk),
+	CLKDEV_CON_DEV_ID("usart", "fffc4000.serial", &usart1_clk),
+	CLKDEV_CON_DEV_ID("usart", "fffc8000.serial", &usart2_clk),
+	CLKDEV_CON_DEV_ID("usart", "fffcc000.serial", &usart3_clk),
+	/* tc lookup table for DT entries */
+	CLKDEV_CON_DEV_ID("t0_clk", "fffa0000.timer", &tc0_clk),
+	CLKDEV_CON_DEV_ID("t1_clk", "fffa0000.timer", &tc1_clk),
+	CLKDEV_CON_DEV_ID("t2_clk", "fffa0000.timer", &tc2_clk),
+	CLKDEV_CON_DEV_ID("t0_clk", "fffa4000.timer", &tc3_clk),
+	CLKDEV_CON_DEV_ID("t1_clk", "fffa4000.timer", &tc4_clk),
+	CLKDEV_CON_DEV_ID("t2_clk", "fffa4000.timer", &tc5_clk),
 	/* fake hclk clock */
 	CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
 	CLKDEV_CON_ID("pioA", &pioA_clk),
Signature · 1 line
1.7.12.2
#2 lore raw

PATCH 2/4 ARM: AT91: Add usart/tc DT clock lookup to AT91RM9200

Hi,

You need to rebase your patch over the pinctrl

Best Regards,
J.

Quoted 32 lines · Joachim Eastwood
---
 arch/arm/mach-at91/at91rm9200.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/arm/mach-at91/at91rm9200.c +13 -0
index b4f0565..eef3f53 100644
@@ -188,6 +188,19 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.2", &ssc2_clk),
 	CLKDEV_CON_DEV_ID(NULL, "i2c-at91rm9200", &twi_clk),
+	/* usart lookup table for DT entries */
+	CLKDEV_CON_DEV_ID("usart", "fffff200.serial", &mck),
+	CLKDEV_CON_DEV_ID("usart", "fffc0000.serial", &usart0_clk),
+	CLKDEV_CON_DEV_ID("usart", "fffc4000.serial", &usart1_clk),
+	CLKDEV_CON_DEV_ID("usart", "fffc8000.serial", &usart2_clk),
+	CLKDEV_CON_DEV_ID("usart", "fffcc000.serial", &usart3_clk),
+	/* tc lookup table for DT entries */
+	CLKDEV_CON_DEV_ID("t0_clk", "fffa0000.timer", &tc0_clk),
+	CLKDEV_CON_DEV_ID("t1_clk", "fffa0000.timer", &tc1_clk),
+	CLKDEV_CON_DEV_ID("t2_clk", "fffa0000.timer", &tc2_clk),
+	CLKDEV_CON_DEV_ID("t0_clk", "fffa4000.timer", &tc3_clk),
+	CLKDEV_CON_DEV_ID("t1_clk", "fffa4000.timer", &tc4_clk),
+	CLKDEV_CON_DEV_ID("t2_clk", "fffa4000.timer", &tc5_clk),
 	/* fake hclk clock */
 	CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
 	CLKDEV_CON_ID("pioA", &pioA_clk),
Signature · 1 line
1.7.12.2
#3 lore raw

PATCH 3/4 ARM: AT91: Add AT91RM9200 support to DT board

In reply to Joachim Eastwood

---

Hi,

This patch has some potential issues.
Before this patch board-dt would fail building when only AT91RM9200 was enabled because at91sam926x_timer symbol would be missing. This patch uses the at91rm9200_timer which will fail if AT91RM9200 is not enabled.

Any thoughts on solving this? As mention above this bug exists in mainline now.

I had to create a new at91rm9200_dt_initialize since at91_dt_initialize will panic when it tries to add rstc and shdwc. Is it okay to add at91rm9200_dt_initialize or should we fix at91_dt_rstc and at91_dt_shdwc to not panic when DT nodes are not found?

regards
Joachim Eastwood

 arch/arm/mach-at91/board-dt.c | 15 +++++++++++++++
 arch/arm/mach-at91/generic.h  |  1 +
 arch/arm/mach-at91/setup.c    | 14 ++++++++++++++
 3 files changed, 30 insertions(+)
arch/arm/mach-at91/board-dt.c +15 -0
index e8f45c4..0e73317 100644
@@ -45,11 +45,26 @@ static void __init at91_dt_device_init(void)
 	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 }
 
+static const char *at91rm9200_dt_board_compat[] __initdata = {
+	"atmel,at91rm9200",
+	NULL
+};
+
 static const char *at91_dt_board_compat[] __initdata = {
 	"atmel,at91sam9",
 	NULL
 };
 
+DT_MACHINE_START(at91rm9200_dt, "Atmel AT91RM9200 (Device Tree)")
+	.timer		= &at91rm9200_timer,
+	.map_io		= at91_map_io,
+	.handle_irq	= at91_aic_handle_irq,
+	.init_early	= at91rm9200_dt_initialize,
+	.init_irq	= at91_dt_init_irq,
+	.init_machine	= at91_dt_device_init,
+	.dt_compat	= at91rm9200_dt_board_compat,
+MACHINE_END
+
 DT_MACHINE_START(at91sam_dt, "Atmel AT91SAM (Device Tree)")
 	/* Maintainer: Atmel */
 	.timer		= &at91sam926x_timer,
arch/arm/mach-at91/generic.h +1 -0
index f496506..9bb5ce5 100644
@@ -20,6 +20,7 @@ extern void __init at91_init_sram(int bank, unsigned long base,
 extern void __init at91rm9200_set_type(int type);
 extern void __init at91_initialize(unsigned long main_clock);
 extern void __init at91x40_initialize(unsigned long main_clock);
+extern void __init at91rm9200_dt_initialize(void);
 extern void __init at91_dt_initialize(void);
 
  /* Interrupts */
arch/arm/mach-at91/setup.c +14 -0
index da9881b..2c1fdd4 100644
@@ -338,6 +338,7 @@ static void at91_dt_rstc(void)
 }
 
 static struct of_device_id ramc_ids[] = {
+	{ .compatible = "atmel,at91rm9200-sdramc" },
 	{ .compatible = "atmel,at91sam9260-sdramc" },
 	{ .compatible = "atmel,at91sam9g45-ddramc" },
 	{ /*sentinel*/ }
@@ -436,6 +437,19 @@ end:
 	of_node_put(np);
 }
 
+void __init at91rm9200_dt_initialize(void)
+{
+	at91_dt_ramc();
+
+	/* Init clock subsystem */
+	at91_dt_clock_init();
+
+	/* Register the processor-specific clocks */
+	at91_boot_soc.register_clocks();
+
+	at91_boot_soc.init();
+}
+
 void __init at91_dt_initialize(void)
 {
 	at91_dt_rstc();
Signature · 1 line
1.7.12.2
#4 lore raw

PATCH 3/4 ARM: AT91: Add AT91RM9200 support to DT board

Quoted 8 lines · Joachim Eastwood

---

Hi,

This patch has some potential issues.
Before this patch board-dt would fail building when only AT91RM9200 was enabled because at91sam926x_timer symbol would be missing. This patch uses the at91rm9200_timer which will fail if AT91RM9200 is not enabled.

this need work with ot wtihout rm9200

Quoted 2 lines

Any thoughts on solving this? As mention above this bug exists in mainline now.

duplicate the board-dt with one for rm9200 only
as rm9200 ans sam9 are 2 distict familly

Quoted 3 lines

I had to create a new at91rm9200_dt_initialize since at91_dt_initialize will panic when it tries to add rstc and shdwc. Is it okay to add at91rm9200_dt_initialize or should we fix at91_dt_rstc and at91_dt_shdwc to not panic when DT nodes are not found?

it's ok

Quoted 1 line

can you add a board too rm9200ek will be good

Best Regards,
J.

Quoted 86 lines

regards
Joachim Eastwood

 arch/arm/mach-at91/board-dt.c | 15 +++++++++++++++
 arch/arm/mach-at91/generic.h  |  1 +
 arch/arm/mach-at91/setup.c    | 14 ++++++++++++++
 3 files changed, 30 insertions(+)
arch/arm/mach-at91/board-dt.c +15 -0
index e8f45c4..0e73317 100644
@@ -45,11 +45,26 @@ static void __init at91_dt_device_init(void)
 	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 }
 
+static const char *at91rm9200_dt_board_compat[] __initdata = {
+	"atmel,at91rm9200",
+	NULL
+};
+
 static const char *at91_dt_board_compat[] __initdata = {
 	"atmel,at91sam9",
 	NULL
 };
 
+DT_MACHINE_START(at91rm9200_dt, "Atmel AT91RM9200 (Device Tree)")
+	.timer		= &at91rm9200_timer,
+	.map_io		= at91_map_io,
+	.handle_irq	= at91_aic_handle_irq,
+	.init_early	= at91rm9200_dt_initialize,
+	.init_irq	= at91_dt_init_irq,
+	.init_machine	= at91_dt_device_init,
+	.dt_compat	= at91rm9200_dt_board_compat,
+MACHINE_END
+
 DT_MACHINE_START(at91sam_dt, "Atmel AT91SAM (Device Tree)")
 	/* Maintainer: Atmel */
 	.timer		= &at91sam926x_timer,
arch/arm/mach-at91/generic.h +1 -0
index f496506..9bb5ce5 100644
@@ -20,6 +20,7 @@ extern void __init at91_init_sram(int bank, unsigned long base,
 extern void __init at91rm9200_set_type(int type);
 extern void __init at91_initialize(unsigned long main_clock);
 extern void __init at91x40_initialize(unsigned long main_clock);
+extern void __init at91rm9200_dt_initialize(void);
 extern void __init at91_dt_initialize(void);
 
  /* Interrupts */
arch/arm/mach-at91/setup.c +14 -0
index da9881b..2c1fdd4 100644
@@ -338,6 +338,7 @@ static void at91_dt_rstc(void)
 }
 
 static struct of_device_id ramc_ids[] = {
+	{ .compatible = "atmel,at91rm9200-sdramc" },
 	{ .compatible = "atmel,at91sam9260-sdramc" },
 	{ .compatible = "atmel,at91sam9g45-ddramc" },
 	{ /*sentinel*/ }
@@ -436,6 +437,19 @@ end:
 	of_node_put(np);
 }
 
+void __init at91rm9200_dt_initialize(void)
+{
+	at91_dt_ramc();
+
+	/* Init clock subsystem */
+	at91_dt_clock_init();
+
+	/* Register the processor-specific clocks */
+	at91_boot_soc.register_clocks();
+
+	at91_boot_soc.init();
+}
+
 void __init at91_dt_initialize(void)
 {
 	at91_dt_rstc();
Signature · 1 line
1.7.12.2
#5 lore raw

PATCH 3/4 ARM: AT91: Add AT91RM9200 support to DT board

Le 10/12/2012 04:22 PM, Jean-Christophe PLAGNIOL-VILLARD a ?crit :

Quoted 6 lines · Joachim Eastwood
Quoted 5 lines

---

Hi,

Quoted 8 lines
Quoted 3 lines

This patch has some potential issues.
Before this patch board-dt would fail building when only AT91RM9200 was enabled because at91sam926x_timer symbol would be missing. This patch uses the at91rm9200_timer which will fail if AT91RM9200 is not enabled.

this need work with ot wtihout rm9200

Quoted 2 lines

Any thoughts on solving this? As mention above this bug exists in mainline now.

duplicate the board-dt with one for rm9200 only
as rm9200 ans sam9 are 2 distict familly

Why not adding a new machine descriptor for rm9200 in order to prevent file duplication?

Regards

Ludovic

Quoted 103 lines
Quoted 3 lines

I had to create a new at91rm9200_dt_initialize since at91_dt_initialize will panic when it tries to add rstc and shdwc. Is it okay to add at91rm9200_dt_initialize or should we fix at91_dt_rstc and at91_dt_shdwc to not panic when DT nodes are not found?

it's ok

Quoted 1 line

can you add a board too rm9200ek will be good

Best Regards,
J.

Quoted 84 lines

regards
Joachim Eastwood

  arch/arm/mach-at91/board-dt.c | 15 +++++++++++++++
  arch/arm/mach-at91/generic.h  |  1 +
  arch/arm/mach-at91/setup.c    | 14 ++++++++++++++
  3 files changed, 30 insertions(+)
arch/arm/mach-at91/board-dt.c +15 -0
index e8f45c4..0e73317 100644
@@ -45,11 +45,26 @@ static void __init at91_dt_device_init(void)
  	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
  }
 
+static const char *at91rm9200_dt_board_compat[] __initdata = {
+	"atmel,at91rm9200",
+	NULL
+};
+
  static const char *at91_dt_board_compat[] __initdata = {
  	"atmel,at91sam9",
  	NULL
  };
 
+DT_MACHINE_START(at91rm9200_dt, "Atmel AT91RM9200 (Device Tree)")
+	.timer		= &at91rm9200_timer,
+	.map_io		= at91_map_io,
+	.handle_irq	= at91_aic_handle_irq,
+	.init_early	= at91rm9200_dt_initialize,
+	.init_irq	= at91_dt_init_irq,
+	.init_machine	= at91_dt_device_init,
+	.dt_compat	= at91rm9200_dt_board_compat,
+MACHINE_END
+
  DT_MACHINE_START(at91sam_dt, "Atmel AT91SAM (Device Tree)")
  	/* Maintainer: Atmel */
  	.timer		= &at91sam926x_timer,
arch/arm/mach-at91/generic.h +1 -0
index f496506..9bb5ce5 100644
@@ -20,6 +20,7 @@ extern void __init at91_init_sram(int bank, unsigned long base,
  extern void __init at91rm9200_set_type(int type);
  extern void __init at91_initialize(unsigned long main_clock);
  extern void __init at91x40_initialize(unsigned long main_clock);
+extern void __init at91rm9200_dt_initialize(void);
  extern void __init at91_dt_initialize(void);
 
   /* Interrupts */
arch/arm/mach-at91/setup.c +14 -1
index da9881b..2c1fdd4 100644
@@ -338,6 +338,7 @@ static void at91_dt_rstc(void)
  }
 
  static struct of_device_id ramc_ids[] = {
+	{ .compatible = "atmel,at91rm9200-sdramc" },
  	{ .compatible = "atmel,at91sam9260-sdramc" },
  	{ .compatible = "atmel,at91sam9g45-ddramc" },
  	{ /*sentinel*/ }
@@ -436,6 +437,19 @@ end:
  	of_node_put(np);
  }
 
+void __init at91rm9200_dt_initialize(void)
+{
+	at91_dt_ramc();
+
+	/* Init clock subsystem */
+	at91_dt_clock_init();
+
+	/* Register the processor-specific clocks */
+	at91_boot_soc.register_clocks();
+
+	at91_boot_soc.init();
+}
+
  void __init at91_dt_initialize(void)
  {
  	at91_dt_rstc();
--
Quoted 2 lines

1.7.12.2

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#6 lore raw

PATCH 3/4 ARM: AT91: Add AT91RM9200 support to DT board

Quoted 10 lines · ludovic.desroches

Le 10/12/2012 04:22 PM, Jean-Christophe PLAGNIOL-VILLARD a ?crit :

Quoted 9 lines · Joachim Eastwood
Quoted 8 lines

---

Hi,

This patch has some potential issues.
Before this patch board-dt would fail building when only AT91RM9200 was enabled because at91sam926x_timer symbol would be missing. This patch uses the at91rm9200_timer which will fail if AT91RM9200 is not enabled.

Quoted 8 lines
Quoted 5 lines

this need work with ot wtihout rm9200

Quoted 2 lines

Any thoughts on solving this? As mention above this bug exists in mainline now.

duplicate the board-dt with one for rm9200 only
as rm9200 ans sam9 are 2 distict familly

Why not adding a new machine descriptor for rm9200 in order to prevent file duplication?

because the soc are different and can only be compile if the timer is enable and I do not want to enable the rm9200 timer on sam9 so instead of a ifdef i the board-dt create a new board is better as we have a 50 lines file

with different board_compat and different machine descriptor

Best Regards,
J.

Quoted 109 lines

Regards

Ludovic

Quoted 103 lines
Quoted 3 lines

I had to create a new at91rm9200_dt_initialize since at91_dt_initialize will panic when it tries to add rstc and shdwc. Is it okay to add at91rm9200_dt_initialize or should we fix at91_dt_rstc and at91_dt_shdwc to not panic when DT nodes are not found?

it's ok

Quoted 1 line

can you add a board too rm9200ek will be good

Best Regards,
J.

Quoted 84 lines

regards
Joachim Eastwood

 arch/arm/mach-at91/board-dt.c | 15 +++++++++++++++
 arch/arm/mach-at91/generic.h  |  1 +
 arch/arm/mach-at91/setup.c    | 14 ++++++++++++++
 3 files changed, 30 insertions(+)
arch/arm/mach-at91/board-dt.c +15 -0
index e8f45c4..0e73317 100644
@@ -45,11 +45,26 @@ static void __init at91_dt_device_init(void)
 	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 }
 
+static const char *at91rm9200_dt_board_compat[] __initdata = {
+	"atmel,at91rm9200",
+	NULL
+};
+
 static const char *at91_dt_board_compat[] __initdata = {
 	"atmel,at91sam9",
 	NULL
 };
 
+DT_MACHINE_START(at91rm9200_dt, "Atmel AT91RM9200 (Device Tree)")
+	.timer		= &at91rm9200_timer,
+	.map_io		= at91_map_io,
+	.handle_irq	= at91_aic_handle_irq,
+	.init_early	= at91rm9200_dt_initialize,
+	.init_irq	= at91_dt_init_irq,
+	.init_machine	= at91_dt_device_init,
+	.dt_compat	= at91rm9200_dt_board_compat,
+MACHINE_END
+
 DT_MACHINE_START(at91sam_dt, "Atmel AT91SAM (Device Tree)")
 	/* Maintainer: Atmel */
 	.timer		= &at91sam926x_timer,
arch/arm/mach-at91/generic.h +1 -0
index f496506..9bb5ce5 100644
@@ -20,6 +20,7 @@ extern void __init at91_init_sram(int bank, unsigned long base,
 extern void __init at91rm9200_set_type(int type);
 extern void __init at91_initialize(unsigned long main_clock);
 extern void __init at91x40_initialize(unsigned long main_clock);
+extern void __init at91rm9200_dt_initialize(void);
 extern void __init at91_dt_initialize(void);
 
  /* Interrupts */
arch/arm/mach-at91/setup.c +14 -1
index da9881b..2c1fdd4 100644
@@ -338,6 +338,7 @@ static void at91_dt_rstc(void)
 }
 
 static struct of_device_id ramc_ids[] = {
+	{ .compatible = "atmel,at91rm9200-sdramc" },
 	{ .compatible = "atmel,at91sam9260-sdramc" },
 	{ .compatible = "atmel,at91sam9g45-ddramc" },
 	{ /*sentinel*/ }
@@ -436,6 +437,19 @@ end:
 	of_node_put(np);
 }
 
+void __init at91rm9200_dt_initialize(void)
+{
+	at91_dt_ramc();
+
+	/* Init clock subsystem */
+	at91_dt_clock_init();
+
+	/* Register the processor-specific clocks */
+	at91_boot_soc.register_clocks();
+
+	at91_boot_soc.init();
+}
+
 void __init at91_dt_initialize(void)
 {
 	at91_dt_rstc();
--
Quoted 2 lines

1.7.12.2

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#7 lore raw

PATCH 3/4 ARM: AT91: Add AT91RM9200 support to DT board

Quoted 6 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 5 lines · ludovic.desroches

Le 10/12/2012 04:22 PM, Jean-Christophe PLAGNIOL-VILLARD a ?crit :

Quoted 4 lines · Joachim Eastwood
Quoted 3 lines

---

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

Hi,

This patch has some potential issues.
Before this patch board-dt would fail building when only AT91RM9200 was enabled because at91sam926x_timer symbol would be missing. This patch uses the at91rm9200_timer which will fail if AT91RM9200 is not enabled.

this need work with ot wtihout rm9200

btw, to solve the build issue with board-dt in mainline now we need to add a select CONFIG_SOC_AT91SAM9 to config MACH_AT91SAM_DT.

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 2 lines

Any thoughts on solving this? As mention above this bug exists in mainline now.

duplicate the board-dt with one for rm9200 only
as rm9200 ans sam9 are 2 distict familly

Quoted 7 lines
Quoted 2 lines

Why not adding a new machine descriptor for rm9200 in order to prevent file duplication?

because the soc are different and can only be compile if the timer is enable and I do not want to enable the rm9200 timer on sam9 so instead of a ifdef i the board-dt create a new board is better as we have a 50 lines file

with different board_compat and different machine descriptor

I am okey with either approach, but I would like to hear what Nicolas Ferre has to say since he is the on the one that added board-dt. It would be nice to have everything in one board DT file, but I understand your concern with the RM9200 timer.

We will also bump into this again on AT91X40 I guess.

regards
Joachim Eastwood

#8 lore raw

PATCH 3/4 ARM: AT91: Add AT91RM9200 support to DT board

Quoted 29 lines · Joachim Eastwood
Quoted 6 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 5 lines · ludovic.desroches

Le 10/12/2012 04:22 PM, Jean-Christophe PLAGNIOL-VILLARD a ?crit :

Quoted 4 lines · Joachim Eastwood
Quoted 3 lines

---

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

Hi,

This patch has some potential issues.
Before this patch board-dt would fail building when only AT91RM9200 was enabled because at91sam926x_timer symbol would be missing. This patch uses the at91rm9200_timer which will fail if AT91RM9200 is not enabled.

this need work with ot wtihout rm9200

btw, to solve the build issue with board-dt in mainline now we need to add a select CONFIG_SOC_AT91SAM9 to config MACH_AT91SAM_DT.

Quoted 11 lines
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Any thoughts on solving this? As mention above this bug exists in mainline now.

duplicate the board-dt with one for rm9200 only
as rm9200 ans sam9 are 2 distict familly

Why not adding a new machine descriptor for rm9200 in order to prevent file duplication?

because the soc are different and can only be compile if the timer is enable and I do not want to enable the rm9200 timer on sam9 so instead of a ifdef i the board-dt create a new board is better as we have a 50 lines file

Quoted 8 lines
Quoted 1 line

with different board_compat and different machine descriptor

I am okey with either approach, but I would like to hear what Nicolas Ferre has to say since he is the on the one that added board-dt. It would be nice to have everything in one board DT file, but I understand your concern with the RM9200 timer.

We will also bump into this again on AT91X40 I guess.

simple on x40 forget about it the x40 is no MMU only SoC

so you can not enable it by default as the all other at91 are use with MMU

I did the necessary to make the board-dt nearly empty and the same for all the sam9 but the board-dt is sam9 only and need to be keeped this way

Nico will tell you the same

Best Regards,
J.

#9 lore raw

PATCH 3/4 ARM: AT91: Add AT91RM9200 support to DT board

Quoted 38 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 29 lines · Joachim Eastwood
Quoted 6 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 5 lines · ludovic.desroches

Le 10/12/2012 04:22 PM, Jean-Christophe PLAGNIOL-VILLARD a ?crit :

Quoted 4 lines · Joachim Eastwood
Quoted 3 lines

---

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

Hi,

This patch has some potential issues.
Before this patch board-dt would fail building when only AT91RM9200 was enabled because at91sam926x_timer symbol would be missing. This patch uses the at91rm9200_timer which will fail if AT91RM9200 is not enabled.

this need work with ot wtihout rm9200

btw, to solve the build issue with board-dt in mainline now we need to add a select CONFIG_SOC_AT91SAM9 to config MACH_AT91SAM_DT.

Quoted 11 lines
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Any thoughts on solving this? As mention above this bug exists in mainline now.

duplicate the board-dt with one for rm9200 only
as rm9200 ans sam9 are 2 distict familly

Why not adding a new machine descriptor for rm9200 in order to prevent file duplication?

because the soc are different and can only be compile if the timer is enable and I do not want to enable the rm9200 timer on sam9 so instead of a ifdef i the board-dt create a new board is better as we have a 50 lines file

Quoted 8 lines
Quoted 1 line

with different board_compat and different machine descriptor

I am okey with either approach, but I would like to hear what Nicolas Ferre has to say since he is the on the one that added board-dt. It would be nice to have everything in one board DT file, but I understand your concern with the RM9200 timer.

We will also bump into this again on AT91X40 I guess.

Quoted 8 lines

simple on x40 forget about it the x40 is no MMU only SoC

so you can not enable it by default as the all other at91 are use with MMU

I did the necessary to make the board-dt nearly empty and the same for all the sam9 but the board-dt is sam9 only and need to be keeped this way

Nico will tell you the same

okay. I'll make the necessary changes to the patch set.

I'll also include a fix for board-dt (select CONFIG_SOC_AT91SAM9) to stop the build failure when it's enabled on a RM9200 only config.

Secondly I'll rebase on linux-next which includes your at91-pinctrl stuff.

regards
Joachim Eastwood

Quoted 2 lines

Best Regards,
J.

#10 lore raw

PATCH 3/4 ARM: AT91: Add AT91RM9200 support to DT board

Quoted 47 lines · Joachim Eastwood
Quoted 45 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 29 lines · Joachim Eastwood
Quoted 6 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 5 lines · ludovic.desroches

Le 10/12/2012 04:22 PM, Jean-Christophe PLAGNIOL-VILLARD a ?crit :

Quoted 4 lines · Joachim Eastwood
Quoted 3 lines

---

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

Hi,

This patch has some potential issues.
Before this patch board-dt would fail building when only AT91RM9200 was enabled because at91sam926x_timer symbol would be missing. This patch uses the at91rm9200_timer which will fail if AT91RM9200 is not enabled.

this need work with ot wtihout rm9200

btw, to solve the build issue with board-dt in mainline now we need to add a select CONFIG_SOC_AT91SAM9 to config MACH_AT91SAM_DT.

Quoted 11 lines
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Any thoughts on solving this? As mention above this bug exists in mainline now.

duplicate the board-dt with one for rm9200 only
as rm9200 ans sam9 are 2 distict familly

Why not adding a new machine descriptor for rm9200 in order to prevent file duplication?

because the soc are different and can only be compile if the timer is enable and I do not want to enable the rm9200 timer on sam9 so instead of a ifdef i the board-dt create a new board is better as we have a 50 lines file

Quoted 8 lines
Quoted 1 line

with different board_compat and different machine descriptor

I am okey with either approach, but I would like to hear what Nicolas Ferre has to say since he is the on the one that added board-dt. It would be nice to have everything in one board DT file, but I understand your concern with the RM9200 timer.

We will also bump into this again on AT91X40 I guess.

simple on x40 forget about it the x40 is no MMU only SoC

so you can not enable it by default as the all other at91 are use with MMU

I did the necessary to make the board-dt nearly empty and the same for all the sam9 but the board-dt is sam9 only and need to be keeped this way

Quoted 6 lines
Quoted 1 line

Nico will tell you the same

okay. I'll make the necessary changes to the patch set.

I'll also include a fix for board-dt (select CONFIG_SOC_AT91SAM9) to stop the build failure when it's enabled on a RM9200 only config.

if rm9200 only the board-dt does not have to be enabled

as you do not have the clock for any of the soc

Best Regards,
J.

#11 lore raw

PATCH 3/4 ARM: AT91: Add AT91RM9200 support to DT board

In reply to Joachim Eastwood

On 10/14/2012 06:39 PM, Joachim Eastwood :

Quoted 42 lines
Quoted 40 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 29 lines · Joachim Eastwood
Quoted 6 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 5 lines · ludovic.desroches

Le 10/12/2012 04:22 PM, Jean-Christophe PLAGNIOL-VILLARD a ?crit :

Quoted 4 lines · Joachim Eastwood
Quoted 3 lines

---

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

Hi,

This patch has some potential issues.
Before this patch board-dt would fail building when only AT91RM9200 was enabled because at91sam926x_timer symbol would be missing. This patch uses the at91rm9200_timer which will fail if AT91RM9200 is not enabled.

this need work with ot wtihout rm9200

btw, to solve the build issue with board-dt in mainline now we need to add a select CONFIG_SOC_AT91SAM9 to config MACH_AT91SAM_DT.

Quoted 11 lines
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Any thoughts on solving this? As mention above this bug exists in mainline now.

duplicate the board-dt with one for rm9200 only
as rm9200 ans sam9 are 2 distict familly

Why not adding a new machine descriptor for rm9200 in order to prevent file duplication?

because the soc are different and can only be compile if the timer is enable and I do not want to enable the rm9200 timer on sam9 so instead of a ifdef i the board-dt create a new board is better as we have a 50 lines file

Quoted 8 lines
Quoted 1 line

with different board_compat and different machine descriptor

I am okey with either approach, but I would like to hear what Nicolas Ferre has to say since he is the on the one that added board-dt. It would be nice to have everything in one board DT file, but I understand your concern with the RM9200 timer.

We will also bump into this again on AT91X40 I guess.

simple on x40 forget about it the x40 is no MMU only SoC

Quoted 8 lines
Quoted 6 lines

so you can not enable it by default as the all other at91 are use with MMU

I did the necessary to make the board-dt nearly empty and the same for all the sam9 but the board-dt is sam9 only and need to be keeped this way

Nico will tell you the same

okay. I'll make the necessary changes to the patch set.

Well, even if did not see the advantage of a new board-dt specifically for rm9200 (and armv4 and armv5 may share the same zImage in the future...), I understand the fact that compiling the rm9200 timer for a sam9 machine is a bit surprising.

So I have a pretty mixed feelings about that, but I will not go against Jean-Christophe nor you Joachim: so continue in this path, we will be able to merge all board-*-dt later if needed anyway...

Bye,

Signature · 1 line
Nicolas Ferre
#12 lore raw

PATCH 3/4 ARM: AT91: Add AT91RM9200 support to DT board

In reply to Jean-Christophe PLAGNIOL-VILLARD

On 10/14/2012 04:54 PM, Jean-Christophe PLAGNIOL-VILLARD :

Quoted 38 lines · Joachim Eastwood
Quoted 29 lines
Quoted 6 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 5 lines · ludovic.desroches

Le 10/12/2012 04:22 PM, Jean-Christophe PLAGNIOL-VILLARD a ?crit :

Quoted 4 lines · Joachim Eastwood
Quoted 3 lines

---

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

Hi,

This patch has some potential issues.
Before this patch board-dt would fail building when only AT91RM9200 was enabled because at91sam926x_timer symbol would be missing. This patch uses the at91rm9200_timer which will fail if AT91RM9200 is not enabled.

this need work with ot wtihout rm9200

btw, to solve the build issue with board-dt in mainline now we need to add a select CONFIG_SOC_AT91SAM9 to config MACH_AT91SAM_DT.

Quoted 11 lines
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Any thoughts on solving this? As mention above this bug exists in mainline now.

duplicate the board-dt with one for rm9200 only
as rm9200 ans sam9 are 2 distict familly

Why not adding a new machine descriptor for rm9200 in order to prevent file duplication?

because the soc are different and can only be compile if the timer is enable and I do not want to enable the rm9200 timer on sam9 so instead of a ifdef i the board-dt create a new board is better as we have a 50 lines file

Quoted 8 lines
Quoted 1 line

with different board_compat and different machine descriptor

I am okey with either approach, but I would like to hear what Nicolas Ferre has to say since he is the on the one that added board-dt. It would be nice to have everything in one board DT file, but I understand your concern with the RM9200 timer.

We will also bump into this again on AT91X40 I guess.

Quoted 8 lines

simple on x40 forget about it the x40 is no MMU only SoC

so you can not enable it by default as the all other at91 are use with MMU

I did the necessary to make the board-dt nearly empty and the same for all the sam9 but the board-dt is sam9 only and need to be keeped this way

Nico will tell you the same

Please, do not speak instead of me!

And even if I often agree with you, it is far from being automatic ;-)

Bye,

Signature · 1 line
Nicolas Ferre
#13 lore raw

PATCH 4/4 ARM: AT91: Add AT91RM9200 device tree

In reply to Joachim Eastwood
---
 arch/arm/boot/dts/at91rm9200.dtsi | 218 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 218 insertions(+)
 create mode 100644 arch/arm/boot/dts/at91rm9200.dtsi
arch/arm/boot/dts/at91rm9200.dtsi new file +218 -0
new file mode 100644
index 0000000..81a344c
@@ -0,0 +1,218 @@
+/*
+ * at91rm9200.dtsi - Device Tree Include file for AT91RM9200 family SoC
+ *
+ *  Copyright (C) 2011 Atmel,
+ *                2011 Nicolas Ferre <[email protected]>,
+ *                2012 Joachim Eastwood <[email protected]>
+ *
+ * Based on at91sam9260.dtsi
+ *
+ * Licensed under GPLv2 or later.
+ */
+
+/include/ "skeleton.dtsi"
+
+/ {
+	model = "Atmel AT91RM9200 family SoC";
+	compatible = "atmel,at91rm9200";
+	interrupt-parent = <&aic>;
+
+	aliases {
+		serial0 = &dbgu;
+		serial1 = &usart0;
+		serial2 = &usart1;
+		serial3 = &usart2;
+		serial4 = &usart3;
+		gpio0 = &pioA;
+		gpio1 = &pioB;
+		gpio2 = &pioC;
+		gpio3 = &pioD;
+		tcb0 = &tcb0;
+		tcb1 = &tcb1;
+	};
+	cpus {
+		cpu at 0 {
+			compatible = "arm,arm920t";
+		};
+	};
+
+	memory {
+		reg = <0x20000000 0x04000000>;
+	};
+
+	ahb {
+		compatible = "simple-bus";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges;
+
+		apb {
+			compatible = "simple-bus";
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges;
+
+			aic: interrupt-controller at fffff000 {
+				#interrupt-cells = <3>;
+				compatible = "atmel,at91rm9200-aic";
+				interrupt-controller;
+				reg = <0xfffff000 0x200>;
+				atmel,external-irqs = <25 26 27 28 29 30 31>;
+			};
+
+			ramc0: ramc at ffffff00 {
+				compatible = "atmel,at91rm9200-sdramc";
+				reg = <0xffffff00 0x100>;
+			};
+
+			pmc: pmc at fffffc00 {
+				compatible = "atmel,at91rm9200-pmc";
+				reg = <0xfffffc00 0x100>;
+			};
+
+			st: timer at fffffd00 {
+				compatible = "atmel,at91rm9200-st";
+				reg = <0xfffffd00 0x100>;
+				interrupts = <1 4 7>;
+			};
+
+			tcb0: timer at fffa0000 {
+				compatible = "atmel,at91rm9200-tcb";
+				reg = <0xfffa0000 0x100>;
+				interrupts = <17 4 0 18 4 0 19 4 0>;
+			};
+
+			tcb1: timer at fffa4000 {
+				compatible = "atmel,at91rm9200-tcb";
+				reg = <0xfffa4000 0x100>;
+				interrupts = <20 4 0 21 4 0 22 4 0>;
+			};
+
+			pioA: gpio at fffff400 {
+				compatible = "atmel,at91rm9200-gpio";
+				reg = <0xfffff400 0x100>;
+				interrupts = <2 4 1>;
+				#gpio-cells = <2>;
+				gpio-controller;
+				interrupt-controller;
+				#interrupt-cells = <2>;
+			};
+
+			pioB: gpio at fffff600 {
+				compatible = "atmel,at91rm9200-gpio";
+				reg = <0xfffff600 0x100>;
+				interrupts = <3 4 1>;
+				#gpio-cells = <2>;
+				gpio-controller;
+				interrupt-controller;
+				#interrupt-cells = <2>;
+			};
+
+			pioC: gpio at fffff800 {
+				compatible = "atmel,at91rm9200-gpio";
+				reg = <0xfffff800 0x100>;
+				interrupts = <4 4 1>;
+				#gpio-cells = <2>;
+				gpio-controller;
+				interrupt-controller;
+				#interrupt-cells = <2>;
+			};
+
+			pioD: gpio at fffffa00 {
+				compatible = "atmel,at91rm9200-gpio";
+				reg = <0xfffffa00 0x100>;
+				interrupts = <5 4 1>;
+				#gpio-cells = <2>;
+				gpio-controller;
+				interrupt-controller;
+				#interrupt-cells = <2>;
+				status = "disabled";
+			};
+
+			dbgu: serial at fffff200 {
+				compatible = "atmel,at91rm9200-usart";
+				reg = <0xfffff200 0x200>;
+				interrupts = <1 4 7>;
+				status = "disabled";
+			};
+
+			usart0: serial at fffc0000 {
+				compatible = "atmel,at91rm9200-usart";
+				reg = <0xfffc0000 0x200>;
+				interrupts = <6 4 5>;
+				atmel,use-dma-rx;
+				atmel,use-dma-tx;
+				status = "disabled";
+			};
+
+			usart1: serial at fffc4000 {
+				compatible = "atmel,at91rm9200-usart";
+				reg = <0xfffc4000 0x200>;
+				interrupts = <7 4 5>;
+				atmel,use-dma-rx;
+				atmel,use-dma-tx;
+				status = "disabled";
+			};
+
+			usart2: serial at fffc8000 {
+				compatible = "atmel,at91rm9200-usart";
+				reg = <0xfffc8000 0x200>;
+				interrupts = <8 4 5>;
+				atmel,use-dma-rx;
+				atmel,use-dma-tx;
+				status = "disabled";
+			};
+
+			usart3: serial at fffcc000 {
+				compatible = "atmel,at91rm9200-usart";
+				reg = <0xfffcc000 0x200>;
+				interrupts = <23 4 5>;
+				atmel,use-dma-rx;
+				atmel,use-dma-tx;
+				status = "disabled";
+			};
+
+			usb1: gadget at fffb0000 {
+				compatible = "atmel,at91rm9200-udc";
+				reg = <0xfffb0000 0x4000>;
+				interrupts = <11 4 2>;
+				status = "disabled";
+			};
+		};
+
+		nand0: nand at 40000000 {
+			compatible = "atmel,at91rm9200-nand";
+			#address-cells = <1>;
+			#size-cells = <1>;
+			reg = <0x40000000 0x10000000>;
+			atmel,nand-addr-offset = <21>;
+			atmel,nand-cmd-offset = <22>;
+			nand-ecc-mode = "soft";
+			gpios = <&pioC 2 0
+				 0
+				 &pioB 1 0
+				>;
+			status = "disabled";
+		};
+
+		usb0: ohci at 00300000 {
+			compatible = "atmel,at91rm9200-ohci", "usb-ohci";
+			reg = <0x00300000 0x100000>;
+			interrupts = <23 4 2>;
+			status = "disabled";
+		};
+	};
+
+	i2c at 0 {
+		compatible = "i2c-gpio";
+		gpios = <&pioA 23 0 /* sda */
+			 &pioA 24 0 /* scl */
+			>;
+		i2c-gpio,sda-open-drain;
+		i2c-gpio,scl-open-drain;
+		i2c-gpio,delay-us = <2>;	/* ~100 kHz */
+		#address-cells = <1>;
+		#size-cells = <0>;
+		status = "disabled";
+	};
+};
Signature · 1 line
1.7.12.2
#14 lore raw

PATCH 1/4 ARM: AT91: Add DT support to AT91RM9200 System Timer

In reply to Joachim Eastwood
Quoted 1 line · Joachim Eastwood

Based on AT91 PIT DT patch from Jean-Christophe PLAGNIOL-VILLARD.

ok for this one

Quoted 130 lines
---
 .../devicetree/bindings/arm/atmel-at91.txt         |  6 +++
 arch/arm/mach-at91/at91rm9200_time.c               | 63 +++++++++++++++++++++-
 2 files changed, 67 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/arm/atmel-at91.txt +6 -0
index ecc81e3..8adc9a8 100644
@@ -7,6 +7,12 @@ PIT Timer required properties:
 - interrupts: Should contain interrupt for the PIT which is the IRQ line
   shared across all System Controller members.
 
+System Timer (ST) required properties:
+- compatible: Should be "atmel,at91rm9200-st"
+- reg: Should contain registers location and length
+- interrupts: Should contain interrupt for the ST which is the IRQ line
+  shared across all System Controller members.
+
 TC/TCLIB Timer required properties:
 - compatible: Should be "atmel,<chip>-pit".
   <chip> can be "at91rm9200" or "at91sam9x5"
arch/arm/mach-at91/at91rm9200_time.c +61 -2
index aaa443b..cafe988 100644
@@ -24,6 +24,9 @@
 #include <linux/irq.h>
 #include <linux/clockchips.h>
 #include <linux/export.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
 
 #include <asm/mach/time.h>
 
@@ -91,7 +94,8 @@ static irqreturn_t at91rm9200_timer_interrupt(int irq, void *dev_id)
 static struct irqaction at91rm9200_timer_irq = {
 	.name		= "at91_tick",
 	.flags		= IRQF_SHARED | IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
-	.handler	= at91rm9200_timer_interrupt
+	.handler	= at91rm9200_timer_interrupt,
+	.irq		= NR_IRQS_LEGACY + AT91_ID_SYS,
 };
 
 static cycle_t read_clk32k(struct clocksource *cs)
@@ -179,8 +183,60 @@ static struct clock_event_device clkevt = {
 void __iomem *at91_st_base;
 EXPORT_SYMBOL_GPL(at91_st_base);
 
+#ifdef CONFIG_OF
+static struct of_device_id at91rm9200_st_timer_ids[] = {
+	{ .compatible = "atmel,at91rm9200-st" },
+	{ /* sentinel */ }
+};
+
+static int __init of_at91rm9200_st_init(void)
+{
+	struct device_node *np;
+	int ret;
+
+	np = of_find_matching_node(NULL, at91rm9200_st_timer_ids);
+	if (!np)
+		goto err;
+
+	at91_st_base = of_iomap(np, 0);
+	if (!at91_st_base)
+		goto node_err;
+
+	/* Get the interrupts property */
+	ret = irq_of_parse_and_map(np, 0);
+	if (!ret)
+		goto ioremap_err;
+	at91rm9200_timer_irq.irq = ret;
+
+	of_node_put(np);
+
+	return 0;
+
+ioremap_err:
+	iounmap(at91_st_base);
+node_err:
+	of_node_put(np);
+err:
+	return -EINVAL;
+}
+#else
+static int __init of_at91rm9200_st_init(void)
+{
+	return -EINVAL;
+}
+#endif
+
 void __init at91rm9200_ioremap_st(u32 addr)
 {
+#ifdef CONFIG_OF
+	struct device_node *np;
+
+	np = of_find_matching_node(NULL, at91rm9200_st_timer_ids);
+	if (np) {
+		of_node_put(np);
+		return;
+	}
+#endif
 	at91_st_base = ioremap(addr, 256);
 	if (!at91_st_base)
 		panic("Impossible to ioremap ST\n");
@@ -191,13 +247,16 @@ void __init at91rm9200_ioremap_st(u32 addr)
  */
 void __init at91rm9200_timer_init(void)
 {
+	/* For device tree enabled device: initialize here */
+	of_at91rm9200_st_init();
+
 	/* Disable all timer interrupts, and clear any pending ones */
 	at91_st_write(AT91_ST_IDR,
 		AT91_ST_PITS | AT91_ST_WDOVF | AT91_ST_RTTINC | AT91_ST_ALMS);
 	at91_st_read(AT91_ST_SR);
 
 	/* Make IRQs happen for the system timer */
-	setup_irq(NR_IRQS_LEGACY + AT91_ID_SYS, &at91rm9200_timer_irq);
+	setup_irq(at91rm9200_timer_irq.irq, &at91rm9200_timer_irq);
 
 	/* The 32KiHz "Slow Clock" (tick every 30517.58 nanoseconds) is used
 	 * directly for the clocksource and all clockevents, after adjusting
Signature · 1 line
1.7.12.2