Shawn Guo | 55cf418 | 2010-12-20 22:57:44 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2010 Freescale Semiconductor, Inc. All Rights Reserved. |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License as published by |
| 6 | * the Free Software Foundation; either version 2 of the License, or |
| 7 | * (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | */ |
| 14 | |
| 15 | #include <linux/delay.h> |
| 16 | #include <linux/platform_device.h> |
| 17 | #include <linux/gpio.h> |
| 18 | #include <linux/irq.h> |
| 19 | |
| 20 | #include <asm/mach-types.h> |
| 21 | #include <asm/mach/arch.h> |
| 22 | #include <asm/mach/time.h> |
| 23 | |
| 24 | #include <mach/common.h> |
| 25 | #include <mach/iomux-mx23.h> |
| 26 | |
| 27 | #include "devices-mx23.h" |
| 28 | |
Shawn Guo | b73d77b | 2011-03-06 00:40:22 +0800 | [diff] [blame] | 29 | #define MX23EVK_LCD_ENABLE MXS_GPIO_NR(1, 18) |
| 30 | #define MX23EVK_BL_ENABLE MXS_GPIO_NR(1, 28) |
Shawn Guo | 1b6f1e8 | 2011-02-22 16:49:19 +0800 | [diff] [blame] | 31 | #define MX23EVK_MMC0_WRITE_PROTECT MXS_GPIO_NR(1, 30) |
| 32 | #define MX23EVK_MMC0_SLOT_POWER MXS_GPIO_NR(1, 29) |
Shawn Guo | b73d77b | 2011-03-06 00:40:22 +0800 | [diff] [blame] | 33 | |
Shawn Guo | 55cf418 | 2010-12-20 22:57:44 +0800 | [diff] [blame] | 34 | static const iomux_cfg_t mx23evk_pads[] __initconst = { |
| 35 | /* duart */ |
Shawn Guo | db63a49 | 2011-03-06 00:40:19 +0800 | [diff] [blame] | 36 | MX23_PAD_PWM0__DUART_RX | MXS_PAD_CTRL, |
| 37 | MX23_PAD_PWM1__DUART_TX | MXS_PAD_CTRL, |
Shawn Guo | 2e8acbc | 2011-02-17 14:28:51 +0800 | [diff] [blame] | 38 | |
| 39 | /* auart */ |
Shawn Guo | db63a49 | 2011-03-06 00:40:19 +0800 | [diff] [blame] | 40 | MX23_PAD_AUART1_RX__AUART1_RX | MXS_PAD_CTRL, |
| 41 | MX23_PAD_AUART1_TX__AUART1_TX | MXS_PAD_CTRL, |
| 42 | MX23_PAD_AUART1_CTS__AUART1_CTS | MXS_PAD_CTRL, |
| 43 | MX23_PAD_AUART1_RTS__AUART1_RTS | MXS_PAD_CTRL, |
Shawn Guo | b73d77b | 2011-03-06 00:40:22 +0800 | [diff] [blame] | 44 | |
| 45 | /* mxsfb (lcdif) */ |
| 46 | MX23_PAD_LCD_D00__LCD_D00 | MXS_PAD_CTRL, |
| 47 | MX23_PAD_LCD_D01__LCD_D01 | MXS_PAD_CTRL, |
| 48 | MX23_PAD_LCD_D02__LCD_D02 | MXS_PAD_CTRL, |
| 49 | MX23_PAD_LCD_D03__LCD_D03 | MXS_PAD_CTRL, |
| 50 | MX23_PAD_LCD_D04__LCD_D04 | MXS_PAD_CTRL, |
| 51 | MX23_PAD_LCD_D05__LCD_D05 | MXS_PAD_CTRL, |
| 52 | MX23_PAD_LCD_D06__LCD_D06 | MXS_PAD_CTRL, |
| 53 | MX23_PAD_LCD_D07__LCD_D07 | MXS_PAD_CTRL, |
| 54 | MX23_PAD_LCD_D08__LCD_D08 | MXS_PAD_CTRL, |
| 55 | MX23_PAD_LCD_D09__LCD_D09 | MXS_PAD_CTRL, |
| 56 | MX23_PAD_LCD_D10__LCD_D10 | MXS_PAD_CTRL, |
| 57 | MX23_PAD_LCD_D11__LCD_D11 | MXS_PAD_CTRL, |
| 58 | MX23_PAD_LCD_D12__LCD_D12 | MXS_PAD_CTRL, |
| 59 | MX23_PAD_LCD_D13__LCD_D13 | MXS_PAD_CTRL, |
| 60 | MX23_PAD_LCD_D14__LCD_D14 | MXS_PAD_CTRL, |
| 61 | MX23_PAD_LCD_D15__LCD_D15 | MXS_PAD_CTRL, |
| 62 | MX23_PAD_LCD_D16__LCD_D16 | MXS_PAD_CTRL, |
| 63 | MX23_PAD_LCD_D17__LCD_D17 | MXS_PAD_CTRL, |
| 64 | MX23_PAD_GPMI_D08__LCD_D18 | MXS_PAD_CTRL, |
| 65 | MX23_PAD_GPMI_D09__LCD_D19 | MXS_PAD_CTRL, |
| 66 | MX23_PAD_GPMI_D10__LCD_D20 | MXS_PAD_CTRL, |
| 67 | MX23_PAD_GPMI_D11__LCD_D21 | MXS_PAD_CTRL, |
| 68 | MX23_PAD_GPMI_D12__LCD_D22 | MXS_PAD_CTRL, |
| 69 | MX23_PAD_GPMI_D13__LCD_D23 | MXS_PAD_CTRL, |
| 70 | MX23_PAD_LCD_VSYNC__LCD_VSYNC | MXS_PAD_CTRL, |
| 71 | MX23_PAD_LCD_HSYNC__LCD_HSYNC | MXS_PAD_CTRL, |
| 72 | MX23_PAD_LCD_DOTCK__LCD_DOTCK | MXS_PAD_CTRL, |
| 73 | MX23_PAD_LCD_ENABLE__LCD_ENABLE | MXS_PAD_CTRL, |
| 74 | /* LCD panel enable */ |
| 75 | MX23_PAD_LCD_RESET__GPIO_1_18 | MXS_PAD_CTRL, |
| 76 | /* backlight control */ |
| 77 | MX23_PAD_PWM2__GPIO_1_28 | MXS_PAD_CTRL, |
Shawn Guo | 1b6f1e8 | 2011-02-22 16:49:19 +0800 | [diff] [blame] | 78 | |
| 79 | /* mmc */ |
| 80 | MX23_PAD_SSP1_DATA0__SSP1_DATA0 | |
| 81 | (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), |
| 82 | MX23_PAD_SSP1_DATA1__SSP1_DATA1 | |
| 83 | (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), |
| 84 | MX23_PAD_SSP1_DATA2__SSP1_DATA2 | |
| 85 | (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), |
| 86 | MX23_PAD_SSP1_DATA3__SSP1_DATA3 | |
| 87 | (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), |
| 88 | MX23_PAD_GPMI_D08__SSP1_DATA4 | |
| 89 | (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), |
| 90 | MX23_PAD_GPMI_D09__SSP1_DATA5 | |
| 91 | (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), |
| 92 | MX23_PAD_GPMI_D10__SSP1_DATA6 | |
| 93 | (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), |
| 94 | MX23_PAD_GPMI_D11__SSP1_DATA7 | |
| 95 | (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), |
| 96 | MX23_PAD_SSP1_CMD__SSP1_CMD | |
| 97 | (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), |
| 98 | MX23_PAD_SSP1_DETECT__SSP1_DETECT | |
| 99 | (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_NOPULL), |
| 100 | MX23_PAD_SSP1_SCK__SSP1_SCK | |
| 101 | (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_NOPULL), |
| 102 | /* write protect */ |
| 103 | MX23_PAD_PWM4__GPIO_1_30 | |
| 104 | (MXS_PAD_4MA | MXS_PAD_3V3 | MXS_PAD_NOPULL), |
| 105 | /* slot power enable */ |
| 106 | MX23_PAD_PWM3__GPIO_1_29 | |
| 107 | (MXS_PAD_4MA | MXS_PAD_3V3 | MXS_PAD_NOPULL), |
Shawn Guo | b73d77b | 2011-03-06 00:40:22 +0800 | [diff] [blame] | 108 | }; |
| 109 | |
| 110 | /* mxsfb (lcdif) */ |
| 111 | static struct fb_videomode mx23evk_video_modes[] = { |
| 112 | { |
| 113 | .name = "Samsung-LMS430HF02", |
| 114 | .refresh = 60, |
| 115 | .xres = 480, |
| 116 | .yres = 272, |
| 117 | .pixclock = 108096, /* picosecond (9.2 MHz) */ |
| 118 | .left_margin = 15, |
| 119 | .right_margin = 8, |
| 120 | .upper_margin = 12, |
| 121 | .lower_margin = 4, |
| 122 | .hsync_len = 1, |
| 123 | .vsync_len = 1, |
| 124 | .sync = FB_SYNC_DATA_ENABLE_HIGH_ACT | |
| 125 | FB_SYNC_DOTCLK_FAILING_ACT, |
| 126 | }, |
| 127 | }; |
| 128 | |
| 129 | static const struct mxsfb_platform_data mx23evk_mxsfb_pdata __initconst = { |
| 130 | .mode_list = mx23evk_video_modes, |
| 131 | .mode_count = ARRAY_SIZE(mx23evk_video_modes), |
| 132 | .default_bpp = 32, |
| 133 | .ld_intf_width = STMLCDIF_24BIT, |
Shawn Guo | 55cf418 | 2010-12-20 22:57:44 +0800 | [diff] [blame] | 134 | }; |
| 135 | |
Shawn Guo | 1b6f1e8 | 2011-02-22 16:49:19 +0800 | [diff] [blame] | 136 | static struct mxs_mmc_platform_data mx23evk_mmc_pdata __initdata = { |
| 137 | .wp_gpio = MX23EVK_MMC0_WRITE_PROTECT, |
| 138 | .flags = SLOTF_8_BIT_CAPABLE, |
| 139 | }; |
| 140 | |
Shawn Guo | 55cf418 | 2010-12-20 22:57:44 +0800 | [diff] [blame] | 141 | static void __init mx23evk_init(void) |
| 142 | { |
Shawn Guo | b73d77b | 2011-03-06 00:40:22 +0800 | [diff] [blame] | 143 | int ret; |
| 144 | |
Shawn Guo | 55cf418 | 2010-12-20 22:57:44 +0800 | [diff] [blame] | 145 | mxs_iomux_setup_multiple_pads(mx23evk_pads, ARRAY_SIZE(mx23evk_pads)); |
| 146 | |
| 147 | mx23_add_duart(); |
Shawn Guo | 2e8acbc | 2011-02-17 14:28:51 +0800 | [diff] [blame] | 148 | mx23_add_auart0(); |
Shawn Guo | b73d77b | 2011-03-06 00:40:22 +0800 | [diff] [blame] | 149 | |
Shawn Guo | 1b6f1e8 | 2011-02-22 16:49:19 +0800 | [diff] [blame] | 150 | /* power on mmc slot by writing 0 to the gpio */ |
| 151 | ret = gpio_request_one(MX23EVK_MMC0_SLOT_POWER, GPIOF_DIR_OUT, |
| 152 | "mmc0-slot-power"); |
| 153 | if (ret) |
| 154 | pr_warn("failed to request gpio mmc0-slot-power: %d\n", ret); |
| 155 | mx23_add_mxs_mmc(0, &mx23evk_mmc_pdata); |
| 156 | |
Shawn Guo | b73d77b | 2011-03-06 00:40:22 +0800 | [diff] [blame] | 157 | ret = gpio_request_one(MX23EVK_LCD_ENABLE, GPIOF_DIR_OUT, "lcd-enable"); |
| 158 | if (ret) |
| 159 | pr_warn("failed to request gpio lcd-enable: %d\n", ret); |
| 160 | else |
| 161 | gpio_set_value(MX23EVK_LCD_ENABLE, 1); |
| 162 | |
| 163 | ret = gpio_request_one(MX23EVK_BL_ENABLE, GPIOF_DIR_OUT, "bl-enable"); |
| 164 | if (ret) |
| 165 | pr_warn("failed to request gpio bl-enable: %d\n", ret); |
| 166 | else |
| 167 | gpio_set_value(MX23EVK_BL_ENABLE, 1); |
| 168 | |
| 169 | mx23_add_mxsfb(&mx23evk_mxsfb_pdata); |
Shawn Guo | 55cf418 | 2010-12-20 22:57:44 +0800 | [diff] [blame] | 170 | } |
| 171 | |
| 172 | static void __init mx23evk_timer_init(void) |
| 173 | { |
| 174 | mx23_clocks_init(); |
| 175 | } |
| 176 | |
| 177 | static struct sys_timer mx23evk_timer = { |
| 178 | .init = mx23evk_timer_init, |
| 179 | }; |
| 180 | |
| 181 | MACHINE_START(MX23EVK, "Freescale MX23 EVK") |
| 182 | /* Maintainer: Freescale Semiconductor, Inc. */ |
| 183 | .map_io = mx23_map_io, |
| 184 | .init_irq = mx23_init_irq, |
| 185 | .init_machine = mx23evk_init, |
| 186 | .timer = &mx23evk_timer, |
| 187 | MACHINE_END |