blob: 3b5794cd03576a9e9ac880450041afac756c6e0c [file] [log] [blame]
Tanmay Upadhyayf16e05c2011-05-02 11:30:00 +05301/*
2 * linux/arch/arm/mach-mmp/gplugd.c
3 *
4 * Support for the Marvell PXA168-based GuruPlug Display (gplugD) Platform.
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 version 2 as
8 * publishhed by the Free Software Foundation.
9 */
10
11#include <linux/init.h>
Haojian Zhuange71dc5f72013-03-15 16:27:53 +080012#include <linux/platform_device.h>
Linus Walleijf55be1b2011-09-28 09:11:30 +010013#include <linux/gpio.h>
Haojian Zhuangb8f649f2013-04-09 18:12:04 +080014#include <linux/gpio-pxa.h>
Sebastian Hesselbarthe7de17a2014-10-22 20:26:45 +020015#include <linux/phy.h>
Tanmay Upadhyayf16e05c2011-05-02 11:30:00 +053016
17#include <asm/mach/arch.h>
18#include <asm/mach-types.h>
19
Haojian Zhuangbac6f612012-07-30 22:20:34 +080020#include <mach/irqs.h>
Tanmay Upadhyayf16e05c2011-05-02 11:30:00 +053021#include <mach/pxa168.h>
22#include <mach/mfp-pxa168.h>
Tanmay Upadhyayf16e05c2011-05-02 11:30:00 +053023
24#include "common.h"
25
26static unsigned long gplugd_pin_config[] __initdata = {
27 /* UART3 */
Tanmay Upadhyay3647a402011-07-14 15:07:15 +053028 GPIO8_UART3_TXD,
29 GPIO9_UART3_RXD,
30 GPIO1O_UART3_CTS,
31 GPIO11_UART3_RTS,
32
33 /* USB OTG PEN */
34 GPIO18_GPIO,
Tanmay Upadhyayf16e05c2011-05-02 11:30:00 +053035
36 /* MMC2 */
37 GPIO28_MMC2_CMD,
38 GPIO29_MMC2_CLK,
39 GPIO30_MMC2_DAT0,
40 GPIO31_MMC2_DAT1,
41 GPIO32_MMC2_DAT2,
42 GPIO33_MMC2_DAT3,
43
44 /* LCD & HDMI clock selection GPIO: 0: 74.176MHz, 1: 74.25 MHz */
45 GPIO35_GPIO,
46 GPIO36_GPIO, /* CEC Interrupt */
47
48 /* MMC1 */
49 GPIO43_MMC1_CLK,
50 GPIO49_MMC1_CMD,
51 GPIO41_MMC1_DAT0,
52 GPIO40_MMC1_DAT1,
53 GPIO52_MMC1_DAT2,
54 GPIO51_MMC1_DAT3,
55 GPIO53_MMC1_CD,
56
57 /* LCD */
58 GPIO56_LCD_FCLK_RD,
59 GPIO57_LCD_LCLK_A0,
60 GPIO58_LCD_PCLK_WR,
61 GPIO59_LCD_DENA_BIAS,
62 GPIO60_LCD_DD0,
63 GPIO61_LCD_DD1,
64 GPIO62_LCD_DD2,
65 GPIO63_LCD_DD3,
66 GPIO64_LCD_DD4,
67 GPIO65_LCD_DD5,
68 GPIO66_LCD_DD6,
69 GPIO67_LCD_DD7,
70 GPIO68_LCD_DD8,
71 GPIO69_LCD_DD9,
72 GPIO70_LCD_DD10,
73 GPIO71_LCD_DD11,
74 GPIO72_LCD_DD12,
75 GPIO73_LCD_DD13,
76 GPIO74_LCD_DD14,
77 GPIO75_LCD_DD15,
78 GPIO76_LCD_DD16,
79 GPIO77_LCD_DD17,
80 GPIO78_LCD_DD18,
81 GPIO79_LCD_DD19,
82 GPIO80_LCD_DD20,
83 GPIO81_LCD_DD21,
84 GPIO82_LCD_DD22,
85 GPIO83_LCD_DD23,
86
87 /* GPIO */
88 GPIO84_GPIO,
89 GPIO85_GPIO,
90
91 /* Fast-Ethernet*/
92 GPIO86_TX_CLK,
93 GPIO87_TX_EN,
94 GPIO88_TX_DQ3,
95 GPIO89_TX_DQ2,
96 GPIO90_TX_DQ1,
97 GPIO91_TX_DQ0,
98 GPIO92_MII_CRS,
99 GPIO93_MII_COL,
100 GPIO94_RX_CLK,
101 GPIO95_RX_ER,
102 GPIO96_RX_DQ3,
103 GPIO97_RX_DQ2,
104 GPIO98_RX_DQ1,
105 GPIO99_RX_DQ0,
106 GPIO100_MII_MDC,
107 GPIO101_MII_MDIO,
108 GPIO103_RX_DV,
109 GPIO104_GPIO, /* Reset PHY */
110
111 /* RTC interrupt */
112 GPIO102_GPIO,
113
114 /* I2C */
115 GPIO105_CI2C_SDA,
116 GPIO106_CI2C_SCL,
117
Tanmay Upadhyay3647a402011-07-14 15:07:15 +0530118 /* SPI NOR Flash on SSP2 */
119 GPIO107_SSP2_RXD,
120 GPIO108_SSP2_TXD,
121 GPIO110_GPIO, /* SPI_CSn */
122 GPIO111_SSP2_CLK,
123
Tanmay Upadhyayf16e05c2011-05-02 11:30:00 +0530124 /* Select JTAG */
125 GPIO109_GPIO,
126
127 /* I2S */
128 GPIO114_I2S_FRM,
129 GPIO115_I2S_BCLK,
130 GPIO116_I2S_TXD
131};
132
Haojian Zhuangb8f649f2013-04-09 18:12:04 +0800133static struct pxa_gpio_platform_data pxa168_gpio_pdata = {
134 .irq_base = MMP_GPIO_TO_IRQ(0),
135};
136
Tanmay Upadhyayf16e05c2011-05-02 11:30:00 +0530137static struct i2c_board_info gplugd_i2c_board_info[] = {
138 {
139 .type = "isl1208",
140 .addr = 0x6F,
141 }
142};
143
144/* Bring PHY out of reset by setting GPIO 104 */
145static int gplugd_eth_init(void)
146{
147 if (unlikely(gpio_request(104, "ETH_RESET_N"))) {
148 printk(KERN_ERR "Can't get hold of GPIO 104 to bring Ethernet "
149 "PHY out of reset\n");
150 return -EIO;
151 }
152
153 gpio_direction_output(104, 1);
154 gpio_free(104);
155 return 0;
156}
157
158struct pxa168_eth_platform_data gplugd_eth_platform_data = {
159 .port_number = 0,
160 .phy_addr = 0,
161 .speed = 0, /* Autonagotiation */
Sebastian Hesselbarthe7de17a2014-10-22 20:26:45 +0200162 .intf = PHY_INTERFACE_MODE_RMII,
Tanmay Upadhyayf16e05c2011-05-02 11:30:00 +0530163 .init = gplugd_eth_init,
164};
165
166static void __init select_disp_freq(void)
167{
168 /* set GPIO 35 & clear GPIO 85 to set LCD External Clock to 74.25 MHz */
169 if (unlikely(gpio_request(35, "DISP_FREQ_SEL"))) {
170 printk(KERN_ERR "Can't get hold of GPIO 35 to select display "
171 "frequency\n");
172 } else {
173 gpio_direction_output(35, 1);
Tanmay Upadhyay4c22ea82011-07-14 15:07:16 +0530174 gpio_free(35);
Tanmay Upadhyayf16e05c2011-05-02 11:30:00 +0530175 }
176
177 if (unlikely(gpio_request(85, "DISP_FREQ_SEL_2"))) {
178 printk(KERN_ERR "Can't get hold of GPIO 85 to select display "
179 "frequency\n");
180 } else {
181 gpio_direction_output(85, 0);
Tanmay Upadhyay4c22ea82011-07-14 15:07:16 +0530182 gpio_free(85);
Tanmay Upadhyayf16e05c2011-05-02 11:30:00 +0530183 }
184}
185
186static void __init gplugd_init(void)
187{
188 mfp_config(ARRAY_AND_SIZE(gplugd_pin_config));
189
190 select_disp_freq();
191
192 /* on-chip devices */
193 pxa168_add_uart(3);
Eric Miaoe4b3bbe2011-11-11 20:11:14 +0800194 pxa168_add_ssp(1);
Tanmay Upadhyayf16e05c2011-05-02 11:30:00 +0530195 pxa168_add_twsi(0, NULL, ARRAY_AND_SIZE(gplugd_i2c_board_info));
Haojian Zhuangb8f649f2013-04-09 18:12:04 +0800196 platform_device_add_data(&pxa168_device_gpio, &pxa168_gpio_pdata,
197 sizeof(struct pxa_gpio_platform_data));
Haojian Zhuang157d2642011-10-17 20:37:52 +0800198 platform_device_register(&pxa168_device_gpio);
Tanmay Upadhyayf16e05c2011-05-02 11:30:00 +0530199
200 pxa168_add_eth(&gplugd_eth_platform_data);
201}
202
Eric Miaoc149f6c2011-08-16 12:28:57 +0800203MACHINE_START(GPLUGD, "PXA168-based GuruPlug Display (gplugD) Platform")
Tanmay Upadhyayf16e05c2011-05-02 11:30:00 +0530204 .map_io = mmp_map_io,
Rob Herring8661fb92012-01-03 16:50:40 -0600205 .nr_irqs = MMP_NR_IRQS,
Tanmay Upadhyayf16e05c2011-05-02 11:30:00 +0530206 .init_irq = pxa168_init_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700207 .init_time = pxa168_timer_init,
Tanmay Upadhyayf16e05c2011-05-02 11:30:00 +0530208 .init_machine = gplugd_init,
Russell King9854a382011-11-05 15:40:09 +0000209 .restart = pxa168_restart,
Tanmay Upadhyayf16e05c2011-05-02 11:30:00 +0530210MACHINE_END