a10_machdep.c revision 266084
110045Speter/*- 210045Speter * Copyright (c) 2012 Ganbold Tsagaankhuu <ganbold@gmail.com> 310045Speter * All rights reserved. 410045Speter * 510045Speter * This code is derived from software written for Brini by Mark Brinicombe 610045Speter * 7179450Speter * Redistribution and use in source and binary forms, with or without 810045Speter * modification, are permitted provided that the following conditions 910045Speter * are met: 1010045Speter * 1. Redistributions of source code must retain the above copyright 1110045Speter * notice, this list of conditions and the following disclaimer. 1210045Speter * 2. Redistributions in binary form must reproduce the above copyright 1310045Speter * notice, this list of conditions and the following disclaimer in the 1410045Speter * documentation and/or other materials provided with the distribution. 1510045Speter * 1610045Speter * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1710045Speter * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1810045Speter * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1910045Speter * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 2010045Speter * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2110045Speter * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2210045Speter * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2310045Speter * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2410045Speter * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2510045Speter * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2610045Speter * SUCH DAMAGE. 2710045Speter * 2810045Speter * from: FreeBSD: //depot/projects/arm/src/sys/arm/ti/ti_machdep.c 2930427Scharnier */ 3030427Scharnier 3150479Speter#include "opt_ddb.h" 3230427Scharnier#include "opt_platform.h" 3330427Scharnier 3430427Scharnier#include <sys/cdefs.h> 3530427Scharnier__FBSDID("$FreeBSD: stable/10/sys/arm/allwinner/a10_machdep.c 266084 2014-05-14 19:18:58Z ian $"); 3630427Scharnier 3769793Sobrien#define _ARM32_BUS_DMA_PRIVATE 3810045Speter#include <sys/param.h> 3930427Scharnier#include <sys/systm.h> 4030427Scharnier#include <sys/bus.h> 4110045Speter 4210045Speter#include <vm/vm.h> 4310045Speter#include <vm/pmap.h> 4410045Speter 4510045Speter#include <machine/bus.h> 4610045Speter#include <machine/devmap.h> 47136063Sphk#include <machine/machdep.h> 4856509Speter 49136063Sphk#include <dev/fdt/fdt_common.h> 5010045Speter 5110045Speter#include <arm/allwinner/a10_wdog.h> 5210045Speter 5310045Spetervm_offset_t 5410045Speterinitarm_lastaddr(void) 5530427Scharnier{ 5630427Scharnier 5730427Scharnier return (arm_devmap_lastaddr()); 5830427Scharnier} 5930427Scharnier 6030427Scharniervoid 6130427Scharnierinitarm_early_init(void) 6230427Scharnier{ 6330427Scharnier} 6430427Scharnier 6530427Scharniervoid 6630427Scharnierinitarm_gpio_init(void) 6730427Scharnier{ 6830427Scharnier} 6930427Scharnier 7030427Scharniervoid 7130427Scharnierinitarm_late_init(void) 7230427Scharnier{ 7330427Scharnier} 7410045Speter 7510045Speter/* 7610045Speter * Set up static device mappings. 7710045Speter * 7856520Speter * This covers all the on-chip device with 1MB section mappings, which is good 79179590Speter * for performance (uses fewer TLB entries for device access). 8056520Speter * 8156520Speter * XXX It also covers a block of SRAM and some GPU (mali400) stuff that maybe 8256520Speter * shouldn't be device-mapped. The original code mapped a 4MB block, but 8356520Speter * perhaps a 1MB block would be more appropriate. 8456520Speter */ 8556520Speterint 8656520Speterinitarm_devmap_init(void) 8756520Speter{ 8856520Speter 8956520Speter arm_devmap_add_entry(0x01C00000, 0x00400000); /* 4MB */ 9056520Speter 9156520Speter return (0); 9256520Speter} 9330427Scharnier 9410045Speterstruct arm32_dma_range * 9510045Speterbus_dma_get_range(void) 9656520Speter{ 9710045Speter return (NULL); 9830427Scharnier} 9930427Scharnier 10030427Scharnierint 10130427Scharnierbus_dma_get_range_nb(void) 10230427Scharnier{ 10330427Scharnier return (0); 104179590Speter} 10530427Scharnier 10610045Spetervoid 10710045Spetercpu_reset() 10810045Speter{ 10956520Speter a10wd_watchdog_reset(); 11010045Speter printf("Reset failed!\n"); 11130427Scharnier while (1); 11230427Scharnier} 11310045Speter