Sascha Hauer | de41fdd | 2009-10-02 09:14:18 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2009 Sascha Hauer, <kernel@pengutronix.de> |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; either version 2 |
| 7 | * of the License, or (at your option) any later version. |
| 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU General Public License |
| 14 | * along with this program; if not, write to the Free Software |
| 15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 16 | * Boston, MA 02110-1301, USA. |
| 17 | */ |
| 18 | |
Sascha Hauer | 635baf6 | 2009-06-04 11:32:46 +0200 | [diff] [blame] | 19 | #include <linux/types.h> |
| 20 | #include <linux/init.h> |
Baruch Siach | e71fbaf | 2009-12-21 13:44:32 +0200 | [diff] [blame] | 21 | #include <linux/delay.h> |
Sascha Hauer | 635baf6 | 2009-06-04 11:32:46 +0200 | [diff] [blame] | 22 | #include <linux/clk.h> |
| 23 | #include <linux/irq.h> |
| 24 | #include <linux/gpio.h> |
Baruch Siach | e71fbaf | 2009-12-21 13:44:32 +0200 | [diff] [blame] | 25 | #include <linux/fec.h> |
Sascha Hauer | 635baf6 | 2009-06-04 11:32:46 +0200 | [diff] [blame] | 26 | #include <linux/platform_device.h> |
| 27 | |
| 28 | #include <mach/hardware.h> |
| 29 | #include <asm/mach-types.h> |
| 30 | #include <asm/mach/arch.h> |
| 31 | #include <asm/mach/time.h> |
| 32 | #include <asm/memory.h> |
| 33 | #include <asm/mach/map.h> |
| 34 | #include <mach/common.h> |
| 35 | #include <mach/imx-uart.h> |
| 36 | #include <mach/mx25.h> |
| 37 | #include <mach/mxc_nand.h> |
Baruch Siach | 0f547dc | 2010-02-17 12:33:25 +0200 | [diff] [blame] | 38 | #include <mach/imxfb.h> |
Sascha Hauer | 635baf6 | 2009-06-04 11:32:46 +0200 | [diff] [blame] | 39 | #include "devices.h" |
Uwe Kleine-König | 261f6f6 | 2010-02-15 21:18:43 +0100 | [diff] [blame] | 40 | #include <mach/iomux-mx25.h> |
Sascha Hauer | 635baf6 | 2009-06-04 11:32:46 +0200 | [diff] [blame] | 41 | |
| 42 | static struct imxuart_platform_data uart_pdata = { |
| 43 | .flags = IMXUART_HAVE_RTSCTS, |
| 44 | }; |
| 45 | |
Baruch Siach | e71fbaf | 2009-12-21 13:44:32 +0200 | [diff] [blame] | 46 | static struct pad_desc mx25pdk_pads[] = { |
| 47 | MX25_PAD_FEC_MDC__FEC_MDC, |
| 48 | MX25_PAD_FEC_MDIO__FEC_MDIO, |
| 49 | MX25_PAD_FEC_TDATA0__FEC_TDATA0, |
| 50 | MX25_PAD_FEC_TDATA1__FEC_TDATA1, |
| 51 | MX25_PAD_FEC_TX_EN__FEC_TX_EN, |
| 52 | MX25_PAD_FEC_RDATA0__FEC_RDATA0, |
| 53 | MX25_PAD_FEC_RDATA1__FEC_RDATA1, |
| 54 | MX25_PAD_FEC_RX_DV__FEC_RX_DV, |
| 55 | MX25_PAD_FEC_TX_CLK__FEC_TX_CLK, |
| 56 | MX25_PAD_A17__GPIO_2_3, /* FEC_EN, GPIO 35 */ |
| 57 | MX25_PAD_D12__GPIO_4_8, /* FEC_RESET_B, GPIO 104 */ |
Baruch Siach | 0f547dc | 2010-02-17 12:33:25 +0200 | [diff] [blame] | 58 | |
| 59 | /* LCD */ |
| 60 | MX25_PAD_LD0__LD0, |
| 61 | MX25_PAD_LD1__LD1, |
| 62 | MX25_PAD_LD2__LD2, |
| 63 | MX25_PAD_LD3__LD3, |
| 64 | MX25_PAD_LD4__LD4, |
| 65 | MX25_PAD_LD5__LD5, |
| 66 | MX25_PAD_LD6__LD6, |
| 67 | MX25_PAD_LD7__LD7, |
| 68 | MX25_PAD_LD8__LD8, |
| 69 | MX25_PAD_LD9__LD9, |
| 70 | MX25_PAD_LD10__LD10, |
| 71 | MX25_PAD_LD11__LD11, |
| 72 | MX25_PAD_LD12__LD12, |
| 73 | MX25_PAD_LD13__LD13, |
| 74 | MX25_PAD_LD14__LD14, |
| 75 | MX25_PAD_LD15__LD15, |
| 76 | MX25_PAD_GPIO_E__LD16, |
| 77 | MX25_PAD_GPIO_F__LD17, |
| 78 | MX25_PAD_HSYNC__HSYNC, |
| 79 | MX25_PAD_VSYNC__VSYNC, |
| 80 | MX25_PAD_LSCLK__LSCLK, |
| 81 | MX25_PAD_OE_ACD__OE_ACD, |
| 82 | MX25_PAD_CONTRAST__CONTRAST, |
Baruch Siach | e71fbaf | 2009-12-21 13:44:32 +0200 | [diff] [blame] | 83 | }; |
| 84 | |
| 85 | static struct fec_platform_data mx25_fec_pdata = { |
| 86 | .phy = PHY_INTERFACE_MODE_RMII, |
| 87 | }; |
| 88 | |
| 89 | #define FEC_ENABLE_GPIO 35 |
| 90 | #define FEC_RESET_B_GPIO 104 |
| 91 | |
| 92 | static void __init mx25pdk_fec_reset(void) |
| 93 | { |
| 94 | gpio_request(FEC_ENABLE_GPIO, "FEC PHY enable"); |
| 95 | gpio_request(FEC_RESET_B_GPIO, "FEC PHY reset"); |
| 96 | |
| 97 | gpio_direction_output(FEC_ENABLE_GPIO, 0); /* drop PHY power */ |
| 98 | gpio_direction_output(FEC_RESET_B_GPIO, 0); /* assert reset */ |
| 99 | udelay(2); |
| 100 | |
| 101 | /* turn on PHY power and lift reset */ |
| 102 | gpio_set_value(FEC_ENABLE_GPIO, 1); |
| 103 | gpio_set_value(FEC_RESET_B_GPIO, 1); |
| 104 | } |
| 105 | |
Baruch Siach | b97235d | 2010-01-14 11:24:15 +0200 | [diff] [blame] | 106 | static struct mxc_nand_platform_data mx25pdk_nand_board_info = { |
| 107 | .width = 1, |
| 108 | .hw_ecc = 1, |
| 109 | .flash_bbt = 1, |
| 110 | }; |
| 111 | |
Baruch Siach | 0f547dc | 2010-02-17 12:33:25 +0200 | [diff] [blame] | 112 | static struct imx_fb_videomode mx25pdk_modes[] = { |
| 113 | { |
| 114 | .mode = { |
| 115 | .name = "CRT-VGA", |
| 116 | .refresh = 60, |
| 117 | .xres = 640, |
| 118 | .yres = 480, |
| 119 | .pixclock = 39683, |
| 120 | .left_margin = 45, |
| 121 | .right_margin = 114, |
| 122 | .upper_margin = 33, |
| 123 | .lower_margin = 11, |
| 124 | .hsync_len = 1, |
| 125 | .vsync_len = 1, |
| 126 | }, |
| 127 | .bpp = 16, |
| 128 | .pcr = 0xFA208B80, |
| 129 | }, |
| 130 | }; |
| 131 | |
| 132 | static struct imx_fb_platform_data mx25pdk_fb_pdata = { |
| 133 | .mode = mx25pdk_modes, |
| 134 | .num_modes = ARRAY_SIZE(mx25pdk_modes), |
| 135 | .pwmr = 0x00A903FF, |
| 136 | .lscr1 = 0x00120300, |
| 137 | .dmacr = 0x00020010, |
| 138 | }; |
| 139 | |
Sascha Hauer | 635baf6 | 2009-06-04 11:32:46 +0200 | [diff] [blame] | 140 | static void __init mx25pdk_init(void) |
| 141 | { |
Baruch Siach | e71fbaf | 2009-12-21 13:44:32 +0200 | [diff] [blame] | 142 | mxc_iomux_v3_setup_multiple_pads(mx25pdk_pads, |
| 143 | ARRAY_SIZE(mx25pdk_pads)); |
| 144 | |
Sascha Hauer | 635baf6 | 2009-06-04 11:32:46 +0200 | [diff] [blame] | 145 | mxc_register_device(&mxc_uart_device0, &uart_pdata); |
| 146 | mxc_register_device(&mxc_usbh2, NULL); |
Baruch Siach | b97235d | 2010-01-14 11:24:15 +0200 | [diff] [blame] | 147 | mxc_register_device(&mxc_nand_device, &mx25pdk_nand_board_info); |
Baruch Siach | 1eaa4f2 | 2010-01-27 15:00:49 +0200 | [diff] [blame] | 148 | mxc_register_device(&mx25_rtc_device, NULL); |
Baruch Siach | 0f547dc | 2010-02-17 12:33:25 +0200 | [diff] [blame] | 149 | mxc_register_device(&mx25_fb_device, &mx25pdk_fb_pdata); |
Baruch Siach | e71fbaf | 2009-12-21 13:44:32 +0200 | [diff] [blame] | 150 | |
| 151 | mx25pdk_fec_reset(); |
| 152 | mxc_register_device(&mx25_fec_device, &mx25_fec_pdata); |
Sascha Hauer | 635baf6 | 2009-06-04 11:32:46 +0200 | [diff] [blame] | 153 | } |
| 154 | |
Sascha Hauer | 635baf6 | 2009-06-04 11:32:46 +0200 | [diff] [blame] | 155 | static void __init mx25pdk_timer_init(void) |
| 156 | { |
Baruch Siach | fadc095 | 2010-01-25 12:58:19 +0200 | [diff] [blame] | 157 | mx25_clocks_init(); |
Sascha Hauer | 635baf6 | 2009-06-04 11:32:46 +0200 | [diff] [blame] | 158 | } |
| 159 | |
| 160 | static struct sys_timer mx25pdk_timer = { |
| 161 | .init = mx25pdk_timer_init, |
| 162 | }; |
| 163 | |
| 164 | MACHINE_START(MX25_3DS, "Freescale MX25PDK (3DS)") |
| 165 | /* Maintainer: Freescale Semiconductor, Inc. */ |
| 166 | .phys_io = MX25_AIPS1_BASE_ADDR, |
| 167 | .io_pg_offst = ((MX25_AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc, |
Uwe Kleine-König | 3410123 | 2010-01-29 17:36:05 +0100 | [diff] [blame] | 168 | .boot_params = MX25_PHYS_OFFSET + 0x100, |
Sascha Hauer | 635baf6 | 2009-06-04 11:32:46 +0200 | [diff] [blame] | 169 | .map_io = mx25_map_io, |
| 170 | .init_irq = mx25_init_irq, |
| 171 | .init_machine = mx25pdk_init, |
| 172 | .timer = &mx25pdk_timer, |
| 173 | MACHINE_END |
| 174 | |