18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/****************************************************************************/
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci/*
58c2ecf20Sopenharmony_ci *	m525xsim.h -- ColdFire 525x System Integration Module support.
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci *	(C) Copyright 2012, Steven king <sfking@fdwdc.com>
88c2ecf20Sopenharmony_ci *	(C) Copyright 2002, Greg Ungerer (gerg@snapgear.com)
98c2ecf20Sopenharmony_ci */
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci/****************************************************************************/
128c2ecf20Sopenharmony_ci#ifndef	m525xsim_h
138c2ecf20Sopenharmony_ci#define m525xsim_h
148c2ecf20Sopenharmony_ci/****************************************************************************/
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci/*
178c2ecf20Sopenharmony_ci *	This header supports ColdFire 5249, 5251 and 5253. There are a few
188c2ecf20Sopenharmony_ci *	little differences between them, but most of the peripheral support
198c2ecf20Sopenharmony_ci *	can be used by all of them.
208c2ecf20Sopenharmony_ci */
218c2ecf20Sopenharmony_ci#define CPU_NAME		"COLDFIRE(m525x)"
228c2ecf20Sopenharmony_ci#define CPU_INSTR_PER_JIFFY	3
238c2ecf20Sopenharmony_ci#define MCF_BUSCLK		(MCF_CLK / 2)
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci#include <asm/m52xxacr.h>
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci/*
288c2ecf20Sopenharmony_ci *	The 525x has a second MBAR region, define its address.
298c2ecf20Sopenharmony_ci */
308c2ecf20Sopenharmony_ci#define MCF_MBAR2		0x80000000
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci/*
338c2ecf20Sopenharmony_ci *	Define the 525x SIM register set addresses.
348c2ecf20Sopenharmony_ci */
358c2ecf20Sopenharmony_ci#define MCFSIM_RSR		(MCF_MBAR + 0x00)	/* Reset Status */
368c2ecf20Sopenharmony_ci#define MCFSIM_SYPCR		(MCF_MBAR + 0x01)	/* System Protection */
378c2ecf20Sopenharmony_ci#define MCFSIM_SWIVR		(MCF_MBAR + 0x02)	/* SW Watchdog intr */
388c2ecf20Sopenharmony_ci#define MCFSIM_SWSR		(MCF_MBAR + 0x03)	/* SW Watchdog srv */
398c2ecf20Sopenharmony_ci#define MCFSIM_MPARK		(MCF_MBAR + 0x0C)	/* BUS Master Ctrl */
408c2ecf20Sopenharmony_ci#define MCFSIM_IPR		(MCF_MBAR + 0x40)	/* Interrupt Pending */
418c2ecf20Sopenharmony_ci#define MCFSIM_IMR		(MCF_MBAR + 0x44)	/* Interrupt Mask */
428c2ecf20Sopenharmony_ci#define MCFSIM_ICR0		(MCF_MBAR + 0x4c)	/* Intr Ctrl reg 0 */
438c2ecf20Sopenharmony_ci#define MCFSIM_ICR1		(MCF_MBAR + 0x4d)	/* Intr Ctrl reg 1 */
448c2ecf20Sopenharmony_ci#define MCFSIM_ICR2		(MCF_MBAR + 0x4e)	/* Intr Ctrl reg 2 */
458c2ecf20Sopenharmony_ci#define MCFSIM_ICR3		(MCF_MBAR + 0x4f)	/* Intr Ctrl reg 3 */
468c2ecf20Sopenharmony_ci#define MCFSIM_ICR4		(MCF_MBAR + 0x50)	/* Intr Ctrl reg 4 */
478c2ecf20Sopenharmony_ci#define MCFSIM_ICR5		(MCF_MBAR + 0x51)	/* Intr Ctrl reg 5 */
488c2ecf20Sopenharmony_ci#define MCFSIM_ICR6		(MCF_MBAR + 0x52)	/* Intr Ctrl reg 6 */
498c2ecf20Sopenharmony_ci#define MCFSIM_ICR7		(MCF_MBAR + 0x53)	/* Intr Ctrl reg 7 */
508c2ecf20Sopenharmony_ci#define MCFSIM_ICR8		(MCF_MBAR + 0x54)	/* Intr Ctrl reg 8 */
518c2ecf20Sopenharmony_ci#define MCFSIM_ICR9		(MCF_MBAR + 0x55)	/* Intr Ctrl reg 9 */
528c2ecf20Sopenharmony_ci#define MCFSIM_ICR10		(MCF_MBAR + 0x56)	/* Intr Ctrl reg 10 */
538c2ecf20Sopenharmony_ci#define MCFSIM_ICR11		(MCF_MBAR + 0x57)	/* Intr Ctrl reg 11 */
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci#define MCFSIM_CSAR0		(MCF_MBAR + 0x80)	/* CS 0 Address reg */
568c2ecf20Sopenharmony_ci#define MCFSIM_CSMR0		(MCF_MBAR + 0x84)	/* CS 0 Mask reg */
578c2ecf20Sopenharmony_ci#define MCFSIM_CSCR0		(MCF_MBAR + 0x8a)	/* CS 0 Control reg */
588c2ecf20Sopenharmony_ci#define MCFSIM_CSAR1		(MCF_MBAR + 0x8c)	/* CS 1 Address reg */
598c2ecf20Sopenharmony_ci#define MCFSIM_CSMR1		(MCF_MBAR + 0x90)	/* CS 1 Mask reg */
608c2ecf20Sopenharmony_ci#define MCFSIM_CSCR1		(MCF_MBAR + 0x96)	/* CS 1 Control reg */
618c2ecf20Sopenharmony_ci#define MCFSIM_CSAR2		(MCF_MBAR + 0x98)	/* CS 2 Address reg */
628c2ecf20Sopenharmony_ci#define MCFSIM_CSMR2		(MCF_MBAR + 0x9c)	/* CS 2 Mask reg */
638c2ecf20Sopenharmony_ci#define MCFSIM_CSCR2		(MCF_MBAR + 0xa2)	/* CS 2 Control reg */
648c2ecf20Sopenharmony_ci#define MCFSIM_CSAR3		(MCF_MBAR + 0xa4)	/* CS 3 Address reg */
658c2ecf20Sopenharmony_ci#define MCFSIM_CSMR3		(MCF_MBAR + 0xa8)	/* CS 3 Mask reg */
668c2ecf20Sopenharmony_ci#define MCFSIM_CSCR3		(MCF_MBAR + 0xae)	/* CS 3 Control reg */
678c2ecf20Sopenharmony_ci#define MCFSIM_CSAR4		(MCF_MBAR + 0xb0)	/* CS 4 Address reg */
688c2ecf20Sopenharmony_ci#define MCFSIM_CSMR4		(MCF_MBAR + 0xb4)	/* CS 4 Mask reg */
698c2ecf20Sopenharmony_ci#define MCFSIM_CSCR4		(MCF_MBAR + 0xba)	/* CS 4 Control reg */
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ci#define MCFSIM_DCR		(MCF_MBAR + 0x100)	/* DRAM Control */
728c2ecf20Sopenharmony_ci#define MCFSIM_DACR0		(MCF_MBAR + 0x108)	/* DRAM 0 Addr/Ctrl */
738c2ecf20Sopenharmony_ci#define MCFSIM_DMR0		(MCF_MBAR + 0x10c)	/* DRAM 0 Mask */
748c2ecf20Sopenharmony_ci#define MCFSIM_DACR1		(MCF_MBAR + 0x110)	/* DRAM 1 Addr/Ctrl */
758c2ecf20Sopenharmony_ci#define MCFSIM_DMR1		(MCF_MBAR + 0x114)	/* DRAM 1 Mask */
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci/*
788c2ecf20Sopenharmony_ci * Secondary Interrupt Controller (in MBAR2)
798c2ecf20Sopenharmony_ci*/
808c2ecf20Sopenharmony_ci#define MCFINTC2_INTBASE	(MCF_MBAR2 + 0x168)	/* Base Vector Reg */
818c2ecf20Sopenharmony_ci#define MCFINTC2_INTPRI1	(MCF_MBAR2 + 0x140)	/* 0-7 priority */
828c2ecf20Sopenharmony_ci#define MCFINTC2_INTPRI2	(MCF_MBAR2 + 0x144)	/* 8-15 priority */
838c2ecf20Sopenharmony_ci#define MCFINTC2_INTPRI3	(MCF_MBAR2 + 0x148)	/* 16-23 priority */
848c2ecf20Sopenharmony_ci#define MCFINTC2_INTPRI4	(MCF_MBAR2 + 0x14c)	/* 24-31 priority */
858c2ecf20Sopenharmony_ci#define MCFINTC2_INTPRI5	(MCF_MBAR2 + 0x150)	/* 32-39 priority */
868c2ecf20Sopenharmony_ci#define MCFINTC2_INTPRI6	(MCF_MBAR2 + 0x154)	/* 40-47 priority */
878c2ecf20Sopenharmony_ci#define MCFINTC2_INTPRI7	(MCF_MBAR2 + 0x158)	/* 48-55 priority */
888c2ecf20Sopenharmony_ci#define MCFINTC2_INTPRI8	(MCF_MBAR2 + 0x15c)	/* 56-63 priority */
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_ci#define MCFINTC2_INTPRI_REG(i)	(MCFINTC2_INTPRI1 + \
918c2ecf20Sopenharmony_ci				((((i) - MCFINTC2_VECBASE) / 8) * 4))
928c2ecf20Sopenharmony_ci#define MCFINTC2_INTPRI_BITS(b, i)	((b) << (((i) % 8) * 4))
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ci/*
958c2ecf20Sopenharmony_ci *	Timer module.
968c2ecf20Sopenharmony_ci */
978c2ecf20Sopenharmony_ci#define MCFTIMER_BASE1		(MCF_MBAR + 0x140)	/* Base of TIMER1 */
988c2ecf20Sopenharmony_ci#define MCFTIMER_BASE2		(MCF_MBAR + 0x180)	/* Base of TIMER2 */
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_ci/*
1018c2ecf20Sopenharmony_ci *	UART module.
1028c2ecf20Sopenharmony_ci */
1038c2ecf20Sopenharmony_ci#define MCFUART_BASE0		(MCF_MBAR + 0x1c0)	/* Base address UART0 */
1048c2ecf20Sopenharmony_ci#define MCFUART_BASE1		(MCF_MBAR + 0x200)	/* Base address UART1 */
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci/*
1078c2ecf20Sopenharmony_ci *	QSPI module.
1088c2ecf20Sopenharmony_ci */
1098c2ecf20Sopenharmony_ci#define MCFQSPI_BASE		(MCF_MBAR + 0x400)	/* Base address QSPI */
1108c2ecf20Sopenharmony_ci#define MCFQSPI_SIZE		0x40			/* Register set size */
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ci#ifdef CONFIG_M5249
1138c2ecf20Sopenharmony_ci#define MCFQSPI_CS0		29
1148c2ecf20Sopenharmony_ci#define MCFQSPI_CS1		24
1158c2ecf20Sopenharmony_ci#define MCFQSPI_CS2		21
1168c2ecf20Sopenharmony_ci#define MCFQSPI_CS3		22
1178c2ecf20Sopenharmony_ci#else
1188c2ecf20Sopenharmony_ci#define MCFQSPI_CS0		15
1198c2ecf20Sopenharmony_ci#define MCFQSPI_CS1		16
1208c2ecf20Sopenharmony_ci#define MCFQSPI_CS2		24
1218c2ecf20Sopenharmony_ci#define MCFQSPI_CS3		28
1228c2ecf20Sopenharmony_ci#endif
1238c2ecf20Sopenharmony_ci
1248c2ecf20Sopenharmony_ci/*
1258c2ecf20Sopenharmony_ci *	I2C module.
1268c2ecf20Sopenharmony_ci */
1278c2ecf20Sopenharmony_ci#define MCFI2C_BASE0		(MCF_MBAR + 0x280)	/* Base address I2C0 */
1288c2ecf20Sopenharmony_ci#define MCFI2C_SIZE0		0x20			/* Register set size */
1298c2ecf20Sopenharmony_ci
1308c2ecf20Sopenharmony_ci#define MCFI2C_BASE1		(MCF_MBAR2 + 0x440)	/* Base address I2C1 */
1318c2ecf20Sopenharmony_ci#define MCFI2C_SIZE1		0x20			/* Register set size */
1328c2ecf20Sopenharmony_ci
1338c2ecf20Sopenharmony_ci/*
1348c2ecf20Sopenharmony_ci *	DMA unit base addresses.
1358c2ecf20Sopenharmony_ci */
1368c2ecf20Sopenharmony_ci#define MCFDMA_BASE0		(MCF_MBAR + 0x300)	/* Base address DMA 0 */
1378c2ecf20Sopenharmony_ci#define MCFDMA_BASE1		(MCF_MBAR + 0x340)	/* Base address DMA 1 */
1388c2ecf20Sopenharmony_ci#define MCFDMA_BASE2		(MCF_MBAR + 0x380)	/* Base address DMA 2 */
1398c2ecf20Sopenharmony_ci#define MCFDMA_BASE3		(MCF_MBAR + 0x3C0)	/* Base address DMA 3 */
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_ci/*
1428c2ecf20Sopenharmony_ci *	Some symbol defines for the above...
1438c2ecf20Sopenharmony_ci */
1448c2ecf20Sopenharmony_ci#define MCFSIM_SWDICR		MCFSIM_ICR0	/* Watchdog timer ICR */
1458c2ecf20Sopenharmony_ci#define MCFSIM_TIMER1ICR	MCFSIM_ICR1	/* Timer 1 ICR */
1468c2ecf20Sopenharmony_ci#define MCFSIM_TIMER2ICR	MCFSIM_ICR2	/* Timer 2 ICR */
1478c2ecf20Sopenharmony_ci#define MCFSIM_I2CICR		MCFSIM_ICR3	/* I2C ICR */
1488c2ecf20Sopenharmony_ci#define MCFSIM_UART1ICR		MCFSIM_ICR4	/* UART 1 ICR */
1498c2ecf20Sopenharmony_ci#define MCFSIM_UART2ICR		MCFSIM_ICR5	/* UART 2 ICR */
1508c2ecf20Sopenharmony_ci#define MCFSIM_DMA0ICR		MCFSIM_ICR6	/* DMA 0 ICR */
1518c2ecf20Sopenharmony_ci#define MCFSIM_DMA1ICR		MCFSIM_ICR7	/* DMA 1 ICR */
1528c2ecf20Sopenharmony_ci#define MCFSIM_DMA2ICR		MCFSIM_ICR8	/* DMA 2 ICR */
1538c2ecf20Sopenharmony_ci#define MCFSIM_DMA3ICR		MCFSIM_ICR9	/* DMA 3 ICR */
1548c2ecf20Sopenharmony_ci#define MCFSIM_QSPIICR		MCFSIM_ICR10	/* QSPI ICR */
1558c2ecf20Sopenharmony_ci
1568c2ecf20Sopenharmony_ci/*
1578c2ecf20Sopenharmony_ci *	Define system peripheral IRQ usage.
1588c2ecf20Sopenharmony_ci */
1598c2ecf20Sopenharmony_ci#define MCF_IRQ_QSPI		28		/* QSPI, Level 4 */
1608c2ecf20Sopenharmony_ci#define MCF_IRQ_I2C0		29
1618c2ecf20Sopenharmony_ci#define MCF_IRQ_TIMER		30		/* Timer0, Level 6 */
1628c2ecf20Sopenharmony_ci#define MCF_IRQ_PROFILER	31		/* Timer1, Level 7 */
1638c2ecf20Sopenharmony_ci
1648c2ecf20Sopenharmony_ci#define MCF_IRQ_UART0		73		/* UART0 */
1658c2ecf20Sopenharmony_ci#define MCF_IRQ_UART1		74		/* UART1 */
1668c2ecf20Sopenharmony_ci
1678c2ecf20Sopenharmony_ci/*
1688c2ecf20Sopenharmony_ci * Define the base interrupt for the second interrupt controller.
1698c2ecf20Sopenharmony_ci * We set it to 128, out of the way of the base interrupts, and plenty
1708c2ecf20Sopenharmony_ci * of room for its 64 interrupts.
1718c2ecf20Sopenharmony_ci */
1728c2ecf20Sopenharmony_ci#define MCFINTC2_VECBASE	128
1738c2ecf20Sopenharmony_ci
1748c2ecf20Sopenharmony_ci#define MCF_IRQ_GPIO0		(MCFINTC2_VECBASE + 32)
1758c2ecf20Sopenharmony_ci#define MCF_IRQ_GPIO1		(MCFINTC2_VECBASE + 33)
1768c2ecf20Sopenharmony_ci#define MCF_IRQ_GPIO2		(MCFINTC2_VECBASE + 34)
1778c2ecf20Sopenharmony_ci#define MCF_IRQ_GPIO3		(MCFINTC2_VECBASE + 35)
1788c2ecf20Sopenharmony_ci#define MCF_IRQ_GPIO4		(MCFINTC2_VECBASE + 36)
1798c2ecf20Sopenharmony_ci#define MCF_IRQ_GPIO5		(MCFINTC2_VECBASE + 37)
1808c2ecf20Sopenharmony_ci#define MCF_IRQ_GPIO6		(MCFINTC2_VECBASE + 38)
1818c2ecf20Sopenharmony_ci#define MCF_IRQ_GPIO7		(MCFINTC2_VECBASE + 39)
1828c2ecf20Sopenharmony_ci
1838c2ecf20Sopenharmony_ci#define MCF_IRQ_USBWUP		(MCFINTC2_VECBASE + 40)
1848c2ecf20Sopenharmony_ci#define MCF_IRQ_I2C1		(MCFINTC2_VECBASE + 62)
1858c2ecf20Sopenharmony_ci
1868c2ecf20Sopenharmony_ci/*
1878c2ecf20Sopenharmony_ci *	General purpose IO registers (in MBAR2).
1888c2ecf20Sopenharmony_ci */
1898c2ecf20Sopenharmony_ci#define MCFSIM2_GPIOREAD	(MCF_MBAR2 + 0x000)	/* GPIO read values */
1908c2ecf20Sopenharmony_ci#define MCFSIM2_GPIOWRITE	(MCF_MBAR2 + 0x004)	/* GPIO write values */
1918c2ecf20Sopenharmony_ci#define MCFSIM2_GPIOENABLE	(MCF_MBAR2 + 0x008)	/* GPIO enabled */
1928c2ecf20Sopenharmony_ci#define MCFSIM2_GPIOFUNC	(MCF_MBAR2 + 0x00C)	/* GPIO function */
1938c2ecf20Sopenharmony_ci#define MCFSIM2_GPIO1READ	(MCF_MBAR2 + 0x0B0)	/* GPIO1 read values */
1948c2ecf20Sopenharmony_ci#define MCFSIM2_GPIO1WRITE	(MCF_MBAR2 + 0x0B4)	/* GPIO1 write values */
1958c2ecf20Sopenharmony_ci#define MCFSIM2_GPIO1ENABLE	(MCF_MBAR2 + 0x0B8)	/* GPIO1 enabled */
1968c2ecf20Sopenharmony_ci#define MCFSIM2_GPIO1FUNC	(MCF_MBAR2 + 0x0BC)	/* GPIO1 function */
1978c2ecf20Sopenharmony_ci
1988c2ecf20Sopenharmony_ci#define MCFSIM2_GPIOINTSTAT	(MCF_MBAR2 + 0xc0)	/* GPIO intr status */
1998c2ecf20Sopenharmony_ci#define MCFSIM2_GPIOINTCLEAR	(MCF_MBAR2 + 0xc0)	/* GPIO intr clear */
2008c2ecf20Sopenharmony_ci#define MCFSIM2_GPIOINTENABLE	(MCF_MBAR2 + 0xc4)	/* GPIO intr enable */
2018c2ecf20Sopenharmony_ci
2028c2ecf20Sopenharmony_ci#define MCFSIM2_DMAROUTE	(MCF_MBAR2 + 0x188)     /* DMA routing */
2038c2ecf20Sopenharmony_ci#define MCFSIM2_IDECONFIG1	(MCF_MBAR2 + 0x18c)	/* IDEconfig1 */
2048c2ecf20Sopenharmony_ci#define MCFSIM2_IDECONFIG2	(MCF_MBAR2 + 0x190)	/* IDEconfig2 */
2058c2ecf20Sopenharmony_ci
2068c2ecf20Sopenharmony_ci/*
2078c2ecf20Sopenharmony_ci * Generic GPIO support
2088c2ecf20Sopenharmony_ci */
2098c2ecf20Sopenharmony_ci#define MCFGPIO_PIN_MAX		64
2108c2ecf20Sopenharmony_ci#ifdef CONFIG_M5249
2118c2ecf20Sopenharmony_ci#define MCFGPIO_IRQ_MAX		-1
2128c2ecf20Sopenharmony_ci#define MCFGPIO_IRQ_VECBASE	-1
2138c2ecf20Sopenharmony_ci#else
2148c2ecf20Sopenharmony_ci#define MCFGPIO_IRQ_MAX		7
2158c2ecf20Sopenharmony_ci#define MCFGPIO_IRQ_VECBASE	MCF_IRQ_GPIO0
2168c2ecf20Sopenharmony_ci#endif
2178c2ecf20Sopenharmony_ci
2188c2ecf20Sopenharmony_ci/****************************************************************************/
2198c2ecf20Sopenharmony_ci
2208c2ecf20Sopenharmony_ci#ifdef __ASSEMBLER__
2218c2ecf20Sopenharmony_ci#ifdef CONFIG_M5249C3
2228c2ecf20Sopenharmony_ci/*
2238c2ecf20Sopenharmony_ci *	The M5249C3 board needs a little help getting all its SIM devices
2248c2ecf20Sopenharmony_ci *	initialized at kernel start time. dBUG doesn't set much up, so
2258c2ecf20Sopenharmony_ci *	we need to do it manually.
2268c2ecf20Sopenharmony_ci */
2278c2ecf20Sopenharmony_ci.macro m5249c3_setup
2288c2ecf20Sopenharmony_ci	/*
2298c2ecf20Sopenharmony_ci	 *	Set MBAR1 and MBAR2, just incase they are not set.
2308c2ecf20Sopenharmony_ci	 */
2318c2ecf20Sopenharmony_ci	movel	#0x10000001,%a0
2328c2ecf20Sopenharmony_ci	movec	%a0,%MBAR			/* map MBAR region */
2338c2ecf20Sopenharmony_ci	subql	#1,%a0				/* get MBAR address in a0 */
2348c2ecf20Sopenharmony_ci
2358c2ecf20Sopenharmony_ci	movel	#0x80000001,%a1
2368c2ecf20Sopenharmony_ci	movec	%a1,#3086			/* map MBAR2 region */
2378c2ecf20Sopenharmony_ci	subql	#1,%a1				/* get MBAR2 address in a1 */
2388c2ecf20Sopenharmony_ci
2398c2ecf20Sopenharmony_ci	/*
2408c2ecf20Sopenharmony_ci	 *      Move secondary interrupts to their base (128).
2418c2ecf20Sopenharmony_ci	 */
2428c2ecf20Sopenharmony_ci	moveb	#MCFINTC2_VECBASE,%d0
2438c2ecf20Sopenharmony_ci	moveb	%d0,0x16b(%a1)			/* interrupt base register */
2448c2ecf20Sopenharmony_ci
2458c2ecf20Sopenharmony_ci	/*
2468c2ecf20Sopenharmony_ci	 *      Work around broken CSMR0/DRAM vector problem.
2478c2ecf20Sopenharmony_ci	 */
2488c2ecf20Sopenharmony_ci	movel	#0x001F0021,%d0			/* disable C/I bit */
2498c2ecf20Sopenharmony_ci	movel	%d0,0x84(%a0)			/* set CSMR0 */
2508c2ecf20Sopenharmony_ci
2518c2ecf20Sopenharmony_ci	/*
2528c2ecf20Sopenharmony_ci	 *	Disable the PLL firstly. (Who knows what state it is
2538c2ecf20Sopenharmony_ci	 *	in here!).
2548c2ecf20Sopenharmony_ci	 */
2558c2ecf20Sopenharmony_ci	movel	0x180(%a1),%d0			/* get current PLL value */
2568c2ecf20Sopenharmony_ci	andl	#0xfffffffe,%d0			/* PLL bypass first */
2578c2ecf20Sopenharmony_ci	movel	%d0,0x180(%a1)			/* set PLL register */
2588c2ecf20Sopenharmony_ci	nop
2598c2ecf20Sopenharmony_ci
2608c2ecf20Sopenharmony_ci#if CONFIG_CLOCK_FREQ == 140000000
2618c2ecf20Sopenharmony_ci	/*
2628c2ecf20Sopenharmony_ci	 *	Set initial clock frequency. This assumes M5249C3 board
2638c2ecf20Sopenharmony_ci	 *	is fitted with 11.2896MHz crystal. It will program the
2648c2ecf20Sopenharmony_ci	 *	PLL for 140MHz. Lets go fast :-)
2658c2ecf20Sopenharmony_ci	 */
2668c2ecf20Sopenharmony_ci	movel	#0x125a40f0,%d0			/* set for 140MHz */
2678c2ecf20Sopenharmony_ci	movel	%d0,0x180(%a1)			/* set PLL register */
2688c2ecf20Sopenharmony_ci	orl	#0x1,%d0
2698c2ecf20Sopenharmony_ci	movel	%d0,0x180(%a1)			/* set PLL register */
2708c2ecf20Sopenharmony_ci#endif
2718c2ecf20Sopenharmony_ci
2728c2ecf20Sopenharmony_ci	/*
2738c2ecf20Sopenharmony_ci	 *	Setup CS1 for ethernet controller.
2748c2ecf20Sopenharmony_ci	 *	(Setup as per M5249C3 doco).
2758c2ecf20Sopenharmony_ci	 */
2768c2ecf20Sopenharmony_ci	movel  #0xe0000000,%d0			/* CS1 mapped at 0xe0000000 */
2778c2ecf20Sopenharmony_ci	movel  %d0,0x8c(%a0)
2788c2ecf20Sopenharmony_ci	movel  #0x001f0021,%d0			/* CS1 size of 1Mb */
2798c2ecf20Sopenharmony_ci	movel  %d0,0x90(%a0)
2808c2ecf20Sopenharmony_ci	movew  #0x0080,%d0			/* CS1 = 16bit port, AA */
2818c2ecf20Sopenharmony_ci	movew  %d0,0x96(%a0)
2828c2ecf20Sopenharmony_ci
2838c2ecf20Sopenharmony_ci	/*
2848c2ecf20Sopenharmony_ci	 *	Setup CS2 for IDE interface.
2858c2ecf20Sopenharmony_ci	 */
2868c2ecf20Sopenharmony_ci	movel	#0x50000000,%d0			/* CS2 mapped at 0x50000000 */
2878c2ecf20Sopenharmony_ci	movel	%d0,0x98(%a0)
2888c2ecf20Sopenharmony_ci	movel	#0x001f0001,%d0			/* CS2 size of 1MB */
2898c2ecf20Sopenharmony_ci	movel	%d0,0x9c(%a0)
2908c2ecf20Sopenharmony_ci	movew	#0x0080,%d0			/* CS2 = 16bit, TA */
2918c2ecf20Sopenharmony_ci	movew	%d0,0xa2(%a0)
2928c2ecf20Sopenharmony_ci
2938c2ecf20Sopenharmony_ci	movel	#0x00107000,%d0			/* IDEconfig1 */
2948c2ecf20Sopenharmony_ci	movel	%d0,0x18c(%a1)
2958c2ecf20Sopenharmony_ci	movel	#0x000c0400,%d0			/* IDEconfig2 */
2968c2ecf20Sopenharmony_ci	movel	%d0,0x190(%a1)
2978c2ecf20Sopenharmony_ci
2988c2ecf20Sopenharmony_ci	movel	#0x00080000,%d0			/* GPIO19, IDE reset bit */
2998c2ecf20Sopenharmony_ci	orl	%d0,0xc(%a1)			/* function GPIO19 */
3008c2ecf20Sopenharmony_ci	orl	%d0,0x8(%a1)			/* enable GPIO19 as output */
3018c2ecf20Sopenharmony_ci        orl	%d0,0x4(%a1)			/* de-assert IDE reset */
3028c2ecf20Sopenharmony_ci.endm
3038c2ecf20Sopenharmony_ci
3048c2ecf20Sopenharmony_ci#define	PLATFORM_SETUP	m5249c3_setup
3058c2ecf20Sopenharmony_ci
3068c2ecf20Sopenharmony_ci#endif /* CONFIG_M5249C3 */
3078c2ecf20Sopenharmony_ci#endif /* __ASSEMBLER__ */
3088c2ecf20Sopenharmony_ci/****************************************************************************/
3098c2ecf20Sopenharmony_ci#endif	/* m525xsim_h */
310