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