MIPS: barebox as a first stage loader on the Black Swift board
cover MIPS: barebox as a first stage loader on the Black Swift board
This patchseries add necessary low level initialization routines for AR9331 SoC. The patchseries makes possible to use barebox as a first stage loader on the Black Swift board.
The patchseries is heavily based on Oleksij Rempel's work on barebox for TP-Link MR3020.
TODOs:
* add UART initialization routune for DEBUG_LL and NMON;
* add macros for GPIO_FUNCTION_1 register initialization;
* check macros names linux kernel source compartibility;
* DT compatible string vendor "smartlx" appears un-documented. The site http://www.smartlx.ru/ is suspended.
Antony Pavlov (3):
MIPS: ar933x: pbl: add pbl_ar9331_ddr2_config macro
MIPS: ath79: add black-swift board support
MIPS: add black-swift_defconfig
Oleksij Rempel (1):
MIPS: ar933x: pbl: add pbl_ar9331_pll macro
arch/mips/Makefile | 1 + arch/mips/boards/black-swift/Makefile | 1 + arch/mips/boards/black-swift/board.c | 27 +++++ .../black-swift/include/board/board_pbl_start.h | 46 +++++++ arch/mips/configs/black-swift_defconfig | 37 ++++++ arch/mips/dts/black-swift.dts | 36 ++++++ arch/mips/include/asm/pbl_macros.h | 21 ++++ arch/mips/mach-ath79/Kconfig | 5 + arch/mips/mach-ath79/include/mach/ar71xx_regs.h | 25 ++++ arch/mips/mach-ath79/include/mach/pbl_macros.h | 132 +++++++++++++++++++++ 10 files changed, 331 insertions(+) create mode 100644 arch/mips/boards/black-swift/Makefile create mode 100644 arch/mips/boards/black-swift/board.c create mode 100644 arch/mips/boards/black-swift/include/board/board_pbl_start.h create mode 100644 arch/mips/configs/black-swift_defconfig create mode 100644 arch/mips/dts/black-swift.dts create mode 100644 arch/mips/mach-ath79/include/mach/pbl_macros.h
Signature · 7 lines
2.5.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
RFC 1/4 MIPS: ar933x: pbl: add pbl_ar9331_pll macro
From: Oleksij Rempel <[email protected]>
--- arch/mips/include/asm/pbl_macros.h | 21 ++++++++++++ arch/mips/mach-ath79/include/mach/ar71xx_regs.h | 5 +++ arch/mips/mach-ath79/include/mach/pbl_macros.h | 43 +++++++++++++++++++++++++ 3 files changed, 69 insertions(+)
arch/mips/include/asm/pbl_macros.h +21 -0
@@ -28,6 +28,27 @@#include <generated/compile.h> #include <generated/utsrelease.h> + .macro pbl_reg_writel val addr + .set push + .set noreorder + li t9, \addr + li t8, \val + sw t8, 0(t9) + .set pop + .endm + + .macro pbl_reg_clr clr addr + .set push + .set noreorder + li t9, \addr + li t8, \clr + lw t7, 0(t9) + not t8, t8 + and t7, t8 + sw t7, 0(t9) + .set pop + .endm + .macro pbl_sleep reg count .set push .set noreorder
arch/mips/mach-ath79/include/mach/ar71xx_regs.h +5 -0
@@ -15,7 +15,11 @@#ifndef __ASM_MACH_AR71XX_REGS_H#define __ASM_MACH_AR71XX_REGS_H +#ifndef __ASSEMBLER__#include <linux/bitops.h> +#else +#define BIT (nr) (1 << (nr)) +#endif #define AR71XX_APB_BASE 0x18000000
@@ -42,6 +46,7 @@#define AR933X_PLL_CPU_CONFIG_REFDIV_MASK 0x1f#define AR933X_PLL_CPU_CONFIG_OUTDIV_SHIFT 23#define AR933X_PLL_CPU_CONFIG_OUTDIV_MASK 0x7 +#define AR933X_PLL_CPU_CONFIG_PLLPWD BIT(30)#define AR933X_PLL_CLOCK_CTRL_BYPASS BIT(2)#define AR933X_PLL_CLOCK_CTRL_CPU_DIV_SHIFT 5
arch/mips/mach-ath79/include/mach/pbl_macros.h new file +43 -0
43 lines not on this page · raw message
Signature · 7 lines
2.5.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
RFC 2/4 MIPS: ar933x: pbl: add pbl_ar9331_ddr2_config macro
In reply to Antony Pavlov--- arch/mips/mach-ath79/include/mach/ar71xx_regs.h | 20 ++++++ arch/mips/mach-ath79/include/mach/pbl_macros.h | 89 +++++++++++++++++++++++++ 2 files changed, 109 insertions(+)
arch/mips/mach-ath79/include/mach/ar71xx_regs.h +20 -0
@@ -23,6 +23,8 @@#define AR71XX_APB_BASE 0x18000000 +#define AR71XX_DDR_CTRL_BASE (AR71XX_APB_BASE + 0x00000000) +#define AR71XX_DDR_CTRL_SIZE 0x100#define AR71XX_PLL_BASE (AR71XX_APB_BASE + 0x00050000)#define AR71XX_PLL_SIZE 0x100#define AR71XX_RESET_BASE (AR71XX_APB_BASE + 0x00060000)
@@ -32,6 +34,24 @@#define AR933X_UART_SIZE 0x14/* +* DDR_CTRL block +*/ +#define AR933X_DDR_CONFIG 0x00 +#define AR933X_DDR_CONFIG2 0x04 +#define AR933X_DDR_MODE 0x08 +#define AR933X_DDR_EXT_MODE 0x0c +#define AR933X_DDR_CTRL 0x10 +#define AR933X_DDR_REFRESH 0x14 +#define AR933X_DDR_RD_DATA 0x18 +#define AR933X_DDR_TAP_CTRL0 0x1c +#define AR933X_DDR_TAP_CTRL1 0x20 +#define AR933X_DDR_TAP_CTRL1 0x20 + +#define AR933X_DDR_DDR_DDR2_CONFIG 0x8c +#define AR933X_DDR_DDR_EMR2 0x90 +#define AR933X_DDR_DDR_EMR3 0x94 + +/* * PLL block */ #define AR933X_PLL_CPU_CONFIG_REG 0x00
arch/mips/mach-ath79/include/mach/pbl_macros.h +89 -0
93 lines not on this page · raw message
Signature · 7 lines
2.5.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
RFC 3/4 MIPS: ath79: add black-swift board support
In reply to Antony PavlovBlack Swift is a tiny coin-sized embedded computer based on AR9331 SoC. See http://www.black-swift.com/ for details.
See also Black Swift kickstarter page:
https://www.kickstarter.com/projects/1133560316/black-swift-tiny-wireless-computer
--- arch/mips/Makefile | 1 + arch/mips/boards/black-swift/Makefile | 1 + arch/mips/boards/black-swift/board.c | 27 +++++++++++++ .../black-swift/include/board/board_pbl_start.h | 46 ++++++++++++++++++++++ arch/mips/dts/black-swift.dts | 36 +++++++++++++++++ arch/mips/mach-ath79/Kconfig | 5 +++ 6 files changed, 116 insertions(+)
arch/mips/Makefile +1 -0
@@ -80,6 +80,7 @@ board-$(CONFIG_BOARD_NETGEAR_WG102) := netgear-wg102 machine-$(CONFIG_MACH_MIPS_ATH79) := ath79 board-$(CONFIG_BOARD_TPLINK_MR3020) := tplink-mr3020 +board-$(CONFIG_BOARD_BLACK_SWIFT) := black-swift machine-$(CONFIG_MACH_MIPS_BCM47XX) := bcm47xx board-$(CONFIG_BOARD_DLINK_DIR320) := dlink-dir-320
arch/mips/boards/black-swift/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-y += board.o
arch/mips/boards/black-swift/board.c new file +27 -0
@@ -0,0 +1,27 @@ +/* +* Copyright (C) 2015 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. +* +*/ + +#include <common.h> +#include <init.h> + +static int model_hostname_init (void ) +{ +barebox_set_hostname ("black-swift" ); + +return 0 ; +} +postcore_initcall (model_hostname_init);
arch/mips/boards/black-swift/include/board/board_pbl_start.h new file +46 -0
46 lines not on this page · raw message
arch/mips/dts/black-swift.dts new file +36 -0
@@ -0,0 +1,36 @@ +/dts-v1/; + +#include "ar9331.dtsi" + +/ { + model = "Black Swift"; + compatible = "smartlx,black-swift"; + + memory { + reg = <0x00000000 0x4000000>; + }; +}; + +&serial0 { + status = "okay"; +}; + +&spi { + num-chipselects = <1>; + status = "okay"; + + /* Winbond W25Q128FV SPI flash */ + spiflash: m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "m25p80"; + spi-max-frequency = <104000000>; + reg = <0>; + }; +}; + +/ { + aliases { + spiflash = &spiflash; + }; +};
arch/mips/mach-ath79/Kconfig +5 -0
@@ -13,6 +13,11 @@ config BOARD_TPLINK_MR3020 select HAVE_IMAGE_COMPRESSION select HAS_NMON +config BOARD_BLACK_SWIFT + bool "Black Swift" + select HAVE_PBL_IMAGE + select HAVE_IMAGE_COMPRESSION + endchoice endif
Signature · 7 lines
2.5.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [RFC 3/4] MIPS: ath79: add black-swift board support
Quoted 151 lines · Antony Pavlov
Black Swift is a tiny coin-sized embedded computer based on AR9331 SoC. See http://www.black-swift.com/ for details.
See also Black Swift kickstarter page:
https://www.kickstarter.com/projects/1133560316/black-swift-tiny-wireless-computerSigned-off-by Antony Pavlov <[email protected]>--- arch/mips/Makefile | 1 + arch/mips/boards/black-swift/Makefile | 1 + arch/mips/boards/black-swift/board.c | 27 +++++++++++++ .../black-swift/include/board/board_pbl_start.h | 46 ++++++++++++++++++++++ arch/mips/dts/black-swift.dts | 36 +++++++++++++++++ arch/mips/mach-ath79/Kconfig | 5 +++ 6 files changed, 116 insertions(+)arch/mips/Makefile +1
-0@@ -80,6 +80,7 @@ board-$(CONFIG_BOARD_NETGEAR_WG102) := netgear-wg102 machine-$(CONFIG_MACH_MIPS_ATH79) := ath79 board-$(CONFIG_BOARD_TPLINK_MR3020) := tplink-mr3020 +board-$(CONFIG_BOARD_BLACK_SWIFT) := black-swift machine-$(CONFIG_MACH_MIPS_BCM47XX) := bcm47xx board-$(CONFIG_BOARD_DLINK_DIR320) := dlink-dir-320arch/mips/boards/black-swift/Makefile new file +1
-0@@ -0,0 +1 @@ +obj-y += board.oarch/mips/boards/black-swift/board.c new file +27
-0@@ -0,0 +1,27 @@ +/* +* Copyright (C) 2015 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. +* +*/ + +#include <common.h> +#include <init.h> + +static int model_hostname_init (void ) +{ +barebox_set_hostname ("black-swift" ); + +return 0 ; +} +postcore_initcall (model_hostname_init);arch/mips/boards/black-swift/include/board/board_pbl_start.h new file +46
-0@@ -0,0 +1,46 @@ +/* +* Copyright (C) 2013, 2015 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> + + .macro board_pbl_start + .set push + .set noreorder + + mips_barebox_10h + + mips_disable_interrupts + + pbl_ar9331_pll +pbl_ar9331_ddr2_config + +/* +* General Purpose I/O Function (GPIO_FUNCTION_1) +* +* SPI_EN (18) enables SPI SPA Interface signals +* in GPIO_2, GPIO_3, GPIO_4 and GPIO_5. +* RES (15) reserved. This bit must be written with 1. +* UART_EN (2) enables UART I/O on GPIO_9 (SIN) and GPIO_10 (SOUT). +*/ + pbl_reg_writel 0x48002, 0xb8040028 + + copy_to_link_location pbl_start + + .set pop + .endmarch/mips/dts/black-swift.dts new file +25
-0@@ -0,0 +1,36 @@ +/dts-v1/; + +#include "ar9331.dtsi" + +/ { + model = "Black Swift"; + compatible = "smartlx,black-swift"; + + memory { + reg = <0x00000000 0x4000000>; + }; +}; + +&serial0 { + status = "okay"; +}; + +&spi { + num-chipselects = <1>; + status = "okay"; + + /* Winbond W25Q128FV SPI flash */ + spiflash: m25p80@0 { + #address-cells = <1>; + #size-cells = <1>;
arch/mips/dts/black-swift.dts line 35
Quoted 10 lines
arch/mips/dts/black-swift.dts new file +10
-0+ compatible = "m25p80"; + spi-max-frequency = <104000000>; + reg = <0>; + }; +}; + +/ { + aliases { + spiflash = &spiflash; + };
I would expect this aliases node near the top of this file, that's where aliases usually are.
Otherwise this series looks good to me, but I can't say much to it as I don't know mips assembly. If it works for you I am fine with it.
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
RFC 4/4 MIPS: add black-swift_defconfig
In reply to Antony Pavlov--- arch/mips/configs/black-swift_defconfig | 37 +++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
arch/mips/configs/black-swift_defconfig new file +37 -0
@@ -0,0 +1,37 @@ +CONFIG_BUILTIN_DTB=y +CONFIG_BUILTIN_DTB_NAME="black-swift" +CONFIG_MACH_MIPS_ATH79=y +CONFIG_BOARD_BLACK_SWIFT=y +CONFIG_PBL_IMAGE=y +CONFIG_CMDLINE_EDITING=y +CONFIG_AUTO_COMPLETE=y +CONFIG_PARTITION=y +CONFIG_LONGHELP=y +CONFIG_CMD_IOMEM=y +CONFIG_CMD_MEMINFO=y +# CONFIG_CMD_BOOTM is not set +CONFIG_CMD_GO=y +CONFIG_CMD_LOADB=y +CONFIG_CMD_LOADY=y +CONFIG_CMD_RESET=y +CONFIG_CMD_PARTITION=y +CONFIG_CMD_GLOBAL=y +CONFIG_CMD_SHA1SUM=y +CONFIG_CMD_LET=y +CONFIG_CMD_SLEEP=y +CONFIG_CMD_EDIT=y +CONFIG_CMD_MM=y +CONFIG_CMD_CLK=y +CONFIG_CMD_FLASH=y +CONFIG_CMD_SPI=y +CONFIG_CMD_OF_NODE=y +CONFIG_CMD_OF_PROPERTY=y +CONFIG_CMD_OFTREE=y +CONFIG_OFDEVICE=y +CONFIG_DRIVER_SERIAL_AR933X=y +CONFIG_DRIVER_SPI_ATH79=y +CONFIG_MTD=y +# CONFIG_MTD_OOB_DEVICE is not set +CONFIG_MTD_M25P80=y +CONFIG_DIGEST_SHA224_GENERIC=y +CONFIG_DIGEST_SHA256_GENERIC=y
Signature · 7 lines
2.5.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Quoted 6 lines · On Wed, 16 Sep 2015 11:31:28 +0300 Antony Pavlov <[email protected]>…
This patchseries add necessary low level initialization routines for AR9331 SoC. The patchseries makes possible to use barebox as a first stage loader on the Black Swift board.
The patchseries is heavily based on Oleksij Rempel's work on barebox for TP-Link MR3020.
Quoted 7 lines
TODOs:
* add UART initialization routune for
DEBUG_LLand NMON;
* add macros forGPIO_FUNCTION_1register initialization;
* check macros names linux kernel source compartibility;
* DT compatible string vendor "smartlx" appears un-documented. The site http://www.smartlx.ru/ is suspended.
* add barebox Black Swift flashing instruction.
Quoted 31 lines
Antony Pavlov (3):
MIPS: ar933x: pbl: addpbl_ar9331_ddr2_configmacro
MIPS: ath79: add black-swift board support
MIPS: add black-swift_defconfigOleksij Rempel (1):
MIPS: ar933x: pbl: addpbl_ar9331_pllmacroarch/mips/Makefile | 1 + arch/mips/boards/black-swift/Makefile | 1 + arch/mips/boards/black-swift/board.c | 27 +++++ .../black-swift/include/board/board_pbl_start.h | 46 +++++++ arch/mips/configs/black-swift_defconfig | 37 ++++++ arch/mips/dts/black-swift.dts | 36 ++++++ arch/mips/include/asm/pbl_macros.h | 21 ++++ arch/mips/mach-ath79/Kconfig | 5 + arch/mips/mach-ath79/include/mach/ar71xx_regs.h | 25 ++++ arch/mips/mach-ath79/include/mach/pbl_macros.h | 132 +++++++++++++++++++++ 10 files changed, 331 insertions(+) create mode 100644 arch/mips/boards/black-swift/Makefile create mode 100644 arch/mips/boards/black-swift/board.c create mode 100644 arch/mips/boards/black-swift/include/board/board_pbl_start.h create mode 100644 arch/mips/configs/black-swift_defconfig create mode 100644 arch/mips/dts/black-swift.dts create mode 100644 arch/mips/mach-ath79/include/mach/pbl_macros.hSignature · 1 line
2.5.0
Signature · 8 lines
-- Best regards, Antony Pavlov _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox