]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - board/karo/common/karo.h
karo: fdt: fix karo_fdt_del_prop() function
[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_SYS_LVDS_IF
20 #define is_lvds()                       1
21 #else
22 #define is_lvds()                       0
23 #endif
24
25 #ifdef CONFIG_OF_LIBFDT
26 void karo_fdt_remove_node(void *blob, const char *node);
27 void karo_fdt_move_fdt(void);
28 void karo_fdt_fixup_touchpanel(void *blob, const char *panels[],
29                         size_t num_panels);
30 void karo_fdt_fixup_usb_otg(void *blob, const char *node, const char *phy,
31                         const char *phy_supply);
32 void karo_fdt_fixup_flexcan(void *blob, int xcvr_present);
33 void karo_fdt_del_prop(void *blob, const char *compat, u32 offs,
34                 const char *prop);
35 void karo_fdt_enable_node(void *blob, const char *node, int enable);
36 int karo_fdt_get_fb_mode(void *blob, const char *name,
37                 struct fb_videomode *fb_mode);
38 int karo_fdt_update_fb_mode(void *blob, const char *name);
39 int karo_fdt_create_fb_mode(void *blob, const char *name,
40                         struct fb_videomode *mode);
41 int karo_fdt_get_backlight_polarity(const void *blob);
42 #else
43 static inline void karo_fdt_remove_node(void *blob, const char *node)
44 {
45 }
46 static inline void karo_fdt_move_fdt(void)
47 {
48 }
49 static inline void karo_fdt_fixup_touchpanel(void *blob, const char *panels[],
50                                         size_t num_panels)
51 {
52 }
53 static inline void karo_fdt_fixup_usb_otg(void *blob, const char *node,
54                                         const char *phy,
55                                         const char *phy_supply)
56 {
57 }
58 static inline void karo_fdt_fixup_flexcan(void *blob, int xcvr_present)
59 {
60 }
61 static inline void karo_fdt_del_prop(void *blob, const char *compat,
62                                 u32 offs, const char *prop)
63 {
64 }
65 static inline void karo_fdt_enable_node(void *blob, const char *node,
66                                         int enable)
67 {
68 }
69 static inline int karo_fdt_get_fb_mode(void *blob, const char *name,
70                                 struct fb_videomode *fb_mode)
71 {
72         return 0;
73 }
74 static inline int karo_fdt_update_fb_mode(void *blob, const char *name)
75 {
76         return 0;
77 }
78 static inline int karo_fdt_create_fb_mode(void *blob,
79                                         const char *name,
80                                         struct fb_videomode *mode)
81 {
82         return 0;
83 }
84 static inline int karo_fdt_get_backlight_polarity(const void *blob)
85 {
86         return getenv_yesno("backlight_polarity");
87 }
88 #endif
89
90 #if defined(CONFIG_SYS_LVDS_IF) && defined(CONFIG_OF_LIBFDT)
91 int karo_fdt_get_lcd_bus_width(const void *blob, int default_width);
92 int karo_fdt_get_lvds_mapping(const void *blob, int default_mapping);
93 u8 karo_fdt_get_lvds_channels(const void *blob);
94 #else
95 static inline int karo_fdt_get_lcd_bus_width(const void *blob, int default_width)
96 {
97         return default_width;
98 }
99 static inline int karo_fdt_get_lvds_mapping(const void *blob, int default_mapping)
100 {
101         return default_mapping;
102 }
103 static inline u8 karo_fdt_get_lvds_channels(const void *blob)
104 {
105         return 0;
106 }
107 #endif
108
109 static inline const char *karo_get_vmode(const char *video_mode)
110 {
111         const char *vmode = NULL;
112
113         if (video_mode == NULL || strlen(video_mode) == 0)
114                 return NULL;
115
116         vmode = strchr(video_mode, ':');
117         return vmode ? vmode + 1 : video_mode;
118 }
119
120 #ifdef CONFIG_SPLASH_SCREEN
121 int karo_load_splashimage(int mode);
122 #else
123 static inline int karo_load_splashimage(int mode)
124 {
125         return 0;
126 }
127 #endif
128
129 #ifdef CONFIG_CMD_NAND
130 int karo_load_nand_part(const char *part, void *addr, size_t len);
131 #else
132 static inline int karo_load_nand_part(const char *part, void *addr, size_t len)
133 {
134         return -EOPNOTSUPP;
135 }
136 #endif
137
138 #ifdef CONFIG_ENV_IS_IN_MMC
139 int karo_load_mmc_part(const char *part, void *addr, size_t len);
140 #else
141 static inline int karo_load_mmc_part(const char *part, void *addr, size_t len)
142 {
143         return -EOPNOTSUPP;
144 }
145 #endif
146
147 static inline int karo_load_part(const char *part, void *addr, size_t len)
148 {
149         int ret;
150
151         ret = karo_load_nand_part(part, addr, len);
152         if (ret == -EOPNOTSUPP)
153                 return karo_load_mmc_part(part, addr, len);
154         return ret;
155 }