From: Oleksij Rempel <linux@rempel-privat.de>
To: barebox@lists.infradead.org
Cc: Oleksij Rempel <linux@rempel-privat.de>
Subject: [PATCH v1 2/4] MIPS: ath79: ar9331: add generic RAM macro
Date: Sat, 9 Dec 2017 10:59:36 +0100 [thread overview]
Message-ID: <20171209095938.30160-2-linux@rempel-privat.de> (raw)
In-Reply-To: <20171209095938.30160-1-linux@rempel-privat.de>
with this macro, we should be able to cover most of existing
ar9331 based boards.
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
---
arch/mips/mach-ath79/include/mach/ar71xx_regs.h | 1 +
arch/mips/mach-ath79/include/mach/pbl_macros.h | 37 +++++++++++++++++++++++--
2 files changed, 35 insertions(+), 3 deletions(-)
diff --git a/arch/mips/mach-ath79/include/mach/ar71xx_regs.h b/arch/mips/mach-ath79/include/mach/ar71xx_regs.h
index 31d33b3c4..f73700b5b 100644
--- a/arch/mips/mach-ath79/include/mach/ar71xx_regs.h
+++ b/arch/mips/mach-ath79/include/mach/ar71xx_regs.h
@@ -139,6 +139,7 @@
#define AR71XX_RESET_FULL_CHIP BIT(24)
+#define AR933X_BOOTSTRAP_MEM_TYPE BIT(13)
#define AR933X_BOOTSTRAP_REF_CLK_40 BIT(0)
#endif /* __ASM_MACH_AR71XX_REGS_H */
diff --git a/arch/mips/mach-ath79/include/mach/pbl_macros.h b/arch/mips/mach-ath79/include/mach/pbl_macros.h
index 680fcbb86..9e4859b19 100644
--- a/arch/mips/mach-ath79/include/mach/pbl_macros.h
+++ b/arch/mips/mach-ath79/include/mach/pbl_macros.h
@@ -172,6 +172,40 @@
.set pop
.endm
+#define RESET_REG_BOOTSTRAP ((KSEG1 | AR71XX_RESET_BASE) \
+ | AR933X_RESET_REG_BOOTSTRAP)
+
+.macro pbl_ar9331_ram_generic_config
+ .set push
+ .set noreorder
+
+ li t5, RESET_REG_BOOTSTRAP
+ /* Documentation and source code of existing boot loaders disagree at
+ * this place. Doc says: MEM_TYPE[13:12]:
+ * - 00 = SDRAM
+ * - 01 = DDR1
+ * - 10 = DDR2
+ * The source code of most loaders do not care about BIT(12). So we do
+ * the same.
+ */
+ li t6, AR933X_BOOTSTRAP_MEM_TYPE
+ lw t7, 0(t5);
+ and t6, t7, t6
+ beq zero, t6, pbl_ar9331_ram_generic_ddr1
+ nop
+
+pbl_ar9331_ram_generic_ddr2:
+ pbl_ar9331_ddr2_config
+ b pbl_ar9331_ram_generic_config
+ nop
+
+pbl_ar9331_ram_generic_ddr1:
+ pbl_ar9331_ddr1_config
+
+pbl_ar9331_ram_generic_config:
+ .set pop
+.endm
+
#define GPIO_FUNC ((KSEG1 | AR71XX_GPIO_BASE) | AR71XX_GPIO_REG_FUNC)
.macro pbl_ar9331_uart_enable
@@ -179,9 +213,6 @@
| AR933X_GPIO_FUNC_RSRV15, GPIO_FUNC
.endm
-#define RESET_REG_BOOTSTRAP ((KSEG1 | AR71XX_RESET_BASE) \
- | AR933X_RESET_REG_BOOTSTRAP)
-
.macro pbl_ar9331_mdio_gpio_enable
/* Bit 18 enables MDC and MDIO function on GPIO26 and GPIO28 */
pbl_reg_set (1 << 18), RESET_REG_BOOTSTRAP
--
2.14.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2017-12-09 10:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-09 9:59 [PATCH v1 1/4] MIPS: ar9331: add watchdog support Oleksij Rempel
2017-12-09 9:59 ` Oleksij Rempel [this message]
2017-12-09 9:59 ` [PATCH v1 3/4] MIPS: ath79: ar9331: add ar9331_pbl_generic_start macro Oleksij Rempel
2017-12-09 9:59 ` [PATCH v1 4/4] MIPS: add support for DPTechnics DPT-Module v1 Oleksij Rempel
2017-12-09 16:54 ` Antony Pavlov
2017-12-11 5:53 ` Oleksij Rempel
2017-12-12 6:50 ` Sascha Hauer
2017-12-12 7:00 ` Oleksij Rempel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171209095938.30160-2-linux@rempel-privat.de \
--to=linux@rempel-privat.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox