btrfs: Attempt to fix GCC2 build.
[haiku.git] / src / system / kernel / arch / arm / arch_uart_8250.cpp
blobef3d06d0e7d60644155e312efe80a6e589654a7f
1 /*
2 * Copyright 2011-2012 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * François Revol, revol@free.fr
7 */
10 #include <arch/arm/reg.h>
11 #include <arch/generic/debug_uart_8250.h>
12 #include <debug.h>
13 #include <new>
16 class ArchUART8250 : public DebugUART8250 {
17 public:
18 ArchUART8250(addr_t base, int64 clock);
19 ~ArchUART8250();
20 void InitEarly();
22 // ARM MMIO: on ARM the UART regs are aligned on 32bit
23 virtual void Out8(int reg, uint8 value);
24 virtual uint8 In8(int reg);
28 ArchUART8250::ArchUART8250(addr_t base, int64 clock)
30 DebugUART8250(base, clock)
35 ArchUART8250::~ArchUART8250()
40 void
41 ArchUART8250::InitEarly()
43 // Perform special hardware UART configuration
44 #warning TODO: Detect OMAP3 from fdt!
45 #if BOARD_CPU_OMAP3
46 /* UART1 */
47 RMWREG32(CM_FCLKEN1_CORE, 13, 1, 1);
48 RMWREG32(CM_ICLKEN1_CORE, 13, 1, 1);
50 /* UART2 */
51 RMWREG32(CM_FCLKEN1_CORE, 14, 1, 1);
52 RMWREG32(CM_ICLKEN1_CORE, 14, 1, 1);
54 /* UART3 */
55 RMWREG32(CM_FCLKEN_PER, 11, 1, 1);
56 RMWREG32(CM_ICLKEN_PER, 11, 1, 1);
57 #else
58 #warning INTITIALIZE UART!!!!!
59 #endif
63 void
64 ArchUART8250::Out8(int reg, uint8 value)
66 *((uint8 *)Base() + reg * sizeof(uint32)) = value;
70 uint8
71 ArchUART8250::In8(int reg)
73 return *((uint8 *)Base() + reg * sizeof(uint32));
77 DebugUART8250 *arch_get_uart_8250(addr_t base, int64 clock)
79 static char buffer[sizeof(ArchUART8250)];
80 ArchUART8250 *uart = new(buffer) ArchUART8250(base, clock);
81 return uart;