Skip to contentSkip to conversation

low level initialisation for ar2313

PATCH Applied Oleksij Rempel 3 participants 18 messages Jun 19, 2013 – Jun 23, 2013 MIPS

lore
Share & tools
lore
#0 lore raw

cover low level initialisation for ar2313

this patch set add low level initialisation for Atheros ar2313 and board based on this chip - Netgear wg102.

Antony Pavlov (2):
MIPS: pbl: add mips_barebox_10h asm macro
MIPS: mach-ar231x: enable DEBUG_LL

Oleksij Rempel (6):
MIPS: pbl: add pbl_sleep macro
MIPS: pbl: add pbl_probe_mem macro
MIPS: mach-ar231x: add lowlevel init pbl macros
MIPS: netgear-wg102: add pbl support
MIPS: netgear-wg102: add debug_ll
netgear-wg102: pbl, add extra check for mem config

 arch/mips/Kconfig                                  |   1 +
 .../netgear-wg102/include/board/board_pbl_start.h  |  77 +++++++++
 .../boards/netgear-wg102/include/board/debug_ll.h  |  33 ++++
 arch/mips/include/asm/pbl_macros.h                 |  38 +++++
 arch/mips/mach-ar231x/Kconfig                      |   2 +
 arch/mips/mach-ar231x/include/mach/debug_ll.h      |  27 ++++
 arch/mips/mach-ar231x/include/mach/pbl_macros.h    | 177 +++++++++++++++++++++
 7 files changed, 355 insertions(+)
 create mode 100644 arch/mips/boards/netgear-wg102/include/board/board_pbl_start.h
 create mode 100644 arch/mips/boards/netgear-wg102/include/board/debug_ll.h
 create mode 100644 arch/mips/mach-ar231x/include/mach/debug_ll.h
 create mode 100644 arch/mips/mach-ar231x/include/mach/pbl_macros.h
Signature · 7 lines
1.8.1.2


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

PATCH 8/8 netgear-wg102: pbl, add extra check for mem config

if E0 flag is not set, sdram is defenetly not configured.

---
 arch/mips/boards/netgear-wg102/include/board/board_pbl_start.h | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/mips/boards/netgear-wg102/include/board/board_pbl_start.h +8 -0
index 4deae06..d74d2c2 100644
@@ -18,6 +18,7 @@
 
 #include <asm/pbl_macros.h>
 #include <mach/pbl_macros.h>
+#include <mach/ar2312_regs.h>
 
 #include <mach/debug_ll.h>
 
@@ -40,10 +41,17 @@
 	/* check if SDRAM is already configured,
 	 * if yes, we are probably starting
 	 * as second stage loader and can skip configuration */
+	la	t0, KSEG1 | AR2312_MEM_CFG1
+	lw	t1, 0(t0)
+	and	t0, t1, MEM_CFG1_E0
+	beq	zero, t0, 1f
+	 nop
+
 	pbl_probe_mem t0, t1, KSEG1
 	beq t0, t1, sdram_configured
 	 nop
 
+1:
 	/* start SDRAM configuration */
 	pbl_ar2312_x16_sdram
 
Signature · 7 lines
1.8.1.2


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

PATCH 2/8 MIPS: pbl: add pbl_sleep macro

In reply to Oleksij Rempel
---
 arch/mips/include/asm/pbl_macros.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
arch/mips/include/asm/pbl_macros.h +10 -0
index a3f970c..cfca117 100644
@@ -28,6 +28,16 @@
 #include <generated/compile.h>
 #include <generated/utsrelease.h>
 
