Greg Ungerer | b5aaf3f | 2005-09-02 10:42:52 +1000 | [diff] [blame] | 1 | /***************************************************************************/ |
| 2 | |
| 3 | /* |
Greg Ungerer | ece9ae6 | 2014-08-19 11:55:24 +1000 | [diff] [blame] | 4 | * m523x.c -- platform support for ColdFire 523x based boards |
Greg Ungerer | b5aaf3f | 2005-09-02 10:42:52 +1000 | [diff] [blame] | 5 | * |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 6 | * Sub-architcture dependent initialization code for the Freescale |
Greg Ungerer | b5aaf3f | 2005-09-02 10:42:52 +1000 | [diff] [blame] | 7 | * 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 Ungerer | b5aaf3f | 2005-09-02 10:42:52 +1000 | [diff] [blame] | 15 | #include <linux/kernel.h> |
Greg Ungerer | b5aaf3f | 2005-09-02 10:42:52 +1000 | [diff] [blame] | 16 | #include <linux/param.h> |
| 17 | #include <linux/init.h> |
Greg Ungerer | 4b61a35 | 2008-02-01 17:34:15 +1000 | [diff] [blame] | 18 | #include <linux/io.h> |
Greg Ungerer | b5aaf3f | 2005-09-02 10:42:52 +1000 | [diff] [blame] | 19 | #include <asm/machdep.h> |
| 20 | #include <asm/coldfire.h> |
| 21 | #include <asm/mcfsim.h> |
Greg Ungerer | a0f8f8c | 2012-07-13 15:57:38 +1000 | [diff] [blame] | 22 | #include <asm/mcfclk.h> |
| 23 | |
| 24 | /***************************************************************************/ |
| 25 | |
| 26 | DEFINE_CLK(pll, "pll.0", MCF_CLK); |
| 27 | DEFINE_CLK(sys, "sys.0", MCF_BUSCLK); |
| 28 | DEFINE_CLK(mcfpit0, "mcfpit.0", MCF_CLK); |
| 29 | DEFINE_CLK(mcfpit1, "mcfpit.1", MCF_CLK); |
| 30 | DEFINE_CLK(mcfpit2, "mcfpit.2", MCF_CLK); |
| 31 | DEFINE_CLK(mcfpit3, "mcfpit.3", MCF_CLK); |
| 32 | DEFINE_CLK(mcfuart0, "mcfuart.0", MCF_BUSCLK); |
| 33 | DEFINE_CLK(mcfuart1, "mcfuart.1", MCF_BUSCLK); |
| 34 | DEFINE_CLK(mcfuart2, "mcfuart.2", MCF_BUSCLK); |
Steven King | 7485952 | 2014-05-14 10:06:29 -0700 | [diff] [blame] | 35 | DEFINE_CLK(mcfqspi0, "mcfqspi.0", MCF_BUSCLK); |
Greg Ungerer | a0f8f8c | 2012-07-13 15:57:38 +1000 | [diff] [blame] | 36 | DEFINE_CLK(fec0, "fec.0", MCF_BUSCLK); |
| 37 | |
| 38 | struct clk *mcf_clks[] = { |
| 39 | &clk_pll, |
| 40 | &clk_sys, |
| 41 | &clk_mcfpit0, |
| 42 | &clk_mcfpit1, |
| 43 | &clk_mcfpit2, |
| 44 | &clk_mcfpit3, |
| 45 | &clk_mcfuart0, |
| 46 | &clk_mcfuart1, |
| 47 | &clk_mcfuart2, |
Steven King | 7485952 | 2014-05-14 10:06:29 -0700 | [diff] [blame] | 48 | &clk_mcfqspi0, |
Greg Ungerer | a0f8f8c | 2012-07-13 15:57:38 +1000 | [diff] [blame] | 49 | &clk_fec0, |
| 50 | NULL |
| 51 | }; |
Greg Ungerer | b5aaf3f | 2005-09-02 10:42:52 +1000 | [diff] [blame] | 52 | |
| 53 | /***************************************************************************/ |
| 54 | |
Steven King | 91d6041 | 2010-01-22 12:43:03 -0800 | [diff] [blame] | 55 | static void __init m523x_qspi_init(void) |
| 56 | { |
Steven King | 151d14f | 2014-05-14 10:07:55 -0700 | [diff] [blame] | 57 | #if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) |
Steven King | 91d6041 | 2010-01-22 12:43:03 -0800 | [diff] [blame] | 58 | u16 par; |
| 59 | |
| 60 | /* setup QSPS pins for QSPI with gpio CS control */ |
| 61 | writeb(0x1f, MCFGPIO_PAR_QSPI); |
| 62 | /* and CS2 & CS3 as gpio */ |
| 63 | par = readw(MCFGPIO_PAR_TIMER); |
| 64 | par &= 0x3f3f; |
| 65 | writew(par, MCFGPIO_PAR_TIMER); |
Steven King | 83ca600 | 2012-05-06 12:22:53 -0700 | [diff] [blame] | 66 | #endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */ |
Steven King | 151d14f | 2014-05-14 10:07:55 -0700 | [diff] [blame] | 67 | } |
Greg Ungerer | 4b61a35 | 2008-02-01 17:34:15 +1000 | [diff] [blame] | 68 | |
| 69 | /***************************************************************************/ |
| 70 | |
Greg Ungerer | 14c16db | 2009-08-12 16:14:43 +1000 | [diff] [blame] | 71 | static void __init m523x_fec_init(void) |
| 72 | { |
Greg Ungerer | 14c16db | 2009-08-12 16:14:43 +1000 | [diff] [blame] | 73 | /* Set multi-function pins to ethernet use */ |
Greg Ungerer | 98d9696 | 2012-09-18 12:14:18 +1000 | [diff] [blame] | 74 | writeb(readb(MCFGPIO_PAR_FECI2C) | 0xf0, MCFGPIO_PAR_FECI2C); |
Greg Ungerer | 14c16db | 2009-08-12 16:14:43 +1000 | [diff] [blame] | 75 | } |
| 76 | |
| 77 | /***************************************************************************/ |
| 78 | |
Greg Ungerer | 4b61a35 | 2008-02-01 17:34:15 +1000 | [diff] [blame] | 79 | void __init config_BSP(char *commandp, int size) |
Greg Ungerer | b5aaf3f | 2005-09-02 10:42:52 +1000 | [diff] [blame] | 80 | { |
Greg Ungerer | 35aefb2 | 2012-01-23 15:34:58 +1000 | [diff] [blame] | 81 | mach_sched_init = hw_timer_init; |
Greg Ungerer | 2ba168a | 2011-12-24 13:00:02 +1000 | [diff] [blame] | 82 | m523x_fec_init(); |
Steven King | 91d6041 | 2010-01-22 12:43:03 -0800 | [diff] [blame] | 83 | m523x_qspi_init(); |
Greg Ungerer | 4b61a35 | 2008-02-01 17:34:15 +1000 | [diff] [blame] | 84 | } |
| 85 | |
Greg Ungerer | 4b61a35 | 2008-02-01 17:34:15 +1000 | [diff] [blame] | 86 | /***************************************************************************/ |