1 /*- 2 * Copyright (c) 1994-1998 Mark Brinicombe. 3 * Copyright (c) 1994 Brini. 4 * Copyright (c) 2012 The FreeBSD Foundation 5 * All rights reserved. 6 * 7 * 8 * This code is derived from software written for Brini by Mark Brinicombe 9 * Portions of this software were developed by Oleksandr Rybalko 10 * under sponsorship from the FreeBSD Foundation. 11 * 12 * Redistribution and use in source and binary forms, with or without 13 * modification, are permitted provided that the following conditions 14 * are met: 15 * 1. Redistributions of source code must retain the above copyright 16 * notice, this list of conditions and the following disclaimer. 17 * 2. Redistributions in binary form must reproduce the above copyright 18 * notice, this list of conditions and the following disclaimer in the 19 * documentation and/or other materials provided with the distribution. 20 * 3. All advertising materials mentioning features or use of this software 21 * must display the following acknowledgement: 22 * This product includes software developed by Brini. 23 * 4. The name of the company nor the name of the author may be used to 24 * endorse or promote products derived from this software without specific 25 * prior written permission. 26 * 27 * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED 28 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 29 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 30 * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 31 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 32 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 33 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 * SUCH DAMAGE. 38 * 39 * from: FreeBSD: //depot/projects/arm/src/sys/arm/at91/kb920x_machdep.c, rev 45 40 */ 41 42 #include "opt_platform.h" 43 44 #include <sys/cdefs.h> 45 __FBSDID("$FreeBSD$"); 46 47 #define _ARM32_BUS_DMA_PRIVATE 48 #include <sys/param.h> 49 #include <sys/systm.h> 50 #include <sys/bus.h> 51 #include <sys/reboot.h> 52 53 #include <vm/vm.h> 54 #include <vm/pmap.h> 55 56 #include <machine/bus.h> 57 #include <machine/frame.h> /* For trapframe_t, used in <machine/machdep.h> */ 58 #include <machine/machdep.h> 59 #include <machine/pmap.h> 60 61 #include <dev/fdt/fdt_common.h> 62 63 #define IMX51_DEV_VIRT_BASE 0xe0000000 64 vm_offset_t 65 initarm_lastaddr(void) 66 { 67 68 boothowto |= RB_VERBOSE|RB_MULTIPLE; 69 bootverbose = 1; 70 71 if (fdt_immr_addr(IMX51_DEV_VIRT_BASE) != 0) 72 while (1); 73 74 /* Platform-specific initialisation */ 75 return (fdt_immr_va - ARM_NOCACHE_KVA_SIZE); 76 } 77 78 /* 79 * Set initial values of GPIO output ports 80 */ 81 void 82 initarm_gpio_init(void) 83 { 84 85 } 86 87 void 88 initarm_late_init(void) 89 { 90 91 } 92 93 #define FDT_DEVMAP_MAX 2 94 static struct pmap_devmap fdt_devmap[FDT_DEVMAP_MAX] = { 95 { 0, 0, 0, 0, 0, }, 96 { 0, 0, 0, 0, 0, } 97 }; 98 99 /* 100 * Construct pmap_devmap[] with DT-derived config data. 101 */ 102 int 103 platform_devmap_init(void) 104 { 105 106 /* 107 * Map segment where UART1 and UART2 located. 108 */ 109 fdt_devmap[0].pd_va = IMX51_DEV_VIRT_BASE + 0x03f00000; 110 fdt_devmap[0].pd_pa = 0x73f00000; 111 fdt_devmap[0].pd_size = 0x00100000; 112 fdt_devmap[0].pd_prot = VM_PROT_READ | VM_PROT_WRITE; 113 fdt_devmap[0].pd_cache = PTE_NOCACHE; 114 115 pmap_devmap_bootstrap_table = &fdt_devmap[0]; 116 return (0); 117 } 118 119 struct arm32_dma_range * 120 bus_dma_get_range(void) 121 { 122 123 return (NULL); 124 } 125 126 int 127 bus_dma_get_range_nb(void) 128 { 129 130 return (0); 131 } 132 133 void 134 cpu_reset(void) 135 { 136 137 printf("Reset ...\n"); 138 /* Clear n_reset flag */ 139 *((volatile u_int16_t *)(IMX51_DEV_VIRT_BASE + 0x03f98000)) = 140 (u_int16_t)0; 141 while (1); 142 } 143