Fabio Estevam | ec9be0d | 2009-04-16 12:45:01 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2009 Freescale Semiconductor, Inc. All Rights Reserved. |
| 3 | * |
| 4 | * Author: Fabio Estevam <fabio.estevam@freescale.com> |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
Fabio Estevam | ec9be0d | 2009-04-16 12:45:01 -0700 | [diff] [blame] | 15 | */ |
| 16 | |
Uwe Kleine-König | 8fdca37 | 2010-03-08 10:46:11 +0100 | [diff] [blame] | 17 | /* |
| 18 | * This machine is known as: |
| 19 | * - i.MX27 3-Stack Development System |
| 20 | * - i.MX27 Platform Development Kit (i.MX27 PDK) |
| 21 | */ |
| 22 | |
Fabio Estevam | ec9be0d | 2009-04-16 12:45:01 -0700 | [diff] [blame] | 23 | #include <linux/platform_device.h> |
| 24 | #include <linux/gpio.h> |
Rogerio Pimentel | b5ec73e | 2010-10-22 11:03:54 -0200 | [diff] [blame] | 25 | #include <linux/irq.h> |
Fabio Estevam | ec9be0d | 2009-04-16 12:45:01 -0700 | [diff] [blame] | 26 | #include <asm/mach-types.h> |
| 27 | #include <asm/mach/arch.h> |
| 28 | #include <asm/mach/time.h> |
| 29 | #include <mach/hardware.h> |
| 30 | #include <mach/common.h> |
Uwe Kleine-König | e835d88 | 2010-02-16 11:07:49 +0100 | [diff] [blame] | 31 | #include <mach/iomux-mx27.h> |
Fabio Estevam | ec9be0d | 2009-04-16 12:45:01 -0700 | [diff] [blame] | 32 | |
Uwe Kleine-König | d5dac4a | 2010-06-23 09:36:01 +0200 | [diff] [blame] | 33 | #include "devices-imx27.h" |
Fabio Estevam | ec9be0d | 2009-04-16 12:45:01 -0700 | [diff] [blame] | 34 | |
Rogerio Pimentel | b5ec73e | 2010-10-22 11:03:54 -0200 | [diff] [blame] | 35 | #define SD1_EN_GPIO (GPIO_PORTB + 25) |
| 36 | |
Uwe Kleine-König | 6c80ee5 | 2010-09-28 21:53:31 +0200 | [diff] [blame] | 37 | static const int mx27pdk_pins[] __initconst = { |
Fabio Estevam | ec9be0d | 2009-04-16 12:45:01 -0700 | [diff] [blame] | 38 | /* UART1 */ |
| 39 | PE12_PF_UART1_TXD, |
| 40 | PE13_PF_UART1_RXD, |
| 41 | PE14_PF_UART1_CTS, |
| 42 | PE15_PF_UART1_RTS, |
| 43 | /* FEC */ |
| 44 | PD0_AIN_FEC_TXD0, |
| 45 | PD1_AIN_FEC_TXD1, |
| 46 | PD2_AIN_FEC_TXD2, |
| 47 | PD3_AIN_FEC_TXD3, |
| 48 | PD4_AOUT_FEC_RX_ER, |
| 49 | PD5_AOUT_FEC_RXD1, |
| 50 | PD6_AOUT_FEC_RXD2, |
| 51 | PD7_AOUT_FEC_RXD3, |
| 52 | PD8_AF_FEC_MDIO, |
| 53 | PD9_AIN_FEC_MDC, |
| 54 | PD10_AOUT_FEC_CRS, |
| 55 | PD11_AOUT_FEC_TX_CLK, |
| 56 | PD12_AOUT_FEC_RXD0, |
| 57 | PD13_AOUT_FEC_RX_DV, |
| 58 | PD14_AOUT_FEC_RX_CLK, |
| 59 | PD15_AOUT_FEC_COL, |
| 60 | PD16_AIN_FEC_TX_ER, |
| 61 | PF23_AIN_FEC_TX_EN, |
Rogerio Pimentel | b5ec73e | 2010-10-22 11:03:54 -0200 | [diff] [blame] | 62 | /* SDHC1 */ |
| 63 | PE18_PF_SD1_D0, |
| 64 | PE19_PF_SD1_D1, |
| 65 | PE20_PF_SD1_D2, |
| 66 | PE21_PF_SD1_D3, |
| 67 | PE22_PF_SD1_CMD, |
| 68 | PE23_PF_SD1_CLK, |
| 69 | SD1_EN_GPIO | GPIO_GPIO | GPIO_OUT, |
Fabio Estevam | ec9be0d | 2009-04-16 12:45:01 -0700 | [diff] [blame] | 70 | }; |
| 71 | |
Uwe Kleine-König | d5dac4a | 2010-06-23 09:36:01 +0200 | [diff] [blame] | 72 | static const struct imxuart_platform_data uart_pdata __initconst = { |
Fabio Estevam | ec9be0d | 2009-04-16 12:45:01 -0700 | [diff] [blame] | 73 | .flags = IMXUART_HAVE_RTSCTS, |
| 74 | }; |
| 75 | |
Rogerio Pimentel | 3fac6cf | 2010-06-25 10:31:33 -0300 | [diff] [blame] | 76 | /* |
| 77 | * Matrix keyboard |
| 78 | */ |
| 79 | |
| 80 | static const uint32_t mx27_3ds_keymap[] = { |
| 81 | KEY(0, 0, KEY_UP), |
| 82 | KEY(0, 1, KEY_DOWN), |
| 83 | KEY(1, 0, KEY_RIGHT), |
| 84 | KEY(1, 1, KEY_LEFT), |
| 85 | KEY(1, 2, KEY_ENTER), |
| 86 | KEY(2, 0, KEY_F6), |
| 87 | KEY(2, 1, KEY_F8), |
| 88 | KEY(2, 2, KEY_F9), |
| 89 | KEY(2, 3, KEY_F10), |
| 90 | }; |
| 91 | |
Uwe Kleine-König | 3f88014 | 2010-11-10 09:58:56 +0100 | [diff] [blame] | 92 | static const struct matrix_keymap_data mx27_3ds_keymap_data __initconst = { |
Rogerio Pimentel | 3fac6cf | 2010-06-25 10:31:33 -0300 | [diff] [blame] | 93 | .keymap = mx27_3ds_keymap, |
| 94 | .keymap_size = ARRAY_SIZE(mx27_3ds_keymap), |
| 95 | }; |
| 96 | |
Rogerio Pimentel | b5ec73e | 2010-10-22 11:03:54 -0200 | [diff] [blame] | 97 | static int mx27_3ds_sdhc1_init(struct device *dev, irq_handler_t detect_irq, |
| 98 | void *data) |
| 99 | { |
| 100 | return request_irq(IRQ_GPIOB(26), detect_irq, IRQF_TRIGGER_FALLING | |
| 101 | IRQF_TRIGGER_RISING, "sdhc1-card-detect", data); |
| 102 | } |
| 103 | |
| 104 | static void mx27_3ds_sdhc1_exit(struct device *dev, void *data) |
| 105 | { |
| 106 | free_irq(IRQ_GPIOB(26), data); |
| 107 | } |
| 108 | |
Uwe Kleine-König | 9d3d945 | 2010-11-05 17:26:09 +0100 | [diff] [blame] | 109 | static const struct imxmmc_platform_data sdhc1_pdata __initconst = { |
Rogerio Pimentel | b5ec73e | 2010-10-22 11:03:54 -0200 | [diff] [blame] | 110 | .init = mx27_3ds_sdhc1_init, |
| 111 | .exit = mx27_3ds_sdhc1_exit, |
| 112 | }; |
| 113 | |
| 114 | static void mx27_3ds_sdhc1_enable_level_translator(void) |
| 115 | { |
| 116 | /* Turn on TXB0108 OE pin */ |
| 117 | gpio_request(SD1_EN_GPIO, "sd1_enable"); |
| 118 | gpio_direction_output(SD1_EN_GPIO, 1); |
| 119 | } |
| 120 | |
Fabio Estevam | ec9be0d | 2009-04-16 12:45:01 -0700 | [diff] [blame] | 121 | static void __init mx27pdk_init(void) |
| 122 | { |
| 123 | mxc_gpio_setup_multiple_pins(mx27pdk_pins, ARRAY_SIZE(mx27pdk_pins), |
| 124 | "mx27pdk"); |
Rogerio Pimentel | b5ec73e | 2010-10-22 11:03:54 -0200 | [diff] [blame] | 125 | mx27_3ds_sdhc1_enable_level_translator(); |
Uwe Kleine-König | d5dac4a | 2010-06-23 09:36:01 +0200 | [diff] [blame] | 126 | imx27_add_imx_uart0(&uart_pdata); |
Uwe Kleine-König | 6bd96f3 | 2010-10-06 12:00:18 +0200 | [diff] [blame] | 127 | imx27_add_fec(NULL); |
Uwe Kleine-König | 3f88014 | 2010-11-10 09:58:56 +0100 | [diff] [blame] | 128 | imx27_add_imx_keypad(&mx27_3ds_keymap_data); |
Uwe Kleine-König | 9d3d945 | 2010-11-05 17:26:09 +0100 | [diff] [blame] | 129 | imx27_add_mxc_mmc(0, &sdhc1_pdata); |
Fabio Estevam | ec9be0d | 2009-04-16 12:45:01 -0700 | [diff] [blame] | 130 | } |
| 131 | |
| 132 | static void __init mx27pdk_timer_init(void) |
| 133 | { |
| 134 | mx27_clocks_init(26000000); |
| 135 | } |
| 136 | |
| 137 | static struct sys_timer mx27pdk_timer = { |
| 138 | .init = mx27pdk_timer_init, |
| 139 | }; |
| 140 | |
| 141 | MACHINE_START(MX27_3DS, "Freescale MX27PDK") |
| 142 | /* maintainer: Freescale Semiconductor, Inc. */ |
Uwe Kleine-König | 3410123 | 2010-01-29 17:36:05 +0100 | [diff] [blame] | 143 | .boot_params = MX27_PHYS_OFFSET + 0x100, |
Simon POLETTE | add85a4 | 2009-06-04 12:09:01 +0200 | [diff] [blame] | 144 | .map_io = mx27_map_io, |
Sascha Hauer | c5aa0ad | 2009-05-25 17:36:19 +0200 | [diff] [blame] | 145 | .init_irq = mx27_init_irq, |
Fabio Estevam | ec9be0d | 2009-04-16 12:45:01 -0700 | [diff] [blame] | 146 | .init_machine = mx27pdk_init, |
| 147 | .timer = &mx27pdk_timer, |
| 148 | MACHINE_END |