2 * (C) Copyright 2012 Lothar Waßmann <LW@KARO-electronics.de>
4 * See file CREDITS for list of people who contributed to this
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.
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.
23 #ifdef CONFIG_SYS_LVDS_IF
29 void env_cleanup(void);
31 #ifdef CONFIG_OF_LIBFDT
32 void karo_fdt_remove_node(void *blob, const char *node);
33 void karo_fdt_move_fdt(void);
34 void karo_fdt_fixup_touchpanel(void *blob, const char *panels[],
36 void karo_fdt_fixup_usb_otg(void *blob, const char *node, const char *phy,
37 const char *phy_supply);
38 void karo_fdt_fixup_flexcan(void *blob, int xcvr_present);
39 void karo_fdt_del_prop(void *blob, const char *compat, u32 offs,
41 void karo_fdt_enable_node(void *blob, const char *node, int enable);
42 int karo_fdt_get_fb_mode(const void *blob, const char *name,
43 struct fb_videomode *fb_mode);
44 int karo_fdt_update_fb_mode(void *blob, const char *name);
45 int karo_fdt_create_fb_mode(void *blob, const char *name,
46 struct fb_videomode *mode);
47 int karo_fdt_get_backlight_polarity(const void *blob);
48 int karo_fdt_get_backlight_gpio(const void *blob, struct gpio_desc *desc);
50 static inline void karo_fdt_remove_node(void *blob, const char *node)
53 static inline void karo_fdt_move_fdt(void)
56 static inline void karo_fdt_fixup_touchpanel(void *blob, const char *panels[],
60 static inline void karo_fdt_fixup_usb_otg(void *blob, const char *node,
62 const char *phy_supply)
65 static inline void karo_fdt_fixup_flexcan(void *blob, int xcvr_present)
68 static inline void karo_fdt_del_prop(void *blob, const char *compat,
69 u32 offs, const char *prop)
72 static inline void karo_fdt_enable_node(void *blob, const char *node,
76 static inline int karo_fdt_get_fb_mode(void *blob, const char *name,
77 struct fb_videomode *fb_mode)
81 static inline int karo_fdt_update_fb_mode(void *blob, const char *name)
85 static inline int karo_fdt_create_fb_mode(void *blob,
87 struct fb_videomode *mode)
91 static inline int karo_fdt_get_backlight_polarity(const void *blob)
93 return getenv_yesno("backlight_polarity");
95 static inline int karo_fdt_get_backlight_gpio(const void *blob,
96 struct gpio_desc *desc)
102 #if defined(CONFIG_SYS_LVDS_IF) && defined(CONFIG_OF_LIBFDT)
103 int karo_fdt_get_lcd_bus_width(const void *blob, int default_width);
104 int karo_fdt_get_lvds_mapping(const void *blob, int default_mapping);
105 u8 karo_fdt_get_lvds_channels(const void *blob);
107 static inline int karo_fdt_get_lcd_bus_width(const void *blob, int default_width)
109 return default_width;
111 static inline int karo_fdt_get_lvds_mapping(const void *blob, int default_mapping)
113 return default_mapping;
115 static inline u8 karo_fdt_get_lvds_channels(const void *blob)
121 static inline const char *karo_get_vmode(const char *video_mode)
123 const char *vmode = NULL;
125 if (video_mode == NULL || strlen(video_mode) == 0)
128 vmode = strchr(video_mode, ':');
129 return vmode ? vmode + 1 : video_mode;
133 #ifdef CONFIG_VIDEO_IPUV3
137 #ifndef FB_SYNC_CLK_LAT_FALL
138 #define FB_SYNC_CLK_LAT_FALL 0
139 #define FB_SYNC_OE_LOW_ACT 0
142 int karo_get_fb_mode(const char *name, struct fb_videomode **mode);
144 static inline int karo_get_fb_mode(const char *name,
145 struct fb_videomode **mode)
149 #endif /* CONFIG_LCD */
151 #ifdef CONFIG_SPLASH_SCREEN
152 int karo_load_splashimage(int mode);
154 static inline int karo_load_splashimage(int mode)
158 #endif /* CONFIG_SPLASH_SCREEN */
160 #ifdef CONFIG_CMD_NAND
161 int karo_nand_load_part(const char *part, void *addr, size_t len);
163 static inline int karo_nand_load_part(const char *part, void *addr, size_t len)
169 #ifdef CONFIG_ENV_IS_IN_MMC
170 int karo_mmc_load_part(const char *part, void *addr, size_t len);
172 static inline int karo_mmc_load_part(const char *part, void *addr, size_t len)
178 static inline int karo_load_part(const char *part, void *addr, size_t len)
182 ret = karo_nand_load_part(part, addr, len);
183 if (ret == -EOPNOTSUPP)
184 return karo_mmc_load_part(part, addr, len);
188 #define DIV_ROUND(n, d) (((n) + (d) / 2) / (d))