blob: e8603eba54bd508e520ee4f60df00edd3187ed8a [file] [log] [blame]
Zbynek Michlb7eb1a52009-01-02 00:26:13 +01001/*
2 * linux/arch/arm/mach-pxa/himalaya.c
3 *
4 * Hardware definitions for the HTC Himalaya
5 *
6 * Based on 2.6.21-hh20's himalaya.c and himalaya_lcd.c
7 *
8 * Copyright (c) 2008 Zbynek Michl <Zbynek.Michl@seznam.cz>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/device.h>
18#include <linux/fb.h>
19#include <linux/platform_device.h>
20
21#include <video/w100fb.h>
22
23#include <asm/setup.h>
24#include <asm/mach-types.h>
25#include <asm/mach/arch.h>
26
27#include <mach/mfp-pxa25x.h>
28#include <mach/hardware.h>
Zbynek Michlb7eb1a52009-01-02 00:26:13 +010029
30#include "generic.h"
31
32/* ---------------------- Himalaya LCD definitions -------------------- */
33
34static struct w100_gen_regs himalaya_lcd_regs = {
35 .lcd_format = 0x00000003,
36 .lcdd_cntl1 = 0x00000000,
37 .lcdd_cntl2 = 0x0003ffff,
38 .genlcd_cntl1 = 0x00fff003,
39 .genlcd_cntl2 = 0x00000003,
40 .genlcd_cntl3 = 0x000102aa,
41};
42
43static struct w100_mode himalaya4_lcd_mode = {
44 .xres = 240,
45 .yres = 320,
46 .left_margin = 0,
47 .right_margin = 31,
48 .upper_margin = 15,
49 .lower_margin = 0,
50 .crtc_ss = 0x80150014,
51 .crtc_ls = 0xa0fb00f7,
52 .crtc_gs = 0xc0080007,
53 .crtc_vpos_gs = 0x00080007,
54 .crtc_rev = 0x0000000a,
55 .crtc_dclk = 0x81700030,
56 .crtc_gclk = 0x8015010f,
57 .crtc_goe = 0x00000000,
58 .pll_freq = 80,
59 .pixclk_divider = 15,
60 .pixclk_divider_rotated = 15,
61 .pixclk_src = CLK_SRC_PLL,
62 .sysclk_divider = 0,
63 .sysclk_src = CLK_SRC_PLL,
64};
65
66static struct w100_mode himalaya6_lcd_mode = {
67 .xres = 240,
68 .yres = 320,
69 .left_margin = 9,
70 .right_margin = 8,
71 .upper_margin = 5,
72 .lower_margin = 4,
73 .crtc_ss = 0x80150014,
74 .crtc_ls = 0xa0fb00f7,
75 .crtc_gs = 0xc0080007,
76 .crtc_vpos_gs = 0x00080007,
77 .crtc_rev = 0x0000000a,
78 .crtc_dclk = 0xa1700030,
79 .crtc_gclk = 0x8015010f,
80 .crtc_goe = 0x00000000,
81 .pll_freq = 95,
82 .pixclk_divider = 0xb,
83 .pixclk_divider_rotated = 4,
84 .pixclk_src = CLK_SRC_PLL,
85 .sysclk_divider = 1,
86 .sysclk_src = CLK_SRC_PLL,
87};
88
89static struct w100_gpio_regs himalaya_w100_gpio_info = {
90 .init_data1 = 0xffff0000, /* GPIO_DATA */
91 .gpio_dir1 = 0x00000000, /* GPIO_CNTL1 */
92 .gpio_oe1 = 0x003c0000, /* GPIO_CNTL2 */
93 .init_data2 = 0x00000000, /* GPIO_DATA2 */
94 .gpio_dir2 = 0x00000000, /* GPIO_CNTL3 */
95 .gpio_oe2 = 0x00000000, /* GPIO_CNTL4 */
96};
97
98static struct w100fb_mach_info himalaya_fb_info = {
99 .num_modes = 1,
100 .regs = &himalaya_lcd_regs,
101 .gpio = &himalaya_w100_gpio_info,
102 .xtal_freq = 16000000,
103};
104
105static struct resource himalaya_fb_resources[] = {
106 [0] = {
107 .start = 0x08000000,
108 .end = 0x08ffffff,
109 .flags = IORESOURCE_MEM,
110 },
111};
112
113static struct platform_device himalaya_fb_device = {
114 .name = "w100fb",
115 .id = -1,
116 .dev = {
117 .platform_data = &himalaya_fb_info,
118 },
119 .num_resources = ARRAY_SIZE(himalaya_fb_resources),
120 .resource = himalaya_fb_resources,
121};
122
123/* ----------------------------------------------------------------------- */
124
125static struct platform_device *devices[] __initdata = {
126 &himalaya_fb_device,
127};
128
129static void __init himalaya_lcd_init(void)
130{
131 int himalaya_boardid;
132
133 himalaya_boardid = 0x4; /* hardcoded (detection needs ASIC3 functions) */
134 printk(KERN_INFO "himalaya LCD Driver init. boardid=%d\n",
135 himalaya_boardid);
136
137 switch (himalaya_boardid) {
138 case 0x4:
139 himalaya_fb_info.modelist = &himalaya4_lcd_mode;
140 break;
141 case 0x6:
142 himalaya_fb_info.modelist = &himalaya6_lcd_mode;
143 break;
144 default:
145 printk(KERN_INFO "himalaya lcd_init: unknown boardid=%d. Using 0x4\n",
146 himalaya_boardid);
147 himalaya_fb_info.modelist = &himalaya4_lcd_mode;
148 }
149}
150
151static void __init himalaya_init(void)
152{
Russell Kingcc155c62009-11-09 13:34:08 +0800153 pxa_set_ffuart_info(NULL);
154 pxa_set_btuart_info(NULL);
155 pxa_set_stuart_info(NULL);
Zbynek Michlb7eb1a52009-01-02 00:26:13 +0100156 himalaya_lcd_init();
157 platform_add_devices(devices, ARRAY_SIZE(devices));
158}
159
160
161MACHINE_START(HIMALAYA, "HTC Himalaya")
Zbynek Michlb7eb1a52009-01-02 00:26:13 +0100162 .boot_params = 0xa0000100,
Marek Vasut851982c2010-10-11 02:20:19 +0200163 .map_io = pxa25x_map_io,
Zbynek Michlb7eb1a52009-01-02 00:26:13 +0100164 .init_irq = pxa25x_init_irq,
165 .init_machine = himalaya_init,
166 .timer = &pxa_timer,
167MACHINE_END