+	.macro	pbl_sleep reg count
+	.set push
+	.set noreorder
+	li	\reg, \count
+1:
+	bgtz	\reg, 1b
+	 addi	\reg, -1
+	.set	pop
+	.endm
+
 	/*
 	 * ADR macro instruction (inspired by ARM)
 	 *
Signature · 7 lines
1.8.1.2


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

PATCH 1/8 MIPS: pbl: add mips_barebox_10h asm macro

In reply to Oleksij Rempel

From: Antony Pavlov <[email protected]>

The mips_barebox_10h macro inserts at offset 0x10 of the barebox image the string 'barebox ' followed by compile time version mark.

---
 arch/mips/include/asm/pbl_macros.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
arch/mips/include/asm/pbl_macros.h +16 -0
index 3971b61..a3f970c 100644
@@ -97,6 +97,22 @@ copy_loop_exit:
 	.set	pop
 	.endm
 
+	.macro	mips_barebox_10h
+	.set	push
+	.set	noreorder
+
+	b	1f
+	 nop
+
+	.org	0x10
+	.ascii	"barebox " UTS_RELEASE " " UTS_VERSION
+	.byte	0
+
+	.align	4
+1:
+	.set	pop
+	.endm
+
 	/*
 	 * Dominic Sweetman, See MIPS Run, Morgan Kaufmann, 2nd edition, 2006
 	 *
Signature · 7 lines
1.8.1.2


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

PATCH 3/8 MIPS: pbl: add pbl_probe_mem macro

In reply to Oleksij Rempel
---
 arch/mips/include/asm/pbl_macros.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/mips/include/asm/pbl_macros.h +12 -0
index cfca117..22d41b8 100644
@@ -38,6 +38,18 @@
 	.set	pop
 	.endm
 
+	.macro	pbl_probe_mem ret1 ret2 addr
+	.set	push
+	.set	noreorder
+	la	\ret1, \addr
+	sw	zero, 0(\ret1)
+	li	\ret2, 0x12345678
+	sw	\ret2, 0(\ret1)
+	lw	\ret2, 0(\ret1)
+	li	\ret1, 0x12345678
+	.set	pop
+	.endm
+
 	/*
 	 * ADR macro instruction (inspired by ARM)
 	 *
Signature · 7 lines
1.8.1.2


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

PATCH 5/8 MIPS: netgear-wg102: add pbl support

In reply to Oleksij Rempel
---
 .../netgear-wg102/include/board/board_pbl_start.h  | 69 ++++++++++++++++++++++
 arch/mips/mach-ar231x/Kconfig                      |  2 +
 2 files changed, 71 insertions(+)
 create mode 100644 arch/mips/boards/netgear-wg102/include/board/board_pbl_start.h
arch/mips/boards/netgear-wg102/include/board/board_pbl_start.h new file +69 -0
new file mode 100644
index 0000000..4deae06
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2013 Antony Pavlov <[email protected]>
+ * Copyright (C) 2013 Oleksij Rempel <[email protected]>
+ *
+ * This file is part of barebox.
+ * See file CREDITS for list of people who contributed to this project.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <asm/pbl_macros.h>
+#include <mach/pbl_macros.h>
+
+#include <mach/debug_ll.h>
+
+	.macro	board_pbl_start
+	.set	push
+	.set	noreorder
+
+	mips_barebox_10h
+
+	mips_disable_interrupts
+
+	pbl_ar2312_pll
+
+	pbl_ar2312_rst_uart0
+	debug_ll_ns16550_init
+
+	debug_ll_ns16550_outc 'a'
+	debug_ll_ns16550_outnl
+
+	/* check if SDRAM is already configured,
+	 * if yes, we are probably starting
+	 * as second stage loader and can skip configuration */
+	pbl_probe_mem t0, t1, KSEG1
+	beq t0, t1, sdram_configured
+	 nop
+
+	/* start SDRAM configuration */
+	pbl_ar2312_x16_sdram
+
+	/* check one more time. if some thing wrong,
+	 * we don't need to continue */
+	pbl_probe_mem t0, t1, KSEG1
+	beq t0, t1, sdram_configured
+	 nop
+	debug_ll_ns16550_outc '#'
+	debug_ll_ns16550_outnl
+
+1:
+	b	1b /* dead end */
+	 nop
+
+sdram_configured:
+	debug_ll_ns16550_outc 'b'
+	debug_ll_ns16550_outnl
+
+	copy_to_link_location	pbl_start
+
+	.set	pop
+	.endm
arch/mips/mach-ar231x/Kconfig +2 -0
index 1c6a12f..3f338ea 100644
@@ -9,6 +9,8 @@ choice
 
 config BOARD_NETGEAR_WG102
 	bool "Netgear WG102"
+	select HAVE_PBL_IMAGE
+	select HAVE_IMAGE_COMPRESSION
 
 endchoice
 
Signature · 7 lines
1.8.1.2


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

PATCH 6/8 MIPS: netgear-wg102: add debug_ll

In reply to Oleksij Rempel
---
 .../boards/netgear-wg102/include/board/debug_ll.h  | 33 ++++++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 arch/mips/boards/netgear-wg102/include/board/debug_ll.h
