/*
* mackerel board support
*
* Copyright (C) 2010 Renesas Solutions Corp.
* Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
*
* based on ap4evb
* Copyright (C) 2010 Magnus Damm
* Copyright (C) 2008 Yoshihiro Shimoda
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/platform_device.h>
#include <linux/gpio.h>
#include <linux/input.h>
#include <linux/io.h>
#include <linux/i2c.h>
#include <linux/leds.h>
#include <linux/mfd/sh_mobile_sdhi.h>
#include <linux/mfd/tmio.h>
#include <linux/mmc/host.h>
#include <linux/mmc/sh_mmcif.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
#include <linux/mtd/physmap.h>
#include <linux/smsc911x.h>
#include <linux/sh_intc.h>
#include <linux/tca6416_keypad.h>
#include <linux/usb/r8a66597.h>
#include <video/sh_mobile_hdmi.h>
#include <video/sh_mobile_lcdc.h>
#include <media/sh_mobile_ceu.h>
#include <media/soc_camera.h>
#include <media/soc_camera_platform.h>
#include <sound/sh_fsi.h>
#include <mach/common.h>
#include <mach/sh7372.h>
#include <asm/mach/arch.h>
#include <asm/mach/time.h>
#include <asm/mach/map.h>
#include <asm/mach-types.h>
/*
* Address Interface BusWidth note
* ------------------------------------------------------------------
* 0x0000_0000 NOR Flash ROM (MCP) 16bit SW7 : bit1 = ON
* 0x0800_0000 user area -
* 0x1000_0000 NOR Flash ROM (MCP) 16bit SW7 : bit1 = OFF
* 0x1400_0000 Ether (LAN9220) 16bit
* 0x1600_0000 user area - cannot use with NAND
* 0x1800_0000 user area -
* 0x1A00_0000 -
* 0x4000_0000 LPDDR2-SDRAM (POP) 32bit
*/
/*
* CPU mode
*
* SW4 | Boot Area| Master | Remarks
* 1 | 2 | 3 | 4 | 5 | 6 | 8 | | Processor|
* ----+-----+-----+-----+-----+-----+-----+----------+----------+--------------
* ON | ON | OFF | ON | ON | OFF | OFF | External | System | External ROM
* ON | ON | ON | ON | ON | OFF | OFF | External | System | ROM Debug
* ON | ON | X | ON | OFF | OFF | OFF | Built-in | System | ROM Debug
* X | OFF | X | X | X | X | OFF | Built-in | System | MaskROM
* OFF | X | X | X | X | X | OFF | Built-in | System | MaskROM
* X | X | X | OFF | X | X | OFF | Built-in | System | MaskROM
* OFF | ON | OFF | X | X | OFF | ON | External | System | Standalone
* ON | OFF | OFF | X | X | OFF | ON | External | Realtime | Standalone
*/
/*
* NOR Flash ROM
*
* SW1 | SW2 | SW7 | NOR Flash ROM
* bit1 | bit1 bit2 | bit1 | Memory allocation
* ------+------------+------+------------------
* OFF | ON OFF | ON | Area 0
* OFF | ON OFF | OFF | Area 4
*/
/*
* SMSC 9220
*
* SW1 SMSC 9220
* -----------------------
* ON access disable
* OFF access enable
*/
/*
* NAND Flash ROM
*
* SW1 | SW2 | SW7 | NAND Flash ROM
* bit1 | bit1 bit2 | bit2 | Memory allocation
* ------+------------+------+------------------
* OFF | ON OFF | ON | FCE 0
* OFF | ON OFF | OFF | FCE 1
*/
/*
* External interrupt pin settings
*
* IRQX | pin setting | device | level
* ------+--------------------+--------------------+-------
* IRQ0 | ICR1A.IRQ0SA=0010 | SDHI2 card detect | Low
* IRQ6 | ICR1A.IRQ6SA=0011 | Ether(LAN9220) | High
* IRQ7 | ICR1A.IRQ7SA=0010 | LCD Tuch Panel | Low
* IRQ8 | ICR2A.IRQ8SA=0010 | MMC/SD card detect | Low
* IRQ9 | ICR2A.IRQ9SA=0010 | KEY(TCA6408) | Low
* IRQ21 | ICR4A.IRQ21SA=0011 | Sensor(ADXL345) | High
* IRQ22 | ICR4A.IRQ22SA=0011 | Sensor(AK8975) | High
*/
/*
* USB
*
* USB0 : CN22 : Function
* USB1 : CN31 : Function/Host *1
*
* J30 (for CN31) *1
* ----------+---------------+-------------
* 1-2 short | VBUS 5V | Host
* open | external VBUS | Function
*
* *1
* CN31 is used as Host in Linux.
*/
/*
* SDHI0 (CN12)
*
* SW56 : OFF
*
*/
/* MMC /SDHI1 (CN7)
*
* I/O voltage : 1.8v
*
* Power voltage : 1.8v or 3.3v
* J22 : select power voltage *1
* 1-2 pin : 1.8v
* 2-3 pin : 3.3v
*
* *1
* Please change J22 depends the card to be used.
* MMC's OCR field set to support either voltage for the card inserted.
*
* SW1 | SW33
* | bit1 | bit2 | bit3 | bit4
* -------------+------+------+------+-------
* MMC0 OFF | OFF | ON | ON | X
* MMC1 ON | OFF | ON | X | ON
* SDHI1 OFF | ON | X | OFF | ON
*
*/
/*
* SDHI2 (CN23)
*
* microSD card sloct
*
*/
/*
* FIXME !!
*
* gpio_no_direction
* are quick_hack.
*
* current gpio frame work doesn't have
* the method to control only pull up/down/free.
* this function should be replaced by correct gpio function
*/
static void __init gpio_no_direction(u32 addr)
{
__raw_writeb(0x00, addr);
}
/* MTD */
static struct mtd_partition nor_flash_partitions[] = {
{
.name = "loader",
.offset = 0x00000000,
.size = 512 * 1024,
.mask_flags = MTD_WRITEABLE,
},
{
.name = "bootenv",
.offset = MTDPART_OFS_APPEND,
.size = 512 * 1024,
.mask_flags = MTD_WRITEABLE,
},
{
.name