1 /* 2 * Copyright 2011-2012 Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * François Revol, revol@free.fr 7 */ 8 9 10 #include <arch/arm/reg.h> 11 #include <arch/arm/arch_uart_8250_omap.h> 12 #include <debug.h> 13 #include <omap3.h> 14 #include <new> 15 16 17 ArchUART8250Omap::ArchUART8250Omap(addr_t base, int64 clock) 18 : 19 DebugUART8250(base, clock) 20 { 21 } 22 23 24 ArchUART8250Omap::~ArchUART8250Omap() 25 { 26 } 27 28 29 void 30 ArchUART8250Omap::InitEarly() 31 { 32 // Perform special hardware UART configuration 33 /* UART1 */ 34 RMWREG32(CM_FCLKEN1_CORE, 13, 1, 1); 35 RMWREG32(CM_ICLKEN1_CORE, 13, 1, 1); 36 37 /* UART2 */ 38 RMWREG32(CM_FCLKEN1_CORE, 14, 1, 1); 39 RMWREG32(CM_ICLKEN1_CORE, 14, 1, 1); 40 41 /* UART3 */ 42 RMWREG32(CM_FCLKEN_PER, 11, 1, 1); 43 RMWREG32(CM_ICLKEN_PER, 11, 1, 1); 44 } 45 46 47 void 48 ArchUART8250Omap::Out8(int reg, uint8 value) 49 { 50 *((uint8 *)Base() + reg * sizeof(uint32)) = value; 51 } 52 53 54 uint8 55 ArchUART8250Omap::In8(int reg) 56 { 57 return *((uint8 *)Base() + reg * sizeof(uint32)); 58 } 59 60 61 DebugUART8250* 62 arch_get_uart_8250_omap(addr_t base, int64 clock) 63 { 64 static char buffer[sizeof(ArchUART8250Omap)]; 65 ArchUART8250Omap* uart = new(buffer) ArchUART8250Omap(base, clock); 66 return uart; 67 } 68