Refactor the architecture parts of mt7628
v3 cover Refactor the architecture parts of mt7628
This patch series are divided into two parts:
The main part is to rewrite the whole architecture code of mt7628:
* Lock parts of the d-cache for initial stack so the rest of the code can be reimplemented in C.
* Memory controller & DDR initialization have been fully written to support detecting DDR size automatically.
* DDR calibration has also been reimplemented with a clear logic.
* Implemented a new sysreset driver to take advantage of the reset controller so we can drop the use of syscon-based sysreset to reduce size.
The second part is to add SPL support for mt7628:
* With SPL enabled we can build the ROM-bootable and RAM-bootable binary simultaneously, and we can drop RAM boot related configs and defconfig files.
* Generate compressed u-boot.bin image for SPL to reduce size of final combined binary.
* Enable DM support for SPL for a more flexible device probing.
* Add a demo board (mt7628_rfb) aims at router application.
Changes since v2:
* Dropped a patch which removes unused parts of mt7628a.dtsi
* Move lzma decompression support to common spl_nor.c
* Move u-boot,dm-pre-reloc to u-boot-mt7628.dtsi
Makefile | 22 ++ arch/mips/Kconfig | 66 ++++ arch/mips/cpu/start.S | 16 +- arch/mips/cpu/u-boot-spl.lds | 4 +- arch/mips/dts/Makefile | 1 + arch/mips/dts/mediatek,mt7628-rfb.dts | 67 ++++ arch/mips/dts/mt7628-u-boot.dtsi | 56 +++ arch/mips/dts/mt7628a.dtsi | 17 +- arch/mips/include/asm/global_data.h | 3 + arch/mips/include/asm/u-boot-mips.h | 2 + arch/mips/lib/bootm.c | 3 + arch/mips/lib/traps.c | 19 + arch/mips/mach-mtmips/Kconfig | 132 +++---- arch/mips/mach-mtmips/Makefile | 8 +- arch/mips/mach-mtmips/cpu.c | 58 +--- arch/mips/mach-mtmips/ddr_cal.c | 211 +++++++++++ arch/mips/mach-mtmips/ddr_calibrate.c | 309 ----------------- arch/mips/mach-mtmips/ddr_init.c | 194 +++++++++++ arch/mips/mach-mtmips/include/mach/ddr.h | 52 +++ arch/mips/mach-mtmips/include/mach/mc.h | 180 ++++++++++ arch/mips/mach-mtmips/include/mach/serial.h | 13 + arch/mips/mach-mtmips/lowlevel_init.S | 328 ------------------ arch/mips/mach-mtmips/mt7628/Makefile | 6 + arch/mips/mach-mtmips/mt7628/ddr.c | 173 +++++++++ arch/mips/mach-mtmips/mt7628/init.c | 109 ++++++ arch/mips/mach-mtmips/mt7628/lowlevel_init.S | 161 +++++++++ arch/mips/mach-mtmips/mt7628/mt7628.h | 104 ++++++ arch/mips/mach-mtmips/mt7628/serial.c | 34 ++ arch/mips/mach-mtmips/mt76xx.h | 32 -- arch/mips/mach-mtmips/spl.c | 44 +++ board/gardena/smart-gateway-mt7688/board.c | 2 + board/mediatek/mt7628/Kconfig | 12 + board/mediatek/mt7628/MAINTAINERS | 7 + board/mediatek/mt7628/Makefile | 3 + board/mediatek/mt7628/board.c | 8 + common/spl/spl_nor.c | 59 +++- ...gardena-smart-gateway-mt7688-ram_defconfig | 74 ---- .../gardena-smart-gateway-mt7688_defconfig | 16 +- configs/linkit-smart-7688-ram_defconfig | 65 ---- configs/linkit-smart-7688_defconfig | 16 +- configs/mt7628_rfb_defconfig | 46 +++ drivers/sysreset/Kconfig | 6 + drivers/sysreset/Makefile | 1 + drivers/sysreset/sysreset_resetctl.c | 48 +++ .../configs/gardena-smart-gateway-mt7688.h | 20 +- include/configs/linkit-smart-7688.h | 21 +- include/configs/mt7628.h | 55 +++ lib/Kconfig | 5 + lib/Makefile | 1 + tools/binman/README.entries | 15 + tools/binman/etype/u_boot_lzma_img.py | 28 ++ 51 files changed, 1952 insertions(+), 980 deletions(-) create mode 100644 arch/mips/dts/mediatek,mt7628-rfb.dts create mode 100644 arch/mips/dts/mt7628-u-boot.dtsi create mode 100644 arch/mips/mach-mtmips/ddr_cal.c delete mode 100644 arch/mips/mach-mtmips/ddr_calibrate.c create mode 100644 arch/mips/mach-mtmips/ddr_init.c create mode 100644 arch/mips/mach-mtmips/include/mach/ddr.h create mode 100644 arch/mips/mach-mtmips/include/mach/mc.h create mode 100644 arch/mips/mach-mtmips/include/mach/serial.h delete mode 100644 arch/mips/mach-mtmips/lowlevel_init.S create mode 100644 arch/mips/mach-mtmips/mt7628/Makefile create mode 100644 arch/mips/mach-mtmips/mt7628/ddr.c create mode 100644 arch/mips/mach-mtmips/mt7628/init.c create mode 100644 arch/mips/mach-mtmips/mt7628/lowlevel_init.S create mode 100644 arch/mips/mach-mtmips/mt7628/mt7628.h create mode 100644 arch/mips/mach-mtmips/mt7628/serial.c delete mode 100644 arch/mips/mach-mtmips/mt76xx.h create mode 100644 arch/mips/mach-mtmips/spl.c create mode 100644 board/mediatek/mt7628/Kconfig create mode 100644 board/mediatek/mt7628/MAINTAINERS create mode 100644 board/mediatek/mt7628/Makefile create mode 100644 board/mediatek/mt7628/board.c delete mode 100644 configs/gardena-smart-gateway-mt7688-ram_defconfig delete mode 100644 configs/linkit-smart-7688-ram_defconfig create mode 100644 configs/mt7628_rfb_defconfig create mode 100644 drivers/sysreset/sysreset_resetctl.c create mode 100644 include/configs/mt7628.h create mode 100644 tools/binman/etype/u_boot_lzma_img.py
Signature · 1 line
2.17.1
v3 cover Refactor the architecture parts of mt7628
I'm having a holiday from tomorrow to Jan 30th and I may not reply during the holiday.
Sincerely
Quoted 105 lines · Weijie Gao
This patch series are divided into two parts:
The main part is to rewrite the whole architecture code of mt7628:
* Lock parts of the d-cache for initial stack so the rest of the code can be reimplemented in C.
* Memory controller & DDR initialization have been fully written to support detecting DDR size automatically.
* DDR calibration has also been reimplemented with a clear logic.
* Implemented a new sysreset driver to take advantage of the reset controller so we can drop the use of syscon-based sysreset to reduce size.The second part is to add SPL support for mt7628:
* With SPL enabled we can build the ROM-bootable and RAM-bootable binary simultaneously, and we can drop RAM boot related configs and defconfig files.
* Generate compressed u-boot.bin image for SPL to reduce size of final combined binary.
* Enable DM support for SPL for a more flexible device probing.
* Add a demo board (mt7628_rfb) aims at router application.Changes since v2:
* Dropped a patch which removes unused parts ofmt7628a.dtsi
* Move lzma decompression support to commonspl_nor.c
* Move u-boot,dm-pre-reloc tou-boot-mt7628.dtsiMakefile | 22 ++ arch/mips/Kconfig | 66 ++++ arch/mips/cpu/start.S | 16 +- arch/mips/cpu/u-boot-spl.lds | 4 +- arch/mips/dts/Makefile | 1 + arch/mips/dts/mediatek,mt7628-rfb.dts | 67 ++++ arch/mips/dts/mt7628-u-boot.dtsi | 56 +++ arch/mips/dts/mt7628a.dtsi | 17 +- arch/mips/include/asm/global_data.h | 3 + arch/mips/include/asm/u-boot-mips.h | 2 + arch/mips/lib/bootm.c | 3 + arch/mips/lib/traps.c | 19 + arch/mips/mach-mtmips/Kconfig | 132 +++---- arch/mips/mach-mtmips/Makefile | 8 +- arch/mips/mach-mtmips/cpu.c | 58 +--- arch/mips/mach-mtmips/ddr_cal.c | 211 +++++++++++ arch/mips/mach-mtmips/ddr_calibrate.c | 309 ----------------- arch/mips/mach-mtmips/ddr_init.c | 194 +++++++++++ arch/mips/mach-mtmips/include/mach/ddr.h | 52 +++ arch/mips/mach-mtmips/include/mach/mc.h | 180 ++++++++++ arch/mips/mach-mtmips/include/mach/serial.h | 13 + arch/mips/mach-mtmips/lowlevel_init.S | 328 ------------------ arch/mips/mach-mtmips/mt7628/Makefile | 6 + arch/mips/mach-mtmips/mt7628/ddr.c | 173 +++++++++ arch/mips/mach-mtmips/mt7628/init.c | 109 ++++++ arch/mips/mach-mtmips/mt7628/lowlevel_init.S | 161 +++++++++ arch/mips/mach-mtmips/mt7628/mt7628.h | 104 ++++++ arch/mips/mach-mtmips/mt7628/serial.c | 34 ++ arch/mips/mach-mtmips/mt76xx.h | 32 -- arch/mips/mach-mtmips/spl.c | 44 +++ board/gardena/smart-gateway-mt7688/board.c | 2 + board/mediatek/mt7628/Kconfig | 12 + board/mediatek/mt7628/MAINTAINERS | 7 + board/mediatek/mt7628/Makefile | 3 + board/mediatek/mt7628/board.c | 8 + common/spl/spl_nor.c | 59 +++- ...gardena-smart-gateway-mt7688-ram_defconfig | 74 ---- .../gardena-smart-gateway-mt7688_defconfig | 16 +- configs/linkit-smart-7688-ram_defconfig | 65 ---- configs/linkit-smart-7688_defconfig | 16 +- configs/mt7628_rfb_defconfig | 46 +++ drivers/sysreset/Kconfig | 6 + drivers/sysreset/Makefile | 1 + drivers/sysreset/sysreset_resetctl.c | 48 +++ .../configs/gardena-smart-gateway-mt7688.h | 20 +- include/configs/linkit-smart-7688.h | 21 +- include/configs/mt7628.h | 55 +++ lib/Kconfig | 5 + lib/Makefile | 1 + tools/binman/README.entries | 15 + tools/binman/etype/u_boot_lzma_img.py | 28 ++ 51 files changed, 1952 insertions(+), 980 deletions(-) create mode 100644 arch/mips/dts/mediatek,mt7628-rfb.dts create mode 100644 arch/mips/dts/mt7628-u-boot.dtsi create mode 100644 arch/mips/mach-mtmips/ddr_cal.c delete mode 100644 arch/mips/mach-mtmips/ddr_calibrate.c create mode 100644 arch/mips/mach-mtmips/ddr_init.c create mode 100644 arch/mips/mach-mtmips/include/mach/ddr.h create mode 100644 arch/mips/mach-mtmips/include/mach/mc.h create mode 100644 arch/mips/mach-mtmips/include/mach/serial.h delete mode 100644 arch/mips/mach-mtmips/lowlevel_init.S create mode 100644 arch/mips/mach-mtmips/mt7628/Makefile create mode 100644 arch/mips/mach-mtmips/mt7628/ddr.c create mode 100644 arch/mips/mach-mtmips/mt7628/init.c create mode 100644 arch/mips/mach-mtmips/mt7628/lowlevel_init.S create mode 100644 arch/mips/mach-mtmips/mt7628/mt7628.h create mode 100644 arch/mips/mach-mtmips/mt7628/serial.c delete mode 100644 arch/mips/mach-mtmips/mt76xx.h create mode 100644 arch/mips/mach-mtmips/spl.c create mode 100644 board/mediatek/mt7628/Kconfig create mode 100644 board/mediatek/mt7628/MAINTAINERS create mode 100644 board/mediatek/mt7628/Makefile create mode 100644 board/mediatek/mt7628/board.c delete mode 100644 configs/gardena-smart-gateway-mt7688-ram_defconfig delete mode 100644 configs/linkit-smart-7688-ram_defconfig create mode 100644 configs/mt7628_rfb_defconfig create mode 100644 drivers/sysreset/sysreset_resetctl.c create mode 100644 include/configs/mt7628.h create mode 100644 tools/binman/etype/u_boot_lzma_img.py
v3 cover Refactor the architecture parts of mt7628
In reply to Weijie GaoHi Weije,
Am 21.01.20 um 09:17 schrieb Weijie Gao:
Quoted 20 lines
This patch series are divided into two parts:
The main part is to rewrite the whole architecture code of mt7628:
* Lock parts of the d-cache for initial stack so the rest of the code can be reimplemented in C.
* Memory controller & DDR initialization have been fully written to support detecting DDR size automatically.
* DDR calibration has also been reimplemented with a clear logic.
* Implemented a new sysreset driver to take advantage of the reset controller so we can drop the use of syscon-based sysreset to reduce size.The second part is to add SPL support for mt7628:
* With SPL enabled we can build the ROM-bootable and RAM-bootable binary simultaneously, and we can drop RAM boot related configs and defconfig files.
* Generate compressed u-boot.bin image for SPL to reduce size of final combined binary.
* Enable DM support for SPL for a more flexible device probing.
* Add a demo board (mt7628_rfb) aims at router application.
Quoted 5 lines
Changes since v2:
* Dropped a patch which removes unused parts ofmt7628a.dtsi
* Move lzma decompression support to commonspl_nor.c
* Move u-boot,dm-pre-reloc tou-boot-mt7628.dtsi
could you resend patches from 14/20 to 20/20? Patch 16/20 should get a test as requested by Simon. From the remaining generic patches I'd like to have some more acks before applying. Thanks.
Signature · 1 line
- Daniel
v3 cover Refactor the architecture parts of mt7628
FYI
I've been using this patchset for over a week without any adverse effect. It allowed me to port to VoCore2 board.
Should I add a "Tested-by" flag?
If so: how should I do it?
Regards
Mauro Codarelli
Quoted 32 lines · Daniel Schwierzeck
Hi Weije,
Am 21.01.20 um 09:17 schrieb Weijie Gao:
Quoted 20 lines
This patch series are divided into two parts:
The main part is to rewrite the whole architecture code of mt7628:
* Lock parts of the d-cache for initial stack so the rest of the code can be reimplemented in C.
* Memory controller & DDR initialization have been fully written to support detecting DDR size automatically.
* DDR calibration has also been reimplemented with a clear logic.
* Implemented a new sysreset driver to take advantage of the reset controller so we can drop the use of syscon-based sysreset to reduce size.The second part is to add SPL support for mt7628:
* With SPL enabled we can build the ROM-bootable and RAM-bootable binary simultaneously, and we can drop RAM boot related configs and defconfig files.
* Generate compressed u-boot.bin image for SPL to reduce size of final combined binary.
* Enable DM support for SPL for a more flexible device probing.
* Add a demo board (mt7628_rfb) aims at router application.Quoted 5 lines
Changes since v2:
* Dropped a patch which removes unused parts ofmt7628a.dtsi
* Move lzma decompression support to commonspl_nor.c
* Move u-boot,dm-pre-reloc tou-boot-mt7628.dtsicould you resend patches from 14/20 to 20/20? Patch 16/20 should get a test as requested by Simon. From the remaining generic patches I'd like to have some more acks before applying. Thanks.
v3 cover Refactor the architecture parts of mt7628
Hi Mauro,
Am 10.02.20 um 21:20 schrieb Mauro Condarelli:
Quoted 9 lines
FYI
I've been using this patchset for over a week without any adverse effect. It allowed me to port to VoCore2 board.
Should I add a "Tested-by" flag?
If so: how should I do it?Regards
Mauro Codarelli
sorry that I could respond to your questions earlier. I've pushed the complete patch set from Weijie to:
https://gitlab.denx.de/u-boot/custodians/u-boot-mips/commits/testing
Maybe this helps you with development. If you have a bootable patch set (you can do MMC later) for your VoCore2 board, please submit a regular patch series based on that branch so that we can review again.
Regarding the Tested-by, simply respond to a patch mail with a
Then Patchwork will record that and automatically adds this line to the patch when I download it. Personally I always remove all parts of the mail beginning with the first "diff --git a/...." when I send a Tested-by or Reviewed-by.
Signature · 1 line
- Daniel
v3 cover Refactor the architecture parts of mt7628
Thanks Daniel.
Quoted 9 lines · Daniel Schwierzeck
Hi Mauro,
Am 10.02.20 um 21:20 schrieb Mauro Condarelli:
Quoted 6 lines
FYI
I've been using this patchset for over a week without any adverse effect. It allowed me to port to VoCore2 board.
Should I add a "Tested-by" flag?
If so: how should I do it?
Quoted 7 lines
Quoted 3 lines
Regards
Mauro Codarellisorry that I could respond to your questions earlier. I've pushed the complete patch set from Weijie to:
https://gitlab.denx.de/u-boot/custodians/u-boot-mips/commits/testing
I tried to use this repo/branch, but something is wrong (or I goofed badly).
Quoted 3 lines
Maybe this helps you with development. If you have a bootable patch set (you can do MMC later) for your VoCore2 board, please submit a regular patch series based on that branch so that we can review again.
I *do* have a bootable patchset built on top of master + Nemirovsky "reconfigurable cpu clocks" + Weijie v3.
Result is fully working, including net and mmc/SD.
This patchset applies cleanly to uboot-mips/testing and compile apparently without errors, but resulting u-boot.bin does not work. By "does not work" I mean it does not utter a single char on debug serial.
I tried to do a complete diff between my working tree and this non-working one and there are tons of differences, but I couldn't spot anything that might be relevant.
I am unsure on how to proceed; please advise.
Quoted 1 line
===8<----
Many thanks
Mauro Condarelli
My complete patchset follows:
This includes some project-specific settings I need to remove before actual submission, but I left them in because *this* is working for me.
==========================================
v3 cover Refactor the architecture parts of mt7628
Hi Mauro,
Quoted 12 lines · Mauro Condarelli
Thanks Daniel.
Quoted 9 lines · Daniel Schwierzeck
Hi Mauro,
Am 10.02.20 um 21:20 schrieb Mauro Condarelli:
Quoted 6 lines
FYI
I've been using this patchset for over a week without any adverse effect. It allowed me to port to VoCore2 board.
Should I add a "Tested-by" flag?
If so: how should I do it?
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
Regards
Mauro Codarellisorry that I could respond to your questions earlier. I've pushed the complete patch set from Weijie to:
https://gitlab.denx.de/u-boot/custodians/u-boot-mips/commits/testing
I tried to use this repo/branch, but something is wrong (or I goofed badly).
Just a quick reply: I tested u-boot-mips/testing today and it works just fine on both LinkIt and the GARDENA board. So there is nothing wrong with this repository AFAICT.
You might need to rebase your patch on top of this branch, as some files might have changes in the meantime.
Thanks,
Stefan
Quoted 628 lines
Quoted 3 lines
Maybe this helps you with development. If you have a bootable patch set (you can do MMC later) for your VoCore2 board, please submit a regular patch series based on that branch so that we can review again.
I *do* have a bootable patchset built on top of master + Nemirovsky "reconfigurable cpu clocks" + Weijie v3.
Result is fully working, including net and mmc/SD.This patchset applies cleanly to uboot-mips/testing and compile apparently without errors, but resulting u-boot.bin does not work. By "does not work" I mean it does not utter a single char on debug serial.
I tried to do a complete diff between my working tree and this non-working one and there are tons of differences, but I couldn't spot anything that might be relevant.
I am unsure on how to proceed; please advise.
Quoted 1 line
===8<----
Many thanks
Mauro CondarelliMy complete patchset follows:
This includes some project-specific settings I need to remove before actual submission, but I left them in because *this* is working for me.
==========================================
Fromf1828bcacbd3fc3bc8aa9243b302ab2b7a509d88Mon Sep 17 00:00:00 2001
From: Mauro Condarelli <[email protected]>
Date: Tue, 17 Dec 2019 10:54:21 +0100
Subject: [PATCH] Add support for SoM "VoCore2".Small patch series to add support for VoCore/VoCore2 board.
VoCore is open hardware and runs OpenWrt/LEDE.
It has WIFI, USB, UART, 20+ GPIOs but is only one inch square. It will help you to make a smart house, study embedded system or even make the tiniest router in the world.Details about this SoM can be found at "https://vocore.io/v2.html".
Series-notes:
This port is working for me and able to boot Linux v5.0. Standard subsystems are enabled (SPI NOR, MMC/SD and USB). Network is not currently enabled as my Vocore2 board networking relies essentially on WiFi (which works under Linux). ENDSeries-to: uboot
Series-name: VoCore2
Series-cc: danielschwierzeck
Series-cc: stroese
Series-cc: Weijie Gao <[email protected]>
Series-version: 5Series-changes: 2
- Removed some dead code
- Changed Author to my full name (no nick)
- Removed unwanted fixup to .dts generation (not my call).
- Fixed commit message
- Fixed various variables/filenames to include Vendor name
- Changed Vendor name (Vonger -> Vocore)Series-changes: 3
- based on top of Weijie Gao patchset:
"[v3,xx/20]Refactor the architecture parts of mt7628"Series-changes: 4
- Reverted some overzealous DTS cleaning.
- Added support for bootcountSeries-changes: 5
- Added network setup.
- Move back environment to SPI NOR.
- Changes to environment default settings.Signed-off-by Mauro Condarelli <[email protected]>--- arch/mips/dts/Makefile | 1 + arch/mips/dts/mt7628a.dtsi | 5 ++ arch/mips/dts/vocore_vocore2.dts | 78 ++++++++++++++++++++ arch/mips/mach-mtmips/Kconfig | 8 ++ board/vocore/vocore2/Kconfig | 12 +++ board/vocore/vocore2/Makefile | 3 + board/vocore/vocore2/board.c | 33 +++++++++ configs/vocore2_defconfig | 105 +++++++++++++++++++++++++++ configs/vocore2_defconfig_ENV_IN_FAT | 104 ++++++++++++++++++++++++++ include/configs/vocore2.h | 76 +++++++++++++++++++ 10 files changed, 425 insertions(+)create mode 100644
arch/mips/dts/vocore_vocore2.dtscreate mode 100644 board/vocore/vocore2/Kconfig create mode 100644 board/vocore/vocore2/Makefile create mode 100644board/vocore/vocore2/board.ccreate mode 100644 configs/vocore2_defconfig create mode 100644 configs/vocore2_defconfig_ENV_IN_FAT create mode 100644include/configs/vocore2.harch/mips/dts/Makefile +0
-0@@ -23,6 +23,7 @@ dtb-$(CONFIG_BOARD_NETGEAR_DGND3700V2) +=netgear,dgnd3700v2.dtb
dtb-$(CONFIG_BOARD_SAGEM_FAST1704) += sagem,f at st1704.dtb dtb-$(CONFIG_BOARD_SFR_NB4_SER) += sfr,nb4-ser.dtb dtb-$(CONFIG_BOARD_TPLINK_WDR4300) += tplink_wdr4300.dtbarch/mips/dts/Makefile +1
-0+dtb-$(CONFIG_BOARD_VOCORE2) += vocore_vocore2.dtb dtb-$(CONFIG_TARGET_JZ4780_CI20) += ci20.dtb dtb-$(CONFIG_SOC_LUTON) += luton_pcb090.dtb luton_pcb091.dtb dtb-$(CONFIG_SOC_OCELOT) += ocelot_pcb120.dtb ocelot_pcb123.dtbarch/mips/dts/mt7628a.dtsi +5
-0@@ -402,6 +402,11 @@ builtin-cd = <1>; r_smpl = <1>; + bus-width = <4>; + max-frequency = <48000000>; + cap-sd-highspeed; + cap-mmc-highspeed; + clocks = <&clk48m>, <&clkctrl CLK_SDXC>; clock-names = "source", "hclk";arch/mips/dts/vocore_vocore2.dts new file +78
-0@@ -0,0 +1,78 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2019 Mauro Condarelli <[email protected]> + */ + +/dts-v1/; + +#include "mt7628a.dtsi" +#include <dt-bindings/gpio/gpio.h> + +/ { + compatible = "vocore,vocore2", "ralink,mt7628a-soc"; + model = "VoCore2"; + + aliases { + serial0 = &uart2; + spi0 = &spi0; + }; + + memory at 0 { + device_type = "memory"; + reg = <0x0 0x08000000>; + }; + leds { + compatible = "gpio-leds"; + + power { + label = "vocore:power"; + gpios = <&gpio1 12 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + }; + + chosen { + bootargs = "console=ttyS2,115200"; + stdout-path = &uart2; + }; +}; + +&pinctrl { + state_default: pin_state { + p0led { + groups = "p0led_a"; + function = "led"; + }; + }; +}; + +&uart2 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + nor0: spi-flash at 0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + spi-max-frequency = <25000000>; + reg = <0>; + }; +}; + +ð { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&ephy_iot_mode>; + mediatek,poll-link-phy = <0>; +}; + +&mmc { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&sd_iot_mode>; + pinctrl-1 = <&sd_iot_mode>; +};arch/mips/mach-mtmips/Kconfig +8
-0@@ -83,6 +83,13 @@ config BOARD_MT7628_RFB SPI-NOR flash, 1 built-in switch with 5 ports, 1 UART, 1 USB host, 1 SDXC, 1 PCIe socket and JTAG pins. +config BOARD_VOCORE2 + bool "VoCore2" + depends on SOC_MT7628 + help + VoCore VoCore2 board has a MT7628 SoC with 128 MiB of RAM + and 16 MiB of flash (SPI). + endchoice config SPL_UART2_SPIS_PINMUX@@ -96,5 +103,6 @@ config SPL_UART2_SPIS_PINMUX source "board/gardena/smart-gateway-mt7688/Kconfig" source "board/mediatek/mt7628/Kconfig" source "board/seeed/linkit-smart-7688/Kconfig" +source "board/vocore/vocore2/Kconfig" endmenuboard/vocore/vocore2/Kconfig new file +12
-0@@ -0,0 +1,12 @@ +if BOARD_VOCORE2 + +config SYS_BOARD + default "vocore2" + +config SYS_VENDOR + default "vocore" + +config SYS_CONFIG_NAME + default "vocore2" + +endifboard/vocore/vocore2/Makefile new file +3
-0@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0+ + +obj-y += board.oboard/vocore/vocore2/board.c new file +33
-0@@ -0,0 +1,33 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (C) 2019 Mauro Condarelli <[email protected]> +* +* Note: this is largely copied from: +* board/seeed/linkit_smart_7688/board.c +* Copyright (C) 2018 Stefan Roese <[email protected]> +*/ + +#include <common.h> +#include <asm/io.h> + +#define MT76XX_GPIO1_MODE 0x10000060 + +void board_debug_uart_init (void ) +{ + void __iomem *gpio_mode; + + /* Select UART2 mode instead of GPIO mode (default) */ + gpio_mode = ioremap_nocache(MT76XX_GPIO1_MODE, 0x100); + clrbits_le32(gpio_mode, GENMASK(27, 26)); +} + +int board_early_init_f (void ) +{ + /* + * The pin muxing of UART2 also needs to be done, if debug uart + * is not enabled. So we need to call this function here as well. + */ + board_debug_uart_init(); + + return 0; +}configs/vocore2_defconfig new file +105
-0@@ -0,0 +1,105 @@ +CONFIG_MIPS=y +CONFIG_SPL_LIBCOMMON_SUPPORT=y +CONFIG_SPL_LIBGENERIC_SUPPORT=y +CONFIG_ENV_SIZE=0x1000 +CONFIG_ENV_SECT_SIZE=0x1000 +CONFIG_ENV_OFFSET=0x04e000 +CONFIG_SPL_SERIAL_SUPPORT=y +CONFIG_SPL_SYS_MALLOC_F_LEN=0x20000 +CONFIG_NR_DRAM_BANKS=1 +CONFIG_SPL=y +CONFIG_SYS_BOOTCOUNT_SINGLEWORD=y +CONFIG_SYS_BOOTCOUNT_ADDR=0xb000006c +CONFIG_ARCH_MTMIPS=y +CONFIG_BOARD_VOCORE2=y +CONFIG_SPL_UART2_SPIS_PINMUX=y +CONFIG_RESTORE_EXCEPTION_VECTOR_BASE=y +CONFIG_MIPS_BOOT_FDT=y +CONFIG_ENV_VARS_UBOOT_CONFIG=y +CONFIG_SYS_BOOT_GET_CMDLINE=y +CONFIG_SYS_BOOT_GET_KBD=y +CONFIG_FIT=y +CONFIG_FIT_SIGNATURE=y +CONFIG_LEGACY_IMAGE_FORMAT=y +CONFIG_OF_STDOUT_VIA_ALIAS=y +CONFIG_USE_BOOTARGS=y +CONFIG_LOGLEVEL=8 +CONFIG_SYS_CONSOLE_INFO_QUIET=y +CONFIG_VERSION_VARIABLE=y +CONFIG_DISPLAY_BOARDINFO_LATE=y +CONFIG_BOARD_EARLY_INIT_F=y +CONFIG_SPL_SYS_MALLOC_SIMPLE=y +CONFIG_SPL_NOR_SUPPORT=y +CONFIG_HUSH_PARSER=y +CONFIG_CMD_LICENSE=y +# CONFIG_BOOTM_NETBSD is not set +# CONFIG_BOOTM_PLAN9 is not set +# CONFIG_BOOTM_RTEMS is not set +# CONFIG_BOOTM_VXWORKS is not set +# CONFIG_CMD_ELF is not set +# CONFIG_CMD_XIMG is not set +# CONFIG_CMD_CRC32 is not set +CONFIG_CMD_MEMINFO=y +# CONFIG_CMD_FLASH is not set +CONFIG_CMD_GPIO=y +CONFIG_CMD_GPT=y +CONFIG_CMD_GPT_RENAME=y +# CONFIG_CMD_LOADS is not set +CONFIG_CMD_MMC=y +CONFIG_CMD_MTD=y +CONFIG_CMD_PART=y +CONFIG_CMD_SPI=y +CONFIG_CMD_USB=y +CONFIG_CMD_WDT=y +CONFIG_CMD_DHCP=y +CONFIG_CMD_MII=y +CONFIG_CMD_PING=y +CONFIG_CMD_BOOTCOUNT=y +CONFIG_CMD_TIME=y +CONFIG_CMD_FAT=y +CONFIG_CMD_FS_GENERIC=y +CONFIG_CMD_MTDPARTS=y +CONFIG_MTDIDS_DEFAULT="nor0=spi0.0" +CONFIG_MTDPARTS_DEFAULT="spi0.0:312k(u-boot),4k(env),4k(factory),2368k(kernel),-(filesystem)" +CONFIG_DEFAULT_DEVICE_TREE="vocore_vocore2" +CONFIG_ENV_IS_IN_SPI_FLASH=y +CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y +CONFIG_NET_RANDOM_ETHADDR=y +CONFIG_SPL_DM=y +# CONFIG_DM_DEVICE_REMOVE is not set +CONFIG_BOOTCOUNT_LIMIT=y +CONFIG_LED=y +CONFIG_LED_BLINK=y +CONFIG_LED_GPIO=y +CONFIG_MMC=y +CONFIG_DM_MMC=y +# CONFIG_MMC_HW_PARTITIONING is not set +CONFIG_MMC_MTK=y +CONFIG_MTD=y +CONFIG_SPI_FLASH_SFDP_SUPPORT=y +CONFIG_SPI_FLASH_GIGADEVICE=y +CONFIG_SPI_FLASH_MACRONIX=y +CONFIG_SPI_FLASH_SPANSION=y +CONFIG_SPI_FLASH_STMICRO=y +CONFIG_SPI_FLASH_WINBOND=y +CONFIG_SPI_FLASH_MTD=y +CONFIG_MT7628_ETH=y +CONFIG_PHY=y +CONFIG_MT76X8_USB_PHY=y +# CONFIG_RAM_ROCKCHIP_DEBUG is not set +CONFIG_SPECIFY_CONSOLE_INDEX=y +CONFIG_CONS_INDEX=3 +CONFIG_SPI=y +CONFIG_MT7621_SPI=y +CONFIG_USB=y +CONFIG_DM_USB=y +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_EHCI_GENERIC=y +CONFIG_USB_STORAGE=y +CONFIG_WDT=y +CONFIG_WDT_MT7621=y +CONFIG_FS_EXT4=y +CONFIG_FAT_WRITE=y +CONFIG_LZMA=y +CONFIG_LZO=yconfigs/vocore2_defconfig_ENV_IN_FAT new file +104
-0@@ -0,0 +1,104 @@ +CONFIG_MIPS=y +CONFIG_SPL_LIBCOMMON_SUPPORT=y +CONFIG_SPL_LIBGENERIC_SUPPORT=y +CONFIG_ENV_SIZE=0x1000 +CONFIG_SPL_SERIAL_SUPPORT=y +CONFIG_SPL_SYS_MALLOC_F_LEN=0x20000 +CONFIG_NR_DRAM_BANKS=1 +CONFIG_SPL=y +CONFIG_SYS_BOOTCOUNT_SINGLEWORD=y +CONFIG_SYS_BOOTCOUNT_ADDR=0xb000006c +CONFIG_ARCH_MTMIPS=y +CONFIG_BOARD_VOCORE2=y +CONFIG_SPL_UART2_SPIS_PINMUX=y +CONFIG_RESTORE_EXCEPTION_VECTOR_BASE=y +CONFIG_MIPS_BOOT_FDT=y +CONFIG_ENV_VARS_UBOOT_CONFIG=y +CONFIG_SYS_BOOT_GET_CMDLINE=y +CONFIG_SYS_BOOT_GET_KBD=y +CONFIG_FIT=y +CONFIG_FIT_SIGNATURE=y +CONFIG_LEGACY_IMAGE_FORMAT=y +CONFIG_OF_STDOUT_VIA_ALIAS=y +CONFIG_USE_BOOTARGS=y +CONFIG_LOGLEVEL=8 +CONFIG_SYS_CONSOLE_INFO_QUIET=y +CONFIG_VERSION_VARIABLE=y +CONFIG_DISPLAY_BOARDINFO_LATE=y +CONFIG_BOARD_EARLY_INIT_F=y +CONFIG_SPL_SYS_MALLOC_SIMPLE=y +CONFIG_SPL_NOR_SUPPORT=y +CONFIG_HUSH_PARSER=y +CONFIG_CMD_LICENSE=y +# CONFIG_BOOTM_NETBSD is not set +# CONFIG_BOOTM_PLAN9 is not set +# CONFIG_BOOTM_RTEMS is not set +# CONFIG_BOOTM_VXWORKS is not set +# CONFIG_CMD_ELF is not set +# CONFIG_CMD_XIMG is not set +# CONFIG_CMD_CRC32 is not set +CONFIG_CMD_MEMINFO=y +# CONFIG_CMD_FLASH is not set +CONFIG_CMD_GPIO=y +CONFIG_CMD_GPT=y +CONFIG_CMD_GPT_RENAME=y +# CONFIG_CMD_LOADS is not set +CONFIG_CMD_MMC=y +CONFIG_CMD_MTD=y +CONFIG_CMD_PART=y +CONFIG_CMD_SPI=y +CONFIG_CMD_USB=y +CONFIG_CMD_WDT=y +CONFIG_CMD_DHCP=y +CONFIG_CMD_MII=y +CONFIG_CMD_PING=y +CONFIG_CMD_BOOTCOUNT=y +CONFIG_CMD_TIME=y +CONFIG_CMD_FAT=y +CONFIG_CMD_FS_GENERIC=y +CONFIG_CMD_MTDPARTS=y +CONFIG_MTDIDS_DEFAULT="nor0=spi0.0" +CONFIG_MTDPARTS_DEFAULT="spi0.0:312k(u-boot),4k(env),4k(factory),2368k(kernel),-(filesystem)" +CONFIG_DEFAULT_DEVICE_TREE="vocore_vocore2" +CONFIG_ENV_IS_IN_FAT=y +CONFIG_ENV_FAT_INTERFACE="mmc" +CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" +CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y +CONFIG_NET_RANDOM_ETHADDR=y +CONFIG_SPL_DM=y +# CONFIG_DM_DEVICE_REMOVE is not set +CONFIG_BOOTCOUNT_LIMIT=y +CONFIG_LED=y +CONFIG_LED_BLINK=y +CONFIG_LED_GPIO=y +CONFIG_MMC=y +CONFIG_DM_MMC=y +# CONFIG_MMC_HW_PARTITIONING is not set +CONFIG_MMC_MTK=y +CONFIG_MTD=y +CONFIG_SPI_FLASH_SFDP_SUPPORT=y +CONFIG_SPI_FLASH_GIGADEVICE=y +CONFIG_SPI_FLASH_MACRONIX=y +CONFIG_SPI_FLASH_SPANSION=y +CONFIG_SPI_FLASH_STMICRO=y +CONFIG_SPI_FLASH_WINBOND=y +CONFIG_SPI_FLASH_MTD=y +CONFIG_MT7628_ETH=y +CONFIG_PHY=y +CONFIG_MT76X8_USB_PHY=y +# CONFIG_RAM_ROCKCHIP_DEBUG is not set +CONFIG_SPECIFY_CONSOLE_INDEX=y +CONFIG_CONS_INDEX=3 +CONFIG_SPI=y +CONFIG_MT7621_SPI=y +CONFIG_USB=y +CONFIG_DM_USB=y +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_EHCI_GENERIC=y +CONFIG_USB_STORAGE=y +CONFIG_WDT=y +CONFIG_WDT_MT7621=y +CONFIG_FS_EXT4=y +CONFIG_LZMA=y +CONFIG_LZO=yinclude/configs/vocore2.h new file +61
-0@@ -0,0 +1,76 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (C) 2019 Mauro Condarelli <[email protected]> +*/ + +#ifndef __VOCORE2_CONFIG_H__ +#define __VOCORE2_CONFIG_H__ + +/* CPU */ +#define CONFIG_SYS_MIPS_TIMER_FREQ 290000000 + +/* RAM */ +#define CONFIG_SYS_SDRAM_BASE 0x80000000 + +#define CONFIG_SYS_LOAD_ADDR CONFIG_SYS_SDRAM_BASE + 0x100000 + +#define CONFIG_SYS_INIT_SP_OFFSET 0x400000 + +/* SPL */ +#if defined(CONFIG_SPL ) && !defined(CONFIG_SPL_BUILD ) +#define CONFIG_SKIP_LOWLEVEL_INIT +#endif + +#define CONFIG_SYS_UBOOT_START CONFIG_SYS_TEXT_BASE +#define CONFIG_SPL_BSS_START_ADDR 0x80010000 +#define CONFIG_SPL_BSS_MAX_SIZE 0x10000 +#define CONFIG_SPL_MAX_SIZE 0x10000 + +/* Dummy value */ +#define CONFIG_SYS_UBOOT_BASE 0 + +/* Serial SPL */ +#if defined(CONFIG_SPL_BUILD ) && defined(CONFIG_SPL_SERIAL_SUPPORT ) +#define CONFIG_SYS_NS16550_MEM32 +#define CONFIG_SYS_NS16550_CLK 40000000 +#define CONFIG_SYS_NS16550_REG_SIZE -4 +#define CONFIG_SYS_NS16550_COM3 0xb0000e00 +#define CONFIG_CONS_INDEX 3 + +#endif + +/* UART */ +#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, \ + 230400, 460800, 921600 } + +/* RAM */ +#define CONFIG_SYS_MEMTEST_START 0x80100000 +#define CONFIG_SYS_MEMTEST_END 0x80400000 + +/* Memory usage */ +#define CONFIG_SYS_MAXARGS 64 +#define CONFIG_SYS_MALLOC_LEN (1024 * 1024) +#define CONFIG_SYS_BOOTPARAMS_LEN (128 * 1024) +#define CONFIG_SYS_CBSIZE 512 + +/* U-Boot */ +#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE + +/* Environment settings */ +#define CONFIG_BOOTCOMMAND \ + "run fupdate; setenv bootargs ${default_bootargs}mtdparts=${mtdparts} root=/dev/mtdblock5 && bootm
1c050000" +// "load mmc 0:1 85000000 recov.uImage && load mmc 0:1 86000000 recov.squashfs && setenv bootargs ${default_bootargs} mtdparts=${mtdparts} rd_start=0x${fileaddr} rd_size=0x${filesize} && bootm 85000000;"include/configs/vocore2.h new file +4
-0+#define CONFIG_EXTRA_ENV_SETTINGS \ + "default_bootargs=earlyprintk rootwait console=ttyS2,115200\0" \ + "mtdids=nor0=spi0.0\0" \ +"mtdparts=spi0.0:312k(u-boot),4k(env),4k(factory),2368k(kernel),-(filesystem)\0"
\
+ "fupdate=mmc rescan && load mmc 0:1 84000000 uboot.scr && fatrm mmc 0:1 uboot.scr && source 84000000 && echo Flash updated\0"
\
+ "boot_a=echo \"Loading System A\";load mmc 0:5 85000000/boot/uImage; setenv bootargs \"${default_bootargs} mtdparts=${mtdparts} root=/dev/mmcblk0p5\"; bootm ${fileaddr}\0" \
+ "boot_b=echo \"Loading System B\";load mmc 0:6 85000000/boot/uImage; setenv bootargs \"${default_bootargs} mtdparts=${mtdparts} root=/dev/mmcblk0p6\"; bootm ${fileaddr}\0" \
+ "boot_r=echo \"Loading Recovery\"; setenv bootargs \"${default_bootargs} mtdparts=${mtdparts} root=/dev/mtdblock5\"; bootm bc050000\0" \
+ "remove_boot=if env existsBOOT_CURRENT; then setenvBOOT_CURRENT; saveenv; elif env exixtsBOOT_A_GOOD; then setenvBOOT_A_GOOD; saveenv; elif env existsBOOT_B_GOOD; then setenvBOOT_B_GOOD; saveenv; fi\0"
\
+ "boot_now=if test \"${BOOT_CURRENT}\" = A; then runboot_a; elif test \"${BOOT_CURRENT}\" = B; then runboot_b; elif env existsBOOT_A_GOOD; then runboot_a; elif env exists testBOOT_B_GOOD; then runboot_b; else runboot_r; fi\0" \
+ "do_boot=test ${bootcount} -gt 1 && runremove_boot; runboot_now" + // "\0bootcmd=mmc rescan && rundo_boot"
include/configs/vocore2.h
Quoted 2 lines
include/configs/vocore2.h new file +2
-0+ +#endif //__VOCORE2_CONFIG_H__
Viele Grüße,
Stefan Roese
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de
v3 cover Refactor the architecture parts of mt7628
Thanks for the fast answer, Stefan.
Quoted 9 lines · Stefan
Hi Mauro,
===8<----Quoted 3 lines
I tried to use this repo/branch, but something is wrong (or I goofed badly).
Just a quick reply: I tested u-boot-mips/testing today and it works just fine on both LinkIt and the GARDENA board. So there is nothing wrong with this repository AFAICT.
Suspect is there's something wrong with handling of SPL_UART2_SPIS_PINMUX (that's where our boards are different), but I couldn't spot any relevant difference.
Quoted 2 lines
You might need to rebase your patch on top of this branch, as some files might have changes in the meantime.
What is the recommended procedure, in this case?
I did a:
git format-patch --full-index -o ../transport weijie.v3
on old branch ("weijie.v3" is the branch on which I added Weijie's patches, of course), an then I tried simply (on u-boot-mips):
git checkout -b vocore2 testing
git am -3 ../transport/*
Quoted 4 lines
Thanks,
Stefan
===8<----
Regards
Mauro
v3 cover Refactor the architecture parts of mt7628
Quoted 9 lines · Mauro Condarelli
Thanks for the fast answer, Stefan.
Quoted 6 lines · Stefan
Hi Mauro,
===8<----Quoted 3 lines
I tried to use this repo/branch, but something is wrong (or I goofed badly).
Quoted 6 lines
Quoted 3 lines
Just a quick reply: I tested u-boot-mips/testing today and it works just fine on both LinkIt and the GARDENA board. So there is nothing wrong with this repository AFAICT.
Suspect is there's something wrong with handling of
SPL_UART2_SPIS_PINMUX(that's where our boards are different), but I couldn't spot any relevant difference.
Correct, I have not selected this one. You need to select it via "make menuconfig" for your board and save it to your defconfig by "make savedefconfig".
If this does not work, then please double-check, if the correct code is called in this pinx-mux case.
Quoted 9 lines
Quoted 2 lines
You might need to rebase your patch on top of this branch, as some files might have changes in the meantime.
What is the recommended procedure, in this case?
I did a:
git format-patch --full-index -o ../transport weijie.v3
on old branch ("weijie.v3" is the branch on which I added Weijie's patches, of course), an then I tried simply (on u-boot-mips):
git checkout -b vocore2 testing
git am -3 ../transport/*
This sounds like a valid approach.
There are many ways. I usually use "git rebase" for this:
In your case:
- Check out your current working branch
- git checkout -b new-version
- git rebase u-boot-mips/testing
The rebase command will most likely issue some warnings or errors on files that you need to manually fix. After this "git rebase --continue". But the output will tell you, what to do.
But again, your approach looks also fine.
Thanks,
Stefan
v3 cover Refactor the architecture parts of mt7628
In reply to Mauro CondarelliQuoted 33 lines · Mauro Condarelli
Thanks Daniel.
Quoted 9 lines · Daniel Schwierzeck
Hi Mauro,
Am 10.02.20 um 21:20 schrieb Mauro Condarelli:
Quoted 6 lines
FYI
I've been using this patchset for over a week without any adverse effect. It allowed me to port to VoCore2 board.
Should I add a "Tested-by" flag?
If so: how should I do it?Quoted 7 lines
Quoted 3 lines
Regards
Mauro Codarellisorry that I could respond to your questions earlier. I've pushed the complete patch set from Weijie to:
https://gitlab.denx.de/u-boot/custodians/u-boot-mips/commits/testing
I tried to use this repo/branch, but something is wrong (or I goofed badly).
Quoted 3 lines
Maybe this helps you with development. If you have a bootable patch set (you can do MMC later) for your VoCore2 board, please submit a regular patch series based on that branch so that we can review again.
I *do* have a bootable patchset built on top of master + Nemirovsky "reconfigurable cpu clocks" + Weijie v3.
Result is fully working, including net and mmc/SD.This patchset applies cleanly to uboot-mips/testing and compile apparently without errors, but resulting u-boot.bin does not work. By "does not work" I mean it does not utter a single char on debug serial.
Quoted 5 lines
I tried to do a complete diff between my working tree and this non-working one and there are tons of differences, but I couldn't spot anything that might be relevant.
I am unsure on how to proceed; please advise.
but do you reach the U-Boot prompt? If I apply your patch and build it, I need to be able to program the resulting U-Boot image to SPI flash and boot to U-Boot prompt. Also note that the final U-Boot image with SPL is now called u-boot-mtmips.bin. Don't try to use u-boot.bin.
Regarding debug UART you also need to configure the serial driver with "make menuconfig" (register base, clocks, baud rate etc.). There is no driver model or device-tree involved at that point. I think Stefan already told you the correct settings and you need this board_early_init_f magic for the pinmux (don't forget to enable CONFIG_BOARD_EARLY_INIT_F). But for the production mode debug UART should be disabled anyway. SPL UART is different than debug UART. AFAIU the regular driver model and device-tree stuff should work there. For the pinmux you'll need the new CONFIG_SPL_UART2_SPIS_PINMUX option. According to the code, you'll also need to configure CONFIG_CONS_INDEX = 3.
v3 cover Refactor the architecture parts of mt7628
Quoted 38 lines · Daniel Schwierzeck
Quoted 37 lines · Mauro Condarelli
Thanks Daniel.
Quoted 9 lines · Daniel Schwierzeck
Hi Mauro,
Am 10.02.20 um 21:20 schrieb Mauro Condarelli:
Quoted 6 lines
FYI
I've been using this patchset for over a week without any adverse effect. It allowed me to port to VoCore2 board.
Should I add a "Tested-by" flag?
If so: how should I do it?Quoted 7 lines
Quoted 3 lines
Regards
Mauro Codarellisorry that I could respond to your questions earlier. I've pushed the complete patch set from Weijie to:
https://gitlab.denx.de/u-boot/custodians/u-boot-mips/commits/testing
I tried to use this repo/branch, but something is wrong (or I goofed badly).
Quoted 3 lines
Maybe this helps you with development. If you have a bootable patch set (you can do MMC later) for your VoCore2 board, please submit a regular patch series based on that branch so that we can review again.
I *do* have a bootable patchset built on top of master + Nemirovsky "reconfigurable cpu clocks" + Weijie v3.
Result is fully working, including net and mmc/SD.This patchset applies cleanly to uboot-mips/testing and compile apparently without errors, but resulting u-boot.bin does not work. By "does not work" I mean it does not utter a single char on debug serial.
I tried to do a complete diff between my working tree and this non-working one and there are tons of differences, but I couldn't spot anything that might be relevant.
Quoted 6 lines
Quoted 1 line
I am unsure on how to proceed; please advise.
but do you reach the U-Boot prompt? If I apply your patch and build it, I need to be able to program the resulting U-Boot image to SPI flash and boot to U-Boot prompt. Also note that the final U-Boot image with SPL is now called u-boot-mtmips.bin. Don't try to use u-boot.bin.
A quick remark on this, as I've forgotten to write about this:
I would like to change the resulting image name from this specific "u-boot-mips.bin" to the already known "u-boot-with-spl.bin" name. There is no need to introduce a new name here and there is nothing "mtmips" specific in this image type.
Thanks,
Stefan
v3 cover Refactor the architecture parts of mt7628
In reply to Daniel SchwierzeckSorry Daniel,
I seem unable to pass the message through.
I have, in front of me two, very similar directories:
u-boot.master:
built from master + Weijie.v3 patches + my vocore2 patch.
u-boot-mips:
built from u-boot-mips/testing + my vocore2 patch.
I was very careful not to change anything after patching.
In both directories I do:
make ARCH=mips CROSS_COMPILE=mipsel-linux- distclean make ARCH=mips CROSS_COMPILE=mipsel-linux- vocore2_defconfig make ARCH=mips CROSS_COMPILE=mipsel-linux-
Both produce similarly-sized u-boot-mtmips.bin (Flash version) and u-boot.bin (RAM version).
On my target I do:
setenv autoload no; dhcp; tftpboot 80200000 192.168.7.101:u-boot.bin; go ${fileaddr}
In the case of the "master dir I get:
=> setenv autoload no; dhcp; tftpboot 80200000 192.168.7.101:u-boot.bin; go ${fileaddr}
BOOTP broadcast 1
DHCP client bound to address 192.168.7.135 (115 ms)
Using eth at 10110000 device
TFTP from server 192.168.7.101; our IP address is 192.168.7.135 Filename 'u-boot.bin'.
Load address: 0x80200000
Loading: ####################################
1.1 MiB/s
done
Bytes transferred = 527090 (80af2 hex)
## Starting application at 0x80200000 ...
U-Boot 2020.01-00648-gc46834052a-dirty (Feb 11 2020 - 09:30:52 +0100)
CPU: MediaTek MT7628A ver:1 eco:2
Boot: DDR2, SPI-NOR 3-Byte Addr, CPU clock from XTAL
Clock: CPU: 580MHz, Bus: 193MHz, XTAL: 40MHz
Model: VoCore2
DRAM: 128 MiB
WDT: Started with servicing (60s timeout)
MMC: mmc at 10130000: 0
Loading Environment from SPI Flash... SF: Detected w25q128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB
OK
Model: VoCore2
Net:
Warning: eth at 10110000 (eth0) using random MAC address - 26:9f:0f:24:ae:39
eth0: eth at 10110000
Hit any key to stop autoboot: 0
=>
If I do the same with product of "mips" dir I get:
=> setenv autoload no; dhcp; tftpboot 80200000 192.168.7.101:u-boot.bin; go ${fileaddr}
BOOTP broadcast 1
BOOTP broadcast 2
BOOTP broadcast 3
BOOTP broadcast 4
DHCP client bound to address 192.168.7.112 (3136 ms)
Using eth at 10110000 device
TFTP from server 192.168.7.101; our IP address is 192.168.7.112 Filename 'u-boot.bin'.
Load address: 0x80200000
Loading: ####################################
1 MiB/s
done
Bytes transferred = 527390 (80c1e hex)
## Starting application at 0x80200000 ...
<*DEAD*>
I am trying to understand where difference lies... and failing, to date :(
I already sent "my vocore2 patch" (Note: that is a "git rebase -i" squashing the three commits in one, no change) earlier today; if You think it might be useful I can send also the complete "git format-patch" from a known u-boot master commit from where I branched off
(currently 8b9cc858e0239823b051a9324431d511baf2b998)
My "git log --oneline" on "master" is:c46834052a (HEAD -> weijie.v3.vocore.net, syno0/weijie.v3.vocore.net) Move back environment to SPI NOR. Changes to environment default settings. 7dbd7fc8bc Added network setup.375435c35e (syno0/weijie.v3.vocore, weijie.v3.vocore) Add support for SoM "VoCore2".f4fa7f499e (syno0/weijie.v3, weijie.v3) mips: mtmips: add support for mt7628-rfb724463aa9e mips: mtmips: enable SPL for all boards1fe4eda6c3 mips: mtmips: add SPL support5ea8181206 spl: nor: add lzma decompression support for legacy image 173aa9cb6c tools: binman: add etype file for u-boot-lzma-img 789a9085d3 Makefile: add support to generate LZMA compressed u-boot image e4721a8b98 lib: enable lzma decompression support for SPL build b769d64488 mips: add an option to enable u_boot_list section for SPL loaders in u-boot-spl.ldsc704313c7e mips: enable support for appending dtb to spl binary 8801d2b226 dts: mtmips: add alternative pinmux node for uart2 4cda40c3ea mips: mtmips: rewrite lowlevel codes of mt7628 13299d7651 mips: add a option to support not reserving malloc space on initial stackeb8a3689b0 mips: add a mtmips-specific field to architecture-specific global dataf5fda08bed configs: enable CONFIG_RESTORE_EXCEPTION_VECTOR_BASE for all mtmips boardse95f8beabe mips: mtmips: make use of sysreset-resetctrl for mt7628 soc 58246e0175 sysreset: add reset controller based reboot driver b6a20ebced mips: start.S: avoid overwriting outside gd when clearing global data in stackc2359e8947 mips: add an option to support initialize SRAM for initial stack a6eecdd28e mips: mtmips: add predefined i-cache/d-cache size and linesize b096b2e05f mips: add support to restore exception vector base before booting linux2e5b1c00fd MIPS: allow override of get_tbclk()8b9cc858e0 mx7ulp: Move SoC base address to a common file
...
while in the "mips" directory I have:cd23ee2179 (HEAD -> VoCore2) Move back environment to SPI NOR. Changes to environment default settings.ddc07fb968 Added network setup.9eabc0c0bb Add support for SoM "VoCore2".b3d1d5d05b (origin/testing, testing, master) mips: mtmips: add support for mt7628-rfb
As said: there must be some difference, somewhere, but it's not evident (to me) where it is and how to find it.
Thanks in Advance for any advice
Best Regards
Mauro
Quoted 55 lines · Daniel Schwierzeck
Quoted 32 lines · Mauro Condarelli
Thanks Daniel.
Quoted 9 lines · Daniel Schwierzeck
Hi Mauro,
Am 10.02.20 um 21:20 schrieb Mauro Condarelli:
Quoted 6 lines
FYI
I've been using this patchset for over a week without any adverse effect. It allowed me to port to VoCore2 board.
Should I add a "Tested-by" flag?
If so: how should I do it?Quoted 7 lines
Quoted 3 lines
Regards
Mauro Codarellisorry that I could respond to your questions earlier. I've pushed the complete patch set from Weijie to:
https://gitlab.denx.de/u-boot/custodians/u-boot-mips/commits/testing
I tried to use this repo/branch, but something is wrong (or I goofed badly).
Quoted 3 lines
Maybe this helps you with development. If you have a bootable patch set (you can do MMC later) for your VoCore2 board, please submit a regular patch series based on that branch so that we can review again.
I *do* have a bootable patchset built on top of master + Nemirovsky "reconfigurable cpu clocks" + Weijie v3.
Result is fully working, including net and mmc/SD.This patchset applies cleanly to uboot-mips/testing and compile apparently without errors, but resulting u-boot.bin does not work. By "does not work" I mean it does not utter a single char on debug serial.
Quoted 5 lines
I tried to do a complete diff between my working tree and this non-working one and there are tons of differences, but I couldn't spot anything that might be relevant.
I am unsure on how to proceed; please advise.
but do you reach the U-Boot prompt? If I apply your patch and build it, I need to be able to program the resulting U-Boot image to SPI flash and boot to U-Boot prompt. Also note that the final U-Boot image with SPL is now called u-boot-mtmips.bin. Don't try to use u-boot.bin.
Regarding debug UART you also need to configure the serial driver with "make menuconfig" (register base, clocks, baud rate etc.). There is no driver model or device-tree involved at that point. I think Stefan already told you the correct settings and you need this
board_early_init_fmagic for the pinmux (don't forget to enableCONFIG_BOARD_EARLY_INIT_F). But for the production mode debug UART should be disabled anyway. SPL UART is different than debug UART. AFAIU the regular driver model and device-tree stuff should work there. For the pinmux you'll need the newCONFIG_SPL_UART2_SPIS_PINMUXoption. According to the code, you'll also need to configureCONFIG_CONS_INDEX= 3.
v3 cover Refactor the architecture parts of mt7628
Quoted 54 lines · Mauro Condarelli
Sorry Daniel,
I seem unable to pass the message through.I have, in front of me two, very similar directories:
u-boot.master:
built from master + Weijie.v3 patches + my vocore2 patch.u-boot-mips:
built from u-boot-mips/testing + my vocore2 patch.I was very careful not to change anything after patching.
In both directories I do:
make ARCH=mips CROSS_COMPILE=mipsel-linux- distclean make ARCH=mips CROSS_COMPILE=mipsel-linux-
vocore2_defconfigmake ARCH=mips CROSS_COMPILE=mipsel-linux-Both produce similarly-sized u-boot-mtmips.bin (Flash version) and u-boot.bin (RAM version).
On my target I do:
setenv autoload no; dhcp; tftpboot 80200000 192.168.7.101:u-boot.bin; go ${fileaddr}
In the case of the "master dir I get:
=> setenv autoload no; dhcp; tftpboot 80200000 192.168.7.101:u-boot.bin; go ${fileaddr}
BOOTP broadcast 1
DHCP client bound to address 192.168.7.135 (115 ms)
Using eth at 10110000 device
TFTP from server 192.168.7.101; our IP address is 192.168.7.135 Filename 'u-boot.bin'.
Load address:0x80200000
Loading: ####################################1.1 MiB/sdone
Bytes transferred = 527090 (80af2 hex)
## Starting application at0x80200000...U-Boot 2020.01-00648-gc46834052a-dirty (Feb 11 2020 - 09:30:52 +0100)
CPU: MediaTek MT7628A ver:1 eco:2 Boot: DDR2, SPI-NOR 3-Byte Addr, CPU clock from XTAL Clock: CPU: 580MHz, Bus: 193MHz, XTAL: 40MHz Model: VoCore2 DRAM: 128 MiB WDT: Started with servicing (60s timeout) MMC: mmc at 10130000: 0
Quoted 9 lines
Loading Environment from SPI Flash... SF: Detected w25q128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB
OK
Model: VoCore2
Net:
Warning: eth at 10110000 (eth0) using random MAC address - 26:9f:0f:24:ae:39
eth0: eth at 10110000
Hit any key to stop autoboot: 0
=>
ok, booting from RAM works. But what I meant with bootable is, that you can write the
the u-boot-mtmips.bin to SPI flash and do a cold boot. Only then we can merge your patch.
Quoted 75 lines
If I do the same with product of "mips" dir I get:
=> setenv autoload no; dhcp; tftpboot 80200000 192.168.7.101:u-boot.bin; go ${fileaddr}
BOOTP broadcast 1
BOOTP broadcast 2
BOOTP broadcast 3
BOOTP broadcast 4
DHCP client bound to address 192.168.7.112 (3136 ms)
Using eth at 10110000 device
TFTP from server 192.168.7.101; our IP address is 192.168.7.112 Filename 'u-boot.bin'.
Load address:0x80200000
Loading: ####################################1 MiB/sdone
Bytes transferred = 527390 (80c1e hex)
## Starting application at0x80200000...
<*DEAD*>I am trying to understand where difference lies... and failing, to date :(
I already sent "my vocore2 patch" (Note: that is a "git rebase -i" squashing the three commits in one, no change) earlier today; if You think it might be useful I can send also the complete "git format-patch" from a known u-boot master commit from where I branched off
(currently8b9cc858e0239823b051a9324431d511baf2b998)My "git log --oneline" on "master" is:
c46834052a(HEAD -> weijie.v3.vocore.net, syno0/weijie.v3.vocore.net) Move back environment to SPI NOR. Changes to environment default settings.7dbd7fc8bcAdded network setup.375435c35e(syno0/weijie.v3.vocore, weijie.v3.vocore) Add support for SoM "VoCore2".f4fa7f499e(syno0/weijie.v3, weijie.v3) mips: mtmips: add support for mt7628-rfb724463aa9emips: mtmips: enable SPL for all boards1fe4eda6c3mips: mtmips: add SPL support5ea8181206spl: nor: add lzma decompression support for legacy image173aa9cb6ctools: binman: add etype file for u-boot-lzma-img789a9085d3Makefile: add support to generate LZMA compressed u-boot imagee4721a8b98lib: enable lzma decompression support for SPL buildb769d64488mips: add an option to enableu_boot_listsection for SPL loaders inu-boot-spl.ldsc704313c7emips: enable support for appending dtb to spl binary8801d2b226dts: mtmips: add alternative pinmux node for uart24cda40c3eamips: mtmips: rewrite lowlevel codes of mt762813299d7651mips: add a option to support not reserving malloc space on initial stackeb8a3689b0mips: add a mtmips-specific field to architecture-specific global dataf5fda08bedconfigs: enableCONFIG_RESTORE_EXCEPTION_VECTOR_BASEfor all mtmips boardse95f8beabemips: mtmips: make use of sysreset-resetctrl for mt7628 soc58246e0175sysreset: add reset controller based reboot driverb6a20ebcedmips:start.S: avoid overwriting outside gd when clearing global data in stackc2359e8947mips: add an option to support initialize SRAM for initial stacka6eecdd28emips: mtmips: add predefined i-cache/d-cache size and linesizeb096b2e05fmips: add support to restore exception vector base before booting linux2e5b1c00fdMIPS: allow override ofget_tbclk()8b9cc858e0mx7ulp: Move SoC base address to a common file
...while in the "mips" directory I have:
cd23ee2179(HEAD -> VoCore2) Move back environment to SPI NOR. Changes to environment default settings.ddc07fb968Added network setup.9eabc0c0bbAdd support for SoM "VoCore2".b3d1d5d05b(origin/testing, testing, master) mips: mtmips: add support for mt7628-rfb
Quoted 46 lines
As said: there must be some difference, somewhere, but it's not evident (to me) where it is and how to find it.
Thanks in Advance for any advice
Best Regards
MauroQuoted 38 lines · Daniel Schwierzeck
Quoted 37 lines · Mauro Condarelli
Thanks Daniel.
Quoted 9 lines · Daniel Schwierzeck
Hi Mauro,
Am 10.02.20 um 21:20 schrieb Mauro Condarelli:
Quoted 6 lines
FYI
I've been using this patchset for over a week without any adverse effect. It allowed me to port to VoCore2 board.
Should I add a "Tested-by" flag?
If so: how should I do it?Quoted 7 lines
Quoted 3 lines
Regards
Mauro Codarellisorry that I could respond to your questions earlier. I've pushed the complete patch set from Weijie to:
https://gitlab.denx.de/u-boot/custodians/u-boot-mips/commits/testing
I tried to use this repo/branch, but something is wrong (or I goofed badly).
Quoted 3 lines
Maybe this helps you with development. If you have a bootable patch set (you can do MMC later) for your VoCore2 board, please submit a regular patch series based on that branch so that we can review again.
I *do* have a bootable patchset built on top of master + Nemirovsky "reconfigurable cpu clocks" + Weijie v3.
Result is fully working, including net and mmc/SD.This patchset applies cleanly to uboot-mips/testing and compile apparently without errors, but resulting u-boot.bin does not work. By "does not work" I mean it does not utter a single char on debug serial.
I tried to do a complete diff between my working tree and this non-working one and there are tons of differences, but I couldn't spot anything that might be relevant.
I am unsure on how to proceed; please advise.
maybe you have a big diff because you are not on the latest master branch. I currently
have ae347120eed8204b1fdf018ddf79131964e57016. The u-boot-mips/testing is based on u-boot-mips/next and only contains Weijie's v3 patches from 14/20 to 20/20. For
u-boot-mips/next I intend to create a pull request soon. The existing mtmips boards should
still work without SPL support. Maybe Stefan could give it a quick test.
Maybe I messed something up in u-boot-mips/testing. There were some merge conflicts.
Could you build a new patch queue on top of u-boot-mips/next with the remaining Weijie v3 patches and your VoCore2 patches?
As long as all u-boot-mips changes aren't merged to mainline, your patches must work with
the latest u-boot-mips/next branch. There could always be new and incompatible changes
in mainline or in other MIPS patches which you have to figure out then.
Signature · 1 line
- Daniel
v3 cover Refactor the architecture parts of mt7628
Thanks Daniel.
Quoted 8 lines · Daniel Schwierzeck
Quoted 3 lines · Mauro Condarelli
===8<----
Hit any key to stop autoboot: 0
=>ok, booting from RAM works. But what I meant with bootable is, that you can write the
the u-boot-mtmips.bin to SPI flash and do a cold boot. Only then we can merge your patch.
It *does* work.
The U-Boot I have flashed is essentially the same as the one built in the "master" directory, just a few days old (I changed essentially my project-specific CONFIG_EXTRA_ENV_SETTINGS).
... which reminds me of something...
... it turns out that flashing *does* work:
=> setenv autoload no; dhcp; tftpboot 85000000 192.168.7.101:u-boot-mtmips.bin; sf probe; sf update ${fileaddr} 0 ${filesize}
BOOTP broadcast 1
BOOTP broadcast 2
BOOTP broadcast 3
BOOTP broadcast 4
DHCP client bound to address 192.168.7.110 (2953 ms) Using eth at 10110000 device
TFTP from server 192.168.7.101; our IP address is 192.168.7.110 Filename 'u-boot-mtmips.bin'.
Load address: 0x85000000
Loading: #################
762.7 KiB/s
done
Bytes transferred = 244458 (3baea hex)
device 0 offset 0x0, size 0x3baea
240362 bytes written, 4096 bytes skipped in 2.232s, speed 111952 B/s => reset
resetting ...
U-Boot SPL 2020.04-rc1-01620-gcd23ee2179 (Feb 11 2020 - 18:33:48 +0100) Trying to boot from NOR
U-Boot 2020.04-rc1-01620-gcd23ee2179 (Feb 11 2020 - 18:33:48 +0100)
CPU: MediaTek MT7628A ver:1 eco:2
Boot: DDR2, SPI-NOR 3-Byte Addr, CPU clock from XTAL
Clock: CPU: 580MHz, Bus: 193MHz, XTAL: 40MHz
Model: VoCore2
DRAM: 128 MiB
WDT: Started with servicing (60s timeout)
MMC: mmc at 10130000: 0
Loading Environment from SPI Flash... SF: Detected w25q128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB
OK
Model: VoCore2
Net:
Warning: eth at 10110000 (eth0) using random MAC address - 8a:fb:d0:3b:d1:93
eth0: eth at 10110000
Hit any key to stop autoboot: 0
=>
What *does NOT* work is loading RAM version or, to be more precise:
It works IF (and only if) you load the same code already running. I *think* this is because current Weijie code unpacks to this same location (80200000) before relocating. If you are rewriting the same code in the same location any cache inconsistencies are unimportant, otherwise Bad Things happen.
I spoke with Stephan about this, but we never found a fix.
Now that I reflashed "u-boot-mips/testing" version I can run it also "from RAM", while trying to load "master" hangs (I tried just now).
If this is considered "acceptable" (probably it has nothing to do with my vocore2 port) I can clean-up my patches and resubmit.
I'm not a mips expert and I don't know how to debug this "RAM load" misbehavior, but I'm available for testing, if useful.
Quoted 24 lines
Quoted 15 lines
===8<---
Quoted 14 lines
Quoted 14 lines
I *do* have a bootable patchset built on top of master + Nemirovsky "reconfigurable cpu clocks" + Weijie v3.
Result is fully working, including net and mmc/SD.This patchset applies cleanly to uboot-mips/testing and compile apparently without errors, but resulting u-boot.bin does not work. By "does not work" I mean it does not utter a single char on debug serial.
I tried to do a complete diff between my working tree and this non-working one and there are tons of differences, but I couldn't spot anything that might be relevant.
I am unsure on how to proceed; please advise.
maybe you have a big diff because you are not on the latest master branch. I currently
haveae347120eed8204b1fdf018ddf79131964e57016. The u-boot-mips/testing is based on u-boot-mips/next and only contains Weijie's v3 patches from 14/20 to 20/20. For
u-boot-mips/next I intend to create a pull request soon. The existing mtmips boards should
still work without SPL support. Maybe Stefan could give it a quick test.
Quoted 2 lines
Maybe I messed something up in u-boot-mips/testing. There were some merge conflicts.
I don't think so.
As said problem is with RAM loading.
Quoted 2 lines
Could you build a new patch queue on top of u-boot-mips/next with the remaining Weijie v3 patches and your VoCore2 patches?
I can do that if You think it's still useful, otherwise we can just use testing.
Quoted 4 lines
As long as all u-boot-mips changes aren't merged to mainline, your patches must work with
the latest u-boot-mips/next branch. There could always be new and incompatible changes
Understood.
Quoted 1 line
in mainline or in other MIPS patches which you have to figure out then.
I don't think there'll be problems.
My patches are quite basic and board-only.
I plan to clean my patch expunging all project-specific stuff, rebase from the (current) tip of uboot-mips-mips/testing and resubmit (unless You tell me to do something different, of course).
For the Ram-lading problem I do not currently plan any action, but I'm available.
Best Regards (and pardon me for the noise, please) Mauro Condarelli
v3 cover Refactor the architecture parts of mt7628
Hi Mauro,
Hi Daniel,
Quoted 72 lines · Mauro Condarelli
Thanks Daniel.
Quoted 8 lines · Daniel Schwierzeck
Quoted 3 lines · Mauro Condarelli
===8<----
Hit any key to stop autoboot: 0
=>ok, booting from RAM works. But what I meant with bootable is, that you can write the
the u-boot-mtmips.bin to SPI flash and do a cold boot. Only then we can merge your patch.It *does* work.
The U-Boot I have flashed is essentially the same as the one built in the "master" directory, just a few days old (I changed essentially my project-specificCONFIG_EXTRA_ENV_SETTINGS).... which reminds me of something...
... it turns out that flashing *does* work:
=> setenv autoload no; dhcp; tftpboot 85000000 192.168.7.101:u-boot-mtmips.bin; sf probe; sf update ${fileaddr} 0 ${filesize}
BOOTP broadcast 1
BOOTP broadcast 2
BOOTP broadcast 3
BOOTP broadcast 4
DHCP client bound to address 192.168.7.110 (2953 ms) Using eth at 10110000 device
TFTP from server 192.168.7.101; our IP address is 192.168.7.110 Filename 'u-boot-mtmips.bin'.
Load address:0x85000000
Loading: #################
762.7 KiB/s
done
Bytes transferred = 244458 (3baea hex)
device 0 offset0x0, size0x3baea
240362 bytes written, 4096 bytes skipped in 2.232s, speed 111952 B/s => reset
resetting ...U-Boot SPL 2020.04-rc1-01620-gcd23ee2179 (Feb 11 2020 - 18:33:48 +0100) Trying to boot from NOR
U-Boot 2020.04-rc1-01620-gcd23ee2179 (Feb 11 2020 - 18:33:48 +0100)
CPU: MediaTek MT7628A ver:1 eco:2
Boot: DDR2, SPI-NOR 3-Byte Addr, CPU clock from XTAL
Clock: CPU: 580MHz, Bus: 193MHz, XTAL: 40MHz
Model: VoCore2
DRAM: 128 MiB
WDT: Started with servicing (60s timeout)
MMC: mmc at 10130000: 0
Loading Environment from SPI Flash... SF: Detected w25q128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB
OK
Model: VoCore2
Net:
Warning: eth at 10110000 (eth0) using random MAC address - 8a:fb:d0:3b:d1:93
eth0: eth at 10110000
Hit any key to stop autoboot: 0
=>What *does NOT* work is loading RAM version or, to be more precise:
It works IF (and only if) you load the same code already running. I *think* this is because current Weijie code unpacks to this same location (80200000) before relocating. If you are rewriting the same code in the same location any cache inconsistencies are unimportant, otherwise Bad Things happen.
I spoke with Stephan about this, but we never found a fix.
Quoted 7 lines
Now that I reflashed "u-boot-mips/testing" version I can run it also "from RAM", while trying to load "master" hangs (I tried just now).
If this is considered "acceptable" (probably it has nothing to do with my vocore2 port) I can clean-up my patches and resubmit.
I'm not a mips expert and I don't know how to debug this "RAM load" misbehavior, but I'm available for testing, if useful.
I also noticed that "RAM loading" the U-Boot proper does not work all the time on my MT7688 targets. It seems to depend on the image size and some other factors (moon phase...). ;)
So there is very likely a bug somewhere hidden - perhaps in the relocaton code. I will probably try to dig into this in sometime soon. But I need a reproducable "bad" image for this. Right now, RAM loading is working just fine.
BTW: I noticed that RAM loading does work even when loading into a different address than TEXT_BASE. On the new MTMIPS targets TEXT_BASE is 0x80200000 and loadind to e.g. 0x81000000 does also work.
Daniel, perhaps a dumb question, but is the MIPS U-Boot code position independant?
Mauro, please try loading into a different address on your non-working setup and report back if RAM loading works in this case.
Quoted 25 lines
Quoted 25 lines
Quoted 16 lines
===8<---
Quoted 14 lines
Quoted 14 lines
I *do* have a bootable patchset built on top of master + Nemirovsky "reconfigurable cpu clocks" + Weijie v3.
Result is fully working, including net and mmc/SD.This patchset applies cleanly to uboot-mips/testing and compile apparently without errors, but resulting u-boot.bin does not work. By "does not work" I mean it does not utter a single char on debug serial.
I tried to do a complete diff between my working tree and this non-working one and there are tons of differences, but I couldn't spot anything that might be relevant.
I am unsure on how to proceed; please advise.
maybe you have a big diff because you are not on the latest master branch. I currently
haveae347120eed8204b1fdf018ddf79131964e57016. The u-boot-mips/testing is based on u-boot-mips/next and only contains Weijie's v3 patches from 14/20 to 20/20. For
u-boot-mips/next I intend to create a pull request soon. The existing mtmips boards should
still work without SPL support. Maybe Stefan could give it a quick test.
Quoted 4 lines
Quoted 2 lines
Maybe I messed something up in u-boot-mips/testing. There were some merge conflicts.
I don't think so.
As said problem is with RAM loading.
I also have this problem (sometimes). Please see above.
Quoted 15 lines
Quoted 2 lines
Could you build a new patch queue on top of u-boot-mips/next with the remaining Weijie v3 patches and your VoCore2 patches?
I can do that if You think it's still useful, otherwise we can just use testing.
Quoted 4 lines
As long as all u-boot-mips changes aren't merged to mainline, your patches must work with
the latest u-boot-mips/next branch. There could always be new and incompatible changesUnderstood.
Quoted 1 line
in mainline or in other MIPS patches which you have to figure out then.
I don't think there'll be problems.
My patches are quite basic and board-only.
Quoted 7 lines
I plan to clean my patch expunging all project-specific stuff, rebase from the (current) tip of uboot-mips-mips/testing and resubmit (unless You tell me to do something different, of course).
For the Ram-lading problem I do not currently plan any action, but I'm available.
A test with a different load address would be interesting.
Thanks,
Stefan
v3 cover Refactor the architecture parts of mt7628
Hi Stefan,
Hi Daniel,
Quoted 17 lines · Stefan
Hi Mauro,
Hi Daniel,Quoted 11 lines · Mauro Condarelli
===8<---
What *does NOT* work is loading RAM version or, to be more precise:
It works IF (and only if) you load the same code already running. I *think* this is because current Weijie code unpacks to this same location
(80200000) before relocating. If you are rewriting the same code in the same location any cache inconsistencies are unimportant, otherwise Bad Things happen.
I spoke with Stephan about this, but we never found a fix.Quoted 1 line
===8<---
Quoted 8 lines
I also noticed that "RAM loading" the U-Boot proper does not work all the time on my MT7688 targets. It seems to depend on the image size and some other factors (moon phase...). ;)
So there is very likely a bug somewhere hidden - perhaps in the relocaton code. I will probably try to dig into this in sometime soon. But I need a reproducable "bad" image for this. Right now, RAM loading is working just fine.
As said: In my setup RAM loading is consistently failing if I try to load an u-boot build consistently different from the one currently running. OTOH loading the same (or very similar, a rebuild is considered "the same") version is _always_ working for me.
To rephrase: I have two setups; one based on master+weijiev3 and the other based on plain mtmips/testing.
I can flash either one and it works from SPI NOR. no problems here. I can always RAM load successfully the same kernel as flashed. If I RAM load the "other" setup it always fails.
I did a few tests:
- erasing download area (mw.b 80200000 0 80000).
- do some other loading (e.g.: the Linux kernel) between RAM load and "go" (attempt to clean caches, but I suspect this would only effectively clear D-cache, not I-cache).
The above behavior does not change.
Quoted 4 lines
BTW: I noticed that RAM loading does work even when loading into a different address than
TEXT_BASE. On the new MTMIPS targetsTEXT_BASEis0x80200000and loadind to e.g.0x81000000does also work.
I do confirm this:
setenv autoload no; dhcp; tftpboot 81000000 192.168.7.101:u-boot.bin-mips.testing; go ${fileaddr} works as expected (loading same-as-flashed)
Quoted 6 lines
Daniel, perhaps a dumb question, but is the MIPS U-Boot code position independant?
Mauro, please try loading into a different address on your non-working setup and report back if RAM loading works in this case.
Attempt to load, even at different address, the "other" u-boot fails:
setenv autoload no; dhcp; tftpboot 81000000 192.168.7.101:u-boot.bin-weijie.v3.vocore2; go ${fileaddr} hangs after "## Starting application at 0x81000000 ..." (I currently have in SPI NOR the u-boot-mtmips.bin-mips.testing built together u-boot.bin-mips.testing).
Quoted 11 lines
Quoted 3 lines
===8<---
I don't think so.
As said problem is with RAM loading.I also have this problem (sometimes). Please see above.
Quoted 3 lines
===8<---
For the Ram-lading problem I do not currently plan any action, but I'm available.A test with a different load address would be interesting.
Done (see above).
Tell me if You want me to rebuild with a different TEXT_BASE and test that.
Quoted 3 lines
Thanks,
Stefan
Regards
Mauro
v3 cover Refactor the architecture parts of mt7628
Hi Mauro,
Quoted 60 lines · Mauro Condarelli
Hi Stefan,
Hi Daniel,Quoted 17 lines · Stefan
Hi Mauro,
Hi Daniel,Quoted 11 lines · Mauro Condarelli
===8<---
What *does NOT* work is loading RAM version or, to be more precise:
It works IF (and only if) you load the same code already running. I *think* this is because current Weijie code unpacks to this same location
(80200000) before relocating. If you are rewriting the same code in the same location any cache inconsistencies are unimportant, otherwise Bad Things happen.
I spoke with Stephan about this, but we never found a fix.Quoted 1 line
===8<---
Quoted 8 lines
I also noticed that "RAM loading" the U-Boot proper does not work all the time on my MT7688 targets. It seems to depend on the image size and some other factors (moon phase...). ;)
So there is very likely a bug somewhere hidden - perhaps in the relocaton code. I will probably try to dig into this in sometime soon. But I need a reproducable "bad" image for this. Right now, RAM loading is working just fine.
As said: In my setup RAM loading is consistently failing if I try to load an u-boot build consistently different from the one currently running. OTOH loading the same (or very similar, a rebuild is considered "the same") version is _always_ working for me.
To rephrase: I have two setups; one based on master+weijiev3 and the other based on plain mtmips/testing.
I can flash either one and it works from SPI NOR. no problems here. I can always RAM load successfully the same kernel as flashed. If I RAM load the "other" setup it always fails.I did a few tests:
- erasing download area (mw.b 80200000 0 80000).
- do some other loading (e.g.: the Linux kernel) between RAM load and "go" (attempt to clean caches, but I suspect this would only effectively clear D-cache, not I-cache).
The above behavior does not change.Quoted 4 lines
BTW: I noticed that RAM loading does work even when loading into a different address than
TEXT_BASE. On the new MTMIPS targetsTEXT_BASEis0x80200000and loadind to e.g.0x81000000does also work.I do confirm this:
setenv autoload no; dhcp; tftpboot 81000000
192.168.7.101:u-boot.bin-mips.testing; go ${fileaddr} works as expected (loading same-as-flashed)Quoted 4 lines
Daniel, perhaps a dumb question, but is the MIPS U-Boot code position independant?
Quoted 8 lines
Quoted 2 lines
Mauro, please try loading into a different address on your non-working setup and report back if RAM loading works in this case.
Attempt to load, even at different address, the "other" u-boot fails:
setenv autoload no; dhcp; tftpboot 81000000
192.168.7.101:u-boot.bin-weijie.v3.vocore2; go ${fileaddr} hangs after "## Starting application at0x81000000..." (I currently have in SPI NOR the u-boot-mtmips.bin-mips.testing built together u-boot.bin-mips.testing).
Could you please apply the new cmd/boot.c patch I've sent just a few minutes ago [1] and burn this image into flash. And please test with this image, if RAM booting of other, different images does work for you now.
And sorry, using a different TEXT_BASE does not seem to work. Somehow I seem to have goofed up this morning in my tests. Please use always the correct TEXT_BASE as load address for the RAM image.
Thanks,
Stefan
v3 cover Refactor the architecture parts of mt7628
In reply to Mauro CondarelliQuoted 49 lines · Mauro Condarelli
Hi Stefan,
Hi Daniel,Quoted 17 lines · Stefan
Hi Mauro,
Hi Daniel,Quoted 11 lines · Mauro Condarelli
===8<---
What *does NOT* work is loading RAM version or, to be more precise:
It works IF (and only if) you load the same code already running. I *think* this is because current Weijie code unpacks to this same location
(80200000) before relocating. If you are rewriting the same code in the same location any cache inconsistencies are unimportant, otherwise Bad Things happen.
I spoke with Stephan about this, but we never found a fix.Quoted 1 line
===8<---
Quoted 8 lines
I also noticed that "RAM loading" the U-Boot proper does not work all the time on my MT7688 targets. It seems to depend on the image size and some other factors (moon phase...). ;)
So there is very likely a bug somewhere hidden - perhaps in the relocaton code. I will probably try to dig into this in sometime soon. But I need a reproducable "bad" image for this. Right now, RAM loading is working just fine.
As said: In my setup RAM loading is consistently failing if I try to load an u-boot build consistently different from the one currently running. OTOH loading the same (or very similar, a rebuild is considered "the same") version is _always_ working for me.
To rephrase: I have two setups; one based on master+weijiev3 and the other based on plain mtmips/testing.
I can flash either one and it works from SPI NOR. no problems here. I can always RAM load successfully the same kernel as flashed. If I RAM load the "other" setup it always fails.I did a few tests:
- erasing download area (mw.b 80200000 0 80000).
- do some other loading (e.g.: the Linux kernel) between RAM load and "go" (attempt to clean caches, but I suspect this would only effectively clear D-cache, not I-cache).
The above behavior does not change.Quoted 1 line
Quoted 11 lines
Quoted 3 lines
BTW: I noticed that RAM loading does work even when loading into a different address than
TEXT_BASE. On the new MTMIPS targetsTEXT_BASEis0x80200000and loadind to e.g.0x81000000does also work.I do confirm this:
setenv autoload no; dhcp; tftpboot 81000000
192.168.7.101:u-boot.bin-mips.testing; go ${fileaddr} works as expected (loading same-as-flashed)Quoted 3 lines
Daniel, perhaps a dumb question, but is the MIPS U-Boot code position independant?
from your tests I can only conclude that RAM loading doesn't work at all. If you see it
"working" than you simply junp to the old copy which the SPL created. A MIPS U-Boot
is always built with position-dependant code. To make the U-Boot binary relocatable,
we use the tools/mips-relocs.c which was ported from Linux. During linking we let gcc
emit relocation entries which are post-processed by the mips-relocs tool. The output
is then inserted into u-boot.bin in section ".data.reloc". Those reloc entries are then
used by the MIPS relocation code to patch all symbols with the relative offset to the
new text address.
If you build for example the Gardena Smart Gateway and disassemble the u-boot binary (which becomes the SPL payload), the very first instruction is this:
80200000 <_start>:
#endif
.endm
ENTRY(_start)
/* U-Boot entry point */
b reset
80200000: 1000013f b 80200500 <reset>
mtc0 zero, CP0_COUNT # clear cp0 count for most accurate boot timing
80200004: 40804800 mtc0 zero,c0_countSo if you load u-boot.bin to a different address than 0x80200000 and jump to it, the first instruction is a jump back to address 0x80200500. If the old SPL copy of u-boot.bin is still there, you'll see a "working" RAM boot.
Actually Mauro already did the right thing with erasing the load area at 0x80200000
before downloading a new binary.
A stable approach to a RAM boot binary (which I use in my out-of-tree boards) would be to use a KSEG1 text address e.g. 0xa0200000 and explicitely switch the CPU to non-caching mode (this is normally skipped with CONFIG_SKIP_LOWLEVEL_INIT in the SPL payload). This approach always worked for me for booting via UART or EJTAG without getting messed up by cache effects.
So either we officially drop RAM boot support for mtmips platform (respectively don't use the u-boot.bin intended for SPL payload as RAM boot binary) or we keep the
special RAM boot configs.
Signature · 1 line
- Daniel
v3 cover Refactor the architecture parts of mt7628
Hi Daniel,
On 12.02.20 13:48, Daniel Schwierzeck wrote:
<snip>
Quoted 29 lines
Quoted 2 lines
Quoted 2 lines
Daniel, perhaps a dumb question, but is the MIPS U-Boot code position independant?
from your tests I can only conclude that RAM loading doesn't work at all. If you see it
"working" than you simply junp to the old copy which the SPL created. A MIPS U-Boot
is always built with position-dependant code. To make the U-Boot binary relocatable,
we use thetools/mips-relocs.cwhich was ported from Linux. During linking we let gcc
emit relocation entries which are post-processed by the mips-relocs tool. The output
is then inserted into u-boot.bin in section ".data.reloc". Those reloc entries are then
used by the MIPS relocation code to patch all symbols with the relative offset to the
new text address.If you build for example the Gardena Smart Gateway and disassemble the u-boot binary (which becomes the SPL payload), the very first instruction is this:
80200000 <
_start>:
#endif
.endm
ENTRY(_start)/* U-Boot entry point */ b reset
Quoted 7 lines
80200000:
1000013fb 80200500 <reset>
mtc0 zero,CP0_COUNT# clear cp0 count for most accurate boot timing
80200004: 40804800 mtc0 zero,c0_countSo if you load u-boot.bin to a different address than
0x80200000and jump to it, the first instruction is a jump back to address0x80200500. If the old SPL copy of u-boot.bin is still there, you'll see a "working" RAM boot.
Thanks for this analysis. This is exactly what happened in my test this morning.
Quoted 11 lines
Actually Mauro already did the right thing with erasing the load area at
0x80200000
before downloading a new binary.A stable approach to a RAM boot binary (which I use in my out-of-tree boards) would be to use a KSEG1 text address e.g.
0xa0200000and explicitely switch the CPU to non-caching mode (this is normally skipped withCONFIG_SKIP_LOWLEVEL_INITin the SPL payload). This approach always worked for me for booting via UART or EJTAG without getting messed up by cache effects.
Quoted 4 lines
So either we officially drop RAM boot support for mtmips platform (respectively don't use the u-boot.bin intended for SPL payload as RAM boot binary) or we keep the
special RAM boot configs.
I assume that you are also okay with the cache flush approach? I'll send v2 of this patch pretty soon if nobody objects.
Thanks,
Stefan