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> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | |
| 24 | /***************************************************************************/ |
| 25 | |
Steven King | 83ca600 | 2012-05-06 12:22:53 -0700 | [diff] [blame^] | 26 | #if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) |
Steven King | 91d6041 | 2010-01-22 12:43:03 -0800 | [diff] [blame] | 27 | |
| 28 | static 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 King | 91d6041 | 2010-01-22 12:43:03 -0800 | [diff] [blame] | 44 | |
Steven King | 83ca600 | 2012-05-06 12:22:53 -0700 | [diff] [blame^] | 45 | #endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */ |
Greg Ungerer | e206da0 | 2008-02-01 17:34:40 +1000 | [diff] [blame] | 46 | |
| 47 | /***************************************************************************/ |
| 48 | |
Greg Ungerer | 1eb1391 | 2011-12-24 00:59:03 +1000 | [diff] [blame] | 49 | static void __init m527x_uarts_init(void) |
Greg Ungerer | e206da0 | 2008-02-01 17:34:40 +1000 | [diff] [blame] | 50 | { |
| 51 | u16 sepmask; |
Greg Ungerer | e206da0 | 2008-02-01 17:34:40 +1000 | [diff] [blame] | 52 | |
Greg Ungerer | e206da0 | 2008-02-01 17:34:40 +1000 | [diff] [blame] | 53 | /* |
| 54 | * External Pin Mask Setting & Enable External Pin for Interface |
| 55 | */ |
| 56 | sepmask = readw(MCF_IPSBAR + MCF_GPIO_PAR_UART); |
Greg Ungerer | 1eb1391 | 2011-12-24 00:59:03 +1000 | [diff] [blame] | 57 | sepmask |= UART0_ENABLE_MASK | UART1_ENABLE_MASK | UART2_ENABLE_MASK; |
Greg Ungerer | e206da0 | 2008-02-01 17:34:40 +1000 | [diff] [blame] | 58 | writew(sepmask, MCF_IPSBAR + MCF_GPIO_PAR_UART); |
| 59 | } |
| 60 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 61 | /***************************************************************************/ |
| 62 | |
Greg Ungerer | ffba3f4 | 2009-02-26 22:40:38 -0800 | [diff] [blame] | 63 | static void __init m527x_fec_init(void) |
| 64 | { |
| 65 | u16 par; |
| 66 | u8 v; |
| 67 | |
Greg Ungerer | ffba3f4 | 2009-02-26 22:40:38 -0800 | [diff] [blame] | 68 | /* Set multi-function pins to ethernet mode for fec0 */ |
Richard Retanubun | 592578a | 2009-04-08 11:51:27 +1000 | [diff] [blame] | 69 | #if defined(CONFIG_M5271) |
| 70 | v = readb(MCF_IPSBAR + 0x100047); |
| 71 | writeb(v | 0xf0, MCF_IPSBAR + 0x100047); |
| 72 | #else |
Greg Ungerer | ffba3f4 | 2009-02-26 22:40:38 -0800 | [diff] [blame] | 73 | 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 Ungerer | ffba3f4 | 2009-02-26 22:40:38 -0800 | [diff] [blame] | 78 | /* 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 Ungerer | e206da0 | 2008-02-01 17:34:40 +1000 | [diff] [blame] | 88 | void __init config_BSP(char *commandp, int size) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 89 | { |
Greg Ungerer | 35aefb2 | 2012-01-23 15:34:58 +1000 | [diff] [blame] | 90 | mach_sched_init = hw_timer_init; |
Greg Ungerer | ffba3f4 | 2009-02-26 22:40:38 -0800 | [diff] [blame] | 91 | m527x_uarts_init(); |
| 92 | m527x_fec_init(); |
Steven King | 83ca600 | 2012-05-06 12:22:53 -0700 | [diff] [blame^] | 93 | #if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) |
Steven King | 91d6041 | 2010-01-22 12:43:03 -0800 | [diff] [blame] | 94 | m527x_qspi_init(); |
| 95 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 96 | } |
| 97 | |
| 98 | /***************************************************************************/ |