Skip to contentSkip to conversation

nds32: Support AG101P timer DM.

PATCH New Andes 1 participant 1 message May 19, 2017

lore
Share & tools
lore

Andes

author
#0 lore raw

PATCH 2/3 nds32: Support AG101P timer DM.

From: rick <[email protected]>

Support AG101P timer device tree flow.

---
 arch/nds32/cpu/n1213/ag101/timer.c |    3 +-
 arch/nds32/dts/ag101p.dts          |    8 +++
 configs/adp-ag101p_defconfig       |    2 +
 drivers/timer/Kconfig              |    6 ++
 drivers/timer/Makefile             |    1 +
 drivers/timer/ag101p_timer.c       |  122 ++++++++++++++++++++++++++++++++++++
 6 files changed, 141 insertions(+), 1 deletion(-)
 create mode 100644 drivers/timer/ag101p_timer.c
arch/nds32/cpu/n1213/ag101/timer.c +2 -1
index 758b354..0c03a10 100644
@@ -8,7 +8,7 @@
  *
  * SPDX-License-Identifier:	GPL-2.0+
  */
-
+#ifndef CONFIG_TIMER
 #include <common.h>
 #include <asm/io.h>
 #include <faraday/fttmr010.h>
@@ -189,3 +189,4 @@ ulong get_tbclk(void)
 	return CONFIG_SYS_CLK_FREQ;
 #endif
 }
+#endif /* CONFIG_TIMER */
arch/nds32/dts/ag101p.dts +8 -0
index 2baa3dc..91314b5 100644
@@ -13,6 +13,7 @@
 		/* bootargs = "console=ttyS0,38400n8 earlyprintk=uart8250-32bit,0x99600000 debug bootmem_debug memblock=debug loglevel=7"; */
 		bootargs = "console=ttyS0,38400n8 earlyprintk=uart8250-32bit,0x99600000 debug loglevel=7";
 		stdout-path = "uart0:38400n8";
+		tick-timer = &timer0;
 	};
 
 	memory at 0 {
@@ -46,4 +47,11 @@
 		no-loopback-test = <1>;
 	};
 
+	timer0: timer at 98400000 {
+		compatible = "andestech,attmr010";
+		reg = <0x98400000 0x1000>;
+		interrupts = <19 4>;
+		clock-frequency = <15000000>;
+	};
+
 };
configs/adp-ag101p_defconfig +2 -0
index 2a7302f..685a961 100644
@@ -18,3 +18,5 @@ CONFIG_OF_CONTROL=y
 CONFIG_DM=y
 CONFIG_DM_SERIAL=y
 CONFIG_SYS_NS16550=y
+CONFIG_TIMER=y
+CONFIG_AG101P_TIMER=y
drivers/timer/Kconfig +6 -0
index e038523..356fa29 100644
@@ -74,4 +74,10 @@ config ARC_TIMER
 	  usually at least one of them exists. Either of them is supported
 	  in U-Boot.
 
+config AG101P_TIMER
+	bool "Ag101p timer support"
+	depends on TIMER
+	help
+	  Select this to enable a timer for Ag101p devices.
+
 endmenu
drivers/timer/Makefile +1 -0
index bfe65fc..3dad956 100644
@@ -12,3 +12,4 @@ obj-$(CONFIG_OMAP_TIMER)	+= omap-timer.o
 obj-$(CONFIG_AST_TIMER)	+= ast_timer.o
 obj-$(CONFIG_STI_TIMER)		+= sti-timer.o
 obj-$(CONFIG_ARC_TIMER)	+= arc_timer.o
+obj-$(CONFIG_AG101P_TIMER) += ag101p_timer.o
drivers/timer/ag101p_timer.c new file +122 -0

122 lines not on this page · raw message

Signature · 1 line
1.7.9.5