blob: d47dfd8f50a2dbfb292933de84f6b764931153c9 [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
Steven King83ca6002012-05-06 12:22:53 -070025#if IS_ENABLED(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
Steven King83ca6002012-05-06 12:22:53 -070039#endif /* IS_ENABLED(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 Ungerer4b61a352008-02-01 17:34:15 +100057void __init config_BSP(char *commandp, int size)
Greg Ungererb5aaf3f2005-09-02 10:42:52 +100058{
Greg Ungerer35aefb22012-01-23 15:34:58 +100059 mach_sched_init = hw_timer_init;
Greg Ungerer2ba168a2011-12-24 13:00:02 +100060 m523x_fec_init();
Steven King83ca6002012-05-06 12:22:53 -070061#if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
Steven King91d60412010-01-22 12:43:03 -080062 m523x_qspi_init();
63#endif
Greg Ungerer4b61a352008-02-01 17:34:15 +100064}
65
Greg Ungerer4b61a352008-02-01 17:34:15 +100066/***************************************************************************/