| 1 | /* |
| 2 | * arch/m68k/coldfire/m547x/mcf548x-devices.c |
| 3 | * |
| 4 | * Coldfire M548x Platform Device Configuration |
| 5 | * |
| 6 | * Based on the Freescale MXC devices.c |
| 7 | * |
| 8 | * Copyright 2007-2009 Freescale Semiconductor, Inc. All Rights Reserved. |
| 9 | * |
| 10 | * Kurt Mahan <kmahan@freescale.com> |
| 11 | */ |
| 12 | #include <linux/module.h> |
| 13 | #include <linux/kernel.h> |
| 14 | #include <linux/init.h> |
| 15 | #include <linux/mtd/physmap.h> |
| 16 | #include <linux/platform_device.h> |
| 17 | #include <linux/fsl_devices.h> |
| 18 | |
| 19 | #include <asm/coldfire.h> |
| 20 | #include <asm/mcfsim.h> |
| 21 | #include <asm/mcfuart.h> |
| 22 | |
| 23 | static struct resource coldfire_i2c_resources[] = { |
| 24 | { /* I/O */ |
| 25 | .start = MCF_MBAR + 0x008F00, |
| 26 | .end = MCF_MBAR + 0x008F20, |
| 27 | .flags = IORESOURCE_MEM, |
| 28 | }, |
| 29 | { /* IRQ */ |
| 30 | .start = 40, |
| 31 | .end = 40, |
| 32 | .flags = IORESOURCE_IRQ, |
| 33 | }, |
| 34 | }; |
| 35 | |
| 36 | static struct platform_device coldfire_i2c_device = { |
| 37 | .name = "mcf-i2c", |
| 38 | .id = 0, /*bus number*/ |
| 39 | .num_resources = ARRAY_SIZE(coldfire_i2c_resources), |
| 40 | .resource = coldfire_i2c_resources, |
| 41 | }; |
| 42 | |
| 43 | static struct resource coldfire_sec_resources[] = { |
| 44 | [0] = { /* I/O */ |
| 45 | .start = MCF_MBAR + 0x00020000, |
| 46 | .end = MCF_MBAR + 0x00033000, |
| 47 | .flags = IORESOURCE_MEM, |
| 48 | }, |
| 49 | [2] = { /* IRQ */ |
| 50 | .start = ISC_SEC, |
| 51 | .end = ISC_SEC, |
| 52 | .flags = IORESOURCE_IRQ, |
| 53 | }, |
| 54 | }; |
| 55 | |
| 56 | static struct platform_device coldfire_sec_device = { |
| 57 | .name = "fsl-sec1", |
| 58 | .id = -1, |
| 59 | .num_resources = ARRAY_SIZE(coldfire_sec_resources), |
| 60 | .resource = coldfire_sec_resources, |
| 61 | }; |
| 62 | |
| 63 | static struct physmap_flash_data mcf5485_flash_data = { |
| 64 | .width = 2, |
| 65 | }; |
| 66 | |
| 67 | static struct resource mcf5485_flash_resource = { |
| 68 | .start = 0xff800000, |
| 69 | .end = 0xffbfffff, |
| 70 | .flags = IORESOURCE_MEM, |
| 71 | }; |
| 72 | |
| 73 | static struct platform_device mcf5485_flash_device = { |
| 74 | .name = "physmap-flash", |
| 75 | .id = 0, |
| 76 | .dev = { |
| 77 | .platform_data = &mcf5485_flash_data, |
| 78 | }, |
| 79 | .num_resources = 1, |
| 80 | .resource = &mcf5485_flash_resource, |
| 81 | }; |
| 82 | |
| 83 | static int __init mcf5485_init_devices(void) |
| 84 | { |
| 85 | printk(KERN_INFO "MCF5485x INIT_DEVICES\n"); |
| 86 | |
| 87 | platform_device_register(&coldfire_i2c_device); |
| 88 | platform_device_register(&coldfire_sec_device); |
| 89 | platform_device_register(&mcf5485_flash_device); |
| 90 | return 0; |
| 91 | } |
| 92 | arch_initcall(mcf5485_init_devices); |
| 93 | |
| 94 | static struct mcf_platform_uart m548x_uart_platform[] = { |
| 95 | { |
| 96 | .mapbase = MCF_MBAR + MCFUART_BASE1, |
| 97 | .irq = MCFINT_VECBASE + MCFINT_UART0, |
| 98 | }, |
| 99 | { |
| 100 | .mapbase = MCF_MBAR + MCFUART_BASE2, |
| 101 | .irq = MCFINT_VECBASE + MCFINT_UART1, |
| 102 | }, |
| 103 | { |
| 104 | .mapbase = MCF_MBAR + MCFUART_BASE3, |
| 105 | .irq = MCFINT_VECBASE + MCFINT_UART2, |
| 106 | }, |
| 107 | { }, |
| 108 | }; |
| 109 | |
| 110 | static struct platform_device m548x_uart = { |
| 111 | .name = "mcfuart", |
| 112 | .id = 0, |
| 113 | .dev.platform_data = m548x_uart_platform, |
| 114 | }; |
| 115 | |
| 116 | static struct platform_device *m548x_devices[] __initdata = { |
| 117 | &m548x_uart, |
| 118 | }; |
| 119 | |
| 120 | void m548x_uarts_init(void) |
| 121 | { |
| 122 | const int nrlines = ARRAY_SIZE(m548x_uart_platform); |
| 123 | int line; |
| 124 | |
| 125 | /* Set GPIO port register to enable PSC(port) signals */ |
| 126 | for (line = 0; (line < nrlines); line++) { |
| 127 | MCF_PAR_PSCn(line) = (0 |
| 128 | | MCF_PAR_PSC_TXD |
| 129 | | MCF_PAR_PSC_RXD); |
| 130 | |
| 131 | MCF_ICR(m548x_uart_platform[line].irq - 64) = ILP_PSCn(line); |
| 132 | } |
| 133 | } |
| 134 | /***************************************************************************/ |
| 135 | |
| 136 | static int __init init_BSP(void) |
| 137 | { |
| 138 | m548x_uarts_init(); |
| 139 | platform_add_devices(m548x_devices, ARRAY_SIZE(m548x_devices)); |
| 140 | return 0; |
| 141 | } |
| 142 | |
| 143 | arch_initcall(init_BSP); |
| 144 | |