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> |
Shawn Guo | 438196c | 2011-12-05 10:12:28 +0800 | [diff] [blame] | 17 | #include <linux/gpio.h> |
Sascha Hauer | 2420563 | 2009-01-28 17:36:37 +0100 | [diff] [blame] | 18 | |
| 19 | #include <asm/mach-types.h> |
| 20 | #include <asm/mach/arch.h> |
| 21 | #include <asm/mach/time.h> |
| 22 | |
| 23 | #include <mach/common.h> |
| 24 | #include <mach/hardware.h> |
Sascha Hauer | 2420563 | 2009-01-28 17:36:37 +0100 | [diff] [blame] | 25 | |
Uwe Kleine-König | d112f4e | 2010-06-22 14:50:59 +0200 | [diff] [blame] | 26 | #include "devices-imx1.h" |
Shawn Guo | 267dd34 | 2012-09-13 13:26:00 +0800 | [diff] [blame^] | 27 | #include "iomux-mx1.h" |
Sascha Hauer | 2420563 | 2009-01-28 17:36:37 +0100 | [diff] [blame] | 28 | |
| 29 | /* |
| 30 | * This scb9328 has a 32MiB flash |
| 31 | */ |
| 32 | static struct resource flash_resource = { |
Uwe Kleine-König | 05a3185 | 2010-03-04 21:02:41 +0100 | [diff] [blame] | 33 | .start = MX1_CS0_PHYS, |
| 34 | .end = MX1_CS0_PHYS + (32 * 1024 * 1024) - 1, |
Sascha Hauer | 2420563 | 2009-01-28 17:36:37 +0100 | [diff] [blame] | 35 | .flags = IORESOURCE_MEM, |
| 36 | }; |
| 37 | |
| 38 | static struct physmap_flash_data scb_flash_data = { |
| 39 | .width = 2, |
| 40 | }; |
| 41 | |
| 42 | static struct platform_device scb_flash_device = { |
| 43 | .name = "physmap-flash", |
| 44 | .id = 0, |
| 45 | .dev = { |
| 46 | .platform_data = &scb_flash_data, |
| 47 | }, |
| 48 | .resource = &flash_resource, |
| 49 | .num_resources = 1, |
| 50 | }; |
| 51 | |
| 52 | /* |
| 53 | * scb9328 has a DM9000 network controller |
| 54 | * connected to CS5, with 16 bit data path |
| 55 | * and interrupt connected to GPIO 3 |
| 56 | */ |
| 57 | |
| 58 | /* |
| 59 | * internal datapath is fixed 16 bit |
| 60 | */ |
| 61 | static struct dm9000_plat_data dm9000_platdata = { |
| 62 | .flags = DM9000_PLATF_16BITONLY, |
| 63 | }; |
| 64 | |
| 65 | /* |
| 66 | * the DM9000 drivers wants two defined address spaces |
| 67 | * to gain access to address latch registers and the data path. |
| 68 | */ |
| 69 | static struct resource dm9000x_resources[] = { |
Sascha Hauer | 9b0e6db | 2009-06-23 12:14:39 +0200 | [diff] [blame] | 70 | { |
Sascha Hauer | 2420563 | 2009-01-28 17:36:37 +0100 | [diff] [blame] | 71 | .name = "address area", |
Uwe Kleine-König | 05a3185 | 2010-03-04 21:02:41 +0100 | [diff] [blame] | 72 | .start = MX1_CS5_PHYS, |
| 73 | .end = MX1_CS5_PHYS + 1, |
Sascha Hauer | 9b0e6db | 2009-06-23 12:14:39 +0200 | [diff] [blame] | 74 | .flags = IORESOURCE_MEM, /* address access */ |
| 75 | }, { |
Sascha Hauer | 2420563 | 2009-01-28 17:36:37 +0100 | [diff] [blame] | 76 | .name = "data area", |
Uwe Kleine-König | 05a3185 | 2010-03-04 21:02:41 +0100 | [diff] [blame] | 77 | .start = MX1_CS5_PHYS + 4, |
| 78 | .end = MX1_CS5_PHYS + 5, |
Sascha Hauer | 9b0e6db | 2009-06-23 12:14:39 +0200 | [diff] [blame] | 79 | .flags = IORESOURCE_MEM, /* data access */ |
| 80 | }, { |
Shawn Guo | 438196c | 2011-12-05 10:12:28 +0800 | [diff] [blame] | 81 | /* irq number is run-time assigned */ |
Sascha Hauer | 9b0e6db | 2009-06-23 12:14:39 +0200 | [diff] [blame] | 82 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, |
Sascha Hauer | 2420563 | 2009-01-28 17:36:37 +0100 | [diff] [blame] | 83 | }, |
| 84 | }; |
| 85 | |
| 86 | static struct platform_device dm9000x_device = { |
| 87 | .name = "dm9000", |
| 88 | .id = 0, |
| 89 | .num_resources = ARRAY_SIZE(dm9000x_resources), |
| 90 | .resource = dm9000x_resources, |
| 91 | .dev = { |
| 92 | .platform_data = &dm9000_platdata, |
| 93 | } |
| 94 | }; |
| 95 | |
Uwe Kleine-König | 6c80ee5 | 2010-09-28 21:53:31 +0200 | [diff] [blame] | 96 | static const int mxc_uart1_pins[] = { |
Sascha Hauer | 2420563 | 2009-01-28 17:36:37 +0100 | [diff] [blame] | 97 | PC9_PF_UART1_CTS, |
| 98 | PC10_PF_UART1_RTS, |
| 99 | PC11_PF_UART1_TXD, |
| 100 | PC12_PF_UART1_RXD, |
| 101 | }; |
| 102 | |
Uwe Kleine-König | d112f4e | 2010-06-22 14:50:59 +0200 | [diff] [blame] | 103 | static const struct imxuart_platform_data uart_pdata __initconst = { |
Sascha Hauer | 2420563 | 2009-01-28 17:36:37 +0100 | [diff] [blame] | 104 | .flags = IMXUART_HAVE_RTSCTS, |
| 105 | }; |
| 106 | |
| 107 | static struct platform_device *devices[] __initdata = { |
| 108 | &scb_flash_device, |
| 109 | &dm9000x_device, |
| 110 | }; |
| 111 | |
| 112 | /* |
| 113 | * scb9328_init - Init the CPU card itself |
| 114 | */ |
| 115 | static void __init scb9328_init(void) |
| 116 | { |
Shawn Guo | b78d8e5 | 2011-06-06 00:07:55 +0800 | [diff] [blame] | 117 | imx1_soc_init(); |
| 118 | |
Fabio Estevam | 31b738a | 2011-06-21 14:49:36 -0300 | [diff] [blame] | 119 | mxc_gpio_setup_multiple_pins(mxc_uart1_pins, |
| 120 | ARRAY_SIZE(mxc_uart1_pins), "UART1"); |
| 121 | |
Uwe Kleine-König | d112f4e | 2010-06-22 14:50:59 +0200 | [diff] [blame] | 122 | imx1_add_imx_uart0(&uart_pdata); |
Sascha Hauer | 2420563 | 2009-01-28 17:36:37 +0100 | [diff] [blame] | 123 | |
| 124 | printk(KERN_INFO"Scb9328: Adding devices\n"); |
Shawn Guo | 438196c | 2011-12-05 10:12:28 +0800 | [diff] [blame] | 125 | dm9000x_resources[2].start = gpio_to_irq(IMX_GPIO_NR(3, 3)); |
| 126 | dm9000x_resources[2].end = gpio_to_irq(IMX_GPIO_NR(3, 3)); |
Sascha Hauer | 2420563 | 2009-01-28 17:36:37 +0100 | [diff] [blame] | 127 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
| 128 | } |
| 129 | |
| 130 | static void __init scb9328_timer_init(void) |
| 131 | { |
| 132 | mx1_clocks_init(32000); |
| 133 | } |
| 134 | |
| 135 | static struct sys_timer scb9328_timer = { |
| 136 | .init = scb9328_timer_init, |
| 137 | }; |
| 138 | |
| 139 | MACHINE_START(SCB9328, "Synertronixx scb9328") |
Uwe Kleine-König | 3dac219 | 2011-02-07 16:35:19 +0100 | [diff] [blame] | 140 | /* Sascha Hauer */ |
Nicolas Pitre | dc8f190 | 2011-07-05 22:38:12 -0400 | [diff] [blame] | 141 | .atag_offset = 100, |
Uwe Kleine-König | 3dac219 | 2011-02-07 16:35:19 +0100 | [diff] [blame] | 142 | .map_io = mx1_map_io, |
| 143 | .init_early = imx1_init_early, |
| 144 | .init_irq = mx1_init_irq, |
Sascha Hauer | ffa2ea3 | 2011-09-20 14:31:24 +0200 | [diff] [blame] | 145 | .handle_irq = imx1_handle_irq, |
Uwe Kleine-König | 3dac219 | 2011-02-07 16:35:19 +0100 | [diff] [blame] | 146 | .timer = &scb9328_timer, |
| 147 | .init_machine = scb9328_init, |
Russell King | 65ea788 | 2011-11-06 17:12:08 +0000 | [diff] [blame] | 148 | .restart = mxc_restart, |
Sascha Hauer | 2420563 | 2009-01-28 17:36:37 +0100 | [diff] [blame] | 149 | MACHINE_END |