···1010 select CADENCE_TTC_TIMER1111 select ARM_GLOBAL_TIMER if !CPU_FREQ1212 select MFD_SYSCON1313+ select SOC_BUS1314 help1415 Support for Xilinx Zynq ARM Cortex A9 Platform
+70-1
arch/arm/mach-zynq/common.c
···2929#include <linux/memblock.h>3030#include <linux/irqchip.h>3131#include <linux/irqchip/arm-gic.h>3232+#include <linux/slab.h>3333+#include <linux/sys_soc.h>32343335#include <asm/mach/arch.h>3436#include <asm/mach/map.h>···3937#include <asm/page.h>4038#include <asm/pgtable.h>4139#include <asm/smp_scu.h>4040+#include <asm/system_info.h>4241#include <asm/hardware/cache-l2x0.h>43424443#include "common.h"4444+4545+#define ZYNQ_DEVCFG_MCTRL 0x804646+#define ZYNQ_DEVCFG_PS_VERSION_SHIFT 284747+#define ZYNQ_DEVCFG_PS_VERSION_MASK 0xF45484649void __iomem *zynq_scu_base;4750···6760};68616962/**6363+ * zynq_get_revision - Get Zynq silicon revision6464+ *6565+ * Return: Silicon version or -1 otherwise6666+ */6767+static int __init zynq_get_revision(void)6868+{6969+ struct device_node *np;7070+ void __iomem *zynq_devcfg_base;7171+ u32 revision;7272+7373+ np = of_find_compatible_node(NULL, NULL, "xlnx,zynq-devcfg-1.0");7474+ if (!np) {7575+ pr_err("%s: no devcfg node found\n", __func__);7676+ return -1;7777+ }7878+7979+ zynq_devcfg_base = of_iomap(np, 0);8080+ if (!zynq_devcfg_base) {8181+ pr_err("%s: Unable to map I/O memory\n", __func__);8282+ return -1;8383+ }8484+8585+ revision = readl(zynq_devcfg_base + ZYNQ_DEVCFG_MCTRL);8686+ revision >>= ZYNQ_DEVCFG_PS_VERSION_SHIFT;8787+ revision &= ZYNQ_DEVCFG_PS_VERSION_MASK;8888+8989+ iounmap(zynq_devcfg_base);9090+9191+ return revision;9292+}9393+9494+/**7095 * zynq_init_machine - System specific initialization, intended to be7196 * called from board specific initialization.7297 */7398static void __init zynq_init_machine(void)7499{75100 struct platform_device_info devinfo = { .name = "cpufreq-cpu0", };101101+ struct soc_device_attribute *soc_dev_attr;102102+ struct soc_device *soc_dev;103103+ struct device *parent = NULL;7610477105 /*78106 * 64KB way size, 8-way associativity, parity disabled79107 */80108 l2x0_of_init(0x02060000, 0xF0F0FFFF);811098282- of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);110110+ soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);111111+ if (!soc_dev_attr)112112+ goto out;113113+114114+ system_rev = zynq_get_revision();115115+116116+ soc_dev_attr->family = kasprintf(GFP_KERNEL, "Xilinx Zynq");117117+ soc_dev_attr->revision = kasprintf(GFP_KERNEL, "0x%x", system_rev);118118+ soc_dev_attr->soc_id = kasprintf(GFP_KERNEL, "0x%x",119119+ zynq_slcr_get_device_id());120120+121121+ soc_dev = soc_device_register(soc_dev_attr);122122+ if (IS_ERR(soc_dev)) {123123+ kfree(soc_dev_attr->family);124124+ kfree(soc_dev_attr->revision);125125+ kfree(soc_dev_attr->soc_id);126126+ kfree(soc_dev_attr);127127+ goto out;128128+ }129129+130130+ parent = soc_device_to_device(soc_dev);131131+132132+out:133133+ /*134134+ * Finished with the static registrations now; fill in the missing135135+ * devices136136+ */137137+ of_platform_populate(NULL, of_default_bus_match_table, NULL, parent);8313884139 platform_device_register(&zynq_cpuidle_device);85140 platform_device_register_full(&devinfo);