blob: b3cb378c5e942012a07a81fb3837ddfac7acbaa1 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/***************************************************************************/
2
3/*
4 * linux/arch/m68knommu/platform/527x/config.c
5 *
Lucas De Marchi25985ed2011-03-30 22:57:33 -03006 * Sub-architcture dependent initialization code for the Freescale
Linus Torvalds1da177e2005-04-16 15:20:36 -07007 * 5270/5271 CPUs.
8 *
9 * Copyright (C) 1999-2004, Greg Ungerer (gerg@snapgear.com)
10 * Copyright (C) 2001-2004, SnapGear Inc. (www.snapgear.com)
11 */
12
13/***************************************************************************/
14
Linus Torvalds1da177e2005-04-16 15:20:36 -070015#include <linux/kernel.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070016#include <linux/param.h>
17#include <linux/init.h>
Greg Ungerere206da02008-02-01 17:34:40 +100018#include <linux/io.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070019#include <asm/machdep.h>
20#include <asm/coldfire.h>
21#include <asm/mcfsim.h>
Greg Ungerere206da02008-02-01 17:34:40 +100022#include <asm/mcfuart.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070023
24/***************************************************************************/
25
Steven King83ca6002012-05-06 12:22:53 -070026#if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
Steven King91d60412010-01-22 12:43:03 -080027
28static void __init m527x_qspi_init(void)
29{
30#if defined(CONFIG_M5271)
31 u16 par;
32
33 /* setup QSPS pins for QSPI with gpio CS control */
34 writeb(0x1f, MCFGPIO_PAR_QSPI);
35 /* and CS2 & CS3 as gpio */
36 par = readw(MCFGPIO_PAR_TIMER);
37 par &= 0x3f3f;
38 writew(par, MCFGPIO_PAR_TIMER);
39#elif defined(CONFIG_M5275)
40 /* setup QSPS pins for QSPI with gpio CS control */
41 writew(0x003e, MCFGPIO_PAR_QSPI);
42#endif
43}
Steven King91d60412010-01-22 12:43:03 -080044
Steven King83ca6002012-05-06 12:22:53 -070045#endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */
Greg Ungerere206da02008-02-01 17:34:40 +100046
47/***************************************************************************/
48
Greg Ungerer1eb13912011-12-24 00:59:03 +100049static void __init m527x_uarts_init(void)
Greg Ungerere206da02008-02-01 17:34:40 +100050{
51 u16 sepmask;
Greg Ungerere206da02008-02-01 17:34:40 +100052
Greg Ungerere206da02008-02-01 17:34:40 +100053 /*
54 * External Pin Mask Setting & Enable External Pin for Interface
55 */
56 sepmask = readw(MCF_IPSBAR + MCF_GPIO_PAR_UART);
Greg Ungerer1eb13912011-12-24 00:59:03 +100057 sepmask |= UART0_ENABLE_MASK | UART1_ENABLE_MASK | UART2_ENABLE_MASK;
Greg Ungerere206da02008-02-01 17:34:40 +100058 writew(sepmask, MCF_IPSBAR + MCF_GPIO_PAR_UART);
59}
60
Linus Torvalds1da177e2005-04-16 15:20:36 -070061/***************************************************************************/
62
Greg Ungererffba3f42009-02-26 22:40:38 -080063static void __init m527x_fec_init(void)
64{
65 u16 par;
66 u8 v;
67
Greg Ungererffba3f42009-02-26 22:40:38 -080068 /* Set multi-function pins to ethernet mode for fec0 */
Richard Retanubun592578a2009-04-08 11:51:27 +100069#if defined(CONFIG_M5271)
70 v = readb(MCF_IPSBAR + 0x100047);
71 writeb(v | 0xf0, MCF_IPSBAR + 0x100047);
72#else
Greg Ungererffba3f42009-02-26 22:40:38 -080073 par = readw(MCF_IPSBAR + 0x100082);
74 writew(par | 0xf00, MCF_IPSBAR + 0x100082);
75 v = readb(MCF_IPSBAR + 0x100078);
76 writeb(v | 0xc0, MCF_IPSBAR + 0x100078);
77
Greg Ungererffba3f42009-02-26 22:40:38 -080078 /* Set multi-function pins to ethernet mode for fec1 */
79 par = readw(MCF_IPSBAR + 0x100082);
80 writew(par | 0xa0, MCF_IPSBAR + 0x100082);
81 v = readb(MCF_IPSBAR + 0x100079);
82 writeb(v | 0xc0, MCF_IPSBAR + 0x100079);
83#endif
84}
85
86/***************************************************************************/
87
Greg Ungerere206da02008-02-01 17:34:40 +100088void __init config_BSP(char *commandp, int size)
Linus Torvalds1da177e2005-04-16 15:20:36 -070089{
Greg Ungerer35aefb22012-01-23 15:34:58 +100090 mach_sched_init = hw_timer_init;
Greg Ungererffba3f42009-02-26 22:40:38 -080091 m527x_uarts_init();
92 m527x_fec_init();
Steven King83ca6002012-05-06 12:22:53 -070093#if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
Steven King91d60412010-01-22 12:43:03 -080094 m527x_qspi_init();
95#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070096}
97
98/***************************************************************************/