/src/barebox/arch/sandbox/board/board.c
Line | Count | Source |
1 | | /* |
2 | | * board.c |
3 | | * |
4 | | * Copyright (c) 2007 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix |
5 | | * |
6 | | * This program is free software; you can redistribute it and/or modify |
7 | | * it under the terms of the GNU General Public License version 2 |
8 | | * as published by the Free Software Foundation. |
9 | | * |
10 | | * This program is distributed in the hope that it will be useful, |
11 | | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | | * GNU General Public License for more details. |
14 | | * |
15 | | */ |
16 | | |
17 | | #include <common.h> |
18 | | #include <envfs.h> |
19 | | #include <driver.h> |
20 | | #include <malloc.h> |
21 | | #include <mach/linux.h> |
22 | | #include <init.h> |
23 | | #include <errno.h> |
24 | | #include <deep-probe.h> |
25 | | #include <fb.h> |
26 | | |
27 | | struct fb_videomode mode = { |
28 | | .name = "sdl", /* optional */ |
29 | | .xres = 640, |
30 | | .yres = 480, |
31 | | }; |
32 | | |
33 | | static struct device tap_device = { |
34 | | .id = DEVICE_ID_DYNAMIC, |
35 | | .name = "tap", |
36 | | }; |
37 | | |
38 | | static struct device sdl_device = { |
39 | | .id = DEVICE_ID_DYNAMIC, |
40 | | .name = "sdlfb", |
41 | | .platform_data = &mode, |
42 | | }; |
43 | | |
44 | | static struct device devrandom_device = { |
45 | | .id = DEVICE_ID_DYNAMIC, |
46 | | .name = "devrandom", |
47 | | }; |
48 | | |
49 | | static int devices_init(struct device *dev) |
50 | 26 | { |
51 | 26 | platform_device_register(&tap_device); |
52 | | |
53 | 26 | if (sdl_xres) |
54 | 0 | mode.xres = sdl_xres; |
55 | | |
56 | 26 | if (sdl_yres) |
57 | 0 | mode.yres = sdl_yres; |
58 | | |
59 | 26 | platform_device_register(&sdl_device); |
60 | | |
61 | 26 | platform_device_register(&devrandom_device); |
62 | | |
63 | 26 | defaultenv_append_directory(defaultenv_sandbox); |
64 | | |
65 | 26 | return 0; |
66 | 26 | } |
67 | | |
68 | | static struct of_device_id sandbox_dt_ids[] = { |
69 | | { .compatible = "barebox,sandbox" }, |
70 | | { /* sentinel */ } |
71 | | }; |
72 | | BAREBOX_DEEP_PROBE_ENABLE(sandbox_dt_ids); |
73 | | |
74 | | static struct driver sandbox_board_drv = { |
75 | | .name = "sandbox-board", |
76 | | .of_compatible = sandbox_dt_ids, |
77 | | .probe = devices_init, |
78 | | }; |
79 | | device_platform_driver(sandbox_board_drv); |