Sascha Hauer | 2420563 | 2009-01-28 17:36:37 +0100 | [diff] [blame] | 1 | /* |
Uwe Kleine-König | 95c0046 | 2009-12-09 20:12:07 +0100 | [diff] [blame] | 2 | * linux/arch/arm/mach-mx1/mach-scb9328.c |
Sascha Hauer | 2420563 | 2009-01-28 17:36:37 +0100 | [diff] [blame] | 3 | * |
| 4 | * Copyright (c) 2004 Sascha Hauer <saschahauer@web.de> |
| 5 | * Copyright (c) 2006-2008 Juergen Beisert <jbeisert@netscape.net> |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License version 2 as |
| 9 | * published by the Free Software Foundation. |
| 10 | * |
| 11 | */ |
| 12 | |
| 13 | #include <linux/platform_device.h> |
| 14 | #include <linux/mtd/physmap.h> |
| 15 | #include <linux/interrupt.h> |
| 16 | #include <linux/dm9000.h> |
| 17 | |
| 18 | #include <asm/mach-types.h> |
| 19 | #include <asm/mach/arch.h> |
| 20 | #include <asm/mach/time.h> |
| 21 | |
| 22 | #include <mach/common.h> |
| 23 | #include <mach/hardware.h> |
| 24 | #include <mach/irqs.h> |
Uwe Kleine-König | e835d88 | 2010-02-16 11:07:49 +0100 | [diff] [blame] | 25 | #include <mach/iomux-mx1.h> |
Sascha Hauer | 2420563 | 2009-01-28 17:36:37 +0100 | [diff] [blame] | 26 | |
Uwe Kleine-König | d112f4e | 2010-06-22 14:50:59 +0200 | [diff] [blame] | 27 | #include "devices-imx1.h" |
Sascha Hauer | 2420563 | 2009-01-28 17:36:37 +0100 | [diff] [blame] | 28 | #include "devices.h" |
| 29 | |
| 30 | /* |
| 31 | * This scb9328 has a 32MiB flash |
| 32 | */ |
| 33 | static struct resource flash_resource = { |
Uwe Kleine-König | 05a3185 | 2010-03-04 21:02:41 +0100 | [diff] [blame] | 34 | .start = MX1_CS0_PHYS, |
| 35 | .end = MX1_CS0_PHYS + (32 * 1024 * 1024) - 1, |
Sascha Hauer | 2420563 | 2009-01-28 17:36:37 +0100 | [diff] [blame] | 36 | .flags = IORESOURCE_MEM, |
| 37 | }; |
| 38 | |
| 39 | static struct physmap_flash_data scb_flash_data = { |
| 40 | .width = 2, |
| 41 | }; |
| 42 | |
| 43 | static struct platform_device scb_flash_device = { |
| 44 | .name = "physmap-flash", |
| 45 | .id = 0, |
| 46 | .dev = { |
| 47 | .platform_data = &scb_flash_data, |
| 48 | }, |
| 49 | .resource = &flash_resource, |
| 50 | .num_resources = 1, |
| 51 | }; |
| 52 | |
| 53 | /* |
| 54 | * scb9328 has a DM9000 network controller |
| 55 | * connected to CS5, with 16 bit data path |
| 56 | * and interrupt connected to GPIO 3 |
| 57 | */ |
| 58 | |
| 59 | /* |
| 60 | * internal datapath is fixed 16 bit |
| 61 | */ |
| 62 | static struct dm9000_plat_data dm9000_platdata = { |
| 63 | .flags = DM9000_PLATF_16BITONLY, |
| 64 | }; |
| 65 | |
| 66 | /* |
| 67 | * the DM9000 drivers wants two defined address spaces |
| 68 | * to gain access to address latch registers and the data path. |
| 69 | */ |
| 70 | static struct resource dm9000x_resources[] = { |
Sascha Hauer | 9b0e6db | 2009-06-23 12:14:39 +0200 | [diff] [blame] | 71 | { |
Sascha Hauer | 2420563 | 2009-01-28 17:36:37 +0100 | [diff] [blame] | 72 | .name = "address area", |
Uwe Kleine-König | 05a3185 | 2010-03-04 21:02:41 +0100 | [diff] [blame] | 73 | .start = MX1_CS5_PHYS, |
| 74 | .end = MX1_CS5_PHYS + 1, |
Sascha Hauer | 9b0e6db | 2009-06-23 12:14:39 +0200 | [diff] [blame] | 75 | .flags = IORESOURCE_MEM, /* address access */ |
| 76 | }, { |
Sascha Hauer | 2420563 | 2009-01-28 17:36:37 +0100 | [diff] [blame] | 77 | .name = "data area", |
Uwe Kleine-König | 05a3185 | 2010-03-04 21:02:41 +0100 | [diff] [blame] | 78 | .start = MX1_CS5_PHYS + 4, |
| 79 | .end = MX1_CS5_PHYS + 5, |
Sascha Hauer | 9b0e6db | 2009-06-23 12:14:39 +0200 | [diff] [blame] | 80 | .flags = IORESOURCE_MEM, /* data access */ |
| 81 | }, { |
Sascha Hauer | 2420563 | 2009-01-28 17:36:37 +0100 | [diff] [blame] | 82 | .start = IRQ_GPIOC(3), |
| 83 | .end = IRQ_GPIOC(3), |
Sascha Hauer | 9b0e6db | 2009-06-23 12:14:39 +0200 | [diff] [blame] | 84 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, |
Sascha Hauer | 2420563 | 2009-01-28 17:36:37 +0100 | [diff] [blame] | 85 | }, |
| 86 | }; |
| 87 | |
| 88 | static struct platform_device dm9000x_device = { |
| 89 | .name = "dm9000", |
| 90 | .id = 0, |
| 91 | .num_resources = ARRAY_SIZE(dm9000x_resources), |
| 92 | .resource = dm9000x_resources, |
| 93 | .dev = { |
| 94 | .platform_data = &dm9000_platdata, |
| 95 | } |
| 96 | }; |
| 97 | |
| 98 | static int mxc_uart1_pins[] = { |
| 99 | PC9_PF_UART1_CTS, |
| 100 | PC10_PF_UART1_RTS, |
| 101 | PC11_PF_UART1_TXD, |
| 102 | PC12_PF_UART1_RXD, |
| 103 | }; |
| 104 | |
| 105 | static int uart1_mxc_init(struct platform_device *pdev) |
| 106 | { |
| 107 | return mxc_gpio_setup_multiple_pins(mxc_uart1_pins, |
| 108 | ARRAY_SIZE(mxc_uart1_pins), "UART1"); |
| 109 | } |
| 110 | |
Uwe Kleine-König | a02b042 | 2010-03-05 11:04:45 +0100 | [diff] [blame] | 111 | static void uart1_mxc_exit(struct platform_device *pdev) |
Sascha Hauer | 2420563 | 2009-01-28 17:36:37 +0100 | [diff] [blame] | 112 | { |
| 113 | mxc_gpio_release_multiple_pins(mxc_uart1_pins, |
| 114 | ARRAY_SIZE(mxc_uart1_pins)); |
Sascha Hauer | 2420563 | 2009-01-28 17:36:37 +0100 | [diff] [blame] | 115 | } |
| 116 | |
Uwe Kleine-König | d112f4e | 2010-06-22 14:50:59 +0200 | [diff] [blame] | 117 | static const struct imxuart_platform_data uart_pdata __initconst = { |
Sascha Hauer | 2420563 | 2009-01-28 17:36:37 +0100 | [diff] [blame] | 118 | .init = uart1_mxc_init, |
| 119 | .exit = uart1_mxc_exit, |
| 120 | .flags = IMXUART_HAVE_RTSCTS, |
| 121 | }; |
| 122 | |
| 123 | static struct platform_device *devices[] __initdata = { |
| 124 | &scb_flash_device, |
| 125 | &dm9000x_device, |
| 126 | }; |
| 127 | |
| 128 | /* |
| 129 | * scb9328_init - Init the CPU card itself |
| 130 | */ |
| 131 | static void __init scb9328_init(void) |
| 132 | { |
Uwe Kleine-König | d112f4e | 2010-06-22 14:50:59 +0200 | [diff] [blame] | 133 | imx1_add_imx_uart0(&uart_pdata); |
Sascha Hauer | 2420563 | 2009-01-28 17:36:37 +0100 | [diff] [blame] | 134 | |
| 135 | printk(KERN_INFO"Scb9328: Adding devices\n"); |
| 136 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
| 137 | } |
| 138 | |
| 139 | static void __init scb9328_timer_init(void) |
| 140 | { |
| 141 | mx1_clocks_init(32000); |
| 142 | } |
| 143 | |
| 144 | static struct sys_timer scb9328_timer = { |
| 145 | .init = scb9328_timer_init, |
| 146 | }; |
| 147 | |
| 148 | MACHINE_START(SCB9328, "Synertronixx scb9328") |
| 149 | /* Sascha Hauer */ |
| 150 | .phys_io = 0x00200000, |
| 151 | .io_pg_offst = ((0xe0200000) >> 18) & 0xfffc, |
| 152 | .boot_params = 0x08000100, |
Sascha Hauer | cd4a05f | 2009-04-02 22:32:10 +0200 | [diff] [blame] | 153 | .map_io = mx1_map_io, |
Sascha Hauer | c5aa0ad | 2009-05-25 17:36:19 +0200 | [diff] [blame] | 154 | .init_irq = mx1_init_irq, |
Sascha Hauer | 2420563 | 2009-01-28 17:36:37 +0100 | [diff] [blame] | 155 | .timer = &scb9328_timer, |
| 156 | .init_machine = scb9328_init, |
| 157 | MACHINE_END |