Haavard Skinnemoen | 5f97f7f | 2006-09-25 23:32:13 -0700 | [diff] [blame] | 1 | /* |
| 2 | * ATSTK1000 board-specific setup code. |
| 3 | * |
| 4 | * Copyright (C) 2005-2006 Atmel Corporation |
| 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 | * published by the Free Software Foundation. |
| 9 | */ |
| 10 | #include <linux/bootmem.h> |
Haavard Skinnemoen | d0a2b7a | 2007-03-21 18:08:49 +0100 | [diff] [blame] | 11 | #include <linux/fb.h> |
Haavard Skinnemoen | 5f97f7f | 2006-09-25 23:32:13 -0700 | [diff] [blame] | 12 | #include <linux/init.h> |
Haavard Skinnemoen | f4c41b2 | 2007-10-29 16:02:51 +0100 | [diff] [blame] | 13 | #include <linux/platform_device.h> |
Haavard Skinnemoen | 5f97f7f | 2006-09-25 23:32:13 -0700 | [diff] [blame] | 14 | #include <linux/types.h> |
| 15 | #include <linux/linkage.h> |
| 16 | |
Haavard Skinnemoen | d0a2b7a | 2007-03-21 18:08:49 +0100 | [diff] [blame] | 17 | #include <video/atmel_lcdc.h> |
Haavard Skinnemoen | 5f97f7f | 2006-09-25 23:32:13 -0700 | [diff] [blame] | 18 | |
Haavard Skinnemoen | d0a2b7a | 2007-03-21 18:08:49 +0100 | [diff] [blame] | 19 | #include <asm/setup.h> |
Haavard Skinnemoen | f4c41b2 | 2007-10-29 16:02:51 +0100 | [diff] [blame] | 20 | |
Haavard Skinnemoen | 3663b73 | 2008-08-05 13:57:38 +0200 | [diff] [blame] | 21 | #include <mach/at32ap700x.h> |
| 22 | #include <mach/board.h> |
| 23 | #include <mach/portmux.h> |
Haavard Skinnemoen | 5f97f7f | 2006-09-25 23:32:13 -0700 | [diff] [blame] | 24 | |
Haavard Skinnemoen | d0a2b7a | 2007-03-21 18:08:49 +0100 | [diff] [blame] | 25 | #include "atstk1000.h" |
| 26 | |
Haavard Skinnemoen | 5f97f7f | 2006-09-25 23:32:13 -0700 | [diff] [blame] | 27 | /* Initialized by bootloader-specific startup code. */ |
| 28 | struct tag *bootloader_tags __initdata; |
Haavard Skinnemoen | d0a2b7a | 2007-03-21 18:08:49 +0100 | [diff] [blame] | 29 | |
| 30 | static struct fb_videomode __initdata ltv350qv_modes[] = { |
| 31 | { |
| 32 | .name = "320x240 @ 75", |
| 33 | .refresh = 75, |
| 34 | .xres = 320, .yres = 240, |
| 35 | .pixclock = KHZ2PICOS(6891), |
| 36 | |
| 37 | .left_margin = 17, .right_margin = 33, |
| 38 | .upper_margin = 10, .lower_margin = 10, |
| 39 | .hsync_len = 16, .vsync_len = 1, |
| 40 | |
| 41 | .sync = 0, |
| 42 | .vmode = FB_VMODE_NONINTERLACED, |
| 43 | }, |
| 44 | }; |
| 45 | |
| 46 | static struct fb_monspecs __initdata atstk1000_default_monspecs = { |
| 47 | .manufacturer = "SNG", |
| 48 | .monitor = "LTV350QV", |
| 49 | .modedb = ltv350qv_modes, |
| 50 | .modedb_len = ARRAY_SIZE(ltv350qv_modes), |
| 51 | .hfmin = 14820, |
| 52 | .hfmax = 22230, |
| 53 | .vfmin = 60, |
| 54 | .vfmax = 90, |
| 55 | .dclkmax = 30000000, |
| 56 | }; |
| 57 | |
Jean-Christophe PLAGNIOL-VILLARD | 8af2c28 | 2013-03-28 22:53:42 +0800 | [diff] [blame] | 58 | struct atmel_lcdfb_pdata __initdata atstk1000_lcdc_data = { |
Haavard Skinnemoen | d0a2b7a | 2007-03-21 18:08:49 +0100 | [diff] [blame] | 59 | .default_bpp = 24, |
| 60 | .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN, |
| 61 | .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT |
| 62 | | ATMEL_LCDC_INVCLK |
| 63 | | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE |
| 64 | | ATMEL_LCDC_MEMOR_BIG), |
| 65 | .default_monspecs = &atstk1000_default_monspecs, |
| 66 | .guard_time = 2, |
| 67 | }; |
Haavard Skinnemoen | f4c41b2 | 2007-10-29 16:02:51 +0100 | [diff] [blame] | 68 | |
| 69 | #ifdef CONFIG_BOARD_ATSTK1000_J2_LED |
| 70 | #include <linux/leds.h> |
| 71 | |
| 72 | static struct gpio_led stk1000_j2_led[] = { |
| 73 | #ifdef CONFIG_BOARD_ATSTK1000_J2_LED8 |
| 74 | #define LEDSTRING "J2 jumpered to LED8" |
| 75 | { .name = "led0:amber", .gpio = GPIO_PIN_PB( 8), }, |
| 76 | { .name = "led1:amber", .gpio = GPIO_PIN_PB( 9), }, |
| 77 | { .name = "led2:amber", .gpio = GPIO_PIN_PB(10), }, |
| 78 | { .name = "led3:amber", .gpio = GPIO_PIN_PB(13), }, |
| 79 | { .name = "led4:amber", .gpio = GPIO_PIN_PB(14), }, |
| 80 | { .name = "led5:amber", .gpio = GPIO_PIN_PB(15), }, |
| 81 | { .name = "led6:amber", .gpio = GPIO_PIN_PB(16), }, |
| 82 | { .name = "led7:amber", .gpio = GPIO_PIN_PB(30), |
| 83 | .default_trigger = "heartbeat", }, |
| 84 | #else /* RGB */ |
| 85 | #define LEDSTRING "J2 jumpered to RGB LEDs" |
| 86 | { .name = "r1:red", .gpio = GPIO_PIN_PB( 8), }, |
| 87 | { .name = "g1:green", .gpio = GPIO_PIN_PB(10), }, |
| 88 | { .name = "b1:blue", .gpio = GPIO_PIN_PB(14), }, |
| 89 | |
| 90 | { .name = "r2:red", .gpio = GPIO_PIN_PB( 9), |
| 91 | .default_trigger = "heartbeat", }, |
| 92 | { .name = "g2:green", .gpio = GPIO_PIN_PB(13), }, |
| 93 | { .name = "b2:blue", .gpio = GPIO_PIN_PB(15), |
| 94 | .default_trigger = "heartbeat", }, |
| 95 | /* PB16, PB30 unused */ |
| 96 | #endif |
| 97 | }; |
| 98 | |
| 99 | static struct gpio_led_platform_data stk1000_j2_led_data = { |
| 100 | .num_leds = ARRAY_SIZE(stk1000_j2_led), |
| 101 | .leds = stk1000_j2_led, |
| 102 | }; |
| 103 | |
| 104 | static struct platform_device stk1000_j2_led_dev = { |
| 105 | .name = "leds-gpio", |
| 106 | .id = 2, /* gpio block J2 */ |
| 107 | .dev = { |
| 108 | .platform_data = &stk1000_j2_led_data, |
| 109 | }, |
| 110 | }; |
| 111 | |
| 112 | void __init atstk1000_setup_j2_leds(void) |
| 113 | { |
| 114 | unsigned i; |
| 115 | |
| 116 | for (i = 0; i < ARRAY_SIZE(stk1000_j2_led); i++) |
| 117 | at32_select_gpio(stk1000_j2_led[i].gpio, AT32_GPIOF_OUTPUT); |
| 118 | |
| 119 | printk("STK1000: " LEDSTRING "\n"); |
| 120 | platform_device_register(&stk1000_j2_led_dev); |
| 121 | } |
| 122 | #else /* CONFIG_BOARD_ATSTK1000_J2_LED */ |
| 123 | void __init atstk1000_setup_j2_leds(void) |
| 124 | { |
| 125 | |
| 126 | } |
| 127 | #endif /* CONFIG_BOARD_ATSTK1000_J2_LED */ |