rk30xx_machdep.c revision 256949
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: head/sys/arm/rockchip/rk30xx_machdep.c 256949 2013-10-23 00:39:43Z ganbold $"); 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> 47256949Sganbold#include <machine/frame.h> /* For trapframe_t, used in <machine/machdep.h> */ 48256949Sganbold#include <machine/machdep.h> 49256949Sganbold#include <machine/pmap.h> 50256949Sganbold 51256949Sganbold#include <dev/fdt/fdt_common.h> 52256949Sganbold 53256949Sganbold/* Start of address space used for bootstrap map */ 54256949Sganbold#define DEVMAP_BOOTSTRAP_MAP_START 0xF0000000 55256949Sganbold 56256949Sganboldvm_offset_t 57256949Sganboldinitarm_lastaddr(void) 58256949Sganbold{ 59256949Sganbold 60256949Sganbold return (DEVMAP_BOOTSTRAP_MAP_START - ARM_NOCACHE_KVA_SIZE); 61256949Sganbold} 62256949Sganbold 63256949Sganboldvoid 64256949Sganboldinitarm_gpio_init(void) 65256949Sganbold{ 66256949Sganbold} 67256949Sganbold 68256949Sganboldvoid 69256949Sganboldinitarm_late_init(void) 70256949Sganbold{ 71256949Sganbold 72256949Sganbold /* Enable cache */ 73256949Sganbold cpufunc_control(CPU_CONTROL_DC_ENABLE|CPU_CONTROL_IC_ENABLE, 74256949Sganbold CPU_CONTROL_DC_ENABLE|CPU_CONTROL_IC_ENABLE); 75256949Sganbold} 76256949Sganbold 77256949Sganbold#define FDT_DEVMAP_MAX (1 + 2 + 1 + 1) 78256949Sganboldstatic struct pmap_devmap fdt_devmap[FDT_DEVMAP_MAX] = { 79256949Sganbold { 0, 0, 0, 0, 0, } 80256949Sganbold}; 81256949Sganbold 82256949Sganbold/* 83256949Sganbold * Construct pmap_devmap[] with DT-derived config data. 84256949Sganbold */ 85256949Sganboldint 86256949Sganboldplatform_devmap_init(void) 87256949Sganbold{ 88256949Sganbold int i = 0; 89256949Sganbold 90256949Sganbold fdt_devmap[i].pd_va = 0xF0000000; 91256949Sganbold fdt_devmap[i].pd_pa = 0x20000000; 92256949Sganbold fdt_devmap[i].pd_size = 0x100000; 93256949Sganbold fdt_devmap[i].pd_prot = VM_PROT_READ | VM_PROT_WRITE; 94256949Sganbold fdt_devmap[i].pd_cache = PTE_DEVICE; 95256949Sganbold i++; 96256949Sganbold 97256949Sganbold pmap_devmap_bootstrap_table = &fdt_devmap[0]; 98256949Sganbold 99256949Sganbold return (0); 100256949Sganbold} 101256949Sganbold 102256949Sganboldstruct arm32_dma_range * 103256949Sganboldbus_dma_get_range(void) 104256949Sganbold{ 105256949Sganbold 106256949Sganbold return (NULL); 107256949Sganbold} 108256949Sganbold 109256949Sganboldint 110256949Sganboldbus_dma_get_range_nb(void) 111256949Sganbold{ 112256949Sganbold 113256949Sganbold return (0); 114256949Sganbold} 115256949Sganbold 116256949Sganboldvoid 117256949Sganboldcpu_reset() 118256949Sganbold{ 119256949Sganbold 120256949Sganbold printf("No cpu_reset implementation!\n"); 121256949Sganbold while (1); 122256949Sganbold} 123