1239281Sgonzo/*- 2239281Sgonzo * Copyright (c) 1994-1998 Mark Brinicombe. 3239281Sgonzo * Copyright (c) 1994 Brini. 4239281Sgonzo * All rights reserved. 5239281Sgonzo * 6239281Sgonzo * This code is derived from software written for Brini by Mark Brinicombe 7239281Sgonzo * 8239281Sgonzo * Redistribution and use in source and binary forms, with or without 9239281Sgonzo * modification, are permitted provided that the following conditions 10239281Sgonzo * are met: 11239281Sgonzo * 1. Redistributions of source code must retain the above copyright 12239281Sgonzo * notice, this list of conditions and the following disclaimer. 13239281Sgonzo * 2. Redistributions in binary form must reproduce the above copyright 14239281Sgonzo * notice, this list of conditions and the following disclaimer in the 15239281Sgonzo * documentation and/or other materials provided with the distribution. 16239281Sgonzo * 3. All advertising materials mentioning features or use of this software 17239281Sgonzo * must display the following acknowledgement: 18239281Sgonzo * This product includes software developed by Brini. 19239281Sgonzo * 4. The name of the company nor the name of the author may be used to 20239281Sgonzo * endorse or promote products derived from this software without specific 21239281Sgonzo * prior written permission. 22239281Sgonzo * 23239281Sgonzo * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED 24239281Sgonzo * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 25239281Sgonzo * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26239281Sgonzo * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 27239281Sgonzo * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 28239281Sgonzo * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 29239281Sgonzo * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30239281Sgonzo * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31239281Sgonzo * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32239281Sgonzo * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33239281Sgonzo * SUCH DAMAGE. 34239281Sgonzo * 35239281Sgonzo * from: FreeBSD: //depot/projects/arm/src/sys/arm/at91/kb920x_machdep.c, rev 45 36239281Sgonzo */ 37239281Sgonzo 38239281Sgonzo#include "opt_platform.h" 39239281Sgonzo 40239281Sgonzo#include <sys/cdefs.h> 41239281Sgonzo__FBSDID("$FreeBSD$"); 42239281Sgonzo 43239281Sgonzo#define _ARM32_BUS_DMA_PRIVATE 44239281Sgonzo#include <sys/param.h> 45239281Sgonzo#include <sys/systm.h> 46239281Sgonzo#include <sys/bus.h> 47239281Sgonzo 48239281Sgonzo#include <vm/vm.h> 49239281Sgonzo#include <vm/pmap.h> 50242531Sandrew 51242531Sandrew#include <machine/bus.h> 52242531Sandrew#include <machine/frame.h> /* For trapframe_t, used in <machine/machdep.h> */ 53242531Sandrew#include <machine/machdep.h> 54239281Sgonzo#include <machine/pmap.h> 55239281Sgonzo 56239281Sgonzo#include <arm/ti/omap4/omap4_reg.h> 57239281Sgonzo 58239281Sgonzo/* Start of address space used for bootstrap map */ 59251586Scognet#define DEVMAP_BOOTSTRAP_MAP_START 0xF0000000 60239281Sgonzo 61239281Sgonzovoid (*ti_cpu_reset)(void); 62239281Sgonzo 63240846Sandrewvm_offset_t 64240846Sandrewinitarm_lastaddr(void) 65240846Sandrew{ 66240846Sandrew 67240846Sandrew ti_cpu_reset = NULL; 68240846Sandrew return (DEVMAP_BOOTSTRAP_MAP_START - ARM_NOCACHE_KVA_SIZE); 69240846Sandrew} 70240846Sandrew 71240846Sandrewvoid 72240846Sandrewinitarm_gpio_init(void) 73240846Sandrew{ 74240846Sandrew} 75240846Sandrew 76240846Sandrewvoid 77240846Sandrewinitarm_late_init(void) 78240846Sandrew{ 79240846Sandrew} 80240846Sandrew 81239281Sgonzo#define FDT_DEVMAP_MAX (2) // FIXME 82239281Sgonzostatic struct pmap_devmap fdt_devmap[FDT_DEVMAP_MAX] = { 83239281Sgonzo { 0, 0, 0, 0, 0, } 84239281Sgonzo}; 85239281Sgonzo 86239281Sgonzo 87239281Sgonzo/* 88239281Sgonzo * Construct pmap_devmap[] with DT-derived config data. 89239281Sgonzo */ 90242531Sandrewint 91239281Sgonzoplatform_devmap_init(void) 92239281Sgonzo{ 93239281Sgonzo int i = 0; 94239281Sgonzo#if defined(SOC_OMAP4) 95251586Scognet fdt_devmap[i].pd_va = 0xF8000000; 96239281Sgonzo fdt_devmap[i].pd_pa = 0x48000000; 97239281Sgonzo fdt_devmap[i].pd_size = 0x1000000; 98239281Sgonzo fdt_devmap[i].pd_prot = VM_PROT_READ | VM_PROT_WRITE; 99239281Sgonzo fdt_devmap[i].pd_cache = PTE_DEVICE; 100239281Sgonzo i++; 101239281Sgonzo#elif defined(SOC_TI_AM335X) 102251586Scognet fdt_devmap[i].pd_va = 0xF4C00000; 103239281Sgonzo fdt_devmap[i].pd_pa = 0x44C00000; /* L4_WKUP */ 104239281Sgonzo fdt_devmap[i].pd_size = 0x400000; /* 4 MB */ 105239281Sgonzo fdt_devmap[i].pd_prot = VM_PROT_READ | VM_PROT_WRITE; 106239281Sgonzo fdt_devmap[i].pd_cache = PTE_DEVICE; 107239281Sgonzo i++; 108239281Sgonzo#else 109239281Sgonzo#error "Unknown SoC" 110239281Sgonzo#endif 111239281Sgonzo 112239281Sgonzo pmap_devmap_bootstrap_table = &fdt_devmap[0]; 113239281Sgonzo return (0); 114239281Sgonzo} 115239281Sgonzo 116239281Sgonzostruct arm32_dma_range * 117239281Sgonzobus_dma_get_range(void) 118239281Sgonzo{ 119239281Sgonzo 120239281Sgonzo return (NULL); 121239281Sgonzo} 122239281Sgonzo 123239281Sgonzoint 124239281Sgonzobus_dma_get_range_nb(void) 125239281Sgonzo{ 126239281Sgonzo 127239281Sgonzo return (0); 128239281Sgonzo} 129239281Sgonzo 130239281Sgonzovoid 131239281Sgonzocpu_reset() 132239281Sgonzo{ 133239281Sgonzo if (ti_cpu_reset) 134239281Sgonzo (*ti_cpu_reset)(); 135239281Sgonzo else 136239281Sgonzo printf("no cpu_reset implementation\n"); 137239281Sgonzo printf("Reset failed!\n"); 138239281Sgonzo while (1); 139239281Sgonzo} 140