Skip to contentSkip to conversation

AT91: Rom boot prepare

PATCH New Jean-Christophe PLAGNIOL-VILLARD 1 participant 4 messages Aug 3, 2012

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

cover AT91: Rom boot prepare

Hi,

This patch serie prepare the support of Rom boot

The following changes since commit 6efca01b82a59f32b016f9cfd46b12e8e632ee92:

eukrea_cpuimx35: fix USB host (2012-08-02 11:01:18 +0200)

are available in the git repository at:

git://git.jcrosoft.org/barebox.git master

for you to fetch changes up to bfefad599289a98656013d9d9ce753fbb484f071:

arm: at91: add custom barebox-arm-head (2012-08-03 13:36:41 +0800)

----------------------------------------------------------------
Jean-Christophe PLAGNIOL-VILLARD (3):
arm: at91: add debug_ll support
arm introduce CONFIG_MACH_ARM_HEAD option to allow custom head
arm: at91: add custom barebox-arm-head

 arch/arm/Kconfig                                   |    5 +++++
 arch/arm/include/asm/barebox-arm-head.h            |    4 ++++
 arch/arm/mach-at91/include/mach/barebox-arm-head.h |   33 +++++++++++++++++++++++++++++++++
 arch/arm/mach-at91/include/mach/debug_ll.h         |   37 +++++++++++++++++++++++++++++++++++++
 4 files changed, 79 insertions(+)
 create mode 100644 arch/arm/mach-at91/include/mach/barebox-arm-head.h
 create mode 100644 arch/arm/mach-at91/include/mach/debug_ll.h

Best Regards,
J.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#1 lore raw

PATCH 1/3 arm: at91: add debug_ll support

Today we only use the DBGU port

---
 arch/arm/Kconfig                           |    1 +
 arch/arm/mach-at91/include/mach/debug_ll.h |   37 ++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+)
 create mode 100644 arch/arm/mach-at91/include/mach/debug_ll.h
arch/arm/Kconfig +1 -0
index 08c742b..8665c16 100644
@@ -23,6 +23,7 @@ config ARCH_AT91
 	bool "Atmel AT91"
 	select GENERIC_GPIO
 	select CLKDEV_LOOKUP
+	select HAS_DEBUG_LL
 
 config ARCH_EP93XX
 	bool "Cirrus Logic EP93xx"
arch/arm/mach-at91/include/mach/debug_ll.h new file +37 -0
new file mode 100644
index 0000000..ee824cb
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2012
+ * Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
+ *
+ * Under GPLv2
+ */
+
+#ifndef __MACH_DEBUG_LL_H__
+#define __MACH_DEBUG_LL_H__
+
+#include <asm/io.h>
+#include <mach/hardware.h>
+
+#define UART_BASE	(AT91_BASE_SYS + AT91_DBGU)
+
+#define ATMEL_US_CSR		0x0014
+#define ATMEL_US_THR		0x001c
+#define ATMEL_US_TXRDY		(1 << 1)
+#define ATMEL_US_TXEMPTY	(1 << 9)
+
+/*
+ * The following code assumes the serial port has already been
+ * initialized by the bootloader.  If you didn't setup a port in
+ * your bootloader then nothing will appear (which might be desired).
+ *
+ * This does not append a newline
+ */
+static void putc(int c)
+{
+	while (!(__raw_readl(UART_BASE + ATMEL_US_CSR) & ATMEL_US_TXRDY))
+		barrier();
+	__raw_writel(c, UART_BASE + ATMEL_US_THR);
+
+	while (!(__raw_readl(UART_BASE + ATMEL_US_CSR) & ATMEL_US_TXEMPTY))
+		barrier();
+}
+#endif
Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

PATCH 2/3 arm introduce CONFIG_MACH_ARM_HEAD option to allow custom head

This is needed by at91 to specify the size of the binary to load from the bootrom when booting for non nor flash.

---
 arch/arm/Kconfig                        |    3 +++
 arch/arm/include/asm/barebox-arm-head.h |    4 ++++
 2 files changed, 7 insertions(+)
arch/arm/Kconfig +3 -0
index 8665c16..8b0a28d 100644
@@ -14,6 +14,9 @@ config ARM_LINUX
 	default y
 	depends on CMD_BOOTZ || CMD_BOOTU || CMD_BOOTM
 
+config HAVE_MACH_ARM_HEAD
+	bool
+
 menu "System Type                   "
 
 choice
arch/arm/include/asm/barebox-arm-head.h +4 -0
index 2c250e9..0b1d786 100644
@@ -1,6 +1,9 @@
 #ifndef __ASM_ARM_HEAD_H
 #define __ASM_ARM_HEAD_H
 
+#ifdef CONFIG_HAVE_MACH_ARM_HEAD
+#include <mach/barebox-arm-head.h>
+#else
 static inline void barebox_arm_head(void)
 {
 	__asm__ __volatile__ (
@@ -31,5 +34,6 @@ static inline void barebox_arm_head(void)
 		".word _barebox_image_size\n"		/* image size to copy */
 	);
 }
+#endif
 
 #endif /* __ASM_ARM_HEAD_H */
Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw

PATCH 3/3 arm: at91: add custom barebox-arm-head

In reply to Jean-Christophe PLAGNIOL-VILLARD

On at91 we need to put the size to load is the sram at the 6th exception vector

---
 arch/arm/Kconfig                                   |    1 +
 arch/arm/mach-at91/include/mach/barebox-arm-head.h |   33 ++++++++++++++++++++
 2 files changed, 34 insertions(+)
 create mode 100644 arch/arm/mach-at91/include/mach/barebox-arm-head.h
arch/arm/Kconfig +1 -0
index 8b0a28d..ce32efb 100644
@@ -27,6 +27,7 @@ config ARCH_AT91
 	select GENERIC_GPIO
 	select CLKDEV_LOOKUP
 	select HAS_DEBUG_LL
+	select HAVE_MACH_ARM_HEAD
 
 config ARCH_EP93XX
 	bool "Cirrus Logic EP93xx"
arch/arm/mach-at91/include/mach/barebox-arm-head.h new file +33 -0
new file mode 100644
index 0000000..a9c8dd4
@@ -0,0 +1,33 @@
+#ifndef __MACH_ARM_HEAD_H
+#define __MACH_ARM_HEAD_H
+
+#ifdef CONFIG_SHELL_NONE
+#define AT91_EXV6	".word _barebox_image_size\n"
+#else
+#define AT91_EXV6	".word _barebox_bare_init_size\n"
+#endif
+
+static inline void barebox_arm_head(void)
+{
+	__asm__ __volatile__ (
+#ifdef CONFIG_THUMB2_BAREBOX
+#error Thumb2 is not supported
+#else
+		"b reset\n"
+		"1: b 1b\n"
+		"1: b 1b\n"
+		"1: b 1b\n"
+		"1: b 1b\n"
+		AT91_EXV6				/* image size to load by the bootrom */
+		"1: b 1b\n"
+		"1: b 1b\n"
+#endif
+		".asciz \"barebox\"\n"
+		".word _text\n"				/* text base. If copied there,
+							 * barebox can skip relocation
+							 */
+		".word _barebox_image_size\n"		/* image size to copy */
+	);
+}
+
+#endif /* __ASM_ARM_HEAD_H */
Signature · 7 lines
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox