Skip to contentSkip to conversation

add support for DPTechnics DPT-Module v1

PATCH Applied Oleksij Rempel 2 participants 7 messages Dec 12, 2017 – Dec 15, 2017

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

v2 cover add support for DPTechnics DPT-Module v1

changes v2:
- remove dummy board code.
- provide HAS_NO_BOARD_HL_CODE option

Oleksij Rempel (5):
MIPS: provide HAS_NO_BOARD_HL_CODE
MIPS: ar9331: add watchdog support
MIPS: ath79: ar9331: add generic RAM macro
MIPS: ath79: ar9331: add ar9331_pbl_generic_start macro
MIPS: add support for DPTechnics DPT-Module v1

 arch/mips/Kconfig                                  |  3 +
 arch/mips/Makefile                                 |  7 +-
 .../include/board/board_pbl_start.h                | 20 +++++
 arch/mips/configs/dptechnics-dpt-module_defconfig  | 89 ++++++++++++++++++++++
 arch/mips/dts/ar9331-dptechnics-dpt-module.dts     | 31 ++++++++
 arch/mips/dts/ar9331.dtsi                          |  6 ++
 arch/mips/mach-ath79/Kconfig                       |  8 ++
 arch/mips/mach-ath79/include/mach/ar71xx_regs.h    |  1 +
 arch/mips/mach-ath79/include/mach/pbl_macros.h     | 72 ++++++++++++++++-
 drivers/watchdog/Kconfig                           |  2 +-
 10 files changed, 234 insertions(+), 5 deletions(-)
 create mode 100644 arch/mips/boards/dptechnics-dpt-module/include/board/board_pbl_start.h
 create mode 100644 arch/mips/configs/dptechnics-dpt-module_defconfig
 create mode 100644 arch/mips/dts/ar9331-dptechnics-dpt-module.dts
Signature · 7 lines
2.14.1


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

PATCH v2 1/5 MIPS: provide HAS_NO_BOARD_HL_CODE

some boards have PBL code, but no board specific
high level code.
Instead of creating dummy.c files, better provide
config to avoid compiling of board code.

---
 arch/mips/Kconfig  | 3 +++
 arch/mips/Makefile | 6 +++++-
 2 files changed, 8 insertions(+), 1 deletion(-)
arch/mips/Kconfig +3 -0
index 06a516d70..c2c555dc3 100644
@@ -22,6 +22,9 @@ config GENERIC_LINKER_SCRIPT
 	bool
 	default y
 
+config HAS_NO_BOARD_HL_CODE
+	bool
+
 menu "Machine selection"
 
 config BUILTIN_DTB
arch/mips/Makefile +5 -1
index dd5ceea20..ecc91111b 100644
@@ -124,7 +124,11 @@ else
 MACH  :=
 endif
 
-common-y += $(BOARD) $(MACH)
+ifndef CONFIG_HAS_NO_BOARD_HL_CODE
+common-y += $(BOARD)
+endif
+
+common-y += $(MACH)
 common-y += arch/mips/lib/
 common-y += arch/mips/boot/
 
Signature · 7 lines
2.14.1


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

PATCH v2 2/5 MIPS: ar9331: add watchdog support

In reply to Oleksij Rempel
---
 arch/mips/dts/ar9331.dtsi | 6 ++++++
 drivers/watchdog/Kconfig  | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)
