2005-04-16 15:20:36 -07:00
/*
2008-08-05 16:14:15 +01:00
* arch / arm / plat - omap / include / mach / uncompress . h
2005-04-16 15:20:36 -07:00
*
* Serial port stubs for kernel decompress status messages
*
* Initially based on :
2008-08-05 16:14:15 +01:00
* linux - 2.4 .15 - rmk1 - dsplinux1 .6 / arch / arm / plat - omap / include / mach1510 / uncompress . h
2005-04-16 15:20:36 -07:00
* Copyright ( C ) 2000 RidgeRun , Inc .
* Author : Greg Lonnon < glonnon @ ridgerun . com >
*
* Rewritten by :
* Author : < source @ mvista . com >
* 2004 ( c ) MontaVista Software , Inc .
*
* This file is licensed under the terms of the GNU General Public License
* version 2. This program is licensed " as is " without any warranty of any
* kind , whether express or implied .
*/
# include <linux/types.h>
# include <linux/serial_reg.h>
2010-02-15 08:49:01 -08:00
2010-04-30 17:39:19 -07:00
# include <asm/memory.h>
2010-02-15 08:49:01 -08:00
# include <asm/mach-types.h>
2009-10-20 09:40:47 -07:00
# include <plat/serial.h>
2005-04-16 15:20:36 -07:00
2010-08-02 14:21:39 +03:00
# define MDR1_MODE_MASK 0x07
2011-04-28 17:00:17 -04:00
volatile u8 * uart_base ;
int uart_shift ;
2005-04-16 15:20:36 -07:00
2010-02-15 08:49:01 -08:00
/*
2010-04-30 17:39:19 -07:00
* Store the DEBUG_LL uart number into memory .
2010-02-15 08:49:01 -08:00
* See also debug - macro . S , and serial . c for related code .
*/
2010-04-30 17:39:19 -07:00
static void set_omap_uart_info ( unsigned char port )
2005-04-16 15:20:36 -07:00
{
2011-08-31 13:57:37 -04:00
/*
* Get address of some . bss variable and round it down
* a la CONFIG_AUTO_ZRELADDR .
*/
u32 ram_start = ( u32 ) & uart_shift & 0xf8000000 ;
u32 * uart_info = ( u32 * ) ( ram_start + OMAP_UART_INFO_OFS ) ;
* uart_info = port ;
2010-02-15 08:49:01 -08:00
}
2005-04-16 15:20:36 -07:00
2010-02-15 08:49:01 -08:00
static void putc ( int c )
{
if ( ! uart_base )
2005-04-16 15:20:36 -07:00
return ;
2010-08-02 14:21:39 +03:00
/* Check for UART 16x mode */
if ( ( uart_base [ UART_OMAP_MDR1 < < uart_shift ] & MDR1_MODE_MASK ) ! = 0 )
return ;
2010-02-15 08:49:01 -08:00
while ( ! ( uart_base [ UART_LSR < < uart_shift ] & UART_LSR_THRE ) )
2006-03-28 10:24:33 +01:00
barrier ( ) ;
2010-02-15 08:49:01 -08:00
uart_base [ UART_TX < < uart_shift ] = c ;
2006-03-28 10:24:33 +01:00
}
static inline void flush ( void )
{
2005-04-16 15:20:36 -07:00
}
2010-02-15 08:49:01 -08:00
/*
* Macros to configure UART1 and debug UART
*/
2010-04-30 17:39:19 -07:00
# define _DEBUG_LL_ENTRY(mach, dbg_uart, dbg_shft, dbg_id) \
2010-02-15 08:49:01 -08:00
if ( machine_is_ # # mach ( ) ) { \
uart_base = ( volatile u8 * ) ( dbg_uart ) ; \
uart_shift = ( dbg_shft ) ; \
port = ( dbg_id ) ; \
2010-04-30 17:39:19 -07:00
set_omap_uart_info ( port ) ; \
2010-02-15 08:49:01 -08:00
break ; \
}
# define DEBUG_LL_OMAP7XX(p, mach) \
2010-04-30 17:39:19 -07:00
_DEBUG_LL_ENTRY ( mach , OMAP1_UART # # p # # _BASE , OMAP7XX_PORT_SHIFT , \
OMAP1UART # # p )
2010-02-15 08:49:01 -08:00
# define DEBUG_LL_OMAP1(p, mach) \
2010-04-30 17:39:19 -07:00
_DEBUG_LL_ENTRY ( mach , OMAP1_UART # # p # # _BASE , OMAP_PORT_SHIFT , \
OMAP1UART # # p )
2010-02-15 08:49:01 -08:00
# define DEBUG_LL_OMAP2(p, mach) \
2010-04-30 17:39:19 -07:00
_DEBUG_LL_ENTRY ( mach , OMAP2_UART # # p # # _BASE , OMAP_PORT_SHIFT , \
OMAP2UART # # p )
2010-02-15 08:49:01 -08:00
# define DEBUG_LL_OMAP3(p, mach) \
2010-04-30 17:39:19 -07:00
_DEBUG_LL_ENTRY ( mach , OMAP3_UART # # p # # _BASE , OMAP_PORT_SHIFT , \
OMAP3UART # # p )
2010-02-15 08:49:01 -08:00
# define DEBUG_LL_OMAP4(p, mach) \
2010-04-30 17:39:19 -07:00
_DEBUG_LL_ENTRY ( mach , OMAP4_UART # # p # # _BASE , OMAP_PORT_SHIFT , \
OMAP4UART # # p )
2010-02-15 08:49:01 -08:00
/* Zoom2/3 shift is different for UART1 and external port */
# define DEBUG_LL_ZOOM(mach) \
2010-04-30 17:39:19 -07:00
_DEBUG_LL_ENTRY ( mach , ZOOM_UART_BASE , ZOOM_PORT_SHIFT , ZOOM_UART )
2010-02-15 08:49:01 -08:00
2011-12-13 10:46:44 -08:00
# define DEBUG_LL_TI81XX(p, mach) \
_DEBUG_LL_ENTRY ( mach , TI81XX_UART # # p # # _BASE , OMAP_PORT_SHIFT , \
TI81XXUART # # p )
2011-02-15 23:06:17 +05:30
2010-02-15 08:49:01 -08:00
static inline void __arch_decomp_setup ( unsigned long arch_id )
{
int port = 0 ;
/*
* Initialize the port based on the machine ID from the bootloader .
* Note that we ' re using macros here instead of switch statement
* as machine_is functions are optimized out for the boards that
* are not selected .
*/
do {
/* omap7xx/8xx based boards using UART1 with shift 0 */
DEBUG_LL_OMAP7XX ( 1 , herald ) ;
DEBUG_LL_OMAP7XX ( 1 , omap_perseus2 ) ;
/* omap15xx/16xx based boards using UART1 */
DEBUG_LL_OMAP1 ( 1 , ams_delta ) ;
DEBUG_LL_OMAP1 ( 1 , nokia770 ) ;
DEBUG_LL_OMAP1 ( 1 , omap_h2 ) ;
DEBUG_LL_OMAP1 ( 1 , omap_h3 ) ;
DEBUG_LL_OMAP1 ( 1 , omap_innovator ) ;
DEBUG_LL_OMAP1 ( 1 , omap_osk ) ;
DEBUG_LL_OMAP1 ( 1 , omap_palmte ) ;
DEBUG_LL_OMAP1 ( 1 , omap_palmz71 ) ;
/* omap15xx/16xx based boards using UART2 */
DEBUG_LL_OMAP1 ( 2 , omap_palmtt ) ;
/* omap15xx/16xx based boards using UART3 */
DEBUG_LL_OMAP1 ( 3 , sx1 ) ;
/* omap2 based boards using UART1 */
DEBUG_LL_OMAP2 ( 1 , omap_2430sdp ) ;
DEBUG_LL_OMAP2 ( 1 , omap_apollon ) ;
DEBUG_LL_OMAP2 ( 1 , omap_h4 ) ;
/* omap2 based boards using UART3 */
DEBUG_LL_OMAP2 ( 3 , nokia_n800 ) ;
DEBUG_LL_OMAP2 ( 3 , nokia_n810 ) ;
DEBUG_LL_OMAP2 ( 3 , nokia_n810_wimax ) ;
/* omap3 based boards using UART1 */
DEBUG_LL_OMAP2 ( 1 , omap3evm ) ;
DEBUG_LL_OMAP3 ( 1 , omap_3430sdp ) ;
DEBUG_LL_OMAP3 ( 1 , omap_3630sdp ) ;
2010-09-27 16:05:47 +00:00
DEBUG_LL_OMAP3 ( 1 , omap3530_lv_som ) ;
DEBUG_LL_OMAP3 ( 1 , omap3_torpedo ) ;
2010-02-15 08:49:01 -08:00
/* omap3 based boards using UART3 */
DEBUG_LL_OMAP3 ( 3 , cm_t35 ) ;
2010-09-21 16:03:09 +00:00
DEBUG_LL_OMAP3 ( 3 , cm_t3517 ) ;
2011-07-05 03:38:23 -07:00
DEBUG_LL_OMAP3 ( 3 , cm_t3730 ) ;
2010-11-16 14:26:58 -08:00
DEBUG_LL_OMAP3 ( 3 , craneboard ) ;
2010-12-21 11:07:09 +00:00
DEBUG_LL_OMAP3 ( 3 , devkit8000 ) ;
2010-02-15 08:49:01 -08:00
DEBUG_LL_OMAP3 ( 3 , igep0020 ) ;
2010-10-08 10:22:11 -07:00
DEBUG_LL_OMAP3 ( 3 , igep0030 ) ;
2010-12-17 15:13:47 -08:00
DEBUG_LL_OMAP3 ( 3 , nokia_rm680 ) ;
2010-02-15 08:49:01 -08:00
DEBUG_LL_OMAP3 ( 3 , nokia_rx51 ) ;
DEBUG_LL_OMAP3 ( 3 , omap3517evm ) ;
DEBUG_LL_OMAP3 ( 3 , omap3_beagle ) ;
DEBUG_LL_OMAP3 ( 3 , omap3_pandora ) ;
DEBUG_LL_OMAP3 ( 3 , omap_ldp ) ;
DEBUG_LL_OMAP3 ( 3 , overo ) ;
DEBUG_LL_OMAP3 ( 3 , touchbook ) ;
/* omap4 based boards using UART3 */
DEBUG_LL_OMAP4 ( 3 , omap_4430sdp ) ;
2010-09-16 18:44:47 +05:30
DEBUG_LL_OMAP4 ( 3 , omap4_panda ) ;
2010-02-15 08:49:01 -08:00
/* zoom2/3 external uart */
DEBUG_LL_ZOOM ( omap_zoom2 ) ;
DEBUG_LL_ZOOM ( omap_zoom3 ) ;
2011-02-15 23:06:17 +05:30
/* TI8168 base boards using UART3 */
2011-12-13 10:46:44 -08:00
DEBUG_LL_TI81XX ( 3 , ti8168evm ) ;
2011-02-15 23:06:17 +05:30
2011-12-13 10:48:55 -08:00
/* TI8148 base boards using UART1 */
DEBUG_LL_TI81XX ( 1 , ti8148evm ) ;
2010-02-15 08:49:01 -08:00
} while ( 0 ) ;
}
# define arch_decomp_setup() __arch_decomp_setup(arch_id)
2005-04-16 15:20:36 -07:00
/*
* nothing to do
*/
# define arch_decomp_wdog()