Path: blob/master/arch/m68k/platform/5307/config.c
10819 views
/***************************************************************************/12/*3* linux/arch/m68knommu/platform/5307/config.c4*5* Copyright (C) 1999-2002, Greg Ungerer ([email protected])6* Copyright (C) 2000, Lineo (www.lineo.com)7*/89/***************************************************************************/1011#include <linux/kernel.h>12#include <linux/param.h>13#include <linux/init.h>14#include <linux/io.h>15#include <asm/machdep.h>16#include <asm/coldfire.h>17#include <asm/mcfsim.h>18#include <asm/mcfuart.h>19#include <asm/mcfwdebug.h>2021/***************************************************************************/2223/*24* Some platforms need software versions of the GPIO data registers.25*/26unsigned short ppdata;27unsigned char ledbank = 0xff;2829/***************************************************************************/3031static struct mcf_platform_uart m5307_uart_platform[] = {32{33.mapbase = MCF_MBAR + MCFUART_BASE1,34.irq = 73,35},36{37.mapbase = MCF_MBAR + MCFUART_BASE2,38.irq = 74,39},40{ },41};4243static struct platform_device m5307_uart = {44.name = "mcfuart",45.id = 0,46.dev.platform_data = m5307_uart_platform,47};4849static struct platform_device *m5307_devices[] __initdata = {50&m5307_uart,51};5253/***************************************************************************/5455static void __init m5307_uart_init_line(int line, int irq)56{57if (line == 0) {58writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR);59writeb(irq, MCF_MBAR + MCFUART_BASE1 + MCFUART_UIVR);60mcf_mapirq2imr(irq, MCFINTC_UART0);61} else if (line == 1) {62writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR);63writeb(irq, MCF_MBAR + MCFUART_BASE2 + MCFUART_UIVR);64mcf_mapirq2imr(irq, MCFINTC_UART1);65}66}6768static void __init m5307_uarts_init(void)69{70const int nrlines = ARRAY_SIZE(m5307_uart_platform);71int line;7273for (line = 0; (line < nrlines); line++)74m5307_uart_init_line(line, m5307_uart_platform[line].irq);75}7677/***************************************************************************/7879static void __init m5307_timers_init(void)80{81/* Timer1 is always used as system timer */82writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI3,83MCF_MBAR + MCFSIM_TIMER1ICR);84mcf_mapirq2imr(MCF_IRQ_TIMER, MCFINTC_TIMER1);8586#ifdef CONFIG_HIGHPROFILE87/* Timer2 is to be used as a high speed profile timer */88writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL7 | MCFSIM_ICR_PRI3,89MCF_MBAR + MCFSIM_TIMER2ICR);90mcf_mapirq2imr(MCF_IRQ_PROFILER, MCFINTC_TIMER2);91#endif92}9394/***************************************************************************/9596void m5307_cpu_reset(void)97{98local_irq_disable();99/* Set watchdog to soft reset, and enabled */100__raw_writeb(0xc0, MCF_MBAR + MCFSIM_SYPCR);101for (;;)102/* wait for watchdog to timeout */;103}104105/***************************************************************************/106107void __init config_BSP(char *commandp, int size)108{109#if defined(CONFIG_NETtel) || \110defined(CONFIG_SECUREEDGEMP3) || defined(CONFIG_CLEOPATRA)111/* Copy command line from FLASH to local buffer... */112memcpy(commandp, (char *) 0xf0004000, size);113commandp[size-1] = 0;114#endif115116mach_reset = m5307_cpu_reset;117m5307_timers_init();118m5307_uarts_init();119120/* Only support the external interrupts on their primary level */121mcf_mapirq2imr(25, MCFINTC_EINT1);122mcf_mapirq2imr(27, MCFINTC_EINT3);123mcf_mapirq2imr(29, MCFINTC_EINT5);124mcf_mapirq2imr(31, MCFINTC_EINT7);125126#ifdef CONFIG_BDM_DISABLE127/*128* Disable the BDM clocking. This also turns off most of the rest of129* the BDM device. This is good for EMC reasons. This option is not130* incompatible with the memory protection option.131*/132wdebug(MCFDEBUG_CSR, MCFDEBUG_CSR_PSTCLK);133#endif134}135136/***************************************************************************/137138static int __init init_BSP(void)139{140platform_add_devices(m5307_devices, ARRAY_SIZE(m5307_devices));141return 0;142}143144arch_initcall(init_BSP);145146/***************************************************************************/147148149