1148459Spjd/* 2148459Spjd * Copyright 2015, Brian McKenzie <mckenzba@gmail.com> 3148459Spjd * All rights reserved. 4293436Sngie * 5293436Sngie * Redistribution and use in source and binary forms, with or without modification, 6148459Spjd * are permitted provided that the following conditions are met: 7148459Spjd * 8293436Sngie * Redistributions of source code must retain the above copyright notice, this 9148459Spjd * list of conditions and the following disclaimer. 10148459Spjd * 11148459Spjd * Redistributions in binary form must reproduce the above copyright notice, this 12148459Spjd * list of conditions and the following disclaimer in the documentation and/or 13148459Spjd * other materials provided with the distribution. 14148459Spjd * 15182452Spjd * If you are going to use this software in any form that does not involve 16148459Spjd * releasing the source to this project or improving it, let me know beforehand. 17148459Spjd * 18148459Spjd * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19148459Spjd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20148459Spjd * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21148459Spjd * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 22148459Spjd * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23148459Spjd * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24148459Spjd * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 25148459Spjd * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26148459Spjd * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27148459Spjd * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28148459Spjd */ 29148459Spjd/* 30148459Spjd * Platform expert for BCM2836. 31148459Spjd */ 32148459Spjd 33148459Spjd#if defined(BOARD_CONFIG_RASPBERRYPI2) 34148459Spjd 35148459Spjd#include <vm/pmap.h> 36148459Spjd#include <arm/pmap.h> 37148459Spjd 38148459Spjd#include <mach/mach_types.h> 39148459Spjd 40148459Spjd#include <pexpert/pexpert.h> 41148459Spjd#include <pexpert/arm/protos.h> 42148459Spjd#include <pexpert/arm/boot.h> 43148459Spjd 44148459Spjd#include <machine/machine_routines.h> 45 46#include "pe_bcm2836.h" 47 48#define KPRINTF_PREFIX "PE_BCM2836: " 49 50extern void rtclock_intr(arm_saved_state_t * regs); 51extern void rtc_configure(uint64_t hz); 52 53static boolean_t clock_initialized = FALSE; 54static boolean_t clock_had_irq = FALSE; 55static uint64_t clock_decrementer = 0; 56static uint64_t clock_absolute_time = 0; 57 58static void timer_configure(void) 59{ 60} 61 62void bcm2836_putc(int c) 63{ 64 return; 65} 66 67int bcm2836_getc(void) 68{ 69 int c; 70 return c; 71} 72 73void bcm2836_uart_init(void) 74{ 75 return; 76} 77 78void bcm2836_interrupt_init(void) 79{ 80 return; 81} 82 83void bcm2836_timebase_init(void) 84{ 85 return; 86} 87 88void bcm2836_handle_interrupt(void *context) 89{ 90 return; 91} 92 93uint64_t bcm2836_get_timebase(void) 94{ 95 return; 96} 97 98uint64_t bcm2836_timer_value(void) 99{ 100 return; 101} 102 103void bcm2836_timer_enabled(int enable) 104{ 105 return; 106} 107 108/* 109 * Stub for printing out to framebuffer. 110 */ 111void vcputc(__unused int l, __unused int u, int c); 112 113static void _fb_putc(int c) 114{ 115 if (c == '\n') { 116 _fb_putc('\r'); 117 } 118 vcputc(0, 0, c); 119 bcm2836_putc(c); 120} 121 122void bcm2836_framebuffer_init(void) 123{ 124 return; 125} 126 127 128/* 129 * Setup the BCM2836 SoC dispatch table 130 */ 131void PE_init_SocSupport_bcm2836(void) 132{ 133 gPESocDispatch.uart_getc = bcm2836_getc; 134 gPESocDispatch.uart_putc = bcm2836_putc; 135 gPESocDispatch.uart_init = bcm2836_uart_init; 136 137 gPESocDispatch.interrupt_init = bcm2836_interrupt_init; 138 gPESocDispatch.timebase_init = bcm2836_timebase_init; 139 140 gPESocDispatch.get_timebase = bcm2836_get_timebase; 141 142 gPESocDispatch.handle_interrupt = bcm2836_handle_interrupt; 143 144 gPESocDispatch.timer_value = bcm2836_timer_value; 145 gPESocDispatch.timer_enabled = bcm2836_timer_enabled; 146 147 gPESocDispatch.framebuffer_init = bcm2836_framebuffer_init; 148 149 bcm2836_uart_init(); 150 bcm2836_framebuffer_init(); 151 152} 153 154/* 155 * Initialize SoC support for BCM2836. 156 */ 157void PE_init_SocSupport_stub(void) 158{ 159 PE_early_puts("PE_init_SocSupport: Initializing for Broadcom BCM2836\n"); 160 PE_init_SocSupport_bcm2836(); 161} 162 163#endif /* !BOARD_CONFIG_RASPBERRYPI2 */ 164