Linux 5.7.7
[linux/fpc-iii.git] / arch / arm / mach-sa1100 / lart.c
blobe3a0279750e396534a4f51cf81837761d7a97496
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * linux/arch/arm/mach-sa1100/lart.c
4 */
6 #include <linux/init.h>
7 #include <linux/kernel.h>
8 #include <linux/platform_data/sa11x0-serial.h>
9 #include <linux/tty.h>
10 #include <linux/gpio.h>
11 #include <linux/leds.h>
12 #include <linux/platform_device.h>
14 #include <video/sa1100fb.h>
16 #include <mach/hardware.h>
17 #include <asm/setup.h>
18 #include <asm/mach-types.h>
19 #include <asm/page.h>
21 #include <asm/mach/arch.h>
22 #include <asm/mach/map.h>
23 #include <linux/platform_data/mfd-mcp-sa11x0.h>
24 #include <mach/irqs.h>
26 #include "generic.h"
28 static struct mcp_plat_data lart_mcp_data = {
29 .mccr0 = MCCR0_ADM,
30 .sclk_rate = 11981000,
33 #ifdef LART_GREY_LCD
34 static struct sa1100fb_mach_info lart_grey_info = {
35 .pixclock = 150000, .bpp = 4,
36 .xres = 320, .yres = 240,
38 .hsync_len = 1, .vsync_len = 1,
39 .left_margin = 4, .upper_margin = 0,
40 .right_margin = 2, .lower_margin = 0,
42 .cmap_greyscale = 1,
43 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
45 .lccr0 = LCCR0_Mono | LCCR0_Sngl | LCCR0_Pas | LCCR0_4PixMono,
46 .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(512),
48 #endif
49 #ifdef LART_COLOR_LCD
50 static struct sa1100fb_mach_info lart_color_info = {
51 .pixclock = 150000, .bpp = 16,
52 .xres = 320, .yres = 240,
54 .hsync_len = 2, .vsync_len = 3,
55 .left_margin = 69, .upper_margin = 14,
56 .right_margin = 8, .lower_margin = 4,
58 .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act,
59 .lccr3 = LCCR3_OutEnH | LCCR3_PixFlEdg | LCCR3_ACBsDiv(512),
61 #endif
62 #ifdef LART_VIDEO_OUT
63 static struct sa1100fb_mach_info lart_video_info = {
64 .pixclock = 39721, .bpp = 16,
65 .xres = 640, .yres = 480,
67 .hsync_len = 95, .vsync_len = 2,
68 .left_margin = 40, .upper_margin = 32,
69 .right_margin = 24, .lower_margin = 11,
71 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
73 .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act,
74 .lccr3 = LCCR3_OutEnL | LCCR3_PixFlEdg | LCCR3_ACBsDiv(512),
76 #endif
78 #ifdef LART_KIT01_LCD
79 static struct sa1100fb_mach_info lart_kit01_info = {
80 .pixclock = 63291, .bpp = 16,
81 .xres = 640, .yres = 480,
83 .hsync_len = 64, .vsync_len = 3,
84 .left_margin = 122, .upper_margin = 45,
85 .right_margin = 10, .lower_margin = 10,
87 .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act,
88 .lccr3 = LCCR3_OutEnH | LCCR3_PixFlEdg
90 #endif
92 static void __init lart_init(void)
94 struct sa1100fb_mach_info *inf = NULL;
96 #ifdef LART_GREY_LCD
97 inf = &lart_grey_info;
98 #endif
99 #ifdef LART_COLOR_LCD
100 inf = &lart_color_info;
101 #endif
102 #ifdef LART_VIDEO_OUT
103 inf = &lart_video_info;
104 #endif
105 #ifdef LART_KIT01_LCD
106 inf = &lart_kit01_info;
107 #endif
109 if (inf)
110 sa11x0_register_lcd(inf);
112 sa11x0_ppc_configure_mcp();
113 sa11x0_register_mcp(&lart_mcp_data);
116 static struct map_desc lart_io_desc[] __initdata = {
117 { /* main flash memory */
118 .virtual = 0xe8000000,
119 .pfn = __phys_to_pfn(0x00000000),
120 .length = 0x00400000,
121 .type = MT_DEVICE
122 }, { /* main flash, alternative location */
123 .virtual = 0xec000000,
124 .pfn = __phys_to_pfn(0x08000000),
125 .length = 0x00400000,
126 .type = MT_DEVICE
130 /* LEDs */
131 struct gpio_led lart_gpio_leds[] = {
133 .name = "lart:red",
134 .default_trigger = "cpu0",
135 .gpio = 23,
139 static struct gpio_led_platform_data lart_gpio_led_info = {
140 .leds = lart_gpio_leds,
141 .num_leds = ARRAY_SIZE(lart_gpio_leds),
144 static struct platform_device lart_leds = {
145 .name = "leds-gpio",
146 .id = -1,
147 .dev = {
148 .platform_data = &lart_gpio_led_info,
151 static void __init lart_map_io(void)
153 sa1100_map_io();
154 iotable_init(lart_io_desc, ARRAY_SIZE(lart_io_desc));
156 sa1100_register_uart(0, 3);
157 sa1100_register_uart(1, 1);
158 sa1100_register_uart(2, 2);
160 GAFR |= (GPIO_UART_TXD | GPIO_UART_RXD);
161 GPDR |= GPIO_UART_TXD;
162 GPDR &= ~GPIO_UART_RXD;
163 PPAR |= PPAR_UPR;
165 platform_device_register(&lart_leds);
168 MACHINE_START(LART, "LART")
169 .atag_offset = 0x100,
170 .map_io = lart_map_io,
171 .nr_irqs = SA1100_NR_IRQS,
172 .init_irq = sa1100_init_irq,
173 .init_machine = lart_init,
174 .init_late = sa11x0_init_late,
175 .init_time = sa1100_timer_init,
176 .restart = sa11x0_restart,
177 MACHINE_END