Message ID | 01b666a8fed92d08e21204201144b9fd624cd50d.1542246777.git.ryder.lee@mediatek.com |
---|---|
State | Accepted |
Commit | 361e13f1d5c893caf40a6026405c0e1b615e90ea |
Delegated to: | Tom Rini |
Headers | show |
Series | Add U-Boot support for MediaTek SoCs - MT7623n & MT7629 | expand |
Hi, On 14 November 2018 at 18:07, Ryder Lee <ryder.lee@mediatek.com> wrote: > From: Weijie Gao <weijie.gao@mediatek.com> > > This adds a general board file based on MT7623 SoCs from MediaTek. > > As this u-boot is loaded by MTK proprietary preloader, there is no > low level initializtion codes. > > Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> > Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> > Tested-by: Matthias Brugger <matthias.bgg@gmail.com> > --- > Changes since v5: None > Changes since v4: > -Add gd->bd->bi_boot_params for legacy method - ATAGs. > --- > arch/arm/mach-mediatek/Kconfig | 13 ++++ > arch/arm/mach-mediatek/Makefile | 1 + > arch/arm/mach-mediatek/mt7623/Makefile | 4 ++ > arch/arm/mach-mediatek/mt7623/init.c | 54 +++++++++++++++ > arch/arm/mach-mediatek/mt7623/lowlevel_init.S | 22 ++++++ > arch/arm/mach-mediatek/mt7623/preloader.h | 99 +++++++++++++++++++++++++++ > board/mediatek/mt7623/Kconfig | 13 ++++ > board/mediatek/mt7623/MAINTAINERS | 7 ++ > board/mediatek/mt7623/Makefile | 3 + > board/mediatek/mt7623/mt7623_rfb.c | 16 +++++ > configs/mt7623n_bpir2_defconfig | 54 +++++++++++++++ > include/configs/mt7623.h | 56 +++++++++++++++ > 12 files changed, 342 insertions(+) > create mode 100644 arch/arm/mach-mediatek/mt7623/Makefile > create mode 100644 arch/arm/mach-mediatek/mt7623/init.c > create mode 100644 arch/arm/mach-mediatek/mt7623/lowlevel_init.S > create mode 100644 arch/arm/mach-mediatek/mt7623/preloader.h > create mode 100644 board/mediatek/mt7623/Kconfig > create mode 100644 board/mediatek/mt7623/MAINTAINERS > create mode 100644 board/mediatek/mt7623/Makefile > create mode 100644 board/mediatek/mt7623/mt7623_rfb.c > create mode 100644 configs/mt7623n_bpir2_defconfig > create mode 100644 include/configs/mt7623.h Can this use the bloblist feature which should land soon? For now, see dm/spl-working. Regards, Simon
On Thu, 2018-11-15 at 11:21 -0800, Simon Glass wrote: > Hi, > > On 14 November 2018 at 18:07, Ryder Lee <ryder.lee@mediatek.com> wrote: > > From: Weijie Gao <weijie.gao@mediatek.com> > > > > This adds a general board file based on MT7623 SoCs from MediaTek. > > > > As this u-boot is loaded by MTK proprietary preloader, there is no > > low level initializtion codes. > > > > Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> > > Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> > > Tested-by: Matthias Brugger <matthias.bgg@gmail.com> > > --- > > Changes since v5: None > > Changes since v4: > > -Add gd->bd->bi_boot_params for legacy method - ATAGs. > > --- > > arch/arm/mach-mediatek/Kconfig | 13 ++++ > > arch/arm/mach-mediatek/Makefile | 1 + > > arch/arm/mach-mediatek/mt7623/Makefile | 4 ++ > > arch/arm/mach-mediatek/mt7623/init.c | 54 +++++++++++++++ > > arch/arm/mach-mediatek/mt7623/lowlevel_init.S | 22 ++++++ > > arch/arm/mach-mediatek/mt7623/preloader.h | 99 +++++++++++++++++++++++++++ > > board/mediatek/mt7623/Kconfig | 13 ++++ > > board/mediatek/mt7623/MAINTAINERS | 7 ++ > > board/mediatek/mt7623/Makefile | 3 + > > board/mediatek/mt7623/mt7623_rfb.c | 16 +++++ > > configs/mt7623n_bpir2_defconfig | 54 +++++++++++++++ > > include/configs/mt7623.h | 56 +++++++++++++++ > > 12 files changed, 342 insertions(+) > > create mode 100644 arch/arm/mach-mediatek/mt7623/Makefile > > create mode 100644 arch/arm/mach-mediatek/mt7623/init.c > > create mode 100644 arch/arm/mach-mediatek/mt7623/lowlevel_init.S > > create mode 100644 arch/arm/mach-mediatek/mt7623/preloader.h > > create mode 100644 board/mediatek/mt7623/Kconfig > > create mode 100644 board/mediatek/mt7623/MAINTAINERS > > create mode 100644 board/mediatek/mt7623/Makefile > > create mode 100644 board/mediatek/mt7623/mt7623_rfb.c > > create mode 100644 configs/mt7623n_bpir2_defconfig > > create mode 100644 include/configs/mt7623.h > > Can this use the bloblist feature which should land soon? > > For now, see dm/spl-working. > > Regards, > Simon Hi Simon, I've read the code for spl handoff. It's a good way though but unfortunately it cannot be applied to the MT7623 boards. The reason is that MT7623 uses a MediaTek proprietary preloader which has the same function as the U-Boot SPL. But the preloader is close-sourced (by company policy) and only available in binary release. This means we can't use a real U-Boot SPL to replace the preloader. At present this chip has already been used in many products. We can't either release a different preloader which introduces compatibility issues. So the conclusion is that we cannot use the bloblist feature for this SoC. Best Regards, Weijie
Hi Weijie, On 15 November 2018 at 23:08, Weijie Gao <weijie.gao@mediatek.com> wrote: > On Thu, 2018-11-15 at 11:21 -0800, Simon Glass wrote: >> Hi, >> >> On 14 November 2018 at 18:07, Ryder Lee <ryder.lee@mediatek.com> wrote: >> > From: Weijie Gao <weijie.gao@mediatek.com> >> > >> > This adds a general board file based on MT7623 SoCs from MediaTek. >> > >> > As this u-boot is loaded by MTK proprietary preloader, there is no >> > low level initializtion codes. >> > >> > Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> >> > Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> >> > Tested-by: Matthias Brugger <matthias.bgg@gmail.com> >> > --- >> > Changes since v5: None >> > Changes since v4: >> > -Add gd->bd->bi_boot_params for legacy method - ATAGs. >> > --- >> > arch/arm/mach-mediatek/Kconfig | 13 ++++ >> > arch/arm/mach-mediatek/Makefile | 1 + >> > arch/arm/mach-mediatek/mt7623/Makefile | 4 ++ >> > arch/arm/mach-mediatek/mt7623/init.c | 54 +++++++++++++++ >> > arch/arm/mach-mediatek/mt7623/lowlevel_init.S | 22 ++++++ >> > arch/arm/mach-mediatek/mt7623/preloader.h | 99 +++++++++++++++++++++++++++ >> > board/mediatek/mt7623/Kconfig | 13 ++++ >> > board/mediatek/mt7623/MAINTAINERS | 7 ++ >> > board/mediatek/mt7623/Makefile | 3 + >> > board/mediatek/mt7623/mt7623_rfb.c | 16 +++++ >> > configs/mt7623n_bpir2_defconfig | 54 +++++++++++++++ >> > include/configs/mt7623.h | 56 +++++++++++++++ >> > 12 files changed, 342 insertions(+) >> > create mode 100644 arch/arm/mach-mediatek/mt7623/Makefile >> > create mode 100644 arch/arm/mach-mediatek/mt7623/init.c >> > create mode 100644 arch/arm/mach-mediatek/mt7623/lowlevel_init.S >> > create mode 100644 arch/arm/mach-mediatek/mt7623/preloader.h >> > create mode 100644 board/mediatek/mt7623/Kconfig >> > create mode 100644 board/mediatek/mt7623/MAINTAINERS >> > create mode 100644 board/mediatek/mt7623/Makefile >> > create mode 100644 board/mediatek/mt7623/mt7623_rfb.c >> > create mode 100644 configs/mt7623n_bpir2_defconfig >> > create mode 100644 include/configs/mt7623.h >> >> Can this use the bloblist feature which should land soon? >> >> For now, see dm/spl-working. >> >> Regards, >> Simon > > Hi Simon, > > I've read the code for spl handoff. It's a good way though but > unfortunately it cannot be applied to the MT7623 boards. > > The reason is that MT7623 uses a MediaTek proprietary preloader which > has the same function as the U-Boot SPL. But the preloader is > close-sourced (by company policy) and only available in binary release. > This means we can't use a real U-Boot SPL to replace the preloader. Can you work to get U-Boot SPL running on the chip? What is the reason for the proprietary SPL? > > At present this chip has already been used in many products. We can't > either release a different preloader which introduces compatibility > issues. What sort of compatibility issues? I cannot see any advantage with a proprietary SPL. > > So the conclusion is that we cannot use the bloblist feature for this > SoC. Regards, Simon
On Fri, 2018-11-16 at 11:26 -0700, Simon Glass wrote: > Hi Weijie, > > On 15 November 2018 at 23:08, Weijie Gao <weijie.gao@mediatek.com> > wrote: > > On Thu, 2018-11-15 at 11:21 -0800, Simon Glass wrote: > >> Hi, > >> > >> On 14 November 2018 at 18:07, Ryder Lee <ryder.lee@mediatek.com> > wrote: > >> > From: Weijie Gao <weijie.gao@mediatek.com> > >> > > >> > This adds a general board file based on MT7623 SoCs from > MediaTek. > >> > > >> > As this u-boot is loaded by MTK proprietary preloader, there is > no > >> > low level initializtion codes. > >> > > >> > Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> > >> > Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> > >> > Tested-by: Matthias Brugger <matthias.bgg@gmail.com> > >> > --- > >> > Changes since v5: None > >> > Changes since v4: > >> > -Add gd->bd->bi_boot_params for legacy method - ATAGs. > >> > --- > >> > arch/arm/mach-mediatek/Kconfig | 13 ++++ > >> > arch/arm/mach-mediatek/Makefile | 1 + > >> > arch/arm/mach-mediatek/mt7623/Makefile | 4 ++ > >> > arch/arm/mach-mediatek/mt7623/init.c | 54 > +++++++++++++++ > >> > arch/arm/mach-mediatek/mt7623/lowlevel_init.S | 22 ++++++ > >> > arch/arm/mach-mediatek/mt7623/preloader.h | 99 > +++++++++++++++++++++++++++ > >> > board/mediatek/mt7623/Kconfig | 13 ++++ > >> > board/mediatek/mt7623/MAINTAINERS | 7 ++ > >> > board/mediatek/mt7623/Makefile | 3 + > >> > board/mediatek/mt7623/mt7623_rfb.c | 16 +++++ > >> > configs/mt7623n_bpir2_defconfig | 54 > +++++++++++++++ > >> > include/configs/mt7623.h | 56 > +++++++++++++++ > >> > 12 files changed, 342 insertions(+) > >> > create mode 100644 arch/arm/mach-mediatek/mt7623/Makefile > >> > create mode 100644 arch/arm/mach-mediatek/mt7623/init.c > >> > create mode 100644 arch/arm/mach-mediatek/mt7623/lowlevel_init.S > >> > create mode 100644 arch/arm/mach-mediatek/mt7623/preloader.h > >> > create mode 100644 board/mediatek/mt7623/Kconfig > >> > create mode 100644 board/mediatek/mt7623/MAINTAINERS > >> > create mode 100644 board/mediatek/mt7623/Makefile > >> > create mode 100644 board/mediatek/mt7623/mt7623_rfb.c > >> > create mode 100644 configs/mt7623n_bpir2_defconfig > >> > create mode 100644 include/configs/mt7623.h > >> > >> Can this use the bloblist feature which should land soon? > >> > >> For now, see dm/spl-working. > >> > >> Regards, > >> Simon > > > > Hi Simon, > > > > I've read the code for spl handoff. It's a good way though but > > unfortunately it cannot be applied to the MT7623 boards. > > > > The reason is that MT7623 uses a MediaTek proprietary preloader > which > > has the same function as the U-Boot SPL. But the preloader is > > close-sourced (by company policy) and only available in binary > release. > > This means we can't use a real U-Boot SPL to replace the preloader. > > Can you work to get U-Boot SPL running on the chip? > > What is the reason for the proprietary SPL? > > > > > At present this chip has already been used in many products. We > can't > > either release a different preloader which introduces compatibility > > issues. > > What sort of compatibility issues? I cannot see any advantage with a > proprietary SPL. > > > > > So the conclusion is that we cannot use the bloblist feature for > this > > SoC. > > Regards, > Simon > Hi Simon, Sorry for that I didn't describe the function of the preloader clearly. The MT7623 is like a smart phone SoC which has the ability to upgrade bootloader/firmware via a USB cable. This function is always available even if there is no valid preloader/bootloader. This is done by cooperation of the BootROM and preloader. This is a simple description of the flow: 1. Connect the MT7623 board to the PC using USB cable. Do not power up. 2. Run MediaTek's FlashTool and start downloading. 3. Power up the board. 4. The BootROM will initialize the USB device immediately for few seconds and waiting for commands from PC. 5. The PC will start transmit commands to the board as soon as it detects the board device. 6. Thee BootROM will then download the preloader into SRAM, and run it. Several informations will be passed to the preloader, to let it continue to communicate with the FlashTool. 7. The preloader will initialize the DRAM, download data via USB and write it to flash. So the preloader is not only a simple SPL. It initializes DRAM and many other components which will only be initialized once or used by preloader. It also performs USB downloading and other things. The preloader is also used by other MediaTek's smart phone SoCs. The DRAM initialization code is the mainly part that are not allowed to be open-sourced. The preloader has so many functions which are not easy to port to the U-Boot SPL. Assume all the codes are allowed to be open sourced.If all the functions are ported to SPL, the DM must be used in SPL, which will make the SPL binary too large to fit in the SRAM.If only the necessary parts are ported (e.g. DRAM initialization), the SPL will be incompatible with the BootROM and the FlashTool and the users will be in trouble recovering a board. At present the preloader can be downloaded from the Internet. Users can concentrate on the development without managing the low level parts. BTW, there are also chips use U-Boot as a second/third bootloader while using their proprietary binary as the first stage bootloader. For example the bcm7xxx. BRs, Weijie
Hi Weijie, On Mon, 19 Nov 2018 at 00:16, Weijie Gao <weijie.gao@mediatek.com> wrote: > > On Fri, 2018-11-16 at 11:26 -0700, Simon Glass wrote: > > Hi Weijie, > > > > On 15 November 2018 at 23:08, Weijie Gao <weijie.gao@mediatek.com> > > wrote: > > > On Thu, 2018-11-15 at 11:21 -0800, Simon Glass wrote: > > >> Hi, > > >> > > >> On 14 November 2018 at 18:07, Ryder Lee <ryder.lee@mediatek.com> > > wrote: > > >> > From: Weijie Gao <weijie.gao@mediatek.com> > > >> > > > >> > This adds a general board file based on MT7623 SoCs from > > MediaTek. > > >> > > > >> > As this u-boot is loaded by MTK proprietary preloader, there is > > no > > >> > low level initializtion codes. > > >> > > > >> > Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> > > >> > Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> > > >> > Tested-by: Matthias Brugger <matthias.bgg@gmail.com> > > >> > --- > > >> > Changes since v5: None > > >> > Changes since v4: > > >> > -Add gd->bd->bi_boot_params for legacy method - ATAGs. > > >> > --- > > >> > arch/arm/mach-mediatek/Kconfig | 13 ++++ > > >> > arch/arm/mach-mediatek/Makefile | 1 + > > >> > arch/arm/mach-mediatek/mt7623/Makefile | 4 ++ > > >> > arch/arm/mach-mediatek/mt7623/init.c | 54 > > +++++++++++++++ > > >> > arch/arm/mach-mediatek/mt7623/lowlevel_init.S | 22 ++++++ > > >> > arch/arm/mach-mediatek/mt7623/preloader.h | 99 > > +++++++++++++++++++++++++++ > > >> > board/mediatek/mt7623/Kconfig | 13 ++++ > > >> > board/mediatek/mt7623/MAINTAINERS | 7 ++ > > >> > board/mediatek/mt7623/Makefile | 3 + > > >> > board/mediatek/mt7623/mt7623_rfb.c | 16 +++++ > > >> > configs/mt7623n_bpir2_defconfig | 54 > > +++++++++++++++ > > >> > include/configs/mt7623.h | 56 > > +++++++++++++++ > > >> > 12 files changed, 342 insertions(+) > > >> > create mode 100644 arch/arm/mach-mediatek/mt7623/Makefile > > >> > create mode 100644 arch/arm/mach-mediatek/mt7623/init.c > > >> > create mode 100644 arch/arm/mach-mediatek/mt7623/lowlevel_init.S > > >> > create mode 100644 arch/arm/mach-mediatek/mt7623/preloader.h > > >> > create mode 100644 board/mediatek/mt7623/Kconfig > > >> > create mode 100644 board/mediatek/mt7623/MAINTAINERS > > >> > create mode 100644 board/mediatek/mt7623/Makefile > > >> > create mode 100644 board/mediatek/mt7623/mt7623_rfb.c > > >> > create mode 100644 configs/mt7623n_bpir2_defconfig > > >> > create mode 100644 include/configs/mt7623.h > > >> > > >> Can this use the bloblist feature which should land soon? > > >> > > >> For now, see dm/spl-working. > > >> > > >> Regards, > > >> Simon > > > > > > Hi Simon, > > > > > > I've read the code for spl handoff. It's a good way though but > > > unfortunately it cannot be applied to the MT7623 boards. > > > > > > The reason is that MT7623 uses a MediaTek proprietary preloader > > which > > > has the same function as the U-Boot SPL. But the preloader is > > > close-sourced (by company policy) and only available in binary > > release. > > > This means we can't use a real U-Boot SPL to replace the preloader. > > > > Can you work to get U-Boot SPL running on the chip? > > > > What is the reason for the proprietary SPL? > > > > > > > > At present this chip has already been used in many products. We > > can't > > > either release a different preloader which introduces compatibility > > > issues. > > > > What sort of compatibility issues? I cannot see any advantage with a > > proprietary SPL. > > > > > > > > So the conclusion is that we cannot use the bloblist feature for > > this > > > SoC. > > > > Regards, > > Simon > > > Hi Simon, > > > Sorry for that I didn't describe the function of the preloader clearly. > > The MT7623 is like a smart phone SoC which has the ability to upgrade > bootloader/firmware via a USB cable. This function is always available > even if there is no valid preloader/bootloader. > > This is done by cooperation of the BootROM and preloader. This is a > simple description of the flow: > 1. Connect the MT7623 board to the PC using USB cable. Do not power up. > 2. Run MediaTek's FlashTool and start downloading. > 3. Power up the board. > 4. The BootROM will initialize the USB device immediately for few > seconds and waiting for commands from PC. > 5. The PC will start transmit commands to the board as soon as it > detects the board device. > 6. Thee BootROM will then download the preloader into SRAM, and run it. > Several informations will be passed to the preloader, to let it > continue to communicate with the FlashTool. > 7. The preloader will initialize the DRAM, download data via USB and > write it to flash. > > So the preloader is not only a simple SPL. It initializes DRAM and many > other components which will only be initialized once or used by > preloader. It also performs USB downloading and other things. > > The preloader is also used by other MediaTek's smart phone SoCs. The > DRAM initialization code is the mainly part that are not allowed to be > open-sourced. > > The preloader has so many functions which are not easy to port to the > U-Boot SPL. > Assume all the codes are allowed to be open sourced.If all the functions > are ported to SPL, the DM must be used in SPL, which will make the SPL > binary too large to fit in the SRAM.If only the necessary parts are > ported (e.g. DRAM initialization), the SPL will be incompatible with the > BootROM and the FlashTool and the users will be in trouble recovering a > board. > > At present the preloader can be downloaded from the Internet. Users can > concentrate on the development without managing the low level parts. > > BTW, there are also chips use U-Boot as a second/third bootloader while > using their proprietary binary as the first stage bootloader. For > example the bcm7xxx. Thank you for your detailed explanation. I am not so concerned about the short-term solution or older chips. A few questions: 1. Why can you not open-source the DRAM init code? 2. You don't need to enable DM in SPL if that makes the size too big. This actually doesn't sound so different from the Rockchip situation, and there it has been possible to have an open-source SPL. In fact it does use DM although on some boards it uses of-platdata to remove device-tree size. From the high quality of your patches it doesn't seem like your team would need any help to do this, but I am happy to help if that is useful. Anyway, we can go ahead with what you have and hopefully resolve this in the future. Reviewed-by: Simon Glass <sjg@chromium.org> Regards, Simon
Hi Simon, On Mon, 2018-11-19 at 10:14 -0700, Simon Glass wrote: > Hi Weijie, > > On Mon, 19 Nov 2018 at 00:16, Weijie Gao <weijie.gao@mediatek.com> wrote: > > > > On Fri, 2018-11-16 at 11:26 -0700, Simon Glass wrote: > > > Hi Weijie, > > > > > > On 15 November 2018 at 23:08, Weijie Gao <weijie.gao@mediatek.com> > > > wrote: > > > > On Thu, 2018-11-15 at 11:21 -0800, Simon Glass wrote: > > > >> Hi, > > > >> > > > >> On 14 November 2018 at 18:07, Ryder Lee <ryder.lee@mediatek.com> > > > wrote: > > > >> > From: Weijie Gao <weijie.gao@mediatek.com> > > > >> > > > > >> > This adds a general board file based on MT7623 SoCs from > > > MediaTek. > > > >> > > > > >> > As this u-boot is loaded by MTK proprietary preloader, there is > > > no > > > >> > low level initializtion codes. > > > >> > > > > >> > Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> > > > >> > Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> > > > >> > Tested-by: Matthias Brugger <matthias.bgg@gmail.com> > > > >> > --- > > > >> > Changes since v5: None > > > >> > Changes since v4: > > > >> > -Add gd->bd->bi_boot_params for legacy method - ATAGs. > > > >> > --- > > > >> > arch/arm/mach-mediatek/Kconfig | 13 ++++ > > > >> > arch/arm/mach-mediatek/Makefile | 1 + > > > >> > arch/arm/mach-mediatek/mt7623/Makefile | 4 ++ > > > >> > arch/arm/mach-mediatek/mt7623/init.c | 54 > > > +++++++++++++++ > > > >> > arch/arm/mach-mediatek/mt7623/lowlevel_init.S | 22 ++++++ > > > >> > arch/arm/mach-mediatek/mt7623/preloader.h | 99 > > > +++++++++++++++++++++++++++ > > > >> > board/mediatek/mt7623/Kconfig | 13 ++++ > > > >> > board/mediatek/mt7623/MAINTAINERS | 7 ++ > > > >> > board/mediatek/mt7623/Makefile | 3 + > > > >> > board/mediatek/mt7623/mt7623_rfb.c | 16 +++++ > > > >> > configs/mt7623n_bpir2_defconfig | 54 > > > +++++++++++++++ > > > >> > include/configs/mt7623.h | 56 > > > +++++++++++++++ > > > >> > 12 files changed, 342 insertions(+) > > > >> > create mode 100644 arch/arm/mach-mediatek/mt7623/Makefile > > > >> > create mode 100644 arch/arm/mach-mediatek/mt7623/init.c > > > >> > create mode 100644 arch/arm/mach-mediatek/mt7623/lowlevel_init.S > > > >> > create mode 100644 arch/arm/mach-mediatek/mt7623/preloader.h > > > >> > create mode 100644 board/mediatek/mt7623/Kconfig > > > >> > create mode 100644 board/mediatek/mt7623/MAINTAINERS > > > >> > create mode 100644 board/mediatek/mt7623/Makefile > > > >> > create mode 100644 board/mediatek/mt7623/mt7623_rfb.c > > > >> > create mode 100644 configs/mt7623n_bpir2_defconfig > > > >> > create mode 100644 include/configs/mt7623.h > > > >> > > > >> Can this use the bloblist feature which should land soon? > > > >> > > > >> For now, see dm/spl-working. > > > >> > > > >> Regards, > > > >> Simon > > > > > > > > Hi Simon, > > > > > > > > I've read the code for spl handoff. It's a good way though but > > > > unfortunately it cannot be applied to the MT7623 boards. > > > > > > > > The reason is that MT7623 uses a MediaTek proprietary preloader > > > which > > > > has the same function as the U-Boot SPL. But the preloader is > > > > close-sourced (by company policy) and only available in binary > > > release. > > > > This means we can't use a real U-Boot SPL to replace the preloader. > > > > > > Can you work to get U-Boot SPL running on the chip? > > > > > > What is the reason for the proprietary SPL? > > > > > > > > > > > At present this chip has already been used in many products. We > > > can't > > > > either release a different preloader which introduces compatibility > > > > issues. > > > > > > What sort of compatibility issues? I cannot see any advantage with a > > > proprietary SPL. > > > > > > > > > > > So the conclusion is that we cannot use the bloblist feature for > > > this > > > > SoC. > > > > > > Regards, > > > Simon > > > > > Hi Simon, > > > > > > Sorry for that I didn't describe the function of the preloader clearly. > > > > The MT7623 is like a smart phone SoC which has the ability to upgrade > > bootloader/firmware via a USB cable. This function is always available > > even if there is no valid preloader/bootloader. > > > > This is done by cooperation of the BootROM and preloader. This is a > > simple description of the flow: > > 1. Connect the MT7623 board to the PC using USB cable. Do not power up. > > 2. Run MediaTek's FlashTool and start downloading. > > 3. Power up the board. > > 4. The BootROM will initialize the USB device immediately for few > > seconds and waiting for commands from PC. > > 5. The PC will start transmit commands to the board as soon as it > > detects the board device. > > 6. Thee BootROM will then download the preloader into SRAM, and run it. > > Several informations will be passed to the preloader, to let it > > continue to communicate with the FlashTool. > > 7. The preloader will initialize the DRAM, download data via USB and > > write it to flash. > > > > So the preloader is not only a simple SPL. It initializes DRAM and many > > other components which will only be initialized once or used by > > preloader. It also performs USB downloading and other things. > > > > The preloader is also used by other MediaTek's smart phone SoCs. The > > DRAM initialization code is the mainly part that are not allowed to be > > open-sourced. > > > > The preloader has so many functions which are not easy to port to the > > U-Boot SPL. > > Assume all the codes are allowed to be open sourced.If all the functions > > are ported to SPL, the DM must be used in SPL, which will make the SPL > > binary too large to fit in the SRAM.If only the necessary parts are > > ported (e.g. DRAM initialization), the SPL will be incompatible with the > > BootROM and the FlashTool and the users will be in trouble recovering a > > board. > > > > At present the preloader can be downloaded from the Internet. Users can > > concentrate on the development without managing the low level parts. > > > > BTW, there are also chips use U-Boot as a second/third bootloader while > > using their proprietary binary as the first stage bootloader. For > > example the bcm7xxx. > > Thank you for your detailed explanation. I am not so concerned about > the short-term solution or older chips. > > A few questions: > > 1. Why can you not open-source the DRAM init code? > 2. You don't need to enable DM in SPL if that makes the size too big. > > This actually doesn't sound so different from the Rockchip situation, > and there it has been possible to have an open-source SPL. In fact it > does use DM although on some boards it uses of-platdata to remove > device-tree size. From the high quality of your patches it doesn't > seem like your team would need any help to do this, but I am happy to > help if that is useful. > > Anyway, we can go ahead with what you have and hopefully resolve this > in the future. > > Reviewed-by: Simon Glass <sjg@chromium.org> > > Regards, > Simon For the first question, it's not only about the dram init codes. MT7623 used many components from a smart phone chip, which contains many security mechanisms like anti-debug and anti-clone which is protected by the company. The preloader will initialize them thus make it unable to be open-sourced. For the rest questions, yes we always have ways to implement an source-source SPL to replace the preloader if at least essential source codes can be opened. The MT7623 actually uses technologies from old chips (e.g. the USB download). Current design can let the users upgrade their old u-boot seamlessly. For our newly designed chips, such as the MT7629 in this patch series, the SPL has already been used to replace the preloader. We removed USB download and other unnecessary parts and used full u-boot from the beginning. There is no compatibility issue for this chip. And again we thank for your kind help. Sincerely, Weijie
Hi Weijie, On Mon, 19 Nov 2018 at 23:36, Weijie Gao <weijie.gao@mediatek.com> wrote: > > Hi Simon, > > On Mon, 2018-11-19 at 10:14 -0700, Simon Glass wrote: > > Hi Weijie, > > > > On Mon, 19 Nov 2018 at 00:16, Weijie Gao <weijie.gao@mediatek.com> wrote: > > > > > > On Fri, 2018-11-16 at 11:26 -0700, Simon Glass wrote: > > > > Hi Weijie, > > > > > > > > On 15 November 2018 at 23:08, Weijie Gao <weijie.gao@mediatek.com> > > > > wrote: > > > > > On Thu, 2018-11-15 at 11:21 -0800, Simon Glass wrote: > > > > >> Hi, > > > > >> > > > > >> On 14 November 2018 at 18:07, Ryder Lee <ryder.lee@mediatek.com> > > > > wrote: > > > > >> > From: Weijie Gao <weijie.gao@mediatek.com> > > > > >> > > > > > >> > This adds a general board file based on MT7623 SoCs from > > > > MediaTek. > > > > >> > > > > > >> > As this u-boot is loaded by MTK proprietary preloader, there is > > > > no > > > > >> > low level initializtion codes. > > > > >> > > > > > >> > Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> > > > > >> > Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> > > > > >> > Tested-by: Matthias Brugger <matthias.bgg@gmail.com> > > > > >> > --- > > > > >> > Changes since v5: None > > > > >> > Changes since v4: > > > > >> > -Add gd->bd->bi_boot_params for legacy method - ATAGs. > > > > >> > --- > > > > >> > arch/arm/mach-mediatek/Kconfig | 13 ++++ > > > > >> > arch/arm/mach-mediatek/Makefile | 1 + > > > > >> > arch/arm/mach-mediatek/mt7623/Makefile | 4 ++ > > > > >> > arch/arm/mach-mediatek/mt7623/init.c | 54 > > > > +++++++++++++++ > > > > >> > arch/arm/mach-mediatek/mt7623/lowlevel_init.S | 22 ++++++ > > > > >> > arch/arm/mach-mediatek/mt7623/preloader.h | 99 > > > > +++++++++++++++++++++++++++ > > > > >> > board/mediatek/mt7623/Kconfig | 13 ++++ > > > > >> > board/mediatek/mt7623/MAINTAINERS | 7 ++ > > > > >> > board/mediatek/mt7623/Makefile | 3 + > > > > >> > board/mediatek/mt7623/mt7623_rfb.c | 16 +++++ > > > > >> > configs/mt7623n_bpir2_defconfig | 54 > > > > +++++++++++++++ > > > > >> > include/configs/mt7623.h | 56 > > > > +++++++++++++++ > > > > >> > 12 files changed, 342 insertions(+) > > > > >> > create mode 100644 arch/arm/mach-mediatek/mt7623/Makefile > > > > >> > create mode 100644 arch/arm/mach-mediatek/mt7623/init.c > > > > >> > create mode 100644 arch/arm/mach-mediatek/mt7623/lowlevel_init.S > > > > >> > create mode 100644 arch/arm/mach-mediatek/mt7623/preloader.h > > > > >> > create mode 100644 board/mediatek/mt7623/Kconfig > > > > >> > create mode 100644 board/mediatek/mt7623/MAINTAINERS > > > > >> > create mode 100644 board/mediatek/mt7623/Makefile > > > > >> > create mode 100644 board/mediatek/mt7623/mt7623_rfb.c > > > > >> > create mode 100644 configs/mt7623n_bpir2_defconfig > > > > >> > create mode 100644 include/configs/mt7623.h > > > > >> > > > > >> Can this use the bloblist feature which should land soon? > > > > >> > > > > >> For now, see dm/spl-working. > > > > >> > > > > >> Regards, > > > > >> Simon > > > > > > > > > > Hi Simon, > > > > > > > > > > I've read the code for spl handoff. It's a good way though but > > > > > unfortunately it cannot be applied to the MT7623 boards. > > > > > > > > > > The reason is that MT7623 uses a MediaTek proprietary preloader > > > > which > > > > > has the same function as the U-Boot SPL. But the preloader is > > > > > close-sourced (by company policy) and only available in binary > > > > release. > > > > > This means we can't use a real U-Boot SPL to replace the preloader. > > > > > > > > Can you work to get U-Boot SPL running on the chip? > > > > > > > > What is the reason for the proprietary SPL? > > > > > > > > > > > > > > At present this chip has already been used in many products. We > > > > can't > > > > > either release a different preloader which introduces compatibility > > > > > issues. > > > > > > > > What sort of compatibility issues? I cannot see any advantage with a > > > > proprietary SPL. > > > > > > > > > > > > > > So the conclusion is that we cannot use the bloblist feature for > > > > this > > > > > SoC. > > > > > > > > Regards, > > > > Simon > > > > > > > Hi Simon, > > > > > > > > > Sorry for that I didn't describe the function of the preloader clearly. > > > > > > The MT7623 is like a smart phone SoC which has the ability to upgrade > > > bootloader/firmware via a USB cable. This function is always available > > > even if there is no valid preloader/bootloader. > > > > > > This is done by cooperation of the BootROM and preloader. This is a > > > simple description of the flow: > > > 1. Connect the MT7623 board to the PC using USB cable. Do not power up. > > > 2. Run MediaTek's FlashTool and start downloading. > > > 3. Power up the board. > > > 4. The BootROM will initialize the USB device immediately for few > > > seconds and waiting for commands from PC. > > > 5. The PC will start transmit commands to the board as soon as it > > > detects the board device. > > > 6. Thee BootROM will then download the preloader into SRAM, and run it. > > > Several informations will be passed to the preloader, to let it > > > continue to communicate with the FlashTool. > > > 7. The preloader will initialize the DRAM, download data via USB and > > > write it to flash. > > > > > > So the preloader is not only a simple SPL. It initializes DRAM and many > > > other components which will only be initialized once or used by > > > preloader. It also performs USB downloading and other things. > > > > > > The preloader is also used by other MediaTek's smart phone SoCs. The > > > DRAM initialization code is the mainly part that are not allowed to be > > > open-sourced. > > > > > > The preloader has so many functions which are not easy to port to the > > > U-Boot SPL. > > > Assume all the codes are allowed to be open sourced.If all the functions > > > are ported to SPL, the DM must be used in SPL, which will make the SPL > > > binary too large to fit in the SRAM.If only the necessary parts are > > > ported (e.g. DRAM initialization), the SPL will be incompatible with the > > > BootROM and the FlashTool and the users will be in trouble recovering a > > > board. > > > > > > At present the preloader can be downloaded from the Internet. Users can > > > concentrate on the development without managing the low level parts. > > > > > > BTW, there are also chips use U-Boot as a second/third bootloader while > > > using their proprietary binary as the first stage bootloader. For > > > example the bcm7xxx. > > > > Thank you for your detailed explanation. I am not so concerned about > > the short-term solution or older chips. > > > > A few questions: > > > > 1. Why can you not open-source the DRAM init code? > > 2. You don't need to enable DM in SPL if that makes the size too big. > > > > This actually doesn't sound so different from the Rockchip situation, > > and there it has been possible to have an open-source SPL. In fact it > > does use DM although on some boards it uses of-platdata to remove > > device-tree size. From the high quality of your patches it doesn't > > seem like your team would need any help to do this, but I am happy to > > help if that is useful. > > > > Anyway, we can go ahead with what you have and hopefully resolve this > > in the future. > > > > Reviewed-by: Simon Glass <sjg@chromium.org> > > > > Regards, > > Simon > > > For the first question, it's not only about the dram init codes. MT7623 > used many components from a smart phone chip, which contains many > security mechanisms like anti-debug and anti-clone which is protected > by the company. The preloader will initialize them thus make it unable > to be open-sourced. I do feel this is confusing obscurity with security. If the system is secure then it can be open-source. In fact it is probably better that way (more eyes). > > For the rest questions, yes we always have ways to implement an > source-source SPL to replace the preloader if at least essential source > codes can be opened. The MT7623 actually uses technologies from old > chips (e.g. the USB download). Current design can let the users upgrade > their old u-boot seamlessly. For our newly designed chips, such as the > MT7629 in this patch series, the SPL has already been used to replace > the preloader. We removed USB download and other unnecessary parts and > used full u-boot from the beginning. There is no compatibility issue for > this chip. I think you can start with a basic U-Boot SPL and add features over time. > > And again we thank for your kind help. You are welcome. I encourage you to upstream more MediaTek platforms. Regards, Simon
On Thu, Nov 15, 2018 at 10:07:53AM +0800, Ryder Lee wrote: > From: Weijie Gao <weijie.gao@mediatek.com> > > This adds a general board file based on MT7623 SoCs from MediaTek. > > As this u-boot is loaded by MTK proprietary preloader, there is no > low level initializtion codes. > > Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> > Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> > Tested-by: Matthias Brugger <matthias.bgg@gmail.com> > Reviewed-by: Simon Glass <sjg@chromium.org> Applied to u-boot/master, thanks!
diff --git a/arch/arm/mach-mediatek/Kconfig b/arch/arm/mach-mediatek/Kconfig index d2ada97..7a733e9 100644 --- a/arch/arm/mach-mediatek/Kconfig +++ b/arch/arm/mach-mediatek/Kconfig @@ -9,6 +9,18 @@ config SYS_VENDOR choice prompt "MediaTek board select" +config TARGET_MT7623 + bool "MediaTek MT7623 SoC" + select CPU_V7A + select ARCH_MISC_INIT + help + The MediaTek MT7623 is a ARM-based SoC with a quad-core Cortex-A7 + including NEON and GPU, Mali-450 graphics, several DDR3 options, + crypto engine, built-in Wi-Fi / Bluetooth combo chip, JPEG decoder, + video interfaces supporting HDMI and MIPI, and video codec support. + Peripherals include Gigabit Ethernet, switch, USB3.0 and OTG, PCIe, + I2S, PCM, S/PDIF, UART, SPI, I2C, IR TX/RX, and PWM. + config TARGET_MT7629 bool "MediaTek MT7629 SoC" select CPU_V7A @@ -21,6 +33,7 @@ config TARGET_MT7629 endchoice +source "board/mediatek/mt7623/Kconfig" source "board/mediatek/mt7629/Kconfig" endif diff --git a/arch/arm/mach-mediatek/Makefile b/arch/arm/mach-mediatek/Makefile index 852d330..b5d3a37 100644 --- a/arch/arm/mach-mediatek/Makefile +++ b/arch/arm/mach-mediatek/Makefile @@ -3,4 +3,5 @@ obj-y += cpu.o obj-$(CONFIG_SPL_BUILD) += spl.o +obj-$(CONFIG_TARGET_MT7623) += mt7623/ obj-$(CONFIG_TARGET_MT7629) += mt7629/ diff --git a/arch/arm/mach-mediatek/mt7623/Makefile b/arch/arm/mach-mediatek/mt7623/Makefile new file mode 100644 index 0000000..007eb4a --- /dev/null +++ b/arch/arm/mach-mediatek/mt7623/Makefile @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-y += init.o +obj-y += lowlevel_init.o diff --git a/arch/arm/mach-mediatek/mt7623/init.c b/arch/arm/mach-mediatek/mt7623/init.c new file mode 100644 index 0000000..0ee8c66 --- /dev/null +++ b/arch/arm/mach-mediatek/mt7623/init.c @@ -0,0 +1,54 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2018 MediaTek Inc. + */ + +#include <common.h> +#include <linux/io.h> +#include <linux/sizes.h> +#include <asm/arch/misc.h> + +#include "preloader.h" + +DECLARE_GLOBAL_DATA_PTR; + +struct boot_argument *preloader_param; + +int mtk_soc_early_init(void) +{ + return 0; +} + +int dram_init(void) +{ + u32 i; + + if (((size_t)preloader_param >= CONFIG_SYS_SDRAM_BASE) && + ((size_t)preloader_param % sizeof(size_t) == 0) && + preloader_param->magic == BOOT_ARGUMENT_MAGIC && + preloader_param->dram_rank_num <= + ARRAY_SIZE(preloader_param->dram_rank_size)) { + gd->ram_size = 0; + + for (i = 0; i < preloader_param->dram_rank_num; i++) + gd->ram_size += preloader_param->dram_rank_size[i]; + } else { + gd->ram_size = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE, + SZ_2G); + } + + return 0; +} + +int print_cpuinfo(void) +{ + void __iomem *chipid; + u32 swver; + + chipid = ioremap(VER_BASE, VER_SIZE); + swver = readl(chipid + APSW_VER); + + printf("CPU: MediaTek MT7623 E%d\n", (swver & 0xf) + 1); + + return 0; +} diff --git a/arch/arm/mach-mediatek/mt7623/lowlevel_init.S b/arch/arm/mach-mediatek/mt7623/lowlevel_init.S new file mode 100644 index 0000000..afb9476 --- /dev/null +++ b/arch/arm/mach-mediatek/mt7623/lowlevel_init.S @@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2018 MediaTek Inc. + */ + +#include <linux/linkage.h> + +.extern preloader_param + +ENTRY(save_boot_params) + ldr r6, =preloader_param + str r4, [r6] + b save_boot_params_ret +ENDPROC(save_boot_params) + +ENTRY(lowlevel_init) + /* enable SMP bit */ + mrc p15, 0, r0, c1, c0, 1 + orr r0, r0, #0x40 + mcr p15, 0, r0, c1, c0, 1 + mov pc, lr +ENDPROC(lowlevel_init) diff --git a/arch/arm/mach-mediatek/mt7623/preloader.h b/arch/arm/mach-mediatek/mt7623/preloader.h new file mode 100644 index 0000000..2d2c71a --- /dev/null +++ b/arch/arm/mach-mediatek/mt7623/preloader.h @@ -0,0 +1,99 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2018 MediaTek Inc. + */ + +#ifndef __PRELOADER_H_ +#define __PRELOADER_H_ + +enum forbidden_mode { + F_FACTORY_MODE = 0x0001 +}; + +union lk_hdr { + struct { + u32 magic; + u32 size; + char name[32]; + u32 loadaddr; + }; + + u8 data[512]; +}; + +struct sec_limit { + unsigned int magic_num; + enum forbidden_mode forbid_mode; +}; + +enum bootmode { + NORMAL_BOOT = 0, + META_BOOT = 1, + RECOVERY_BOOT = 2, + SW_REBOOT = 3, + FACTORY_BOOT = 4, + ADVMETA_BOOT = 5, + ATE_FACTORY_BOOT = 6, + ALARM_BOOT = 7, + + KERNEL_POWER_OFF_CHARGING_BOOT = 8, + LOW_POWER_OFF_CHARGING_BOOT = 9, + + FAST_BOOT = 99, + DOWNLOAD_BOOT = 100, + UNKNOWN_BOOT +}; + +enum boot_reason { + BR_POWER_KEY = 0, + BR_USB, + BR_RTC, + BR_WDT, + BR_WDT_BY_PASS_PWK, + BR_TOOL_BY_PASS_PWK, + BR_2SEC_REBOOT, + BR_UNKNOWN +}; + +enum meta_com_type { + META_UNKNOWN_COM = 0, + META_UART_COM, + META_USB_COM +}; + +struct da_info_t { + u32 addr; + u32 arg1; + u32 arg2; + u32 len; + u32 sig_len; +}; + +struct boot_argument { + u32 magic; + enum bootmode boot_mode; + u32 e_flag; + u32 log_port; + u32 log_baudrate; + u8 log_enable; + u8 part_num; + u8 reserved[2]; + u32 dram_rank_num; + u32 dram_rank_size[4]; + u32 boot_reason; + enum meta_com_type meta_com_type; + u32 meta_com_id; + u32 boot_time; + struct da_info_t da_info; + struct sec_limit sec_limit; + union lk_hdr *part_info; + u8 md_type[4]; + u32 ddr_reserve_enable; + u32 ddr_reserve_success; + u32 chip_ver; + char pl_version[8]; +}; + +#define BOOT_ARGUMENT_MAGIC 0x504c504c + +#endif /* __PRELOADER_H_ */ diff --git a/board/mediatek/mt7623/Kconfig b/board/mediatek/mt7623/Kconfig new file mode 100644 index 0000000..a8c670e --- /dev/null +++ b/board/mediatek/mt7623/Kconfig @@ -0,0 +1,13 @@ +if TARGET_MT7623 + +config SYS_BOARD + default "mt7623" + +config SYS_CONFIG_NAME + default "mt7623" + +config MTK_BROM_HEADER_INFO + string + default "lk=1" + +endif diff --git a/board/mediatek/mt7623/MAINTAINERS b/board/mediatek/mt7623/MAINTAINERS new file mode 100644 index 0000000..eeb0375 --- /dev/null +++ b/board/mediatek/mt7623/MAINTAINERS @@ -0,0 +1,7 @@ +MT7623 +M: Ryder Lee <ryder.lee@mediatek.com> +M: Weijie Gao <weijie.gao@mediatek.com> +S: Maintained +F: board/mediatek/mt7623 +F: include/configs/mt7623.h +F: configs/mt7623n_bpir2_defconfig diff --git a/board/mediatek/mt7623/Makefile b/board/mediatek/mt7623/Makefile new file mode 100644 index 0000000..2b42071 --- /dev/null +++ b/board/mediatek/mt7623/Makefile @@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-y += mt7623_rfb.o diff --git a/board/mediatek/mt7623/mt7623_rfb.c b/board/mediatek/mt7623/mt7623_rfb.c new file mode 100644 index 0000000..08468b5 --- /dev/null +++ b/board/mediatek/mt7623/mt7623_rfb.c @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2018 MediaTek Inc. + */ + +#include <common.h> + +DECLARE_GLOBAL_DATA_PTR; + +int board_init(void) +{ + /* address of boot parameters */ + gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100; + + return 0; +} diff --git a/configs/mt7623n_bpir2_defconfig b/configs/mt7623n_bpir2_defconfig new file mode 100644 index 0000000..3a4de72 --- /dev/null +++ b/configs/mt7623n_bpir2_defconfig @@ -0,0 +1,54 @@ +CONFIG_ARM=y +CONFIG_SYS_THUMB_BUILD=y +CONFIG_ARCH_MEDIATEK=y +CONFIG_SYS_TEXT_BASE=0x81e00000 +CONFIG_SYS_MALLOC_F_LEN=0x4000 +CONFIG_TARGET_MT7623=y +CONFIG_NR_DRAM_BANKS=1 +CONFIG_FIT=y +CONFIG_FIT_VERBOSE=y +CONFIG_BOOTDELAY=3 +CONFIG_SYS_CONSOLE_IS_IN_ENV=y +CONFIG_DEFAULT_FDT_FILE="mt7623n-bananapi-bpi-r2" +# CONFIG_DISPLAY_BOARDINFO is not set +CONFIG_HUSH_PARSER=y +CONFIG_SYS_PROMPT="U-Boot> " +CONFIG_CMD_BOOTMENU=y +# CONFIG_CMD_ELF is not set +# CONFIG_CMD_XIMG is not set +# CONFIG_CMD_FLASH is not set +CONFIG_CMD_GPIO=y +CONFIG_CMD_GPT=y +CONFIG_CMD_MMC=y +CONFIG_CMD_PART=y +CONFIG_CMD_READ=y +# CONFIG_CMD_SETEXPR is not set +# CONFIG_CMD_NFS is not set +CONFIG_CMD_PING=y +CONFIG_CMD_FAT=y +CONFIG_CMD_FS_GENERIC=y +CONFIG_OF_EMBED=y +CONFIG_DEFAULT_DEVICE_TREE="mt7623n-bananapi-bpi-r2" +CONFIG_REGMAP=y +CONFIG_SYSCON=y +# CONFIG_BLOCK_CACHE is not set +CONFIG_CLK=y +CONFIG_DM_GPIO=y +CONFIG_DM_MMC=y +# CONFIG_MMC_QUIRKS is not set +CONFIG_MMC_HS400_SUPPORT=y +CONFIG_MMC_MTK=y +CONFIG_PINCTRL=y +CONFIG_PINCONF=y +CONFIG_PINCTRL_MT7623=y +CONFIG_POWER_DOMAIN=y +CONFIG_MTK_POWER_DOMAIN=y +CONFIG_DM_SERIAL=y +CONFIG_MTK_SERIAL=y +CONFIG_SYSRESET=y +CONFIG_SYSRESET_WATCHDOG=y +CONFIG_TIMER=y +CONFIG_MTK_TIMER=y +CONFIG_WDT_MTK=y +CONFIG_LZMA=y +# CONFIG_EFI_LOADER is not set diff --git a/include/configs/mt7623.h b/include/configs/mt7623.h new file mode 100644 index 0000000..68da920 --- /dev/null +++ b/include/configs/mt7623.h @@ -0,0 +1,56 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Configuration for MediaTek MT7623 SoC + * + * Copyright (C) 2018 MediaTek Inc. + * Author: Weijie Gao <weijie.gao@mediatek.com> + */ + +#ifndef __MT7623_H +#define __MT7623_H + +#include <linux/sizes.h> + +/* Miscellaneous configurable options */ +#define CONFIG_SETUP_MEMORY_TAGS +#define CONFIG_INITRD_TAG +#define CONFIG_CMDLINE_TAG + +#define CONFIG_SYS_MAXARGS 8 +#define CONFIG_SYS_BOOTM_LEN SZ_64M +#define CONFIG_SYS_CBSIZE SZ_1K +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ + sizeof(CONFIG_SYS_PROMPT) + 16) + +/* Size of malloc() pool */ +#define CONFIG_SYS_MALLOC_LEN SZ_4M + +/* Environment */ +#define CONFIG_ENV_SIZE SZ_4K +/* Allow to overwrite serial and ethaddr */ +#define CONFIG_ENV_OVERWRITE + +/* Preloader -> Uboot */ +#define CONFIG_SYS_UBOOT_START CONFIG_SYS_TEXT_BASE +#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_TEXT_BASE + SZ_2M - \ + GENERATED_GBL_DATA_SIZE) + +/* UBoot -> Kernel */ +#define CONFIG_LOADADDR 0x84000000 +#define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR + +/* MMC */ +#define MMC_SUPPORTS_TUNING +#define CONFIG_SUPPORT_EMMC_BOOT + +/* DRAM */ +#define CONFIG_SYS_SDRAM_BASE 0x80000000 + +/* This is neede for kernel booting */ +#define FDT_HIGH "fdt_high=0xac000000\0" + +/* Extra environment variables */ +#define CONFIG_EXTRA_ENV_SETTINGS \ + FDT_HIGH + +#endif