[PATCH 08/18] serial: add uart driver for MediaTek MT7620 SoC

Simon Glass sjg at chromium.org
Fri Oct 30 19:15:47 CET 2020


Hi Weijie,

On Thu, 29 Oct 2020 at 21:21, Weijie Gao <weijie.gao at mediatek.com> wrote:
>
> On Thu, 2020-10-29 at 08:30 -0600, Simon Glass wrote:
> > Hi Weijie,
> >
> > On Thu, 29 Oct 2020 at 03:47, Weijie Gao <weijie.gao at mediatek.com> wrote:
> > >
> > > On Mon, 2020-10-26 at 22:51 -0600, Simon Glass wrote:
> > > > Hi Weijie,
> > > >
> > > > On Fri, 16 Oct 2020 at 01:36, Weijie Gao <weijie.gao at mediatek.com> wrote:
> > > > >
> > > > > This patch adds uart support for MediaTek MT7620 and earlier SoCs.
> > > > >
> > > > > The UART used by MT7620 is incompatible with the ns16550a driver.
> > > > > All registers of this UART have different addresses. A special 16-bit
> > > > > register for Divisor Latch is used to set the baudrate instead of the
> > > > > original two 8-bit registers (DLL and DLM).
> > > > >
> > > > > The driver can be built without DM which is useful for tiny SPL.
> > > > >
> > > > > Signed-off-by: Weijie Gao <weijie.gao at mediatek.com>
> > > > > ---
> > > > >  drivers/serial/Kconfig         |  20 ++
> > > > >  drivers/serial/Makefile        |   1 +
> > > > >  drivers/serial/serial.c        |   2 +
> > > > >  drivers/serial/serial_mt7620.c | 350 +++++++++++++++++++++++++++++++++
> > > > >  4 files changed, 373 insertions(+)
> > > > >  create mode 100644 drivers/serial/serial_mt7620.c
> > > >
> > > > Why do you need to build without DM? We have of-platdata which
> > > > provides for smaller images. What is the SRAM size available?
> > > >
> > >
> > > Actually it's the total size (spl+u-boot-lzma.img) that matters.
> > > mt7620_rfb_defconfig is configured to be compatible with the original
> > > u-boot from MTK SDK, and the maximum size is 192KiB.
> >
> > What is lzma.img ?
>
> The u-boot.bin is compressed to reduce it's size (395KiB -> 150KiB), and
> the SPL is responsible to decompress it.
>
> >
> > >
> > > Currently without SPL_DM, the final image u-boot-with-spl.bin is about
> > > 170KiB, the u-boot-spl.bin is only 20KiB.
> >
> > That is definitely huge.
>
> Without the decompression code, the size of SPL will be reduced to 9KiB.

OK...so is it possible to have SPL load U-Boot, instead of including
it in SRAM? That is normally what is done.

>
> >
> > > If SPL_DM is enabled, the total size is 189KiB, which is very close to
> > > the limit 192KiB, and the size of spl is almost doubled, 39KiB.
> > > (Without DM, only serial_mt7620 is needed. However with DM, both
> > > serial_mt7620, clk-mt7620 and misc are needed)
> > >
> > > Considering that we may still add some feature to mt7620_rfb_defconfig
> > > in the future, only 3KiB left is not enough. Building without DM is
> > > apparently better.
> > >
> > > I believe using of-platdata can only reduce few KiBs of SPL, because the
> > > DM itself is the largest overhead.
> >
> > That's not my experience. The core DM overhead is fairly small,
> > perhaps 3-4KB. The device tree itself is typically at least another
> > 3KB, depending on how many nodes you mark for inclusion in SPL.
> >
> > With of-platdata the overhead of DM is not that terrible. You can see
> > some stats here:
>
> I have tried to optimize drivers and configs used in SPL, and managed to
> reduce the size of SPL to 22KiB with of-platdata (without DM, the size
> is 17KiB. So it's only 5KiB used by DM).
>
> I'll switch this driver to of-platdata in the next series.

Gosh that was quick, nice work!

>
> >
> > http://u-boot.10912.n7.nabble.com/RFC-PATCH-v2-0-3-RFC-tiny-dm-Proposal-for-using-driver-model-in-SPL-td418552.html

Regards,
Simon


More information about the U-Boot mailing list