Path: blob/master/arch/mips/emma/markeins/platform.c
10818 views
/*1* Copyright(C) MontaVista Software Inc, 20062*3* Author: dmitry pervushin <[email protected]>4*5* This program is free software; you can redistribute it and/or modify6* it under the terms of the GNU General Public License as published by7* the Free Software Foundation; either version 2 of the License, or8* (at your option) any later version.9*10* This program is distributed in the hope that it will be useful,11* but WITHOUT ANY WARRANTY; without even the implied warranty of12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13* GNU General Public License for more details.14*15* You should have received a copy of the GNU General Public License16* along with this program; if not, write to the Free Software17* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA18*/19#include <linux/init.h>20#include <linux/kernel.h>21#include <linux/types.h>22#include <linux/ioport.h>23#include <linux/serial_8250.h>24#include <linux/mtd/physmap.h>2526#include <asm/cpu.h>27#include <asm/bootinfo.h>28#include <asm/addrspace.h>29#include <asm/time.h>30#include <asm/bcache.h>31#include <asm/irq.h>32#include <asm/reboot.h>33#include <asm/traps.h>3435#include <asm/emma/emma2rh.h>363738#define I2C_EMMA2RH "emma2rh-iic" /* must be in sync with IIC driver */3940static struct resource i2c_emma_resources_0[] = {41{42.name = NULL,43.start = EMMA2RH_IRQ_PIIC0,44.end = EMMA2RH_IRQ_PIIC0,45.flags = IORESOURCE_IRQ46}, {47.name = NULL,48.start = EMMA2RH_PIIC0_BASE,49.end = EMMA2RH_PIIC0_BASE + 0x1000,50.flags = 051},52};5354struct resource i2c_emma_resources_1[] = {55{56.name = NULL,57.start = EMMA2RH_IRQ_PIIC1,58.end = EMMA2RH_IRQ_PIIC1,59.flags = IORESOURCE_IRQ60}, {61.name = NULL,62.start = EMMA2RH_PIIC1_BASE,63.end = EMMA2RH_PIIC1_BASE + 0x1000,64.flags = 065},66};6768struct resource i2c_emma_resources_2[] = {69{70.name = NULL,71.start = EMMA2RH_IRQ_PIIC2,72.end = EMMA2RH_IRQ_PIIC2,73.flags = IORESOURCE_IRQ74}, {75.name = NULL,76.start = EMMA2RH_PIIC2_BASE,77.end = EMMA2RH_PIIC2_BASE + 0x1000,78.flags = 079},80};8182struct platform_device i2c_emma_devices[] = {83[0] = {84.name = I2C_EMMA2RH,85.id = 0,86.resource = i2c_emma_resources_0,87.num_resources = ARRAY_SIZE(i2c_emma_resources_0),88},89[1] = {90.name = I2C_EMMA2RH,91.id = 1,92.resource = i2c_emma_resources_1,93.num_resources = ARRAY_SIZE(i2c_emma_resources_1),94},95[2] = {96.name = I2C_EMMA2RH,97.id = 2,98.resource = i2c_emma_resources_2,99.num_resources = ARRAY_SIZE(i2c_emma_resources_2),100},101};102103#define EMMA2RH_SERIAL_CLOCK 18544000104#define EMMA2RH_SERIAL_FLAGS UPF_BOOT_AUTOCONF | UPF_SKIP_TEST105106static struct plat_serial8250_port platform_serial_ports[] = {107[0] = {108.membase= (void __iomem*)KSEG1ADDR(EMMA2RH_PFUR0_BASE + 3),109.mapbase = EMMA2RH_PFUR0_BASE + 3,110.irq = EMMA2RH_IRQ_PFUR0,111.uartclk = EMMA2RH_SERIAL_CLOCK,112.regshift = 4,113.iotype = UPIO_MEM,114.flags = EMMA2RH_SERIAL_FLAGS,115}, [1] = {116.membase = (void __iomem*)KSEG1ADDR(EMMA2RH_PFUR1_BASE + 3),117.mapbase = EMMA2RH_PFUR1_BASE + 3,118.irq = EMMA2RH_IRQ_PFUR1,119.uartclk = EMMA2RH_SERIAL_CLOCK,120.regshift = 4,121.iotype = UPIO_MEM,122.flags = EMMA2RH_SERIAL_FLAGS,123}, [2] = {124.membase = (void __iomem*)KSEG1ADDR(EMMA2RH_PFUR2_BASE + 3),125.mapbase = EMMA2RH_PFUR2_BASE + 3,126.irq = EMMA2RH_IRQ_PFUR2,127.uartclk = EMMA2RH_SERIAL_CLOCK,128.regshift = 4,129.iotype = UPIO_MEM,130.flags = EMMA2RH_SERIAL_FLAGS,131}, [3] = {132.flags = 0,133},134};135136static struct platform_device serial_emma = {137.name = "serial8250",138.dev = {139.platform_data = &platform_serial_ports,140},141};142143static struct mtd_partition markeins_parts[] = {144[0] = {145.name = "RootFS",146.offset = 0x00000000,147.size = 0x00c00000,148},149[1] = {150.name = "boot code area",151.offset = MTDPART_OFS_APPEND,152.size = 0x00100000,153},154[2] = {155.name = "kernel image",156.offset = MTDPART_OFS_APPEND,157.size = 0x00300000,158},159[3] = {160.name = "RootFS2",161.offset = MTDPART_OFS_APPEND,162.size = 0x00c00000,163},164[4] = {165.name = "boot code area2",166.offset = MTDPART_OFS_APPEND,167.size = 0x00100000,168},169[5] = {170.name = "kernel image2",171.offset = MTDPART_OFS_APPEND,172.size = MTDPART_SIZ_FULL,173},174};175176static struct physmap_flash_data markeins_flash_data = {177.width = 2,178.nr_parts = ARRAY_SIZE(markeins_parts),179.parts = markeins_parts180};181182static struct resource markeins_flash_resource = {183.start = 0x1e000000,184.end = 0x02000000,185.flags = IORESOURCE_MEM186};187188static struct platform_device markeins_flash_device = {189.name = "physmap-flash",190.id = 0,191.dev = {192.platform_data = &markeins_flash_data,193},194.num_resources = 1,195.resource = &markeins_flash_resource,196};197198static struct platform_device *devices[] = {199i2c_emma_devices,200i2c_emma_devices + 1,201i2c_emma_devices + 2,202&serial_emma,203&markeins_flash_device,204};205206static int __init platform_devices_setup(void)207{208return platform_add_devices(devices, ARRAY_SIZE(devices));209}210211arch_initcall(platform_devices_setup);212213214