Re: [U-Boot] [PATCH v5 05/18] arm: MediaTek: add basic support for MT7623 boards

2018-11-26 Thread Simon Glass
Hi Weijie,

On Mon, 19 Nov 2018 at 23:36, Weijie Gao  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  wrote:
> > >
> > > On Fri, 2018-11-16 at 11:26 -0700, Simon Glass wrote:
> > > > Hi Weijie,
> > > >
> > > > On 15 November 2018 at 23:08, Weijie Gao 
> > > > wrote:
> > > > > On Thu, 2018-11-15 at 11:21 -0800, Simon Glass wrote:
> > > > >> Hi,
> > > > >>
> > > > >> On 14 November 2018 at 18:07, Ryder Lee 
> > > > wrote:
> > > > >> > From: Weijie Gao 
> > > > >> >
> > > > >> > 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 
> > > > >> > Signed-off-by: Ryder Lee 
> > > > >> > Tested-by: Matthias Brugger 
> > > > >> > ---
> > > > >> > 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 

Re: [U-Boot] [PATCH v5 05/18] arm: MediaTek: add basic support for MT7623 boards

2018-11-19 Thread Weijie Gao
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  wrote:
> >
> > On Fri, 2018-11-16 at 11:26 -0700, Simon Glass wrote:
> > > Hi Weijie,
> > >
> > > On 15 November 2018 at 23:08, Weijie Gao 
> > > wrote:
> > > > On Thu, 2018-11-15 at 11:21 -0800, Simon Glass wrote:
> > > >> Hi,
> > > >>
> > > >> On 14 November 2018 at 18:07, Ryder Lee 
> > > wrote:
> > > >> > From: Weijie Gao 
> > > >> >
> > > >> > 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 
> > > >> > Signed-off-by: Ryder Lee 
> > > >> > Tested-by: Matthias Brugger 
> > > >> > ---
> > > >> > 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 

Re: [U-Boot] [PATCH v5 05/18] arm: MediaTek: add basic support for MT7623 boards

2018-11-19 Thread Simon Glass
Hi Weijie,

On Mon, 19 Nov 2018 at 00:16, Weijie Gao  wrote:
>
> On Fri, 2018-11-16 at 11:26 -0700, Simon Glass wrote:
> > Hi Weijie,
> >
> > On 15 November 2018 at 23:08, Weijie Gao 
> > wrote:
> > > On Thu, 2018-11-15 at 11:21 -0800, Simon Glass wrote:
> > >> Hi,
> > >>
> > >> On 14 November 2018 at 18:07, Ryder Lee 
> > wrote:
> > >> > From: Weijie Gao 
> > >> >
> > >> > 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 
> > >> > Signed-off-by: Ryder Lee 
> > >> > Tested-by: Matthias Brugger 
> > >> > ---
> > >> > 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 

Re: [U-Boot] [PATCH v5 05/18] arm: MediaTek: add basic support for MT7623 boards

2018-11-18 Thread Weijie Gao
On Fri, 2018-11-16 at 11:26 -0700, Simon Glass wrote:
> Hi Weijie,
> 
> On 15 November 2018 at 23:08, Weijie Gao 
> wrote:
> > On Thu, 2018-11-15 at 11:21 -0800, Simon Glass wrote:
> >> Hi,
> >>
> >> On 14 November 2018 at 18:07, Ryder Lee 
> wrote:
> >> > From: Weijie Gao 
> >> >
> >> > 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 
> >> > Signed-off-by: Ryder Lee 
> >> > Tested-by: Matthias Brugger 
> >> > ---
> >> > 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 

Re: [U-Boot] [PATCH v5 05/18] arm: MediaTek: add basic support for MT7623 boards

2018-11-16 Thread Simon Glass
Hi Weijie,

On 15 November 2018 at 23:08, Weijie Gao  wrote:
> On Thu, 2018-11-15 at 11:21 -0800, Simon Glass wrote:
>> Hi,
>>
>> On 14 November 2018 at 18:07, Ryder Lee  wrote:
>> > From: Weijie Gao 
>> >
>> > 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 
>> > Signed-off-by: Ryder Lee 
>> > Tested-by: Matthias Brugger 
>> > ---
>> > 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
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v5 05/18] arm: MediaTek: add basic support for MT7623 boards

2018-11-15 Thread Weijie Gao
On Thu, 2018-11-15 at 11:21 -0800, Simon Glass wrote:
> Hi,
> 
> On 14 November 2018 at 18:07, Ryder Lee  wrote:
> > From: Weijie Gao 
> >
> > 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 
> > Signed-off-by: Ryder Lee 
> > Tested-by: Matthias Brugger 
> > ---
> > 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




___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v5 05/18] arm: MediaTek: add basic support for MT7623 boards

2018-11-15 Thread Simon Glass
Hi,

On 14 November 2018 at 18:07, Ryder Lee  wrote:
> From: Weijie Gao 
>
> 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 
> Signed-off-by: Ryder Lee 
> Tested-by: Matthias Brugger 
> ---
> 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
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v5 05/18] arm: MediaTek: add basic support for MT7623 boards

2018-11-14 Thread Ryder Lee
From: Weijie Gao 

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 
Signed-off-by: Ryder Lee 
Tested-by: Matthias Brugger 
---
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

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 000..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 000..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 
+#include 
+#include 
+#include 
+
+#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 000..afb9476
---