u-boot-2019.07: Fix for Raspberry Pi 4
[AGL/meta-agl.git] / meta-agl-bsp / meta-raspberrypi / recipes-bsp / u-boot / u-boot-2019.07 / 0007-rpi-Add-memory-map-for-bcm2838.patch
1 From 76b656349a6786fa81cf69ac7762c31675cd567e Mon Sep 17 00:00:00 2001
2 From: Andrei Gherzan <andrei@balena.io>
3 Date: Fri, 12 Jul 2019 14:27:31 +0100
4 Subject: [PATCH 7/7] rpi: Add memory map for bcm2838
5
6 Define the memory map for the BCM2838 based on the dt configuration
7 available in the Raspberry Pi kernel fork.
8
9 Signed-off-by: Andrei Gherzan <andrei@balena.io>
10 Upstream-status: Pending
11 ---
12  board/raspberrypi/rpi/rpi.c | 27 ++++++++++++++++++++++++---
13  1 file changed, 24 insertions(+), 3 deletions(-)
14
15 diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c
16 index 92c6534da6..bddf2a578d 100644
17 --- a/board/raspberrypi/rpi/rpi.c
18 +++ b/board/raspberrypi/rpi/rpi.c
19 @@ -249,7 +249,8 @@ static uint32_t rev_type;
20  static const struct rpi_model *model;
21  
22  #ifdef CONFIG_ARM64
23 -static struct mm_region bcm2837_mem_map[] = {
24 +#ifndef CONFIG_BCM2838
25 +static struct mm_region bcm283x_mem_map[] = {
26         {
27                 .virt = 0x00000000UL,
28                 .phys = 0x00000000UL,
29 @@ -268,8 +269,28 @@ static struct mm_region bcm2837_mem_map[] = {
30                 0,
31         }
32  };
33 -
34 -struct mm_region *mem_map = bcm2837_mem_map;
35 +#else
36 +static struct mm_region bcm283x_mem_map[] = {
37 +       {
38 +               .virt = 0x00000000UL,
39 +               .phys = 0x00000000UL,
40 +               .size = 0xfe000000UL,
41 +               .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
42 +                        PTE_BLOCK_INNER_SHARE
43 +       }, {
44 +               .virt = 0xfe000000UL,
45 +               .phys = 0xfe000000UL,
46 +               .size = 0x01800000UL,
47 +               .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
48 +                        PTE_BLOCK_NON_SHARE |
49 +                        PTE_BLOCK_PXN | PTE_BLOCK_UXN
50 +       }, {
51 +               /* List terminator */
52 +               0,
53 +       }
54 +};
55 +#endif
56 +struct mm_region *mem_map = bcm283x_mem_map;
57  #endif
58  
59  int dram_init(void)
60 -- 
61 2.22.0
62