18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Copyright (C) 2015 Atmel 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Alexandre Belloni <alexandre.belloni@free-electrons.com 58c2ecf20Sopenharmony_ci * Boris Brezillon <boris.brezillon@free-electrons.com 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * This file is licensed under the terms of the GNU General Public 88c2ecf20Sopenharmony_ci * License version 2. This program is licensed "as is" without any 98c2ecf20Sopenharmony_ci * warranty of any kind, whether express or implied. 108c2ecf20Sopenharmony_ci * 118c2ecf20Sopenharmony_ci */ 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#define pr_fmt(fmt) "AT91: " fmt 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci#include <linux/io.h> 168c2ecf20Sopenharmony_ci#include <linux/of.h> 178c2ecf20Sopenharmony_ci#include <linux/of_address.h> 188c2ecf20Sopenharmony_ci#include <linux/of_platform.h> 198c2ecf20Sopenharmony_ci#include <linux/slab.h> 208c2ecf20Sopenharmony_ci#include <linux/sys_soc.h> 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci#include "soc.h" 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci#define AT91_DBGU_CIDR 0x40 258c2ecf20Sopenharmony_ci#define AT91_DBGU_EXID 0x44 268c2ecf20Sopenharmony_ci#define AT91_CHIPID_CIDR 0x00 278c2ecf20Sopenharmony_ci#define AT91_CHIPID_EXID 0x04 288c2ecf20Sopenharmony_ci#define AT91_CIDR_VERSION(x) ((x) & 0x1f) 298c2ecf20Sopenharmony_ci#define AT91_CIDR_EXT BIT(31) 308c2ecf20Sopenharmony_ci#define AT91_CIDR_MATCH_MASK 0x7fffffe0 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_cistatic const struct at91_soc __initconst socs[] = { 338c2ecf20Sopenharmony_ci#ifdef CONFIG_SOC_AT91RM9200 348c2ecf20Sopenharmony_ci AT91_SOC(AT91RM9200_CIDR_MATCH, 0, "at91rm9200 BGA", "at91rm9200"), 358c2ecf20Sopenharmony_ci#endif 368c2ecf20Sopenharmony_ci#ifdef CONFIG_SOC_AT91SAM9 378c2ecf20Sopenharmony_ci AT91_SOC(AT91SAM9260_CIDR_MATCH, 0, "at91sam9260", NULL), 388c2ecf20Sopenharmony_ci AT91_SOC(AT91SAM9261_CIDR_MATCH, 0, "at91sam9261", NULL), 398c2ecf20Sopenharmony_ci AT91_SOC(AT91SAM9263_CIDR_MATCH, 0, "at91sam9263", NULL), 408c2ecf20Sopenharmony_ci AT91_SOC(AT91SAM9G20_CIDR_MATCH, 0, "at91sam9g20", NULL), 418c2ecf20Sopenharmony_ci AT91_SOC(AT91SAM9RL64_CIDR_MATCH, 0, "at91sam9rl64", NULL), 428c2ecf20Sopenharmony_ci AT91_SOC(AT91SAM9G45_CIDR_MATCH, AT91SAM9M11_EXID_MATCH, 438c2ecf20Sopenharmony_ci "at91sam9m11", "at91sam9g45"), 448c2ecf20Sopenharmony_ci AT91_SOC(AT91SAM9G45_CIDR_MATCH, AT91SAM9M10_EXID_MATCH, 458c2ecf20Sopenharmony_ci "at91sam9m10", "at91sam9g45"), 468c2ecf20Sopenharmony_ci AT91_SOC(AT91SAM9G45_CIDR_MATCH, AT91SAM9G46_EXID_MATCH, 478c2ecf20Sopenharmony_ci "at91sam9g46", "at91sam9g45"), 488c2ecf20Sopenharmony_ci AT91_SOC(AT91SAM9G45_CIDR_MATCH, AT91SAM9G45_EXID_MATCH, 498c2ecf20Sopenharmony_ci "at91sam9g45", "at91sam9g45"), 508c2ecf20Sopenharmony_ci AT91_SOC(AT91SAM9X5_CIDR_MATCH, AT91SAM9G15_EXID_MATCH, 518c2ecf20Sopenharmony_ci "at91sam9g15", "at91sam9x5"), 528c2ecf20Sopenharmony_ci AT91_SOC(AT91SAM9X5_CIDR_MATCH, AT91SAM9G35_EXID_MATCH, 538c2ecf20Sopenharmony_ci "at91sam9g35", "at91sam9x5"), 548c2ecf20Sopenharmony_ci AT91_SOC(AT91SAM9X5_CIDR_MATCH, AT91SAM9X35_EXID_MATCH, 558c2ecf20Sopenharmony_ci "at91sam9x35", "at91sam9x5"), 568c2ecf20Sopenharmony_ci AT91_SOC(AT91SAM9X5_CIDR_MATCH, AT91SAM9G25_EXID_MATCH, 578c2ecf20Sopenharmony_ci "at91sam9g25", "at91sam9x5"), 588c2ecf20Sopenharmony_ci AT91_SOC(AT91SAM9X5_CIDR_MATCH, AT91SAM9X25_EXID_MATCH, 598c2ecf20Sopenharmony_ci "at91sam9x25", "at91sam9x5"), 608c2ecf20Sopenharmony_ci AT91_SOC(AT91SAM9N12_CIDR_MATCH, AT91SAM9CN12_EXID_MATCH, 618c2ecf20Sopenharmony_ci "at91sam9cn12", "at91sam9n12"), 628c2ecf20Sopenharmony_ci AT91_SOC(AT91SAM9N12_CIDR_MATCH, AT91SAM9N12_EXID_MATCH, 638c2ecf20Sopenharmony_ci "at91sam9n12", "at91sam9n12"), 648c2ecf20Sopenharmony_ci AT91_SOC(AT91SAM9N12_CIDR_MATCH, AT91SAM9CN11_EXID_MATCH, 658c2ecf20Sopenharmony_ci "at91sam9cn11", "at91sam9n12"), 668c2ecf20Sopenharmony_ci AT91_SOC(AT91SAM9XE128_CIDR_MATCH, 0, "at91sam9xe128", "at91sam9xe128"), 678c2ecf20Sopenharmony_ci AT91_SOC(AT91SAM9XE256_CIDR_MATCH, 0, "at91sam9xe256", "at91sam9xe256"), 688c2ecf20Sopenharmony_ci AT91_SOC(AT91SAM9XE512_CIDR_MATCH, 0, "at91sam9xe512", "at91sam9xe512"), 698c2ecf20Sopenharmony_ci#endif 708c2ecf20Sopenharmony_ci#ifdef CONFIG_SOC_SAM9X60 718c2ecf20Sopenharmony_ci AT91_SOC(SAM9X60_CIDR_MATCH, SAM9X60_EXID_MATCH, "sam9x60", "sam9x60"), 728c2ecf20Sopenharmony_ci#endif 738c2ecf20Sopenharmony_ci#ifdef CONFIG_SOC_SAMA5 748c2ecf20Sopenharmony_ci AT91_SOC(SAMA5D2_CIDR_MATCH, SAMA5D21CU_EXID_MATCH, 758c2ecf20Sopenharmony_ci "sama5d21", "sama5d2"), 768c2ecf20Sopenharmony_ci AT91_SOC(SAMA5D2_CIDR_MATCH, SAMA5D22CU_EXID_MATCH, 778c2ecf20Sopenharmony_ci "sama5d22", "sama5d2"), 788c2ecf20Sopenharmony_ci AT91_SOC(SAMA5D2_CIDR_MATCH, SAMA5D225C_D1M_EXID_MATCH, 798c2ecf20Sopenharmony_ci "sama5d225c 16MiB SiP", "sama5d2"), 808c2ecf20Sopenharmony_ci AT91_SOC(SAMA5D2_CIDR_MATCH, SAMA5D23CU_EXID_MATCH, 818c2ecf20Sopenharmony_ci "sama5d23", "sama5d2"), 828c2ecf20Sopenharmony_ci AT91_SOC(SAMA5D2_CIDR_MATCH, SAMA5D24CX_EXID_MATCH, 838c2ecf20Sopenharmony_ci "sama5d24", "sama5d2"), 848c2ecf20Sopenharmony_ci AT91_SOC(SAMA5D2_CIDR_MATCH, SAMA5D24CU_EXID_MATCH, 858c2ecf20Sopenharmony_ci "sama5d24", "sama5d2"), 868c2ecf20Sopenharmony_ci AT91_SOC(SAMA5D2_CIDR_MATCH, SAMA5D26CU_EXID_MATCH, 878c2ecf20Sopenharmony_ci "sama5d26", "sama5d2"), 888c2ecf20Sopenharmony_ci AT91_SOC(SAMA5D2_CIDR_MATCH, SAMA5D27CU_EXID_MATCH, 898c2ecf20Sopenharmony_ci "sama5d27", "sama5d2"), 908c2ecf20Sopenharmony_ci AT91_SOC(SAMA5D2_CIDR_MATCH, SAMA5D27CN_EXID_MATCH, 918c2ecf20Sopenharmony_ci "sama5d27", "sama5d2"), 928c2ecf20Sopenharmony_ci AT91_SOC(SAMA5D2_CIDR_MATCH, SAMA5D27C_D1G_EXID_MATCH, 938c2ecf20Sopenharmony_ci "sama5d27c 128MiB SiP", "sama5d2"), 948c2ecf20Sopenharmony_ci AT91_SOC(SAMA5D2_CIDR_MATCH, SAMA5D27C_D5M_EXID_MATCH, 958c2ecf20Sopenharmony_ci "sama5d27c 64MiB SiP", "sama5d2"), 968c2ecf20Sopenharmony_ci AT91_SOC(SAMA5D2_CIDR_MATCH, SAMA5D27C_LD1G_EXID_MATCH, 978c2ecf20Sopenharmony_ci "sama5d27c 128MiB LPDDR2 SiP", "sama5d2"), 988c2ecf20Sopenharmony_ci AT91_SOC(SAMA5D2_CIDR_MATCH, SAMA5D27C_LD2G_EXID_MATCH, 998c2ecf20Sopenharmony_ci "sama5d27c 256MiB LPDDR2 SiP", "sama5d2"), 1008c2ecf20Sopenharmony_ci AT91_SOC(SAMA5D2_CIDR_MATCH, SAMA5D28CU_EXID_MATCH, 1018c2ecf20Sopenharmony_ci "sama5d28", "sama5d2"), 1028c2ecf20Sopenharmony_ci AT91_SOC(SAMA5D2_CIDR_MATCH, SAMA5D28CN_EXID_MATCH, 1038c2ecf20Sopenharmony_ci "sama5d28", "sama5d2"), 1048c2ecf20Sopenharmony_ci AT91_SOC(SAMA5D2_CIDR_MATCH, SAMA5D28C_D1G_EXID_MATCH, 1058c2ecf20Sopenharmony_ci "sama5d28c 128MiB SiP", "sama5d2"), 1068c2ecf20Sopenharmony_ci AT91_SOC(SAMA5D2_CIDR_MATCH, SAMA5D28C_LD1G_EXID_MATCH, 1078c2ecf20Sopenharmony_ci "sama5d28c 128MiB LPDDR2 SiP", "sama5d2"), 1088c2ecf20Sopenharmony_ci AT91_SOC(SAMA5D2_CIDR_MATCH, SAMA5D28C_LD2G_EXID_MATCH, 1098c2ecf20Sopenharmony_ci "sama5d28c 256MiB LPDDR2 SiP", "sama5d2"), 1108c2ecf20Sopenharmony_ci AT91_SOC(SAMA5D3_CIDR_MATCH, SAMA5D31_EXID_MATCH, 1118c2ecf20Sopenharmony_ci "sama5d31", "sama5d3"), 1128c2ecf20Sopenharmony_ci AT91_SOC(SAMA5D3_CIDR_MATCH, SAMA5D33_EXID_MATCH, 1138c2ecf20Sopenharmony_ci "sama5d33", "sama5d3"), 1148c2ecf20Sopenharmony_ci AT91_SOC(SAMA5D3_CIDR_MATCH, SAMA5D34_EXID_MATCH, 1158c2ecf20Sopenharmony_ci "sama5d34", "sama5d3"), 1168c2ecf20Sopenharmony_ci AT91_SOC(SAMA5D3_CIDR_MATCH, SAMA5D35_EXID_MATCH, 1178c2ecf20Sopenharmony_ci "sama5d35", "sama5d3"), 1188c2ecf20Sopenharmony_ci AT91_SOC(SAMA5D3_CIDR_MATCH, SAMA5D36_EXID_MATCH, 1198c2ecf20Sopenharmony_ci "sama5d36", "sama5d3"), 1208c2ecf20Sopenharmony_ci AT91_SOC(SAMA5D4_CIDR_MATCH, SAMA5D41_EXID_MATCH, 1218c2ecf20Sopenharmony_ci "sama5d41", "sama5d4"), 1228c2ecf20Sopenharmony_ci AT91_SOC(SAMA5D4_CIDR_MATCH, SAMA5D42_EXID_MATCH, 1238c2ecf20Sopenharmony_ci "sama5d42", "sama5d4"), 1248c2ecf20Sopenharmony_ci AT91_SOC(SAMA5D4_CIDR_MATCH, SAMA5D43_EXID_MATCH, 1258c2ecf20Sopenharmony_ci "sama5d43", "sama5d4"), 1268c2ecf20Sopenharmony_ci AT91_SOC(SAMA5D4_CIDR_MATCH, SAMA5D44_EXID_MATCH, 1278c2ecf20Sopenharmony_ci "sama5d44", "sama5d4"), 1288c2ecf20Sopenharmony_ci#endif 1298c2ecf20Sopenharmony_ci#ifdef CONFIG_SOC_SAMV7 1308c2ecf20Sopenharmony_ci AT91_SOC(SAME70Q21_CIDR_MATCH, SAME70Q21_EXID_MATCH, 1318c2ecf20Sopenharmony_ci "same70q21", "same7"), 1328c2ecf20Sopenharmony_ci AT91_SOC(SAME70Q20_CIDR_MATCH, SAME70Q20_EXID_MATCH, 1338c2ecf20Sopenharmony_ci "same70q20", "same7"), 1348c2ecf20Sopenharmony_ci AT91_SOC(SAME70Q19_CIDR_MATCH, SAME70Q19_EXID_MATCH, 1358c2ecf20Sopenharmony_ci "same70q19", "same7"), 1368c2ecf20Sopenharmony_ci AT91_SOC(SAMS70Q21_CIDR_MATCH, SAMS70Q21_EXID_MATCH, 1378c2ecf20Sopenharmony_ci "sams70q21", "sams7"), 1388c2ecf20Sopenharmony_ci AT91_SOC(SAMS70Q20_CIDR_MATCH, SAMS70Q20_EXID_MATCH, 1398c2ecf20Sopenharmony_ci "sams70q20", "sams7"), 1408c2ecf20Sopenharmony_ci AT91_SOC(SAMS70Q19_CIDR_MATCH, SAMS70Q19_EXID_MATCH, 1418c2ecf20Sopenharmony_ci "sams70q19", "sams7"), 1428c2ecf20Sopenharmony_ci AT91_SOC(SAMV71Q21_CIDR_MATCH, SAMV71Q21_EXID_MATCH, 1438c2ecf20Sopenharmony_ci "samv71q21", "samv7"), 1448c2ecf20Sopenharmony_ci AT91_SOC(SAMV71Q20_CIDR_MATCH, SAMV71Q20_EXID_MATCH, 1458c2ecf20Sopenharmony_ci "samv71q20", "samv7"), 1468c2ecf20Sopenharmony_ci AT91_SOC(SAMV71Q19_CIDR_MATCH, SAMV71Q19_EXID_MATCH, 1478c2ecf20Sopenharmony_ci "samv71q19", "samv7"), 1488c2ecf20Sopenharmony_ci AT91_SOC(SAMV70Q20_CIDR_MATCH, SAMV70Q20_EXID_MATCH, 1498c2ecf20Sopenharmony_ci "samv70q20", "samv7"), 1508c2ecf20Sopenharmony_ci AT91_SOC(SAMV70Q19_CIDR_MATCH, SAMV70Q19_EXID_MATCH, 1518c2ecf20Sopenharmony_ci "samv70q19", "samv7"), 1528c2ecf20Sopenharmony_ci#endif 1538c2ecf20Sopenharmony_ci { /* sentinel */ }, 1548c2ecf20Sopenharmony_ci}; 1558c2ecf20Sopenharmony_ci 1568c2ecf20Sopenharmony_cistatic int __init at91_get_cidr_exid_from_dbgu(u32 *cidr, u32 *exid) 1578c2ecf20Sopenharmony_ci{ 1588c2ecf20Sopenharmony_ci struct device_node *np; 1598c2ecf20Sopenharmony_ci void __iomem *regs; 1608c2ecf20Sopenharmony_ci 1618c2ecf20Sopenharmony_ci np = of_find_compatible_node(NULL, NULL, "atmel,at91rm9200-dbgu"); 1628c2ecf20Sopenharmony_ci if (!np) 1638c2ecf20Sopenharmony_ci np = of_find_compatible_node(NULL, NULL, 1648c2ecf20Sopenharmony_ci "atmel,at91sam9260-dbgu"); 1658c2ecf20Sopenharmony_ci if (!np) 1668c2ecf20Sopenharmony_ci return -ENODEV; 1678c2ecf20Sopenharmony_ci 1688c2ecf20Sopenharmony_ci regs = of_iomap(np, 0); 1698c2ecf20Sopenharmony_ci of_node_put(np); 1708c2ecf20Sopenharmony_ci 1718c2ecf20Sopenharmony_ci if (!regs) { 1728c2ecf20Sopenharmony_ci pr_warn("Could not map DBGU iomem range"); 1738c2ecf20Sopenharmony_ci return -ENXIO; 1748c2ecf20Sopenharmony_ci } 1758c2ecf20Sopenharmony_ci 1768c2ecf20Sopenharmony_ci *cidr = readl(regs + AT91_DBGU_CIDR); 1778c2ecf20Sopenharmony_ci *exid = readl(regs + AT91_DBGU_EXID); 1788c2ecf20Sopenharmony_ci 1798c2ecf20Sopenharmony_ci iounmap(regs); 1808c2ecf20Sopenharmony_ci 1818c2ecf20Sopenharmony_ci return 0; 1828c2ecf20Sopenharmony_ci} 1838c2ecf20Sopenharmony_ci 1848c2ecf20Sopenharmony_cistatic int __init at91_get_cidr_exid_from_chipid(u32 *cidr, u32 *exid) 1858c2ecf20Sopenharmony_ci{ 1868c2ecf20Sopenharmony_ci struct device_node *np; 1878c2ecf20Sopenharmony_ci void __iomem *regs; 1888c2ecf20Sopenharmony_ci 1898c2ecf20Sopenharmony_ci np = of_find_compatible_node(NULL, NULL, "atmel,sama5d2-chipid"); 1908c2ecf20Sopenharmony_ci if (!np) 1918c2ecf20Sopenharmony_ci return -ENODEV; 1928c2ecf20Sopenharmony_ci 1938c2ecf20Sopenharmony_ci regs = of_iomap(np, 0); 1948c2ecf20Sopenharmony_ci of_node_put(np); 1958c2ecf20Sopenharmony_ci 1968c2ecf20Sopenharmony_ci if (!regs) { 1978c2ecf20Sopenharmony_ci pr_warn("Could not map DBGU iomem range"); 1988c2ecf20Sopenharmony_ci return -ENXIO; 1998c2ecf20Sopenharmony_ci } 2008c2ecf20Sopenharmony_ci 2018c2ecf20Sopenharmony_ci *cidr = readl(regs + AT91_CHIPID_CIDR); 2028c2ecf20Sopenharmony_ci *exid = readl(regs + AT91_CHIPID_EXID); 2038c2ecf20Sopenharmony_ci 2048c2ecf20Sopenharmony_ci iounmap(regs); 2058c2ecf20Sopenharmony_ci 2068c2ecf20Sopenharmony_ci return 0; 2078c2ecf20Sopenharmony_ci} 2088c2ecf20Sopenharmony_ci 2098c2ecf20Sopenharmony_cistruct soc_device * __init at91_soc_init(const struct at91_soc *socs) 2108c2ecf20Sopenharmony_ci{ 2118c2ecf20Sopenharmony_ci struct soc_device_attribute *soc_dev_attr; 2128c2ecf20Sopenharmony_ci const struct at91_soc *soc; 2138c2ecf20Sopenharmony_ci struct soc_device *soc_dev; 2148c2ecf20Sopenharmony_ci u32 cidr, exid; 2158c2ecf20Sopenharmony_ci int ret; 2168c2ecf20Sopenharmony_ci 2178c2ecf20Sopenharmony_ci /* 2188c2ecf20Sopenharmony_ci * With SAMA5D2 and later SoCs, CIDR and EXID registers are no more 2198c2ecf20Sopenharmony_ci * in the dbgu device but in the chipid device whose purpose is only 2208c2ecf20Sopenharmony_ci * to expose these two registers. 2218c2ecf20Sopenharmony_ci */ 2228c2ecf20Sopenharmony_ci ret = at91_get_cidr_exid_from_dbgu(&cidr, &exid); 2238c2ecf20Sopenharmony_ci if (ret) 2248c2ecf20Sopenharmony_ci ret = at91_get_cidr_exid_from_chipid(&cidr, &exid); 2258c2ecf20Sopenharmony_ci if (ret) { 2268c2ecf20Sopenharmony_ci if (ret == -ENODEV) 2278c2ecf20Sopenharmony_ci pr_warn("Could not find identification node"); 2288c2ecf20Sopenharmony_ci return NULL; 2298c2ecf20Sopenharmony_ci } 2308c2ecf20Sopenharmony_ci 2318c2ecf20Sopenharmony_ci for (soc = socs; soc->name; soc++) { 2328c2ecf20Sopenharmony_ci if (soc->cidr_match != (cidr & AT91_CIDR_MATCH_MASK)) 2338c2ecf20Sopenharmony_ci continue; 2348c2ecf20Sopenharmony_ci 2358c2ecf20Sopenharmony_ci if (!(cidr & AT91_CIDR_EXT) || soc->exid_match == exid) 2368c2ecf20Sopenharmony_ci break; 2378c2ecf20Sopenharmony_ci } 2388c2ecf20Sopenharmony_ci 2398c2ecf20Sopenharmony_ci if (!soc->name) { 2408c2ecf20Sopenharmony_ci pr_warn("Could not find matching SoC description\n"); 2418c2ecf20Sopenharmony_ci return NULL; 2428c2ecf20Sopenharmony_ci } 2438c2ecf20Sopenharmony_ci 2448c2ecf20Sopenharmony_ci soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); 2458c2ecf20Sopenharmony_ci if (!soc_dev_attr) 2468c2ecf20Sopenharmony_ci return NULL; 2478c2ecf20Sopenharmony_ci 2488c2ecf20Sopenharmony_ci soc_dev_attr->family = soc->family; 2498c2ecf20Sopenharmony_ci soc_dev_attr->soc_id = soc->name; 2508c2ecf20Sopenharmony_ci soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%X", 2518c2ecf20Sopenharmony_ci AT91_CIDR_VERSION(cidr)); 2528c2ecf20Sopenharmony_ci soc_dev = soc_device_register(soc_dev_attr); 2538c2ecf20Sopenharmony_ci if (IS_ERR(soc_dev)) { 2548c2ecf20Sopenharmony_ci kfree(soc_dev_attr->revision); 2558c2ecf20Sopenharmony_ci kfree(soc_dev_attr); 2568c2ecf20Sopenharmony_ci pr_warn("Could not register SoC device\n"); 2578c2ecf20Sopenharmony_ci return NULL; 2588c2ecf20Sopenharmony_ci } 2598c2ecf20Sopenharmony_ci 2608c2ecf20Sopenharmony_ci if (soc->family) 2618c2ecf20Sopenharmony_ci pr_info("Detected SoC family: %s\n", soc->family); 2628c2ecf20Sopenharmony_ci pr_info("Detected SoC: %s, revision %X\n", soc->name, 2638c2ecf20Sopenharmony_ci AT91_CIDR_VERSION(cidr)); 2648c2ecf20Sopenharmony_ci 2658c2ecf20Sopenharmony_ci return soc_dev; 2668c2ecf20Sopenharmony_ci} 2678c2ecf20Sopenharmony_ci 2688c2ecf20Sopenharmony_cistatic const struct of_device_id at91_soc_allowed_list[] __initconst = { 2698c2ecf20Sopenharmony_ci { .compatible = "atmel,at91rm9200", }, 2708c2ecf20Sopenharmony_ci { .compatible = "atmel,at91sam9", }, 2718c2ecf20Sopenharmony_ci { .compatible = "atmel,sama5", }, 2728c2ecf20Sopenharmony_ci { .compatible = "atmel,samv7", }, 2738c2ecf20Sopenharmony_ci { } 2748c2ecf20Sopenharmony_ci}; 2758c2ecf20Sopenharmony_ci 2768c2ecf20Sopenharmony_cistatic int __init atmel_soc_device_init(void) 2778c2ecf20Sopenharmony_ci{ 2788c2ecf20Sopenharmony_ci struct device_node *np = of_find_node_by_path("/"); 2798c2ecf20Sopenharmony_ci 2808c2ecf20Sopenharmony_ci if (!of_match_node(at91_soc_allowed_list, np)) 2818c2ecf20Sopenharmony_ci return 0; 2828c2ecf20Sopenharmony_ci 2838c2ecf20Sopenharmony_ci at91_soc_init(socs); 2848c2ecf20Sopenharmony_ci 2858c2ecf20Sopenharmony_ci return 0; 2868c2ecf20Sopenharmony_ci} 2878c2ecf20Sopenharmony_cisubsys_initcall(atmel_soc_device_init); 288