Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
Yoshinori Sato | f36af3fd | 2006-11-05 16:21:09 +0900 | [diff] [blame] | 2 | /* |
| 3 | * |
| 4 | * linux/arch/sh/boards/se/7206/setup.c |
| 5 | * |
| 6 | * Copyright (C) 2006 Yoshinori Sato |
Paul Mundt | f11c9c2 | 2008-05-09 14:13:17 +0900 | [diff] [blame] | 7 | * Copyright (C) 2007 - 2008 Paul Mundt |
Yoshinori Sato | f36af3fd | 2006-11-05 16:21:09 +0900 | [diff] [blame] | 8 | * |
| 9 | * Hitachi 7206 SolutionEngine Support. |
Yoshinori Sato | f36af3fd | 2006-11-05 16:21:09 +0900 | [diff] [blame] | 10 | */ |
Yoshinori Sato | f36af3fd | 2006-11-05 16:21:09 +0900 | [diff] [blame] | 11 | #include <linux/init.h> |
| 12 | #include <linux/platform_device.h> |
Paul Mundt | f11c9c2 | 2008-05-09 14:13:17 +0900 | [diff] [blame] | 13 | #include <linux/smc91x.h> |
Paul Mundt | 939a24a | 2008-07-29 21:41:37 +0900 | [diff] [blame] | 14 | #include <mach-se/mach/se7206.h> |
Paul Mundt | 710ee0c | 2006-11-05 16:48:42 +0900 | [diff] [blame] | 15 | #include <asm/io.h> |
Yoshinori Sato | f36af3fd | 2006-11-05 16:21:09 +0900 | [diff] [blame] | 16 | #include <asm/machvec.h> |
Paul Mundt | 8786c95 | 2007-08-20 13:03:41 +0900 | [diff] [blame] | 17 | #include <asm/heartbeat.h> |
Yoshinori Sato | f36af3fd | 2006-11-05 16:21:09 +0900 | [diff] [blame] | 18 | |
| 19 | static struct resource smc91x_resources[] = { |
| 20 | [0] = { |
Paul Mundt | f11c9c2 | 2008-05-09 14:13:17 +0900 | [diff] [blame] | 21 | .name = "smc91x-regs", |
| 22 | .start = PA_SMSC + 0x300, |
| 23 | .end = PA_SMSC + 0x300 + 0x020 - 1, |
Yoshinori Sato | f36af3fd | 2006-11-05 16:21:09 +0900 | [diff] [blame] | 24 | .flags = IORESOURCE_MEM, |
| 25 | }, |
| 26 | [1] = { |
| 27 | .start = 64, |
| 28 | .end = 64, |
| 29 | .flags = IORESOURCE_IRQ, |
| 30 | }, |
| 31 | }; |
| 32 | |
Paul Mundt | f11c9c2 | 2008-05-09 14:13:17 +0900 | [diff] [blame] | 33 | static struct smc91x_platdata smc91x_info = { |
| 34 | .flags = SMC91X_USE_16BIT, |
| 35 | }; |
| 36 | |
Yoshinori Sato | f36af3fd | 2006-11-05 16:21:09 +0900 | [diff] [blame] | 37 | static struct platform_device smc91x_device = { |
| 38 | .name = "smc91x", |
| 39 | .id = -1, |
Paul Mundt | f11c9c2 | 2008-05-09 14:13:17 +0900 | [diff] [blame] | 40 | .dev = { |
| 41 | .dma_mask = NULL, |
| 42 | .coherent_dma_mask = 0xffffffff, |
| 43 | .platform_data = &smc91x_info, |
| 44 | }, |
Yoshinori Sato | f36af3fd | 2006-11-05 16:21:09 +0900 | [diff] [blame] | 45 | .num_resources = ARRAY_SIZE(smc91x_resources), |
| 46 | .resource = smc91x_resources, |
| 47 | }; |
| 48 | |
Paul Mundt | 3b4d953 | 2007-02-13 15:42:28 +0900 | [diff] [blame] | 49 | static unsigned char heartbeat_bit_pos[] = { 8, 9, 10, 11, 12, 13, 14, 15 }; |
| 50 | |
Paul Mundt | 8786c95 | 2007-08-20 13:03:41 +0900 | [diff] [blame] | 51 | static struct heartbeat_data heartbeat_data = { |
| 52 | .bit_pos = heartbeat_bit_pos, |
| 53 | .nr_bits = ARRAY_SIZE(heartbeat_bit_pos), |
| 54 | }; |
| 55 | |
Paul Mundt | a09d283 | 2010-01-15 12:24:34 +0900 | [diff] [blame] | 56 | static struct resource heartbeat_resource = { |
| 57 | .start = PA_LED, |
| 58 | .end = PA_LED, |
| 59 | .flags = IORESOURCE_MEM | IORESOURCE_MEM_32BIT, |
Paul Mundt | 3b4d953 | 2007-02-13 15:42:28 +0900 | [diff] [blame] | 60 | }; |
| 61 | |
| 62 | static struct platform_device heartbeat_device = { |
| 63 | .name = "heartbeat", |
| 64 | .id = -1, |
| 65 | .dev = { |
Paul Mundt | a1fd306 | 2007-08-23 15:11:44 +0900 | [diff] [blame] | 66 | .platform_data = &heartbeat_data, |
Paul Mundt | 3b4d953 | 2007-02-13 15:42:28 +0900 | [diff] [blame] | 67 | }, |
Paul Mundt | a09d283 | 2010-01-15 12:24:34 +0900 | [diff] [blame] | 68 | .num_resources = 1, |
| 69 | .resource = &heartbeat_resource, |
Paul Mundt | 3b4d953 | 2007-02-13 15:42:28 +0900 | [diff] [blame] | 70 | }; |
| 71 | |
| 72 | static struct platform_device *se7206_devices[] __initdata = { |
| 73 | &smc91x_device, |
| 74 | &heartbeat_device, |
| 75 | }; |
| 76 | |
Yoshinori Sato | f36af3fd | 2006-11-05 16:21:09 +0900 | [diff] [blame] | 77 | static int __init se7206_devices_setup(void) |
| 78 | { |
Paul Mundt | 3b4d953 | 2007-02-13 15:42:28 +0900 | [diff] [blame] | 79 | return platform_add_devices(se7206_devices, ARRAY_SIZE(se7206_devices)); |
Yoshinori Sato | f36af3fd | 2006-11-05 16:21:09 +0900 | [diff] [blame] | 80 | } |
Nobuhiro Iwamatsu | 95d210c | 2011-01-07 03:02:15 +0000 | [diff] [blame] | 81 | device_initcall(se7206_devices_setup); |
Yoshinori Sato | f36af3fd | 2006-11-05 16:21:09 +0900 | [diff] [blame] | 82 | |
Paul Mundt | 16b2592 | 2010-11-01 12:18:48 -0400 | [diff] [blame] | 83 | static int se7206_mode_pins(void) |
| 84 | { |
| 85 | return MODE_PIN1 | MODE_PIN2; |
| 86 | } |
| 87 | |
Yoshinori Sato | f36af3fd | 2006-11-05 16:21:09 +0900 | [diff] [blame] | 88 | /* |
| 89 | * The Machine Vector |
| 90 | */ |
| 91 | |
Paul Mundt | 82f81f4 | 2007-05-15 15:19:34 +0900 | [diff] [blame] | 92 | static struct sh_machine_vector mv_se __initmv = { |
Yoshinori Sato | f36af3fd | 2006-11-05 16:21:09 +0900 | [diff] [blame] | 93 | .mv_name = "SolutionEngine", |
Yoshinori Sato | f36af3fd | 2006-11-05 16:21:09 +0900 | [diff] [blame] | 94 | .mv_init_irq = init_se7206_IRQ, |
Paul Mundt | 16b2592 | 2010-11-01 12:18:48 -0400 | [diff] [blame] | 95 | .mv_mode_pins = se7206_mode_pins, |
Yoshinori Sato | f36af3fd | 2006-11-05 16:21:09 +0900 | [diff] [blame] | 96 | }; |