rk30xx_machdep.c revision 259364
1256949Sganbold/*- 2256949Sganbold * Copyright (c) 2013 Ganbold Tsagaankhuu <ganbold@gmail.com> 3256949Sganbold * All rights reserved. 4256949Sganbold * 5256949Sganbold * This code is derived from software written for Brini by Mark Brinicombe 6256949Sganbold * 7256949Sganbold * Redistribution and use in source and binary forms, with or without 8256949Sganbold * modification, are permitted provided that the following conditions 9256949Sganbold * are met: 10256949Sganbold * 1. Redistributions of source code must retain the above copyright 11256949Sganbold * notice, this list of conditions and the following disclaimer. 12256949Sganbold * 2. Redistributions in binary form must reproduce the above copyright 13256949Sganbold * notice, this list of conditions and the following disclaimer in the 14256949Sganbold * documentation and/or other materials provided with the distribution. 15256949Sganbold * 16256949Sganbold * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17256949Sganbold * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18256949Sganbold * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19256949Sganbold * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20256949Sganbold * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21256949Sganbold * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22256949Sganbold * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23256949Sganbold * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24256949Sganbold * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25256949Sganbold * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26256949Sganbold * SUCH DAMAGE. 27256949Sganbold * 28256949Sganbold * from: FreeBSD: //depot/projects/arm/src/sys/arm/ti/ti_machdep.c 29256949Sganbold */ 30256949Sganbold 31256949Sganbold#include "opt_ddb.h" 32256949Sganbold#include "opt_platform.h" 33256949Sganbold 34256949Sganbold#include <sys/cdefs.h> 35256949Sganbold__FBSDID("$FreeBSD: stable/10/sys/arm/rockchip/rk30xx_machdep.c 259364 2013-12-13 23:56:53Z ian $"); 36256949Sganbold 37256949Sganbold#define _ARM32_BUS_DMA_PRIVATE 38256949Sganbold#include <sys/param.h> 39256949Sganbold#include <sys/systm.h> 40256949Sganbold#include <sys/bus.h> 41256949Sganbold 42256949Sganbold#include <vm/vm.h> 43256949Sganbold#include <vm/pmap.h> 44256949Sganbold 45256949Sganbold#include <machine/armreg.h> 46256949Sganbold#include <machine/bus.h> 47259364Sian#include <machine/devmap.h> 48256949Sganbold#include <machine/machdep.h> 49256949Sganbold 50256949Sganbold#include <dev/fdt/fdt_common.h> 51256949Sganbold 52256949Sganbold/* Start of address space used for bootstrap map */ 53256949Sganbold#define DEVMAP_BOOTSTRAP_MAP_START 0xF0000000 54256949Sganbold 55256949Sganboldvm_offset_t 56256949Sganboldinitarm_lastaddr(void) 57256949Sganbold{ 58256949Sganbold 59259335Sian return (DEVMAP_BOOTSTRAP_MAP_START); 60256949Sganbold} 61256949Sganbold 62256949Sganboldvoid 63256949Sganboldinitarm_gpio_init(void) 64256949Sganbold{ 65256949Sganbold} 66256949Sganbold 67256949Sganboldvoid 68256949Sganboldinitarm_late_init(void) 69256949Sganbold{ 70256949Sganbold 71256949Sganbold /* Enable cache */ 72256949Sganbold cpufunc_control(CPU_CONTROL_DC_ENABLE|CPU_CONTROL_IC_ENABLE, 73256949Sganbold CPU_CONTROL_DC_ENABLE|CPU_CONTROL_IC_ENABLE); 74256949Sganbold} 75256949Sganbold 76256949Sganbold#define FDT_DEVMAP_MAX (1 + 2 + 1 + 1) 77259364Sianstatic struct arm_devmap_entry fdt_devmap[FDT_DEVMAP_MAX] = { 78256949Sganbold { 0, 0, 0, 0, 0, } 79256949Sganbold}; 80256949Sganbold 81256949Sganbold/* 82256949Sganbold * Construct pmap_devmap[] with DT-derived config data. 83256949Sganbold */ 84256949Sganboldint 85256949Sganboldplatform_devmap_init(void) 86256949Sganbold{ 87256949Sganbold int i = 0; 88256949Sganbold 89256949Sganbold fdt_devmap[i].pd_va = 0xF0000000; 90256949Sganbold fdt_devmap[i].pd_pa = 0x20000000; 91256949Sganbold fdt_devmap[i].pd_size = 0x100000; 92256949Sganbold fdt_devmap[i].pd_prot = VM_PROT_READ | VM_PROT_WRITE; 93256949Sganbold fdt_devmap[i].pd_cache = PTE_DEVICE; 94256949Sganbold i++; 95256949Sganbold 96259364Sian arm_devmap_register_table(&fdt_devmap[0]); 97259364Sian 98256949Sganbold return (0); 99256949Sganbold} 100256949Sganbold 101256949Sganboldstruct arm32_dma_range * 102256949Sganboldbus_dma_get_range(void) 103256949Sganbold{ 104256949Sganbold 105256949Sganbold return (NULL); 106256949Sganbold} 107256949Sganbold 108256949Sganboldint 109256949Sganboldbus_dma_get_range_nb(void) 110256949Sganbold{ 111256949Sganbold 112256949Sganbold return (0); 113256949Sganbold} 114256949Sganbold 115256949Sganboldvoid 116256949Sganboldcpu_reset() 117256949Sganbold{ 118256949Sganbold 119256949Sganbold printf("No cpu_reset implementation!\n"); 120256949Sganbold while (1); 121256949Sganbold} 122