您尚未登录。

楼主 # 2023-03-03 09:59:01

wills
会员
注册时间: 2023-03-03
已发帖子: 10
积分: 12

T113主线u-boot/kernel支持代码

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)

离线

#1 2023-03-03 12:01:49

tango_zhu
会员
注册时间: 2018-04-12
已发帖子: 115
积分: 2

Re: T113主线u-boot/kernel支持代码

内核是哪个版本? mango pi 怎么接spi nand ? 自己焊接吗 ?

离线

楼主 #2 2023-03-06 09:09:04

wills
会员
注册时间: 2023-03-03
已发帖子: 10
积分: 12

Re: T113主线u-boot/kernel支持代码

tango_zhu 说:

内核是哪个版本? 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)

离线

#3 2023-03-21 23:13:17

chenfengmcu
会员
注册时间: 2019-10-06
已发帖子: 9
积分: 4

Re: T113主线u-boot/kernel支持代码

starting kernel 卡住 内核设备树确认正常,能否开放一个内核测试版本

离线

楼主 #5 2023-03-29 12:22:37

wills
会员
注册时间: 2023-03-03
已发帖子: 10
积分: 12

Re: T113主线u-boot/kernel支持代码

chenfengmcu 说:

starting kernel 卡住 内核设备树确认正常,能否开放一个内核测试版本

有启动log吗?注意console是PE uart0

最近编辑记录 wills (2023-03-29 14:04:05)

离线

楼主 #6 2023-03-29 12:24:52

wills
会员
注册时间: 2023-03-03
已发帖子: 10
积分: 12

Re: T113主线u-boot/kernel支持代码

内核改动不多,比较简单,所以没有专门放上去

离线

楼主 #7 2023-03-29 14:12:58

wills
会员
注册时间: 2023-03-03
已发帖子: 10
积分: 12

Re: T113主线u-boot/kernel支持代码

基于主线Linux 6.3-rc4的 mangopi-dual板的patch文件
linux-t113-6.3-rc4.patch.zip

离线

#9 2023-04-03 19:17:37

vigour1000
会员
注册时间: 2018-11-19
已发帖子: 100
积分: 6

Re: T113主线u-boot/kernel支持代码

内核版本升级太快

离线

#10 2023-04-03 21:34:35

chenfengmcu
会员
注册时间: 2019-10-06
已发帖子: 9
积分: 4

Re: T113主线u-boot/kernel支持代码

楼主提供的主线源码非常好,大家可以偿试一下,生成的debian系统很方便

离线

#11 2023-10-23 17:41:57

vvpnet
会员
注册时间: 2023-01-31
已发帖子: 7
积分: 7

Re: T113主线u-boot/kernel支持代码

@wills
告诉我。 你是如何将linux写入nand flash的? 通过xfel? 给我举个例子。 谢谢!

离线

楼主 #12 2023-10-24 08:55:15

wills
会员
注册时间: 2023-03-03
已发帖子: 10
积分: 12

Re: T113主线u-boot/kernel支持代码

u-boot用xfel写到spi-nand里面
kernel如果放在单独的分区,也是一样
或者把kernel放在ubi/ubifs里面,用u-boot烧写

离线

#13 2023-11-20 16:59:53

ueiia
会员
注册时间: 2021-04-30
已发帖子: 29
积分: 12

Re: T113主线u-boot/kernel支持代码

之前试的大佬的AWBOOT+6.0.1内核,启动没成功,试试6.3的版本

离线

#14 2023-11-20 23:41:07

HunanJLR
会员
注册时间: 2023-11-19
已发帖子: 5
积分: 0

Re: T113主线u-boot/kernel支持代码

同样是T113,S3是商业级,-i工业级。官方搞2种干嘛

离线

#15 2023-11-25 17:19:36

暗水天狼
会员
注册时间: 2023-04-15
已发帖子: 12
积分: 12

Re: T113主线u-boot/kernel支持代码

我克隆下来后,编译报错:
配置:
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

离线

楼主 #16 2023-11-28 09:27:58

wills
会员
注册时间: 2023-03-03
已发帖子: 10
积分: 12

Re: T113主线u-boot/kernel支持代码

设置工具链 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- 编译

离线

#17 2023-12-01 10:54:46

暗水天狼
会员
注册时间: 2023-04-15
已发帖子: 12
积分: 12

Re: T113主线u-boot/kernel支持代码

@wills 已经解决,谢谢!

离线

#18 2023-12-03 09:32:00

ueiia
会员
注册时间: 2021-04-30
已发帖子: 29
积分: 12

Re: T113主线u-boot/kernel支持代码

主线代码还有很多驱动都没有,不如用tina来的省心,不过tina的编译好复杂,学起来真要命

离线

楼主 #19 2023-12-04 16:13:22

wills
会员
注册时间: 2023-03-03
已发帖子: 10
积分: 12

Re: T113主线u-boot/kernel支持代码

如果你需要做一些原厂无法覆盖到的差异化的东西,你就知道tina到底省不省心?
话说回来,除了turnkey和大厂,用全志的啥时候省心过,主要还是图便宜

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn