18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Copyright 2003-2013 Broadcom Corporation. 38c2ecf20Sopenharmony_ci * All Rights Reserved. 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * This software is available to you under a choice of one of two 68c2ecf20Sopenharmony_ci * licenses. You may choose to be licensed under the terms of the GNU 78c2ecf20Sopenharmony_ci * General Public License (GPL) Version 2, available from the file 88c2ecf20Sopenharmony_ci * COPYING in the main directory of this source tree, or the Broadcom 98c2ecf20Sopenharmony_ci * license below: 108c2ecf20Sopenharmony_ci * 118c2ecf20Sopenharmony_ci * Redistribution and use in source and binary forms, with or without 128c2ecf20Sopenharmony_ci * modification, are permitted provided that the following conditions 138c2ecf20Sopenharmony_ci * are met: 148c2ecf20Sopenharmony_ci * 158c2ecf20Sopenharmony_ci * 1. Redistributions of source code must retain the above copyright 168c2ecf20Sopenharmony_ci * notice, this list of conditions and the following disclaimer. 178c2ecf20Sopenharmony_ci * 2. Redistributions in binary form must reproduce the above copyright 188c2ecf20Sopenharmony_ci * notice, this list of conditions and the following disclaimer in 198c2ecf20Sopenharmony_ci * the documentation and/or other materials provided with the 208c2ecf20Sopenharmony_ci * distribution. 218c2ecf20Sopenharmony_ci * 228c2ecf20Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY BROADCOM ``AS IS'' AND ANY EXPRESS OR 238c2ecf20Sopenharmony_ci * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 248c2ecf20Sopenharmony_ci * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 258c2ecf20Sopenharmony_ci * ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM OR CONTRIBUTORS BE LIABLE 268c2ecf20Sopenharmony_ci * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 278c2ecf20Sopenharmony_ci * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 288c2ecf20Sopenharmony_ci * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 298c2ecf20Sopenharmony_ci * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 308c2ecf20Sopenharmony_ci * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 318c2ecf20Sopenharmony_ci * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 328c2ecf20Sopenharmony_ci * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 338c2ecf20Sopenharmony_ci */ 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci#include <linux/kernel.h> 368c2ecf20Sopenharmony_ci#include <linux/memblock.h> 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci#include <linux/of_fdt.h> 398c2ecf20Sopenharmony_ci#include <linux/of_platform.h> 408c2ecf20Sopenharmony_ci#include <linux/of_device.h> 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci#include <asm/prom.h> 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ciextern u32 __dtb_xlp_evp_begin[], __dtb_xlp_svp_begin[], __dtb_xlp_fvp_begin[], 458c2ecf20Sopenharmony_ci __dtb_xlp_gvp_begin[], __dtb_xlp_rvp_begin[]; 468c2ecf20Sopenharmony_cistatic void *xlp_fdt_blob; 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_civoid __init *xlp_dt_init(void *fdtp) 498c2ecf20Sopenharmony_ci{ 508c2ecf20Sopenharmony_ci if (!fdtp) { 518c2ecf20Sopenharmony_ci switch (current_cpu_data.processor_id & PRID_IMP_MASK) { 528c2ecf20Sopenharmony_ci#ifdef CONFIG_DT_XLP_RVP 538c2ecf20Sopenharmony_ci case PRID_IMP_NETLOGIC_XLP5XX: 548c2ecf20Sopenharmony_ci fdtp = __dtb_xlp_rvp_begin; 558c2ecf20Sopenharmony_ci break; 568c2ecf20Sopenharmony_ci#endif 578c2ecf20Sopenharmony_ci#ifdef CONFIG_DT_XLP_GVP 588c2ecf20Sopenharmony_ci case PRID_IMP_NETLOGIC_XLP9XX: 598c2ecf20Sopenharmony_ci fdtp = __dtb_xlp_gvp_begin; 608c2ecf20Sopenharmony_ci break; 618c2ecf20Sopenharmony_ci#endif 628c2ecf20Sopenharmony_ci#ifdef CONFIG_DT_XLP_FVP 638c2ecf20Sopenharmony_ci case PRID_IMP_NETLOGIC_XLP2XX: 648c2ecf20Sopenharmony_ci fdtp = __dtb_xlp_fvp_begin; 658c2ecf20Sopenharmony_ci break; 668c2ecf20Sopenharmony_ci#endif 678c2ecf20Sopenharmony_ci#ifdef CONFIG_DT_XLP_SVP 688c2ecf20Sopenharmony_ci case PRID_IMP_NETLOGIC_XLP3XX: 698c2ecf20Sopenharmony_ci fdtp = __dtb_xlp_svp_begin; 708c2ecf20Sopenharmony_ci break; 718c2ecf20Sopenharmony_ci#endif 728c2ecf20Sopenharmony_ci#ifdef CONFIG_DT_XLP_EVP 738c2ecf20Sopenharmony_ci case PRID_IMP_NETLOGIC_XLP8XX: 748c2ecf20Sopenharmony_ci fdtp = __dtb_xlp_evp_begin; 758c2ecf20Sopenharmony_ci break; 768c2ecf20Sopenharmony_ci#endif 778c2ecf20Sopenharmony_ci default: 788c2ecf20Sopenharmony_ci /* Pick a built-in if any, and hope for the best */ 798c2ecf20Sopenharmony_ci fdtp = __dtb_start; 808c2ecf20Sopenharmony_ci break; 818c2ecf20Sopenharmony_ci } 828c2ecf20Sopenharmony_ci } 838c2ecf20Sopenharmony_ci xlp_fdt_blob = fdtp; 848c2ecf20Sopenharmony_ci return fdtp; 858c2ecf20Sopenharmony_ci} 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_civoid __init xlp_early_init_devtree(void) 888c2ecf20Sopenharmony_ci{ 898c2ecf20Sopenharmony_ci __dt_setup_arch(xlp_fdt_blob); 908c2ecf20Sopenharmony_ci} 918c2ecf20Sopenharmony_ci 928c2ecf20Sopenharmony_civoid __init device_tree_init(void) 938c2ecf20Sopenharmony_ci{ 948c2ecf20Sopenharmony_ci unflatten_and_copy_device_tree(); 958c2ecf20Sopenharmony_ci} 96