2019-06-04 11:11:33 +03:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
2010-12-16 22:51:30 +03:00
|
|
|
/*
|
|
|
|
* linux/arch/arm/mach-sa1100/nanoengine.c
|
|
|
|
*
|
|
|
|
* Bright Star Engineering's nanoEngine board init code.
|
|
|
|
*
|
2010-10-19 01:41:29 +04:00
|
|
|
* Copyright (C) 2010 Marcelo Roberto Jimenez <mroberto@cpti.cetuc.puc-rio.br>
|
2010-12-16 22:51:30 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/init.h>
|
2016-08-31 10:49:48 +03:00
|
|
|
#include <linux/gpio/machine.h>
|
2010-12-16 22:51:30 +03:00
|
|
|
#include <linux/kernel.h>
|
2012-09-21 13:18:58 +04:00
|
|
|
#include <linux/platform_data/sa11x0-serial.h>
|
2010-12-16 22:51:30 +03:00
|
|
|
#include <linux/mtd/mtd.h>
|
|
|
|
#include <linux/mtd/partitions.h>
|
|
|
|
#include <linux/root_dev.h>
|
|
|
|
|
|
|
|
#include <asm/mach-types.h>
|
|
|
|
#include <asm/setup.h>
|
2012-01-03 21:12:48 +04:00
|
|
|
#include <asm/page.h>
|
2010-12-16 22:51:30 +03:00
|
|
|
|
|
|
|
#include <asm/mach/arch.h>
|
|
|
|
#include <asm/mach/flash.h>
|
|
|
|
#include <asm/mach/map.h>
|
|
|
|
|
|
|
|
#include <mach/hardware.h>
|
2010-12-16 23:34:51 +03:00
|
|
|
#include <mach/nanoengine.h>
|
2012-02-24 03:06:51 +04:00
|
|
|
#include <mach/irqs.h>
|
2010-12-16 22:51:30 +03:00
|
|
|
|
|
|
|
#include "generic.h"
|
|
|
|
|
|
|
|
/* Flash bank 0 */
|
|
|
|
static struct mtd_partition nanoengine_partitions[] = {
|
|
|
|
{
|
|
|
|
.name = "nanoEngine boot firmware and parameter table",
|
|
|
|
.size = 0x00010000, /* 32K */
|
|
|
|
.offset = 0,
|
|
|
|
.mask_flags = MTD_WRITEABLE,
|
|
|
|
}, {
|
|
|
|
.name = "kernel/initrd reserved",
|
|
|
|
.size = 0x002f0000,
|
|
|
|
.offset = 0x00010000,
|
|
|
|
.mask_flags = MTD_WRITEABLE,
|
|
|
|
}, {
|
|
|
|
.name = "experimental filesystem allocation",
|
|
|
|
.size = 0x00100000,
|
|
|
|
.offset = 0x00300000,
|
|
|
|
.mask_flags = MTD_WRITEABLE,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct flash_platform_data nanoengine_flash_data = {
|
|
|
|
.map_name = "jedec_probe",
|
|
|
|
.parts = nanoengine_partitions,
|
|
|
|
.nr_parts = ARRAY_SIZE(nanoengine_partitions),
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct resource nanoengine_flash_resources[] = {
|
2012-01-12 14:25:29 +04:00
|
|
|
DEFINE_RES_MEM(SA1100_CS0_PHYS, SZ_32M),
|
|
|
|
DEFINE_RES_MEM(SA1100_CS1_PHYS, SZ_32M),
|
2010-12-16 22:51:30 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct map_desc nanoengine_io_desc[] __initdata = {
|
|
|
|
{
|
|
|
|
/* System Registers */
|
|
|
|
.virtual = 0xf0000000,
|
|
|
|
.pfn = __phys_to_pfn(0x10000000),
|
|
|
|
.length = 0x00100000,
|
|
|
|
.type = MT_DEVICE
|
2010-12-16 23:34:51 +03:00
|
|
|
}, {
|
|
|
|
/* Internal PCI Memory Read/Write */
|
|
|
|
.virtual = NANO_PCI_MEM_RW_VIRT,
|
|
|
|
.pfn = __phys_to_pfn(NANO_PCI_MEM_RW_PHYS),
|
|
|
|
.length = NANO_PCI_MEM_RW_SIZE,
|
|
|
|
.type = MT_DEVICE
|
2010-12-16 22:51:30 +03:00
|
|
|
}, {
|
|
|
|
/* Internal PCI Config Space */
|
2010-12-16 23:34:51 +03:00
|
|
|
.virtual = NANO_PCI_CONFIG_SPACE_VIRT,
|
|
|
|
.pfn = __phys_to_pfn(NANO_PCI_CONFIG_SPACE_PHYS),
|
|
|
|
.length = NANO_PCI_CONFIG_SPACE_SIZE,
|
2010-12-16 22:51:30 +03:00
|
|
|
.type = MT_DEVICE
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
static void __init nanoengine_map_io(void)
|
|
|
|
{
|
|
|
|
sa1100_map_io();
|
|
|
|
iotable_init(nanoengine_io_desc, ARRAY_SIZE(nanoengine_io_desc));
|
|
|
|
|
|
|
|
sa1100_register_uart(0, 1);
|
|
|
|
sa1100_register_uart(1, 2);
|
|
|
|
sa1100_register_uart(2, 3);
|
|
|
|
Ser1SDCR0 |= SDCR0_UART;
|
|
|
|
/* disable IRDA -- UART2 is used as a normal serial port */
|
|
|
|
Ser2UTCR4 = 0;
|
|
|
|
Ser2HSCR0 = 0;
|
|
|
|
}
|
|
|
|
|
2016-08-31 10:49:48 +03:00
|
|
|
static struct gpiod_lookup_table nanoengine_pcmcia0_gpio_table = {
|
|
|
|
.dev_id = "sa11x0-pcmcia.0",
|
|
|
|
.table = {
|
|
|
|
GPIO_LOOKUP("gpio", 11, "ready", GPIO_ACTIVE_HIGH),
|
|
|
|
GPIO_LOOKUP("gpio", 13, "detect", GPIO_ACTIVE_LOW),
|
|
|
|
GPIO_LOOKUP("gpio", 15, "reset", GPIO_ACTIVE_HIGH),
|
|
|
|
{ },
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct gpiod_lookup_table nanoengine_pcmcia1_gpio_table = {
|
|
|
|
.dev_id = "sa11x0-pcmcia.1",
|
|
|
|
.table = {
|
|
|
|
GPIO_LOOKUP("gpio", 12, "ready", GPIO_ACTIVE_HIGH),
|
|
|
|
GPIO_LOOKUP("gpio", 14, "detect", GPIO_ACTIVE_LOW),
|
|
|
|
GPIO_LOOKUP("gpio", 16, "reset", GPIO_ACTIVE_HIGH),
|
|
|
|
{ },
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2010-12-16 22:51:30 +03:00
|
|
|
static void __init nanoengine_init(void)
|
|
|
|
{
|
2016-08-31 10:49:48 +03:00
|
|
|
sa11x0_register_pcmcia(0, &nanoengine_pcmcia0_gpio_table);
|
|
|
|
sa11x0_register_pcmcia(1, &nanoengine_pcmcia1_gpio_table);
|
2010-12-16 22:51:30 +03:00
|
|
|
sa11x0_register_mtd(&nanoengine_flash_data, nanoengine_flash_resources,
|
|
|
|
ARRAY_SIZE(nanoengine_flash_resources));
|
|
|
|
}
|
|
|
|
|
|
|
|
MACHINE_START(NANOENGINE, "BSE nanoEngine")
|
2011-07-06 06:38:17 +04:00
|
|
|
.atag_offset = 0x100,
|
2010-12-16 22:51:30 +03:00
|
|
|
.map_io = nanoengine_map_io,
|
2012-02-24 03:06:51 +04:00
|
|
|
.nr_irqs = SA1100_NR_IRQS,
|
2010-12-16 22:51:30 +03:00
|
|
|
.init_irq = sa1100_init_irq,
|
2012-11-08 23:40:59 +04:00
|
|
|
.init_time = sa1100_timer_init,
|
2010-12-16 22:51:30 +03:00
|
|
|
.init_machine = nanoengine_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,
|
2010-12-16 22:51:30 +03:00
|
|
|
MACHINE_END
|