Commit a851604ca36493e8319a7d3a17594b7224d546fe

Authored by Tom Rini

Merge branch 'master' of http://git.denx.de/u-boot-sunxi

Showing 24 changed files Side-by-side Diff

arch/arm/cpu/armv7/exynos/spl_boot.c
... ... @@ -309,5 +309,4 @@
309 309 while (1)
310 310 ;
311 311 }
312   -void save_boot_params(u32 r0, u32 r1, u32 r2, u32 r3) {}
arch/arm/cpu/armv7/omap-common/lowlevel_init.S
... ... @@ -19,7 +19,7 @@
19 19 ENTRY(save_boot_params)
20 20 ldr r1, =OMAP_SRAM_SCRATCH_BOOT_PARAMS
21 21 str r0, [r1]
22   - bx lr
  22 + b save_boot_params_ret
23 23 ENDPROC(save_boot_params)
24 24  
25 25 ENTRY(set_pl310_ctrl_reg)
arch/arm/cpu/armv7/omap3/lowlevel_init.S
... ... @@ -23,7 +23,7 @@
23 23 ldr r5, [r0, #0x4]
24 24 and r5, r5, #0xff
25 25 str r5, [r4]
26   - bx lr
  26 + b save_boot_params_ret
27 27 ENDPROC(save_boot_params)
28 28 #endif
29 29  
arch/arm/cpu/armv7/start.S
... ... @@ -31,9 +31,12 @@
31 31 *************************************************************************/
32 32  
33 33 .globl reset
  34 + .globl save_boot_params_ret
34 35  
35 36 reset:
36   - bl save_boot_params
  37 + /* Allow the board to save important registers */
  38 + b save_boot_params
  39 +save_boot_params_ret:
37 40 /*
38 41 * disable interrupts (FIQ and IRQ), also set the cpu to SVC32 mode,
39 42 * except if in HYP mode already
... ... @@ -96,7 +99,7 @@
96 99 *
97 100 *************************************************************************/
98 101 ENTRY(save_boot_params)
99   - bx lr @ back to my caller
  102 + b save_boot_params_ret @ back to my caller
100 103 ENDPROC(save_boot_params)
101 104 .weak save_boot_params
102 105  
arch/arm/cpu/armv7/sunxi/Makefile
... ... @@ -11,6 +11,7 @@
11 11 obj-y += board.o
12 12 obj-y += clock.o
13 13 obj-y += cpu_info.o
  14 +obj-y += dram_helpers.o
14 15 obj-y += pinmux.o
15 16 obj-y += usbc.o
16 17 obj-$(CONFIG_MACH_SUN6I) += prcm.o
... ... @@ -38,8 +39,6 @@
38 39 obj-$(CONFIG_MACH_SUN6I) += dram_sun6i.o
39 40 obj-$(CONFIG_MACH_SUN7I) += dram_sun4i.o
40 41 obj-$(CONFIG_MACH_SUN8I) += dram_sun8i.o
41   -ifdef CONFIG_SPL_FEL
42   -obj-y += start.o
43   -endif
  42 +obj-y += fel_utils.o
44 43 endif
arch/arm/cpu/armv7/sunxi/board.c
... ... @@ -27,6 +27,17 @@
27 27  
28 28 #include <linux/compiler.h>
29 29  
  30 +struct fel_stash {
  31 + uint32_t sp;
  32 + uint32_t lr;
  33 + uint32_t cpsr;
  34 + uint32_t sctlr;
  35 + uint32_t vbar;
  36 + uint32_t cr;
  37 +};
  38 +
  39 +struct fel_stash fel_stash __attribute__((section(".data")));
  40 +
30 41 static int gpio_init(void)
31 42 {
32 43 #if CONFIG_CONS_INDEX == 1 && defined(CONFIG_UART0_PORT_F)
... ... @@ -65,6 +76,12 @@
65 76 return 0;
66 77 }
67 78  
  79 +void spl_board_load_image(void)
  80 +{
  81 + debug("Returning to FEL sp=%x, lr=%x\n", fel_stash.sp, fel_stash.lr);
  82 + return_to_fel(fel_stash.sp, fel_stash.lr);
  83 +}
  84 +
68 85 void s_init(void)
69 86 {
70 87 #if defined CONFIG_MACH_SUN6I || defined CONFIG_MACH_SUN8I
... ... @@ -95,7 +112,34 @@
95 112 */
96 113 u32 spl_boot_device(void)
97 114 {
98   - return BOOT_DEVICE_MMC1;
  115 +#ifdef CONFIG_SPL_FEL
  116 + /*
  117 + * This is the legacy compile time configuration for a special FEL
  118 + * enabled build. It has many restrictions and can only boot over USB.
  119 + */
  120 + return BOOT_DEVICE_BOARD;
  121 +#else
  122 + /*
  123 + * When booting from the SD card, the "eGON.BT0" signature is expected
  124 + * to be found in memory at the address 0x0004 (see the "mksunxiboot"
  125 + * tool, which generates this header).
  126 + *
  127 + * When booting in the FEL mode over USB, this signature is patched in
  128 + * memory and replaced with something else by the 'fel' tool. This other
  129 + * signature is selected in such a way, that it can't be present in a
  130 + * valid bootable SD card image (because the BROM would refuse to
  131 + * execute the SPL in this case).
  132 + *
  133 + * This branch is just making a decision at runtime whether to load
  134 + * the main u-boot binary from the SD card (if the "eGON.BT0" signature
  135 + * is found) or return to the FEL code in the BROM to wait and receive
  136 + * the main u-boot binary over USB.
  137 + */
  138 + if (readl(4) == 0x4E4F4765 && readl(8) == 0x3054422E) /* eGON.BT0 */
  139 + return BOOT_DEVICE_MMC1;
  140 + else
  141 + return BOOT_DEVICE_BOARD;
  142 +#endif
99 143 }
100 144  
101 145 /* No confirmation data available in SPL yet. Hardcode bootmode */
arch/arm/cpu/armv7/sunxi/config.mk
1 1 # Build a combined spl + u-boot image
2 2 ifdef CONFIG_SPL
3 3 ifndef CONFIG_SPL_BUILD
4   -ifndef CONFIG_SPL_FEL
5 4 ALL-y += u-boot-sunxi-with-spl.bin
6   -endif
7 5 endif
8 6 endif
arch/arm/cpu/armv7/sunxi/dram_helpers.c
  1 +/*
  2 + * DRAM init helper functions
  3 + *
  4 + * (C) Copyright 2015 Hans de Goede <hdegoede@redhat.com>
  5 + *
  6 + * SPDX-License-Identifier: GPL-2.0+
  7 + */
  8 +
  9 +#include <common.h>
  10 +#include <asm/io.h>
  11 +#include <asm/arch/dram.h>
  12 +
  13 +/*
  14 + * Wait up to 1s for value to be set in given part of reg.
  15 + */
  16 +void mctl_await_completion(u32 *reg, u32 mask, u32 val)
  17 +{
  18 + unsigned long tmo = timer_get_us() + 1000000;
  19 +
  20 + while ((readl(reg) & mask) != val) {
  21 + if (timer_get_us() > tmo)
  22 + panic("Timeout initialising DRAM\n");
  23 + }
  24 +}
  25 +
  26 +/*
  27 + * Test if memory at offset offset matches memory at begin of DRAM
  28 + */
  29 +bool mctl_mem_matches(u32 offset)
  30 +{
  31 + /* Try to write different values to RAM at two addresses */
  32 + writel(0, CONFIG_SYS_SDRAM_BASE);
  33 + writel(0xaa55aa55, CONFIG_SYS_SDRAM_BASE + offset);
  34 + /* Check if the same value is actually observed when reading back */
  35 + return readl(CONFIG_SYS_SDRAM_BASE) ==
  36 + readl(CONFIG_SYS_SDRAM_BASE + offset);
  37 +}
arch/arm/cpu/armv7/sunxi/fel_utils.S
  1 +/*
  2 + * Utility functions for FEL mode.
  3 + *
  4 + * Copyright (c) 2015 Google, Inc
  5 + *
  6 + * SPDX-License-Identifier: GPL-2.0+
  7 + */
  8 +
  9 +#include <asm-offsets.h>
  10 +#include <config.h>
  11 +#include <asm/system.h>
  12 +#include <linux/linkage.h>
  13 +
  14 +ENTRY(save_boot_params)
  15 + ldr r0, =fel_stash
  16 + str sp, [r0, #0]
  17 + str lr, [r0, #4]
  18 + mrs lr, cpsr @ Read CPSR
  19 + str lr, [r0, #8]
  20 + mrc p15, 0, lr, c1, c0, 0 @ Read CP15 SCTLR Register
  21 + str lr, [r0, #12]
  22 + mrc p15, 0, lr, c12, c0, 0 @ Read VBAR
  23 + str lr, [r0, #16]
  24 + mrc p15, 0, lr, c1, c0, 0 @ Read CP15 Control Register
  25 + str lr, [r0, #20]
  26 + b save_boot_params_ret
  27 +ENDPROC(save_boot_params)
  28 +
  29 +ENTRY(return_to_fel)
  30 + mov sp, r0
  31 + mov lr, r1
  32 + ldr r0, =fel_stash
  33 + ldr r1, [r0, #20]
  34 + mcr p15, 0, r1, c1, c0, 0 @ Write CP15 Control Register
  35 + ldr r1, [r0, #16]
  36 + mcr p15, 0, r1, c12, c0, 0 @ Write VBAR
  37 + ldr r1, [r0, #12]
  38 + mcr p15, 0, r1, c1, c0, 0 @ Write CP15 SCTLR Register
  39 + ldr r1, [r0, #8]
  40 + msr cpsr, r1 @ Write CPSR
  41 + bx lr
  42 +ENDPROC(return_to_fel)
arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.lds
1   -/*
2   - * (C) Copyright 2013
3   - * Henrik Nordstrom <henrik@henriknordstrom.net>
4   - *
5   - * SPDX-License-Identifier: GPL-2.0+
6   - */
7   -OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
8   -OUTPUT_ARCH(arm)
9   -ENTRY(s_init)
10   -SECTIONS
11   -{
12   - . = 0x00002000;
13   -
14   - . = ALIGN(4);
15   - .text :
16   - {
17   - *(.text.s_init)
18   - *(.text*)
19   - }
20   -
21   - . = ALIGN(4);
22   - .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
23   -
24   - . = ALIGN(4);
25   - .data : {
26   - *(.data*)
27   - }
28   -
29   - . = ALIGN(4);
30   - .u_boot_list : {
31   - KEEP(*(SORT(.u_boot_list*)));
32   - }
33   -
34   - . = ALIGN(4);
35   - . = .;
36   -
37   - . = ALIGN(4);
38   - .rel.dyn : {
39   - __rel_dyn_start = .;
40   - *(.rel*)
41   - __rel_dyn_end = .;
42   - }
43   -
44   - .dynsym : {
45   - __dynsym_start = .;
46   - *(.dynsym)
47   - }
48   -
49   - . = ALIGN(4);
50   - .note.gnu.build-id :
51   - {
52   - *(.note.gnu.build-id)
53   - }
54   - _end = .;
55   -
56   - . = ALIGN(4096);
57   - .mmutable : {
58   - *(.mmutable)
59   - }
60   -
61   - .bss_start __rel_dyn_start (OVERLAY) : {
62   - KEEP(*(.__bss_start));
63   - __bss_base = .;
64   - }
65   -
66   - .bss __bss_base (OVERLAY) : {
67   - *(.bss*)
68   - . = ALIGN(4);
69   - __bss_limit = .;
70   - }
71   -
72   - .bss_end __bss_limit (OVERLAY) : {
73   - KEEP(*(.__bss_end));
74   - }
75   -
76   - /DISCARD/ : { *(.dynstr*) }
77   - /DISCARD/ : { *(.dynamic*) }
78   - /DISCARD/ : { *(.plt*) }
79   - /DISCARD/ : { *(.interp*) }
80   - /DISCARD/ : { *(.gnu*) }
81   - /DISCARD/ : { *(.note*) }
82   -}
arch/arm/include/asm/arch-sunxi/dram.h
... ... @@ -25,32 +25,8 @@
25 25 #endif
26 26  
27 27 unsigned long sunxi_dram_init(void);
28   -
29   -/*
30   - * Wait up to 1s for value to be set in given part of reg.
31   - */
32   -static inline void mctl_await_completion(u32 *reg, u32 mask, u32 val)
33   -{
34   - unsigned long tmo = timer_get_us() + 1000000;
35   -
36   - while ((readl(reg) & mask) != val) {
37   - if (timer_get_us() > tmo)
38   - panic("Timeout initialising DRAM\n");
39   - }
40   -}
41   -
42   -/*
43   - * Test if memory at offset offset matches memory at begin of DRAM
44   - */
45   -static inline bool mctl_mem_matches(u32 offset)
46   -{
47   - /* Try to write different values to RAM at two addresses */
48   - writel(0, CONFIG_SYS_SDRAM_BASE);
49   - writel(0xaa55aa55, CONFIG_SYS_SDRAM_BASE + offset);
50   - /* Check if the same value is actually observed when reading back */
51   - return readl(CONFIG_SYS_SDRAM_BASE) ==
52   - readl(CONFIG_SYS_SDRAM_BASE + offset);
53   -}
  28 +void mctl_await_completion(u32 *reg, u32 mask, u32 val);
  29 +bool mctl_mem_matches(u32 offset);
54 30  
55 31 #endif /* _SUNXI_DRAM_H */
arch/arm/include/asm/arch-sunxi/sys_proto.h
... ... @@ -13,5 +13,15 @@
13 13  
14 14 void sdelay(unsigned long);
15 15  
  16 +/* return_to_fel() - Return to BROM from SPL
  17 + *
  18 + * This returns back into the BROM after U-Boot SPL has performed its initial
  19 + * init. It uses the provided lr and sp to do so.
  20 + *
  21 + * @lr: BROM link register value (return address)
  22 + * @sp: BROM stack pointer
  23 + */
  24 +void return_to_fel(uint32_t lr, uint32_t sp);
  25 +
16 26 #endif
arch/arm/include/asm/spl.h
... ... @@ -26,9 +26,13 @@
26 26 BOOT_DEVICE_SPI,
27 27 BOOT_DEVICE_SATA,
28 28 BOOT_DEVICE_I2C,
  29 + BOOT_DEVICE_BOARD,
29 30 BOOT_DEVICE_NONE
30 31 };
31 32 #endif
  33 +
  34 +/* Board-specific load method */
  35 +void spl_board_load_image(void);
32 36  
33 37 /* Linker symbols. */
34 38 extern char __bss_start[], __bss_end[];
arch/arm/include/asm/system.h
... ... @@ -142,6 +142,21 @@
142 142  
143 143 #ifndef __ASSEMBLY__
144 144  
  145 +/**
  146 + * save_boot_params() - Save boot parameters before starting reset sequence
  147 + *
  148 + * If you provide this function it will be called immediately U-Boot starts,
  149 + * both for SPL and U-Boot proper.
  150 + *
  151 + * All registers are unchanged from U-Boot entry. No registers need be
  152 + * preserved.
  153 + *
  154 + * This is not a normal C function. There is no stack. Return by branching to
  155 + * save_boot_params_ret.
  156 + *
  157 + * void save_boot_params(u32 r0, u32 r1, u32 r2, u32 r3);
  158 + */
  159 +
145 160 #define isb() __asm__ __volatile__ ("" : : : "memory")
146 161  
147 162 #define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t");
board/nokia/rx51/lowlevel_init.S
... ... @@ -37,7 +37,8 @@
37 37  
38 38 .global save_boot_params
39 39 save_boot_params:
40   -
  40 + /* Get return address */
  41 + ldr lr, =save_boot_params_ret
41 42  
42 43 /* Copy valid attached kernel to address KERNEL_ADDRESS */
43 44  
... ... @@ -149,6 +149,16 @@
149 149 bool "SPL/FEL mode support"
150 150 depends on SPL
151 151 default n
  152 + help
  153 + This enables support for Fast Early Loader (FEL) mode. This
  154 + allows U-Boot to be loaded to the board over USB by the on-chip
  155 + boot rom. U-Boot should be sent in two parts: SPL first, with
  156 + 'fel write 0x2000 u-boot-spl.bin; fel exe 0x2000' then U-Boot with
  157 + 'fel write 0x4a000000 u-boot.bin; fel exe 0x4a000000'. This option
  158 + shrinks the amount of SRAM available to SPL, so only enable it if
  159 + you need FEL. Note that enabling this option only allows FEL to be
  160 + used; it is still possible to boot U-Boot from boot media. U-Boot
  161 + SPL detects when it is being loaded using FEL.
152 162  
153 163 config UART0_PORT_F
154 164 bool "UART0 on MicroSD breakout board"
board/sunxi/MAINTAINERS
... ... @@ -46,6 +46,11 @@
46 46 F: board/sunxi/dram_a20_olinuxino_l2.c
47 47 F: configs/A20-OLinuXino-Lime2_defconfig
48 48  
  49 +AMPE A76 BOARD
  50 +M: Paul Kocialkowski <contact@paulk.fr>
  51 +S: Maintained
  52 +F: configs/Ampe_A76_defconfig
  53 +
49 54 COLOMBUS BOARD
50 55 M: Maxime Ripard <maxime.ripard@free-electrons.com>
51 56 S: Maintained
52 57  
... ... @@ -57,9 +62,7 @@
57 62 S: Maintained
58 63 F: include/configs/sun7i.h
59 64 F: configs/Cubieboard2_defconfig
60   -F: configs/Cubieboard2_FEL_defconfig
61 65 F: configs/Cubietruck_defconfig
62   -F: configs/Cubietruck_FEL_defconfig
63 66  
64 67 GEMEI-G9 TABLET
65 68 M: Priit Laes <plaes@plaes.org>
... ... @@ -229,6 +229,11 @@
229 229 spl_sata_load_image();
230 230 break;
231 231 #endif
  232 +#ifdef CONFIG_SPL_BOARD_LOAD_IMAGE
  233 + case BOOT_DEVICE_BOARD:
  234 + spl_board_load_image();
  235 + break;
  236 +#endif
232 237 default:
233 238 #if defined(CONFIG_SPL_SERIAL_SUPPORT) && defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
234 239 puts("SPL: Unsupported Boot Device!\n");
configs/Ampe_A76_defconfig
  1 +CONFIG_SPL=y
  2 +CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=2,AXP209_POWER"
  3 +CONFIG_FDTFILE="sun5i-a13-ampe-a76.dtb"
  4 +CONFIG_USB_MUSB_SUNXI=y
  5 +CONFIG_USB0_VBUS_PIN="PG12"
  6 +CONFIG_VIDEO_LCD_MODE="x:800,y:480,depth:18,pclk_khz:33000,le:45,ri:82,up:22,lo:22,hs:1,vs:1,sync:3,vmode:0"
  7 +CONFIG_VIDEO_LCD_POWER="AXP0-0"
  8 +CONFIG_VIDEO_LCD_BL_EN="AXP0-1"
  9 +CONFIG_VIDEO_LCD_BL_PWM="PB2"
  10 ++S:CONFIG_ARM=y
  11 ++S:CONFIG_ARCH_SUNXI=y
  12 ++S:CONFIG_MACH_SUN5I=y
  13 ++S:CONFIG_DRAM_CLK=432
  14 ++S:CONFIG_DRAM_ZQ=123
  15 ++S:CONFIG_DRAM_EMR1=4
drivers/usb/musb-new/sunxi.c
... ... @@ -145,16 +145,6 @@
145 145 musb_writel(base, USBC_REG_o_ISCR, reg_val);
146 146 }
147 147  
148   -static void USBC_ForceVbusValidDisable(__iomem void *base)
149   -{
150   - u32 reg_val;
151   -
152   - reg_val = musb_readl(base, USBC_REG_o_ISCR);
153   - reg_val &= ~(0x03 << USBC_BP_ISCR_FORCE_VBUS_VALID);
154   - reg_val = USBC_WakeUp_ClearChangeDetect(reg_val);
155   - musb_writel(base, USBC_REG_o_ISCR, reg_val);
156   -}
157   -
158 148 static void USBC_ForceVbusValidToHigh(__iomem void *base)
159 149 {
160 150 u32 reg_val;
161 151  
162 152  
... ... @@ -248,12 +238,11 @@
248 238 if (is_host_enabled(musb)) {
249 239 /* Host mode */
250 240 USBC_ForceIdToLow(musb->mregs);
251   - USBC_ForceVbusValidToHigh(musb->mregs);
252 241 } else {
253 242 /* Peripheral mode */
254 243 USBC_ForceIdToHigh(musb->mregs);
255   - USBC_ForceVbusValidDisable(musb->mregs);
256 244 }
  245 + USBC_ForceVbusValidToHigh(musb->mregs);
257 246  
258 247 return 0;
259 248 }
drivers/video/sunxi_display.c
... ... @@ -46,6 +46,7 @@
46 46 GraphicDevice graphic_device;
47 47 enum sunxi_monitor monitor;
48 48 unsigned int depth;
  49 + unsigned int fb_size;
49 50 } sunxi_display;
50 51  
51 52 #ifdef CONFIG_VIDEO_HDMI
... ... @@ -1060,6 +1061,11 @@
1060 1061 return NULL; /* never reached */
1061 1062 }
1062 1063  
  1064 +ulong board_get_usable_ram_top(ulong total_size)
  1065 +{
  1066 + return gd->ram_top - CONFIG_SUNXI_MAX_FB_SIZE;
  1067 +}
  1068 +
1063 1069 void *video_hw_init(void)
1064 1070 {
1065 1071 static GraphicDevice *graphic_device = &sunxi_display.graphic_device;
... ... @@ -1075,10 +1081,6 @@
1075 1081  
1076 1082 memset(&sunxi_display, 0, sizeof(struct sunxi_display));
1077 1083  
1078   - printf("Reserved %dkB of RAM for Framebuffer.\n",
1079   - CONFIG_SUNXI_FB_SIZE >> 10);
1080   - gd->fb_base = gd->ram_top;
1081   -
1082 1084 video_get_ctfb_res_modes(RES_MODE_1024x768, 24, &mode,
1083 1085 &sunxi_display.depth, &options);
1084 1086 #ifdef CONFIG_VIDEO_HDMI
... ... @@ -1169,6 +1171,17 @@
1169 1171 mode->yres, sunxi_get_mon_desc(sunxi_display.monitor));
1170 1172 }
1171 1173  
  1174 + sunxi_display.fb_size =
  1175 + (mode->xres * mode->yres * 4 + 0xfff) & ~0xfff;
  1176 + if (sunxi_display.fb_size > CONFIG_SUNXI_MAX_FB_SIZE) {
  1177 + printf("Error need %dkB for fb, but only %dkB is reserved\n",
  1178 + sunxi_display.fb_size >> 10,
  1179 + CONFIG_SUNXI_MAX_FB_SIZE >> 10);
  1180 + return NULL;
  1181 + }
  1182 +
  1183 + gd->fb_base = gd->bd->bi_dram[0].start +
  1184 + gd->bd->bi_dram[0].size - sunxi_display.fb_size;
1172 1185 sunxi_engines_init();
1173 1186 sunxi_mode_set(mode, gd->fb_base - CONFIG_SYS_SDRAM_BASE);
1174 1187  
... ... @@ -1194,6 +1207,7 @@
1194 1207 {
1195 1208 static GraphicDevice *graphic_device = &sunxi_display.graphic_device;
1196 1209 int offset, ret;
  1210 + u64 start, size;
1197 1211 const char *pipeline = NULL;
1198 1212  
1199 1213 #ifdef CONFIG_MACH_SUN4I
... ... @@ -1235,6 +1249,20 @@
1235 1249 if (offset < 0) {
1236 1250 eprintf("Cannot setup simplefb: node not found\n");
1237 1251 return 0; /* Keep older kernels working */
  1252 + }
  1253 +
  1254 + /*
  1255 + * Do not report the framebuffer as free RAM to the OS, note we cannot
  1256 + * use fdt_add_mem_rsv() here, because then it is still seen as RAM,
  1257 + * and e.g. Linux refuses to iomap RAM on ARM, see:
  1258 + * linux/arch/arm/mm/ioremap.c around line 301.
  1259 + */
  1260 + start = gd->bd->bi_dram[0].start;
  1261 + size = gd->bd->bi_dram[0].size - sunxi_display.fb_size;
  1262 + ret = fdt_fixup_memory_banks(blob, &start, &size, 1);
  1263 + if (ret) {
  1264 + eprintf("Cannot setup simplefb: Error reserving memory\n");
  1265 + return ret;
1238 1266 }
1239 1267  
1240 1268 ret = fdt_setup_simplefb_node(blob, offset, gd->fb_base,
include/configs/sunxi-common.h
... ... @@ -18,10 +18,8 @@
18 18 */
19 19 #define CONFIG_SUNXI /* sunxi family */
20 20 #ifdef CONFIG_SPL_BUILD
21   -#ifndef CONFIG_SPL_FEL
22 21 #define CONFIG_SYS_THUMB_BUILD /* Thumbs mode to save space in SPL */
23 22 #endif
24   -#endif
25 23  
26 24 #include <asm/arch/cpu.h> /* get chip and board defs */
27 25  
28 26  
... ... @@ -145,10 +143,10 @@
145 143 #define CONFIG_SPL_SERIAL_SUPPORT
146 144 #define CONFIG_SPL_LIBGENERIC_SUPPORT
147 145  
  146 +#define CONFIG_SPL_BOARD_LOAD_IMAGE
  147 +
148 148 #ifdef CONFIG_SPL_FEL
149 149  
150   -#define CONFIG_SPL_LDSCRIPT "arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.lds"
151   -#define CONFIG_SPL_START_S_PATH "arch/arm/cpu/armv7/sunxi"
152 150 #define CONFIG_SPL_TEXT_BASE 0x2000
153 151 #define CONFIG_SPL_MAX_SIZE 0x4000 /* 16 KiB */
154 152  
155 153  
... ... @@ -206,10 +204,10 @@
206 204  
207 205 #ifdef CONFIG_VIDEO
208 206 /*
209   - * The amount of RAM that is reserved for the FB. This will not show up as
210   - * RAM to the kernel, but will be reclaimed by a KMS driver in future.
  207 + * The amount of RAM to keep free at the top of RAM when relocating u-boot,
  208 + * to use as framebuffer. This must be a multiple of 4096.
211 209 */
212   -#define CONFIG_SUNXI_FB_SIZE (9 << 20)
  210 +#define CONFIG_SUNXI_MAX_FB_SIZE (9 << 20)
213 211  
214 212 /* Do we want to initialize a simple FB? */
215 213 #define CONFIG_VIDEO_DT_SIMPLEFB
... ... @@ -226,8 +224,6 @@
226 224 #define CONFIG_CONSOLE_MUX
227 225 /* stop x86 thinking in cfbconsole from trying to init a pc keyboard */
228 226 #define CONFIG_VGA_AS_SINGLE_DEVICE
229   -
230   -#define CONFIG_SYS_MEM_TOP_HIDE ((CONFIG_SUNXI_FB_SIZE + 0xFFF) & ~0xFFF)
231 227  
232 228 /* To be able to hook simplefb into dt */
233 229 #ifdef CONFIG_VIDEO_DT_SIMPLEFB
scripts/Makefile.spl
... ... @@ -154,9 +154,7 @@
154 154 endif
155 155  
156 156 ifdef CONFIG_SUNXI
157   -ifndef CONFIG_SPL_FEL
158 157 ALL-y += $(obj)/sunxi-spl.bin
159   -endif
160 158 endif
161 159  
162 160 ifeq ($(CONFIG_SYS_SOC),"at91")
... ... @@ -43,19 +43,19 @@
43 43 uint32_t i;
44 44 uint32_t sum;
45 45  
46   - length = head_p->length;
  46 + length = le32_to_cpu(head_p->length);
47 47 if ((length & 0x3) != 0) /* must 4-byte-aligned */
48 48 return -1;
49 49 buf = (uint32_t *)head_p;
50   - head_p->check_sum = STAMP_VALUE; /* fill stamp */
  50 + head_p->check_sum = cpu_to_le32(STAMP_VALUE); /* fill stamp */
51 51 loop = length >> 2;
52 52  
53 53 /* calculate the sum */
54 54 for (i = 0, sum = 0; i < loop; i++)
55   - sum += buf[i];
  55 + sum += le32_to_cpu(buf[i]);
56 56  
57 57 /* write back check sum */
58   - head_p->check_sum = sum;
  58 + head_p->check_sum = cpu_to_le32(sum);
59 59  
60 60 return 0;
61 61 }
62 62  
... ... @@ -125,10 +125,12 @@
125 125 memcpy(img.header.magic, BOOT0_MAGIC, 8); /* no '0' termination */
126 126 img.header.length =
127 127 ALIGN(file_size + sizeof(struct boot_file_head), BLOCK_SIZE);
  128 + img.header.b_instruction = cpu_to_le32(img.header.b_instruction);
  129 + img.header.length = cpu_to_le32(img.header.length);
128 130 gen_check_sum(&img.header);
129 131  
130   - count = write(fd_out, &img, img.header.length);
131   - if (count != img.header.length) {
  132 + count = write(fd_out, &img, le32_to_cpu(img.header.length));
  133 + if (count != le32_to_cpu(img.header.length)) {
132 134 perror("Writing output");
133 135 return EXIT_FAILURE;
134 136 }