Path: blob/master/arch/m68k/platform/5272/config.c
10821 views
/***************************************************************************/12/*3* linux/arch/m68knommu/platform/5272/config.c4*5* Copyright (C) 1999-2002, Greg Ungerer ([email protected])6* Copyright (C) 2001-2002, SnapGear Inc. (www.snapgear.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 <linux/phy.h>16#include <linux/phy_fixed.h>17#include <asm/machdep.h>18#include <asm/coldfire.h>19#include <asm/mcfsim.h>20#include <asm/mcfuart.h>2122/***************************************************************************/2324/*25* Some platforms need software versions of the GPIO data registers.26*/27unsigned short ppdata;28unsigned char ledbank = 0xff;2930/***************************************************************************/3132static struct mcf_platform_uart m5272_uart_platform[] = {33{34.mapbase = MCF_MBAR + MCFUART_BASE1,35.irq = MCF_IRQ_UART1,36},37{38.mapbase = MCF_MBAR + MCFUART_BASE2,39.irq = MCF_IRQ_UART2,40},41{ },42};4344static struct platform_device m5272_uart = {45.name = "mcfuart",46.id = 0,47.dev.platform_data = m5272_uart_platform,48};4950static struct resource m5272_fec_resources[] = {51{52.start = MCF_MBAR + 0x840,53.end = MCF_MBAR + 0x840 + 0x1cf,54.flags = IORESOURCE_MEM,55},56{57.start = MCF_IRQ_ERX,58.end = MCF_IRQ_ERX,59.flags = IORESOURCE_IRQ,60},61{62.start = MCF_IRQ_ETX,63.end = MCF_IRQ_ETX,64.flags = IORESOURCE_IRQ,65},66{67.start = MCF_IRQ_ENTC,68.end = MCF_IRQ_ENTC,69.flags = IORESOURCE_IRQ,70},71};7273static struct platform_device m5272_fec = {74.name = "fec",75.id = 0,76.num_resources = ARRAY_SIZE(m5272_fec_resources),77.resource = m5272_fec_resources,78};7980static struct platform_device *m5272_devices[] __initdata = {81&m5272_uart,82&m5272_fec,83};8485/***************************************************************************/8687static void __init m5272_uart_init_line(int line, int irq)88{89u32 v;9091if ((line >= 0) && (line < 2)) {92/* Enable the output lines for the serial ports */93v = readl(MCF_MBAR + MCFSIM_PBCNT);94v = (v & ~0x000000ff) | 0x00000055;95writel(v, MCF_MBAR + MCFSIM_PBCNT);9697v = readl(MCF_MBAR + MCFSIM_PDCNT);98v = (v & ~0x000003fc) | 0x000002a8;99writel(v, MCF_MBAR + MCFSIM_PDCNT);100}101}102103static void __init m5272_uarts_init(void)104{105const int nrlines = ARRAY_SIZE(m5272_uart_platform);106int line;107108for (line = 0; (line < nrlines); line++)109m5272_uart_init_line(line, m5272_uart_platform[line].irq);110}111112/***************************************************************************/113114static void m5272_cpu_reset(void)115{116local_irq_disable();117/* Set watchdog to reset, and enabled */118__raw_writew(0, MCF_MBAR + MCFSIM_WIRR);119__raw_writew(1, MCF_MBAR + MCFSIM_WRRR);120__raw_writew(0, MCF_MBAR + MCFSIM_WCR);121for (;;)122/* wait for watchdog to timeout */;123}124125/***************************************************************************/126127void __init config_BSP(char *commandp, int size)128{129#if defined (CONFIG_MOD5272)130volatile unsigned char *pivrp;131132/* Set base of device vectors to be 64 */133pivrp = (volatile unsigned char *) (MCF_MBAR + MCFSIM_PIVR);134*pivrp = 0x40;135#endif136137#if defined(CONFIG_NETtel) || defined(CONFIG_SCALES)138/* Copy command line from FLASH to local buffer... */139memcpy(commandp, (char *) 0xf0004000, size);140commandp[size-1] = 0;141#elif defined(CONFIG_CANCam)142/* Copy command line from FLASH to local buffer... */143memcpy(commandp, (char *) 0xf0010000, size);144commandp[size-1] = 0;145#endif146147mach_reset = m5272_cpu_reset;148}149150/***************************************************************************/151152/*153* Some 5272 based boards have the FEC ethernet diectly connected to154* an ethernet switch. In this case we need to use the fixed phy type,155* and we need to declare it early in boot.156*/157static struct fixed_phy_status nettel_fixed_phy_status __initdata = {158.link = 1,159.speed = 100,160.duplex = 0,161};162163/***************************************************************************/164165static int __init init_BSP(void)166{167m5272_uarts_init();168fixed_phy_add(PHY_POLL, 0, &nettel_fixed_phy_status);169platform_add_devices(m5272_devices, ARRAY_SIZE(m5272_devices));170return 0;171}172173arch_initcall(init_BSP);174175/***************************************************************************/176177178