T113主线u-boot支持代码:
https://github.com/willswang/u-boot/tree/t113-2022.10.y
Tested on mangopi-dual board with PE uart0
Support boot from spi-nand/mmc
Support heyangtek spi nand
Support usb/mmc/eth
Support env storage on mtd
Support boot mainline kernel
Build for mangopi-dual board:
make mangopi_dual_defconfig
make
Burn to spi nand:
xfel spinand write 0 u-boot-sunxi-with-spl.bin
T113主线kernel支持patch:
arch/arm/mach-sunxi/platsmp.c
#define PRCM_CPU_PWROFF_REG 0x100
#define PRCM_CPU_PWR_CLAMP_REG(cpu) (((cpu) * 4) + 0x140)
+/*
+ * T113 is different from other SoCs.
+ */
+#define T113_CPUCFG_RST_CTRL_REG 0x0000
+#define T113_CPUCTRL_ENTRY_REG(cpu) (0x5c0 + ((cpu) + 1) * 4)
+
static void __iomem *cpucfg_membase;
static void __iomem *prcm_membase;
@@ -194,3 +200,61 @@ static const struct smp_operations sun8i_smp_ops __initconst = {
.smp_boot_secondary = sun8i_smp_boot_secondary,
};
CPU_METHOD_OF_DECLARE(sun8i_a23_smp, "allwinner,sun8i-a23", &sun8i_smp_ops);
+
+static void __init sun8i_t113_smp_prepare_cpus(unsigned int max_cpus)
+{
+ struct device_node *node;
+
+ node = of_find_compatible_node(NULL, NULL, "allwinner,sun8i-t113-cpucontrol");
+ if (!node) {
+ pr_err("Missing T113 CPU contrl node in the device tree\n");
+ return;
+ }
+
+ prcm_membase = of_iomap(node, 0);
+ of_node_put(node);
+ if (!prcm_membase) {
+ pr_err("Couldn't map T113 CPU contrl registers\n");
+ return;
+ }
+
+ node = of_find_compatible_node(NULL, NULL,
+ "allwinner,sun8i-t113-cpuconfig");
+ if (!node) {
+ pr_err("Missing T113 CPU config node in the device tree\n");
+ return;
+ }
+
+ cpucfg_membase = of_iomap(node, 0);
+ of_node_put(node);
+ if (!cpucfg_membase)
+ pr_err("Couldn't map T113 CPU config registers\n");
+}
+
+static int sun8i_t113_smp_boot_secondary(unsigned int cpu,
+ struct task_struct *idle)
+{
+ u32 reg;
+
+ if (!(prcm_membase && cpucfg_membase))
+ return -EFAULT;
+
+ spin_lock(&cpu_lock);
+
+ /* Set CPU boot address */
+ writel(__pa_symbol(secondary_startup), prcm_membase + T113_CPUCTRL_ENTRY_REG(cpu));
+
+ /* Deassert the CPU core reset */
+ reg = readl(cpucfg_membase + T113_CPUCFG_RST_CTRL_REG);
+ writel(reg | BIT(cpu), cpucfg_membase + T113_CPUCFG_RST_CTRL_REG);
+
+ spin_unlock(&cpu_lock);
+
+ return 0;
+}
+
+static const struct smp_operations sun8i_t113_smp_ops __initconst = {
+ .smp_prepare_cpus = sun8i_t113_smp_prepare_cpus,
+ .smp_boot_secondary = sun8i_t113_smp_boot_secondary,
+};
+CPU_METHOD_OF_DECLARE(sun8i_t113_smp, "allwinner,sun8i-t113", &sun8i_t113_smp_ops);
在dts中增加下列节点:
arch/arm/boot/dts/sun8i-t113.dtsi
cpus {
enable-method = "allwinner,sun8i-t113";
#address-cells = <1>;
#size-cells = <0>;
cpu0: cpu@0 {
device_type = "cpu";
compatible = "arm,cortex-a7","arm,armv7";
reg = <0x0>;
clocks = <&ccu CLK_CPUX>;
clock-frequency = <1200000000>;
#cooling-cells = <2>;
};
cpu1: cpu@1 {
device_type = "cpu";
compatible = "arm,cortex-a7","arm,armv7";
reg = <0x1>;
clocks = <&ccu CLK_CPUX>;
clock-frequency = <1200000000>;
#cooling-cells = <2>;
};
};
soc {
cpuctrl: cpuctrl@7000000 {
compatible = "allwinner,sun8i-t113-cpucontrol";
reg = <0x07000000 0x1000>;
};
cpucfg: cpucfg@9010000 {
compatible = "allwinner,sun8i-t113-cpuconfig";
reg = <0x09010000 0x100>;
};
};
最近编辑记录 wills (2023-03-03 10:22:15)
离线
内核是哪个版本? mango pi 怎么接spi nand ? 自己焊接吗 ?
离线
内核是哪个版本? mango pi 怎么接spi nand ? 自己焊接吗 ?
mangopi-dual预留有spi flash焊盘,自己焊接一个就可以
主线内核6.0以上应该就都可以,只是支持外设驱动多少的问题
下面sun8i-t113.dtsi供大家参考:
https://whycan.com/files/members/11464/sun8i-t113.dtsi.zip
最近编辑记录 wills (2023-03-06 09:18:31)
离线
starting kernel 卡住 内核设备树确认正常,能否开放一个内核测试版本
离线
starting kernel 卡住 内核设备树确认正常,能否开放一个内核测试版本
有启动log吗?注意console是PE uart0
最近编辑记录 wills (2023-03-29 14:04:05)
离线
内核改动不多,比较简单,所以没有专门放上去
离线
基于主线Linux 6.3-rc4的 mangopi-dual板的patch文件
linux-t113-6.3-rc4.patch.zip
离线
内核版本升级太快
离线
楼主提供的主线源码非常好,大家可以偿试一下,生成的debian系统很方便
离线
@wills
告诉我。 你是如何将linux写入nand flash的? 通过xfel? 给我举个例子。 谢谢!
离线
u-boot用xfel写到spi-nand里面
kernel如果放在单独的分区,也是一样
或者把kernel放在ubi/ubifs里面,用u-boot烧写
离线
之前试的大佬的AWBOOT+6.0.1内核,启动没成功,试试6.3的版本
离线
同样是T113,S3是商业级,-i工业级。官方搞2种干嘛
离线
我克隆下来后,编译报错:
配置:
make ARCH=arm CROSS_COMPILE=../gcc-linaro-7.5.0-2019.12-rc1-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- mangopi_dual_defconfig
编译:
make ARCH=arm CROSS_COMPILE=../gcc-linaro-7.5.0-2019.12-rc1-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-
报错:
LD spl/u-boot-spl
/bin/sh: 1: ../gcc-linaro-7.5.0-2019.12-rc1-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-ld.bfd: not found
scripts/Makefile.spl:526: recipe for target 'spl/u-boot-spl' failed
make[1]: *** [spl/u-boot-spl] Error 127
Makefile:2075: recipe for target 'spl/u-boot-spl' failed
make: *** [spl/u-boot-spl] Error 2
离线
设置工具链 export PATH=<绝对路径>/gcc-linaro-7.5.0-2019.12-rc1-x86_64_arm-linux-gnueabihf/bin/:$PATH,然后再用make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- 编译
离线
@wills 已经解决,谢谢!
离线
主线代码还有很多驱动都没有,不如用tina来的省心,不过tina的编译好复杂,学起来真要命
离线
如果你需要做一些原厂无法覆盖到的差异化的东西,你就知道tina到底省不省心?
话说回来,除了turnkey和大厂,用全志的啥时候省心过,主要还是图便宜
离线
内核改动不多,比较简单,所以没有专门放上去
给个下载连接吧,那个6。0的编译过了起动不了
离线
@wills
内核SPI驱动都我看没有呀,怎么会支持SPI flash,能否发一个内核的连接,谢谢
离线
如何使用uart3而不是uart0,我改变了dts文件,但没有显示在控制台上,当我使用uart0时它很好
最近编辑记录 dangvitin (2024-09-24 23:23:16)
离线
最新的u-boot和kernel主线已经支持了T113,只不过里面的用的型号是R528
离线