arch/mips/boards/netgear-wg102/include/board/debug_ll.h new file +33 -0
new file mode 100644
index 0000000..2725032
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2013 Oleksij Rempel <[email protected]>
+ *
+ * This file is part of barebox.
+ * See file CREDITS for list of people who contributed to this project.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+/** @file
+ *  This File contains declaration for early output support
+ */
+#ifndef __NETGEAR_WG102_DEBUG_LL_H__
+#define __NETGEAR_WG102_DEBUG_LL_H__
+
+#include <mach/ar2312_regs.h>
+
+#define DEBUG_LL_UART_ADDR	KSEG1ADDR(AR2312_UART0)
+#define DEBUG_LL_UART_SHIFT	AR2312_UART_SHIFT
+
+#define DEBUG_LL_UART_CLK   (45000000 / 16)
+#define DEBUG_LL_UART_BPS   CONFIG_BAUDRATE
+#define DEBUG_LL_UART_DIVISOR   (DEBUG_LL_UART_CLK / DEBUG_LL_UART_BPS)
+
+#endif /* __NETGEAR_WG102_DEBUG_LL_H__ */
Signature · 7 lines
1.8.1.2


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

PATCH 7/8 MIPS: mach-ar231x: enable DEBUG_LL

In reply to Oleksij Rempel

From: Antony Pavlov <[email protected]>

---
 arch/mips/Kconfig                             |  1 +
 arch/mips/mach-ar231x/include/mach/debug_ll.h | 27 +++++++++++++++++++++++++++
 2 files changed, 28 insertions(+)
 create mode 100644 arch/mips/mach-ar231x/include/mach/debug_ll.h
arch/mips/Kconfig +1 -0
index 2e44619..6179fd8 100644
@@ -52,6 +52,7 @@ config MACH_MIPS_AR231X
 	select SYS_SUPPORTS_BIG_ENDIAN
 	select CSRC_R4K_LIB
 	select DRIVER_SERIAL_NS16550
+	select HAS_DEBUG_LL
 
 config MACH_MIPS_BCM47XX
 	bool "Broadcom BCM47xx-based boards"
arch/mips/mach-ar231x/include/mach/debug_ll.h new file +27 -0
new file mode 100644
index 0000000..5ab7f9a
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2013 Antony Pavlov <[email protected]>
+ *
+ * This file is part of barebox.
+ * See file CREDITS for list of people who contributed to this project.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __MACH_AR231X_DEBUG_LL__
+#define __MACH_AR231X_DEBUG_LL__
+
+/** @file
+ *  This File contains declaration for early output support
+ */
+#include <board/debug_ll.h>
+#include <asm/debug_ll_ns16550.h>
+
+#endif /* __MACH_AR231X_DEBUG_LL__ */
Signature · 7 lines
1.8.1.2


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

PATCH 4/8 MIPS: mach-ar231x: add lowlevel init pbl macros

In reply to Oleksij Rempel
---
 arch/mips/mach-ar231x/include/mach/pbl_macros.h | 177 ++++++++++++++++++++++++
 1 file changed, 177 insertions(+)
 create mode 100644 arch/mips/mach-ar231x/include/mach/pbl_macros.h
