Gwenhael Goavec-Merou | 7fc92c6 | 2011-04-29 05:21:39 +0000 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/arm/mach-imx/mach-apf9328.c |
| 3 | * |
| 4 | * Copyright (c) 2005-2011 ARMadeus systems <support@armadeus.com> |
| 5 | * |
| 6 | * This work is based on mach-scb9328.c which is: |
| 7 | * Copyright (c) 2004 Sascha Hauer <saschahauer@web.de> |
| 8 | * Copyright (c) 2006-2008 Juergen Beisert <jbeisert@netscape.net> |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License version 2 as |
| 12 | * published by the Free Software Foundation. |
| 13 | * |
| 14 | */ |
| 15 | |
| 16 | #include <linux/init.h> |
| 17 | #include <linux/kernel.h> |
| 18 | #include <linux/platform_device.h> |
| 19 | #include <linux/mtd/physmap.h> |
| 20 | #include <linux/dm9000.h> |
Shawn Guo | 438196c | 2011-12-05 10:12:28 +0800 | [diff] [blame] | 21 | #include <linux/gpio.h> |
Gwenhael Goavec-Merou | 7a99481 | 2011-10-08 17:19:49 +0200 | [diff] [blame] | 22 | #include <linux/i2c.h> |
Gwenhael Goavec-Merou | 7fc92c6 | 2011-04-29 05:21:39 +0000 | [diff] [blame] | 23 | |
| 24 | #include <asm/mach-types.h> |
| 25 | #include <asm/mach/arch.h> |
| 26 | #include <asm/mach/time.h> |
| 27 | |
Shawn Guo | e337247 | 2012-09-13 21:01:00 +0800 | [diff] [blame] | 28 | #include "common.h" |
Gwenhael Goavec-Merou | 7fc92c6 | 2011-04-29 05:21:39 +0000 | [diff] [blame] | 29 | #include "devices-imx1.h" |
Shawn Guo | 50f2de6 | 2012-09-14 14:14:45 +0800 | [diff] [blame] | 30 | #include "hardware.h" |
Shawn Guo | 267dd34 | 2012-09-13 13:26:00 +0800 | [diff] [blame] | 31 | #include "iomux-mx1.h" |
Gwenhael Goavec-Merou | 7fc92c6 | 2011-04-29 05:21:39 +0000 | [diff] [blame] | 32 | |
| 33 | static const int apf9328_pins[] __initconst = { |
| 34 | /* UART1 */ |
| 35 | PC9_PF_UART1_CTS, |
| 36 | PC10_PF_UART1_RTS, |
| 37 | PC11_PF_UART1_TXD, |
| 38 | PC12_PF_UART1_RXD, |
| 39 | /* UART2 */ |
| 40 | PB28_PF_UART2_CTS, |
| 41 | PB29_PF_UART2_RTS, |
| 42 | PB30_PF_UART2_TXD, |
| 43 | PB31_PF_UART2_RXD, |
Gwenhael Goavec-Merou | 7a99481 | 2011-10-08 17:19:49 +0200 | [diff] [blame] | 44 | /* I2C */ |
| 45 | PA15_PF_I2C_SDA, |
| 46 | PA16_PF_I2C_SCL, |
Gwenhael Goavec-Merou | 7fc92c6 | 2011-04-29 05:21:39 +0000 | [diff] [blame] | 47 | }; |
| 48 | |
| 49 | /* |
| 50 | * The APF9328 can have up to 32MB NOR Flash |
| 51 | */ |
| 52 | static struct resource flash_resource = { |
| 53 | .start = MX1_CS0_PHYS, |
| 54 | .end = MX1_CS0_PHYS + SZ_32M - 1, |
| 55 | .flags = IORESOURCE_MEM, |
| 56 | }; |
| 57 | |
| 58 | static struct physmap_flash_data apf9328_flash_data = { |
| 59 | .width = 2, |
| 60 | }; |
| 61 | |
| 62 | static struct platform_device apf9328_flash_device = { |
| 63 | .name = "physmap-flash", |
| 64 | .id = 0, |
| 65 | .dev = { |
| 66 | .platform_data = &apf9328_flash_data, |
| 67 | }, |
| 68 | .resource = &flash_resource, |
| 69 | .num_resources = 1, |
| 70 | }; |
| 71 | |
| 72 | /* |
| 73 | * APF9328 has a DM9000 Ethernet controller |
| 74 | */ |
| 75 | static struct dm9000_plat_data dm9000_setup = { |
| 76 | .flags = DM9000_PLATF_16BITONLY |
| 77 | }; |
| 78 | |
| 79 | static struct resource dm9000_resources[] = { |
| 80 | { |
| 81 | .start = MX1_CS4_PHYS + 0x00C00000, |
| 82 | .end = MX1_CS4_PHYS + 0x00C00001, |
| 83 | .flags = IORESOURCE_MEM, |
| 84 | }, { |
| 85 | .start = MX1_CS4_PHYS + 0x00C00002, |
| 86 | .end = MX1_CS4_PHYS + 0x00C00003, |
| 87 | .flags = IORESOURCE_MEM, |
| 88 | }, { |
Shawn Guo | 438196c | 2011-12-05 10:12:28 +0800 | [diff] [blame] | 89 | /* irq number is run-time assigned */ |
Gwenhael Goavec-Merou | 7fc92c6 | 2011-04-29 05:21:39 +0000 | [diff] [blame] | 90 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, |
| 91 | }, |
| 92 | }; |
| 93 | |
| 94 | static struct platform_device dm9000x_device = { |
| 95 | .name = "dm9000", |
| 96 | .id = 0, |
| 97 | .num_resources = ARRAY_SIZE(dm9000_resources), |
| 98 | .resource = dm9000_resources, |
| 99 | .dev = { |
| 100 | .platform_data = &dm9000_setup, |
| 101 | } |
| 102 | }; |
| 103 | |
Gwenhael Goavec-Merou | 7fc92c6 | 2011-04-29 05:21:39 +0000 | [diff] [blame] | 104 | static const struct imxuart_platform_data uart1_pdata __initconst = { |
| 105 | .flags = IMXUART_HAVE_RTSCTS, |
| 106 | }; |
| 107 | |
Gwenhael Goavec-Merou | 7a99481 | 2011-10-08 17:19:49 +0200 | [diff] [blame] | 108 | static const struct imxi2c_platform_data apf9328_i2c_data __initconst = { |
| 109 | .bitrate = 100000, |
| 110 | }; |
| 111 | |
Gwenhael Goavec-Merou | 7fc92c6 | 2011-04-29 05:21:39 +0000 | [diff] [blame] | 112 | static struct platform_device *devices[] __initdata = { |
| 113 | &apf9328_flash_device, |
| 114 | &dm9000x_device, |
| 115 | }; |
| 116 | |
| 117 | static void __init apf9328_init(void) |
| 118 | { |
Shawn Guo | b78d8e5 | 2011-06-06 00:07:55 +0800 | [diff] [blame] | 119 | imx1_soc_init(); |
| 120 | |
Gwenhael Goavec-Merou | 7fc92c6 | 2011-04-29 05:21:39 +0000 | [diff] [blame] | 121 | mxc_gpio_setup_multiple_pins(apf9328_pins, |
| 122 | ARRAY_SIZE(apf9328_pins), |
| 123 | "APF9328"); |
| 124 | |
Fabio Estevam | 07d1483 | 2011-05-10 11:21:00 -0300 | [diff] [blame] | 125 | imx1_add_imx_uart0(NULL); |
Gwenhael Goavec-Merou | 7fc92c6 | 2011-04-29 05:21:39 +0000 | [diff] [blame] | 126 | imx1_add_imx_uart1(&uart1_pdata); |
| 127 | |
Gwenhael Goavec-Merou | 7a99481 | 2011-10-08 17:19:49 +0200 | [diff] [blame] | 128 | imx1_add_imx_i2c(&apf9328_i2c_data); |
| 129 | |
Shawn Guo | 438196c | 2011-12-05 10:12:28 +0800 | [diff] [blame] | 130 | dm9000_resources[2].start = gpio_to_irq(IMX_GPIO_NR(2, 14)); |
| 131 | dm9000_resources[2].end = gpio_to_irq(IMX_GPIO_NR(2, 14)); |
Gwenhael Goavec-Merou | 7fc92c6 | 2011-04-29 05:21:39 +0000 | [diff] [blame] | 132 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
| 133 | } |
| 134 | |
| 135 | static void __init apf9328_timer_init(void) |
| 136 | { |
| 137 | mx1_clocks_init(32768); |
| 138 | } |
| 139 | |
Gwenhael Goavec-Merou | 7fc92c6 | 2011-04-29 05:21:39 +0000 | [diff] [blame] | 140 | MACHINE_START(APF9328, "Armadeus APF9328") |
| 141 | /* Maintainer: Gwenhael Goavec-Merou, ARMadeus Systems */ |
| 142 | .map_io = mx1_map_io, |
| 143 | .init_early = imx1_init_early, |
| 144 | .init_irq = mx1_init_irq, |
Stephen Warren | 6bb27d7 | 2012-11-08 12:40:59 -0700 | [diff] [blame] | 145 | .init_time = apf9328_timer_init, |
Gwenhael Goavec-Merou | 7fc92c6 | 2011-04-29 05:21:39 +0000 | [diff] [blame] | 146 | .init_machine = apf9328_init, |
Russell King | 65ea788 | 2011-11-06 17:12:08 +0000 | [diff] [blame] | 147 | .restart = mxc_restart, |
Gwenhael Goavec-Merou | 7fc92c6 | 2011-04-29 05:21:39 +0000 | [diff] [blame] | 148 | MACHINE_END |