All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ye Li <ye.li@nxp.com>
To: u-boot@lists.denx.de
Subject: [EXT] [PATCH] ARM: imx: Add OCRAM_S into iMX8M MMU tables
Date: Sat, 27 Feb 2021 06:26:54 +0000	[thread overview]
Message-ID: <1614340964.112899.26.camel@nxp.com> (raw)
In-Reply-To: <872dc185-856f-ee55-b58c-838fb1ee6593@denx.de>

Hi Marek,

On Fri, 2021-02-26 at 13:44 +0100, Marek Vasut wrote:
> Caution: EXT Email
> 
> On 2/26/21 8:15 AM, Ye Li wrote:
> > 
> > Hi Marek,
> > 
> > On Thu, 2021-02-25 at 21:52 +0100, Marek Vasut wrote:
> > > 
> > > Caution: EXT Email
> > > 
> > > The OCRAM_S is regular memory, just like the OCRAM, add it to the
> > > MMU
> > > tables so it can be used and cached.
> > > 
> > > Signed-off-by: Marek Vasut <marex@denx.de>
> > > Cc: Fabio Estevam <festevam@gmail.com>
> > > Cc: Peng Fan <peng.fan@nxp.com>
> > > Cc: Stefano Babic <sbabic@denx.de>
> > > ---
> > > ? arch/arm/mach-imx/imx8m/soc.c | 7 +++++++
> > > ? 1 file changed, 7 insertions(+)
> > > 
> > > diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-
> > > imx/imx8m/soc.c
> > > index 5456c10fb17..225e4e12500 100644
> > > --- a/arch/arm/mach-imx/imx8m/soc.c
> > > +++ b/arch/arm/mach-imx/imx8m/soc.c
> > > @@ -104,6 +104,13 @@ static struct mm_region imx8m_mem_map[] = {
> > > ?????????????????.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
> > > ??????????????????????????PTE_BLOCK_NON_SHARE |
> > > ??????????????????????????PTE_BLOCK_PXN | PTE_BLOCK_UXN
> > > +???????}, {
> > > +???????????????/* OCRAM_S */
> > > +???????????????.virt = 0x180000UL,
> > > +???????????????.phys = 0x180000UL,
> > > +???????????????.size = 0x8000UL,
> > > +???????????????.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
> > > +????????????????????????PTE_BLOCK_OUTER_SHARE
> > > ?????????}, {
> > > ?????????????????/* TCM */
> > > ?????????????????.virt = 0x7C0000UL,
> > > --
> > > 2.30.0
> > > 
> > OCRAM_S is used by ATF and SPL to pass DDR CSR data.
> Where is this implemented ?

See below definition in?drivers/ddr/imx/imx8m/Kconfig

config SAVED_DRAM_TIMING_BASE
	hex "Define the base address for saved dram timing"
	help
	??after DRAM is trained, need to save the dram related timming
	??info into memory for low power use. OCRAM_S is used for this
	??purpose on i.MX8MM.
	default 0x180000
> 
> > 
> > It is better not
> > use it in u-boot to avoid any DDR issue.
> The MMU table entry does not trigger any IO to the OCRAM_S , it
> merely
> makes it cacheable .
> 
That's fine to add a map, just remind to use it carefully since it
already used by ATF.

> > 
> > And this imx8m_mem_map will be modified at runtime to get rid of
> > optee
> > memory. When OCRAM_S is added, the index used in enable_caches and
> > dram_init need update as well.
> I'm not sure I understand this. What kind of modification are you
> talking about ? The DRAM entry offset should be determined
> automatically, so there shouldn't be any need to hand-tune ad-hoc
> offsets.

You also need below change, the index for DRAM1 is used in codes to
help remove the OPTEE space from MMU table.

--- a/arch/arm/mach-imx/imx8m/soc.c
+++ b/arch/arm/mach-imx/imx8m/soc.c
@@ -167,10 +167,10 @@ void enable_caches(void)
?????????????????* please make sure that entry initial value matches
?????????????????* imx8m_mem_map for DRAM1
?????????????????*/
-???????????????int entry = 5;
+???????????????int entry = 6;
????????????????u64 attrs = imx8m_mem_map[entry].attrs;
?
-???????????????while (i < CONFIG_NR_DRAM_BANKS && entry < 8) {
+???????????????while (i < CONFIG_NR_DRAM_BANKS && entry < 9) {
????????????????????????if (gd->bd->bi_dram[i].start == 0)
????????????????????????????????break;
????????????????????????imx8m_mem_map[entry].phys = gd->bd-
>bi_dram[i].start;
@@ -212,7 +212,7 @@ int dram_init(void)
????????????????gd->ram_size = sdram_size;
?
????????/* also update the SDRAM size in the mem_map used externally */
-???????imx8m_mem_map[5].size = sdram_size;
+???????imx8m_mem_map[6].size = sdram_size;
?
?#ifdef PHYS_SDRAM_2_SIZE
????????gd->ram_size += PHYS_SDRAM_2_SIZE;

Best regards,
Ye Li

  reply	other threads:[~2021-02-27  6:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-25 20:52 [PATCH] ARM: imx: Add OCRAM_S into iMX8M MMU tables Marek Vasut
2021-02-26  7:15 ` [EXT] " Ye Li
2021-02-26 12:44   ` Marek Vasut
2021-02-27  6:26     ` Ye Li [this message]
2021-02-27 12:57       ` Marek Vasut
2021-04-08 20:58 ` sbabic at denx.de

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=1614340964.112899.26.camel@nxp.com \
    --to=ye.li@nxp.com \
    --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 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.