arch/mips/mach-ar231x/include/mach/pbl_macros.h new file +177 -0
new file mode 100644
index 0000000..cb72dbe
@@ -0,0 +1,177 @@
+#ifndef __ASM_MACH_AR2312_PBL_MACROS_H
+#define __ASM_MACH_AR2312_PBL_MACROS_H
+
+#include <asm/regdef.h>
+#include <mach/ar2312_regs.h>
+
+.macro	pbl_ar2312_pll
+	.set	push
+	.set	noreorder
+
+	mfc0	k0, CP0_STATUS
+	li	k1, ST0_NMI
+	and	k1, k1, k0
+	bnez	k1, pllskip
+	 nop
+
+	/* Clear any prior AHB errors by reading both addr registers */
+	li	t0, KSEG1 | AR2312_PROCADDR
+	lw	zero, 0(t0)
+	li	t0, KSEG1 | AR2312_DMAADDR
+	lw	zero, 0(t0)
+
+	pbl_sleep	t2, 4000
+
+	li	t0, KSEG1 | AR2312_CLOCKCTL2
+	lw	t1, (t0)
+	bgez	t1, pllskip	/* upper bit guaranteed non-0 at reset */
+	 nop
+
+	/* For Viper 0xbc003064 register has to be programmed with 0x91000 to
+	 * get 180Mhz Processor clock
+	 * Set /2 clocking and turn OFF AR2312_CLOCKCTL2_STATUS_PLL_BYPASS.
+	 * Processor RESETs at this point; the CLOCKCTL registers retain
+	 * their new values across the reset.
+	 */
+
+	li	t0, KSEG1 | AR2312_CLOCKCTL1
+	li	t1, AR2313_CLOCKCTL1_SELECTION
+	sw	t1, (t0)
+
+	li	t0, KSEG1 | AR2312_CLOCKCTL2
+	li	t1, AR2312_CLOCKCTL2_WANT_RESET
+	sw	t1, (t0)	/* reset CPU */
+1:	b	1b		/* NOTREACHED */
+	 nop
+pllskip:
+
+	.set	pop
+.endm
+
+.macro	pbl_ar2312_rst_uart0
+	.set	push
+	.set	noreorder
+
+	li	a0, KSEG1 | AR2312_RESET
+	lw	t0, 0(a0)
+	and	t0, ~AR2312_RESET_APB
+	or	t0, AR2312_RESET_UART0
+	sw	t0, 0(a0)
+	lw	zero, 0(a0)	/* flush */
+
+	and	t0, ~AR2312_RESET_UART0
+	sw	t0, 0(a0)
+	lw	zero, 0(a0)	/* flush */
+
+1:	/* Use internal clocking */
+	li	a0, KSEG1 | AR2312_CLOCKCTL0
+	lw	t0, 0(a0)
+	and	t0, ~AR2312_CLOCKCTL_UART0
+	sw	t0, 0(a0)
+
+	.set	pop
+.endm
+
+.macro	pbl_ar2312_x16_sdram
+	.set	push
+	.set	noreorder
+
+	li	a0, KSEG1 | AR2312_MEM_CFG0
+	li	a1, KSEG1 | AR2312_MEM_CFG1
+	li	a2, KSEG1 | AR2312_MEM_REF
+
+	li	a3, MEM_CFG1_E0 | (MEM_CFG1_AC_128 << MEM_CFG1_AC0_S)
+
+	/* Set the I and M bits to issue an SDRAM nop */
+	ori	t0, a3, MEM_CFG1_M | MEM_CFG1_I
+	sw	t0, 0(a1)	/* AR2312_MEM_CFG1 */
+
+	pbl_sleep	t2, 50
+
+	/* Reset the M bit to issue an SDRAM PRE-ALL */
+	ori	t0, a3, MEM_CFG1_I
+	sw	t0, 0(a1)	/* AR2312_MEM_CFG1 */
+	sync
+
+	/* Generate a refresh every 16 clocks (spec says 10) */
+	li	t0, 16		/* very fast refresh for now */
+	sw	t0, 0(a2)	/* AR2312_MEM_REF */
+
+	pbl_sleep	t2, 5
+
+	/* Set command write mode, and read SDRAM */
+	ori	t0, a3, MEM_CFG1_M
+	sw	t0, 0(a1)	/* AR2312_MEM_CFG1 */
+	sync
+
+	li	t0, KSEG1 | AR2312_SDRAM0
+	or	t0, 0x23000	/* 16bit burst */
+	lw	zero, 0(t0)
+
+	/* Program configuration register */
+	li	t0, MEM_CFG0_C | MEM_CFG0_C2 | MEM_CFG0_R1 | \
+			MEM_CFG0_B0 | MEM_CFG0_X
+	sw	t0, 0(a0)	/* AR2312_MEM_CFG0 */
+	sync
+
+	li	t0, AR2312_SDRAM_MEMORY_REFRESH_VALUE
+	sw	t0, 0(a2)	/* AR2312_MEM_REF */
+	sync
+
+	/* Clear I and M and set cfg1 to the normal operational value */
+	sw	a3, 0(a1)	/* AR2312_MEM_CFG1 */
+	sync
+
+	pbl_sleep	t2, 10
+
+	/* Now we need to set size of RAM to prevent some wired errors.
+	 * Since I do not have access to any board with two SDRAM chips, or
+	 * any was registered in the wild - we will support only one. */
+	/* So, lets find the beef */
+	li	a0, KSEG1 | AR2312_MEM_CFG1
+	li	a1, KSEG1 | AR2312_SDRAM0
+	li	a2, 0xdeadbeef
+	li	t0, 0x200000
+	li	t1, MEM_CFG1_AC_2
+
+	/* We will write some magic word to the beginning of RAM,
+	 * and see if it appears somewhere else. If yes, we made
+	 * a travel around the world. */
+
+	/* But first of all save original state of the first RAM word. */
+	lw	a3, 0(a1)
+	sw	a2, 0(a1)
+
+find_the_beef:
+	or	t2, a1, t0
+	lw	t3, 0(t2)
+	beq	a2, t3, 1f
+	 nop
+	sll	t0, 1
+	add	t1, 1
+	/* we should have some limit here. */
+	blt	t1, MEM_CFG1_AC_64, find_the_beef
+	 nop
+	b	make_beefsteak
+	 nop
+
+	/* additional paranoid check */
+1:
+	sw	zero, 0(a1)
+	lw	t3, 0(t2)
+	bne	zero, t3, find_the_beef
+	 nop
+
+make_beefsteak:
+	/* create new config for AR2312_MEM_CFG1 and overwrite it */
+	sll	t1, MEM_CFG1_AC0_S
+	or	t2, t1, MEM_CFG1_E0
+	sw	t2, 0(a0)	/* AR2312_MEM_CFG1 */
+
+	/* restore original state of the first RAM word */
+	sw	a3, 0(a1)
+
+	.set	pop
+.endm
+
+#endif /* __ASM_MACH_AR2312_PBL_MACROS_H */
Signature · 7 lines
1.8.1.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#10 lore raw
In reply to Oleksij Rempel

