Path: blob/master/arch/sh/boards/mach-x3proto/setup.c
15126 views
/*1* arch/sh/boards/mach-x3proto/setup.c2*3* Renesas SH-X3 Prototype Board Support.4*5* Copyright (C) 2007 - 2010 Paul Mundt6*7* This file is subject to the terms and conditions of the GNU General Public8* License. See the file "COPYING" in the main directory of this archive9* for more details.10*/11#include <linux/init.h>12#include <linux/platform_device.h>13#include <linux/kernel.h>14#include <linux/io.h>15#include <linux/smc91x.h>16#include <linux/irq.h>17#include <linux/interrupt.h>18#include <linux/input.h>19#include <linux/usb/r8a66597.h>20#include <linux/usb/m66592.h>21#include <linux/gpio.h>22#include <linux/gpio_keys.h>23#include <mach/ilsel.h>24#include <mach/hardware.h>25#include <asm/smp-ops.h>2627static struct resource heartbeat_resources[] = {28[0] = {29.start = 0xb8140020,30.end = 0xb8140020,31.flags = IORESOURCE_MEM,32},33};3435static struct platform_device heartbeat_device = {36.name = "heartbeat",37.id = -1,38.num_resources = ARRAY_SIZE(heartbeat_resources),39.resource = heartbeat_resources,40};4142static struct smc91x_platdata smc91x_info = {43.flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,44};4546static struct resource smc91x_resources[] = {47[0] = {48.start = 0x18000300,49.end = 0x18000300 + 0x10 - 1,50.flags = IORESOURCE_MEM,51},52[1] = {53/* Filled in by ilsel */54.flags = IORESOURCE_IRQ,55},56};5758static struct platform_device smc91x_device = {59.name = "smc91x",60.id = -1,61.resource = smc91x_resources,62.num_resources = ARRAY_SIZE(smc91x_resources),63.dev = {64.platform_data = &smc91x_info,65},66};6768static struct r8a66597_platdata r8a66597_data = {69.xtal = R8A66597_PLATDATA_XTAL_12MHZ,70.vif = 1,71};7273static struct resource r8a66597_usb_host_resources[] = {74[0] = {75.start = 0x18040000,76.end = 0x18080000 - 1,77.flags = IORESOURCE_MEM,78},79[1] = {80/* Filled in by ilsel */81.flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,82},83};8485static struct platform_device r8a66597_usb_host_device = {86.name = "r8a66597_hcd",87.id = -1,88.dev = {89.dma_mask = NULL, /* don't use dma */90.coherent_dma_mask = 0xffffffff,91.platform_data = &r8a66597_data,92},93.num_resources = ARRAY_SIZE(r8a66597_usb_host_resources),94.resource = r8a66597_usb_host_resources,95};9697static struct m66592_platdata usbf_platdata = {98.xtal = M66592_PLATDATA_XTAL_24MHZ,99.vif = 1,100};101102static struct resource m66592_usb_peripheral_resources[] = {103[0] = {104.name = "m66592_udc",105.start = 0x18080000,106.end = 0x180c0000 - 1,107.flags = IORESOURCE_MEM,108},109[1] = {110.name = "m66592_udc",111/* Filled in by ilsel */112.flags = IORESOURCE_IRQ,113},114};115116static struct platform_device m66592_usb_peripheral_device = {117.name = "m66592_udc",118.id = -1,119.dev = {120.dma_mask = NULL, /* don't use dma */121.coherent_dma_mask = 0xffffffff,122.platform_data = &usbf_platdata,123},124.num_resources = ARRAY_SIZE(m66592_usb_peripheral_resources),125.resource = m66592_usb_peripheral_resources,126};127128static struct gpio_keys_button baseboard_buttons[NR_BASEBOARD_GPIOS] = {129{130.desc = "key44",131.code = KEY_POWER,132.active_low = 1,133.wakeup = 1,134}, {135.desc = "key43",136.code = KEY_SUSPEND,137.active_low = 1,138.wakeup = 1,139}, {140.desc = "key42",141.code = KEY_KATAKANAHIRAGANA,142.active_low = 1,143}, {144.desc = "key41",145.code = KEY_SWITCHVIDEOMODE,146.active_low = 1,147}, {148.desc = "key34",149.code = KEY_F12,150.active_low = 1,151}, {152.desc = "key33",153.code = KEY_F11,154.active_low = 1,155}, {156.desc = "key32",157.code = KEY_F10,158.active_low = 1,159}, {160.desc = "key31",161.code = KEY_F9,162.active_low = 1,163}, {164.desc = "key24",165.code = KEY_F8,166.active_low = 1,167}, {168.desc = "key23",169.code = KEY_F7,170.active_low = 1,171}, {172.desc = "key22",173.code = KEY_F6,174.active_low = 1,175}, {176.desc = "key21",177.code = KEY_F5,178.active_low = 1,179}, {180.desc = "key14",181.code = KEY_F4,182.active_low = 1,183}, {184.desc = "key13",185.code = KEY_F3,186.active_low = 1,187}, {188.desc = "key12",189.code = KEY_F2,190.active_low = 1,191}, {192.desc = "key11",193.code = KEY_F1,194.active_low = 1,195},196};197198static struct gpio_keys_platform_data baseboard_buttons_data = {199.buttons = baseboard_buttons,200.nbuttons = ARRAY_SIZE(baseboard_buttons),201};202203static struct platform_device baseboard_buttons_device = {204.name = "gpio-keys",205.id = -1,206.dev = {207.platform_data = &baseboard_buttons_data,208},209};210211static struct platform_device *x3proto_devices[] __initdata = {212&heartbeat_device,213&smc91x_device,214&r8a66597_usb_host_device,215&m66592_usb_peripheral_device,216&baseboard_buttons_device,217};218219static void __init x3proto_init_irq(void)220{221plat_irq_setup_pins(IRQ_MODE_IRL3210);222223/* Set ICR0.LVLMODE */224__raw_writel(__raw_readl(0xfe410000) | (1 << 21), 0xfe410000);225}226227static int __init x3proto_devices_setup(void)228{229int ret, i;230231/*232* IRLs are only needed for ILSEL mappings, so flip over the INTC233* pins at a later point to enable the GPIOs to settle.234*/235x3proto_init_irq();236237/*238* Now that ILSELs are available, set up the baseboard GPIOs.239*/240ret = x3proto_gpio_setup();241if (unlikely(ret))242return ret;243244/*245* Propagate dynamic GPIOs for the baseboard button device.246*/247for (i = 0; i < ARRAY_SIZE(baseboard_buttons); i++)248baseboard_buttons[i].gpio = x3proto_gpio_chip.base + i;249250r8a66597_usb_host_resources[1].start =251r8a66597_usb_host_resources[1].end = ilsel_enable(ILSEL_USBH_I);252253m66592_usb_peripheral_resources[1].start =254m66592_usb_peripheral_resources[1].end = ilsel_enable(ILSEL_USBP_I);255256smc91x_resources[1].start =257smc91x_resources[1].end = ilsel_enable(ILSEL_LAN);258259return platform_add_devices(x3proto_devices,260ARRAY_SIZE(x3proto_devices));261}262device_initcall(x3proto_devices_setup);263264static void __init x3proto_setup(char **cmdline_p)265{266register_smp_ops(&shx3_smp_ops);267}268269static struct sh_machine_vector mv_x3proto __initmv = {270.mv_name = "x3proto",271.mv_setup = x3proto_setup,272};273274275