Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /***************************************************************************/ |
| 2 | |
| 3 | /* |
| 4 | * linux/arch/m68knommu/platform/527x/config.c |
| 5 | * |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 6 | * Sub-architcture dependent initialization code for the Freescale |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | * 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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | #include <linux/kernel.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | #include <linux/param.h> |
| 17 | #include <linux/init.h> |
Greg Ungerer | e206da0 | 2008-02-01 17:34:40 +1000 | [diff] [blame] | 18 | #include <linux/io.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | #include <asm/machdep.h> |
| 20 | #include <asm/coldfire.h> |
| 21 | #include <asm/mcfsim.h> |
Greg Ungerer | e206da0 | 2008-02-01 17:34:40 +1000 | [diff] [blame] | 22 | #include <asm/mcfuart.h> |
Greg Ungerer | a3d8eb0 | 2012-07-13 16:03:52 +1000 | [diff] [blame^] | 23 | #include <asm/mcfclk.h> |
| 24 | |
| 25 | /***************************************************************************/ |
| 26 | |
| 27 | DEFINE_CLK(pll, "pll.0", MCF_CLK); |
| 28 | DEFINE_CLK(sys, "sys.0", MCF_BUSCLK); |
| 29 | DEFINE_CLK(mcfpit0, "mcfpit.0", MCF_CLK); |
| 30 | DEFINE_CLK(mcfpit1, "mcfpit.1", MCF_CLK); |
| 31 | DEFINE_CLK(mcfpit2, "mcfpit.2", MCF_CLK); |
| 32 | DEFINE_CLK(mcfpit3, "mcfpit.3", MCF_CLK); |
| 33 | DEFINE_CLK(mcfuart0, "mcfuart.0", MCF_BUSCLK); |
| 34 | DEFINE_CLK(mcfuart1, "mcfuart.1", MCF_BUSCLK); |
| 35 | DEFINE_CLK(mcfuart2, "mcfuart.2", MCF_BUSCLK); |
| 36 | DEFINE_CLK(fec0, "fec.0", MCF_BUSCLK); |
| 37 | DEFINE_CLK(fec1, "fec.1", MCF_BUSCLK); |
| 38 | |
| 39 | struct clk *mcf_clks[] = { |
| 40 | &clk_pll, |
| 41 | &clk_sys, |
| 42 | &clk_mcfpit0, |
| 43 | &clk_mcfpit1, |
| 44 | &clk_mcfpit2, |
| 45 | &clk_mcfpit3, |
| 46 | &clk_mcfuart0, |
| 47 | &clk_mcfuart1, |
| 48 | &clk_mcfuart2, |
| 49 | &clk_fec0, |
| 50 | &clk_fec1, |
| 51 | NULL |
| 52 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | |
| 54 | /***************************************************************************/ |
| 55 | |
Steven King | 83ca600 | 2012-05-06 12:22:53 -0700 | [diff] [blame] | 56 | #if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) |
Steven King | 91d6041 | 2010-01-22 12:43:03 -0800 | [diff] [blame] | 57 | |
| 58 | static void __init m527x_qspi_init(void) |
| 59 | { |
| 60 | #if defined(CONFIG_M5271) |
| 61 | u16 par; |
| 62 | |
| 63 | /* setup QSPS pins for QSPI with gpio CS control */ |
| 64 | writeb(0x1f, MCFGPIO_PAR_QSPI); |
| 65 | /* and CS2 & CS3 as gpio */ |
| 66 | par = readw(MCFGPIO_PAR_TIMER); |
| 67 | par &= 0x3f3f; |
| 68 | writew(par, MCFGPIO_PAR_TIMER); |
| 69 | #elif defined(CONFIG_M5275) |
| 70 | /* setup QSPS pins for QSPI with gpio CS control */ |
| 71 | writew(0x003e, MCFGPIO_PAR_QSPI); |
| 72 | #endif |
| 73 | } |
Steven King | 91d6041 | 2010-01-22 12:43:03 -0800 | [diff] [blame] | 74 | |
Steven King | 83ca600 | 2012-05-06 12:22:53 -0700 | [diff] [blame] | 75 | #endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */ |
Greg Ungerer | e206da0 | 2008-02-01 17:34:40 +1000 | [diff] [blame] | 76 | |
| 77 | /***************************************************************************/ |
| 78 | |
Greg Ungerer | 1eb1391 | 2011-12-24 00:59:03 +1000 | [diff] [blame] | 79 | static void __init m527x_uarts_init(void) |
Greg Ungerer | e206da0 | 2008-02-01 17:34:40 +1000 | [diff] [blame] | 80 | { |
| 81 | u16 sepmask; |
Greg Ungerer | e206da0 | 2008-02-01 17:34:40 +1000 | [diff] [blame] | 82 | |
Greg Ungerer | e206da0 | 2008-02-01 17:34:40 +1000 | [diff] [blame] | 83 | /* |
| 84 | * External Pin Mask Setting & Enable External Pin for Interface |
| 85 | */ |
Greg Ungerer | f821e34 | 2012-09-17 12:07:21 +1000 | [diff] [blame] | 86 | sepmask = readw(MCFGPIO_PAR_UART); |
Greg Ungerer | 1eb1391 | 2011-12-24 00:59:03 +1000 | [diff] [blame] | 87 | sepmask |= UART0_ENABLE_MASK | UART1_ENABLE_MASK | UART2_ENABLE_MASK; |
Greg Ungerer | f821e34 | 2012-09-17 12:07:21 +1000 | [diff] [blame] | 88 | writew(sepmask, MCFGPIO_PAR_UART); |
Greg Ungerer | e206da0 | 2008-02-01 17:34:40 +1000 | [diff] [blame] | 89 | } |
| 90 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 91 | /***************************************************************************/ |
| 92 | |
Greg Ungerer | ffba3f4 | 2009-02-26 22:40:38 -0800 | [diff] [blame] | 93 | static void __init m527x_fec_init(void) |
| 94 | { |
| 95 | u16 par; |
| 96 | u8 v; |
| 97 | |
Greg Ungerer | ffba3f4 | 2009-02-26 22:40:38 -0800 | [diff] [blame] | 98 | /* Set multi-function pins to ethernet mode for fec0 */ |
Richard Retanubun | 592578a | 2009-04-08 11:51:27 +1000 | [diff] [blame] | 99 | #if defined(CONFIG_M5271) |
Greg Ungerer | f821e34 | 2012-09-17 12:07:21 +1000 | [diff] [blame] | 100 | v = readb(MCFGPIO_PAR_FECI2C); |
| 101 | writeb(v | 0xf0, MCFGPIO_PAR_FECI2C); |
Richard Retanubun | 592578a | 2009-04-08 11:51:27 +1000 | [diff] [blame] | 102 | #else |
Greg Ungerer | f821e34 | 2012-09-17 12:07:21 +1000 | [diff] [blame] | 103 | par = readw(MCFGPIO_PAR_FECI2C); |
| 104 | writew(par | 0xf00, MCFGPIO_PAR_FECI2C); |
| 105 | v = readb(MCFGPIO_PAR_FEC0HL); |
| 106 | writeb(v | 0xc0, MCFGPIO_PAR_FEC0HL); |
Greg Ungerer | ffba3f4 | 2009-02-26 22:40:38 -0800 | [diff] [blame] | 107 | |
Greg Ungerer | ffba3f4 | 2009-02-26 22:40:38 -0800 | [diff] [blame] | 108 | /* Set multi-function pins to ethernet mode for fec1 */ |
Greg Ungerer | f821e34 | 2012-09-17 12:07:21 +1000 | [diff] [blame] | 109 | par = readw(MCFGPIO_PAR_FECI2C); |
| 110 | writew(par | 0xa0, MCFGPIO_PAR_FECI2C); |
| 111 | v = readb(MCFGPIO_PAR_FEC1HL); |
| 112 | writeb(v | 0xc0, MCFGPIO_PAR_FEC1HL); |
Greg Ungerer | ffba3f4 | 2009-02-26 22:40:38 -0800 | [diff] [blame] | 113 | #endif |
| 114 | } |
| 115 | |
| 116 | /***************************************************************************/ |
| 117 | |
Greg Ungerer | e206da0 | 2008-02-01 17:34:40 +1000 | [diff] [blame] | 118 | void __init config_BSP(char *commandp, int size) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 119 | { |
Greg Ungerer | 35aefb2 | 2012-01-23 15:34:58 +1000 | [diff] [blame] | 120 | mach_sched_init = hw_timer_init; |
Greg Ungerer | ffba3f4 | 2009-02-26 22:40:38 -0800 | [diff] [blame] | 121 | m527x_uarts_init(); |
| 122 | m527x_fec_init(); |
Steven King | 83ca600 | 2012-05-06 12:22:53 -0700 | [diff] [blame] | 123 | #if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) |
Steven King | 91d6041 | 2010-01-22 12:43:03 -0800 | [diff] [blame] | 124 | m527x_qspi_init(); |
| 125 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 126 | } |
| 127 | |
| 128 | /***************************************************************************/ |