1a9caca6aSWojciech A. Koszek /*- 240713190SWojciech A. Koszek * Copyright (c) 2013 Thomas Skibo 3a9caca6aSWojciech A. Koszek * All rights reserved. 4a9caca6aSWojciech A. Koszek * 5a9caca6aSWojciech A. Koszek * Redistribution and use in source and binary forms, with or without 640713190SWojciech A. Koszek * modification, are permitted provided that the following conditions 740713190SWojciech A. Koszek * are met: 840713190SWojciech A. Koszek * 1. Redistributions of source code must retain the above copyright 9a9caca6aSWojciech A. Koszek * notice, this list of conditions and the following disclaimer. 1040713190SWojciech A. Koszek * 2. Redistributions in binary form must reproduce the above copyright 11a9caca6aSWojciech A. Koszek * notice, this list of conditions and the following disclaimer in the 12a9caca6aSWojciech A. Koszek * documentation and/or other materials provided with the distribution. 13a9caca6aSWojciech A. Koszek * 1440713190SWojciech A. Koszek * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1540713190SWojciech A. Koszek * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16a9caca6aSWojciech A. Koszek * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1740713190SWojciech A. Koszek * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1840713190SWojciech A. Koszek * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1940713190SWojciech A. Koszek * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2040713190SWojciech A. Koszek * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2140713190SWojciech A. Koszek * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22a9caca6aSWojciech A. Koszek * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2340713190SWojciech A. Koszek * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2440713190SWojciech A. Koszek * SUCH DAMAGE. 25a9caca6aSWojciech A. Koszek * 2640713190SWojciech A. Koszek * $FreeBSD$ 27a9caca6aSWojciech A. Koszek */ 28a9caca6aSWojciech A. Koszek 2940713190SWojciech A. Koszek /* 3040713190SWojciech A. Koszek * Machine dependent code for Xilinx Zynq-7000 Soc. 31a9caca6aSWojciech A. Koszek * 32a9caca6aSWojciech A. Koszek * Reference: Zynq-7000 All Programmable SoC Technical Reference Manual. 33a9caca6aSWojciech A. Koszek * (v1.4) November 16, 2012. Xilinx doc UG585. 34a9caca6aSWojciech A. Koszek */ 35a9caca6aSWojciech A. Koszek 36dc59c854SAndrew Turner #include "opt_platform.h" 37dc59c854SAndrew Turner 38a9caca6aSWojciech A. Koszek #include <sys/cdefs.h> 39a9caca6aSWojciech A. Koszek __FBSDID("$FreeBSD$"); 40a9caca6aSWojciech A. Koszek 41a9caca6aSWojciech A. Koszek #include <sys/param.h> 42a9caca6aSWojciech A. Koszek #include <sys/systm.h> 43a9caca6aSWojciech A. Koszek #include <sys/bus.h> 4430b72b68SRuslan Bukin #include <sys/devmap.h> 45a9caca6aSWojciech A. Koszek 46a9caca6aSWojciech A. Koszek #include <vm/vm.h> 47a9caca6aSWojciech A. Koszek #include <vm/pmap.h> 48a9caca6aSWojciech A. Koszek 49a9caca6aSWojciech A. Koszek #include <machine/bus.h> 50a9caca6aSWojciech A. Koszek #include <machine/machdep.h> 5127521ff8SAndrew Turner #include <machine/platform.h> 52dc59c854SAndrew Turner #include <machine/platformvar.h> 53a9caca6aSWojciech A. Koszek 54*3185adf0SAndrew Turner #include <arm/xilinx/zy7_machdep.h> 55a9caca6aSWojciech A. Koszek #include <arm/xilinx/zy7_reg.h> 56a9caca6aSWojciech A. Koszek 57dc59c854SAndrew Turner #include "platform_if.h" 58dc59c854SAndrew Turner 59a9caca6aSWojciech A. Koszek void (*zynq7_cpu_reset)(void); 60a9caca6aSWojciech A. Koszek 61a9caca6aSWojciech A. Koszek /* 624c053598SIan Lepore * Set up static device mappings. Not strictly necessary -- simplebus will 634c053598SIan Lepore * dynamically establish mappings as needed -- but doing it this way gets us 644c053598SIan Lepore * nice efficient 1MB section mappings. 65a9caca6aSWojciech A. Koszek */ 66dc59c854SAndrew Turner static int 67dc59c854SAndrew Turner zynq7_devmap_init(platform_t plat) 68a9caca6aSWojciech A. Koszek { 69a9caca6aSWojciech A. Koszek 7030b72b68SRuslan Bukin devmap_add_entry(ZYNQ7_PSIO_HWBASE, ZYNQ7_PSIO_SIZE); 7130b72b68SRuslan Bukin devmap_add_entry(ZYNQ7_PSCTL_HWBASE, ZYNQ7_PSCTL_SIZE); 72a9caca6aSWojciech A. Koszek 73a9caca6aSWojciech A. Koszek return (0); 74a9caca6aSWojciech A. Koszek } 75a9caca6aSWojciech A. Koszek 76dc59c854SAndrew Turner static void 77dc59c854SAndrew Turner zynq7_do_cpu_reset(platform_t plat) 78a9caca6aSWojciech A. Koszek { 79a9caca6aSWojciech A. Koszek if (zynq7_cpu_reset != NULL) 80a9caca6aSWojciech A. Koszek (*zynq7_cpu_reset)(); 81a9caca6aSWojciech A. Koszek 82a9caca6aSWojciech A. Koszek printf("cpu_reset: no platform cpu_reset. hanging.\n"); 83a9caca6aSWojciech A. Koszek for (;;) 84a9caca6aSWojciech A. Koszek ; 85a9caca6aSWojciech A. Koszek } 86dc59c854SAndrew Turner 87dc59c854SAndrew Turner static platform_method_t zynq7_methods[] = { 88dc59c854SAndrew Turner PLATFORMMETHOD(platform_devmap_init, zynq7_devmap_init), 89dc59c854SAndrew Turner PLATFORMMETHOD(platform_cpu_reset, zynq7_do_cpu_reset), 90dc59c854SAndrew Turner 91dc59c854SAndrew Turner #ifdef SMP 92dc59c854SAndrew Turner PLATFORMMETHOD(platform_mp_setmaxid, zynq7_mp_setmaxid), 93dc59c854SAndrew Turner PLATFORMMETHOD(platform_mp_start_ap, zynq7_mp_start_ap), 94dc59c854SAndrew Turner #endif 95dc59c854SAndrew Turner 96dc59c854SAndrew Turner PLATFORMMETHOD_END, 97dc59c854SAndrew Turner }; 98dc59c854SAndrew Turner 9957521c21SAndrew Turner FDT_PLATFORM_DEF(zynq7, "zynq7", 0, "xlnx,zynq-7000", 200); 100