Hi Oleksij, Antony,

I'm fine with this series. Antony, do you have comments?

Sascha

Quoted 37 lines · Oleksij Rempel

this patch set add low level initialisation for Atheros ar2313 and board based on this chip - Netgear wg102.

Antony Pavlov (2):
MIPS: pbl: add mips_barebox_10h asm macro
MIPS: mach-ar231x: enable DEBUG_LL

Oleksij Rempel (6):
MIPS: pbl: add pbl_sleep macro
MIPS: pbl: add pbl_probe_mem macro
MIPS: mach-ar231x: add lowlevel init pbl macros
MIPS: netgear-wg102: add pbl support
MIPS: netgear-wg102: add debug_ll
netgear-wg102: pbl, add extra check for mem config

 arch/mips/Kconfig                                  |   1 +
 .../netgear-wg102/include/board/board_pbl_start.h  |  77 +++++++++
 .../boards/netgear-wg102/include/board/debug_ll.h  |  33 ++++
 arch/mips/include/asm/pbl_macros.h                 |  38 +++++
 arch/mips/mach-ar231x/Kconfig                      |   2 +
 arch/mips/mach-ar231x/include/mach/debug_ll.h      |  27 ++++
 arch/mips/mach-ar231x/include/mach/pbl_macros.h    | 177 +++++++++++++++++++++
 7 files changed, 355 insertions(+)
 create mode 100644 arch/mips/boards/netgear-wg102/include/board/board_pbl_start.h
 create mode 100644 arch/mips/boards/netgear-wg102/include/board/debug_ll.h
 create mode 100644 arch/mips/mach-ar231x/include/mach/debug_ll.h
 create mode 100644 arch/mips/mach-ar231x/include/mach/pbl_macros.h
Signature · 7 lines
1.8.1.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#11 lore raw
Quoted 3 lines · On Fri, 21 Jun 2013 07:30:17 +0200 Sascha Hauer <[email protected]> wrote:

Hi Oleksij, Antony,

I'm fine with this series. Antony, do you have comments?

The series looks good!

But in the last minute I made a small fix for the "MIPS: pbl: add pbl_sleep macro" patch.

It's a shame, but generated label inside assembly macros are not "local" (at least I have not found how to make them local in my toolchain).

As the user of the pbl_sleep can use generated label "1" (this label already used in pbl_sleep), there can be some painful side effects, e.g.

1: // user's generated label

... // some user code

pbl_sleep t1 100

... // another user code

b 1b // jump to the back label "1"

