2005-11-07 07:09:50 +03:00
/***************************************************************************/
/*
* linux / arch / m68knommu / platform / 520 x / config . c
*
* Copyright ( C ) 2005 , Freescale ( www . freescale . com )
* Copyright ( C ) 2005 , Intec Automation ( mike @ steroidmicros . com )
2008-02-01 10:34:10 +03:00
* Copyright ( C ) 1999 - 2007 , Greg Ungerer ( gerg @ snapgear . com )
2005-11-07 07:09:50 +03:00
* Copyright ( C ) 2001 - 2003 , SnapGear Inc . ( www . snapgear . com )
*/
/***************************************************************************/
# include <linux/kernel.h>
# include <linux/param.h>
2008-02-01 10:34:10 +03:00
# include <linux/init.h>
# include <linux/io.h>
2005-11-07 07:09:50 +03:00
# include <asm/machdep.h>
2008-02-01 10:34:10 +03:00
# include <asm/coldfire.h>
# include <asm/mcfsim.h>
# include <asm/mcfuart.h>
2005-11-07 07:09:50 +03:00
/***************************************************************************/
2012-05-06 23:22:53 +04:00
# if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
2010-01-22 23:43:03 +03:00
static void __init m520x_qspi_init ( void )
{
u16 par ;
/* setup Port QS for QSPI with gpio CS control */
2011-03-05 16:50:37 +03:00
writeb ( 0x3f , MCF_GPIO_PAR_QSPI ) ;
2010-01-22 23:43:03 +03:00
/* make U1CTS and U2RTS gpio for cs_control */
2011-03-05 16:50:37 +03:00
par = readw ( MCF_GPIO_PAR_UART ) ;
2010-01-22 23:43:03 +03:00
par & = 0x00ff ;
2011-03-05 16:50:37 +03:00
writew ( par , MCF_GPIO_PAR_UART ) ;
2010-01-22 23:43:03 +03:00
}
2012-05-06 23:22:53 +04:00
# endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */
2008-02-01 10:34:10 +03:00
/***************************************************************************/
2011-12-23 18:53:54 +04:00
static void __init m520x_uarts_init ( void )
2008-02-01 10:34:10 +03:00
{
u16 par ;
u8 par2 ;
2011-12-23 18:53:54 +04:00
/* UART0 and UART1 GPIO pin setup */
par = readw ( MCF_GPIO_PAR_UART ) ;
par | = MCF_GPIO_PAR_UART_PAR_UTXD0 | MCF_GPIO_PAR_UART_PAR_URXD0 ;
par | = MCF_GPIO_PAR_UART_PAR_UTXD1 | MCF_GPIO_PAR_UART_PAR_URXD1 ;
writew ( par , MCF_GPIO_PAR_UART ) ;
2008-02-01 10:34:10 +03:00
2011-12-23 18:53:54 +04:00
/* UART1 GPIO pin setup */
par2 = readb ( MCF_GPIO_PAR_FECI2C ) ;
par2 & = ~ 0x0F ;
par2 | = MCF_GPIO_PAR_FECI2C_PAR_SCL_UTXD2 |
MCF_GPIO_PAR_FECI2C_PAR_SDA_URXD2 ;
writeb ( par2 , MCF_GPIO_PAR_FECI2C ) ;
2008-02-01 10:34:10 +03:00
}
2005-11-07 07:09:50 +03:00
/***************************************************************************/
2009-02-27 09:40:38 +03:00
static void __init m520x_fec_init ( void )
{
u8 v ;
/* Set multi-function pins to ethernet mode */
2011-03-05 16:50:37 +03:00
v = readb ( MCF_GPIO_PAR_FEC ) ;
writeb ( v | 0xf0 , MCF_GPIO_PAR_FEC ) ;
2009-02-27 09:40:38 +03:00
2011-03-05 16:50:37 +03:00
v = readb ( MCF_GPIO_PAR_FECI2C ) ;
writeb ( v | 0x0f , MCF_GPIO_PAR_FECI2C ) ;
2009-02-27 09:40:38 +03:00
}
/***************************************************************************/
2008-02-01 10:34:10 +03:00
void __init config_BSP ( char * commandp , int size )
2005-11-07 07:09:50 +03:00
{
2012-01-23 09:34:58 +04:00
mach_sched_init = hw_timer_init ;
2008-02-01 10:34:10 +03:00
m520x_uarts_init ( ) ;
2009-02-27 09:40:38 +03:00
m520x_fec_init ( ) ;
2012-05-06 23:22:53 +04:00
# if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
2010-01-22 23:43:03 +03:00
m520x_qspi_init ( ) ;
# endif
2005-11-07 07:09:50 +03:00
}
/***************************************************************************/