aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mxs
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-mxs')
-rw-r--r--arch/arm/mach-mxs/Kconfig1
-rw-r--r--arch/arm/mach-mxs/Makefile.boot9
-rw-r--r--arch/arm/mach-mxs/devices-mx23.h2
-rw-r--r--arch/arm/mach-mxs/devices-mx28.h2
-rw-r--r--arch/arm/mach-mxs/devices/platform-mxsfb.c2
-rw-r--r--arch/arm/mach-mxs/include/mach/mxsfb.h49
-rw-r--r--arch/arm/mach-mxs/mach-apx4devkit.c11
-rw-r--r--arch/arm/mach-mxs/mach-mxs.c215
-rw-r--r--arch/arm/mach-mxs/module-tx28.c2
9 files changed, 235 insertions, 58 deletions
diff --git a/arch/arm/mach-mxs/Kconfig b/arch/arm/mach-mxs/Kconfig
index 91cf0625819c..ccdf83b17cf1 100644
--- a/arch/arm/mach-mxs/Kconfig
+++ b/arch/arm/mach-mxs/Kconfig
@@ -16,6 +16,7 @@ config SOC_IMX28
16 bool 16 bool
17 select ARM_AMBA 17 select ARM_AMBA
18 select CPU_ARM926T 18 select CPU_ARM926T
19 select HAVE_CAN_FLEXCAN if CAN
19 select HAVE_PWM 20 select HAVE_PWM
20 select PINCTRL_IMX28 21 select PINCTRL_IMX28
21 22
diff --git a/arch/arm/mach-mxs/Makefile.boot b/arch/arm/mach-mxs/Makefile.boot
index 07b11fe6453f..4582999cf080 100644
--- a/arch/arm/mach-mxs/Makefile.boot
+++ b/arch/arm/mach-mxs/Makefile.boot
@@ -1 +1,10 @@
1zreladdr-y += 0x40008000 1zreladdr-y += 0x40008000
2
3dtb-y += imx23-evk.dtb \
4 imx23-olinuxino.dtb \
5 imx23-stmp378x_devb.dtb \
6 imx28-apx4devkit.dtb \
7 imx28-cfa10036.dtb \
8 imx28-evk.dtb \
9 imx28-m28evk.dtb \
10 imx28-tx28.dtb \
diff --git a/arch/arm/mach-mxs/devices-mx23.h b/arch/arm/mach-mxs/devices-mx23.h
index 9acdd6387047..9ee5cede3d42 100644
--- a/arch/arm/mach-mxs/devices-mx23.h
+++ b/arch/arm/mach-mxs/devices-mx23.h
@@ -10,7 +10,7 @@
10 */ 10 */
11#include <mach/mx23.h> 11#include <mach/mx23.h>
12#include <mach/devices-common.h> 12#include <mach/devices-common.h>
13#include <mach/mxsfb.h> 13#include <linux/mxsfb.h>
14#include <linux/amba/bus.h> 14#include <linux/amba/bus.h>
15 15
16static inline int mx23_add_duart(void) 16static inline int mx23_add_duart(void)
diff --git a/arch/arm/mach-mxs/devices-mx28.h b/arch/arm/mach-mxs/devices-mx28.h
index 84b2960df117..fcab431060f4 100644
--- a/arch/arm/mach-mxs/devices-mx28.h
+++ b/arch/arm/mach-mxs/devices-mx28.h
@@ -10,7 +10,7 @@
10 */ 10 */
11#include <mach/mx28.h> 11#include <mach/mx28.h>
12#include <mach/devices-common.h> 12#include <mach/devices-common.h>
13#include <mach/mxsfb.h> 13#include <linux/mxsfb.h>
14#include <linux/amba/bus.h> 14#include <linux/amba/bus.h>
15 15
16static inline int mx28_add_duart(void) 16static inline int mx28_add_duart(void)
diff --git a/arch/arm/mach-mxs/devices/platform-mxsfb.c b/arch/arm/mach-mxs/devices/platform-mxsfb.c
index 5a75b7180f74..76b53f73418e 100644
--- a/arch/arm/mach-mxs/devices/platform-mxsfb.c
+++ b/arch/arm/mach-mxs/devices/platform-mxsfb.c
@@ -10,7 +10,7 @@
10#include <mach/mx23.h> 10#include <mach/mx23.h>
11#include <mach/mx28.h> 11#include <mach/mx28.h>
12#include <mach/devices-common.h> 12#include <mach/devices-common.h>
13#include <mach/mxsfb.h> 13#include <linux/mxsfb.h>
14 14
15#ifdef CONFIG_SOC_IMX23 15#ifdef CONFIG_SOC_IMX23
16struct platform_device *__init mx23_add_mxsfb( 16struct platform_device *__init mx23_add_mxsfb(
diff --git a/arch/arm/mach-mxs/include/mach/mxsfb.h b/arch/arm/mach-mxs/include/mach/mxsfb.h
deleted file mode 100644
index e4d79791515e..000000000000
--- a/arch/arm/mach-mxs/include/mach/mxsfb.h
+++ /dev/null
@@ -1,49 +0,0 @@
1/*
2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU General Public License
4 * as published by the Free Software Foundation; either version 2
5 * of the License, or (at your option) any later version.
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
14 * MA 02110-1301, USA.
15 */
16
17#ifndef __MACH_FB_H
18#define __MACH_FB_H
19
20#include <linux/fb.h>
21
22#define STMLCDIF_8BIT 1 /** pixel data bus to the display is of 8 bit width */
23#define STMLCDIF_16BIT 0 /** pixel data bus to the display is of 16 bit width */
24#define STMLCDIF_18BIT 2 /** pixel data bus to the display is of 18 bit width */
25#define STMLCDIF_24BIT 3 /** pixel data bus to the display is of 24 bit width */
26
27#define FB_SYNC_DATA_ENABLE_HIGH_ACT (1 << 6)
28#define FB_SYNC_DOTCLK_FAILING_ACT (1 << 7) /* failing/negtive edge sampling */
29
30struct mxsfb_platform_data {
31 struct fb_videomode *mode_list;
32 unsigned mode_count;
33
34 unsigned default_bpp;
35
36 unsigned dotclk_delay; /* refer manual HW_LCDIF_VDCTRL4 register */
37 unsigned ld_intf_width; /* refer STMLCDIF_* macros */
38
39 unsigned fb_size; /* Size of the video memory. If zero a
40 * default will be used
41 */
42 unsigned long fb_phys; /* physical address for the video memory. If
43 * zero the framebuffer memory will be dynamically
44 * allocated. If specified,fb_size must also be specified.
45 * fb_phys must be unused by Linux.
46 */
47};
48
49#endif /* __MACH_FB_H */
diff --git a/arch/arm/mach-mxs/mach-apx4devkit.c b/arch/arm/mach-mxs/mach-apx4devkit.c
index 5e90b9dcdef8..f5f061757deb 100644
--- a/arch/arm/mach-mxs/mach-apx4devkit.c
+++ b/arch/arm/mach-mxs/mach-apx4devkit.c
@@ -205,6 +205,16 @@ static int apx4devkit_phy_fixup(struct phy_device *phy)
205 return 0; 205 return 0;
206} 206}
207 207
208static void __init apx4devkit_fec_phy_clk_enable(void)
209{
210 struct clk *clk;
211
212 /* Enable fec phy clock */
213 clk = clk_get_sys("enet_out", NULL);
214 if (!IS_ERR(clk))
215 clk_prepare_enable(clk);
216}
217
208static void __init apx4devkit_init(void) 218static void __init apx4devkit_init(void)
209{ 219{
210 mx28_soc_init(); 220 mx28_soc_init();
@@ -225,6 +235,7 @@ static void __init apx4devkit_init(void)
225 phy_register_fixup_for_uid(PHY_ID_KS8051, MICREL_PHY_ID_MASK, 235 phy_register_fixup_for_uid(PHY_ID_KS8051, MICREL_PHY_ID_MASK,
226 apx4devkit_phy_fixup); 236 apx4devkit_phy_fixup);
227 237
238 apx4devkit_fec_phy_clk_enable();
228 mx28_add_fec(0, &mx28_fec_pdata); 239 mx28_add_fec(0, &mx28_fec_pdata);
229 240
230 mx28_add_mxs_mmc(0, &apx4devkit_mmc_pdata); 241 mx28_add_mxs_mmc(0, &apx4devkit_mmc_pdata);
diff --git a/arch/arm/mach-mxs/mach-mxs.c b/arch/arm/mach-mxs/mach-mxs.c
index 8cac94b33020..648bdd05d38b 100644
--- a/arch/arm/mach-mxs/mach-mxs.c
+++ b/arch/arm/mach-mxs/mach-mxs.c
@@ -16,12 +16,95 @@
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/irqdomain.h> 18#include <linux/irqdomain.h>
19#include <linux/micrel_phy.h>
20#include <linux/mxsfb.h>
19#include <linux/of_irq.h> 21#include <linux/of_irq.h>
20#include <linux/of_platform.h> 22#include <linux/of_platform.h>
23#include <linux/phy.h>
21#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
22#include <asm/mach/time.h> 25#include <asm/mach/time.h>
23#include <mach/common.h> 26#include <mach/common.h>
24 27
28static struct fb_videomode mx23evk_video_modes[] = {
29 {
30 .name = "Samsung-LMS430HF02",
31 .refresh = 60,
32 .xres = 480,
33 .yres = 272,
34 .pixclock = 108096, /* picosecond (9.2 MHz) */
35 .left_margin = 15,
36 .right_margin = 8,
37 .upper_margin = 12,
38 .lower_margin = 4,
39 .hsync_len = 1,
40 .vsync_len = 1,
41 .sync = FB_SYNC_DATA_ENABLE_HIGH_ACT |
42 FB_SYNC_DOTCLK_FAILING_ACT,
43 },
44};
45
46static struct fb_videomode mx28evk_video_modes[] = {
47 {
48 .name = "Seiko-43WVF1G",
49 .refresh = 60,
50 .xres = 800,
51 .yres = 480,
52 .pixclock = 29851, /* picosecond (33.5 MHz) */
53 .left_margin = 89,
54 .right_margin = 164,
55 .upper_margin = 23,
56 .lower_margin = 10,
57 .hsync_len = 10,
58 .vsync_len = 10,
59 .sync = FB_SYNC_DATA_ENABLE_HIGH_ACT |
60 FB_SYNC_DOTCLK_FAILING_ACT,
61 },
62};
63
64static struct fb_videomode m28evk_video_modes[] = {
65 {
66 .name = "Ampire AM-800480R2TMQW-T01H",
67 .refresh = 60,
68 .xres = 800,
69 .yres = 480,
70 .pixclock = 30066, /* picosecond (33.26 MHz) */
71 .left_margin = 0,
72 .right_margin = 256,
73 .upper_margin = 0,
74 .lower_margin = 45,
75 .hsync_len = 1,
76 .vsync_len = 1,
77 .sync = FB_SYNC_DATA_ENABLE_HIGH_ACT,
78 },
79};
80
81static struct fb_videomode apx4devkit_video_modes[] = {
82 {
83 .name = "HannStar PJ70112A",
84 .refresh = 60,
85 .xres = 800,
86 .yres = 480,
87 .pixclock = 33333, /* picosecond (30.00 MHz) */
88 .left_margin = 88,
89 .right_margin = 40,
90 .upper_margin = 32,
91 .lower_margin = 13,
92 .hsync_len = 48,
93 .vsync_len = 3,
94 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT |
95 FB_SYNC_DATA_ENABLE_HIGH_ACT |
96 FB_SYNC_DOTCLK_FAILING_ACT,
97 },
98};
99
100static struct mxsfb_platform_data mxsfb_pdata __initdata;
101
102static struct of_dev_auxdata mxs_auxdata_lookup[] __initdata = {
103 OF_DEV_AUXDATA("fsl,imx23-lcdif", 0x80030000, NULL, &mxsfb_pdata),
104 OF_DEV_AUXDATA("fsl,imx28-lcdif", 0x80030000, NULL, &mxsfb_pdata),
105 { /* sentinel */ }
106};
107
25static int __init mxs_icoll_add_irq_domain(struct device_node *np, 108static int __init mxs_icoll_add_irq_domain(struct device_node *np,
26 struct device_node *interrupt_parent) 109 struct device_node *interrupt_parent)
27{ 110{
@@ -71,33 +154,155 @@ static struct sys_timer imx28_timer = {
71 .init = imx28_timer_init, 154 .init = imx28_timer_init,
72}; 155};
73 156
74static void __init imx28_evk_init(void) 157enum mac_oui {
158 OUI_FSL,
159 OUI_DENX,
160};
161
162static void __init update_fec_mac_prop(enum mac_oui oui)
163{
164 struct device_node *np, *from = NULL;
165 struct property *oldmac, *newmac;
166 const u32 *ocotp = mxs_get_ocotp();
167 u8 *macaddr;
168 u32 val;
169 int i;
170
171 for (i = 0; i < 2; i++) {
172 np = of_find_compatible_node(from, NULL, "fsl,imx28-fec");
173 if (!np)
174 return;
175 from = np;
176
177 newmac = kzalloc(sizeof(*newmac) + 6, GFP_KERNEL);
178 if (!newmac)
179 return;
180 newmac->value = newmac + 1;
181 newmac->length = 6;
182
183 newmac->name = kstrdup("local-mac-address", GFP_KERNEL);
184 if (!newmac->name) {
185 kfree(newmac);
186 return;
187 }
188
189 /*
190 * OCOTP only stores the last 4 octets for each mac address,
191 * so hard-code OUI here.
192 */
193 macaddr = newmac->value;
194 switch (oui) {
195 case OUI_FSL:
196 macaddr[0] = 0x00;
197 macaddr[1] = 0x04;
198 macaddr[2] = 0x9f;
199 break;
200 case OUI_DENX:
201 macaddr[0] = 0xc0;
202 macaddr[1] = 0xe5;
203 macaddr[2] = 0x4e;
204 break;
205 }
206 val = ocotp[i];
207 macaddr[3] = (val >> 16) & 0xff;
208 macaddr[4] = (val >> 8) & 0xff;
209 macaddr[5] = (val >> 0) & 0xff;
210
211 oldmac = of_find_property(np, newmac->name, NULL);
212 if (oldmac)
213 prom_update_property(np, newmac, oldmac);
214 else
215 prom_add_property(np, newmac);
216 }
217}
218
219static void __init imx23_evk_init(void)
220{
221 mxsfb_pdata.mode_list = mx23evk_video_modes;
222 mxsfb_pdata.mode_count = ARRAY_SIZE(mx23evk_video_modes);
223 mxsfb_pdata.default_bpp = 32;
224 mxsfb_pdata.ld_intf_width = STMLCDIF_24BIT;
225}
226
227static inline void enable_clk_enet_out(void)
75{ 228{
76 struct clk *clk; 229 struct clk *clk = clk_get_sys("enet_out", NULL);
77 230
78 /* Enable fec phy clock */
79 clk = clk_get_sys("enet_out", NULL);
80 if (!IS_ERR(clk)) 231 if (!IS_ERR(clk))
81 clk_prepare_enable(clk); 232 clk_prepare_enable(clk);
82} 233}
83 234
235static void __init imx28_evk_init(void)
236{
237 enable_clk_enet_out();
238 update_fec_mac_prop(OUI_FSL);
239
240 mxsfb_pdata.mode_list = mx28evk_video_modes;
241 mxsfb_pdata.mode_count = ARRAY_SIZE(mx28evk_video_modes);
242 mxsfb_pdata.default_bpp = 32;
243 mxsfb_pdata.ld_intf_width = STMLCDIF_24BIT;
244}
245
246static void __init m28evk_init(void)
247{
248 enable_clk_enet_out();
249 update_fec_mac_prop(OUI_DENX);
250
251 mxsfb_pdata.mode_list = m28evk_video_modes;
252 mxsfb_pdata.mode_count = ARRAY_SIZE(m28evk_video_modes);
253 mxsfb_pdata.default_bpp = 16;
254 mxsfb_pdata.ld_intf_width = STMLCDIF_18BIT;
255}
256
257static int apx4devkit_phy_fixup(struct phy_device *phy)
258{
259 phy->dev_flags |= MICREL_PHY_50MHZ_CLK;
260 return 0;
261}
262
263static void __init apx4devkit_init(void)
264{
265 enable_clk_enet_out();
266
267 if (IS_BUILTIN(CONFIG_PHYLIB))
268 phy_register_fixup_for_uid(PHY_ID_KS8051, MICREL_PHY_ID_MASK,
269 apx4devkit_phy_fixup);
270
271 mxsfb_pdata.mode_list = apx4devkit_video_modes;
272 mxsfb_pdata.mode_count = ARRAY_SIZE(apx4devkit_video_modes);
273 mxsfb_pdata.default_bpp = 32;
274 mxsfb_pdata.ld_intf_width = STMLCDIF_24BIT;
275}
276
84static void __init mxs_machine_init(void) 277static void __init mxs_machine_init(void)
85{ 278{
86 if (of_machine_is_compatible("fsl,imx28-evk")) 279 if (of_machine_is_compatible("fsl,imx28-evk"))
87 imx28_evk_init(); 280 imx28_evk_init();
281 else if (of_machine_is_compatible("fsl,imx23-evk"))
282 imx23_evk_init();
283 else if (of_machine_is_compatible("denx,m28evk"))
284 m28evk_init();
285 else if (of_machine_is_compatible("bluegiga,apx4devkit"))
286 apx4devkit_init();
88 287
89 of_platform_populate(NULL, of_default_bus_match_table, 288 of_platform_populate(NULL, of_default_bus_match_table,
90 NULL, NULL); 289 mxs_auxdata_lookup, NULL);
91} 290}
92 291
93static const char *imx23_dt_compat[] __initdata = { 292static const char *imx23_dt_compat[] __initdata = {
94 "fsl,imx23-evk", 293 "fsl,imx23-evk",
294 "fsl,stmp378x_devb"
295 "olimex,imx23-olinuxino",
95 "fsl,imx23", 296 "fsl,imx23",
96 NULL, 297 NULL,
97}; 298};
98 299
99static const char *imx28_dt_compat[] __initdata = { 300static const char *imx28_dt_compat[] __initdata = {
301 "bluegiga,apx4devkit",
302 "crystalfontz,cfa10036",
303 "denx,m28evk",
100 "fsl,imx28-evk", 304 "fsl,imx28-evk",
305 "karo,tx28",
101 "fsl,imx28", 306 "fsl,imx28",
102 NULL, 307 NULL,
103}; 308};
diff --git a/arch/arm/mach-mxs/module-tx28.c b/arch/arm/mach-mxs/module-tx28.c
index 9a7b08b2a925..0f71f82101cc 100644
--- a/arch/arm/mach-mxs/module-tx28.c
+++ b/arch/arm/mach-mxs/module-tx28.c
@@ -11,7 +11,7 @@
11#include <linux/gpio.h> 11#include <linux/gpio.h>
12 12
13#include <mach/iomux-mx28.h> 13#include <mach/iomux-mx28.h>
14#include "../devices-mx28.h" 14#include "devices-mx28.h"
15 15
16#include "module-tx28.h" 16#include "module-tx28.h"
17 17