Add F1C100s based PocketGo handheld support
Subsystems (11)
cover Add F1C100s based PocketGo handheld support
This series add support for the PocketGo handheld, a low cost portable gaming console that is based on the Allwinner F1C100s chip.
A significant portion of this patchset is authored by:
- Icenowy Zheng <[email protected]>
- George Hilliard <[email protected]>
This patchset includes 4 parts necessary to make PocketGo work:
- suniv + f1c100s support by Icenowy Zheng <[email protected]>, rebased by George Hilliard <[email protected]> and then by me.
See: https://github.com/Icenowy/u-boot/commits/f1c100s-spiflash
- additional support for suniv clock and MMC controller by George Hilliard, rebased.
See: https://github.com/thirtythreeforty/u-boot/tree/f1c100s-v2019.04
- additional support for serial uart1, and misc fixes for compilation, SPL -> U-Boot proper load on F1C100s.
- DTS and defconfig for PocketGo
I have accidentally CC'ed a few people while testing git send-email, I am awfully sorry for my lack of experience in email-patch based workflows. This is my first time attempting to contribute to U-Boot.
George Hilliard (6):
sunxi: Don't provide enable_cache() on suniv
sunxi: implement clock driver for suniv f1c100s
sunxi: gpio: Add support for suniv-f1c100s
sunxi: spi: restore bus speed and mode after reset
sunxi: spi: Add suniv pin controller support
sunxi: suniv: add device tree nodes for f1c100s MMC controllers
Icenowy Zheng (12):
arm: arm926ejs: start.S: port save_boot_params support from armv7 code
arm: arm926ej-s: add sunxi code
sunxi: add support for suniv architecture
sunxi: suniv: add support for Lichee Pi Nano
sunxi: suniv: add boot sequence for SPL to try
sunxi: spi-spl: add support for SUNIV
sunxi: add SPI0 node for suniv
sunxi: enable SPI NOR on Lichee Pi Nano
sunxi: add defconfig for Lichee Pi Nano with SPI Flash support
sunxi: add support for UART at PF for suniv
sunxi: do not set PF MMC0 pinmux when PF uart is used
sunxi: allow to enable MMC driver when using PF UART0
Yifan Gu (9):
arm: dts: sunxi: do not renumber if mmc2 does not exist
board: licheepi_nano: set CONFIG_MMC_SUNXI_SLOT_EXTRA
sunxi: suniv: add missing header include for udelay
sunxi: suniv: allow serial connection on uart1
sunxi: suniv: do not detect boot sector on suniv
sunxi: suniv: set SYS_TEXT_BASE default
sunxi: suniv: disable mmc optimization for suniv
arm: dts: suniv: define uart1 pins
arm: dts: add pocketgo handheld support
arch/arm/cpu/arm926ejs/Makefile | 1 + arch/arm/cpu/arm926ejs/start.S | 19 + arch/arm/cpu/arm926ejs/sunxi/Makefile | 16 + arch/arm/cpu/arm926ejs/sunxi/config.mk | 6 + arch/arm/cpu/arm926ejs/sunxi/fel_utils.S | 38 ++ arch/arm/cpu/arm926ejs/sunxi/lowlevel_init.S | 68 +++ arch/arm/cpu/arm926ejs/sunxi/start.c | 1 + arch/arm/cpu/arm926ejs/sunxi/timer.c | 114 ++++ arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds | 63 +++ arch/arm/dts/Makefile | 3 + arch/arm/dts/suniv-f1c100s-licheepi-nano.dts | 58 ++ arch/arm/dts/suniv-f1c100s-pocketgo.dts | 48 ++ arch/arm/dts/suniv-f1c100s.dtsi | 6 + arch/arm/dts/suniv.dtsi | 253 +++++++++ arch/arm/dts/sunxi-u-boot.dtsi | 2 + arch/arm/include/asm/arch-sunxi/clock.h | 2 +- arch/arm/include/asm/arch-sunxi/clock_sun6i.h | 21 + arch/arm/include/asm/arch-sunxi/cpu_sun4i.h | 8 + arch/arm/include/asm/arch-sunxi/dram.h | 2 + arch/arm/include/asm/arch-sunxi/dram_suniv.h | 47 ++ arch/arm/include/asm/arch-sunxi/gpio.h | 3 + arch/arm/mach-sunxi/Kconfig | 16 +- arch/arm/mach-sunxi/Makefile | 2 + arch/arm/mach-sunxi/board.c | 37 +- arch/arm/mach-sunxi/clock.c | 3 +- arch/arm/mach-sunxi/clock_sun6i.c | 47 +- arch/arm/mach-sunxi/cpu_info.c | 2 + arch/arm/mach-sunxi/dram_helpers.c | 4 + arch/arm/mach-sunxi/dram_suniv.c | 497 ++++++++++++++++++ arch/arm/mach-sunxi/spl_spi_sunxi.c | 13 + board/sunxi/board.c | 8 +- common/Kconfig.boot | 3 +- configs/licheepi_nano_defconfig | 10 + configs/licheepi_nano_spiflash_defconfig | 26 + configs/pocketgo_defconfig | 12 + drivers/clk/sunxi/Kconfig | 7 + drivers/clk/sunxi/Makefile | 1 + drivers/clk/sunxi/clk_f1c100s.c | 66 +++ drivers/gpio/sunxi_gpio.c | 6 + drivers/mmc/Kconfig | 2 +- drivers/mmc/sunxi_mmc.c | 6 +- drivers/spi/spi-sunxi.c | 12 +- include/configs/suniv.h | 15 + include/configs/sunxi-common.h | 69 ++- include/dt-bindings/clock/suniv-ccu.h | 69 +++ include/dt-bindings/reset/suniv-ccu.h | 37 ++ 46 files changed, 1715 insertions(+), 34 deletions(-) create mode 100644 arch/arm/cpu/arm926ejs/sunxi/Makefile create mode 100644 arch/arm/cpu/arm926ejs/sunxi/config.mk create mode 100644 arch/arm/cpu/arm926ejs/sunxi/fel_utils.S create mode 100644 arch/arm/cpu/arm926ejs/sunxi/lowlevel_init.S create mode 100644 arch/arm/cpu/arm926ejs/sunxi/start.c create mode 100644 arch/arm/cpu/arm926ejs/sunxi/timer.c create mode 100644 arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds create mode 100644 arch/arm/dts/suniv-f1c100s-licheepi-nano.dts create mode 100644 arch/arm/dts/suniv-f1c100s-pocketgo.dts create mode 100644 arch/arm/dts/suniv-f1c100s.dtsi create mode 100644 arch/arm/dts/suniv.dtsi create mode 100644 arch/arm/include/asm/arch-sunxi/dram_suniv.h create mode 100644 arch/arm/mach-sunxi/dram_suniv.c create mode 100644 configs/licheepi_nano_defconfig create mode 100644 configs/licheepi_nano_spiflash_defconfig create mode 100644 configs/pocketgo_defconfig create mode 100644 drivers/clk/sunxi/clk_f1c100s.c create mode 100644 include/configs/suniv.h create mode 100644 include/dt-bindings/clock/suniv-ccu.h create mode 100644 include/dt-bindings/reset/suniv-ccu.h
Signature · 1 line
2.25.1
PATCH 1/27 arm: arm926ejs: start.S: port save_boot_params support from armv7 code
From: Icenowy Zheng <[email protected]>
The ARMv7 start code has support for saving some boot params at the entry point, which is used by some SoCs to return to BROM.
Port this to ARM926EJ-S start code.
--- arch/arm/cpu/arm926ejs/start.S | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
arch/arm/cpu/arm926ejs/start.S +19 -0
@@ -17,6 +17,7 @@ #include <asm-offsets.h> #include <config.h> #include <common.h> +#include <linux/linkage.h> /* *************************************************************************
@@ -32,8 +33,13 @@ */ .globl reset + .globl save_boot_params_ret + .type save_boot_params_ret,%function reset: + /* Allow the board to save important registers */ + b save_boot_params +save_boot_params_ret: /* * set the cpu to SVC32 mode */
@@ -110,3 +116,16 @@ flush_dcache: #endif mov pc, lr /* back to my caller */ #endif /* CONFIG_SKIP_LOWLEVEL_INIT */ + +/************************************************************************* + * + * void save_boot_params(u32 r0, u32 r1, u32 r2, u32 r3) + * __attribute__((weak)); + * + * Stack pointer is not yet initialized at this moment + * Don't save anything to stack even if compiled with -O0 + * + *************************************************************************/ +WEAK(save_boot_params) + b save_boot_params_ret /* back to my caller */ +ENDPROC(save_boot_params)
Signature · 1 line
2.25.1
PATCH 2/27 arm: arm926ej-s: add sunxi code
In reply to Yifan GuFrom: Icenowy Zheng <[email protected]>
Some Allwinner SoCs use ARM926EJ-S core.
Add Allwinner/sunXi specific code to ARM926EJ-S CPU dircetory.
--- arch/arm/cpu/arm926ejs/Makefile | 1 + arch/arm/cpu/arm926ejs/sunxi/Makefile | 16 +++ arch/arm/cpu/arm926ejs/sunxi/config.mk | 6 + arch/arm/cpu/arm926ejs/sunxi/fel_utils.S | 38 +++++++ arch/arm/cpu/arm926ejs/sunxi/lowlevel_init.S | 68 +++++++++++ arch/arm/cpu/arm926ejs/sunxi/start.c | 1 + arch/arm/cpu/arm926ejs/sunxi/timer.c | 114 +++++++++++++++++++ arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds | 63 ++++++++++ 8 files changed, 307 insertions(+) create mode 100644 arch/arm/cpu/arm926ejs/sunxi/Makefile create mode 100644 arch/arm/cpu/arm926ejs/sunxi/config.mk create mode 100644 arch/arm/cpu/arm926ejs/sunxi/fel_utils.S create mode 100644 arch/arm/cpu/arm926ejs/sunxi/lowlevel_init.S create mode 100644 arch/arm/cpu/arm926ejs/sunxi/start.c create mode 100644 arch/arm/cpu/arm926ejs/sunxi/timer.c create mode 100644 arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds
arch/arm/cpu/arm926ejs/Makefile +1 -0
@@ -17,6 +17,7 @@ obj-$(CONFIG_MX25) += mx25/ obj-$(CONFIG_MX27) += mx27/ obj-$(if $(filter mxs,$(SOC)),y) += mxs/ obj-$(if $(filter spear,$(SOC)),y) += spear/ +obj-$(CONFIG_ARCH_SUNXI) += sunxi/ # some files can only build in ARM or THUMB2, not THUMB1
arch/arm/cpu/arm926ejs/sunxi/Makefile new file +16 -0
@@ -0,0 +1,16 @@ +# +# (C) Copyright 2012 Henrik Nordstrom <[email protected]> +# +# Based on some other Makefile +# (C) Copyright 2000-2003 +# Wolfgang Denk, DENX Software Engineering, [email protected]. +# +# SPDX-License-Identifier: GPL-2.0+ +# +obj-y += timer.o +obj-y += lowlevel_init.o + +ifdef CONFIG_SPL_BUILD +obj-y += fel_utils.o +CFLAGS_fel_utils.o := -marm +endif
arch/arm/cpu/arm926ejs/sunxi/config.mk new file +6 -0
@@ -0,0 +1,6 @@ +# Build a combined spl + u-boot image +ifdef CONFIG_SPL +ifndef CONFIG_SPL_BUILD +ALL-y += u-boot-sunxi-with-spl.bin +endif +endif
arch/arm/cpu/arm926ejs/sunxi/fel_utils.S new file +38 -0
@@ -0,0 +1,38 @@ +/* + * Utility functions for FEL mode. + * + * Copyright (c) 2015 Google, Inc + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include <asm-offsets.h> +#include <config.h> +#include <asm/system.h> +#include <linux/linkage.h> + +ENTRY(save_boot_params) + ldr r0, =fel_stash + str sp, [r0, #0] + str lr, [r0, #4] + mrs lr, cpsr @ Read CPSR + str lr, [r0, #8] + mrc p15, 0, lr, c1, c0, 0 @ Read CP15 SCTLR Register + str lr, [r0, #12] + mrc p15, 0, lr, c1, c0, 0 @ Read CP15 Control Register + str lr, [r0, #16] + b save_boot_params_ret +ENDPROC(save_boot_params) + +ENTRY(return_to_fel) + mov sp, r0 + mov lr, r1 + ldr r0, =fel_stash + ldr r1, [r0, #16] + mcr p15, 0, r1, c1, c0, 0 @ Write CP15 Control Register + ldr r1, [r0, #12] + mcr p15, 0, r1, c1, c0, 0 @ Write CP15 SCTLR Register + ldr r1, [r0, #8] + msr cpsr, r1 @ Write CPSR + bx lr +ENDPROC(return_to_fel)
arch/arm/cpu/arm926ejs/sunxi/lowlevel_init.S new file +68 -0
68 lines not on this page · raw message
arch/arm/cpu/arm926ejs/sunxi/start.c new file +1 -0
@@ -0,0 +1 @@ +/* Intentionally empty. Only needed to get FEL SPL link line right */
arch/arm/cpu/arm926ejs/sunxi/timer.c new file +114 -0
114 lines not on this page · raw message
arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds new file +63 -0
63 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH 3/27 sunxi: add support for suniv architecture
In reply to Yifan GuFrom: Icenowy Zheng <[email protected]>
Add support for the suniv architecture, which is newer ARM9 SoCs by Allwinner. The design of it seems to be a mixture of sun3i, sun4i and sun6i.
--- arch/arm/dts/suniv-f1c100s.dtsi | 6 + arch/arm/dts/suniv.dtsi | 183 +++++++ arch/arm/include/asm/arch-sunxi/clock.h | 2 +- arch/arm/include/asm/arch-sunxi/clock_sun6i.h | 21 + arch/arm/include/asm/arch-sunxi/cpu_sun4i.h | 8 + arch/arm/include/asm/arch-sunxi/dram.h | 2 + arch/arm/include/asm/arch-sunxi/dram_suniv.h | 47 ++ arch/arm/include/asm/arch-sunxi/gpio.h | 1 + arch/arm/mach-sunxi/Kconfig | 14 +- arch/arm/mach-sunxi/Makefile | 2 + arch/arm/mach-sunxi/board.c | 7 +- arch/arm/mach-sunxi/clock.c | 3 +- arch/arm/mach-sunxi/clock_sun6i.c | 47 +- arch/arm/mach-sunxi/cpu_info.c | 2 + arch/arm/mach-sunxi/dram_helpers.c | 4 + arch/arm/mach-sunxi/dram_suniv.c | 496 ++++++++++++++++++ board/sunxi/board.c | 4 +- include/configs/suniv.h | 15 + include/configs/sunxi-common.h | 69 ++- include/dt-bindings/clock/suniv-ccu.h | 69 +++ include/dt-bindings/reset/suniv-ccu.h | 37 ++ 21 files changed, 1013 insertions(+), 26 deletions(-) create mode 100644 arch/arm/dts/suniv-f1c100s.dtsi create mode 100644 arch/arm/dts/suniv.dtsi create mode 100644 arch/arm/include/asm/arch-sunxi/dram_suniv.h create mode 100644 arch/arm/mach-sunxi/dram_suniv.c create mode 100644 include/configs/suniv.h create mode 100644 include/dt-bindings/clock/suniv-ccu.h create mode 100644 include/dt-bindings/reset/suniv-ccu.h
arch/arm/dts/suniv-f1c100s.dtsi new file +6 -0
@@ -0,0 +1,6 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR X11) +/* + * Copyright 2018 Icenowy Zheng <[email protected]> + */ + +#include "suniv.dtsi"
arch/arm/dts/suniv.dtsi new file +183 -0
183 lines not on this page · raw message
arch/arm/include/asm/arch-sunxi/clock.h +1 -1
@@ -19,7 +19,7 @@#elif defined(CONFIG_SUN50I_GEN_H6 )#include <asm/arch/clock_sun50i_h6.h> #elif defined(CONFIG_MACH_SUN6I ) || defined(CONFIG_MACH_SUN8I ) || \ - defined(CONFIG_MACH_SUN50I ) + defined(CONFIG_MACH_SUN50I ) || defined(CONFIG_MACH_SUNIV )#include <asm/arch/clock_sun6i.h> #elif defined(CONFIG_MACH_SUN9I )#include <asm/arch/clock_sun9i.h>
arch/arm/include/asm/arch-sunxi/clock_sun6i.h +21 -0
@@ -168,6 +168,14 @@ struct sunxi_ccm_reg {u32 pll_lock_ctrl;/* 0x320 PLL lock control, R40 only */ }; +/* apb1 bit field */ +#ifdef CONFIG_MACH_SUNIV +#define APB1_GATE_UART_SHIFT (20) +#define APB1_GATE_UART_MASK (0x7 << APB1_GATE_UART_SHIFT) +#define APB1_GATE_TWI_SHIFT (16) +#define APB1_GATE_TWI_MASK (0x7 << APB1_GATE_TWI_SHIFT) +#endif +/* apb2 bit field */ #define APB2_CLK_SRC_LOSC (0x0 << 24)#define APB2_CLK_SRC_OSC24M (0x1 << 24)
@@ -226,7 +234,12 @@ struct sunxi_ccm_reg {#define CCM_PLL5_CTRL_SIGMA_DELTA_EN (0x1 << 24)#define CCM_PLL5_CTRL_EN (0x1 << 31) +#if !defined(CONFIG_MACH_SUNIV )#define PLL6_CFG_DEFAULT 0x90041811/* 600 MHz */ +#else +/* suniv pll6 doesn't have postdiv 2, so k is set to 0 */ +#define PLL6_CFG_DEFAULT 0x90041800 +#endif #define CCM_PLL6_CTRL_N_SHIFT 8#define CCM_PLL6_CTRL_N_MASK (0x1f << CCM_PLL6_CTRL_N_SHIFT)
@@ -488,6 +501,14 @@ struct sunxi_ccm_reg {#define AHB_RESET_OFFSET_EPHY 2#define AHB_RESET_OFFSET_LVDS 0 +/* apb1 reset */ +#ifdef CONFIG_MACH_SUNIV +#define APB1_RESET_UART_SHIFT (20) +#define APB1_RESET_UART_MASK (0x7 << APB1_RESET_UART_SHIFT) +#define APB1_RESET_TWI_SHIFT (16) +#define APB1_RESET_TWI_MASK (0x7 << APB1_RESET_TWI_SHIFT) +#endif +/* apb2 reset */ #define APB2_RESET_UART_SHIFT (16)#define APB2_RESET_UART_MASK (0xff << APB2_RESET_UART_SHIFT)
arch/arm/include/asm/arch-sunxi/cpu_sun4i.h +8 -0
@@ -111,6 +111,12 @@ defined(CONFIG_MACH_SUN50I)#define SUNXI_SJTAG_BASE 0x01c23c00 +#ifdef CONFIG_MACH_SUNIV +#define SUNXI_UART0_BASE 0x01c25000 +#define SUNXI_UART1_BASE 0x01c25400 +#define SUNXI_UART2_BASE 0x01c25800 +#endif +#define SUNXI_TP_BASE 0x01c25000#define SUNXI_PMU_BASE 0x01c25400
@@ -118,9 +124,11 @@ defined(CONFIG_MACH_SUN50I)#define SUNXI_CPUCFG_BASE 0x01c25c00#endif +#ifndef CONFIG_MACH_SUNIV #define SUNXI_UART0_BASE 0x01c28000#define SUNXI_UART1_BASE 0x01c28400#define SUNXI_UART2_BASE 0x01c28800 +#endif #define SUNXI_UART3_BASE 0x01c28c00#define SUNXI_UART4_BASE 0x01c29000#define SUNXI_UART5_BASE 0x01c29400
arch/arm/include/asm/arch-sunxi/dram.h +2 -0
@@ -31,6 +31,8 @@#include <asm/arch/dram_sun50i_h6.h> #elif defined(CONFIG_MACH_SUN50I_H616 )#include <asm/arch/dram_sun50i_h616.h> +#elif defined(CONFIG_MACH_SUNIV ) +#include <asm/arch/dram_suniv.h> #else #include <asm/arch/dram_sun4i.h> #endif
arch/arm/include/asm/arch-sunxi/dram_suniv.h new file +47 -0
47 lines not on this page · raw message
arch/arm/include/asm/arch-sunxi/gpio.h +1 -0
@@ -178,6 +178,7 @@ enum sunxi_gpio_number {#define SUNXI_GPD_LVDS0 3#define SUNXI_GPD_PWM 2 +#define SUNIV_GPE_UART0 5#define SUN5I_GPE_SDC2 3#define SUN8I_GPE_TWI2 3#define SUN50I_GPE_TWI2 3
arch/arm/mach-sunxi/Kconfig +12 -2
@@ -1,7 +1,8 @@ if ARCH_SUNXI config SPL_LDSCRIPT - default "arch/arm/cpu/armv7/sunxi/u-boot-spl.lds" if !ARM64 + default "arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds" if MACH_SUNIV + default "arch/arm/cpu/armv7/sunxi/u-boot-spl.lds" if !ARM64 && !MACH_SUNIV config IDENT_STRING default " Allwinner Technology"
@@ -201,6 +202,12 @@ choice prompt "Sunxi SoC Variant" optional +config MACH_SUNIV + bool "suniv (Allwinner F1C100s/F1C200s/F1C600/R6)" + select CPU_ARM926EJS + select SUNXI_GEN_SUN6I + select SUPPORT_SPL + config MACH_SUN4I bool "sun4i (Allwinner A10)" select CPU_V7A
@@ -593,6 +600,7 @@ config DRAM_ODT_CORRECTION endif config SYS_CLK_FREQ + default 408000000 if MACH_SUNIV default 1008000000 if MACH_SUN4I default 1008000000 if MACH_SUN5I default 1008000000 if MACH_SUN6I
@@ -604,6 +612,7 @@ config SYS_CLK_FREQ default 1008000000 if MACH_SUN50I_H616 config SYS_CONFIG_NAME + default "suniv" if MACH_SUNIV default "sun4i" if MACH_SUN4I default "sun5i" if MACH_SUN5I default "sun6i" if MACH_SUN6I
@@ -830,7 +839,7 @@ config VIDEO_SUNXI config VIDEO_HDMI bool "HDMI output support" - depends on VIDEO_SUNXI && !MACH_SUN8I + depends on VIDEO_SUNXI && !MACH_SUN8I && !MACH_SUNIV default y ---help--- Say Y here to add support for outputting video over HDMI.
@@ -1046,6 +1055,7 @@ config GMAC_TX_DELAY Set the GMAC Transmit Clock Delay Chain value. config SPL_STACK_R_ADDR + default 0x81e00000 if MACH_SUNIV default 0x4fe00000 if MACH_SUN4I default 0x4fe00000 if MACH_SUN5I default 0x4fe00000 if MACH_SUN6I
arch/arm/mach-sunxi/Makefile +2 -0
@@ -15,6 +15,7 @@ obj-$(CONFIG_SUN6I_P2WI) += p2wi.o obj-$(CONFIG_SUN6I_PRCM) += prcm.o obj-$(CONFIG_AXP_PMIC_BUS) += pmic_bus.o obj-$(CONFIG_SUN8I_RSB) += rsb.o +obj-$(CONFIG_MACH_SUNIV) += clock_sun6i.o obj-$(CONFIG_MACH_SUN4I) += clock_sun4i.o obj-$(CONFIG_MACH_SUN5I) += clock_sun4i.o obj-$(CONFIG_MACH_SUN6I) += clock_sun6i.o
@@ -29,6 +30,7 @@ obj-$(CONFIG_MACH_SUN9I) += clock_sun9i.o gtbus_sun9i.o obj-$(CONFIG_SUN50I_GEN_H6) += clock_sun50i_h6.o ifdef CONFIG_SPL_BUILD +obj-$(CONFIG_MACH_SUNIV) += dram_suniv.o obj-$(CONFIG_DRAM_SUN4I) += dram_sun4i.o obj-$(CONFIG_DRAM_SUN6I) += dram_sun6i.o obj-$(CONFIG_DRAM_SUN8I_A23) += dram_sun8i_a23.o
arch/arm/mach-sunxi/board.c +6 -1
@@ -95,6 +95,10 @@ static int gpio_init(void)sunxi_gpio_set_cfgpin (SUNXI_GPF (4 ),SUNXI_GPF_UART0 );#endif sunxi_gpio_set_pull (SUNXI_GPF (4 ),1 ); +#elif CONFIG_CONS_INDEX == 1 && defined(CONFIG_MACH_SUNIV) +sunxi_gpio_set_cfgpin (SUNXI_GPE (0 ),SUNIV_GPE_UART0 ); +sunxi_gpio_set_cfgpin (SUNXI_GPE (1 ),SUNIV_GPE_UART0 ); +sunxi_gpio_set_pull (SUNXI_GPE (1 ),SUNXI_GPIO_PULL_UP );#elif CONFIG_CONS_INDEX == 1 && (defined(CONFIG_MACH_SUN4I) || \ defined(CONFIG_MACH_SUN7I) || \ defined(CONFIG_MACH_SUN8I_R40))
@@ -220,7 +224,8 @@ void s_init(void)/* No H3 BSP, boot0 seems to not modify SUNXI_SRAMC_BASE + 0x44 */ #endif -#if !defined(CONFIG_ARM_CORTEX_CPU_IS_UP ) && !defined(CONFIG_ARM64 ) +#if !defined(CONFIG_ARM_CORTEX_CPU_IS_UP ) && !defined(CONFIG_ARM64 ) && \ + !defined(CONFIG_MACH_SUNIV )/* Enable SMP mode for CPU0, by setting bit 6 of Auxiliary Ctl reg */ asmvolatile ( "mrc p15, 0, r0, c1, c0, 1\n"
arch/arm/mach-sunxi/clock.c +2 -1
@@ -36,7 +36,8 @@ int clock_init(void) }/* These functions are shared between various SoCs so put them here. */ -#if definedCONFIG_SUNXI_GEN_SUN6I && !definedCONFIG_MACH_SUN9I +#if definedCONFIG_SUNXI_GEN_SUN6I && !definedCONFIG_MACH_SUN9I && \ + !definedCONFIG_MACH_SUNIV int clock_twi_onoff (int port,int state) { struct sunxi_ccm_reg *const ccm =
arch/arm/mach-sunxi/clock_sun6i.c +46 -1
104 lines not on this page · raw message
arch/arm/mach-sunxi/cpu_info.c +2 -0
@@ -57,6 +57,8 @@ int print_cpuinfo(void) {#ifdef CONFIG_MACH_SUN4I puts ("CPU: Allwinner A10 (SUN4I)\n" ); +#elif definedCONFIG_MACH_SUNIV +puts ("CPU: Allwinner F Series (SUNIV)\n" );#elif definedCONFIG_MACH_SUN5I u32 val =readl (SUNXI_SID_BASE +0x08 );switch ((val >>12 ) &0xf ) {
arch/arm/mach-sunxi/dram_helpers.c +4 -0
@@ -26,7 +26,10 @@ void mctl_await_completion(u32 *reg, u32 mask, u32 val)/* * Test if memory at offset offset matches memory at begin of DRAM +* +* Note: dsb() is not available on ARMv5 in Thumb mode */ +#ifndef CONFIG_MACH_SUNIV bool mctl_mem_matches (u32 offset) {/* Try to write different values to RAM at two addresses */
@@ -37,3 +40,4 @@ bool mctl_mem_matches(u32 offset)return readl (CONFIG_SYS_SDRAM_BASE ) == readl((ulong)CONFIG_SYS_SDRAM_BASE + offset); } +#endif
arch/arm/mach-sunxi/dram_suniv.c new file +496 -0
496 lines not on this page · raw message
board/sunxi/board.c +2 -2
@@ -237,7 +237,7 @@ int board_init(void) gd->bd->bi_boot_params = (PHYS_SDRAM_0 +0x100 ); -#ifndef CONFIG_ARM64 +#if !defined(CONFIG_ARM64 ) && !defined(CONFIG_MACH_SUNIV ) asmvolatile ("mrc p15, 0, %0, c0, c1, 1" :"=r" (id_pfr1));debug ("id_pfr1: 0x%08x\n" , id_pfr1);/* Generic Timer Extension available? */
@@ -264,7 +264,7 @@ int board_init(void) #endif } } -#endif /* !CONFIG_ARM64 */ +#endif /* !CONFIG_ARM64 && !CONFIG_MACH_SUNIV */ ret =axp_gpio_init ();if (ret)
include/configs/suniv.h new file +15 -0
@@ -0,0 +1,15 @@ +/* +* Configuration settings for new Allwinner F-series (suniv) CPU +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __CONFIG_H +#define __CONFIG_H + +/* +* Include common sunxi configuration where most the settings are +*/ +#include <configs/sunxi-common.h> + +#endif /* __CONFIG_H */
include/configs/sunxi-common.h +51 -18
102 lines not on this page · raw message
include/dt-bindings/clock/suniv-ccu.h new file +69 -0
69 lines not on this page · raw message
include/dt-bindings/reset/suniv-ccu.h new file +37 -0
@@ -0,0 +1,37 @@ +/* +* Copyright (C) 2018 Icenowy Zheng <[email protected]> +* +* SPDX-License-Identifier: (GPL-2.0+ OR MIT) +*/ + +#ifndef _DT_BINDINGS_RST_SUNIV_H_ +#define _DT_BINDINGS_RST_SUNIV_H_ + +#define RST_USB_PHY0 0 +#define RST_BUS_MMC0 1 +#define RST_BUS_MMC1 2 +#define RST_BUS_DRAM 3 +#define RST_BUS_SPI0 4 +#define RST_BUS_SPI1 5 +#define RST_BUS_OTG 6 +#define RST_BUS_VE 7 +#define RST_BUS_LCD 8 +#define RST_BUS_DEINTERLACE 9 +#define RST_BUS_CSI 10 +#define RST_BUS_TVD 11 +#define RST_BUS_TVE 12 +#define RST_BUS_DE_BE 13 +#define RST_BUS_DE_FE 14 +#define RST_BUS_CODEC 15 +#define RST_BUS_SPDIF 16 +#define RST_BUS_IR 17 +#define RST_BUS_RSB 18 +#define RST_BUS_I2S0 19 +#define RST_BUS_I2C0 20 +#define RST_BUS_I2C1 21 +#define RST_BUS_I2C2 22 +#define RST_BUS_UART0 23 +#define RST_BUS_UART1 24 +#define RST_BUS_UART2 25 + +#endif /* _DT_BINDINGS_RST_SUNIV_H_ */
Signature · 1 line
2.25.1
PATCH 4/27 sunxi: suniv: add support for Lichee Pi Nano
In reply to Yifan GuFrom: Icenowy Zheng <[email protected]>
Lichee Pi Nano is a board based on F1C100s.
Add support for it.
--- arch/arm/dts/Makefile | 2 + arch/arm/dts/suniv-f1c100s-licheepi-nano.dts | 43 ++++++++++++++++++++ configs/licheepi_nano_defconfig | 9 ++++ 3 files changed, 54 insertions(+) create mode 100644 arch/arm/dts/suniv-f1c100s-licheepi-nano.dts create mode 100644 configs/licheepi_nano_defconfig
arch/arm/dts/Makefile +2 -0
@@ -665,6 +665,8 @@ dtb-$(CONFIG_MACH_SUN9I) += \ sun9i-a80-optimus.dtb \ sun9i-a80-cubieboard4.dtb \ sun9i-a80-cx-a99.dtb +dtb-$(CONFIG_MACH_SUNIV) += \ + suniv-f1c100s-licheepi-nano.dtb dtb-$(CONFIG_VF610) += vf500-colibri.dtb \ vf610-colibri.dtb \
arch/arm/dts/suniv-f1c100s-licheepi-nano.dts new file +43 -0
43 lines not on this page · raw message
configs/licheepi_nano_defconfig new file +9 -0
@@ -0,0 +1,9 @@ +CONFIG_ARM=y +CONFIG_ARCH_SUNXI=y +CONFIG_MACH_SUNIV=y +CONFIG_DRAM_CLK=156 +CONFIG_DRAM_ZQ=0 +# CONFIG_VIDEO_SUNXI is not set +CONFIG_DEFAULT_DEVICE_TREE="suniv-f1c100s-licheepi-nano" +CONFIG_SPL=y +# CONFIG_SPL_DM_SERIAL is not set
Signature · 1 line
2.25.1
PATCH 5/27 sunxi: suniv: add boot sequence for SPL to try
In reply to Yifan GuFrom: Icenowy Zheng <[email protected]>
The BROM of suniv do not pass the info of boot media to SPL.
Add boot sequence for SPL to try again for the available boot media.
--- arch/arm/mach-sunxi/board.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
arch/arm/mach-sunxi/board.c +22 -0
@@ -334,10 +334,32 @@ unsigned long spl_mmc_get_uboot_raw_sector(struct mmc *mmc,return sector; } + +#ifndef CONFIG_MACH_SUNIV u32 spl_boot_device (void ) {return sunxi_get_boot_device (); } +#else +/* +* suniv BROM do not pass the boot media type to SPL, so we try with the +* boot sequence in BROM: mmc0->spinor->fail. +*/ +void board_boot_order (u32 *spl_boot_list) +{ +/* +* See the comments above in sunxi_get_boot_device() for infomation +* about FEL boot. +*/ +if (!is_boot0_magic (SPL_ADDR +4 )) { + spl_boot_list[0 ] =BOOT_DEVICE_BOARD ; +return ; + } + + spl_boot_list[0 ] =BOOT_DEVICE_MMC1 ; + spl_boot_list[1 ] =BOOT_DEVICE_SPI ; +} +#endif void board_init_f (ulong dummy) {
Signature · 1 line
2.25.1
PATCH 6/27 sunxi: spi-spl: add support for SUNIV
In reply to Yifan GuFrom: Icenowy Zheng <[email protected]>
The suniv SoC come with a sun6i-style SPI controller at the base address of sun4i SPI controller. The module clock of the SPI controller is also missing.
Add support for it.
--- arch/arm/include/asm/arch-sunxi/gpio.h | 1 + arch/arm/mach-sunxi/Kconfig | 2 +- arch/arm/mach-sunxi/spl_spi_sunxi.c | 13 +++++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-)
arch/arm/include/asm/arch-sunxi/gpio.h +1 -0
@@ -170,6 +170,7 @@ enum sunxi_gpio_number {#define SUNXI_GPC_NAND 2#define SUNXI_GPC_SPI0 3#define SUNXI_GPC_SDC2 3 +#define SUNIV_GPC_SPI0 2#define SUN6I_GPC_SDC3 4#define SUN50I_GPC_SPI0 4
arch/arm/mach-sunxi/Kconfig +1 -1
@@ -1067,7 +1067,7 @@ config SPL_STACK_R_ADDR config SPL_SPI_SUNXI bool "Support for SPI Flash on Allwinner SoCs in SPL" - depends on MACH_SUN4I || MACH_SUN5I || MACH_SUN7I || MACH_SUNXI_H3_H5 || MACH_SUN50I || MACH_SUN8I_R40 || MACH_SUN50I_H6 + depends on MACH_SUNIV || MACH_SUN4I || MACH_SUN5I || MACH_SUN7I || MACH_SUNXI_H3_H5 || MACH_SUN50I || MACH_SUN8I_R40 || MACH_SUN50I_H6 help Enable support for SPI Flash. This option allows SPL to read from sunxi SPI Flash. It uses the same method as the boot ROM, so does
arch/arm/mach-sunxi/spl_spi_sunxi.c +13 -0
@@ -89,6 +89,7 @@#define SPI0_CLK_DIV_BY_2 0x1000#define SPI0_CLK_DIV_BY_4 0x1001 +#define SPI0_CLK_DIV_BY_32 0x100f/*****************************************************************************/
@@ -120,6 +121,7 @@ static void spi0_pinmux_setup(unsigned int pin_function)static bool is_sun6i_gen_spi (void ) {return IS_ENABLED (CONFIG_SUNXI_GEN_SUN6I ) || +IS_ENABLED (CONFIG_MACH_SUNIV ) ||IS_ENABLED (CONFIG_MACH_SUN50I_H6 ); }
@@ -155,11 +157,17 @@ static void spi0_enable_clock(void)if (!IS_ENABLED (CONFIG_MACH_SUN50I_H6 ))setbits_le32 (CCM_AHB_GATING0 , (1 <<AHB_GATE_OFFSET_SPI0 )); +#ifdef CONFIG_MACH_SUNIV +/* Divide by 32, clock source is AHB clock 200MHz */ +writel (SPI0_CLK_DIV_BY_32 , base + (is_sun6i_gen_spi () ? +SUN6I_SPI0_CCTL :SUN4I_SPI0_CCTL )); +#else /* Divide by 4 */ writel (SPI0_CLK_DIV_BY_4 , base + (is_sun6i_gen_spi () ?SUN6I_SPI0_CCTL :SUN4I_SPI0_CCTL ));/* 24MHz from OSC24M */ writel ((1 <<31 ),CCM_SPI0_CLK ); +#endif if (is_sun6i_gen_spi ()) {/* Enable SPI in the master mode and do a soft reset */
@@ -189,8 +197,10 @@ static void spi0_disable_clock(void)clrbits_le32 (base +SUN4I_SPI0_CTL ,SUN4I_CTL_MASTER |SUN4I_CTL_ENABLE ); +#ifndef CONFIG_MACH_SUNIV /* Disable the SPI0 clock */ writel (0 ,CCM_SPI0_CLK ); +#endif /* Close the SPI0 gate */ if (!IS_ENABLED (CONFIG_MACH_SUN50I_H6 ))
@@ -212,6 +222,9 @@ static void spi0_init(void) IS_ENABLED(CONFIG_MACH_SUN50I_H6)) pin_function =SUN50I_GPC_SPI0 ; +if (IS_ENABLED (CONFIG_MACH_SUNIV )) + pin_function =SUNIV_GPC_SPI0 ; +spi0_pinmux_setup (pin_function);spi0_enable_clock (); }
Signature · 1 line
2.25.1
PATCH 7/27 sunxi: add SPI0 node for suniv
In reply to Yifan GuFrom: Icenowy Zheng <[email protected]>
The suniv SoC has two SPI controllers, in which SPI0 is bootable.
Add device tree node of the controller and its bootable pinmux node.
--- arch/arm/dts/suniv.dtsi | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
arch/arm/dts/suniv.dtsi +18 -0
@@ -76,6 +76,19 @@ }; }; + spi0: spi@1c05000 { + compatible = "allwinner,suniv-spi", + "allwinner,sun8i-h3-spi"; + reg = <0x01c05000 0x1000>; + interrupts = <10>; + clocks = <&ccu CLK_BUS_SPI0>, <&ccu CLK_BUS_SPI0>; + clock-names = "ahb", "mod"; + resets = <&ccu RST_BUS_SPI0>; + status = "disabled"; + #address-cells = <1>; + #size-cells = <0>; + }; + ccu: clock@1c20000 { compatible = "allwinner,suniv-f1c100s-ccu"; reg = <0x01c20000 0x400>;
@@ -103,6 +116,11 @@ #interrupt-cells = <3>; #gpio-cells = <3>; + spi0_pins_a: spi0-pins-pc { + pins = "PC0", "PC1", "PC2", "PC3"; + function = "spi0"; + }; + uart0_pe_pins: uart-pins-pe { pins = "PE0", "PE1"; function = "uart0";
Signature · 1 line
2.25.1
PATCH 8/27 sunxi: enable SPI NOR on Lichee Pi Nano
In reply to Yifan GuFrom: Icenowy Zheng <[email protected]>
The Lichee Pi Nano board has a Winbond W25Q128 SPI flash on it.
Enable it.
--- arch/arm/dts/suniv-f1c100s-licheepi-nano.dts | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
arch/arm/dts/suniv-f1c100s-licheepi-nano.dts +15 -0
@@ -15,6 +15,7 @@ aliases { serial0 = &uart0; + spi0 = &spi0; }; chosen {
@@ -26,6 +27,20 @@ status = "okay"; }; +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_pins_a>; + status = "okay"; + + flash@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "winbond,w25q128", "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <40000000>; + }; +}; + &uart0 { pinctrl-names = "default"; pinctrl-0 = <&uart0_pe_pins>;
Signature · 1 line
2.25.1
PATCH 9/27 sunxi: add defconfig for Lichee Pi Nano with SPI Flash support
In reply to Yifan GuFrom: Icenowy Zheng <[email protected]>
--- configs/licheepi_nano_spiflash_defconfig | 25 ++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 configs/licheepi_nano_spiflash_defconfig
configs/licheepi_nano_spiflash_defconfig new file +25 -0
@@ -0,0 +1,25 @@ +CONFIG_ARM=y +CONFIG_ARCH_SUNXI=y +CONFIG_ENV_SIZE=0x8000 +CONFIG_ENV_OFFSET=0xf8000 +CONFIG_MACH_SUNIV=y +CONFIG_DRAM_CLK=156 +CONFIG_DRAM_ZQ=0 +# CONFIG_VIDEO_SUNXI is not set +CONFIG_DEFAULT_DEVICE_TREE="suniv-f1c100s-licheepi-nano" +CONFIG_SPL=y +# CONFIG_CMD_FLASH is not set +# CONFIG_CMD_FPGA is not set +CONFIG_CMD_SF=y +CONFIG_CMD_SPI=y +CONFIG_ENV_IS_IN_SPI_FLASH=y +CONFIG_DM_SPI_FLASH=y +CONFIG_SPI_FLASH=y +CONFIG_SPI_FLASH_BAR=y +CONFIG_SPI_FLASH_GIGADEVICE=y +CONFIG_SPI_FLASH_MACRONIX=y +CONFIG_SPI_FLASH_WINBOND=y +CONFIG_SPL_SPI_SUNXI=y +# CONFIG_SPL_DM_SERIAL is not set +CONFIG_DM_SPI=y +CONFIG_SUN6I_SPI=y
Signature · 1 line
2.25.1
PATCH 10/27 sunxi: add support for UART at PF for suniv
In reply to Yifan GuFrom: Icenowy Zheng <[email protected]>
--- arch/arm/mach-sunxi/board.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/mach-sunxi/board.c +2 -1
@@ -87,7 +87,8 @@ static int gpio_init(void)sunxi_gpio_set_cfgpin (SUNXI_GPB (22 ),SUNXI_GPIO_INPUT );sunxi_gpio_set_cfgpin (SUNXI_GPB (23 ),SUNXI_GPIO_INPUT );#endif -#if defined(CONFIG_MACH_SUN8I ) && !defined(CONFIG_MACH_SUN8I_R40 ) +#if (defined(CONFIG_MACH_SUN8I ) && !defined(CONFIG_MACH_SUN8I_R40 )) || \ + defined(CONFIG_MACH_SUNIV )sunxi_gpio_set_cfgpin (SUNXI_GPF (2 ),SUN8I_GPF_UART0 );sunxi_gpio_set_cfgpin (SUNXI_GPF (4 ),SUN8I_GPF_UART0 );#else
Signature · 1 line
2.25.1
PATCH 11/27 sunxi: do not set PF MMC0 pinmux when PF uart is used
In reply to Yifan GuFrom: Icenowy Zheng <[email protected]>
--- board/sunxi/board.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
board/sunxi/board.c +3 -1
@@ -412,17 +412,19 @@ void board_nand_init(void)#ifdef CONFIG_MMC static void mmc_pinmux_setup (int sdc) { -unsigned int pin; +__maybe_unused unsigned int pin;__maybe_unused int pins;switch (sdc) {case 0 :/* SDC0: PF0-PF5 */ +#ifndef CONFIG_UART0_PORT_F for (pin =SUNXI_GPF (0 ); pin <=SUNXI_GPF (5 ); pin++) {sunxi_gpio_set_cfgpin (pin,SUNXI_GPF_SDC0 );sunxi_gpio_set_pull (pin,SUNXI_GPIO_PULL_UP );sunxi_gpio_set_drv (pin,2 ); } +#endif break ;case 1 :
Signature · 1 line
2.25.1
PATCH 12/27 sunxi: allow to enable MMC driver when using PF UART0
In reply to Yifan GuFrom: Icenowy Zheng <[email protected]>
As the pinmux setup of MMC0 at PF is masked, the sunxi MMC driver is now harmless for PF uart setup, and it may be used for the extra MMC port.
--- drivers/mmc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/Kconfig +1 -1
@@ -723,7 +723,7 @@ config ZYNQ_HISPD_BROKEN config MMC_SUNXI bool "Allwinner sunxi SD/MMC Host Controller support" - depends on ARCH_SUNXI && !UART0_PORT_F + depends on ARCH_SUNXI default y help This selects support for the SD/MMC Host Controller on
Signature · 1 line
2.25.1
PATCH 13/27 sunxi: Don't provide enable_cache() on suniv
In reply to Yifan GuFrom: George Hilliard <[email protected]>
The arm926 code provides this function. Disable it here.
--- arch/arm/mach-sunxi/board.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-sunxi/board.c +1 -1
@@ -406,7 +406,7 @@ void reset_cpu(void)#endif } -#if !CONFIG_IS_ENABLED (SYS_DCACHE_OFF ) && !defined(CONFIG_ARM64 ) +#if !CONFIG_IS_ENABLED (SYS_DCACHE_OFF ) && !defined(CONFIG_ARM64 ) && !defined(CONFIG_CPU_ARM926EJS )void enable_caches (void ) {/* Enable D-cache. I-cache is already enabled in start.S */
Signature · 1 line
2.25.1
PATCH 14/27 sunxi: implement clock driver for suniv f1c100s
In reply to Yifan GuFrom: George Hilliard <[email protected]>
The f1c100s has a simple clock tree similar to those of other sunxi parts. Add support for it.
--- drivers/clk/sunxi/Kconfig | 7 ++++ drivers/clk/sunxi/Makefile | 1 + drivers/clk/sunxi/clk_f1c100s.c | 66 +++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 drivers/clk/sunxi/clk_f1c100s.c
drivers/clk/sunxi/Kconfig +7 -0
@@ -9,6 +9,13 @@ config CLK_SUNXI if CLK_SUNXI +config CLK_SUNIV_F1C100S + bool "Clock driver for Allwinner F1C100s" + default MACH_SUNIV + help + This enables common clock driver support for platforms based + on Allwinner F1C100s SoC. + config CLK_SUN4I_A10 bool "Clock driver for Allwinner A10/A20" default MACH_SUN4I || MACH_SUN7I
drivers/clk/sunxi/Makefile +1 -0
@@ -8,6 +8,7 @@ obj-$(CONFIG_CLK_SUNXI) += clk_sunxi.o obj-$(CONFIG_CLK_SUNXI) += clk_sun6i_rtc.o +obj-$(CONFIG_CLK_SUNIV_F1C100S) += clk_f1c100s.o obj-$(CONFIG_CLK_SUN4I_A10) += clk_a10.o obj-$(CONFIG_CLK_SUN5I_A10S) += clk_a10s.o obj-$(CONFIG_CLK_SUN6I_A31) += clk_a31.o
drivers/clk/sunxi/clk_f1c100s.c new file +66 -0
66 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [PATCH 14/27] sunxi: implement clock driver for suniv f1c100s
Quoted 107 lines · Yifan Gu
From: George Hilliard <[email protected]>
The f1c100s has a simple clock tree similar to those of other sunxi parts. Add support for it.
Signed-off-by George Hilliard <[email protected]>Signed-off-by Yifan Gu <[email protected]>--- drivers/clk/sunxi/Kconfig | 7 ++++ drivers/clk/sunxi/Makefile | 1 + drivers/clk/sunxi/clk_f1c100s.c | 66 +++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+)create mode 100644
drivers/clk/sunxi/clk_f1c100s.cdrivers/clk/sunxi/Kconfig +7
-0@@ -9,6 +9,13 @@ config CLK_SUNXI if CLK_SUNXI +config CLK_SUNIV_F1C100S + bool "Clock driver for Allwinner F1C100s" + default MACH_SUNIV + help + This enables common clock driver support for platforms based + on Allwinner F1C100s SoC. + config CLK_SUN4I_A10 bool "Clock driver for Allwinner A10/A20" default MACH_SUN4I || MACH_SUN7Idrivers/clk/sunxi/Makefile +1
-0@@ -8,6 +8,7 @@ obj-$(CONFIG_CLK_SUNXI) += clk_sunxi.o obj-$(CONFIG_CLK_SUNXI) += clk_sun6i_rtc.o +obj-$(CONFIG_CLK_SUNIV_F1C100S) += clk_f1c100s.o obj-$(CONFIG_CLK_SUN4I_A10) += clk_a10.o obj-$(CONFIG_CLK_SUN5I_A10S) += clk_a10s.o obj-$(CONFIG_CLK_SUN6I_A31) += clk_a31.odrivers/clk/sunxi/clk_f1c100s.c new file +56
-0@@ -0,0 +1,66 @@ +// SPDX-License-Identifier: (GPL-2.0+) +/* +* Copyright (C) 2019 George Hilliard <[email protected]>. +*/ + +#include <common.h> +#include <clk-uclass.h> +#include <dm.h> +#include <errno.h> +#include <asm/arch/ccu.h> +#include <dt-bindings/clock/suniv-ccu.h> +#include <dt-bindings/reset/suniv-ccu.h> + +static struct ccu_clk_gate f1c100s_gates[] = { + [CLK_BUS_MMC0 ] =GATE (0x060 ,BIT (8 )), + [CLK_BUS_MMC1 ] =GATE (0x060 ,BIT (9 )), + [CLK_BUS_SPI0 ] =GATE (0x060 ,BIT (20 )), + [CLK_BUS_SPI1 ] =GATE (0x060 ,BIT (21 )), + [CLK_BUS_OTG ] =GATE (0x060 ,BIT (24 )), + + [CLK_BUS_UART0 ] =GATE (0x06c ,BIT (20 )), + [CLK_BUS_UART1 ] =GATE (0x06c ,BIT (21 )), + [CLK_BUS_UART2 ] =GATE (0x06c ,BIT (22 )), + + [CLK_USB_PHY0 ] =GATE (0x0cc ,BIT (1 )), +}; + +static struct ccu_reset f1c100s_resets[] = { + [RST_USB_PHY0 ] =RESET (0x0cc ,BIT (0 )), + + [RST_BUS_MMC0 ] =RESET (0x2c0 ,BIT (8 )), + [RST_BUS_MMC1 ] =RESET (0x2c0 ,BIT (9 )), + [RST_BUS_SPI0 ] =RESET (0x2c0 ,BIT (20 )), + [RST_BUS_SPI1 ] =RESET (0x2c0 ,BIT (21 )), + [RST_BUS_OTG ] =RESET (0x2c0 ,BIT (24 )), + + [RST_BUS_UART0 ] =RESET (0x2d0 ,BIT (20 )), + [RST_BUS_UART1 ] =RESET (0x2d0 ,BIT (21 )), + [RST_BUS_UART2 ] =RESET (0x2d0 ,BIT (22 )), +}; + +static const struct ccu_desc f1c100s_ccu_desc = { + .gates = f1c100s_gates, + .resets = f1c100s_resets, +}; + +static int f1c100s_clk_bind (struct udevice *dev) +{ +return sunxi_reset_bind (dev,ARRAY_SIZE (f1c100s_resets)); +} + +static const struct udevice_id f1c100s_clk_ids[] = { + { .compatible ="allwinner,suniv-f1c100s-ccu" , + .data = (ulong)&f1c100s_ccu_desc }, + { } +};
drivers/clk/sunxi/clk_f1c100s.c line 66
Quoted 10 lines
drivers/clk/sunxi/clk_f1c100s.c new file +10
-0+ +U_BOOT_DRIVER (clk_suniv_f1c100s) = { + .name ="suniv_f1c100s_ccu" , + .id =UCLASS_CLK , + .of_match = f1c100s_clk_ids, + .priv_auto =sizeof (struct ccu_priv ), + .ops = &sunxi_clk_ops, + .probe = sunxi_clk_probe, + .bind = f1c100s_clk_bind, +};
PATCH 15/27 sunxi: gpio: Add support for suniv-f1c100s
In reply to Yifan GuFrom: George Hilliard <[email protected]>
The f1c100s has a controller pretty similar to that of most sunxi parts, but there are only 6 banks. Add a new compatible entry for this peripheral.
--- drivers/gpio/sunxi_gpio.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpio/sunxi_gpio.c +6 -0
@@ -319,6 +319,11 @@ static const struct sunxi_gpio_soc_data soc_data_a_all = { .no_banks = SUNXI_GPIO_BANKS, }; +static const struct sunxi_gpio_soc_data soc_data_a_6 = { + .start =0 , + .no_banks =6 , +}; +static const struct sunxi_gpio_soc_data soc_data_l_1 = { .start ='L' -'A' , .no_banks =1 ,
@@ -364,6 +369,7 @@ static const struct udevice_id sunxi_gpio_ids[] = {ID ("allwinner,sun50i-a64-r-pinctrl" , l_1),ID ("allwinner,sun50i-h6-r-pinctrl" , l_2),ID ("allwinner,sun50i-h616-r-pinctrl" , l_1), + ID("allwinner,suniv-pinctrl", a_6), { } };
Signature · 1 line
2.25.1
PATCH 16/27 sunxi: spi: restore bus speed and mode after reset
In reply to Yifan GuFrom: George Hilliard <[email protected]>
The sunxi SPI peripheral driver resets the device completely (disabling clocks and power) when the bus is released and turns it back on when claiming. On the F1C100s (and maybe others), the peripheral resets back to default register settings, losing speed and mode settings.
Restore these settings when resetting the peripheral.
--- drivers/spi/spi-sunxi.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/spi/spi-sunxi.c +9 -1
@@ -39,6 +39,10 @@DECLARE_GLOBAL_DATA_PTR ; +/* Forward declarations of some reused functions */ +static int sun4i_spi_set_speed (struct udevice *dev,uint speed); +static int sun4i_spi_set_mode (struct udevice *dev,uint mode); +/* sun4i spi registers */ #define SUN4I_RXDATA_REG 0x00#define SUN4I_TXDATA_REG 0x04
@@ -304,7 +308,8 @@ err_ahb:static int sun4i_spi_claim_bus (struct udevice *dev) { -struct sun4i_spi_priv *priv =dev_get_priv (dev->parent); +struct udevice *bus = dev->parent; +struct sun4i_spi_priv *priv =dev_get_priv (bus);int ret; ret =sun4i_spi_set_clock (dev->parent, true);
@@ -321,6 +326,9 @@ static int sun4i_spi_claim_bus(struct udevice *dev)setbits_le32 (SPI_REG (priv,SPI_TCR ),SPI_BIT (priv,SPI_TCR_CS_MANUAL ) |SPI_BIT (priv,SPI_TCR_CS_ACTIVE_LOW )); +sun4i_spi_set_speed (bus, priv->freq); +sun4i_spi_set_mode (bus, priv->mode); +return 0 ; }
Signature · 1 line
2.25.1
PATCH 17/27 sunxi: spi: Add suniv pin controller support
In reply to Yifan GuFrom: George Hilliard <[email protected]>
suniv needs slightly different register settings to enable the SPI peripheral. The magic numbers are already provided by the architecture support; we just have to check for them here.
--- drivers/spi/spi-sunxi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/spi/spi-sunxi.c +2 -0
@@ -255,6 +255,8 @@ static int sun4i_spi_parse_pins(struct udevice *dev)if (IS_ENABLED (CONFIG_MACH_SUN50I ))sunxi_gpio_set_cfgpin (pin,SUN50I_GPC_SPI0 ); +else if (IS_ENABLED (CONFIG_MACH_SUNIV )) +sunxi_gpio_set_cfgpin (pin,SUNIV_GPC_SPI0 );else sunxi_gpio_set_cfgpin (pin,SUNXI_GPC_SPI0 );sunxi_gpio_set_drv (pin, drive);
Signature · 1 line
2.25.1
PATCH 18/27 sunxi: suniv: add device tree nodes for f1c100s MMC controllers
In reply to Yifan GuFrom: George Hilliard <[email protected]>
The f1c100s has two MMC controllers. Add device tree nodes for them.
--- arch/arm/dts/suniv.dtsi | 47 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+)
arch/arm/dts/suniv.dtsi +47 -0
@@ -125,6 +125,11 @@ pins = "PE0", "PE1"; function = "uart0"; }; + + mmc0_pins: mmc0-pins { + pins = "PF0", "PF1", "PF2", "PF3", "PF4", "PF5"; + function = "mmc0"; + }; }; timer@1c20c00 {
@@ -197,5 +202,47 @@ #phy-cells = <1>; status = "disabled"; }; + + mmc0: mmc@1c0f000 { + compatible = "allwinner,suniv-f1c100s-mmc", + "allwinner,sun7i-a20-mmc"; + reg = <0x01c0f000 0x1000>; + clocks = <&ccu CLK_BUS_MMC0>, + <&ccu CLK_MMC0>, + <&ccu CLK_MMC0_OUTPUT>, + <&ccu CLK_MMC0_SAMPLE>; + clock-names = "ahb", + "mmc", + "output", + "sample"; + resets = <&ccu RST_BUS_MMC0>; + reset-names = "ahb"; + interrupts = <23>; + pinctrl-names = "default"; + pinctrl-0 = <&mmc0_pins>; + status = "disabled"; + #address-cells = <1>; + #size-cells = <0>; + }; + + mmc1: mmc@1c10000 { + compatible = "allwinner,suniv-f1c100s-mmc", + "allwinner,sun7i-a20-mmc"; + reg = <0x01c10000 0x1000>; + clocks = <&ccu CLK_BUS_MMC1>, + <&ccu CLK_MMC1>, + <&ccu CLK_MMC1_OUTPUT>, + <&ccu CLK_MMC1_SAMPLE>; + clock-names = "ahb", + "mmc", + "output", + "sample"; + resets = <&ccu RST_BUS_MMC1>; + reset-names = "ahb"; + interrupts = <24>; + status = "disabled"; + #address-cells = <1>; + #size-cells = <0>; + }; }; };
Signature · 1 line
2.25.1
PATCH 19/27 arm: dts: sunxi: do not renumber if mmc2 does not exist
In reply to Yifan GuWe renumber mmc2 to mmc1 for sunxi devices, but if mmc2 does not exist dts will not build.
This patch prevents that by checking CONFIG_MMC_SUNXI_SLOT_EXTRA.
--- arch/arm/dts/sunxi-u-boot.dtsi | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/dts/sunxi-u-boot.dtsi +2 -0
@@ -13,7 +13,9 @@ / { aliases { mmc0 = &mmc0; +#if CONFIG_MMC_SUNXI_SLOT_EXTRA > 1 mmc1 = &mmc2; +#endif }; binman: binman {
Signature · 1 line
2.25.1
Re: [PATCH 19/27] arm: dts: sunxi: do not renumber if mmc2 does not exist
Quoted 4 lines · 在 2021-07-25星期日的 19:16 -0400,Yifan Gu写道:
We renumber mmc2 to mmc1 for sunxi devices, but if mmc2 does not exist dts will not build.
This patch prevents that by checking
CONFIG_MMC_SUNXI_SLOT_EXTRA.
I have a similar patch at
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
Quoted 19 lines
---
arch/arm/dts/sunxi-u-boot.dtsi | 2 ++1 file changed, 2 insertions(+)arch/arm/dts/sunxi-u- renamed from arch/arm/dts/sunxi-u-boot.dtsi +0
-0
boot.dtsi
index06da009fa2..53db622144100644arch/arm/dts/sunxi-u-boot.dtsi +2
-0@@ -13,7 +13,9 @@ / { aliases { mmc0 = &mmc0; +#if CONFIG_MMC_SUNXI_SLOT_EXTRA > 1 mmc1 = &mmc2; +#endif };
binman: binman {
PATCH 20/27 board: licheepi_nano: set CONFIG_MMC_SUNXI_SLOT_EXTRA
In reply to Yifan Gu--- configs/licheepi_nano_defconfig | 1 + configs/licheepi_nano_spiflash_defconfig | 1 + 2 files changed, 2 insertions(+)
configs/licheepi_nano_defconfig +1 -0
@@ -7,3 +7,4 @@ CONFIG_DRAM_ZQ=0 CONFIG_DEFAULT_DEVICE_TREE="suniv-f1c100s-licheepi-nano" CONFIG_SPL=y # CONFIG_SPL_DM_SERIAL is not set +CONFIG_MMC_SUNXI_SLOT_EXTRA=1
configs/licheepi_nano_spiflash_defconfig +1 -0
@@ -23,3 +23,4 @@ CONFIG_SPL_SPI_SUNXI=y # CONFIG_SPL_DM_SERIAL is not set CONFIG_DM_SPI=y CONFIG_SUN6I_SPI=y +CONFIG_MMC_SUNXI_SLOT_EXTRA=1
Signature · 1 line
2.25.1
PATCH 21/27 sunxi: suniv: add missing header include for udelay
In reply to Yifan Gu--- arch/arm/mach-sunxi/dram_suniv.c | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-sunxi/dram_suniv.c +1 -0
@@ -15,6 +15,7 @@#include <asm/arch/clock.h> #include <asm/arch/dram.h> #include <asm/arch/gpio.h> +#include <linux/delay.h> #define SDR_T_CAS (0x2)#define SDR_T_RAS (0x8)
Signature · 1 line
2.25.1
PATCH 22/27 sunxi: suniv: allow serial connection on uart1
In reply to Yifan Gu--- arch/arm/include/asm/arch-sunxi/gpio.h | 1 + arch/arm/mach-sunxi/board.c | 4 ++++ 2 files changed, 5 insertions(+)
arch/arm/include/asm/arch-sunxi/gpio.h +1 -0
@@ -180,6 +180,7 @@ enum sunxi_gpio_number {#define SUNXI_GPD_PWM 2#define SUNIV_GPE_UART0 5 +#define SUNIV_GPA_UART1 5#define SUN5I_GPE_SDC2 3#define SUN8I_GPE_TWI2 3#define SUN50I_GPE_TWI2 3
arch/arm/mach-sunxi/board.c +4 -0
@@ -100,6 +100,10 @@ static int gpio_init(void)sunxi_gpio_set_cfgpin (SUNXI_GPE (0 ),SUNIV_GPE_UART0 );sunxi_gpio_set_cfgpin (SUNXI_GPE (1 ),SUNIV_GPE_UART0 );sunxi_gpio_set_pull (SUNXI_GPE (1 ),SUNXI_GPIO_PULL_UP ); +#elif CONFIG_CONS_INDEX ==2 && defined(CONFIG_MACH_SUNIV ) +sunxi_gpio_set_cfgpin (SUNXI_GPA (2 ),SUNIV_GPA_UART1 ); +sunxi_gpio_set_cfgpin (SUNXI_GPA (3 ),SUNIV_GPA_UART1 ); +sunxi_gpio_set_pull (SUNXI_GPA (2 ),SUNXI_GPIO_PULL_UP );#elif CONFIG_CONS_INDEX ==1 && (defined(CONFIG_MACH_SUN4I ) || \ defined(CONFIG_MACH_SUN7I ) || \ defined(CONFIG_MACH_SUN8I_R40 ))
Signature · 1 line
2.25.1
PATCH 23/27 sunxi: suniv: do not detect boot sector on suniv
In reply to Yifan GuThe BROM of suniv does not pass info to SPL, and it should always boot from the 8KB offset.
--- arch/arm/mach-sunxi/board.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arm/mach-sunxi/board.c +1 -2
@@ -305,6 +305,7 @@ uint32_t sunxi_get_boot_device(void) } #ifdef CONFIG_SPL_BUILD +#ifndef CONFIG_MACH_SUNIV static u32 sunxi_get_spl_size(void) { if (!is_boot0_magic(SPL_ADDR + 4)) /* eGON.BT0 */
@@ -339,8 +340,6 @@ unsigned long spl_mmc_get_uboot_raw_sector(struct mmc *mmc,return sector; } - -#ifndef CONFIG_MACH_SUNIV u32 spl_boot_device (void ) {return sunxi_get_boot_device ();
Signature · 1 line
2.25.1
PATCH 24/27 sunxi: suniv: set SYS_TEXT_BASE default
In reply to Yifan Gusuniv ddr memory starts at 0x8000000. Set SYS_TEXT_BASE accordingly so SPL can copy U-Boot proper to DRAM.
--- common/Kconfig.boot | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
common/Kconfig.boot +2 -1
@@ -360,9 +360,10 @@ config SYS_TEXT_BASE depends on HAVE_SYS_TEXT_BASE default 0x0 if POSITION_INDEPENDENT default 0x80800000 if ARCH_OMAP2PLUS || ARCH_K3 - default 0x4a000000 if ARCH_SUNXI && !MACH_SUN9I && !MACH_SUN8I_V3S + default 0x4a000000 if ARCH_SUNXI && !MACH_SUN9I && !MACH_SUN8I_V3S && !MACH_SUNIV default 0x2a000000 if ARCH_SUNXI && MACH_SUN9I default 0x42e00000 if ARCH_SUNXI && MACH_SUN8I_V3S + default 0x81c00000 if ARCH_SUNXI && MACH_SUNIV hex "Text Base" help The address in memory that U-Boot will be running from, initially.
Signature · 1 line
2.25.1
PATCH 25/27 sunxi: suniv: disable mmc optimization for suniv
In reply to Yifan Gusuniv cannot boot with this mmc optimization, as suniv fifo level register is only 4 bits.
Disable this optimization for suniv for now.
--- drivers/mmc/sunxi_mmc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/mmc/sunxi_mmc.c +5 -1
@@ -324,7 +324,7 @@ static int mmc_trans_data_by_cpu(struct sunxi_mmc_priv *priv, struct mmc *mmc, start =get_timer (0 );for (i =0 ; i < word_cnt;) { -unsigned int in_fifo; +__maybe_unused unsigned int in_fifo;while ((status =readl (&priv->reg->status)) & status_bit) {if (get_timer (start) > timeout_msecs)
@@ -343,6 +343,9 @@ static int mmc_trans_data_by_cpu(struct sunxi_mmc_priv *priv, struct mmc *mmc,continue ; } +#ifdef CONFIG_MACH_SUNIV + buff[i++] =readl (&priv->reg->fifo); +#else /* * The status register holds the current FIFO level, so we * can be sure to collect as many words from the FIFO
@@ -355,6 +358,7 @@ static int mmc_trans_data_by_cpu(struct sunxi_mmc_priv *priv, struct mmc *mmc, in_fifo--) buff[i++] =readl_relaxed (&priv->reg->fifo);dmb (); +#endif }return 0 ;
Signature · 1 line
2.25.1
PATCH 26/27 arm: dts: suniv: define uart1 pins
In reply to Yifan Gu--- arch/arm/dts/suniv.dtsi | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm/dts/suniv.dtsi +5 -0
@@ -126,6 +126,11 @@ function = "uart0"; }; + uart1_pa_pins: uart-pins-pa { + pins = "PA2", "PA3"; + function = "uart1"; + }; + mmc0_pins: mmc0-pins { pins = "PF0", "PF1", "PF2", "PF3", "PF4", "PF5"; function = "mmc0";
Signature · 1 line
2.25.1
PATCH 27/27 arm: dts: add pocketgo handheld support
In reply to Yifan Gu--- arch/arm/dts/Makefile | 3 +- arch/arm/dts/suniv-f1c100s-pocketgo.dts | 48 +++++++++++++++++++++++++ configs/pocketgo_defconfig | 12 +++++++ 3 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 arch/arm/dts/suniv-f1c100s-pocketgo.dts create mode 100644 configs/pocketgo_defconfig
arch/arm/dts/Makefile +2 -1
@@ -666,7 +666,8 @@ dtb-$(CONFIG_MACH_SUN9I) += \ sun9i-a80-cubieboard4.dtb \ sun9i-a80-cx-a99.dtb dtb-$(CONFIG_MACH_SUNIV) += \ - suniv-f1c100s-licheepi-nano.dtb + suniv-f1c100s-licheepi-nano.dtb \ + suniv-f1c100s-pocketgo.dtb dtb-$(CONFIG_VF610) += vf500-colibri.dtb \ vf610-colibri.dtb \
arch/arm/dts/suniv-f1c100s-pocketgo.dts new file +48 -0
48 lines not on this page · raw message
configs/pocketgo_defconfig new file +12 -0
@@ -0,0 +1,12 @@ +CONFIG_ARM=y +CONFIG_ARCH_SUNXI=y +CONFIG_MACH_SUNIV=y +CONFIG_DRAM_CLK=156 +CONFIG_DRAM_ZQ=0 +# CONFIG_VIDEO_SUNXI is not set +CONFIG_DEFAULT_DEVICE_TREE="suniv-f1c100s-pocketgo" +CONFIG_SPL=y +# CONFIG_SPL_DM_SERIAL is not set +CONFIG_MMC_SUNXI=y +CONFIG_CONS_INDEX=2 +CONFIG_NET=n
Signature · 1 line
2.25.1