~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/sh/boards/mach-rsk/devices-rsk7203.c

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

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

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php