Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * linux/arch/arm/mach-pxa/himalaya.c
0004  *
0005  * Hardware definitions for the HTC Himalaya
0006  *
0007  * Based on 2.6.21-hh20's himalaya.c and himalaya_lcd.c
0008  *
0009  * Copyright (c) 2008 Zbynek Michl <Zbynek.Michl@seznam.cz>
0010  */
0011 
0012 #include <linux/kernel.h>
0013 #include <linux/init.h>
0014 #include <linux/device.h>
0015 #include <linux/fb.h>
0016 #include <linux/platform_device.h>
0017 
0018 #include <video/w100fb.h>
0019 
0020 #include <asm/setup.h>
0021 #include <asm/mach-types.h>
0022 #include <asm/mach/arch.h>
0023 
0024 #include "pxa25x.h"
0025 
0026 #include "generic.h"
0027 
0028 /* ---------------------- Himalaya LCD definitions -------------------- */
0029 
0030 static struct w100_gen_regs himalaya_lcd_regs = {
0031     .lcd_format =        0x00000003,
0032     .lcdd_cntl1 =        0x00000000,
0033     .lcdd_cntl2 =        0x0003ffff,
0034     .genlcd_cntl1 =      0x00fff003,
0035     .genlcd_cntl2 =      0x00000003,
0036     .genlcd_cntl3 =      0x000102aa,
0037 };
0038 
0039 static struct w100_mode himalaya4_lcd_mode = {
0040     .xres       = 240,
0041     .yres       = 320,
0042     .left_margin    = 0,
0043     .right_margin   = 31,
0044     .upper_margin   = 15,
0045     .lower_margin   = 0,
0046     .crtc_ss    = 0x80150014,
0047     .crtc_ls    = 0xa0fb00f7,
0048     .crtc_gs    = 0xc0080007,
0049     .crtc_vpos_gs   = 0x00080007,
0050     .crtc_rev   = 0x0000000a,
0051     .crtc_dclk  = 0x81700030,
0052     .crtc_gclk  = 0x8015010f,
0053     .crtc_goe   = 0x00000000,
0054     .pll_freq   = 80,
0055     .pixclk_divider = 15,
0056     .pixclk_divider_rotated = 15,
0057     .pixclk_src     = CLK_SRC_PLL,
0058     .sysclk_divider = 0,
0059     .sysclk_src     = CLK_SRC_PLL,
0060 };
0061 
0062 static struct w100_mode himalaya6_lcd_mode = {
0063     .xres       = 240,
0064     .yres       = 320,
0065     .left_margin    = 9,
0066     .right_margin   = 8,
0067     .upper_margin   = 5,
0068     .lower_margin   = 4,
0069     .crtc_ss    = 0x80150014,
0070     .crtc_ls    = 0xa0fb00f7,
0071     .crtc_gs    = 0xc0080007,
0072     .crtc_vpos_gs   = 0x00080007,
0073     .crtc_rev   = 0x0000000a,
0074     .crtc_dclk  = 0xa1700030,
0075     .crtc_gclk  = 0x8015010f,
0076     .crtc_goe   = 0x00000000,
0077     .pll_freq   = 95,
0078     .pixclk_divider = 0xb,
0079     .pixclk_divider_rotated = 4,
0080     .pixclk_src     = CLK_SRC_PLL,
0081     .sysclk_divider = 1,
0082     .sysclk_src     = CLK_SRC_PLL,
0083 };
0084 
0085 static struct w100_gpio_regs himalaya_w100_gpio_info = {
0086     .init_data1 = 0xffff0000,   /* GPIO_DATA  */
0087     .gpio_dir1  = 0x00000000,   /* GPIO_CNTL1 */
0088     .gpio_oe1   = 0x003c0000,   /* GPIO_CNTL2 */
0089     .init_data2 = 0x00000000,   /* GPIO_DATA2 */
0090     .gpio_dir2  = 0x00000000,   /* GPIO_CNTL3 */
0091     .gpio_oe2   = 0x00000000,   /* GPIO_CNTL4 */
0092 };
0093 
0094 static struct w100fb_mach_info himalaya_fb_info = {
0095     .num_modes  = 1,
0096     .regs       = &himalaya_lcd_regs,
0097     .gpio       = &himalaya_w100_gpio_info,
0098     .xtal_freq = 16000000,
0099 };
0100 
0101 static struct resource himalaya_fb_resources[] = {
0102     [0] = {
0103         .start  = 0x08000000,
0104         .end    = 0x08ffffff,
0105         .flags  = IORESOURCE_MEM,
0106     },
0107 };
0108 
0109 static struct platform_device himalaya_fb_device = {
0110     .name           = "w100fb",
0111     .id             = -1,
0112     .dev            = {
0113         .platform_data  = &himalaya_fb_info,
0114     },
0115     .num_resources  = ARRAY_SIZE(himalaya_fb_resources),
0116     .resource       = himalaya_fb_resources,
0117 };
0118 
0119 /* ----------------------------------------------------------------------- */
0120 
0121 static struct platform_device *devices[] __initdata = {
0122     &himalaya_fb_device,
0123 };
0124 
0125 static void __init himalaya_lcd_init(void)
0126 {
0127     int himalaya_boardid;
0128 
0129     himalaya_boardid = 0x4; /* hardcoded (detection needs ASIC3 functions) */
0130     printk(KERN_INFO "himalaya LCD Driver init. boardid=%d\n",
0131         himalaya_boardid);
0132 
0133     switch (himalaya_boardid) {
0134     case 0x4:
0135         himalaya_fb_info.modelist = &himalaya4_lcd_mode;
0136     break;
0137     case 0x6:
0138         himalaya_fb_info.modelist = &himalaya6_lcd_mode;
0139     break;
0140     default:
0141         printk(KERN_INFO "himalaya lcd_init: unknown boardid=%d. Using 0x4\n",
0142             himalaya_boardid);
0143         himalaya_fb_info.modelist = &himalaya4_lcd_mode;
0144     }
0145 }
0146 
0147 static void __init himalaya_init(void)
0148 {
0149     pxa_set_ffuart_info(NULL);
0150     pxa_set_btuart_info(NULL);
0151     pxa_set_stuart_info(NULL);
0152     himalaya_lcd_init();
0153     platform_add_devices(devices, ARRAY_SIZE(devices));
0154 }
0155 
0156 
0157 MACHINE_START(HIMALAYA, "HTC Himalaya")
0158     .atag_offset = 0x100,
0159     .map_io = pxa25x_map_io,
0160     .nr_irqs = PXA_NR_IRQS,
0161     .init_irq = pxa25x_init_irq,
0162     .handle_irq = pxa25x_handle_irq,
0163     .init_machine = himalaya_init,
0164     .init_time  = pxa_timer_init,
0165     .restart    = pxa_restart,
0166 MACHINE_END