Path: blob/master/arch/sh/boards/mach-rsk/devices-rsk7203.c
15126 views
/*1* Renesas Technology Europe RSK+ 7203 Support.2*3* Copyright (C) 2008 - 2010 Paul Mundt4*5* This file is subject to the terms and conditions of the GNU General Public6* License. See the file "COPYING" in the main directory of this archive7* for more details.8*/9#include <linux/init.h>10#include <linux/types.h>11#include <linux/platform_device.h>12#include <linux/interrupt.h>13#include <linux/smsc911x.h>14#include <linux/input.h>15#include <linux/gpio.h>16#include <linux/gpio_keys.h>17#include <linux/leds.h>18#include <asm/machvec.h>19#include <asm/io.h>20#include <cpu/sh7203.h>2122static struct smsc911x_platform_config smsc911x_config = {23.phy_interface = PHY_INTERFACE_MODE_MII,24.irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,25.irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,26.flags = SMSC911X_USE_32BIT | SMSC911X_SWAP_FIFO,27};2829static struct resource smsc911x_resources[] = {30[0] = {31.start = 0x24000000,32.end = 0x240000ff,33.flags = IORESOURCE_MEM,34},35[1] = {36.start = 64,37.end = 64,38.flags = IORESOURCE_IRQ,39},40};4142static struct platform_device smsc911x_device = {43.name = "smsc911x",44.id = -1,45.num_resources = ARRAY_SIZE(smsc911x_resources),46.resource = smsc911x_resources,47.dev = {48.platform_data = &smsc911x_config,49},50};5152static struct gpio_led rsk7203_gpio_leds[] = {53{54.name = "green",55.gpio = GPIO_PE10,56.active_low = 1,57}, {58.name = "orange",59.default_trigger = "nand-disk",60.gpio = GPIO_PE12,61.active_low = 1,62}, {63.name = "red:timer",64.default_trigger = "timer",65.gpio = GPIO_PC14,66.active_low = 1,67}, {68.name = "red:heartbeat",69.default_trigger = "heartbeat",70.gpio = GPIO_PE11,71.active_low = 1,72},73};7475static struct gpio_led_platform_data rsk7203_gpio_leds_info = {76.leds = rsk7203_gpio_leds,77.num_leds = ARRAY_SIZE(rsk7203_gpio_leds),78};7980static struct platform_device led_device = {81.name = "leds-gpio",82.id = -1,83.dev = {84.platform_data = &rsk7203_gpio_leds_info,85},86};8788static struct gpio_keys_button rsk7203_gpio_keys_table[] = {89{90.code = BTN_0,91.gpio = GPIO_PB0,92.active_low = 1,93.desc = "SW1",94}, {95.code = BTN_1,96.gpio = GPIO_PB1,97.active_low = 1,98.desc = "SW2",99}, {100.code = BTN_2,101.gpio = GPIO_PB2,102.active_low = 1,103.desc = "SW3",104},105};106107static struct gpio_keys_platform_data rsk7203_gpio_keys_info = {108.buttons = rsk7203_gpio_keys_table,109.nbuttons = ARRAY_SIZE(rsk7203_gpio_keys_table),110.poll_interval = 50, /* default to 50ms */111};112113static struct platform_device keys_device = {114.name = "gpio-keys-polled",115.dev = {116.platform_data = &rsk7203_gpio_keys_info,117},118};119120static struct platform_device *rsk7203_devices[] __initdata = {121&smsc911x_device,122&led_device,123&keys_device,124};125126static int __init rsk7203_devices_setup(void)127{128/* Select pins for SCIF0 */129gpio_request(GPIO_FN_TXD0, NULL);130gpio_request(GPIO_FN_RXD0, NULL);131132/* Setup LAN9118: CS1 in 16-bit Big Endian Mode, IRQ0 at Port B */133__raw_writel(0x36db0400, 0xfffc0008); /* CS1BCR */134gpio_request(GPIO_FN_IRQ0_PB, NULL);135136return platform_add_devices(rsk7203_devices,137ARRAY_SIZE(rsk7203_devices));138}139device_initcall(rsk7203_devices_setup);140141142