]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - board/karo/common/karo.h
karo: tx6: add support for TX6-V2 (eMMC)
[karo-tx-uboot.git] / board / karo / common / karo.h
1 /*
2  * (C) Copyright 2012 Lothar Waßmann <LW@KARO-electronics.de>
3  *
4  * See file CREDITS for list of people who contributed to this
5  * project.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * version 2 as published by the Free Software Foundation.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16 */
17 struct fb_videomode;
18
19 #ifdef CONFIG_OF_LIBFDT
20 void karo_fdt_remove_node(void *blob, const char *node);
21 void karo_fdt_move_fdt(void);
22 void karo_fdt_fixup_touchpanel(void *blob, const char *panels[],
23                         size_t num_panels);
24 void karo_fdt_fixup_usb_otg(void *blob, const char *node, const char *phy);
25 void karo_fdt_fixup_flexcan(void *blob, int xcvr_present);
26 void karo_fdt_del_prop(void *blob, const char *compat, phys_addr_t offs,
27                 const char *prop);
28 void karo_fdt_enable_node(void *blob, const char *node, int enable);
29 int karo_fdt_get_fb_mode(void *blob, const char *name,
30                 struct fb_videomode *fb_mode);
31 int karo_fdt_update_fb_mode(void *blob, const char *name);
32 int karo_fdt_create_fb_mode(void *blob, const char *name,
33                         struct fb_videomode *mode);
34 int karo_fdt_get_lcd_bus_width(const void *blob, int default_width);
35 int karo_fdt_get_lvds_mapping(const void *blob, int default_mapping);
36 u8 karo_fdt_get_lvds_channels(const void *blob);
37 #else
38 static inline void karo_fdt_remove_node(void *blob, const char *node)
39 {
40 }
41 static inline void karo_fdt_move_fdt(void)
42 {
43 }
44 static inline void karo_fdt_fixup_touchpanel(void *blob, const char *panels[],
45                                         size_t num_panels)
46 {
47 }
48 static inline void karo_fdt_fixup_usb_otg(void *blob, const char *node,
49                                         const char *phy)
50 {
51 }
52 static inline void karo_fdt_fixup_flexcan(void *blob, int xcvr_present)
53 {
54 }
55 static inline void karo_fdt_del_prop(void *blob, const char *compat,
56                                 phys_addr_t offs, const char *prop)
57 {
58 }
59 static inline void karo_fdt_enable_node(void *blob, const char *node,
60                                         int enable)
61 {
62 }
63 static inline int karo_fdt_get_fb_mode(void *blob, const char *name,
64                                 struct fb_videomode *fb_mode)
65 {
66         return 0;
67 }
68 static inline int karo_fdt_update_fb_mode(void *blob, const char *name)
69 {
70         return 0;
71 }
72 static inline int karo_fdt_create_fb_mode(void *blob,
73                                         const char *name,
74                                         struct fb_videomode *mode)
75 {
76         return 0;
77 }
78 int karo_fdt_get_lcd_bus_width(const void *blob, int default_width)
79 {
80         return default_width;
81 }
82 int karo_fdt_get_lvds_mapping(const void *blob, int default_mapping)
83 {
84         return default_mapping;
85 }
86 u8 karo_fdt_get_lvds_channels(const void *blob)
87 {
88         return 0;
89 }
90 #endif
91
92 static inline const char *karo_get_vmode(const char *video_mode)
93 {
94         const char *vmode = NULL;
95
96         if (video_mode == NULL || strlen(video_mode) == 0)
97                 return NULL;
98
99         vmode = strchr(video_mode, ':');
100         return vmode ? vmode + 1 : video_mode;
101 }
102
103 #ifdef CONFIG_SPLASH_SCREEN
104 int karo_load_splashimage(int mode);
105 #else
106 static inline int karo_load_splashimage(int mode)
107 {
108         return 0;
109 }
110 #endif
111
112 #ifdef CONFIG_CMD_NAND
113 int karo_load_nand_part(const char *part, void *addr, size_t len);
114 #else
115 static inline int karo_load_nand_part(const char *part, void *addr, size_t len)
116 {
117         return -EOPNOTSUPP;
118 }
119 #endif
120
121 #ifdef CONFIG_CMD_MMC
122 int karo_load_mmc_part(const char *part, void *addr, size_t len);
123 #else
124 static inline int karo_load_mmc_part(const char *part, void *addr, size_t len)
125 {
126         return -EOPNOTSUPP;
127 }
128 #endif
129
130 static inline int karo_load_part(const char *part, void *addr, size_t len)
131 {
132         int ret;
133
134         ret = karo_load_nand_part(part, addr, len);
135         if (ret == -EOPNOTSUPP)
136                 return karo_load_mmc_part(part, addr, len);
137         return ret;
138 }