Path: blob/master/arch/sh/boards/mach-rsk/devices-rsk7203.c
26481 views
// SPDX-License-Identifier: GPL-2.01/*2* Renesas Technology Europe RSK+ 7203 Support.3*4* Copyright (C) 2008 - 2010 Paul Mundt5*/6#include <linux/init.h>7#include <linux/types.h>8#include <linux/platform_device.h>9#include <linux/interrupt.h>10#include <linux/smsc911x.h>11#include <linux/input.h>12#include <linux/gpio.h>13#include <linux/gpio_keys.h>14#include <linux/leds.h>15#include <asm/machvec.h>16#include <asm/io.h>17#include <cpu/sh7203.h>1819static struct smsc911x_platform_config smsc911x_config = {20.phy_interface = PHY_INTERFACE_MODE_MII,21.irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,22.irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,23.flags = SMSC911X_USE_32BIT | SMSC911X_SWAP_FIFO,24};2526static struct resource smsc911x_resources[] = {27[0] = {28.start = 0x24000000,29.end = 0x240000ff,30.flags = IORESOURCE_MEM,31},32[1] = {33.start = 64,34.end = 64,35.flags = IORESOURCE_IRQ,36},37};3839static struct platform_device smsc911x_device = {40.name = "smsc911x",41.id = -1,42.num_resources = ARRAY_SIZE(smsc911x_resources),43.resource = smsc911x_resources,44.dev = {45.platform_data = &smsc911x_config,46},47};4849static struct gpio_led rsk7203_gpio_leds[] = {50{51.name = "green",52.gpio = GPIO_PE10,53.active_low = 1,54}, {55.name = "orange",56.default_trigger = "nand-disk",57.gpio = GPIO_PE12,58.active_low = 1,59}, {60.name = "red:timer",61.default_trigger = "timer",62.gpio = GPIO_PC14,63.active_low = 1,64}, {65.name = "red:heartbeat",66.default_trigger = "heartbeat",67.gpio = GPIO_PE11,68.active_low = 1,69},70};7172static struct gpio_led_platform_data rsk7203_gpio_leds_info = {73.leds = rsk7203_gpio_leds,74.num_leds = ARRAY_SIZE(rsk7203_gpio_leds),75};7677static struct platform_device led_device = {78.name = "leds-gpio",79.id = -1,80.dev = {81.platform_data = &rsk7203_gpio_leds_info,82},83};8485static struct gpio_keys_button rsk7203_gpio_keys_table[] = {86{87.code = BTN_0,88.gpio = GPIO_PB0,89.active_low = 1,90.desc = "SW1",91}, {92.code = BTN_1,93.gpio = GPIO_PB1,94.active_low = 1,95.desc = "SW2",96}, {97.code = BTN_2,98.gpio = GPIO_PB2,99.active_low = 1,100.desc = "SW3",101},102};103104static struct gpio_keys_platform_data rsk7203_gpio_keys_info = {105.buttons = rsk7203_gpio_keys_table,106.nbuttons = ARRAY_SIZE(rsk7203_gpio_keys_table),107.poll_interval = 50, /* default to 50ms */108};109110static struct platform_device keys_device = {111.name = "gpio-keys-polled",112.dev = {113.platform_data = &rsk7203_gpio_keys_info,114},115};116117static struct platform_device *rsk7203_devices[] __initdata = {118&smsc911x_device,119&led_device,120&keys_device,121};122123static int __init rsk7203_devices_setup(void)124{125/* Select pins for SCIF0 */126gpio_request(GPIO_FN_TXD0, NULL);127gpio_request(GPIO_FN_RXD0, NULL);128129/* Setup LAN9118: CS1 in 16-bit Big Endian Mode, IRQ0 at Port B */130__raw_writel(0x36db0400, 0xfffc0008); /* CS1BCR */131gpio_request(GPIO_FN_IRQ0_PB, NULL);132133return platform_add_devices(rsk7203_devices,134ARRAY_SIZE(rsk7203_devices));135}136device_initcall(rsk7203_devices_setup);137138139