2005-04-17 02:20:36 +04:00
|
|
|
/*
|
|
|
|
* linux/arch/arm/mach-sa1100/cerf.c
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* Apr-2003 : Removed some old PDA crud [FB]
|
|
|
|
* Oct-2003 : Added uart2 resource [FB]
|
|
|
|
* Jan-2004 : Removed io map for flash [FB]
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/init.h>
|
2016-08-31 10:49:47 +03:00
|
|
|
#include <linux/gpio/machine.h>
|
2005-04-17 02:20:36 +04:00
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/tty.h>
|
2012-09-21 13:18:58 +04:00
|
|
|
#include <linux/platform_data/sa11x0-serial.h>
|
2005-10-29 22:07:23 +04:00
|
|
|
#include <linux/platform_device.h>
|
2006-07-02 01:32:38 +04:00
|
|
|
#include <linux/irq.h>
|
2005-04-17 02:20:36 +04:00
|
|
|
#include <linux/mtd/mtd.h>
|
|
|
|
#include <linux/mtd/partitions.h>
|
2012-03-13 22:22:03 +04:00
|
|
|
#include <linux/gpio.h>
|
|
|
|
#include <linux/leds.h>
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2008-08-05 19:14:15 +04:00
|
|
|
#include <mach/hardware.h>
|
2005-04-17 02:20:36 +04:00
|
|
|
#include <asm/setup.h>
|
|
|
|
|
|
|
|
#include <asm/mach-types.h>
|
|
|
|
#include <asm/mach/arch.h>
|
|
|
|
#include <asm/mach/flash.h>
|
|
|
|
#include <asm/mach/map.h>
|
|
|
|
|
2008-08-05 19:14:15 +04:00
|
|
|
#include <mach/cerf.h>
|
2012-08-24 17:17:38 +04:00
|
|
|
#include <linux/platform_data/mfd-mcp-sa11x0.h>
|
2012-02-24 03:06:51 +04:00
|
|
|
#include <mach/irqs.h>
|
2005-04-17 02:20:36 +04:00
|
|
|
#include "generic.h"
|
|
|
|
|
|
|
|
static struct resource cerfuart2_resources[] = {
|
2012-01-12 14:25:29 +04:00
|
|
|
[0] = DEFINE_RES_MEM(0x80030000, SZ_64K),
|
2005-04-17 02:20:36 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device cerfuart2_device = {
|
|
|
|
.name = "sa11x0-uart",
|
|
|
|
.id = 2,
|
|
|
|
.num_resources = ARRAY_SIZE(cerfuart2_resources),
|
|
|
|
.resource = cerfuart2_resources,
|
|
|
|
};
|
|
|
|
|
2016-08-31 10:49:47 +03:00
|
|
|
/* Compact Flash */
|
|
|
|
static struct gpiod_lookup_table cerf_cf_gpio_table = {
|
|
|
|
.dev_id = "sa11x0-pcmcia.1",
|
|
|
|
.table = {
|
|
|
|
GPIO_LOOKUP("gpio", 19, "bvd2", GPIO_ACTIVE_HIGH),
|
|
|
|
GPIO_LOOKUP("gpio", 20, "bvd1", GPIO_ACTIVE_HIGH),
|
|
|
|
GPIO_LOOKUP("gpio", 21, "reset", GPIO_ACTIVE_HIGH),
|
|
|
|
GPIO_LOOKUP("gpio", 22, "ready", GPIO_ACTIVE_HIGH),
|
|
|
|
GPIO_LOOKUP("gpio", 23, "detect", GPIO_ACTIVE_LOW),
|
|
|
|
{ },
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2012-03-13 22:22:03 +04:00
|
|
|
/* LEDs */
|
|
|
|
struct gpio_led cerf_gpio_leds[] = {
|
|
|
|
{
|
|
|
|
.name = "cerf:d0",
|
|
|
|
.default_trigger = "heartbeat",
|
|
|
|
.gpio = 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "cerf:d1",
|
|
|
|
.default_trigger = "cpu0",
|
|
|
|
.gpio = 1,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "cerf:d2",
|
|
|
|
.default_trigger = "default-on",
|
|
|
|
.gpio = 2,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "cerf:d3",
|
|
|
|
.default_trigger = "default-on",
|
|
|
|
.gpio = 3,
|
|
|
|
},
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct gpio_led_platform_data cerf_gpio_led_info = {
|
|
|
|
.leds = cerf_gpio_leds,
|
|
|
|
.num_leds = ARRAY_SIZE(cerf_gpio_leds),
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device cerf_leds = {
|
|
|
|
.name = "leds-gpio",
|
|
|
|
.id = -1,
|
|
|
|
.dev = {
|
|
|
|
.platform_data = &cerf_gpio_led_info,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
static struct platform_device *cerf_devices[] __initdata = {
|
|
|
|
&cerfuart2_device,
|
2012-03-13 22:22:03 +04:00
|
|
|
&cerf_leds,
|
2005-04-17 02:20:36 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef CONFIG_SA1100_CERF_FLASH_32MB
|
|
|
|
# define CERF_FLASH_SIZE 0x02000000
|
|
|
|
#elif defined CONFIG_SA1100_CERF_FLASH_16MB
|
|
|
|
# define CERF_FLASH_SIZE 0x01000000
|
|
|
|
#elif defined CONFIG_SA1100_CERF_FLASH_8MB
|
|
|
|
# define CERF_FLASH_SIZE 0x00800000
|
|
|
|
#else
|
|
|
|
# error "Undefined flash size for CERF"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static struct mtd_partition cerf_partitions[] = {
|
|
|
|
{
|
|
|
|
.name = "Bootloader",
|
|
|
|
.size = 0x00020000,
|
|
|
|
.offset = 0x00000000,
|
|
|
|
}, {
|
|
|
|
.name = "Params",
|
|
|
|
.size = 0x00040000,
|
|
|
|
.offset = 0x00020000,
|
|
|
|
}, {
|
|
|
|
.name = "Kernel",
|
|
|
|
.size = 0x00100000,
|
|
|
|
.offset = 0x00060000,
|
|
|
|
}, {
|
|
|
|
.name = "Filesystem",
|
|
|
|
.size = CERF_FLASH_SIZE-0x00160000,
|
|
|
|
.offset = 0x00160000,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct flash_platform_data cerf_flash_data = {
|
|
|
|
.map_name = "cfi_probe",
|
|
|
|
.parts = cerf_partitions,
|
|
|
|
.nr_parts = ARRAY_SIZE(cerf_partitions),
|
|
|
|
};
|
|
|
|
|
2012-01-12 14:25:29 +04:00
|
|
|
static struct resource cerf_flash_resource =
|
|
|
|
DEFINE_RES_MEM(SA1100_CS0_PHYS, SZ_32M);
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
static void __init cerf_init_irq(void)
|
|
|
|
{
|
|
|
|
sa1100_init_irq();
|
2011-03-24 15:25:22 +03:00
|
|
|
irq_set_irq_type(CERF_ETH_IRQ, IRQ_TYPE_EDGE_RISING);
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static struct map_desc cerf_io_desc[] __initdata = {
|
2005-10-28 18:19:04 +04:00
|
|
|
{ /* Crystal Ethernet Chip */
|
|
|
|
.virtual = 0xf0000000,
|
|
|
|
.pfn = __phys_to_pfn(0x08000000),
|
|
|
|
.length = 0x00100000,
|
|
|
|
.type = MT_DEVICE
|
|
|
|
}
|
2005-04-17 02:20:36 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
static void __init cerf_map_io(void)
|
|
|
|
{
|
|
|
|
sa1100_map_io();
|
|
|
|
iotable_init(cerf_io_desc, ARRAY_SIZE(cerf_io_desc));
|
|
|
|
|
|
|
|
sa1100_register_uart(0, 3);
|
|
|
|
sa1100_register_uart(1, 2); /* disable this and the uart2 device for sa1100_fir */
|
|
|
|
sa1100_register_uart(2, 1);
|
|
|
|
}
|
|
|
|
|
2005-08-18 13:10:46 +04:00
|
|
|
static struct mcp_plat_data cerf_mcp_data = {
|
|
|
|
.mccr0 = MCCR0_ADM,
|
|
|
|
.sclk_rate = 11981000,
|
|
|
|
};
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
static void __init cerf_init(void)
|
|
|
|
{
|
2012-01-21 02:24:07 +04:00
|
|
|
sa11x0_ppc_configure_mcp();
|
2005-04-17 02:20:36 +04:00
|
|
|
platform_add_devices(cerf_devices, ARRAY_SIZE(cerf_devices));
|
2009-10-06 17:55:53 +04:00
|
|
|
sa11x0_register_mtd(&cerf_flash_data, &cerf_flash_resource, 1);
|
|
|
|
sa11x0_register_mcp(&cerf_mcp_data);
|
2016-08-31 10:49:47 +03:00
|
|
|
sa11x0_register_pcmcia(1, &cerf_cf_gpio_table);
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
MACHINE_START(CERF, "Intrinsyc CerfBoard/CerfCube")
|
2005-07-03 20:38:58 +04:00
|
|
|
/* Maintainer: support@intrinsyc.com */
|
|
|
|
.map_io = cerf_map_io,
|
2012-02-24 03:06:51 +04:00
|
|
|
.nr_irqs = SA1100_NR_IRQS,
|
2005-07-03 20:38:58 +04:00
|
|
|
.init_irq = cerf_init_irq,
|
2012-11-08 23:40:59 +04:00
|
|
|
.init_time = sa1100_timer_init,
|
2005-04-17 02:20:36 +04:00
|
|
|
.init_machine = cerf_init,
|
2012-04-26 17:22:45 +04:00
|
|
|
.init_late = sa11x0_init_late,
|
2011-11-05 14:28:50 +04:00
|
|
|
.restart = sa11x0_restart,
|
2005-04-17 02:20:36 +04:00
|
|
|
MACHINE_END
|