1 /* 2 * arch/sh/boards/renesas/x3proto/setup.c 3 * 4 * Renesas SH-X3 Prototype Board Support. 5 * 6 * Copyright (C) 2007 - 2008 Paul Mundt 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> 16 #include <linux/smc91x.h> 17 #include <asm/ilsel.h> 18 19 static struct resource heartbeat_resources[] = { 20 [0] = { 21 .start = 0xb8140020, 22 .end = 0xb8140020, 23 .flags = IORESOURCE_MEM, 24 }, 25 }; 26 27 static struct platform_device heartbeat_device = { 28 .name = "heartbeat", 29 .id = -1, 30 .num_resources = ARRAY_SIZE(heartbeat_resources), 31 .resource = heartbeat_resources, 32 }; 33 34 static struct smc91x_platdata smc91x_info = { 35 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT, 36 }; 37 38 static struct resource smc91x_resources[] = { 39 [0] = { 40 .start = 0x18000300, 41 .end = 0x18000300 + 0x10 - 1, 42 .flags = IORESOURCE_MEM, 43 }, 44 [1] = { 45 /* Filled in by ilsel */ 46 .flags = IORESOURCE_IRQ, 47 }, 48 }; 49 50 static struct platform_device smc91x_device = { 51 .name = "smc91x", 52 .id = -1, 53 .resource = smc91x_resources, 54 .num_resources = ARRAY_SIZE(smc91x_resources), 55 .dev = { 56 .platform_data = &smc91x_info, 57 }, 58 }; 59 60 static struct resource r8a66597_usb_host_resources[] = { 61 [0] = { 62 .name = "r8a66597_hcd", 63 .start = 0x18040000, 64 .end = 0x18080000 - 1, 65 .flags = IORESOURCE_MEM, 66 }, 67 [1] = { 68 .name = "r8a66597_hcd", 69 /* Filled in by ilsel */ 70 .flags = IORESOURCE_IRQ, 71 }, 72 }; 73 74 static struct platform_device r8a66597_usb_host_device = { 75 .name = "r8a66597_hcd", 76 .id = -1, 77 .dev = { 78 .dma_mask = NULL, /* don't use dma */ 79 .coherent_dma_mask = 0xffffffff, 80 }, 81 .num_resources = ARRAY_SIZE(r8a66597_usb_host_resources), 82 .resource = r8a66597_usb_host_resources, 83 }; 84 85 static struct resource m66592_usb_peripheral_resources[] = { 86 [0] = { 87 .name = "m66592_udc", 88 .start = 0x18080000, 89 .end = 0x180c0000 - 1, 90 .flags = IORESOURCE_MEM, 91 }, 92 [1] = { 93 .name = "m66592_udc", 94 /* Filled in by ilsel */ 95 .flags = IORESOURCE_IRQ, 96 }, 97 }; 98 99 static struct platform_device m66592_usb_peripheral_device = { 100 .name = "m66592_udc", 101 .id = -1, 102 .dev = { 103 .dma_mask = NULL, /* don't use dma */ 104 .coherent_dma_mask = 0xffffffff, 105 }, 106 .num_resources = ARRAY_SIZE(m66592_usb_peripheral_resources), 107 .resource = m66592_usb_peripheral_resources, 108 }; 109 110 static struct platform_device *x3proto_devices[] __initdata = { 111 &heartbeat_device, 112 &smc91x_device, 113 &r8a66597_usb_host_device, 114 &m66592_usb_peripheral_device, 115 }; 116 117 static int __init x3proto_devices_setup(void) 118 { 119 r8a66597_usb_host_resources[1].start = 120 r8a66597_usb_host_resources[1].end = ilsel_enable(ILSEL_USBH_I); 121 122 m66592_usb_peripheral_resources[1].start = 123 m66592_usb_peripheral_resources[1].end = ilsel_enable(ILSEL_USBP_I); 124 125 smc91x_resources[1].start = 126 smc91x_resources[1].end = ilsel_enable(ILSEL_LAN); 127 128 return platform_add_devices(x3proto_devices, 129 ARRAY_SIZE(x3proto_devices)); 130 } 131 device_initcall(x3proto_devices_setup); 132 133 static void __init x3proto_init_irq(void) 134 { 135 plat_irq_setup_pins(IRQ_MODE_IRL3210); 136 137 /* Set ICR0.LVLMODE */ 138 ctrl_outl(ctrl_inl(0xfe410000) | (1 << 21), 0xfe410000); 139 } 140 141 static struct sh_machine_vector mv_x3proto __initmv = { 142 .mv_name = "x3proto", 143 .mv_init_irq = x3proto_init_irq, 144 }; 145