1.用cat /proc/cpuinfo看cpuid是0000000000000000,是因为内核驱动没有加读cpuid的代码 2.kernel_imx/arch/arm/kernel/setup.c,添加下方补丁 --- a/kernel_imx/arch/arm/kernel/setup.c +++ b/kernel_imx/arch/arm/kernel/setup.c @@ -57,6 +57,11 @@ #include <asm/unwind.h> #include <asm/memblock.h> #include <asm/virt.h> +#include <linux/of.h> +#include <linux/of_address.h> +#include <linux/regmap.h> +#include <asm/mach/map.h> +#include <asm/io.h> #include "atags.h" @@ -837,10 +842,34 @@ static int __init customize_machine(void) } arch_initcall(customize_machine); +#define OCOTP_CFG0 0x410 +#define OCOTP_CFG1 0x420 + static int __init init_machine_late(void) { + struct device_node *np; + void __iomem *base; + if (machine_desc->init_late) machine_desc->init_late(); + + np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-ocotp"); + if (!np) { + pr_warn("failed to find ocotp node\n"); + return -ENODEV; + } + + base = of_iomap(np, 0); + if (!base) { + pr_warn("failed to map ocotp\n"); + goto put_node; + } + + system_serial_low = readl_relaxed(base + OCOTP_CFG0); + system_serial_high = readl_relaxed(base + OCOTP_CFG1); +put_node: + of_node_put(np); + return 0; } late_initcall(init_machine_late); -- 2.17.1 |
|小黑屋|
飞凌嵌入式
( 冀ICP备12004394号-1 )
GMT+8, 2025-7-1 15:28
Powered by Discuz! X3.4
© 2001-2013 Comsenz Inc.