1*f86b9e03SGreg Ungerer /***************************************************************************/ 2*f86b9e03SGreg Ungerer 3*f86b9e03SGreg Ungerer /* 4*f86b9e03SGreg Ungerer * linux/arch/m68knommu/platform/528x/config.c 5*f86b9e03SGreg Ungerer * 6*f86b9e03SGreg Ungerer * Sub-architcture dependent initialization code for the Freescale 7*f86b9e03SGreg Ungerer * 5280, 5281 and 5282 CPUs. 8*f86b9e03SGreg Ungerer * 9*f86b9e03SGreg Ungerer * Copyright (C) 1999-2003, Greg Ungerer (gerg@snapgear.com) 10*f86b9e03SGreg Ungerer * Copyright (C) 2001-2003, SnapGear Inc. (www.snapgear.com) 11*f86b9e03SGreg Ungerer */ 12*f86b9e03SGreg Ungerer 13*f86b9e03SGreg Ungerer /***************************************************************************/ 14*f86b9e03SGreg Ungerer 15*f86b9e03SGreg Ungerer #include <linux/kernel.h> 16*f86b9e03SGreg Ungerer #include <linux/param.h> 17*f86b9e03SGreg Ungerer #include <linux/init.h> 18*f86b9e03SGreg Ungerer #include <linux/platform_device.h> 19*f86b9e03SGreg Ungerer #include <linux/io.h> 20*f86b9e03SGreg Ungerer #include <asm/machdep.h> 21*f86b9e03SGreg Ungerer #include <asm/coldfire.h> 22*f86b9e03SGreg Ungerer #include <asm/mcfsim.h> 23*f86b9e03SGreg Ungerer #include <asm/mcfuart.h> 24*f86b9e03SGreg Ungerer #include <asm/mcfclk.h> 25*f86b9e03SGreg Ungerer 26*f86b9e03SGreg Ungerer /***************************************************************************/ 27*f86b9e03SGreg Ungerer 28*f86b9e03SGreg Ungerer DEFINE_CLK(pll, "pll.0", MCF_CLK); 29*f86b9e03SGreg Ungerer DEFINE_CLK(sys, "sys.0", MCF_BUSCLK); 30*f86b9e03SGreg Ungerer DEFINE_CLK(mcfpit0, "mcfpit.0", MCF_CLK); 31*f86b9e03SGreg Ungerer DEFINE_CLK(mcfpit1, "mcfpit.1", MCF_CLK); 32*f86b9e03SGreg Ungerer DEFINE_CLK(mcfpit2, "mcfpit.2", MCF_CLK); 33*f86b9e03SGreg Ungerer DEFINE_CLK(mcfpit3, "mcfpit.3", MCF_CLK); 34*f86b9e03SGreg Ungerer DEFINE_CLK(mcfuart0, "mcfuart.0", MCF_BUSCLK); 35*f86b9e03SGreg Ungerer DEFINE_CLK(mcfuart1, "mcfuart.1", MCF_BUSCLK); 36*f86b9e03SGreg Ungerer DEFINE_CLK(mcfuart2, "mcfuart.2", MCF_BUSCLK); 37*f86b9e03SGreg Ungerer DEFINE_CLK(mcfqspi0, "mcfqspi.0", MCF_BUSCLK); 38*f86b9e03SGreg Ungerer DEFINE_CLK(fec0, "fec.0", MCF_BUSCLK); 39*f86b9e03SGreg Ungerer 40*f86b9e03SGreg Ungerer struct clk *mcf_clks[] = { 41*f86b9e03SGreg Ungerer &clk_pll, 42*f86b9e03SGreg Ungerer &clk_sys, 43*f86b9e03SGreg Ungerer &clk_mcfpit0, 44*f86b9e03SGreg Ungerer &clk_mcfpit1, 45*f86b9e03SGreg Ungerer &clk_mcfpit2, 46*f86b9e03SGreg Ungerer &clk_mcfpit3, 47*f86b9e03SGreg Ungerer &clk_mcfuart0, 48*f86b9e03SGreg Ungerer &clk_mcfuart1, 49*f86b9e03SGreg Ungerer &clk_mcfuart2, 50*f86b9e03SGreg Ungerer &clk_mcfqspi0, 51*f86b9e03SGreg Ungerer &clk_fec0, 52*f86b9e03SGreg Ungerer NULL 53*f86b9e03SGreg Ungerer }; 54*f86b9e03SGreg Ungerer 55*f86b9e03SGreg Ungerer /***************************************************************************/ 56*f86b9e03SGreg Ungerer 57*f86b9e03SGreg Ungerer static void __init m528x_qspi_init(void) 58*f86b9e03SGreg Ungerer { 59*f86b9e03SGreg Ungerer #if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) 60*f86b9e03SGreg Ungerer /* setup Port QS for QSPI with gpio CS control */ 61*f86b9e03SGreg Ungerer __raw_writeb(0x07, MCFGPIO_PQSPAR); 62*f86b9e03SGreg Ungerer #endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */ 63*f86b9e03SGreg Ungerer } 64*f86b9e03SGreg Ungerer 65*f86b9e03SGreg Ungerer /***************************************************************************/ 66*f86b9e03SGreg Ungerer 67*f86b9e03SGreg Ungerer static void __init m528x_uarts_init(void) 68*f86b9e03SGreg Ungerer { 69*f86b9e03SGreg Ungerer u8 port; 70*f86b9e03SGreg Ungerer 71*f86b9e03SGreg Ungerer /* make sure PUAPAR is set for UART0 and UART1 */ 72*f86b9e03SGreg Ungerer port = readb(MCFGPIO_PUAPAR); 73*f86b9e03SGreg Ungerer port |= 0x03 | (0x03 << 2); 74*f86b9e03SGreg Ungerer writeb(port, MCFGPIO_PUAPAR); 75*f86b9e03SGreg Ungerer } 76*f86b9e03SGreg Ungerer 77*f86b9e03SGreg Ungerer /***************************************************************************/ 78*f86b9e03SGreg Ungerer 79*f86b9e03SGreg Ungerer static void __init m528x_fec_init(void) 80*f86b9e03SGreg Ungerer { 81*f86b9e03SGreg Ungerer u16 v16; 82*f86b9e03SGreg Ungerer 83*f86b9e03SGreg Ungerer /* Set multi-function pins to ethernet mode for fec0 */ 84*f86b9e03SGreg Ungerer v16 = readw(MCFGPIO_PASPAR); 85*f86b9e03SGreg Ungerer writew(v16 | 0xf00, MCFGPIO_PASPAR); 86*f86b9e03SGreg Ungerer writeb(0xc0, MCFGPIO_PEHLPAR); 87*f86b9e03SGreg Ungerer } 88*f86b9e03SGreg Ungerer 89*f86b9e03SGreg Ungerer /***************************************************************************/ 90*f86b9e03SGreg Ungerer 91*f86b9e03SGreg Ungerer #ifdef CONFIG_WILDFIRE 92*f86b9e03SGreg Ungerer void wildfire_halt(void) 93*f86b9e03SGreg Ungerer { 94*f86b9e03SGreg Ungerer writeb(0, 0x30000007); 95*f86b9e03SGreg Ungerer writeb(0x2, 0x30000007); 96*f86b9e03SGreg Ungerer } 97*f86b9e03SGreg Ungerer #endif 98*f86b9e03SGreg Ungerer 99*f86b9e03SGreg Ungerer #ifdef CONFIG_WILDFIREMOD 100*f86b9e03SGreg Ungerer void wildfiremod_halt(void) 101*f86b9e03SGreg Ungerer { 102*f86b9e03SGreg Ungerer printk(KERN_INFO "WildFireMod hibernating...\n"); 103*f86b9e03SGreg Ungerer 104*f86b9e03SGreg Ungerer /* Set portE.5 to Digital IO */ 105*f86b9e03SGreg Ungerer MCF5282_GPIO_PEPAR &= ~(1 << (5 * 2)); 106*f86b9e03SGreg Ungerer 107*f86b9e03SGreg Ungerer /* Make portE.5 an output */ 108*f86b9e03SGreg Ungerer MCF5282_GPIO_DDRE |= (1 << 5); 109*f86b9e03SGreg Ungerer 110*f86b9e03SGreg Ungerer /* Now toggle portE.5 from low to high */ 111*f86b9e03SGreg Ungerer MCF5282_GPIO_PORTE &= ~(1 << 5); 112*f86b9e03SGreg Ungerer MCF5282_GPIO_PORTE |= (1 << 5); 113*f86b9e03SGreg Ungerer 114*f86b9e03SGreg Ungerer printk(KERN_EMERG "Failed to hibernate. Halting!\n"); 115*f86b9e03SGreg Ungerer } 116*f86b9e03SGreg Ungerer #endif 117*f86b9e03SGreg Ungerer 118*f86b9e03SGreg Ungerer void __init config_BSP(char *commandp, int size) 119*f86b9e03SGreg Ungerer { 120*f86b9e03SGreg Ungerer #ifdef CONFIG_WILDFIRE 121*f86b9e03SGreg Ungerer mach_halt = wildfire_halt; 122*f86b9e03SGreg Ungerer #endif 123*f86b9e03SGreg Ungerer #ifdef CONFIG_WILDFIREMOD 124*f86b9e03SGreg Ungerer mach_halt = wildfiremod_halt; 125*f86b9e03SGreg Ungerer #endif 126*f86b9e03SGreg Ungerer mach_sched_init = hw_timer_init; 127*f86b9e03SGreg Ungerer m528x_uarts_init(); 128*f86b9e03SGreg Ungerer m528x_fec_init(); 129*f86b9e03SGreg Ungerer m528x_qspi_init(); 130*f86b9e03SGreg Ungerer } 131*f86b9e03SGreg Ungerer 132*f86b9e03SGreg Ungerer /***************************************************************************/ 133