拿到了 T113-S4 的片子,先焊接上去

ebac880c-f76b-4b69-8804-5b534d1ec79b-9821e79089ef316fba8458a1d89c79a.jpg

然后准备下SDK,拉取了全新的D1-H 2.1SDK

f1225966-082f-4a33-9845-ae757a73845e-image.png

然后去 https://github.com/YuzukiHD/TinaAddons 找到 T113 的补丁打进去

git clone https://github.com/YuzukiHD/TinaAddons.git
cp -rf TinaAddons/* .
chmod 777 apply_patch.sh
./apply_patch.sh

然后就能找到 T113 平台了

637e08a5-9bbb-4af1-ba87-0a5a5614cbed-image.png

修改 DRAM 驱动,支持T113-S4

驱动:https://github.com/YuzukiHD/TinyKasKit/blob/master/lib-dram-for-t113-s4.tar.gz

把这个驱动放到 lichee/brandy-2.0/spl/drivers/dram/sun8iw20p1

烧录~启动,识别了256M 内存

7b91be57-2ffc-47f6-a4f1-f6cf9fcfa07e-image.png

问题来了,卡OPTEE

006d242e-e419-4f16-b1b3-bd1cc79167c4-image.png

M/TC: OP-TEE version: 963b7e95 (gcc version 5.3.1 20160412 (Linaro GCC 5.3-2016.05)) #1 Wed Jul 28 12:51:52 UTC 2021 arm
E/TC:0 0 check_hardware_info:122 data: 60 0 0 0
E/TC:0 0 check_hardware_info:123 hardware error 3
E/TC:0 0 Panic at core/arch/arm/plat-sun8iw20p1/main.c:301 <plat_init>
E/TC:0 0 Call stack:
E/TC:0 0  0x41b0a271

那就先跳过 OPTEE 吧,在 device/config/chips/t113/configs/nezha/ 新建一个 boot_package.cfg

ff0c8b32-0a39-485e-b519-d688fc0734cd-image.png

写入以下内容

[package]
item=u-boot, u-boot.fex
item=dtb,    sunxi.fex

然后找到 lichee/linux-5.4/arch/arm/boot/dts/sun8iw20p1.dtsi 中的 psci 节点把他删了

psci {
	compatible = "arm,psci-1.0";
	method = "smc";
};

be847701-5ae6-4e07-bc69-5c8b14beff6b-image.png

启动了,256M 可用内存

7cf9ea13-738e-46c5-9590-d19406ad304a-image.png

启用SMP

由于上面关闭了optee和pcsi,所以是不能用双核的,为了开启双核需要加下配置代码

打开 lichee/linux-5.4/arch/arm/mach-sunxi/platsmp.c 文件,在末尾加入下列内容

static int sun8i_t113_smp_boot_secondary(unsigned int cpu,
				    struct task_struct *idle)
{
    u32 reg;
    void __iomem *cpucfg_membase = ioremap(0x09010000, 0x10);
    void __iomem *cpuexec_membase[] = {ioremap(0x070005C4, 0x10),ioremap(0x070005C8, 0x10)};
	
	if (cpu != 1)
	    return 0;

	spin_lock(&cpu_lock);

	writel(__pa_symbol(secondary_startup),	cpuexec_membase[cpu]);

	reg = readl(cpucfg_membase);
	writel(reg | BIT(cpu), cpucfg_membase);

	spin_unlock(&cpu_lock);

	return 0;
}

static const struct smp_operations sun8i_t113_smp_ops __initconst = {
	.smp_boot_secondary	= sun8i_t113_smp_boot_secondary,
};
CPU_METHOD_OF_DECLARE(sun8i_t113_smp, "allwinner,sun8iw20p1", &sun8i_t113_smp_ops);

配置smp,设置boot地址和rst地址并且启动即可

1f9705a9-3d93-4973-ae13-178f13a549c6-69b920e462002d5b4bd1eade6c2583d.png