/* * Copyright (C) 2011 * Author: Jan Weitzel * based on arch/arm/mach-versatile/include/mach/debug_ll.h * * barebox is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * barebox is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #ifndef __MACH_OMAP_DEBUG_LL_H__ #define __MACH_OMAP_DEBUG_LL_H__ #include #include #include #include #ifdef CONFIG_DEBUG_OMAP_UART #ifdef CONFIG_DEBUG_OMAP3_UART #define OMAP_DEBUG_SOC OMAP3 #elif defined CONFIG_DEBUG_OMAP4_UART #define OMAP_DEBUG_SOC OMAP44XX #elif defined CONFIG_DEBUG_AM33XX_UART #define OMAP_DEBUG_SOC AM33XX #else #error "unknown OMAP debug uart soc type" #endif #define __OMAP_UART_BASE(soc, num) soc##_UART##num##_BASE #define OMAP_UART_BASE(soc, num) __OMAP_UART_BASE(soc, num) static inline uint8_t debug_ll_read_reg(int reg) { void __iomem *base = (void *)OMAP_UART_BASE(OMAP_DEBUG_SOC, CONFIG_DEBUG_OMAP_UART_PORT); return readb(base + (reg << 2)); } static inline void debug_ll_write_reg(int reg, uint8_t val) { void __iomem *base = (void *)OMAP_UART_BASE(OMAP_DEBUG_SOC, CONFIG_DEBUG_OMAP_UART_PORT); writeb(val, base + (reg << 2)); } #include static inline void omap_debug_ll_init(void) { unsigned int divisor; divisor = debug_ll_ns16550_calc_divisor(48000000); debug_ll_ns16550_init(divisor); } static inline void PUTC_LL(int c) { debug_ll_ns16550_putc(c); } #else static inline void omap_debug_ll_init(void) { } #endif #endif /* __MACH_OMAP_DEBUG_LL_H__ */