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 | #include "devices.h" |
| 35 | |
Rogerio Pimentel | b5ec73e | 2010-10-22 11:03:54 -0200 | [diff] [blame] | 36 | #define SD1_EN_GPIO (GPIO_PORTB + 25) |
| 37 | |
Uwe Kleine-König | 6c80ee5 | 2010-09-28 21:53:31 +0200 | [diff] [blame] | 38 | static const int mx27pdk_pins[] __initconst = { |
Fabio Estevam | ec9be0d | 2009-04-16 12:45:01 -0700 | [diff] [blame] | 39 | /* UART1 */ |
| 40 | PE12_PF_UART1_TXD, |
| 41 | PE13_PF_UART1_RXD, |
| 42 | PE14_PF_UART1_CTS, |
| 43 | PE15_PF_UART1_RTS, |
| 44 | /* FEC */ |
| 45 | PD0_AIN_FEC_TXD0, |
| 46 | PD1_AIN_FEC_TXD1, |
| 47 | PD2_AIN_FEC_TXD2, |
| 48 | PD3_AIN_FEC_TXD3, |
| 49 | PD4_AOUT_FEC_RX_ER, |
| 50 | PD5_AOUT_FEC_RXD1, |
| 51 | PD6_AOUT_FEC_RXD2, |
| 52 | PD7_AOUT_FEC_RXD3, |
| 53 | PD8_AF_FEC_MDIO, |
| 54 | PD9_AIN_FEC_MDC, |
| 55 | PD10_AOUT_FEC_CRS, |
| 56 | PD11_AOUT_FEC_TX_CLK, |
| 57 | PD12_AOUT_FEC_RXD0, |
| 58 | PD13_AOUT_FEC_RX_DV, |
| 59 | PD14_AOUT_FEC_RX_CLK, |
| 60 | PD15_AOUT_FEC_COL, |
| 61 | PD16_AIN_FEC_TX_ER, |
| 62 | PF23_AIN_FEC_TX_EN, |
Rogerio Pimentel | b5ec73e | 2010-10-22 11:03:54 -0200 | [diff] [blame] | 63 | /* SDHC1 */ |
| 64 | PE18_PF_SD1_D0, |
| 65 | PE19_PF_SD1_D1, |
| 66 | PE20_PF_SD1_D2, |
| 67 | PE21_PF_SD1_D3, |
| 68 | PE22_PF_SD1_CMD, |
| 69 | PE23_PF_SD1_CLK, |
| 70 | SD1_EN_GPIO | GPIO_GPIO | GPIO_OUT, |
Fabio Estevam | ec9be0d | 2009-04-16 12:45:01 -0700 | [diff] [blame] | 71 | }; |
| 72 | |
Uwe Kleine-König | d5dac4a | 2010-06-23 09:36:01 +0200 | [diff] [blame] | 73 | static const struct imxuart_platform_data uart_pdata __initconst = { |
Fabio Estevam | ec9be0d | 2009-04-16 12:45:01 -0700 | [diff] [blame] | 74 | .flags = IMXUART_HAVE_RTSCTS, |
| 75 | }; |
| 76 | |
Rogerio Pimentel | 3fac6cf | 2010-06-25 10:31:33 -0300 | [diff] [blame] | 77 | /* |
| 78 | * Matrix keyboard |
| 79 | */ |
| 80 | |
| 81 | static const uint32_t mx27_3ds_keymap[] = { |
| 82 | KEY(0, 0, KEY_UP), |
| 83 | KEY(0, 1, KEY_DOWN), |
| 84 | KEY(1, 0, KEY_RIGHT), |
| 85 | KEY(1, 1, KEY_LEFT), |
| 86 | KEY(1, 2, KEY_ENTER), |
| 87 | KEY(2, 0, KEY_F6), |
| 88 | KEY(2, 1, KEY_F8), |
| 89 | KEY(2, 2, KEY_F9), |
| 90 | KEY(2, 3, KEY_F10), |
| 91 | }; |
| 92 | |
Uwe Kleine-König | 3f88014 | 2010-11-10 09:58:56 +0100 | [diff] [blame^] | 93 | static const struct matrix_keymap_data mx27_3ds_keymap_data __initconst = { |
Rogerio Pimentel | 3fac6cf | 2010-06-25 10:31:33 -0300 | [diff] [blame] | 94 | .keymap = mx27_3ds_keymap, |
| 95 | .keymap_size = ARRAY_SIZE(mx27_3ds_keymap), |
| 96 | }; |
| 97 | |
Rogerio Pimentel | b5ec73e | 2010-10-22 11:03:54 -0200 | [diff] [blame] | 98 | static int mx27_3ds_sdhc1_init(struct device *dev, irq_handler_t detect_irq, |
| 99 | void *data) |
| 100 | { |
| 101 | return request_irq(IRQ_GPIOB(26), detect_irq, IRQF_TRIGGER_FALLING | |
| 102 | IRQF_TRIGGER_RISING, "sdhc1-card-detect", data); |
| 103 | } |
| 104 | |
| 105 | static void mx27_3ds_sdhc1_exit(struct device *dev, void *data) |
| 106 | { |
| 107 | free_irq(IRQ_GPIOB(26), data); |
| 108 | } |
| 109 | |
Uwe Kleine-König | 9d3d945 | 2010-11-05 17:26:09 +0100 | [diff] [blame] | 110 | static const struct imxmmc_platform_data sdhc1_pdata __initconst = { |
Rogerio Pimentel | b5ec73e | 2010-10-22 11:03:54 -0200 | [diff] [blame] | 111 | .init = mx27_3ds_sdhc1_init, |
| 112 | .exit = mx27_3ds_sdhc1_exit, |
| 113 | }; |
| 114 | |
| 115 | static void mx27_3ds_sdhc1_enable_level_translator(void) |
| 116 | { |
| 117 | /* Turn on TXB0108 OE pin */ |
| 118 | gpio_request(SD1_EN_GPIO, "sd1_enable"); |
| 119 | gpio_direction_output(SD1_EN_GPIO, 1); |
| 120 | } |
| 121 | |
Fabio Estevam | ec9be0d | 2009-04-16 12:45:01 -0700 | [diff] [blame] | 122 | static void __init mx27pdk_init(void) |
| 123 | { |
| 124 | mxc_gpio_setup_multiple_pins(mx27pdk_pins, ARRAY_SIZE(mx27pdk_pins), |
| 125 | "mx27pdk"); |
Rogerio Pimentel | b5ec73e | 2010-10-22 11:03:54 -0200 | [diff] [blame] | 126 | mx27_3ds_sdhc1_enable_level_translator(); |
Uwe Kleine-König | d5dac4a | 2010-06-23 09:36:01 +0200 | [diff] [blame] | 127 | imx27_add_imx_uart0(&uart_pdata); |
Uwe Kleine-König | 6bd96f3 | 2010-10-06 12:00:18 +0200 | [diff] [blame] | 128 | imx27_add_fec(NULL); |
Uwe Kleine-König | 3f88014 | 2010-11-10 09:58:56 +0100 | [diff] [blame^] | 129 | imx27_add_imx_keypad(&mx27_3ds_keymap_data); |
Uwe Kleine-König | 9d3d945 | 2010-11-05 17:26:09 +0100 | [diff] [blame] | 130 | imx27_add_mxc_mmc(0, &sdhc1_pdata); |
Fabio Estevam | ec9be0d | 2009-04-16 12:45:01 -0700 | [diff] [blame] | 131 | } |
| 132 | |
| 133 | static void __init mx27pdk_timer_init(void) |
| 134 | { |
| 135 | mx27_clocks_init(26000000); |
| 136 | } |
| 137 | |
| 138 | static struct sys_timer mx27pdk_timer = { |
| 139 | .init = mx27pdk_timer_init, |
| 140 | }; |
| 141 | |
| 142 | MACHINE_START(MX27_3DS, "Freescale MX27PDK") |
| 143 | /* maintainer: Freescale Semiconductor, Inc. */ |
Uwe Kleine-König | 3410123 | 2010-01-29 17:36:05 +0100 | [diff] [blame] | 144 | .boot_params = MX27_PHYS_OFFSET + 0x100, |
Simon POLETTE | add85a4 | 2009-06-04 12:09:01 +0200 | [diff] [blame] | 145 | .map_io = mx27_map_io, |
Sascha Hauer | c5aa0ad | 2009-05-25 17:36:19 +0200 | [diff] [blame] | 146 | .init_irq = mx27_init_irq, |
Fabio Estevam | ec9be0d | 2009-04-16 12:45:01 -0700 | [diff] [blame] | 147 | .init_machine = mx27pdk_init, |
| 148 | .timer = &mx27pdk_timer, |
| 149 | MACHINE_END |