Inside the pbl_sleep macro we have one more "1" label, so the jump instruction of the example transfer control not to the user's label "1" but to label "1" inside pbl_sleep.

So I propose a ad-hoc solution.

arch/mips/include/asm/pbl_macros.h +2 -2
@@ -32,8 +32,8 @@
        .set push
        .set noreorder
        li      \reg, \count
-1:
-       bgtz    \reg, 1b
+254:
+       bgtz    \reg, 254b
         addi   \reg, -1
        .set    pop
        .endm

The programmers are lazy (at least many of them), they like short names "1", "2"
and "254" is very long name, so the conflict is not expected.
To prevent conflicts like this we can make a convention "don't use generated labels 200-255 in you assembler pbl code".

Is there a need for series/patch reposting for fixing the issue?

Quoted 44 lines · Oleksij Rempel
Quoted 37 lines

this patch set add low level initialisation for Atheros ar2313 and board based on this chip - Netgear wg102.

Antony Pavlov (2):
MIPS: pbl: add mips_barebox_10h asm macro
MIPS: mach-ar231x: enable DEBUG_LL

Oleksij Rempel (6):
MIPS: pbl: add pbl_sleep macro
MIPS: pbl: add pbl_probe_mem macro
MIPS: mach-ar231x: add lowlevel init pbl macros
MIPS: netgear-wg102: add pbl support
MIPS: netgear-wg102: add debug_ll
netgear-wg102: pbl, add extra check for mem config

 arch/mips/Kconfig                                  |   1 +
 .../netgear-wg102/include/board/board_pbl_start.h  |  77 +++++++++
 .../boards/netgear-wg102/include/board/debug_ll.h  |  33 ++++
 arch/mips/include/asm/pbl_macros.h                 |  38 +++++
 arch/mips/mach-ar231x/Kconfig                      |   2 +
 arch/mips/mach-ar231x/include/mach/debug_ll.h      |  27 ++++
 arch/mips/mach-ar231x/include/mach/pbl_macros.h    | 177 +++++++++++++++++++++
 7 files changed, 355 insertions(+)
 create mode 100644 arch/mips/boards/netgear-wg102/include/board/board_pbl_start.h
 create mode 100644 arch/mips/boards/netgear-wg102/include/board/debug_ll.h
 create mode 100644 arch/mips/mach-ar231x/include/mach/debug_ll.h
 create mode 100644 arch/mips/mach-ar231x/include/mach/pbl_macros.h
Signature · 7 lines
1.8.1.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
Signature · 8 lines
-- 
Best regards,
  Antony Pavlov

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

PATCH v2 2/8 MIPS: pbl: add pbl_sleep macro

In reply to Oleksij Rempel
---
 arch/mips/include/asm/pbl_macros.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
arch/mips/include/asm/pbl_macros.h +10 -0
index a3f970c..fde9434 100644
@@ -28,6 +28,16 @@
 #include <generated/compile.h>
 #include <generated/utsrelease.h>
 
