Paul Mundt | 94807a3 | 2007-08-08 15:22:04 +0900 | [diff] [blame] | 1 | /* |
| 2 | * arch/sh/boards/renesas/x3proto/setup.c |
| 3 | * |
| 4 | * Renesas SH-X3 Prototype Board Support. |
| 5 | * |
Paul Mundt | e77eb36 | 2008-08-05 13:16:56 +0900 | [diff] [blame] | 6 | * Copyright (C) 2007 - 2008 Paul Mundt |
Paul Mundt | 94807a3 | 2007-08-08 15:22:04 +0900 | [diff] [blame] | 7 | * |
| 8 | * This file is subject to the terms and conditions of the GNU General Public |
| 9 | * License. See the file "COPYING" in the main directory of this archive |
| 10 | * for more details. |
| 11 | */ |
| 12 | #include <linux/init.h> |
| 13 | #include <linux/platform_device.h> |
| 14 | #include <linux/kernel.h> |
| 15 | #include <linux/io.h> |
Paul Mundt | e77eb36 | 2008-08-05 13:16:56 +0900 | [diff] [blame] | 16 | #include <linux/smc91x.h> |
Paul Mundt | 10f0fc1 | 2009-01-07 17:45:02 +0900 | [diff] [blame] | 17 | #include <linux/irq.h> |
Yoshihiro Shimoda | fcaf99d | 2009-05-26 09:33:08 +0000 | [diff] [blame] | 18 | #include <linux/interrupt.h> |
| 19 | #include <linux/usb/r8a66597.h> |
Magnus Damm | 2c59b0b | 2009-07-22 14:41:35 +0000 | [diff] [blame^] | 20 | #include <linux/usb/m66592.h> |
Paul Mundt | e7109a9 | 2007-08-08 15:27:55 +0900 | [diff] [blame] | 21 | #include <asm/ilsel.h> |
Paul Mundt | 94807a3 | 2007-08-08 15:22:04 +0900 | [diff] [blame] | 22 | |
| 23 | static struct resource heartbeat_resources[] = { |
| 24 | [0] = { |
| 25 | .start = 0xb8140020, |
Paul Mundt | a1fd306 | 2007-08-23 15:11:44 +0900 | [diff] [blame] | 26 | .end = 0xb8140020, |
Paul Mundt | 94807a3 | 2007-08-08 15:22:04 +0900 | [diff] [blame] | 27 | .flags = IORESOURCE_MEM, |
| 28 | }, |
| 29 | }; |
| 30 | |
| 31 | static struct platform_device heartbeat_device = { |
| 32 | .name = "heartbeat", |
| 33 | .id = -1, |
| 34 | .num_resources = ARRAY_SIZE(heartbeat_resources), |
| 35 | .resource = heartbeat_resources, |
| 36 | }; |
| 37 | |
Paul Mundt | e77eb36 | 2008-08-05 13:16:56 +0900 | [diff] [blame] | 38 | static struct smc91x_platdata smc91x_info = { |
| 39 | .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT, |
| 40 | }; |
| 41 | |
Paul Mundt | e7109a9 | 2007-08-08 15:27:55 +0900 | [diff] [blame] | 42 | static struct resource smc91x_resources[] = { |
| 43 | [0] = { |
| 44 | .start = 0x18000300, |
| 45 | .end = 0x18000300 + 0x10 - 1, |
| 46 | .flags = IORESOURCE_MEM, |
| 47 | }, |
| 48 | [1] = { |
| 49 | /* Filled in by ilsel */ |
| 50 | .flags = IORESOURCE_IRQ, |
| 51 | }, |
| 52 | }; |
| 53 | |
| 54 | static struct platform_device smc91x_device = { |
| 55 | .name = "smc91x", |
| 56 | .id = -1, |
| 57 | .resource = smc91x_resources, |
| 58 | .num_resources = ARRAY_SIZE(smc91x_resources), |
Paul Mundt | e77eb36 | 2008-08-05 13:16:56 +0900 | [diff] [blame] | 59 | .dev = { |
| 60 | .platform_data = &smc91x_info, |
| 61 | }, |
Paul Mundt | e7109a9 | 2007-08-08 15:27:55 +0900 | [diff] [blame] | 62 | }; |
| 63 | |
Yoshihiro Shimoda | fcaf99d | 2009-05-26 09:33:08 +0000 | [diff] [blame] | 64 | static struct r8a66597_platdata r8a66597_data = { |
| 65 | .xtal = R8A66597_PLATDATA_XTAL_12MHZ, |
| 66 | .vif = 1, |
| 67 | }; |
| 68 | |
Paul Mundt | e7109a9 | 2007-08-08 15:27:55 +0900 | [diff] [blame] | 69 | static struct resource r8a66597_usb_host_resources[] = { |
| 70 | [0] = { |
Paul Mundt | e7109a9 | 2007-08-08 15:27:55 +0900 | [diff] [blame] | 71 | .start = 0x18040000, |
| 72 | .end = 0x18080000 - 1, |
| 73 | .flags = IORESOURCE_MEM, |
| 74 | }, |
| 75 | [1] = { |
Paul Mundt | e7109a9 | 2007-08-08 15:27:55 +0900 | [diff] [blame] | 76 | /* Filled in by ilsel */ |
Yoshihiro Shimoda | fcaf99d | 2009-05-26 09:33:08 +0000 | [diff] [blame] | 77 | .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW, |
Paul Mundt | e7109a9 | 2007-08-08 15:27:55 +0900 | [diff] [blame] | 78 | }, |
| 79 | }; |
| 80 | |
| 81 | static struct platform_device r8a66597_usb_host_device = { |
| 82 | .name = "r8a66597_hcd", |
| 83 | .id = -1, |
| 84 | .dev = { |
| 85 | .dma_mask = NULL, /* don't use dma */ |
| 86 | .coherent_dma_mask = 0xffffffff, |
Yoshihiro Shimoda | fcaf99d | 2009-05-26 09:33:08 +0000 | [diff] [blame] | 87 | .platform_data = &r8a66597_data, |
Paul Mundt | e7109a9 | 2007-08-08 15:27:55 +0900 | [diff] [blame] | 88 | }, |
| 89 | .num_resources = ARRAY_SIZE(r8a66597_usb_host_resources), |
| 90 | .resource = r8a66597_usb_host_resources, |
| 91 | }; |
| 92 | |
Magnus Damm | 2c59b0b | 2009-07-22 14:41:35 +0000 | [diff] [blame^] | 93 | static struct m66592_platdata usbf_platdata = { |
| 94 | .xtal = M66592_PLATDATA_XTAL_24MHZ, |
| 95 | .vif = 1, |
| 96 | }; |
| 97 | |
Paul Mundt | e7109a9 | 2007-08-08 15:27:55 +0900 | [diff] [blame] | 98 | static struct resource m66592_usb_peripheral_resources[] = { |
| 99 | [0] = { |
| 100 | .name = "m66592_udc", |
| 101 | .start = 0x18080000, |
| 102 | .end = 0x180c0000 - 1, |
| 103 | .flags = IORESOURCE_MEM, |
| 104 | }, |
| 105 | [1] = { |
| 106 | .name = "m66592_udc", |
| 107 | /* Filled in by ilsel */ |
| 108 | .flags = IORESOURCE_IRQ, |
| 109 | }, |
| 110 | }; |
| 111 | |
| 112 | static struct platform_device m66592_usb_peripheral_device = { |
| 113 | .name = "m66592_udc", |
| 114 | .id = -1, |
| 115 | .dev = { |
| 116 | .dma_mask = NULL, /* don't use dma */ |
| 117 | .coherent_dma_mask = 0xffffffff, |
Magnus Damm | 2c59b0b | 2009-07-22 14:41:35 +0000 | [diff] [blame^] | 118 | .platform_data = &usbf_platdata, |
Paul Mundt | e7109a9 | 2007-08-08 15:27:55 +0900 | [diff] [blame] | 119 | }, |
| 120 | .num_resources = ARRAY_SIZE(m66592_usb_peripheral_resources), |
| 121 | .resource = m66592_usb_peripheral_resources, |
| 122 | }; |
| 123 | |
Paul Mundt | 94807a3 | 2007-08-08 15:22:04 +0900 | [diff] [blame] | 124 | static struct platform_device *x3proto_devices[] __initdata = { |
| 125 | &heartbeat_device, |
Paul Mundt | e7109a9 | 2007-08-08 15:27:55 +0900 | [diff] [blame] | 126 | &smc91x_device, |
| 127 | &r8a66597_usb_host_device, |
| 128 | &m66592_usb_peripheral_device, |
Paul Mundt | 94807a3 | 2007-08-08 15:22:04 +0900 | [diff] [blame] | 129 | }; |
| 130 | |
| 131 | static int __init x3proto_devices_setup(void) |
| 132 | { |
Paul Mundt | e7109a9 | 2007-08-08 15:27:55 +0900 | [diff] [blame] | 133 | r8a66597_usb_host_resources[1].start = |
| 134 | r8a66597_usb_host_resources[1].end = ilsel_enable(ILSEL_USBH_I); |
| 135 | |
| 136 | m66592_usb_peripheral_resources[1].start = |
| 137 | m66592_usb_peripheral_resources[1].end = ilsel_enable(ILSEL_USBP_I); |
| 138 | |
| 139 | smc91x_resources[1].start = |
| 140 | smc91x_resources[1].end = ilsel_enable(ILSEL_LAN); |
| 141 | |
Paul Mundt | 94807a3 | 2007-08-08 15:22:04 +0900 | [diff] [blame] | 142 | return platform_add_devices(x3proto_devices, |
| 143 | ARRAY_SIZE(x3proto_devices)); |
| 144 | } |
| 145 | device_initcall(x3proto_devices_setup); |
| 146 | |
| 147 | static void __init x3proto_init_irq(void) |
| 148 | { |
| 149 | plat_irq_setup_pins(IRQ_MODE_IRL3210); |
| 150 | |
| 151 | /* Set ICR0.LVLMODE */ |
| 152 | ctrl_outl(ctrl_inl(0xfe410000) | (1 << 21), 0xfe410000); |
| 153 | } |
| 154 | |
| 155 | static struct sh_machine_vector mv_x3proto __initmv = { |
| 156 | .mv_name = "x3proto", |
| 157 | .mv_init_irq = x3proto_init_irq, |
| 158 | }; |