Home | History | Annotate | Line # | Download | only in samsung
exynos_platform.c revision 1.8.2.7
      1  1.8.2.7  pgoyette /* $NetBSD: exynos_platform.c,v 1.8.2.7 2019/01/18 08:50:15 pgoyette Exp $ */
      2      1.1  jmcneill 
      3      1.1  jmcneill /*-
      4      1.1  jmcneill  * Copyright (c) 2017 Jared D. McNeill <jmcneill (at) invisible.ca>
      5      1.1  jmcneill  * All rights reserved.
      6      1.1  jmcneill  *
      7      1.1  jmcneill  * Redistribution and use in source and binary forms, with or without
      8      1.1  jmcneill  * modification, are permitted provided that the following conditions
      9      1.1  jmcneill  * are met:
     10      1.1  jmcneill  * 1. Redistributions of source code must retain the above copyright
     11      1.1  jmcneill  *    notice, this list of conditions and the following disclaimer.
     12      1.1  jmcneill  * 2. Redistributions in binary form must reproduce the above copyright
     13      1.1  jmcneill  *    notice, this list of conditions and the following disclaimer in the
     14      1.1  jmcneill  *    documentation and/or other materials provided with the distribution.
     15      1.1  jmcneill  *
     16      1.1  jmcneill  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     17      1.1  jmcneill  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     18      1.1  jmcneill  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     19      1.1  jmcneill  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     20      1.1  jmcneill  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
     21      1.1  jmcneill  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     22      1.1  jmcneill  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
     23      1.1  jmcneill  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
     24      1.1  jmcneill  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     25      1.1  jmcneill  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     26      1.1  jmcneill  * SUCH DAMAGE.
     27      1.1  jmcneill  */
     28      1.1  jmcneill 
     29  1.8.2.3  pgoyette #include "opt_arm_debug.h"
     30  1.8.2.4  pgoyette #include "opt_console.h"
     31      1.1  jmcneill #include "opt_exynos.h"
     32      1.1  jmcneill #include "opt_multiprocessor.h"
     33  1.8.2.4  pgoyette #include "opt_console.h"
     34      1.1  jmcneill 
     35      1.1  jmcneill #include "ukbd.h"
     36      1.1  jmcneill 
     37      1.1  jmcneill #include <sys/cdefs.h>
     38  1.8.2.7  pgoyette __KERNEL_RCSID(0, "$NetBSD: exynos_platform.c,v 1.8.2.7 2019/01/18 08:50:15 pgoyette Exp $");
     39  1.8.2.7  pgoyette 
     40  1.8.2.7  pgoyette /* XXXJDM
     41  1.8.2.7  pgoyette  * Booting a CA7 core on Exynos5422 is currently broken, disable starting CA7 secondaries.
     42  1.8.2.7  pgoyette  */
     43  1.8.2.7  pgoyette #define	EXYNOS5422_DISABLE_CA7_CLUSTER
     44      1.1  jmcneill 
     45      1.1  jmcneill #include <sys/param.h>
     46      1.1  jmcneill #include <sys/bus.h>
     47      1.1  jmcneill #include <sys/cpu.h>
     48      1.1  jmcneill #include <sys/device.h>
     49      1.1  jmcneill #include <sys/termios.h>
     50      1.1  jmcneill 
     51      1.1  jmcneill #include <dev/fdt/fdtvar.h>
     52      1.1  jmcneill 
     53      1.1  jmcneill #include <uvm/uvm_extern.h>
     54      1.1  jmcneill 
     55      1.1  jmcneill #include <machine/bootconfig.h>
     56      1.1  jmcneill #include <arm/cpufunc.h>
     57      1.1  jmcneill 
     58      1.1  jmcneill #include <arm/samsung/exynos_reg.h>
     59      1.1  jmcneill #include <arm/samsung/exynos_var.h>
     60  1.8.2.2  pgoyette #include <arm/samsung/mct_var.h>
     61  1.8.2.3  pgoyette #include <arm/samsung/sscom_reg.h>
     62      1.1  jmcneill 
     63      1.2  jmcneill #include <evbarm/exynos/platform.h>
     64  1.8.2.5  pgoyette #include <evbarm/fdt/machdep.h>
     65      1.2  jmcneill 
     66      1.1  jmcneill #include <arm/fdt/arm_fdtvar.h>
     67      1.1  jmcneill 
     68  1.8.2.7  pgoyette #include <libfdt.h>
     69      1.1  jmcneill 
     70  1.8.2.7  pgoyette void exynos_platform_early_putchar(char);
     71      1.2  jmcneill 
     72  1.8.2.4  pgoyette #define	EXYNOS5800_PMU_BASE		0x10040000
     73  1.8.2.4  pgoyette #define	EXYNOS5800_PMU_SIZE		0x20000
     74  1.8.2.7  pgoyette #define	 EXYNOS5800_PMU_SWRESET			0x0400
     75  1.8.2.7  pgoyette #define	  EXYNOS5800_PMU_KFC_ETM_RESET(n)	__BIT(20 + (n))
     76  1.8.2.7  pgoyette #define	  EXYNOS5800_PMU_KFC_CORE_RESET(n)	__BIT(8 + (n))
     77  1.8.2.7  pgoyette #define	 EXYNOS5800_PMU_SPARE2			0x0908
     78  1.8.2.7  pgoyette #define	 EXYNOS5800_PMU_SPARE3			0x090c
     79  1.8.2.7  pgoyette #define	  EXYNOS5800_PMU_SWRESET_KFC_SEL	0x3
     80  1.8.2.7  pgoyette #define	 EXYNOS5800_PMU_CORE_CONFIG(n)		(0x2000 + 0x80 * (n))
     81  1.8.2.7  pgoyette #define	 EXYNOS5800_PMU_CORE_STATUS(n)		(0x2004 + 0x80 * (n))
     82  1.8.2.7  pgoyette #define	  EXYNOS5800_PMU_CORE_POWER_EN		0x3
     83  1.8.2.7  pgoyette #define	 EXYNOS5800_PMU_COMMON_CONFIG(n)	(0x2500 + 0x80 * (n))
     84  1.8.2.7  pgoyette #define	  EXYNOS5800_PMU_COMMON_POWER_EN	0x3
     85  1.8.2.7  pgoyette #define	 EXYNOS5800_PMU_COMMON_OPTION(n)	(0x2508 + 0x80 * (n))
     86  1.8.2.7  pgoyette #define	  EXYNOS5800_PMU_USE_L2_COMMON_UP_STATE		__BIT(30)
     87  1.8.2.7  pgoyette #define	  EXYNOS5800_PMU_USE_ARM_CORE_DOWN_STATE	__BIT(29)
     88  1.8.2.7  pgoyette #define	  EXYNOS5800_PMU_AUTO_CORE_DOWN			__BIT(9)
     89  1.8.2.7  pgoyette 
     90  1.8.2.7  pgoyette #define	EXYNOS5800_SYSRAM_BASE		0x02073000
     91  1.8.2.7  pgoyette #define	EXYNOS5800_SYSRAM_SIZE		0x1000
     92  1.8.2.7  pgoyette #define	 EXYNOS5800_SYSRAM_HOTPLUG		0x001c
     93  1.8.2.5  pgoyette 
     94  1.8.2.5  pgoyette static void
     95  1.8.2.5  pgoyette exynos5800_mpstart(void)
     96  1.8.2.5  pgoyette {
     97  1.8.2.5  pgoyette #if defined(MULTIPROCESSOR)
     98  1.8.2.4  pgoyette 	bus_space_tag_t bst = &armv7_generic_bs_tag;
     99  1.8.2.4  pgoyette 	bus_space_handle_t pmu_bsh, sysram_bsh;
    100  1.8.2.7  pgoyette 	uint64_t mpidr, bp_mpidr;
    101  1.8.2.4  pgoyette 	uint32_t val, started = 0;
    102  1.8.2.7  pgoyette 	u_int cpuindex, n;
    103  1.8.2.7  pgoyette 	int child;
    104  1.8.2.4  pgoyette 
    105  1.8.2.4  pgoyette 	bus_space_map(bst, EXYNOS5800_PMU_BASE, EXYNOS5800_PMU_SIZE, 0, &pmu_bsh);
    106  1.8.2.4  pgoyette 	bus_space_map(bst, EXYNOS5800_SYSRAM_BASE, EXYNOS5800_SYSRAM_SIZE, 0, &sysram_bsh);
    107  1.8.2.4  pgoyette 
    108  1.8.2.7  pgoyette 	const int cpus = OF_finddevice("/cpus");
    109  1.8.2.7  pgoyette 	if (cpus == -1) {
    110  1.8.2.7  pgoyette 		aprint_error("%s: no /cpus node found\n", __func__);
    111  1.8.2.7  pgoyette 		return;
    112  1.8.2.7  pgoyette 	}
    113  1.8.2.7  pgoyette 
    114  1.8.2.7  pgoyette 	/* MPIDR affinity levels of boot processor. */
    115  1.8.2.7  pgoyette 	bp_mpidr = cpu_mpidr_aff_read();
    116  1.8.2.7  pgoyette 
    117  1.8.2.7  pgoyette 	/* Setup KFC reset */
    118  1.8.2.7  pgoyette 	bus_space_write_4(bst, pmu_bsh, EXYNOS5800_PMU_SPARE3, EXYNOS5800_PMU_SWRESET_KFC_SEL);
    119  1.8.2.7  pgoyette 
    120  1.8.2.7  pgoyette 	const uint32_t option = EXYNOS5800_PMU_USE_L2_COMMON_UP_STATE |
    121  1.8.2.7  pgoyette 	    EXYNOS5800_PMU_USE_ARM_CORE_DOWN_STATE |
    122  1.8.2.7  pgoyette 	    EXYNOS5800_PMU_AUTO_CORE_DOWN;
    123  1.8.2.7  pgoyette 	val = bus_space_read_4(bst, pmu_bsh, EXYNOS5800_PMU_COMMON_OPTION(0));
    124  1.8.2.7  pgoyette 	bus_space_write_4(bst, pmu_bsh, EXYNOS5800_PMU_COMMON_OPTION(0), val | option);
    125  1.8.2.7  pgoyette 	val = bus_space_read_4(bst, pmu_bsh, EXYNOS5800_PMU_COMMON_OPTION(1));
    126  1.8.2.7  pgoyette 	bus_space_write_4(bst, pmu_bsh, EXYNOS5800_PMU_COMMON_OPTION(1), val | option);
    127  1.8.2.7  pgoyette 
    128  1.8.2.7  pgoyette 	bus_space_write_4(bst, sysram_bsh, EXYNOS5800_SYSRAM_HOTPLUG, KERN_VTOPHYS((vaddr_t)cpu_mpstart));
    129  1.8.2.7  pgoyette 	arm_dsb();
    130  1.8.2.7  pgoyette 
    131  1.8.2.7  pgoyette 	/* Power on clusters */
    132  1.8.2.7  pgoyette 	bus_space_write_4(bst, pmu_bsh, EXYNOS5800_PMU_COMMON_CONFIG(0),
    133  1.8.2.7  pgoyette 	    EXYNOS5800_PMU_COMMON_POWER_EN);
    134  1.8.2.7  pgoyette 	bus_space_write_4(bst, pmu_bsh, EXYNOS5800_PMU_COMMON_CONFIG(1),
    135  1.8.2.7  pgoyette 	    EXYNOS5800_PMU_COMMON_POWER_EN);
    136  1.8.2.7  pgoyette 
    137  1.8.2.7  pgoyette 	/* Boot APs */
    138  1.8.2.7  pgoyette 	cpuindex = 1;
    139  1.8.2.7  pgoyette 	for (child = OF_child(cpus); child; child = OF_peer(child)) {
    140  1.8.2.7  pgoyette 		if (fdtbus_get_reg64(child, 0, &mpidr, NULL) != 0)
    141  1.8.2.7  pgoyette 			continue;
    142  1.8.2.7  pgoyette 
    143  1.8.2.7  pgoyette 		if (mpidr == bp_mpidr)
    144  1.8.2.7  pgoyette 			continue;	/* BP already started */
    145  1.8.2.7  pgoyette 
    146  1.8.2.7  pgoyette 		const u_int cluster = __SHIFTOUT(mpidr, MPIDR_AFF1);
    147  1.8.2.7  pgoyette 		const u_int aff0 = __SHIFTOUT(mpidr, MPIDR_AFF0);
    148  1.8.2.7  pgoyette 		const u_int cpu = cluster * 4 + aff0;
    149  1.8.2.7  pgoyette 
    150  1.8.2.7  pgoyette #if defined(EXYNOS5422_DISABLE_CA7_CLUSTER)
    151  1.8.2.7  pgoyette 		if (cluster == 1)
    152  1.8.2.7  pgoyette 			continue;
    153  1.8.2.7  pgoyette #endif
    154  1.8.2.4  pgoyette 
    155  1.8.2.7  pgoyette 		val = bus_space_read_4(bst, pmu_bsh, EXYNOS5800_PMU_CORE_STATUS(cpu));
    156  1.8.2.7  pgoyette 		bus_space_write_4(bst, pmu_bsh, EXYNOS5800_PMU_CORE_CONFIG(cpu),
    157  1.8.2.4  pgoyette 		    EXYNOS5800_PMU_CORE_POWER_EN);
    158  1.8.2.7  pgoyette 
    159  1.8.2.7  pgoyette 		for (n = 0x100000; n > 0; n--) {
    160  1.8.2.7  pgoyette 			val = bus_space_read_4(bst, pmu_bsh, EXYNOS5800_PMU_CORE_STATUS(cpu));
    161  1.8.2.4  pgoyette 			if ((val & EXYNOS5800_PMU_CORE_POWER_EN) == EXYNOS5800_PMU_CORE_POWER_EN) {
    162  1.8.2.7  pgoyette 				started |= __BIT(cpuindex);
    163  1.8.2.4  pgoyette 				break;
    164  1.8.2.4  pgoyette 			}
    165  1.8.2.4  pgoyette 		}
    166  1.8.2.7  pgoyette 		if (n == 0)
    167  1.8.2.7  pgoyette 			aprint_error("cpu%d: WARNING: AP failed to power on\n", cpuindex);
    168  1.8.2.7  pgoyette 
    169  1.8.2.7  pgoyette 		if (cluster == 1 && __SHIFTOUT(bp_mpidr, MPIDR_AFF1) == 1) {
    170  1.8.2.7  pgoyette 			while (bus_space_read_4(bst, pmu_bsh, EXYNOS5800_PMU_SPARE2) == 0)
    171  1.8.2.7  pgoyette 				;
    172  1.8.2.7  pgoyette 			bus_space_write_4(bst, pmu_bsh, EXYNOS5800_PMU_SWRESET,
    173  1.8.2.7  pgoyette 			    EXYNOS5800_PMU_KFC_CORE_RESET(aff0) |
    174  1.8.2.7  pgoyette 			    EXYNOS5800_PMU_KFC_ETM_RESET(aff0));
    175  1.8.2.7  pgoyette 		}
    176  1.8.2.4  pgoyette 
    177  1.8.2.7  pgoyette 		/* Wait for AP to start */
    178  1.8.2.7  pgoyette 		for (n = 0x100000; n > 0; n--) {
    179  1.8.2.7  pgoyette 			membar_consumer();
    180  1.8.2.7  pgoyette 			if (arm_cpu_hatched & __BIT(cpuindex))
    181  1.8.2.7  pgoyette 				break;
    182  1.8.2.7  pgoyette 		}
    183  1.8.2.7  pgoyette 		if (n == 0)
    184  1.8.2.7  pgoyette 			aprint_error("cpu%d: WARNING: AP failed to start\n", cpuindex);
    185  1.8.2.7  pgoyette 
    186  1.8.2.7  pgoyette 		cpuindex++;
    187  1.8.2.4  pgoyette 	}
    188  1.8.2.4  pgoyette 
    189  1.8.2.4  pgoyette 	bus_space_unmap(bst, sysram_bsh, EXYNOS5800_SYSRAM_SIZE);
    190  1.8.2.4  pgoyette 	bus_space_unmap(bst, pmu_bsh, EXYNOS5800_PMU_SIZE);
    191  1.8.2.4  pgoyette #endif
    192  1.8.2.4  pgoyette }
    193  1.8.2.4  pgoyette 
    194  1.8.2.4  pgoyette static struct of_compat_data mp_compat_data[] = {
    195  1.8.2.5  pgoyette 	{ "samsung,exynos5800",		(uintptr_t)exynos5800_mpstart },
    196  1.8.2.4  pgoyette 	{ NULL }
    197  1.8.2.4  pgoyette };
    198  1.8.2.4  pgoyette 
    199      1.1  jmcneill static void
    200  1.8.2.5  pgoyette exynos_platform_mpstart(void)
    201      1.1  jmcneill {
    202  1.8.2.3  pgoyette 
    203  1.8.2.5  pgoyette 	void (*mp_start)(void) = NULL;
    204  1.8.2.5  pgoyette 
    205  1.8.2.4  pgoyette 	const struct of_compat_data *cd = of_search_compatible(OF_finddevice("/"), mp_compat_data);
    206  1.8.2.4  pgoyette 	if (cd)
    207  1.8.2.5  pgoyette 		mp_start = (void (*)(void))cd->data;
    208  1.8.2.4  pgoyette 
    209  1.8.2.5  pgoyette 	if (mp_start)
    210  1.8.2.5  pgoyette 		mp_start();
    211      1.1  jmcneill }
    212      1.1  jmcneill 
    213      1.1  jmcneill static void
    214      1.1  jmcneill exynos_platform_init_attach_args(struct fdt_attach_args *faa)
    215      1.1  jmcneill {
    216      1.1  jmcneill 	extern struct bus_space armv7_generic_bs_tag;
    217      1.1  jmcneill 	extern struct bus_space armv7_generic_a4x_bs_tag;
    218  1.8.2.1  pgoyette 	extern struct arm32_bus_dma_tag arm_generic_dma_tag;
    219      1.1  jmcneill 
    220      1.1  jmcneill 	faa->faa_bst = &armv7_generic_bs_tag;
    221      1.1  jmcneill 	faa->faa_a4x_bst = &armv7_generic_a4x_bs_tag;
    222  1.8.2.1  pgoyette 	faa->faa_dmat = &arm_generic_dma_tag;
    223      1.1  jmcneill }
    224      1.1  jmcneill 
    225  1.8.2.3  pgoyette void
    226      1.1  jmcneill exynos_platform_early_putchar(char c)
    227      1.1  jmcneill {
    228  1.8.2.3  pgoyette #ifdef CONSADDR
    229  1.8.2.3  pgoyette #define CONSADDR_VA	(CONSADDR - EXYNOS_CORE_PBASE + EXYNOS_CORE_VBASE)
    230  1.8.2.3  pgoyette 
    231  1.8.2.3  pgoyette 	volatile uint32_t *uartaddr = cpu_earlydevice_va_p() ?
    232  1.8.2.3  pgoyette 	    (volatile uint32_t *)CONSADDR_VA :
    233  1.8.2.3  pgoyette 	    (volatile uint32_t *)CONSADDR;
    234  1.8.2.3  pgoyette 
    235  1.8.2.3  pgoyette 	while ((uartaddr[SSCOM_UFSTAT / 4] & UFSTAT_TXFULL) != 0)
    236  1.8.2.3  pgoyette 		;
    237      1.2  jmcneill 
    238  1.8.2.3  pgoyette 	uartaddr[SSCOM_UTXH / 4] = c;
    239      1.4  jmcneill #endif
    240      1.1  jmcneill }
    241      1.1  jmcneill 
    242      1.1  jmcneill static void
    243      1.1  jmcneill exynos_platform_device_register(device_t self, void *aux)
    244      1.1  jmcneill {
    245      1.1  jmcneill 	exynos_device_register(self, aux);
    246      1.1  jmcneill }
    247      1.1  jmcneill 
    248      1.1  jmcneill static void
    249      1.6  jmcneill exynos5_platform_reset(void)
    250      1.1  jmcneill {
    251      1.6  jmcneill 	bus_space_tag_t bst = &armv7_generic_bs_tag;
    252      1.6  jmcneill 	bus_space_handle_t bsh;
    253      1.6  jmcneill 
    254  1.8.2.7  pgoyette 	bus_space_map(bst, EXYNOS5800_PMU_BASE + EXYNOS5800_PMU_SWRESET, 4, 0, &bsh);
    255      1.6  jmcneill 	bus_space_write_4(bst, bsh, 0, 1);
    256      1.1  jmcneill }
    257      1.1  jmcneill 
    258      1.1  jmcneill static u_int
    259      1.1  jmcneill exynos_platform_uart_freq(void)
    260      1.1  jmcneill {
    261      1.1  jmcneill 	return EXYNOS_UART_FREQ;
    262      1.1  jmcneill }
    263      1.1  jmcneill 
    264  1.8.2.3  pgoyette 
    265  1.8.2.3  pgoyette #if defined(SOC_EXYNOS4)
    266  1.8.2.3  pgoyette static const struct pmap_devmap *
    267  1.8.2.3  pgoyette exynos4_platform_devmap(void)
    268  1.8.2.3  pgoyette {
    269  1.8.2.3  pgoyette 	static const struct pmap_devmap devmap[] = {
    270  1.8.2.3  pgoyette 		DEVMAP_ENTRY(EXYNOS_CORE_VBASE,
    271  1.8.2.3  pgoyette 			     EXYNOS_CORE_PBASE,
    272  1.8.2.3  pgoyette 			     EXYNOS4_CORE_SIZE),
    273  1.8.2.3  pgoyette 		DEVMAP_ENTRY(EXYNOS4_AUDIOCORE_VBASE,
    274  1.8.2.3  pgoyette 			     EXYNOS4_AUDIOCORE_PBASE,
    275  1.8.2.3  pgoyette 			     EXYNOS4_AUDIOCORE_SIZE),
    276  1.8.2.3  pgoyette 		DEVMAP_ENTRY_END
    277  1.8.2.3  pgoyette 	};
    278  1.8.2.3  pgoyette 
    279  1.8.2.3  pgoyette 	return devmap;
    280  1.8.2.3  pgoyette }
    281  1.8.2.3  pgoyette 
    282  1.8.2.5  pgoyette static void
    283  1.8.2.5  pgoyette exynos4_platform_bootstrap(void)
    284  1.8.2.5  pgoyette {
    285  1.8.2.5  pgoyette 
    286  1.8.2.5  pgoyette 	exynos_bootstrap(4);
    287  1.8.2.5  pgoyette 
    288  1.8.2.7  pgoyette #if defined(MULTIPROCESSOR)
    289  1.8.2.7  pgoyette 	arm_cpu_max = 1 + __SHIFTOUT(armreg_l2ctrl_read(), L2CTRL_NUMCPU);
    290  1.8.2.7  pgoyette #endif
    291  1.8.2.5  pgoyette }
    292  1.8.2.5  pgoyette 
    293  1.8.2.3  pgoyette static const struct arm_platform exynos4_platform = {
    294  1.8.2.3  pgoyette 	.ap_devmap = exynos4_platform_devmap,
    295  1.8.2.5  pgoyette //	.ap_mpstart = exynos4_mpstart,
    296  1.8.2.5  pgoyette 	.ap_bootstrap = exynos4_platform_bootstrap,
    297  1.8.2.3  pgoyette 	.ap_init_attach_args = exynos_platform_init_attach_args,
    298  1.8.2.3  pgoyette 	.ap_device_register = exynos_platform_device_register,
    299  1.8.2.3  pgoyette 	.ap_reset = exynos5_platform_reset,
    300  1.8.2.3  pgoyette 	.ap_delay = mct_delay,
    301  1.8.2.3  pgoyette 	.ap_uart_freq = exynos_platform_uart_freq,
    302  1.8.2.3  pgoyette };
    303  1.8.2.3  pgoyette 
    304  1.8.2.3  pgoyette ARM_PLATFORM(exynos4, "samsung,exynos4", &exynos4_platform);
    305  1.8.2.3  pgoyette #endif
    306  1.8.2.3  pgoyette 
    307  1.8.2.3  pgoyette 
    308  1.8.2.3  pgoyette #if defined(SOC_EXYNOS5)
    309  1.8.2.3  pgoyette static const struct pmap_devmap *
    310  1.8.2.3  pgoyette exynos5_platform_devmap(void)
    311  1.8.2.3  pgoyette {
    312  1.8.2.3  pgoyette 	static const struct pmap_devmap devmap[] = {
    313  1.8.2.3  pgoyette 		DEVMAP_ENTRY(EXYNOS_CORE_VBASE,
    314  1.8.2.3  pgoyette 			     EXYNOS_CORE_PBASE,
    315  1.8.2.3  pgoyette 			     EXYNOS5_CORE_SIZE),
    316  1.8.2.3  pgoyette 		DEVMAP_ENTRY(EXYNOS5_AUDIOCORE_VBASE,
    317  1.8.2.3  pgoyette 			     EXYNOS5_AUDIOCORE_PBASE,
    318  1.8.2.3  pgoyette 			     EXYNOS5_AUDIOCORE_SIZE),
    319  1.8.2.4  pgoyette 		DEVMAP_ENTRY(EXYNOS5_SYSRAM_VBASE,
    320  1.8.2.4  pgoyette 			     EXYNOS5_SYSRAM_PBASE,
    321  1.8.2.4  pgoyette 			     EXYNOS5_SYSRAM_SIZE),
    322  1.8.2.3  pgoyette 		DEVMAP_ENTRY_END
    323  1.8.2.3  pgoyette 	};
    324  1.8.2.3  pgoyette 
    325  1.8.2.3  pgoyette 	return devmap;
    326  1.8.2.3  pgoyette }
    327  1.8.2.3  pgoyette 
    328  1.8.2.5  pgoyette static void
    329  1.8.2.5  pgoyette exynos5_platform_bootstrap(void)
    330  1.8.2.5  pgoyette {
    331  1.8.2.5  pgoyette 
    332  1.8.2.5  pgoyette 	exynos_bootstrap(5);
    333  1.8.2.5  pgoyette 
    334  1.8.2.7  pgoyette #if defined(MULTIPROCESSOR) && defined(EXYNOS5422_DISABLE_CA7_CLUSTER)
    335  1.8.2.7  pgoyette 	const struct of_compat_data *cd = of_search_compatible(OF_finddevice("/"), mp_compat_data);
    336  1.8.2.7  pgoyette 	if (cd && cd->data == (uintptr_t)exynos5800_mpstart) {
    337  1.8.2.7  pgoyette 		void *fdt_data = __UNCONST(fdtbus_get_data());
    338  1.8.2.7  pgoyette 		int cpu_off, cpus_off, len;
    339  1.8.2.7  pgoyette 
    340  1.8.2.7  pgoyette 		cpus_off = fdt_path_offset(fdt_data, "/cpus");
    341  1.8.2.7  pgoyette 		if (cpus_off < 0)
    342  1.8.2.7  pgoyette 			return;
    343  1.8.2.7  pgoyette 
    344  1.8.2.7  pgoyette 		fdt_for_each_subnode(cpu_off, fdt_data, cpus_off) {
    345  1.8.2.7  pgoyette 			const void *prop = fdt_getprop(fdt_data, cpu_off, "reg", &len);
    346  1.8.2.7  pgoyette 			if (len != 4)
    347  1.8.2.7  pgoyette 				continue;
    348  1.8.2.7  pgoyette 			const uint32_t mpidr = be32dec(prop);
    349  1.8.2.7  pgoyette 			if (mpidr != cpu_mpidr_aff_read() && __SHIFTOUT(mpidr, MPIDR_AFF1) == 1)
    350  1.8.2.7  pgoyette 				fdt_setprop_string(fdt_data, cpu_off, "status", "fail");
    351  1.8.2.7  pgoyette 		}
    352  1.8.2.7  pgoyette 	}
    353  1.8.2.7  pgoyette #endif
    354  1.8.2.7  pgoyette 
    355  1.8.2.7  pgoyette 	arm_fdt_cpu_bootstrap();
    356  1.8.2.5  pgoyette }
    357  1.8.2.5  pgoyette 
    358      1.1  jmcneill static const struct arm_platform exynos5_platform = {
    359  1.8.2.3  pgoyette 	.ap_devmap = exynos5_platform_devmap,
    360  1.8.2.5  pgoyette 	.ap_bootstrap = exynos5_platform_bootstrap,
    361  1.8.2.5  pgoyette 	.ap_mpstart = exynos_platform_mpstart,
    362  1.8.2.3  pgoyette 	.ap_init_attach_args = exynos_platform_init_attach_args,
    363  1.8.2.3  pgoyette 	.ap_device_register = exynos_platform_device_register,
    364  1.8.2.3  pgoyette 	.ap_reset = exynos5_platform_reset,
    365  1.8.2.3  pgoyette 	.ap_delay = mct_delay,
    366  1.8.2.3  pgoyette 	.ap_uart_freq = exynos_platform_uart_freq,
    367      1.1  jmcneill };
    368      1.1  jmcneill 
    369      1.1  jmcneill ARM_PLATFORM(exynos5, "samsung,exynos5", &exynos5_platform);
    370  1.8.2.3  pgoyette #endif
    371