+	.macro	pbl_sleep reg count
+	.set push
+	.set noreorder
+	li	\reg, \count
+254:
+	bgtz	\reg, 254b
+	 addi	\reg, -1
+	.set	pop
+	.endm
+
 	/*
 	 * ADR macro instruction (inspired by ARM)
 	 *
Signature · 7 lines
1.8.1.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#12 lore raw
In reply to [email protected]
Quoted 34 lines · On Fri, Jun 21, 2013 at 10:25:25AM +0400, [email protected] wrote:
Quoted 3 lines · On Fri, 21 Jun 2013 07:30:17 +0200 Sascha Hauer <[email protected]> wrote:

Hi Oleksij, Antony,

I'm fine with this series. Antony, do you have comments?

The series looks good!

But in the last minute I made a small fix for the "MIPS: pbl: add pbl_sleep macro" patch.

It's a shame, but generated label inside assembly macros are not "local" (at least I have not found how to make them local in my toolchain).

As the user of the pbl_sleep can use generated label "1" (this label already used in pbl_sleep), there can be some painful side effects, e.g.

1: // user's generated label

... // some user code

pbl_sleep t1 100

... // another user code

b 1b // jump to the back label "1"

Inside the pbl_sleep macro we have one more "1" label, so the jump instruction of the example transfer control not to the user's label "1" but to label "1" inside pbl_sleep.

So I propose a ad-hoc solution.

arch/mips/include/asm/pbl_macros.h line 39

Quoted 10 lines
arch/mips/include/asm/pbl_macros.h +2 -2
@@ -32,8 +32,8 @@
        .set push
        .set noreorder
        li      \reg, \count
-1:
-       bgtz    \reg, 1b
+254:
+       bgtz    \reg, 254b
         addi   \reg, -1
        .set    pop
        .endm

Yeah, I noticed the same problem some time ago and came up with the same solution. I'm not aware of a better way to do this.

Quoted 6 lines

The programmers are lazy (at least many of them), they like short names "1", "2"
and "254" is very long name, so the conflict is not expected.
To prevent conflicts like this we can make a convention "don't use generated labels 200-255 in you assembler pbl code".

Is there a need for series/patch reposting for fixing the issue?

Yes, please post what you want me to apply on -next.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#13 lore raw
Quoted 50 lines · On Fri, 21 Jun 2013 09:23:19 +0200 Sascha Hauer <[email protected]> wrote:
Quoted 34 lines · On Fri, Jun 21, 2013 at 10:25:25AM +0400, [email protected] wrote:
Quoted 3 lines · On Fri, 21 Jun 2013 07:30:17 +0200 Sascha Hauer <[email protected]> wrote:

Hi Oleksij, Antony,

I'm fine with this series. Antony, do you have comments?

The series looks good!

But in the last minute I made a small fix for the "MIPS: pbl: add pbl_sleep macro" patch.

It's a shame, but generated label inside assembly macros are not "local" (at least I have not found how to make them local in my toolchain).

As the user of the pbl_sleep can use generated label "1" (this label already used in pbl_sleep), there can be some painful side effects, e.g.

1: // user's generated label

... // some user code

pbl_sleep t1 100

... // another user code

b 1b // jump to the back label "1"

Inside the pbl_sleep macro we have one more "1" label, so the jump instruction of the example transfer control not to the user's label "1" but to label "1" inside pbl_sleep.

So I propose a ad-hoc solution.

arch/mips/include/asm/pbl_macros.h line 39

Quoted 10 lines
arch/mips/include/asm/pbl_macros.h +2 -2
@@ -32,8 +32,8 @@
        .set push
        .set noreorder
        li      \reg, \count
-1:
-       bgtz    \reg, 1b
+254:
+       bgtz    \reg, 254b
         addi   \reg, -1
        .set    pop
        .endm

Yeah, I noticed the same problem some time ago and came up with the same solution. I'm not aware of a better way to do this.

Quoted 1 line
Quoted 7 lines
Quoted 5 lines

The programmers are lazy (at least many of them), they like short names "1", "2"
and "254" is very long name, so the conflict is not expected.
To prevent conflicts like this we can make a convention "don't use generated labels 200-255 in you assembler pbl code".

Is there a need for series/patch reposting for fixing the issue?

Yes, please post what you want me to apply on -next.

Oleksij have reposted the fixed patch: "[PATCH 2/8 v2] MIPS: pbl: add pbl_sleep macro"

Quoted 8 lines

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
Signature · 8 lines
-- 
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Applied
#14 lore raw
In reply to Oleksij Rempel
Quoted 7 lines · Oleksij Rempel

this patch set add low level initialisation for Atheros ar2313 and board based on this chip - Netgear wg102.

Antony Pavlov (2):
MIPS: pbl: add mips_barebox_10h asm macro
MIPS: mach-ar231x: enable DEBUG_LL

Quoted 7 lines

Oleksij Rempel (6):
MIPS: pbl: add pbl_sleep macro
MIPS: pbl: add pbl_probe_mem macro
MIPS: mach-ar231x: add lowlevel init pbl macros
MIPS: netgear-wg102: add pbl support
MIPS: netgear-wg102: add debug_ll
netgear-wg102: pbl, add extra check for mem config

Applied, thanks

Sascha

Quoted 23 lines
 arch/mips/Kconfig                                  |   1 +
 .../netgear-wg102/include/board/board_pbl_start.h  |  77 +++++++++
 .../boards/netgear-wg102/include/board/debug_ll.h  |  33 ++++
 arch/mips/include/asm/pbl_macros.h                 |  38 +++++
 arch/mips/mach-ar231x/Kconfig                      |   2 +
 arch/mips/mach-ar231x/include/mach/debug_ll.h      |  27 ++++
 arch/mips/mach-ar231x/include/mach/pbl_macros.h    | 177 +++++++++++++++++++++
 7 files changed, 355 insertions(+)
 create mode 100644 arch/mips/boards/netgear-wg102/include/board/board_pbl_start.h
 create mode 100644 arch/mips/boards/netgear-wg102/include/board/debug_ll.h
 create mode 100644 arch/mips/mach-ar231x/include/mach/debug_ll.h
 create mode 100644 arch/mips/mach-ar231x/include/mach/pbl_macros.h
Signature · 7 lines
1.8.1.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

On Fri, 21 Jun 2013 17:48:40 +0200
Sascha Hauer <[email protected]> wrote:

Well done, Oleksij! Congratulations!

Thanks, Sascha!

Now we have in the next branch THE FIRST PUBLICLY AVAILABLE FULLY SUPPORTED "HARDWARE" MIPS-based BOARD!

Quoted 54 lines · Oleksij Rempel
Quoted 7 lines

this patch set add low level initialisation for Atheros ar2313 and board based on this chip - Netgear wg102.

Antony Pavlov (2):
MIPS: pbl: add mips_barebox_10h asm macro
MIPS: mach-ar231x: enable DEBUG_LL

Quoted 7 lines

Oleksij Rempel (6):
MIPS: pbl: add pbl_sleep macro
MIPS: pbl: add pbl_probe_mem macro
MIPS: mach-ar231x: add lowlevel init pbl macros
MIPS: netgear-wg102: add pbl support
MIPS: netgear-wg102: add debug_ll
netgear-wg102: pbl, add extra check for mem config

Applied, thanks

Sascha

Quoted 23 lines
 arch/mips/Kconfig                                  |   1 +
 .../netgear-wg102/include/board/board_pbl_start.h  |  77 +++++++++
 .../boards/netgear-wg102/include/board/debug_ll.h  |  33 ++++
 arch/mips/include/asm/pbl_macros.h                 |  38 +++++
 arch/mips/mach-ar231x/Kconfig                      |   2 +
 arch/mips/mach-ar231x/include/mach/debug_ll.h      |  27 ++++
 arch/mips/mach-ar231x/include/mach/pbl_macros.h    | 177 +++++++++++++++++++++
 7 files changed, 355 insertions(+)
 create mode 100644 arch/mips/boards/netgear-wg102/include/board/board_pbl_start.h
 create mode 100644 arch/mips/boards/netgear-wg102/include/board/debug_ll.h
 create mode 100644 arch/mips/mach-ar231x/include/mach/debug_ll.h
 create mode 100644 arch/mips/mach-ar231x/include/mach/pbl_macros.h
Signature · 7 lines
1.8.1.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 8 lines
-- 
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#16 lore raw
Quoted 8 lines · On Fri, Jun 21, 2013 at 08:37:45PM +0400, [email protected] wrote:

On Fri, 21 Jun 2013 17:48:40 +0200
Sascha Hauer <[email protected]> wrote:

Well done, Oleksij! Congratulations!

Thanks, Sascha!

Now we have in the next branch THE FIRST PUBLICLY AVAILABLE FULLY SUPPORTED "HARDWARE" MIPS-based BOARD!

Hurray \o/

What about the dlink 320? Does it only work 2nd stage?

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#17 lore raw
Quoted 6 lines · On Sun, 23 Jun 2013 20:42:17 +0200 Sascha Hauer <[email protected]> wrote:
Quoted 5 lines · On Fri, Jun 21, 2013 at 08:37:45PM +0400, [email protected] wrote:

On Fri, 21 Jun 2013 17:48:40 +0200
Sascha Hauer <[email protected]> wrote:

Well done, Oleksij! Congratulations!

Quoted 7 lines
Quoted 3 lines

Thanks, Sascha!

Now we have in the next branch THE FIRST PUBLICLY AVAILABLE FULLY SUPPORTED "HARDWARE" MIPS-based BOARD!

Hurray \o/

What about the dlink 320? Does it only work 2nd stage?

Alas it works only 2nd stage.

I have a Ingenic JZ4770-based tablet with barebox only firmware. I made the 1st stage loader as a very very dirty hack, but it works! It is time to clean it...

Quoted 7 lines

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
Signature · 8 lines
-- 
Best regards,
  Antony Pavlov

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