Date:2011-03-18 16:26:08 (11 years 6 months ago)
Author:Lars C.
Commit:d85e1af47e57949552c17058af89a29026689870
Message:MIPS: JZ4760: lepus: Register more peripherals

Files: arch/mips/jz47xx/jz4760/board-lepus.c (1 diff)

Change Details

arch/mips/jz47xx/jz4760/board-lepus.c
11#include <linux/kernel.h>
22#include <linux/init.h>
3#include <linux/gpio.h>
4
5#include <asm/mach-jz47xx/jz4760/gpio.h>
6
7#include <linux/input.h>
8#include <linux/gpio_keys.h>
39
410#include <jz4760/platform.h>
11#include <jz4750_nand.h>
12#include <jz4740_mmc.h>
13#include <jz4740_fb.h>
514
615#include "../clock.h"
716
17#include <linux/pwm_backlight.h>
18
19#include <linux/regulator/fixed.h>
20#include <linux/regulator/machine.h>
21
22static struct nand_ecclayout lepus_ecclayout = {
23    .eccbytes = 104,
24    .eccpos = {
25        24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
26        37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
27        50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
28        63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
29        76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
30        89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101,
31        102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
32        115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
33    },
34    .oobfree = {
35        { .offset = 0, .length = 24 },
36    },
37};
38
39static struct mtd_partition lepus_partitions[] = {
40    {
41        .name = "u-boot",
42        .offset = 0,
43        .size = 0x400000,
44    },
45    {
46        .name = "kernel",
47        .offset = MTDPART_OFS_APPEND,
48        .size = 0xb00000,
49    },
50    {
51        .name = "rootfs",
52        .offset = MTDPART_OFS_APPEND,
53        .size = MTDPART_SIZ_FULL,
54    },
55};
56
57static struct jz_nand_platform_data lepus_nand_pdata = {
58    .bch_8bit = 1,
59    .ecc_layout = &lepus_ecclayout,
60    .partitions = lepus_partitions,
61    .num_partitions = ARRAY_SIZE(lepus_partitions),
62    .busy_gpio = 20,
63};
64
65/* GPIO Key: power */
66static struct gpio_keys_button lepus_gpio_keys_buttons[] = {
67    {
68        .code = KEY_POWER,
69        .gpio = JZ_GPIO_PORTD(27),
70        .active_low = 1,
71        .desc = "Power",
72    },
73};
74
75static struct gpio_keys_platform_data lepus_gpio_keys_data = {
76    .nbuttons = ARRAY_SIZE(lepus_gpio_keys_buttons),
77    .buttons = lepus_gpio_keys_buttons,
78};
79
80static struct platform_device lepus_gpio_keys_device = {
81    .name = "gpio-keys",
82    .id = -1,
83    .dev = {
84        .platform_data = &lepus_gpio_keys_data,
85    }
86};
87
88/* PWM backlight */
89static struct platform_pwm_backlight_data lepus_bl_pdata = {
90    .max_brightness = 0xff,
91    .dft_brightness = 0xff,
92    .pwm_period_ns = 7500000,
93    .pwm_id = 1,
94};
95
96static struct platform_device lepus_bl_device = {
97    .name = "pwm-backlight",
98    .id = -1,
99    .dev = {
100        .platform_data = &lepus_bl_pdata,
101    },
102};
103
104/* MMC */
105static struct jz_gpio_bulk_request lepus_mmc0_pins[] = {
106    { JZ_GPIO_PORTE(20), "MSC0 D0", JZ4760_GPIO_E20_FUNC_MSC0_DATA0 },
107    { JZ_GPIO_PORTE(21), "MSC0 D1", JZ4760_GPIO_E21_FUNC_MSC0_DATA1 },
108    { JZ_GPIO_PORTE(22), "MSC0 D2", JZ4760_GPIO_E22_FUNC_MSC0_DATA2 },
109    { JZ_GPIO_PORTE(23), "MSC0 D3", JZ4760_GPIO_E23_FUNC_MSC0_DATA3 },
110    { JZ_GPIO_PORTE(24), "MSC0 D4", JZ4760_GPIO_E24_FUNC_MSC0_DATA4 },
111    { JZ_GPIO_PORTE(25), "MSC0 D5", JZ4760_GPIO_E25_FUNC_MSC0_DATA5 },
112    { JZ_GPIO_PORTE(26), "MSC0 D6", JZ4760_GPIO_E26_FUNC_MSC0_DATA6 },
113    { JZ_GPIO_PORTE(27), "MSC0 D7", JZ4760_GPIO_E27_FUNC_MSC0_DATA7 },
114    { JZ_GPIO_PORTE(28), "MSC0 CLK", JZ4760_GPIO_E28_FUNC_MSC0_CLK },
115    { JZ_GPIO_PORTE(29), "MSC0 CMD", JZ4760_GPIO_E29_FUNC_MSC0_CMD },
116};
117
118static struct jz4740_mmc_platform_data lepus_mmc0_pdata = {
119    .gpio_card_detect = JZ_GPIO_PORTB(22),
120    .card_detect_active_low = 1,
121    .gpio_read_only = JZ_GPIO_PORTF(4),
122    .read_only_active_low = 1,
123    .gpio_power = JZ_GPIO_PORTF(9),
124    .power_active_low = 1,
125    .mmc_pins = lepus_mmc0_pins,
126    .mmc_pin_count = ARRAY_SIZE(lepus_mmc0_pins),
127};
128
129static struct jz_gpio_bulk_request lepus_mmc1_pins[] = {
130    { JZ_GPIO_PORTD(20), "MSC1 D0", JZ4760_GPIO_D20_FUNC_MSC1_DATA0 },
131    { JZ_GPIO_PORTD(21), "MSC1 D1", JZ4760_GPIO_D21_FUNC_MSC1_DATA1 },
132    { JZ_GPIO_PORTD(22), "MSC1 D2", JZ4760_GPIO_D22_FUNC_MSC1_DATA2 },
133    { JZ_GPIO_PORTD(23), "MSC1 D3", JZ4760_GPIO_D23_FUNC_MSC1_DATA3 },
134    { JZ_GPIO_PORTD(24), "MSC1 CLK", JZ4760_GPIO_D24_FUNC_MSC1_CLK },
135    { JZ_GPIO_PORTD(25), "MSC1 CMD", JZ4760_GPIO_D25_FUNC_MSC1_CMD },
136};
137
138static struct jz4740_mmc_platform_data lepus_mmc1_pdata = {
139    .gpio_card_detect = JZ_GPIO_PORTA(28),
140    .card_detect_active_low = 1,
141    .gpio_read_only = -1,
142    .gpio_power = JZ_GPIO_PORTE(9),
143    .power_active_low = 1,
144    .mmc_pins = lepus_mmc1_pins,
145    .mmc_pin_count = ARRAY_SIZE(lepus_mmc1_pins),
146};
147
148/* Display */
149static struct fb_videomode lepus_video_modes[] = {
150    {
151        .name = "800x480",
152        .xres = 800,
153        .yres = 480,
154        .refresh = 60,
155        .left_margin = 214,
156        .right_margin = 1,
157        .upper_margin = 34,
158        .lower_margin = 10,
159        .hsync_len = 1,
160        .vsync_len = 1,
161        .sync = 0,
162        .vmode = FB_VMODE_NONINTERLACED,
163    },
164};
165
166static struct jz4740_fb_platform_data lepus_fb_pdata = {
167    .width = 90,
168    .height = 52,
169    .num_modes = ARRAY_SIZE(lepus_video_modes),
170    .modes = lepus_video_modes,
171    .bpp = 24,
172    .lcd_type = JZ_LCD_TYPE_GENERIC_24_BIT,
173    .pixclk_falling_edge = 1,
174
175    .gpio_reset = JZ_GPIO_PORTF(10),
176    .reset_active_low = 1,
177};
178
179static struct platform_device *jz_platform_devices[] __initdata = {
180    &jz4760_rtc_device,
181    &jz4760_mmc0_device,
182    &jz4760_mmc1_device,
183    &jz4760_usb_ohci_device,
184    &lepus_gpio_keys_device,
185    &lepus_bl_device,
186    &jz4760_nand_device,
187    &jz4760_framebuffer_device,
188    &jz4760_adc_device,
189};
190
8191static int __init lepus_init_platform_devices(void)
9192{
10193    jz4760_serial_device_register();
194    jz4760_nand_device.dev.platform_data = &lepus_nand_pdata;
195    jz4760_mmc0_device.dev.platform_data = &lepus_mmc0_pdata;
196    jz4760_mmc1_device.dev.platform_data = &lepus_mmc1_pdata;
197    jz4760_framebuffer_device.dev.platform_data = &lepus_fb_pdata;
11198
12    return 0;
199    return platform_add_devices(jz_platform_devices,
200                    ARRAY_SIZE(jz_platform_devices));
13201}
14202
15struct jz4740_clock_board_data jz4740_clock_bdata = {
203struct jz47xx_clock_board_data jz47xx_clock_bdata = {
16204    .ext_rate = 12000000,
17205    .rtc_rate = 32768,
18206};
19207
20208static int __init lepus_board_setup(void)
21209{
210    unsigned int i;
211    for (i = 20; i < 26; ++i)
212        jz_gpio_disable_pullup(JZ_GPIO_PORTD(i));
213
214    for (i = 20; i < 30; ++i)
215        jz_gpio_disable_pullup(JZ_GPIO_PORTE(i));
216
22217    if (lepus_init_platform_devices())
23218        panic("Failed to initalize platform devices\n");
24219
25220    return 0;
221
26222}
27223arch_initcall(lepus_board_setup);

Archive Download the corresponding diff file



interactive