1*4882a593Smuzhiyun // SPDX-License-Identifier: GPL-2.0
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun * arch/sh/boards/superh/microdev/setup.c
4*4882a593Smuzhiyun *
5*4882a593Smuzhiyun * Copyright (C) 2003 Sean McGoogan (Sean.McGoogan@superh.com)
6*4882a593Smuzhiyun * Copyright (C) 2003, 2004 SuperH, Inc.
7*4882a593Smuzhiyun * Copyright (C) 2004, 2005 Paul Mundt
8*4882a593Smuzhiyun *
9*4882a593Smuzhiyun * SuperH SH4-202 MicroDev board support.
10*4882a593Smuzhiyun */
11*4882a593Smuzhiyun #include <linux/init.h>
12*4882a593Smuzhiyun #include <linux/platform_device.h>
13*4882a593Smuzhiyun #include <linux/ioport.h>
14*4882a593Smuzhiyun #include <video/s1d13xxxfb.h>
15*4882a593Smuzhiyun #include <mach/microdev.h>
16*4882a593Smuzhiyun #include <asm/io.h>
17*4882a593Smuzhiyun #include <asm/machvec.h>
18*4882a593Smuzhiyun #include <linux/sizes.h>
19*4882a593Smuzhiyun
20*4882a593Smuzhiyun static struct resource smc91x_resources[] = {
21*4882a593Smuzhiyun [0] = {
22*4882a593Smuzhiyun .start = 0x300,
23*4882a593Smuzhiyun .end = 0x300 + SZ_4K - 1,
24*4882a593Smuzhiyun .flags = IORESOURCE_MEM,
25*4882a593Smuzhiyun },
26*4882a593Smuzhiyun [1] = {
27*4882a593Smuzhiyun .start = MICRODEV_LINUX_IRQ_ETHERNET,
28*4882a593Smuzhiyun .end = MICRODEV_LINUX_IRQ_ETHERNET,
29*4882a593Smuzhiyun .flags = IORESOURCE_IRQ,
30*4882a593Smuzhiyun },
31*4882a593Smuzhiyun };
32*4882a593Smuzhiyun
33*4882a593Smuzhiyun static struct platform_device smc91x_device = {
34*4882a593Smuzhiyun .name = "smc91x",
35*4882a593Smuzhiyun .id = -1,
36*4882a593Smuzhiyun .num_resources = ARRAY_SIZE(smc91x_resources),
37*4882a593Smuzhiyun .resource = smc91x_resources,
38*4882a593Smuzhiyun };
39*4882a593Smuzhiyun
40*4882a593Smuzhiyun static struct s1d13xxxfb_regval s1d13806_initregs[] = {
41*4882a593Smuzhiyun { S1DREG_MISC, 0x00 },
42*4882a593Smuzhiyun { S1DREG_COM_DISP_MODE, 0x00 },
43*4882a593Smuzhiyun { S1DREG_GPIO_CNF0, 0x00 },
44*4882a593Smuzhiyun { S1DREG_GPIO_CNF1, 0x00 },
45*4882a593Smuzhiyun { S1DREG_GPIO_CTL0, 0x00 },
46*4882a593Smuzhiyun { S1DREG_GPIO_CTL1, 0x00 },
47*4882a593Smuzhiyun { S1DREG_CLK_CNF, 0x02 },
48*4882a593Smuzhiyun { S1DREG_LCD_CLK_CNF, 0x01 },
49*4882a593Smuzhiyun { S1DREG_CRT_CLK_CNF, 0x03 },
50*4882a593Smuzhiyun { S1DREG_MPLUG_CLK_CNF, 0x03 },
51*4882a593Smuzhiyun { S1DREG_CPU2MEM_WST_SEL, 0x02 },
52*4882a593Smuzhiyun { S1DREG_SDRAM_REF_RATE, 0x03 },
53*4882a593Smuzhiyun { S1DREG_SDRAM_TC0, 0x00 },
54*4882a593Smuzhiyun { S1DREG_SDRAM_TC1, 0x01 },
55*4882a593Smuzhiyun { S1DREG_MEM_CNF, 0x80 },
56*4882a593Smuzhiyun { S1DREG_PANEL_TYPE, 0x25 },
57*4882a593Smuzhiyun { S1DREG_MOD_RATE, 0x00 },
58*4882a593Smuzhiyun { S1DREG_LCD_DISP_HWIDTH, 0x63 },
59*4882a593Smuzhiyun { S1DREG_LCD_NDISP_HPER, 0x1e },
60*4882a593Smuzhiyun { S1DREG_TFT_FPLINE_START, 0x06 },
61*4882a593Smuzhiyun { S1DREG_TFT_FPLINE_PWIDTH, 0x03 },
62*4882a593Smuzhiyun { S1DREG_LCD_DISP_VHEIGHT0, 0x57 },
63*4882a593Smuzhiyun { S1DREG_LCD_DISP_VHEIGHT1, 0x02 },
64*4882a593Smuzhiyun { S1DREG_LCD_NDISP_VPER, 0x00 },
65*4882a593Smuzhiyun { S1DREG_TFT_FPFRAME_START, 0x0a },
66*4882a593Smuzhiyun { S1DREG_TFT_FPFRAME_PWIDTH, 0x81 },
67*4882a593Smuzhiyun { S1DREG_LCD_DISP_MODE, 0x03 },
68*4882a593Smuzhiyun { S1DREG_LCD_MISC, 0x00 },
69*4882a593Smuzhiyun { S1DREG_LCD_DISP_START0, 0x00 },
70*4882a593Smuzhiyun { S1DREG_LCD_DISP_START1, 0x00 },
71*4882a593Smuzhiyun { S1DREG_LCD_DISP_START2, 0x00 },
72*4882a593Smuzhiyun { S1DREG_LCD_MEM_OFF0, 0x90 },
73*4882a593Smuzhiyun { S1DREG_LCD_MEM_OFF1, 0x01 },
74*4882a593Smuzhiyun { S1DREG_LCD_PIX_PAN, 0x00 },
75*4882a593Smuzhiyun { S1DREG_LCD_DISP_FIFO_HTC, 0x00 },
76*4882a593Smuzhiyun { S1DREG_LCD_DISP_FIFO_LTC, 0x00 },
77*4882a593Smuzhiyun { S1DREG_CRT_DISP_HWIDTH, 0x63 },
78*4882a593Smuzhiyun { S1DREG_CRT_NDISP_HPER, 0x1f },
79*4882a593Smuzhiyun { S1DREG_CRT_HRTC_START, 0x04 },
80*4882a593Smuzhiyun { S1DREG_CRT_HRTC_PWIDTH, 0x8f },
81*4882a593Smuzhiyun { S1DREG_CRT_DISP_VHEIGHT0, 0x57 },
82*4882a593Smuzhiyun { S1DREG_CRT_DISP_VHEIGHT1, 0x02 },
83*4882a593Smuzhiyun { S1DREG_CRT_NDISP_VPER, 0x1b },
84*4882a593Smuzhiyun { S1DREG_CRT_VRTC_START, 0x00 },
85*4882a593Smuzhiyun { S1DREG_CRT_VRTC_PWIDTH, 0x83 },
86*4882a593Smuzhiyun { S1DREG_TV_OUT_CTL, 0x10 },
87*4882a593Smuzhiyun { S1DREG_CRT_DISP_MODE, 0x05 },
88*4882a593Smuzhiyun { S1DREG_CRT_DISP_START0, 0x00 },
89*4882a593Smuzhiyun { S1DREG_CRT_DISP_START1, 0x00 },
90*4882a593Smuzhiyun { S1DREG_CRT_DISP_START2, 0x00 },
91*4882a593Smuzhiyun { S1DREG_CRT_MEM_OFF0, 0x20 },
92*4882a593Smuzhiyun { S1DREG_CRT_MEM_OFF1, 0x03 },
93*4882a593Smuzhiyun { S1DREG_CRT_PIX_PAN, 0x00 },
94*4882a593Smuzhiyun { S1DREG_CRT_DISP_FIFO_HTC, 0x00 },
95*4882a593Smuzhiyun { S1DREG_CRT_DISP_FIFO_LTC, 0x00 },
96*4882a593Smuzhiyun { S1DREG_LCD_CUR_CTL, 0x00 },
97*4882a593Smuzhiyun { S1DREG_LCD_CUR_START, 0x01 },
98*4882a593Smuzhiyun { S1DREG_LCD_CUR_XPOS0, 0x00 },
99*4882a593Smuzhiyun { S1DREG_LCD_CUR_XPOS1, 0x00 },
100*4882a593Smuzhiyun { S1DREG_LCD_CUR_YPOS0, 0x00 },
101*4882a593Smuzhiyun { S1DREG_LCD_CUR_YPOS1, 0x00 },
102*4882a593Smuzhiyun { S1DREG_LCD_CUR_BCTL0, 0x00 },
103*4882a593Smuzhiyun { S1DREG_LCD_CUR_GCTL0, 0x00 },
104*4882a593Smuzhiyun { S1DREG_LCD_CUR_RCTL0, 0x00 },
105*4882a593Smuzhiyun { S1DREG_LCD_CUR_BCTL1, 0x1f },
106*4882a593Smuzhiyun { S1DREG_LCD_CUR_GCTL1, 0x3f },
107*4882a593Smuzhiyun { S1DREG_LCD_CUR_RCTL1, 0x1f },
108*4882a593Smuzhiyun { S1DREG_LCD_CUR_FIFO_HTC, 0x00 },
109*4882a593Smuzhiyun { S1DREG_CRT_CUR_CTL, 0x00 },
110*4882a593Smuzhiyun { S1DREG_CRT_CUR_START, 0x01 },
111*4882a593Smuzhiyun { S1DREG_CRT_CUR_XPOS0, 0x00 },
112*4882a593Smuzhiyun { S1DREG_CRT_CUR_XPOS1, 0x00 },
113*4882a593Smuzhiyun { S1DREG_CRT_CUR_YPOS0, 0x00 },
114*4882a593Smuzhiyun { S1DREG_CRT_CUR_YPOS1, 0x00 },
115*4882a593Smuzhiyun { S1DREG_CRT_CUR_BCTL0, 0x00 },
116*4882a593Smuzhiyun { S1DREG_CRT_CUR_GCTL0, 0x00 },
117*4882a593Smuzhiyun { S1DREG_CRT_CUR_RCTL0, 0x00 },
118*4882a593Smuzhiyun { S1DREG_CRT_CUR_BCTL1, 0x1f },
119*4882a593Smuzhiyun { S1DREG_CRT_CUR_GCTL1, 0x3f },
120*4882a593Smuzhiyun { S1DREG_CRT_CUR_RCTL1, 0x1f },
121*4882a593Smuzhiyun { S1DREG_CRT_CUR_FIFO_HTC, 0x00 },
122*4882a593Smuzhiyun { S1DREG_BBLT_CTL0, 0x00 },
123*4882a593Smuzhiyun { S1DREG_BBLT_CTL1, 0x00 },
124*4882a593Smuzhiyun { S1DREG_BBLT_CC_EXP, 0x00 },
125*4882a593Smuzhiyun { S1DREG_BBLT_OP, 0x00 },
126*4882a593Smuzhiyun { S1DREG_BBLT_SRC_START0, 0x00 },
127*4882a593Smuzhiyun { S1DREG_BBLT_SRC_START1, 0x00 },
128*4882a593Smuzhiyun { S1DREG_BBLT_SRC_START2, 0x00 },
129*4882a593Smuzhiyun { S1DREG_BBLT_DST_START0, 0x00 },
130*4882a593Smuzhiyun { S1DREG_BBLT_DST_START1, 0x00 },
131*4882a593Smuzhiyun { S1DREG_BBLT_DST_START2, 0x00 },
132*4882a593Smuzhiyun { S1DREG_BBLT_MEM_OFF0, 0x00 },
133*4882a593Smuzhiyun { S1DREG_BBLT_MEM_OFF1, 0x00 },
134*4882a593Smuzhiyun { S1DREG_BBLT_WIDTH0, 0x00 },
135*4882a593Smuzhiyun { S1DREG_BBLT_WIDTH1, 0x00 },
136*4882a593Smuzhiyun { S1DREG_BBLT_HEIGHT0, 0x00 },
137*4882a593Smuzhiyun { S1DREG_BBLT_HEIGHT1, 0x00 },
138*4882a593Smuzhiyun { S1DREG_BBLT_BGC0, 0x00 },
139*4882a593Smuzhiyun { S1DREG_BBLT_BGC1, 0x00 },
140*4882a593Smuzhiyun { S1DREG_BBLT_FGC0, 0x00 },
141*4882a593Smuzhiyun { S1DREG_BBLT_FGC1, 0x00 },
142*4882a593Smuzhiyun { S1DREG_LKUP_MODE, 0x00 },
143*4882a593Smuzhiyun { S1DREG_LKUP_ADDR, 0x00 },
144*4882a593Smuzhiyun { S1DREG_PS_CNF, 0x10 },
145*4882a593Smuzhiyun { S1DREG_PS_STATUS, 0x00 },
146*4882a593Smuzhiyun { S1DREG_CPU2MEM_WDOGT, 0x00 },
147*4882a593Smuzhiyun { S1DREG_COM_DISP_MODE, 0x02 },
148*4882a593Smuzhiyun };
149*4882a593Smuzhiyun
150*4882a593Smuzhiyun static struct s1d13xxxfb_pdata s1d13806_platform_data = {
151*4882a593Smuzhiyun .initregs = s1d13806_initregs,
152*4882a593Smuzhiyun .initregssize = ARRAY_SIZE(s1d13806_initregs),
153*4882a593Smuzhiyun };
154*4882a593Smuzhiyun
155*4882a593Smuzhiyun static struct resource s1d13806_resources[] = {
156*4882a593Smuzhiyun [0] = {
157*4882a593Smuzhiyun .start = 0x07200000,
158*4882a593Smuzhiyun .end = 0x07200000 + SZ_2M - 1,
159*4882a593Smuzhiyun .flags = IORESOURCE_MEM,
160*4882a593Smuzhiyun },
161*4882a593Smuzhiyun [1] = {
162*4882a593Smuzhiyun .start = 0x07000000,
163*4882a593Smuzhiyun .end = 0x07000000 + SZ_2M - 1,
164*4882a593Smuzhiyun .flags = IORESOURCE_MEM,
165*4882a593Smuzhiyun },
166*4882a593Smuzhiyun };
167*4882a593Smuzhiyun
168*4882a593Smuzhiyun static struct platform_device s1d13806_device = {
169*4882a593Smuzhiyun .name = "s1d13806fb",
170*4882a593Smuzhiyun .id = -1,
171*4882a593Smuzhiyun .num_resources = ARRAY_SIZE(s1d13806_resources),
172*4882a593Smuzhiyun .resource = s1d13806_resources,
173*4882a593Smuzhiyun
174*4882a593Smuzhiyun .dev = {
175*4882a593Smuzhiyun .platform_data = &s1d13806_platform_data,
176*4882a593Smuzhiyun },
177*4882a593Smuzhiyun };
178*4882a593Smuzhiyun
179*4882a593Smuzhiyun static struct platform_device *microdev_devices[] __initdata = {
180*4882a593Smuzhiyun &smc91x_device,
181*4882a593Smuzhiyun &s1d13806_device,
182*4882a593Smuzhiyun };
183*4882a593Smuzhiyun
microdev_devices_setup(void)184*4882a593Smuzhiyun static int __init microdev_devices_setup(void)
185*4882a593Smuzhiyun {
186*4882a593Smuzhiyun return platform_add_devices(microdev_devices, ARRAY_SIZE(microdev_devices));
187*4882a593Smuzhiyun }
188*4882a593Smuzhiyun device_initcall(microdev_devices_setup);
189*4882a593Smuzhiyun
190*4882a593Smuzhiyun /*
191*4882a593Smuzhiyun * The Machine Vector
192*4882a593Smuzhiyun */
193*4882a593Smuzhiyun static struct sh_machine_vector mv_sh4202_microdev __initmv = {
194*4882a593Smuzhiyun .mv_name = "SH4-202 MicroDev",
195*4882a593Smuzhiyun .mv_ioport_map = microdev_ioport_map,
196*4882a593Smuzhiyun .mv_init_irq = init_microdev_irq,
197*4882a593Smuzhiyun };
198