1245450Sganbold/*- 2266337Sian * Copyright (c) 2012 Ganbold Tsagaankhuu <ganbold@freebsd.org> 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: releng/10.3/sys/arm/allwinner/a10_machdep.c 266337 2014-05-17 18:53:36Z 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 53245450Sganboldvm_offset_t 54245450Sganboldinitarm_lastaddr(void) 55245450Sganbold{ 56245450Sganbold 57266084Sian return (arm_devmap_lastaddr()); 58245450Sganbold} 59245450Sganbold 60245450Sganboldvoid 61259365Sianinitarm_early_init(void) 62259365Sian{ 63259365Sian} 64259365Sian 65259365Sianvoid 66245450Sganboldinitarm_gpio_init(void) 67245450Sganbold{ 68245450Sganbold} 69245450Sganbold 70245450Sganboldvoid 71245450Sganboldinitarm_late_init(void) 72245450Sganbold{ 73245450Sganbold} 74245450Sganbold 75245450Sganbold/* 76266084Sian * Set up static device mappings. 77266084Sian * 78266084Sian * This covers all the on-chip device with 1MB section mappings, which is good 79266084Sian * for performance (uses fewer TLB entries for device access). 80266084Sian * 81266084Sian * XXX It also covers a block of SRAM and some GPU (mali400) stuff that maybe 82266084Sian * shouldn't be device-mapped. The original code mapped a 4MB block, but 83266084Sian * perhaps a 1MB block would be more appropriate. 84245450Sganbold */ 85245450Sganboldint 86259365Sianinitarm_devmap_init(void) 87245450Sganbold{ 88245450Sganbold 89266084Sian arm_devmap_add_entry(0x01C00000, 0x00400000); /* 4MB */ 90245450Sganbold 91245450Sganbold return (0); 92245450Sganbold} 93245450Sganbold 94245450Sganboldstruct arm32_dma_range * 95245450Sganboldbus_dma_get_range(void) 96245450Sganbold{ 97245450Sganbold return (NULL); 98245450Sganbold} 99245450Sganbold 100245450Sganboldint 101245450Sganboldbus_dma_get_range_nb(void) 102245450Sganbold{ 103245450Sganbold return (0); 104245450Sganbold} 105245450Sganbold 106245450Sganboldvoid 107245450Sganboldcpu_reset() 108245450Sganbold{ 109246661Sgonzo a10wd_watchdog_reset(); 110245450Sganbold printf("Reset failed!\n"); 111245450Sganbold while (1); 112245450Sganbold} 113