1 | /*
|
2 | * init code specific for ICNova Base
|
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>
|
11 | #include <linux/linkage.h>
|
12 | #include <linux/clk.h>
|
13 | #include <linux/etherdevice.h>
|
14 | #include <linux/init.h>
|
15 | #include <linux/kernel.h>
|
16 | #include <linux/platform_device.h>
|
17 | #include <linux/string.h>
|
18 | #include <linux/types.h>
|
19 | #include <linux/spi/spi.h>
|
20 |
|
21 | #include <asm/io.h>
|
22 | #include <asm/setup.h>
|
23 | #include <asm/arch/at32ap700x.h>
|
24 | #include <asm/arch/board.h>
|
25 | #include <asm/arch/init.h>
|
26 | #include <asm/arch/portmux.h>
|
27 |
|
28 | #include "icnova.h"
|
29 | #include "led.h"
|
30 | #include "btn.h"
|
31 | #include "mac.h"
|
32 | #include "pwm.h"
|
33 |
|
34 | #include <linux/fb.h>
|
35 | #include <video/atmel_lcdc.h>
|
36 |
|
37 |
|
38 | #undef ICNOVA_USB_CP2102
|
39 |
|
40 | static struct i2c_board_info grasshopper_i2c[] = {
|
41 | };
|
42 |
|
43 |
|
44 | static struct fb_videomode grasshopper_tft_modes[] = {
|
45 | {
|
46 | .name = "TX09D70 @ 60", // name of mode
|
47 | .refresh = 60, // refresh rate
|
48 | .xres = 480, // horizontal resolution
|
49 | .yres = 272, // vertical resolution
|
50 | .pixclock = KHZ2PICOS(9000), // pixel clock in kHz
|
51 | .left_margin = 2, // h. front porch
|
52 | .right_margin = 2, // h. back porch
|
53 | .upper_margin = 12, // v. front porch
|
54 | .lower_margin = 2, // v. back porch
|
55 | .hsync_len = 41, // hsync length
|
56 | .vsync_len = 10, // vsync lengt
|
57 | /* .sync = , //FB_SYNC_HOR_LOW_ACT | FB_SYNC_VERT_LOW_ACT,
|
58 | // Active high hsync impulse , active high vsync impulse */
|
59 | .vmode = FB_VMODE_NONINTERLACED,
|
60 | // always send a full frame to the display
|
61 | },
|
62 | };
|
63 |
|
64 | static struct fb_monspecs __initdata grasshopper_default_monspecs = {
|
65 | .manufacturer = "ATM", // ATM = Atmel
|
66 | .monitor = "GENERIC", // Generic type
|
67 | .modedb = grasshopper_tft_modes,
|
68 | .modedb_len = ARRAY_SIZE(grasshopper_tft_modes),
|
69 | .hfmin = 14820, // doesn't affect the lcdc!
|
70 | .hfmax = 32000, // doesn't affect the lcdc!
|
71 | .vfmin = 30, // doesn't affect the lcdc!
|
72 | .vfmax = 200, // doesn't affect the lcdc!
|
73 | .dclkmax = 30000000, // doesn't affect the lcdc!
|
74 | };
|
75 |
|
76 | struct atmel_lcdfb_info __initdata grasshopper_lcdc_data = {
|
77 | .default_bpp = 24, // Color depth
|
78 | .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
|
79 | .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
|
80 | | ATMEL_LCDC_SCANMOD_SINGLE
|
81 | | ATMEL_LCDC_INVLINE_INVERTED
|
82 | | ATMEL_LCDC_INVFRAME_INVERTED
|
83 | | ATMEL_LCDC_INVCLK_NORMAL
|
84 | | ATMEL_LCDC_PIXELSIZE_24
|
85 | | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE
|
86 | | ATMEL_LCDC_MEMOR_BIG),
|
87 |
|
88 |
|
89 |
|
90 | /*
|
91 | .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
|
92 | .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
|
93 | | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE
|
94 | | ATMEL_LCDC_MEMOR_BIG),
|
95 |
|
96 | */
|
97 | .default_monspecs = &grasshopper_default_monspecs,
|
98 | .guard_time = 2,
|
99 | };
|
100 |
|
101 |
|
102 | void __init setup_board(void)
|
103 | {
|
104 | at32_map_usart(0, 0); // USART 0: /dev/ttyS0, IF-to-USB-UART_Bridge
|
105 | #ifdef ICNOVA_USB_CP2102
|
106 | at32_map_usart(1, 1); // USART 1: /dev/ttyS0, CP2102
|
107 | #endif
|
108 |
|
109 | at32_setup_serial_console(0);
|
110 | }
|
111 |
|
112 | static int __init icnova_init(void)
|
113 | {
|
114 |
|
115 | icnova_reserve_pins();
|
116 |
|
117 | at32_add_system_devices();
|
118 |
|
119 | at32_add_device_usart(0);
|
120 | #ifdef ICNOVA_USB_CP2102
|
121 | at32_add_device_usart(1);
|
122 | #endif
|
123 |
|
124 | at32_add_device_pwm((1<<2));
|
125 | icnova_setup_pwm(2,25000000); // 25MHz
|
126 |
|
127 | icnova_setup_leds();
|
128 | icnova_setup_buttons();
|
129 |
|
130 | set_hw_addr(at32_add_device_eth(0, ð_data[0]));
|
131 |
|
132 | at32_add_device_twi(0,grasshopper_i2c,ARRAY_SIZE(grasshopper_i2c));
|
133 | at32_add_device_usba(0, NULL);
|
134 | at32_add_device_lcdc(0, &grasshopper_lcdc_data, fbmem_start, fbmem_size);
|
135 |
|
136 | return 0;
|
137 | }
|
138 | postcore_initcall(icnova_init);
|