From: "Jernej Škrabec" <jernej.skrabec@gmail.com>
To: Jagan Teki <jagan@amarulasolutions.com>,
Andre Przywara <andre.przywara@arm.com>,
Mikhail Kalashnikov <iuncuim@gmail.com>
Cc: Samuel Holland <samuel@sholland.org>,
Piotr Oniszczuk <piotr.oniszczuk@gmail.com>,
u-boot@lists.denx.de
Subject: Re: [PATCH v3 1/1] sunxi: H616: add LPDDR4 DRAM support
Date: Sat, 11 Nov 2023 08:50:36 +0100 [thread overview]
Message-ID: <12318958.O9o76ZdvQC@jernej-laptop> (raw)
In-Reply-To: <3ff938ac-35c0-4705-86f7-819060ebb2d6@gmail.com>
Dne sobota, 11. november 2023 ob 08:43:22 CET je Mikhail Kalashnikov napisal(a):
> Hi Jernej,
>
> On 04.11.2023 11:31, Jernej Škrabec wrote:
> > Hi Mikhail,
> >
> > I have some notes on LPDDR4 from a long time ago. It mostly matches to your
> > code, but please take a look at comments below.
> >
> > Note that I have extra code, not included in this patch, for
> > mctl_phy_read_training(). At the very beginning, before any other register
> > access is done, this should be added:
> >
> > if (para->type == SUNXI_DRAM_TYPE_LPDDR4) {
> > writel(0, SUNXI_DRAM_PHY0_BASE + 0x800);
> > writel(0, SUNXI_DRAM_PHY0_BASE + 0x81c);
> > }
> >
> > Maybe that will help with other LPDDR4 boards?
>
> Current H618 and t507 boards do not yet require this feature. Yes, this
> feature may be required for future devices. I will add it in the next
> version.
>
> >> @@ -246,8 +251,13 @@ static void mctl_phy_configure_odt(const struct
> >> dram_para *para) {
> >> uint32_t val_lo, val_hi;
> >>
> >> + clrsetbits_le32(SUNXI_DRAM_PHY0_BASE + 0x390, BIT(5), BIT(4));
> >> + clrsetbits_le32(SUNXI_DRAM_PHY0_BASE + 0x3d0, BIT(5), BIT(4));
> >> + clrsetbits_le32(SUNXI_DRAM_PHY0_BASE + 0x410, BIT(5), BIT(4));
> >> + clrsetbits_le32(SUNXI_DRAM_PHY0_BASE + 0x450, BIT(5), BIT(4));
> >
> > I don't have above block. Something from newer libdram? Is it applicable to
> > all DRAM types?
>
> This function is present in the RE code for all types of memory. Binary
> file dumped from orangepi zero3 nor spi.I paid attention to this area
> code when comparing the sunxi u-boot dump (md.l) with the resulting
> mainline u-boot. Now I checked my tvbox with H616 and LPDDR3 and it
> doesn't have this block. In this case, maybe it would be better to make
> it only for devices with LPDDR4?
> >> + case SUNXI_DRAM_TYPE_LPDDR4:
> >> + writel(0x0, &mctl_ctl->mrctrl1);
> >> + writel(0x80000030, &mctl_ctl->mrctrl0);
> >> + mctl_await_completion(&mctl_ctl->mrctrl0, BIT(31), 0);
> > I don't have above block. Maybe difference from newer version of libdram
> > code?
>
> This block was present in the sunxi t507 binaries for which the driver
> was originally intended. Now I checked original dump from orangepi zero3 NOR SPI.
> This is also present here.
>
>
> >> writel(reg_val, &mctl_ctl->odtcfg);
> >> writel(reg_val, &mctl_ctl->unk_0x2240);
> >> writel(reg_val, &mctl_ctl->unk_0x3240);
> > I have extra "writel(BIT(31), &mctl_com->cr);" after this block for all DRAM
> > types. Not sure if it changes anything.
> Looks like this has already been done in previous patches.
> >> + u16 trfc = ns_to_t(280);
> > My notes say 180 instead of 280. Did you check if register value matches if
> > booted with boot0
> I booted from NOR SPI of the sunxi u-boot and made a dump with md.l
> 0x047fb064. It show me value 0030006f, where 0x6f trfc value. Based on
> the transformation function - 111*1000/(792/2)=280,30(30) So, obtained
> value looks correct. Best regards,
> Mikhail
Ok, thanks for double checking. I think next version can be merged and then
issues can be fixed if they appear.
Best regards,
Jernej
prev parent reply other threads:[~2023-11-11 7:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-04 6:22 [PATCH v3 0/1] sunxi: H616: add LPDDR4 support Mikhail Kalashnikov
2023-11-04 6:22 ` [PATCH v3 1/1] sunxi: H616: add LPDDR4 DRAM support Mikhail Kalashnikov
2023-11-04 8:31 ` Jernej Škrabec
2023-11-11 7:43 ` Mikhail Kalashnikov
2023-11-11 7:50 ` Jernej Škrabec [this message]
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=12318958.O9o76ZdvQC@jernej-laptop \
--to=jernej.skrabec@gmail.com \
--cc=andre.przywara@arm.com \
--cc=iuncuim@gmail.com \
--cc=jagan@amarulasolutions.com \
--cc=piotr.oniszczuk@gmail.com \
--cc=samuel@sholland.org \
--cc=u-boot@lists.denx.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox