a10_machdep.c revision 259364
1245450Sganbold/*- 2245453Sganbold * Copyright (c) 2012 Ganbold Tsagaankhuu <ganbold@gmail.com> 3245450Sganbold * All rights reserved. 4245450Sganbold * 5245450Sganbold * This code is derived from software written for Brini by Mark Brinicombe 6245450Sganbold * 7245450Sganbold * Redistribution and use in source and binary forms, with or without 8245450Sganbold * modification, are permitted provided that the following conditions 9245450Sganbold * are met: 10245450Sganbold * 1. Redistributions of source code must retain the above copyright 11245450Sganbold * notice, this list of conditions and the following disclaimer. 12245450Sganbold * 2. Redistributions in binary form must reproduce the above copyright 13245450Sganbold * notice, this list of conditions and the following disclaimer in the 14245450Sganbold * documentation and/or other materials provided with the distribution. 15245450Sganbold * 16245450Sganbold * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17245450Sganbold * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18245450Sganbold * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19245454Sganbold * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20245450Sganbold * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21245450Sganbold * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22245450Sganbold * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23245450Sganbold * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24245450Sganbold * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25245450Sganbold * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26245450Sganbold * SUCH DAMAGE. 27245450Sganbold * 28245450Sganbold * from: FreeBSD: //depot/projects/arm/src/sys/arm/ti/ti_machdep.c 29245450Sganbold */ 30245450Sganbold 31245450Sganbold#include "opt_ddb.h" 32245450Sganbold#include "opt_platform.h" 33245450Sganbold 34245450Sganbold#include <sys/cdefs.h> 35245450Sganbold__FBSDID("$FreeBSD: stable/10/sys/arm/allwinner/a10_machdep.c 259364 2013-12-13 23:56:53Z ian $"); 36245450Sganbold 37245450Sganbold#define _ARM32_BUS_DMA_PRIVATE 38245450Sganbold#include <sys/param.h> 39245450Sganbold#include <sys/systm.h> 40245450Sganbold#include <sys/bus.h> 41245450Sganbold 42245450Sganbold#include <vm/vm.h> 43245450Sganbold#include <vm/pmap.h> 44245450Sganbold 45245450Sganbold#include <machine/bus.h> 46259364Sian#include <machine/devmap.h> 47245450Sganbold#include <machine/machdep.h> 48245450Sganbold 49245450Sganbold#include <dev/fdt/fdt_common.h> 50245450Sganbold 51246661Sgonzo#include <arm/allwinner/a10_wdog.h> 52246661Sgonzo 53245450Sganbold/* Start of address space used for bootstrap map */ 54245450Sganbold#define DEVMAP_BOOTSTRAP_MAP_START 0xE0000000 55245450Sganbold 56245450Sganbold 57245450Sganboldvm_offset_t 58245450Sganboldinitarm_lastaddr(void) 59245450Sganbold{ 60245450Sganbold 61259335Sian return (DEVMAP_BOOTSTRAP_MAP_START); 62245450Sganbold} 63245450Sganbold 64245450Sganboldvoid 65245450Sganboldinitarm_gpio_init(void) 66245450Sganbold{ 67245450Sganbold} 68245450Sganbold 69245450Sganboldvoid 70245450Sganboldinitarm_late_init(void) 71245450Sganbold{ 72245450Sganbold} 73245450Sganbold 74245450Sganbold#define FDT_DEVMAP_MAX (1 + 2 + 1 + 1) 75259364Sianstatic struct arm_devmap_entry fdt_devmap[FDT_DEVMAP_MAX] = { 76245450Sganbold { 0, 0, 0, 0, 0, } 77245450Sganbold}; 78245450Sganbold 79245450Sganbold/* 80245450Sganbold * Construct pmap_devmap[] with DT-derived config data. 81245450Sganbold */ 82245450Sganboldint 83245450Sganboldplatform_devmap_init(void) 84245450Sganbold{ 85245450Sganbold int i = 0; 86245450Sganbold 87245450Sganbold fdt_devmap[i].pd_va = 0xE1C00000; 88245450Sganbold fdt_devmap[i].pd_pa = 0x01C00000; 89245450Sganbold fdt_devmap[i].pd_size = 0x00400000; /* 4 MB */ 90245450Sganbold fdt_devmap[i].pd_prot = VM_PROT_READ | VM_PROT_WRITE; 91245450Sganbold fdt_devmap[i].pd_cache = PTE_DEVICE; 92245450Sganbold 93245450Sganbold i++; 94245450Sganbold 95259364Sian arm_devmap_register_table(&fdt_devmap[0]); 96245450Sganbold 97245450Sganbold return (0); 98245450Sganbold} 99245450Sganbold 100245450Sganboldstruct arm32_dma_range * 101245450Sganboldbus_dma_get_range(void) 102245450Sganbold{ 103245450Sganbold return (NULL); 104245450Sganbold} 105245450Sganbold 106245450Sganboldint 107245450Sganboldbus_dma_get_range_nb(void) 108245450Sganbold{ 109245450Sganbold return (0); 110245450Sganbold} 111245450Sganbold 112245450Sganboldvoid 113245450Sganboldcpu_reset() 114245450Sganbold{ 115246661Sgonzo a10wd_watchdog_reset(); 116245450Sganbold printf("Reset failed!\n"); 117245450Sganbold while (1); 118245450Sganbold} 119