blob: b47a6886b8aec29dd6e73a17baaad7d190bc2f68 [file] [log] [blame]
Greg Ungererb5aaf3f2005-09-02 10:42:52 +10001/***************************************************************************/
2
3/*
4 * linux/arch/m68knommu/platform/523x/config.c
5 *
Lucas De Marchi25985ed2011-03-30 22:57:33 -03006 * Sub-architcture dependent initialization code for the Freescale
Greg Ungererb5aaf3f2005-09-02 10:42:52 +10007 * 523x CPUs.
8 *
9 * Copyright (C) 1999-2005, Greg Ungerer (gerg@snapgear.com)
10 * Copyright (C) 2001-2003, SnapGear Inc. (www.snapgear.com)
11 */
12
13/***************************************************************************/
14
Greg Ungererb5aaf3f2005-09-02 10:42:52 +100015#include <linux/kernel.h>
Greg Ungererb5aaf3f2005-09-02 10:42:52 +100016#include <linux/param.h>
17#include <linux/init.h>
Greg Ungerer4b61a352008-02-01 17:34:15 +100018#include <linux/io.h>
Greg Ungererb5aaf3f2005-09-02 10:42:52 +100019#include <asm/machdep.h>
20#include <asm/coldfire.h>
21#include <asm/mcfsim.h>
Greg Ungererb5aaf3f2005-09-02 10:42:52 +100022
23/***************************************************************************/
24
Greg Ungererfa1fc242011-12-24 12:56:10 +100025#ifdef CONFIG_SPI_COLDFIRE_QSPI
Steven King91d60412010-01-22 12:43:03 -080026
27static void __init m523x_qspi_init(void)
28{
29 u16 par;
30
31 /* setup QSPS pins for QSPI with gpio CS control */
32 writeb(0x1f, MCFGPIO_PAR_QSPI);
33 /* and CS2 & CS3 as gpio */
34 par = readw(MCFGPIO_PAR_TIMER);
35 par &= 0x3f3f;
36 writew(par, MCFGPIO_PAR_TIMER);
37}
Steven King91d60412010-01-22 12:43:03 -080038
Greg Ungererfa1fc242011-12-24 12:56:10 +100039#endif /* CONFIG_SPI_COLDFIRE_QSPI */
Greg Ungerer4b61a352008-02-01 17:34:15 +100040
41/***************************************************************************/
42
Greg Ungerer14c16db2009-08-12 16:14:43 +100043static void __init m523x_fec_init(void)
44{
45 u16 par;
46 u8 v;
47
48 /* Set multi-function pins to ethernet use */
49 par = readw(MCF_IPSBAR + 0x100082);
50 writew(par | 0xf00, MCF_IPSBAR + 0x100082);
51 v = readb(MCF_IPSBAR + 0x100078);
52 writeb(v | 0xc0, MCF_IPSBAR + 0x100078);
53}
54
55/***************************************************************************/
56
Greg Ungerer55b33f32009-04-30 22:58:35 +100057static void m523x_cpu_reset(void)
58{
59 local_irq_disable();
60 __raw_writeb(MCF_RCR_SWRESET, MCF_IPSBAR + MCF_RCR);
61}
Greg Ungererb5aaf3f2005-09-02 10:42:52 +100062
63/***************************************************************************/
64
Greg Ungerer4b61a352008-02-01 17:34:15 +100065void __init config_BSP(char *commandp, int size)
Greg Ungererb5aaf3f2005-09-02 10:42:52 +100066{
Greg Ungerer55b33f32009-04-30 22:58:35 +100067 mach_reset = m523x_cpu_reset;
Greg Ungerer35aefb22012-01-23 15:34:58 +100068 mach_sched_init = hw_timer_init;
Greg Ungerer2ba168a2011-12-24 13:00:02 +100069 m523x_fec_init();
Greg Ungererfa1fc242011-12-24 12:56:10 +100070#ifdef CONFIG_SPI_COLDFIRE_QSPI
Steven King91d60412010-01-22 12:43:03 -080071 m523x_qspi_init();
72#endif
Greg Ungerer4b61a352008-02-01 17:34:15 +100073}
74
Greg Ungerer4b61a352008-02-01 17:34:15 +100075/***************************************************************************/