]> git.karo-electronics.de Git - karo-tx-linux.git/commit
ENGR00297285-1 [MX6x] Support IRAM page table when DDR is in self-refresh.
authorRanjani Vaidyanathan <Ranjani.Vaidyanathan@freescale.com>
Thu, 13 Feb 2014 22:50:20 +0000 (16:50 -0600)
committerRanjani Vaidyanathan <Ranjani.Vaidyanathan@freescale.com>
Tue, 18 Feb 2014 18:08:16 +0000 (12:08 -0600)
commit93ae491d9dbe34a91e2dd5832b02b0f0a390ddbe
tree70cedb3e7a085cd4a091eddfa1ea7061cc017005
parent912e09484adf2cbf05b0338fe696b305f2e481ee
ENGR00297285-1 [MX6x] Support IRAM page table when DDR is in self-refresh.

Whenever DDR is explicitly put into self-refresh, we need to ensure
that no access are made to the DDR. All the bus masters excpet ARM
are shutdown gracefully.
The ARM core can continue to access the DDR due to:
1. Speculative accesses
   This can be prevented by flushing the Branch Target Address Cache
2. Aggressive Prefetching
   This can be minimized by adding nops.
Apart from this the TLB architecture in ARM does not guarantee that
an entry remains in the TLB unless its explicitly locked. Even if
free slots are available an entry maybe evicted. So flushing the TLB
does not guarantee a page table walk will not happen.

The solution is to put a minimized page table in IRAM that can be used when
DDR is in self-refresh. The IRAM page tables should have entries for IRAM,
AIPS1 and AIPS2 as these entries will be needed by the code that puts DDR
into self-refresh. It should not contain any entries that point to the DDR.

This patch set accomplishes the following:
1. Set the IRAM to be mapped as 1M sections in the high mem region.
   This makes it possible to create entries for the IRAM code in the IRAM page table.
We need to ensure that both the DDR and IRAM page table have mapping for the IRAM code.
2. Ensure the IRAM, AIPS1, AIPS2 have entries in the IRAM page table.
3. Save TTBR1
4. Set TTBR1 to point to the page tables stored in IRAM. Switch to using
TTBR1 before DDR is put into self-refresh. Ensure the following settings:
    a. TTBCR.N = 1
     This means the 0-2G virtual address space is translated using TTBR0
     and 2G-4G is translated using TTBR1.
    b. Set TTBCR.PD0 = 1
      With this setting page table walks using TTBR0 are disabled.
4. After the DDR has exited self-refresh, reset TTBCR to 0 (TTBR0 will
be used for translations now).
5. Restore TTBR1

Even though TTBR1 is only used to decode the top 2G of virtual address
space, ARM requires that we allocate the entire 16KB for the page table.
To minimize IRAM/OCRAM required, we put the code in the bottom 8K and
page table entries in the top 8K.
This requires the low power code be optimized to occupy as little space
as possible.

Signed-off-by: Ranjani Vaidyanathan <Ranjani.Vaidyanathan@freescale.com>
arch/arm/mach-imx/busfreq_ddr3.c
arch/arm/mach-imx/busfreq_lpddr2.c
arch/arm/mach-imx/cpuidle-imx6sl.c
arch/arm/mach-imx/ddr3_freq_imx6.S
arch/arm/mach-imx/hardware.h
arch/arm/mach-imx/imx6sl_wfi.S
arch/arm/mach-imx/lpddr2_freq_imx6.S
arch/arm/mach-imx/mx6.h
arch/arm/mach-imx/pm-imx6.c
arch/arm/mach-imx/suspend-imx6.S