imx51_machdep.c revision 248557
1248557Sray/*- 2248557Sray * Copyright (c) 1994-1998 Mark Brinicombe. 3248557Sray * Copyright (c) 1994 Brini. 4248557Sray * Copyright (c) 2012 The FreeBSD Foundation 5248557Sray * All rights reserved. 6248557Sray * 7248557Sray * 8248557Sray * This code is derived from software written for Brini by Mark Brinicombe 9248557Sray * Portions of this software were developed by Oleksandr Rybalko 10248557Sray * under sponsorship from the FreeBSD Foundation. 11248557Sray * 12248557Sray * Redistribution and use in source and binary forms, with or without 13248557Sray * modification, are permitted provided that the following conditions 14248557Sray * are met: 15248557Sray * 1. Redistributions of source code must retain the above copyright 16248557Sray * notice, this list of conditions and the following disclaimer. 17248557Sray * 2. Redistributions in binary form must reproduce the above copyright 18248557Sray * notice, this list of conditions and the following disclaimer in the 19248557Sray * documentation and/or other materials provided with the distribution. 20248557Sray * 3. All advertising materials mentioning features or use of this software 21248557Sray * must display the following acknowledgement: 22248557Sray * This product includes software developed by Brini. 23248557Sray * 4. The name of the company nor the name of the author may be used to 24248557Sray * endorse or promote products derived from this software without specific 25248557Sray * prior written permission. 26248557Sray * 27248557Sray * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED 28248557Sray * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 29248557Sray * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 30248557Sray * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 31248557Sray * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 32248557Sray * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 33248557Sray * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34248557Sray * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35248557Sray * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36248557Sray * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37248557Sray * SUCH DAMAGE. 38248557Sray * 39248557Sray * from: FreeBSD: //depot/projects/arm/src/sys/arm/at91/kb920x_machdep.c, rev 45 40248557Sray */ 41248557Sray 42248557Sray#include "opt_platform.h" 43248557Sray 44248557Sray#include <sys/cdefs.h> 45248557Sray__FBSDID("$FreeBSD: head/sys/arm/freescale/imx/imx_machdep.c 248557 2013-03-20 15:39:27Z ray $"); 46248557Sray 47248557Sray#define _ARM32_BUS_DMA_PRIVATE 48248557Sray#include <sys/param.h> 49248557Sray#include <sys/systm.h> 50248557Sray#include <sys/bus.h> 51248557Sray#include <sys/reboot.h> 52248557Sray 53248557Sray#include <vm/vm.h> 54248557Sray#include <vm/pmap.h> 55248557Sray 56248557Sray#include <machine/bus.h> 57248557Sray#include <machine/frame.h> /* For trapframe_t, used in <machine/machdep.h> */ 58248557Sray#include <machine/machdep.h> 59248557Sray#include <machine/pmap.h> 60248557Sray 61248557Sray#include <dev/fdt/fdt_common.h> 62248557Sray 63248557Sray#define IMX51_DEV_VIRT_BASE 0xe0000000 64248557Srayvm_offset_t 65248557Srayinitarm_lastaddr(void) 66248557Sray{ 67248557Sray 68248557Sray boothowto |= RB_VERBOSE|RB_MULTIPLE; 69248557Sray bootverbose = 1; 70248557Sray 71248557Sray if (fdt_immr_addr(IMX51_DEV_VIRT_BASE) != 0) 72248557Sray while (1); 73248557Sray 74248557Sray /* Platform-specific initialisation */ 75248557Sray return (fdt_immr_va - ARM_NOCACHE_KVA_SIZE); 76248557Sray} 77248557Sray 78248557Sray/* 79248557Sray * Set initial values of GPIO output ports 80248557Sray */ 81248557Srayvoid 82248557Srayinitarm_gpio_init(void) 83248557Sray{ 84248557Sray 85248557Sray} 86248557Sray 87248557Srayvoid 88248557Srayinitarm_late_init(void) 89248557Sray{ 90248557Sray 91248557Sray} 92248557Sray 93248557Sray#define FDT_DEVMAP_MAX 2 94248557Sraystatic struct pmap_devmap fdt_devmap[FDT_DEVMAP_MAX] = { 95248557Sray { 0, 0, 0, 0, 0, }, 96248557Sray { 0, 0, 0, 0, 0, } 97248557Sray}; 98248557Sray 99248557Sray/* 100248557Sray * Construct pmap_devmap[] with DT-derived config data. 101248557Sray */ 102248557Srayint 103248557Srayplatform_devmap_init(void) 104248557Sray{ 105248557Sray 106248557Sray /* 107248557Sray * Map segment where UART1 and UART2 located. 108248557Sray */ 109248557Sray fdt_devmap[0].pd_va = IMX51_DEV_VIRT_BASE + 0x03f00000; 110248557Sray fdt_devmap[0].pd_pa = 0x73f00000; 111248557Sray fdt_devmap[0].pd_size = 0x00100000; 112248557Sray fdt_devmap[0].pd_prot = VM_PROT_READ | VM_PROT_WRITE; 113248557Sray fdt_devmap[0].pd_cache = PTE_NOCACHE; 114248557Sray 115248557Sray pmap_devmap_bootstrap_table = &fdt_devmap[0]; 116248557Sray return (0); 117248557Sray} 118248557Sray 119248557Sraystruct arm32_dma_range * 120248557Sraybus_dma_get_range(void) 121248557Sray{ 122248557Sray 123248557Sray return (NULL); 124248557Sray} 125248557Sray 126248557Srayint 127248557Sraybus_dma_get_range_nb(void) 128248557Sray{ 129248557Sray 130248557Sray return (0); 131248557Sray} 132248557Sray 133248557Srayvoid 134248557Sraycpu_reset(void) 135248557Sray{ 136248557Sray 137248557Sray printf("Reset ...\n"); 138248557Sray /* Clear n_reset flag */ 139248557Sray *((volatile u_int16_t *)(IMX51_DEV_VIRT_BASE + 0x03f98000)) = 140248557Sray (u_int16_t)0; 141248557Sray while (1); 142248557Sray} 143