All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Junhui Liu" <junhui.liu@pigmoral.tech>
To: "E Shattow" <e@freeshell.de>,
	"Anirudh Srinivasan" <asrinivasan@oss.tenstorrent.com>,
	"Junhui Liu" <junhui.liu@pigmoral.tech>
Cc: <u-boot@lists.u-boot-project.org>, "Yao Zi" <me@ziyao.cc>,
	<u-boot-spacemit@groups.io>, "Tom Rini" <trini@konsulko.com>,
	"Yixun Lan" <dlan@kernel.org>,
	"Tim Ouyang" <tim609@andestech.com>,
	"Leo Liang" <leo.liang@sifive.com>,
	"Huan Zhou" <pericycle.cc@gmail.com>,
	"Eric Chung" <eric.chung@riscstar.com>
Subject: Re: [PATCH 2/5] riscv: spacemit: k3: Add SPL initialization support
Date: Fri, 27 Nov 2026 11:38:36 +0800	[thread overview]
Message-ID: <DN5OI2G4C1U2.103YTJGESLMES@pigmoral.tech> (raw)
In-Reply-To: <589eed22-6a01-40be-afd1-536662e8c30d@freeshell.de>

Hi Anirudh, E,

On Fri Nov 27, 2026 at 5:20 AM CST, E Shattow wrote:
> On 11/26/26 13:13, Anirudh Srinivasan wrote:
>> On Fri, Nov 06, 2026 at 12:40:40AM +0800, Junhui Liu wrote:
>>> Add SPL initialization support for SpacemiT K3. Enable instruction and
>>> data caches and cache snooping during early hart initialization, and
>>> provide the timer configuration needed for M-mode execution.
>>>
>>> Initialize I2C and read the DDR part number from the board's TLV EEPROM.
>>> Populate the RAM driver's platform data before probing it to initialize
>>> DRAM. Set up the DRAM PMA boundary and record the RAM base and size in
>>> global data.
>>>
>>> Loading the next boot stage is not yet supported.
>>>
>>> Signed-off-by: Junhui Liu <junhui.liu@pigmoral.tech>
>>> ---
>>>  arch/riscv/cpu/k3/Kconfig            |   6 +-
>>>  arch/riscv/cpu/k3/Makefile           |   1 +
>>>  arch/riscv/cpu/k3/spl.c              |  52 ++++++++++++++
>>>  arch/riscv/include/asm/arch-k3/csr.h |  20 ++++++
>>>  arch/riscv/include/asm/arch-k3/spl.h |  11 +++
>>>  board/spacemit/k3/Makefile           |   5 ++
>>>  board/spacemit/k3/spl.c              | 127 +++++++++++++++++++++++++++++++++++
>>>  include/configs/spacemit-k3.h        |   3 +
>>>  8 files changed, 224 insertions(+), 1 deletion(-)
>>>

[...]

>>> +
>>> +static int setup_ddr_plat(void)
>>> +{
>>> +	struct k3_ddr_plat *plat;
>>> +	struct udevice *dev;
>>> +
>>> +	dev = uclass_try_first_device(UCLASS_RAM);
>>> +	if (!dev)
>>> +		return -ENODEV;
>>> +
>>> +	if (!device_is_compatible(dev, "spacemit,k3-ddrc"))
>>> +		return -ENODEV;
>>> +
>>> +	plat = dev_get_plat(dev);
>>> +
>>> +	return read_ddr_part_number(plat->part_number, sizeof(plat->part_number));
>> 
>> Add some kind of fallback here in case we can't read the value from EEPROM. You could use the smallest supported value (4G)? The vendor U-Boot SPL seems to have a fallback, so this should too.

I've checked the vendor code. It falls back to the first entry in the
DRAM part table if the part number is not recognized. I can add a
fallback to the first entry in my driver for both missing and
unrecognized part numbers.

>> 
>> Regards
>> Anirudh Srinivasan
>
> Currently the smallest DRAM sizes for shipping products I know of are 8G
> for the Pico-ITX and CoM260. I don't know of any product that has 4G as
> the DRAM size;  one complication for 4G DRAM size as a fallback is that

I think Anirudh meant 4 GiB per DRAM part here. With two such parts,
the board has 8 GiB of RAM, matching the smallest board configuration
you mentioned.

> the default "addr"-named variables go past 5GiB range so that would fail.
>
> -E

-- 
Best regards,
Junhui Liu


  parent reply	other threads:[~2026-11-27  3:39 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05 16:40 [PATCH 0/5] riscv: spacemit: k3: Add SPL LPDDR5 initialization Junhui Liu
2026-11-05 16:40 ` [PATCH 1/5] ram: spacemit: Add DDR driver for K3 SoC Junhui Liu
2026-11-05 16:40 ` [PATCH 2/5] riscv: spacemit: k3: Add SPL initialization support Junhui Liu
2026-11-26 21:13   ` Anirudh Srinivasan
2026-11-26 21:20     ` E Shattow
2026-11-26 21:49       ` E Shattow
2026-11-27  3:38       ` Junhui Liu [this message]
2026-11-05 16:40 ` [PATCH 3/5] riscv: dts: spacemit: k3: Add SPL device and image descriptions Junhui Liu
2026-11-06  6:59   ` Yixun Lan
2026-11-07  9:06     ` Junhui Liu
2026-11-07 11:08       ` E Shattow
2026-11-05 16:40 ` [PATCH 4/5] configs: spacemit: k3: Enable SPL support Junhui Liu
2026-11-05 16:40 ` [PATCH 5/5] doc: spacemit: k3: Add SPL build instructions Junhui Liu
2026-11-27  4:46 ` [PATCH 0/5] riscv: spacemit: k3: Add SPL LPDDR5 initialization E Shattow
2026-11-28  9:53   ` Junhui Liu
2026-12-03  6:30   ` Junhui Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DN5OI2G4C1U2.103YTJGESLMES@pigmoral.tech \
    --to=junhui.liu@pigmoral.tech \
    --cc=asrinivasan@oss.tenstorrent.com \
    --cc=dlan@kernel.org \
    --cc=e@freeshell.de \
    --cc=eric.chung@riscstar.com \
    --cc=leo.liang@sifive.com \
    --cc=me@ziyao.cc \
    --cc=pericycle.cc@gmail.com \
    --cc=tim609@andestech.com \
    --cc=trini@konsulko.com \
    --cc=u-boot-spacemit@groups.io \
    --cc=u-boot@lists.u-boot-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.