[PATCH 2/5] ARM: Rockchip: implement memory read out from controller

Sascha Hauer s.hauer at pengutronix.de
Mon Mar 27 00:32:46 PDT 2023


On Sun, Mar 26, 2023 at 10:34:55AM +0200, Rouven Czerwinski wrote:
> Hi,
> 
> On Fri, 2023-03-24 at 15:03 +0100, Sascha Hauer wrote:
> > From: Ahmad Fatoum <ahmad at a3f.at>
> > 
> > Add a driver to read out the amount of memory from the DDR controller.
> > The decoding of the registers has been taken from U-Boot. Currently
> > supported are the RK3399 and the RK3568, but decoding should work on
> > other Rockchip SoCs as well.
> > 
> > Signed-off-by: Ahmad Fatoum <ahmad at a3f.at>
> > Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
> > ---
> >  arch/arm/mach-rockchip/Makefile     |   1 +
> >  arch/arm/mach-rockchip/dmc.c        | 232 ++++++++++++++++++++++++++++
> >  include/linux/sizes.h               |   3 +
> >  include/mach/rockchip/dmc.h         |  86 +++++++++++
> >  include/mach/rockchip/rk3399-regs.h |   1 +
> >  include/mach/rockchip/rk3568-regs.h |   1 +
> >  6 files changed, 324 insertions(+)
> >  create mode 100644 arch/arm/mach-rockchip/dmc.c
> >  create mode 100644 include/mach/rockchip/dmc.h
> > 

[...]

> > +
> > +resource_size_t rk3568_ram0_size(void)
> > +{
> > +       void __iomem *pmugrf = IOMEM(RK3568_PMUGRF_BASE);
> > +       u32 sys_reg2, sys_reg3;
> > +       resource_size_t size;
> > +
> > +       sys_reg2 = readl(pmugrf + RK3568_PMUGRF_OS_REG2);
> > +       sys_reg3 = readl(pmugrf + RK3568_PMUGRF_OS_REG3);
> > +
> > +       size = rockchip_sdram_size(sys_reg2, sys_reg3);
> > +       size = min_t(resource_size_t, SZ_4G - SZ_128M, size);
>                                            this ^
> Should be SZ_256M, The frist memory region for RK356x is from 0x0 to
> 0xf000_0000, not 0xf800_0000. Tested on Radxa CM3 RK3566.

True. Maybe we should better write 0xf0000000, because that's the
address value where the DDR stops.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list