Hi,

On Tue, Jan 10, 2017 at 05:18:22PM +0800, Icenowy Zheng wrote:
> Basic U-Boot support is now present for V3s.
> 
> Some memory addresses are changed specially for V3s, as the original
> address map cannot fit into a so small DRAM.
> 
> As the DRAM controller code needs a big refactor, the SPL support is
> disabled in this version.
> 
> Signed-off-by: Icenowy Zheng <[email protected]>
> ---
>  arch/arm/include/asm/arch-sunxi/gpio.h |  1 +
>  arch/arm/mach-sunxi/board.c            |  9 ++++++--
>  arch/arm/mach-sunxi/cpu_info.c         |  2 ++
>  board/sunxi/Kconfig                    | 12 ++++++++--
>  include/configs/sun8i.h                |  2 ++
>  include/configs/sunxi-common.h         | 42 
> +++++++++++++++++++++++++++++++---
>  6 files changed, 61 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/arm/include/asm/arch-sunxi/gpio.h 
> b/arch/arm/include/asm/arch-sunxi/gpio.h
> index 85a4ec3b0e..24f85206c8 100644
> --- a/arch/arm/include/asm/arch-sunxi/gpio.h
> +++ b/arch/arm/include/asm/arch-sunxi/gpio.h
> @@ -161,6 +161,7 @@ enum sunxi_gpio_number {
>  #define SUN8I_GPB_UART2              2
>  #define SUN8I_A33_GPB_UART0  3
>  #define SUN8I_A83T_GPB_UART0 2
> +#define SUN8I_V3S_GPB_UART0  3
>  #define SUN50I_GPB_UART0     4
>  
>  #define SUNXI_GPC_NAND               2
> diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c
> index aa11493748..3b28478e2d 100644
> --- a/arch/arm/mach-sunxi/board.c
> +++ b/arch/arm/mach-sunxi/board.c
> @@ -110,6 +110,10 @@ static int gpio_init(void)
>       sunxi_gpio_set_cfgpin(SUNXI_GPB(9), SUN8I_A83T_GPB_UART0);
>       sunxi_gpio_set_cfgpin(SUNXI_GPB(10), SUN8I_A83T_GPB_UART0);
>       sunxi_gpio_set_pull(SUNXI_GPB(10), SUNXI_GPIO_PULL_UP);
> +#elif CONFIG_CONS_INDEX == 1 && defined(CONFIG_MACH_SUN8I_V3S)
> +     sunxi_gpio_set_cfgpin(SUNXI_GPB(8), SUN8I_V3S_GPB_UART0);
> +     sunxi_gpio_set_cfgpin(SUNXI_GPB(9), SUN8I_V3S_GPB_UART0);
> +     sunxi_gpio_set_pull(SUNXI_GPB(9), SUNXI_GPIO_PULL_UP);
>  #elif CONFIG_CONS_INDEX == 1 && defined(CONFIG_MACH_SUN9I)
>       sunxi_gpio_set_cfgpin(SUNXI_GPH(12), SUN9I_GPH_UART0);
>       sunxi_gpio_set_cfgpin(SUNXI_GPH(13), SUN9I_GPH_UART0);
> @@ -180,10 +184,11 @@ void s_init(void)
>       /* No H3 BSP, boot0 seems to not modify SUNXI_SRAMC_BASE + 0x44 */
>  #endif
>  
> -#if defined CONFIG_MACH_SUN6I || \
> +#if (defined CONFIG_MACH_SUN6I || \
>      defined CONFIG_MACH_SUN7I || \
>      defined CONFIG_MACH_SUN8I || \
> -    defined CONFIG_MACH_SUN9I
> +    defined CONFIG_MACH_SUN9I) && \
> +    !defined CONFIG_MACH_SUN8I_V3S
>       /* Enable SMP mode for CPU0, by setting bit 6 of Auxiliary Ctl reg */
>       asm volatile(
>               "mrc p15, 0, r0, c1, c0, 1\n"
> diff --git a/arch/arm/mach-sunxi/cpu_info.c b/arch/arm/mach-sunxi/cpu_info.c
> index f1f6fd5ba4..15f1e0e45a 100644
> --- a/arch/arm/mach-sunxi/cpu_info.c
> +++ b/arch/arm/mach-sunxi/cpu_info.c
> @@ -87,6 +87,8 @@ int print_cpuinfo(void)
>       printf("CPU:   Allwinner A83T (SUN8I %04x)\n", sunxi_get_sram_id());
>  #elif defined CONFIG_MACH_SUN8I_H3
>       printf("CPU:   Allwinner H3 (SUN8I %04x)\n", sunxi_get_sram_id());
> +#elif defined CONFIG_MACH_SUN8I_V3S
> +     printf("CPU:   Allwinner V3s (SUN8I %04x)\n", sunxi_get_sram_id());
>  #elif defined CONFIG_MACH_SUN9I
>       puts("CPU:   Allwinner A80 (SUN9I)\n");
>  #elif defined CONFIG_MACH_SUN50I
> diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
> index e1d4ab148f..1eb23c3a4c 100644
> --- a/board/sunxi/Kconfig
> +++ b/board/sunxi/Kconfig
> @@ -115,6 +115,14 @@ config MACH_SUN8I_H3
>       select SUPPORT_SPL
>       select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
>  
> +config MACH_SUN8I_V3S
> +     bool "sun8i (Allwinner V3s)"
> +     select CPU_V7
> +     select CPU_V7_HAS_NONSEC
> +     select CPU_V7_HAS_VIRT
> +     select SUNXI_GEN_SUN6I
> +     select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
> +
>  config MACH_SUN9I
>       bool "sun9i (Allwinner A80)"
>       select CPU_V7
> @@ -131,7 +139,7 @@ endchoice
>  # The sun8i SoCs share a lot, this helps to avoid a lot of "if A23 || A33"
>  config MACH_SUN8I
>       bool
> -     default y if MACH_SUN8I_A23 || MACH_SUN8I_A33 || MACH_SUN8I_H3 || 
> MACH_SUN8I_A83T
> +     default y if MACH_SUN8I_A23 || MACH_SUN8I_A33 || MACH_SUN8I_H3 || 
> MACH_SUN8I_A83T || MACH_SUN8I_V3S

This needs some wrapping

>  
>  config DRAM_TYPE
>       int "sunxi dram type"
> @@ -462,7 +470,7 @@ config AXP_GPIO
>  
>  config VIDEO
>       bool "Enable graphical uboot console on HDMI, LCD or VGA"
> -     depends on !MACH_SUN8I_A83T && !MACH_SUN8I_H3 && !MACH_SUN9I && 
> !MACH_SUN50I
> +     depends on !MACH_SUN8I_A83T && !MACH_SUN8I_H3 && !MACH_SUN8I_V3S && 
> !MACH_SUN9I && !MACH_SUN50I

Ditto.

>       default y
>       ---help---
>       Say Y here to add support for using a cfb console on the HDMI, LCD
> diff --git a/include/configs/sun8i.h b/include/configs/sun8i.h
> index a4c3fb69e4..6ac42acaea 100644
> --- a/include/configs/sun8i.h
> +++ b/include/configs/sun8i.h
> @@ -21,6 +21,8 @@
>       #define CONFIG_SUNXI_USB_PHYS   4
>  #elif defined CONFIG_MACH_SUN8I_A83T
>       #define CONFIG_SUNXI_USB_PHYS   3
> +#elif defined CONFIG_MACH_SUN8I_V3S
> +     #define CONFIG_SUNXI_USB_PHYS   1
>  #else
>       #define CONFIG_SUNXI_USB_PHYS   2
>  #endif
> diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
> index b0bfc0dfd7..f4489fad6d 100644
> --- a/include/configs/sunxi-common.h
> +++ b/include/configs/sunxi-common.h
> @@ -75,8 +75,13 @@
>  #else
>  #define SDRAM_OFFSET(x) 0x4##x
>  #define CONFIG_SYS_SDRAM_BASE                0x40000000
> -#define CONFIG_SYS_LOAD_ADDR         0x42000000 /* default load address */
> +#define CONFIG_SYS_LOAD_ADDR         0x41000000 /* default load address */
> +/* V3s do not have enough memory to place code at 0x4a000000 */
> +#ifndef CONFIG_MACH_SUN8I_V3S
>  #define CONFIG_SYS_TEXT_BASE         0x4a000000
> +#else
> +#define CONFIG_SYS_TEXT_BASE         0x42e00000
> +#endif
>  /* Note SPL_STACK_R_ADDR is set through Kconfig, we include it here 
>   * since it needs to fit in with the other values. By also #defining it
>   * we get warnings if the Kconfig value mismatches. */
> @@ -148,8 +153,13 @@
>  #define CONFIG_SYS_MMC_MAX_DEVICE    4
>  #endif
>  
> +#ifndef CONFIG_MACH_SUN8I_V3S
>  /* 64MB of malloc() pool */
>  #define CONFIG_SYS_MALLOC_LEN                (CONFIG_ENV_SIZE + (64 << 20))
> +#else
> +/* 2MB of malloc() pool */
> +#define CONFIG_SYS_MALLOC_LEN                (CONFIG_ENV_SIZE + (2 << 20))
> +#endif
>  
>  /*
>   * Miscellaneous configurable options
> @@ -280,7 +290,11 @@ extern int soft_i2c_gpio_scl;
>   * The amount of RAM to keep free at the top of RAM when relocating u-boot,
>   * to use as framebuffer. This must be a multiple of 4096.
>   */
> +#ifndef CONFIG_MACH_SUN8I_V3S
>  #define CONFIG_SUNXI_MAX_FB_SIZE (16 << 20)
> +#else
> +#define CONFIG_SUNXI_MAX_FB_SIZE (2 << 20)
> +#endif

Do you need that? CONFIG_VIDEO is disabled, so there's no need to
reserve space for a framebuffer.

>  
>  /* Do we want to initialize a simple FB? */
>  #define CONFIG_VIDEO_DT_SIMPLEFB
> @@ -383,27 +397,49 @@ extern int soft_i2c_gpio_scl;
>   * 32M uncompressed kernel, 16M compressed kernel, 1M fdt,
>   * 1M script, 1M pxe and the ramdisk at the end.
>   */
> -
> +#ifndef CONFIG_MACH_SUN8I_V3S
> +#define BOOTM_SIZE     __stringify(0xa000000)
>  #define KERNEL_ADDR_R  __stringify(SDRAM_OFFSET(2000000))
>  #define FDT_ADDR_R     __stringify(SDRAM_OFFSET(3000000))
>  #define SCRIPT_ADDR_R  __stringify(SDRAM_OFFSET(3100000))
>  #define PXEFILE_ADDR_R __stringify(SDRAM_OFFSET(3200000))
>  #define RAMDISK_ADDR_R __stringify(SDRAM_OFFSET(3300000))
> +#else
> +/*
> + * 64M RAM minus 2MB heap + 16MB for u-boot, stack, fb, etc.
> + * 16M uncompressed kernel, 8M compressed kernel, 1M fdt,
> + * 1M script, 1M pxe and the ramdisk at the end.
> + */
> +#define BOOTM_SIZE     __stringify(0x2e00000)
> +#define KERNEL_ADDR_R  __stringify(SDRAM_OFFSET(1000000))
> +#define FDT_ADDR_R     __stringify(SDRAM_OFFSET(1800000))
> +#define SCRIPT_ADDR_R  __stringify(SDRAM_OFFSET(1900000))
> +#define PXEFILE_ADDR_R __stringify(SDRAM_OFFSET(1A00000))
> +#define RAMDISK_ADDR_R __stringify(SDRAM_OFFSET(1B00000))
> +#endif
>  #endif
>  
>  #define MEM_LAYOUT_ENV_SETTINGS \
> -     "bootm_size=0xa000000\0" \
> +     "bootm_size=" BOOTM_SIZE "\0" \
>       "kernel_addr_r=" KERNEL_ADDR_R "\0" \
>       "fdt_addr_r=" FDT_ADDR_R "\0" \
>       "scriptaddr=" SCRIPT_ADDR_R "\0" \
>       "pxefile_addr_r=" PXEFILE_ADDR_R "\0" \
>       "ramdisk_addr_r=" RAMDISK_ADDR_R "\0"
>  
> +#ifndef CONFIG_MACH_SUN8I_V3S
>  #define DFU_ALT_INFO_RAM \
>       "dfu_alt_info_ram=" \
>       "kernel ram " KERNEL_ADDR_R " 0x1000000;" \
>       "fdt ram " FDT_ADDR_R " 0x100000;" \
>       "ramdisk ram " RAMDISK_ADDR_R " 0x4000000\0"
> +#else
> +#define DFU_ALT_INFO_RAM \
> +     "dfu_alt_info_ram=" \
> +     "kernel ram " KERNEL_ADDR_R " 0x800000;" \
> +     "fdt ram " FDT_ADDR_R " 0x100000;" \
> +     "ramdisk ram " RAMDISK_ADDR_R " 0x1000000\0"
> +#endif

Do you even support DFU?

Thanks,
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

Attachment: signature.asc
Description: PGP signature

_______________________________________________
U-Boot mailing list
[email protected]
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to