您尚未登录。

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

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

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)

离线

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

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

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)

离线

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

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

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
已发帖子: 11
积分: 13

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

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

离线

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

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

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

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

离线

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

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

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

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

离线

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

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

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- 编译

离线

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

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

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

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

离线

楼主 #23 2024-09-25 10:45:04

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

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

最新的u-boot和kernel主线已经支持了T113,只不过里面的用的型号是R528

离线

页脚

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

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