Linux Audio

Check our new training course

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