Skip to contentSkip to conversation

Xilinx Microblaze patches

PATCH New Michal Simek 2 participants 7 messages Apr 23, 2013

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

v2 cover Xilinx Microblaze patches

Here are some patches I have in my private repo for a long time. Let's upstream them.

Thanks,
Michal

Changes in v2:
- Remove trailing 1 for configurations
- Remove \; from nc variable
- Fix define macros not to use trailing 1
- define watchdog_base as static variable
- label init and disable function as extern in header
- Add record to xparameters.h to get it compiled by default

Michal Simek (4):
microblaze: Fix reset function
microblaze: Enable netconsole
microblaze: Disable all cpu features before reset
watchdog: Add support for Xilinx Microblaze watchdog

 arch/microblaze/include/asm/processor.h            |  4 +
 arch/microblaze/lib/board.c                        |  3 +
 .../xilinx/microblaze-generic/microblaze-generic.c | 11 ++-
 board/xilinx/microblaze-generic/xparameters.h      |  4 +
 doc/README.watchdog                                |  3 +
 drivers/watchdog/Makefile                          |  1 +
 drivers/watchdog/xilinx_tb_wdt.c                   | 87 ++++++++++++++++++++++
 include/configs/microblaze-generic.h               | 17 ++++-
 8 files changed, 126 insertions(+), 4 deletions(-)
 create mode 100644 drivers/watchdog/xilinx_tb_wdt.c

--
1.8.2.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130423/8c176ea2/attachment.pgp>

#1 lore raw

PATCH v2 1/4 microblaze: Fix reset function

From: Michal Simek <[email protected]>

Remove CONFIG_SYS_RESET_ADDRESS macro.
It was there from historical point of view when soft reset was just jump to u-boot text start (not used right now).

---
Changes in v2: None

 board/xilinx/microblaze-generic/microblaze-generic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
board/xilinx/microblaze-generic/microblaze-generic.c +2 -2
index 70f94c1..8ba99f9 100644
@@ -38,10 +38,10 @@ int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	*((unsigned long *)(CONFIG_SYS_GPIO_0_ADDR)) =
 	    ++(*((unsigned long *)(CONFIG_SYS_GPIO_0_ADDR)));
 #endif
-#ifdef CONFIG_SYS_RESET_ADDRESS
+
 	puts ("Reseting board\n");
 	asm ("bra r0");
-#endif
+
 	return 0;
 }
 

--
1.8.2.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130423/d01b35cc/attachment.pgp>

#2 lore raw

PATCH v2 2/4 microblaze: Enable netconsole

In reply to Michal Simek

From: Michal Simek <[email protected]>

Setup environment and enable netconsole.

---
Changes in v2:
- Remove trailing 1 for configurations
- Remove \; from nc variable

 include/configs/microblaze-generic.h | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
include/configs/microblaze-generic.h +8 -1
index d172e56..8c0353a 100644
@@ -414,10 +414,17 @@
 					"nor0=flash-0\0"\
 					"mtdparts=mtdparts=flash-0:"\
 					"256k(u-boot),256k(env),3m(kernel),"\
-					"1m(romfs),1m(cramfs),-(jffs2)\0"
+					"1m(romfs),1m(cramfs),-(jffs2)\0"\
+					"nc=setenv stdout nc;"\
+					"setenv stdin nc\0" \
+					"serial=setenv stdout serial;"\
+					"setenv stdin serial\0"
 
 #define CONFIG_CMDLINE_EDITING
 
+#define CONFIG_NETCONSOLE
+#define CONFIG_SYS_CONSOLE_IS_IN_ENV
+
 /* Use the HUSH parser */
 #define CONFIG_SYS_HUSH_PARSER
 

--
1.8.2.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130423/ca02e9fe/attachment.pgp>

#3 lore raw

PATCH v2 2/4 microblaze: Enable netconsole

Quoted 6 lines · Michal Simek

From: Michal Simek <[email protected]>

Setup environment and enable netconsole.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130423/b881425b/attachment.pgp>
#4 lore raw

PATCH v2 3/4 microblaze: Disable all cpu features before reset

In reply to Michal Simek

From: Michal Simek <[email protected]>

Fix microblaze soft reset function and disable all cpu features. Especially disable caches because IRQs were off by disable_interrupts().

---
Changes in v2: None

 board/xilinx/microblaze-generic/microblaze-generic.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
board/xilinx/microblaze-generic/microblaze-generic.c +2 -1
index 8ba99f9..1af0b86 100644
@@ -40,7 +40,8 @@ int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 #endif
 
 	puts ("Reseting board\n");
-	asm ("bra r0");
+	__asm__ __volatile__ ("	mts rmsr, r0;" \
+				"bra r0");
 
 	return 0;
 }

--
1.8.2.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130423/350400f5/attachment.pgp>

#5 lore raw

PATCH v2 4/4 watchdog: Add support for Xilinx Microblaze watchdog

In reply to Michal Simek

Watchdog can be used on Microblaze, PPC and Zynq hw designs.

