Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /*
0003  * linux/arch/arm/mach-sa1100/lart.c
0004  */
0005 
0006 #include <linux/init.h>
0007 #include <linux/kernel.h>
0008 #include <linux/platform_data/sa11x0-serial.h>
0009 #include <linux/tty.h>
0010 #include <linux/gpio.h>
0011 #include <linux/leds.h>
0012 #include <linux/platform_device.h>
0013 
0014 #include <video/sa1100fb.h>
0015 
0016 #include <mach/hardware.h>
0017 #include <asm/setup.h>
0018 #include <asm/mach-types.h>
0019 #include <asm/page.h>
0020 
0021 #include <asm/mach/arch.h>
0022 #include <asm/mach/map.h>
0023 #include <linux/platform_data/mfd-mcp-sa11x0.h>
0024 #include <mach/irqs.h>
0025 
0026 #include "generic.h"
0027 
0028 static struct mcp_plat_data lart_mcp_data = {
0029     .mccr0      = MCCR0_ADM,
0030     .sclk_rate  = 11981000,
0031 };
0032 
0033 #ifdef LART_GREY_LCD
0034 static struct sa1100fb_mach_info lart_grey_info = {
0035     .pixclock   = 150000,   .bpp        = 4,
0036     .xres       = 320,      .yres       = 240,
0037 
0038     .hsync_len  = 1,        .vsync_len  = 1,
0039     .left_margin    = 4,        .upper_margin   = 0,
0040     .right_margin   = 2,        .lower_margin   = 0,
0041 
0042     .cmap_greyscale = 1,
0043     .sync       = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
0044 
0045     .lccr0      = LCCR0_Mono | LCCR0_Sngl | LCCR0_Pas | LCCR0_4PixMono,
0046     .lccr3      = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(512),
0047 };
0048 #endif
0049 #ifdef LART_COLOR_LCD
0050 static struct sa1100fb_mach_info lart_color_info = {
0051     .pixclock   = 150000,   .bpp        = 16,
0052     .xres       = 320,      .yres       = 240,
0053 
0054     .hsync_len  = 2,        .vsync_len  = 3,
0055     .left_margin    = 69,       .upper_margin   = 14,
0056     .right_margin   = 8,        .lower_margin   = 4,
0057 
0058     .lccr0      = LCCR0_Color | LCCR0_Sngl | LCCR0_Act,
0059     .lccr3      = LCCR3_OutEnH | LCCR3_PixFlEdg | LCCR3_ACBsDiv(512),
0060 };
0061 #endif
0062 #ifdef LART_VIDEO_OUT
0063 static struct sa1100fb_mach_info lart_video_info = {
0064     .pixclock   = 39721,    .bpp        = 16,
0065     .xres       = 640,      .yres       = 480,
0066 
0067     .hsync_len  = 95,       .vsync_len  = 2,
0068     .left_margin    = 40,       .upper_margin   = 32,
0069     .right_margin   = 24,       .lower_margin   = 11,
0070 
0071     .sync       = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
0072 
0073     .lccr0      = LCCR0_Color | LCCR0_Sngl | LCCR0_Act,
0074     .lccr3      = LCCR3_OutEnL | LCCR3_PixFlEdg | LCCR3_ACBsDiv(512),
0075 };
0076 #endif
0077 
0078 #ifdef LART_KIT01_LCD
0079 static struct sa1100fb_mach_info lart_kit01_info = {
0080     .pixclock   = 63291,    .bpp        = 16,
0081     .xres       = 640,      .yres       = 480,
0082 
0083     .hsync_len  = 64,       .vsync_len  = 3,
0084     .left_margin    = 122,      .upper_margin   = 45,
0085     .right_margin   = 10,       .lower_margin   = 10,
0086 
0087     .lccr0      = LCCR0_Color | LCCR0_Sngl | LCCR0_Act,
0088     .lccr3      = LCCR3_OutEnH | LCCR3_PixFlEdg
0089 };
0090 #endif
0091 
0092 static void __init lart_init(void)
0093 {
0094     struct sa1100fb_mach_info *inf = NULL;
0095 
0096 #ifdef LART_GREY_LCD
0097     inf = &lart_grey_info;
0098 #endif
0099 #ifdef LART_COLOR_LCD
0100     inf = &lart_color_info;
0101 #endif
0102 #ifdef LART_VIDEO_OUT
0103     inf = &lart_video_info;
0104 #endif
0105 #ifdef LART_KIT01_LCD
0106     inf = &lart_kit01_info;
0107 #endif
0108 
0109     if (inf)
0110         sa11x0_register_lcd(inf);
0111 
0112     sa11x0_ppc_configure_mcp();
0113     sa11x0_register_mcp(&lart_mcp_data);
0114 }
0115 
0116 static struct map_desc lart_io_desc[] __initdata = {
0117     {   /* main flash memory */
0118         .virtual    =  0xe8000000,
0119         .pfn        = __phys_to_pfn(0x00000000),
0120         .length     = 0x00400000,
0121         .type       = MT_DEVICE
0122     }, {    /* main flash, alternative location */
0123         .virtual    =  0xec000000,
0124         .pfn        = __phys_to_pfn(0x08000000),
0125         .length     = 0x00400000,
0126         .type       = MT_DEVICE
0127     }
0128 };
0129 
0130 /* LEDs */
0131 struct gpio_led lart_gpio_leds[] = {
0132     {
0133         .name           = "lart:red",
0134         .default_trigger    = "cpu0",
0135         .gpio           = 23,
0136     },
0137 };
0138 
0139 static struct gpio_led_platform_data lart_gpio_led_info = {
0140     .leds       = lart_gpio_leds,
0141     .num_leds   = ARRAY_SIZE(lart_gpio_leds),
0142 };
0143 
0144 static struct platform_device lart_leds = {
0145     .name   = "leds-gpio",
0146     .id = -1,
0147     .dev    = {
0148         .platform_data  = &lart_gpio_led_info,
0149     }
0150 };
0151 static void __init lart_map_io(void)
0152 {
0153     sa1100_map_io();
0154     iotable_init(lart_io_desc, ARRAY_SIZE(lart_io_desc));
0155 
0156     sa1100_register_uart(0, 3);
0157     sa1100_register_uart(1, 1);
0158     sa1100_register_uart(2, 2);
0159 
0160     GAFR |= (GPIO_UART_TXD | GPIO_UART_RXD);
0161     GPDR |= GPIO_UART_TXD;
0162     GPDR &= ~GPIO_UART_RXD;
0163     PPAR |= PPAR_UPR;
0164 
0165     platform_device_register(&lart_leds);
0166 }
0167 
0168 MACHINE_START(LART, "LART")
0169     .atag_offset    = 0x100,
0170     .map_io     = lart_map_io,
0171     .nr_irqs    = SA1100_NR_IRQS,
0172     .init_irq   = sa1100_init_irq,
0173     .init_machine   = lart_init,
0174     .init_late  = sa11x0_init_late,
0175     .init_time  = sa1100_timer_init,
0176     .restart    = sa11x0_restart,
0177 MACHINE_END