arch/mips/dts/ar9331.dtsi +6 -0
index b4b8b766b..42baae1e8 100644
@@ -1,5 +1,11 @@
 / {
 	ahb {
+		wdt0: wdt@18060008 {
+			compatible = "qca,ar9331-wdt", "qca,ar9344-wdt";
+			reg = <0x18060008 0x8>;
+			clocks = <&pll ATH79_CLK_CPU>;
+		};
+
 		mac0: mac@19000000 {
 			compatible = "qca,ar9331-ge0";
 			reg = <0x18070000 0x00000100>,
drivers/watchdog/Kconfig +1 -1
index 1f04c7fba..a8f9492ac 100644
@@ -12,7 +12,7 @@ if WATCHDOG
 
 config WATCHDOG_AR9344
 	bool "QCA AR9344"
-	depends on SOC_QCA_AR9344
+	depends on SOC_QCA_AR9344 || SOC_QCA_AR9331
 	help
 	  Add support for watchdog on the QCA AR9344 SoC.
 
Signature · 7 lines
2.14.1


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

PATCH v2 3/5 MIPS: ath79: ar9331: add generic RAM macro

In reply to Oleksij Rempel

with this macro, we should be able to cover most of existing ar9331 based boards.

---
 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(-)
arch/mips/mach-ath79/include/mach/ar71xx_regs.h +1 -0
index 31d33b3c4..f73700b5b 100644
@@ -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 */
arch/mips/mach-ath79/include/mach/pbl_macros.h +34 -3
index 680fcbb86..9e4859b19 100644
@@ -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
Signature · 7 lines
2.14.1


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

PATCH v2 4/5 MIPS: ath79: ar9331: add ar9331_pbl_generic_start macro

In reply to Oleksij Rempel

Most of ar9331 boards have identical PBL. So we can sync the code to single macro.

---
 arch/mips/mach-ath79/include/mach/pbl_macros.h | 35 ++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
arch/mips/mach-ath79/include/mach/pbl_macros.h +35 -0
index 9e4859b19..906d73e8c 100644
@@ -368,4 +368,39 @@ normal_path:
 	.set	pop
 .endm
 
+	.macro	ar9331_pbl_generic_start
+	.set	push
+	.set	noreorder
+
+	mips_barebox_10h
+
+	pbl_blt 0xbf000000 skip_pll_ram_config t8
+
+	hornet_mips24k_cp0_setup
+
+	pbl_ar9331_wmac_enable
+
+	hornet_1_1_war
+
+	pbl_ar9331_pll
+	pbl_ar9331_ram_generic_config
+
+skip_pll_ram_config:
+	/* Initialize caches... */
+	mips_cache_reset
+
+	/* ... and enable them */
+	dcache_enable
+
+	pbl_ar9331_uart_enable
+	debug_ll_ar9331_init
+	mips_nmon
+
+	pbl_ar9331_mdio_gpio_enable
+
+	copy_to_link_location	pbl_start
+
+	.set	pop
+	.endm
+
 #endif /* __ASM_MACH_ATH79_PBL_MACROS_H */
Signature · 7 lines
2.14.1


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

PATCH v2 5/5 MIPS: add support for DPTechnics DPT-Module v1

In reply to Oleksij Rempel

This product can be found here:
https://dptechnics.com/en/products/dpt-module-v1.html

---
 arch/mips/Makefile                                 |  1 +
 .../include/board/board_pbl_start.h                | 20 +++++
 arch/mips/configs/dptechnics-dpt-module_defconfig  | 89 ++++++++++++++++++++++
 arch/mips/dts/ar9331-dptechnics-dpt-module.dts     | 31 ++++++++
 arch/mips/mach-ath79/Kconfig                       |  8 ++
 5 files changed, 149 insertions(+)
 create mode 100644 arch/mips/boards/dptechnics-dpt-module/include/board/board_pbl_start.h
 create mode 100644 arch/mips/configs/dptechnics-dpt-module_defconfig
 create mode 100644 arch/mips/dts/ar9331-dptechnics-dpt-module.dts
arch/mips/Makefile +1 -0
index ecc91111b..1ef44a0f1 100644
@@ -79,6 +79,7 @@ machine-$(CONFIG_MACH_MIPS_AR231X)	:= ar231x
 board-$(CONFIG_BOARD_NETGEAR_WG102)	:= netgear-wg102
 
 machine-$(CONFIG_MACH_MIPS_ATH79)	:= ath79
+board-$(CONFIG_BOARC_DPTECHNICS_DPT_MODULE)	:= dptechnics-dpt-module
 board-$(CONFIG_BOARD_TPLINK_MR3020)	:= tplink-mr3020
 board-$(CONFIG_BOARD_TPLINK_WDR4300)	:= tplink-wdr4300
 board-$(CONFIG_BOARD_BLACK_SWIFT)	:= black-swift
arch/mips/boards/dptechnics-dpt-module/include/board/board_pbl_start.h new file +20 -0
new file mode 100644
index 000000000..9d6b1b86b
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2017 Oleksij Rempel <[email protected]>
+ *
+ * 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.
+ */
+
+#include <asm/pbl_macros.h>
+#include <mach/pbl_macros.h>
+#include <asm/pbl_nmon.h>
+
+	.macro	board_pbl_start
+	.set	push
+	.set	noreorder
+
+	ar9331_pbl_generic_start
+
+	.set	pop
+	.endm
arch/mips/configs/dptechnics-dpt-module_defconfig new file +89 -0

89 lines not on this page · raw message

arch/mips/dts/ar9331-dptechnics-dpt-module.dts new file +31 -0
new file mode 100644
index 000000000..39eb36600
@@ -0,0 +1,31 @@
+#include <mips/qca/ar9331_dpt_module.dts>
+#include "ar9331.dtsi"
+
+/ {
+	aliases {
+		spiflash = &spiflash;
+	};
+
+	chosen {
+		environment@0 {
+			compatible = "barebox,environment";
+			device-path = &spiflash, "partname:barebox-environment";
+		};
+	};
+};
+
+&spiflash {
+	partition@0 {
+		label = "barebox";
+		reg = <0 0x80000>;
+	};
+
+	partition@80000 {
+		label = "barebox-environment";
+		reg = <0x80000 0x10000>;
+	};
+};
+
+&mac0 {
+	status = "okay";
+};
arch/mips/mach-ath79/Kconfig +8 -0
index 9fec00c98..c7ce77568 100644
@@ -13,6 +13,14 @@ config SOC_QCA_AR9344
 choice
 	prompt "Board type"
 
+config BOARC_DPTECHNICS_DPT_MODULE
+	bool "DPTechnics DPT-Module"
+	select SOC_QCA_AR9331
+	select HAVE_PBL_IMAGE
+	select HAVE_IMAGE_COMPRESSION
+	select HAS_NMON
+	select HAS_NO_BOARD_HL_CODE
+
 config BOARD_TPLINK_MR3020
 	bool "TP-LINK MR3020"
 	select SOC_QCA_AR9331
Signature · 7 lines
2.14.1


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

changes v2:
- remove dummy board code.
- provide HAS_NO_BOARD_HL_CODE option

Oleksij Rempel (5):
MIPS: provide HAS_NO_BOARD_HL_CODE
MIPS: ar9331: add watchdog support
MIPS: ath79: ar9331: add generic RAM macro
MIPS: ath79: ar9331: add ar9331_pbl_generic_start macro
MIPS: add support for DPTechnics DPT-Module v1

Applied, thanks

Sascha

Quoted 25 lines
 arch/mips/Kconfig                                  |  3 +
 arch/mips/Makefile                                 |  7 +-
 .../include/board/board_pbl_start.h                | 20 +++++
 arch/mips/configs/dptechnics-dpt-module_defconfig  | 89 ++++++++++++++++++++++
 arch/mips/dts/ar9331-dptechnics-dpt-module.dts     | 31 ++++++++
 arch/mips/dts/ar9331.dtsi                          |  6 ++
 arch/mips/mach-ath79/Kconfig                       |  8 ++
 arch/mips/mach-ath79/include/mach/ar71xx_regs.h    |  1 +
 arch/mips/mach-ath79/include/mach/pbl_macros.h     | 72 ++++++++++++++++-
 drivers/watchdog/Kconfig                           |  2 +-
 10 files changed, 234 insertions(+), 5 deletions(-)
 create mode 100644 arch/mips/boards/dptechnics-dpt-module/include/board/board_pbl_start.h
 create mode 100644 arch/mips/configs/dptechnics-dpt-module_defconfig
 create mode 100644 arch/mips/dts/ar9331-dptechnics-dpt-module.dts
Signature · 7 lines
2.14.1


_______________________________________________
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