---
Changes in v2:
- Fix define macros not to use trailing 1
- define watchdog_base as static variable
- label init and disable function as extern in header
- Add record to xparameters.h to get it compiled by default

 arch/microblaze/include/asm/processor.h            |  4 +
 arch/microblaze/lib/board.c                        |  3 +
 .../xilinx/microblaze-generic/microblaze-generic.c |  4 +
 board/xilinx/microblaze-generic/xparameters.h      |  4 +
 doc/README.watchdog                                |  3 +
 drivers/watchdog/Makefile                          |  1 +
 drivers/watchdog/xilinx_tb_wdt.c                   | 87 ++++++++++++++++++++++
 include/configs/microblaze-generic.h               |  8 ++
 8 files changed, 114 insertions(+)
 create mode 100644 drivers/watchdog/xilinx_tb_wdt.c
arch/microblaze/include/asm/processor.h +4 -0
index 2c4d5ff..d33faeb 100644
@@ -31,4 +31,8 @@ extern char __text_start[];
 /* Microblaze board initialization function */
 void board_init(void);
 
+/* Watchdog functions */
+extern int hw_watchdog_init(void);
+extern void hw_watchdog_disable(void);
+
 #endif /* __ASM_MICROBLAZE_PROCESSOR_H */
arch/microblaze/lib/board.c +3 -0
index a7c2f76..815fb5a 100644
@@ -61,6 +61,9 @@ init_fnc_t *init_sequence[] = {
 	serial_init,
 	console_init_f,
 	interrupts_init,
+#ifdef CONFIG_XILINX_TB_WATCHDOG
+	hw_watchdog_init,
+#endif
 	timer_init,
 	NULL,
 };
board/xilinx/microblaze-generic/microblaze-generic.c +4 -0
index 1af0b86..befbb3a 100644
@@ -39,6 +39,10 @@ int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	    ++(*((unsigned long *)(CONFIG_SYS_GPIO_0_ADDR)));
 #endif
 
+#ifdef CONFIG_XILINX_TB_WATCHDOG
+	hw_watchdog_disable();
+#endif
+
 	puts ("Reseting board\n");
 	__asm__ __volatile__ ("	mts rmsr, r0;" \
 				"bra r0");
board/xilinx/microblaze-generic/xparameters.h +4 -0
index 50a82d9..c846f97 100644
@@ -77,3 +77,7 @@
 #define XILINX_LLTEMAC_SDMA_CTRL_BASEADDR	0x42000180
 #define XILINX_LLTEMAC_BASEADDR1		0x44200000
 #define XILINX_LLTEMAC_FIFO_BASEADDR1		0x42100000
+
+/* Watchdog IP is wxi_timebase_wdt_0 */
+#define XILINX_WATCHDOG_BASEADDR	0x50000000
+#define XILINX_WATCHDOG_IRQ		1
doc/README.watchdog +3 -0
index ee65008..33f31c2 100644
@@ -27,3 +27,6 @@ CONFIG_IMX_WATCHDOG
 	Available for i.mx31/35/5x/6x to service the watchdog. This is not
 	automatically set because some boards (vision2) still need to define
 	their own hw_watchdog_reset routine.
+
+CONFIG_XILINX_TB_WATCHDOG
+	Available for Xilinx Axi platforms to service timebase watchdog timer.
drivers/watchdog/Makefile +1 -0
index b1f4e0f..13e7c37 100644
@@ -32,6 +32,7 @@ COBJS-y += imx_watchdog.o
 endif
 COBJS-$(CONFIG_TNETV107X_WATCHDOG) += tnetv107x_wdt.o
 COBJS-$(CONFIG_S5P)               += s5p_wdt.o
+COBJS-$(CONFIG_XILINX_TB_WATCHDOG) += xilinx_tb_wdt.o
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
drivers/watchdog/xilinx_tb_wdt.c new file +87 -0

87 lines not on this page · raw message

include/configs/microblaze-generic.h +8 -0
index 8c0353a..0c4e719 100644
@@ -120,6 +120,14 @@
 #  define CONFIG_SYS_TIMER_0_IRQ	XILINX_TIMER_IRQ
 #endif
 
+/* watchdog */
+#if defined(XILINX_WATCHDOG_BASEADDR) && defined(XILINX_WATCHDOG_IRQ)
+# define CONFIG_WATCHDOG_BASEADDR	XILINX_WATCHDOG_BASEADDR
+# define CONFIG_WATCHDOG_IRQ		XILINX_WATCHDOG_IRQ
+# define CONFIG_HW_WATCHDOG
+# define CONFIG_XILINX_TB_WATCHDOG
+#endif
+
 /*
  * memory layout - Example
  * CONFIG_SYS_TEXT_BASE = 0x1200_0000;	defined in config.mk

--
1.8.2.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130423/4b4ac696/attachment.pgp>

#6 lore raw

PATCH v2 4/4 watchdog: Add support for Xilinx Microblaze watchdog

Quoted 3 lines · Michal Simek

Watchdog can be used on Microblaze, PPC and Zynq hw designs.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130423/aaf65f97/attachment.pgp>