Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Jernej Skrabec | 8d91b46 | 2017-03-27 19:22:32 +0200 | [diff] [blame] | 2 | /* |
| 3 | * Allwinner DE2 display driver |
| 4 | * |
| 5 | * (C) Copyright 2017 Jernej Skrabec <jernej.skrabec@siol.net> |
Jernej Skrabec | 8d91b46 | 2017-03-27 19:22:32 +0200 | [diff] [blame] | 6 | */ |
| 7 | |
Jernej Skrabec | 8d91b46 | 2017-03-27 19:22:32 +0200 | [diff] [blame] | 8 | #include <display.h> |
| 9 | #include <dm.h> |
| 10 | #include <edid.h> |
Emmanuel Vadot | 0219a0c | 2018-05-04 10:26:55 +0200 | [diff] [blame] | 11 | #include <efi_loader.h> |
Icenowy Zheng | 82576de | 2017-10-26 11:14:47 +0800 | [diff] [blame] | 12 | #include <fdtdec.h> |
| 13 | #include <fdt_support.h> |
Simon Glass | 0f2af88 | 2020-05-10 11:40:05 -0600 | [diff] [blame] | 14 | #include <log.h> |
Simon Glass | 655306c | 2020-05-10 11:39:58 -0600 | [diff] [blame] | 15 | #include <part.h> |
Jernej Skrabec | 8d91b46 | 2017-03-27 19:22:32 +0200 | [diff] [blame] | 16 | #include <video.h> |
| 17 | #include <asm/global_data.h> |
| 18 | #include <asm/io.h> |
| 19 | #include <asm/arch/clock.h> |
| 20 | #include <asm/arch/display2.h> |
Simon Glass | 4dcacfc | 2020-05-10 11:40:13 -0600 | [diff] [blame] | 21 | #include <linux/bitops.h> |
Icenowy Zheng | 82576de | 2017-10-26 11:14:47 +0800 | [diff] [blame] | 22 | #include "simplefb_common.h" |
Jernej Skrabec | 8d91b46 | 2017-03-27 19:22:32 +0200 | [diff] [blame] | 23 | |
| 24 | DECLARE_GLOBAL_DATA_PTR; |
| 25 | |
| 26 | enum { |
| 27 | /* Maximum LCD size we support */ |
| 28 | LCD_MAX_WIDTH = 3840, |
| 29 | LCD_MAX_HEIGHT = 2160, |
| 30 | LCD_MAX_LOG2_BPP = VIDEO_BPP32, |
| 31 | }; |
| 32 | |
| 33 | static void sunxi_de2_composer_init(void) |
| 34 | { |
| 35 | struct sunxi_ccm_reg * const ccm = |
| 36 | (struct sunxi_ccm_reg *)SUNXI_CCM_BASE; |
| 37 | |
| 38 | #ifdef CONFIG_MACH_SUN50I |
| 39 | u32 reg_value; |
| 40 | |
| 41 | /* set SRAM for video use (A64 only) */ |
| 42 | reg_value = readl(SUNXI_SRAMC_BASE + 0x04); |
| 43 | reg_value &= ~(0x01 << 24); |
| 44 | writel(reg_value, SUNXI_SRAMC_BASE + 0x04); |
| 45 | #endif |
| 46 | |
| 47 | clock_set_pll10(432000000); |
| 48 | |
| 49 | /* Set DE parent to pll10 */ |
| 50 | clrsetbits_le32(&ccm->de_clk_cfg, CCM_DE2_CTRL_PLL_MASK, |
| 51 | CCM_DE2_CTRL_PLL10); |
| 52 | |
| 53 | /* Set ahb gating to pass */ |
| 54 | setbits_le32(&ccm->ahb_reset1_cfg, 1 << AHB_RESET_OFFSET_DE); |
| 55 | setbits_le32(&ccm->ahb_gate1, 1 << AHB_GATE_OFFSET_DE); |
| 56 | |
| 57 | /* Clock on */ |
| 58 | setbits_le32(&ccm->de_clk_cfg, CCM_DE2_CTRL_GATE); |
| 59 | } |
| 60 | |
| 61 | static void sunxi_de2_mode_set(int mux, const struct display_timing *mode, |
Jernej Skrabec | b8f7cab | 2017-05-19 17:41:16 +0200 | [diff] [blame] | 62 | int bpp, ulong address, bool is_composite) |
Jernej Skrabec | 8d91b46 | 2017-03-27 19:22:32 +0200 | [diff] [blame] | 63 | { |
| 64 | ulong de_mux_base = (mux == 0) ? |
| 65 | SUNXI_DE2_MUX0_BASE : SUNXI_DE2_MUX1_BASE; |
| 66 | struct de_clk * const de_clk_regs = |
| 67 | (struct de_clk *)(SUNXI_DE2_BASE); |
| 68 | struct de_glb * const de_glb_regs = |
| 69 | (struct de_glb *)(de_mux_base + |
| 70 | SUNXI_DE2_MUX_GLB_REGS); |
| 71 | struct de_bld * const de_bld_regs = |
| 72 | (struct de_bld *)(de_mux_base + |
| 73 | SUNXI_DE2_MUX_BLD_REGS); |
| 74 | struct de_ui * const de_ui_regs = |
| 75 | (struct de_ui *)(de_mux_base + |
| 76 | SUNXI_DE2_MUX_CHAN_REGS + |
| 77 | SUNXI_DE2_MUX_CHAN_SZ * 1); |
Jernej Skrabec | b8f7cab | 2017-05-19 17:41:16 +0200 | [diff] [blame] | 78 | struct de_csc * const de_csc_regs = |
| 79 | (struct de_csc *)(de_mux_base + |
| 80 | SUNXI_DE2_MUX_DCSC_REGS); |
Jernej Skrabec | 8d91b46 | 2017-03-27 19:22:32 +0200 | [diff] [blame] | 81 | u32 size = SUNXI_DE2_WH(mode->hactive.typ, mode->vactive.typ); |
| 82 | int channel; |
| 83 | u32 format; |
| 84 | |
| 85 | /* enable clock */ |
| 86 | #ifdef CONFIG_MACH_SUN8I_H3 |
| 87 | setbits_le32(&de_clk_regs->rst_cfg, (mux == 0) ? 1 : 4); |
| 88 | #else |
| 89 | setbits_le32(&de_clk_regs->rst_cfg, BIT(mux)); |
| 90 | #endif |
| 91 | setbits_le32(&de_clk_regs->gate_cfg, BIT(mux)); |
| 92 | setbits_le32(&de_clk_regs->bus_cfg, BIT(mux)); |
| 93 | |
| 94 | clrbits_le32(&de_clk_regs->sel_cfg, 1); |
| 95 | |
| 96 | writel(SUNXI_DE2_MUX_GLB_CTL_EN, &de_glb_regs->ctl); |
| 97 | writel(0, &de_glb_regs->status); |
| 98 | writel(1, &de_glb_regs->dbuff); |
| 99 | writel(size, &de_glb_regs->size); |
| 100 | |
| 101 | for (channel = 0; channel < 4; channel++) { |
| 102 | void *ch = (void *)(de_mux_base + SUNXI_DE2_MUX_CHAN_REGS + |
| 103 | SUNXI_DE2_MUX_CHAN_SZ * channel); |
| 104 | memset(ch, 0, (channel == 0) ? |
| 105 | sizeof(struct de_vi) : sizeof(struct de_ui)); |
| 106 | } |
| 107 | memset(de_bld_regs, 0, sizeof(struct de_bld)); |
| 108 | |
| 109 | writel(0x00000101, &de_bld_regs->fcolor_ctl); |
| 110 | |
| 111 | writel(1, &de_bld_regs->route); |
| 112 | |
| 113 | writel(0, &de_bld_regs->premultiply); |
| 114 | writel(0xff000000, &de_bld_regs->bkcolor); |
| 115 | |
| 116 | writel(0x03010301, &de_bld_regs->bld_mode[0]); |
| 117 | |
| 118 | writel(size, &de_bld_regs->output_size); |
| 119 | writel(mode->flags & DISPLAY_FLAGS_INTERLACED ? 2 : 0, |
| 120 | &de_bld_regs->out_ctl); |
| 121 | writel(0, &de_bld_regs->ck_ctl); |
| 122 | |
| 123 | writel(0xff000000, &de_bld_regs->attr[0].fcolor); |
| 124 | writel(size, &de_bld_regs->attr[0].insize); |
| 125 | |
| 126 | /* Disable all other units */ |
| 127 | writel(0, de_mux_base + SUNXI_DE2_MUX_VSU_REGS); |
| 128 | writel(0, de_mux_base + SUNXI_DE2_MUX_GSU1_REGS); |
| 129 | writel(0, de_mux_base + SUNXI_DE2_MUX_GSU2_REGS); |
| 130 | writel(0, de_mux_base + SUNXI_DE2_MUX_GSU3_REGS); |
| 131 | writel(0, de_mux_base + SUNXI_DE2_MUX_FCE_REGS); |
| 132 | writel(0, de_mux_base + SUNXI_DE2_MUX_BWS_REGS); |
| 133 | writel(0, de_mux_base + SUNXI_DE2_MUX_LTI_REGS); |
| 134 | writel(0, de_mux_base + SUNXI_DE2_MUX_PEAK_REGS); |
| 135 | writel(0, de_mux_base + SUNXI_DE2_MUX_ASE_REGS); |
| 136 | writel(0, de_mux_base + SUNXI_DE2_MUX_FCC_REGS); |
Jernej Skrabec | b8f7cab | 2017-05-19 17:41:16 +0200 | [diff] [blame] | 137 | |
| 138 | if (is_composite) { |
| 139 | /* set CSC coefficients */ |
| 140 | writel(0x107, &de_csc_regs->coef11); |
| 141 | writel(0x204, &de_csc_regs->coef12); |
| 142 | writel(0x64, &de_csc_regs->coef13); |
| 143 | writel(0x4200, &de_csc_regs->coef14); |
| 144 | writel(0x1f68, &de_csc_regs->coef21); |
| 145 | writel(0x1ed6, &de_csc_regs->coef22); |
| 146 | writel(0x1c2, &de_csc_regs->coef23); |
| 147 | writel(0x20200, &de_csc_regs->coef24); |
| 148 | writel(0x1c2, &de_csc_regs->coef31); |
| 149 | writel(0x1e87, &de_csc_regs->coef32); |
| 150 | writel(0x1fb7, &de_csc_regs->coef33); |
| 151 | writel(0x20200, &de_csc_regs->coef34); |
| 152 | |
| 153 | /* enable CSC unit */ |
| 154 | writel(1, &de_csc_regs->csc_ctl); |
| 155 | } else { |
| 156 | writel(0, &de_csc_regs->csc_ctl); |
| 157 | } |
Jernej Skrabec | 8d91b46 | 2017-03-27 19:22:32 +0200 | [diff] [blame] | 158 | |
| 159 | switch (bpp) { |
| 160 | case 16: |
| 161 | format = SUNXI_DE2_UI_CFG_ATTR_FMT(SUNXI_DE2_FORMAT_RGB_565); |
| 162 | break; |
| 163 | case 32: |
| 164 | default: |
| 165 | format = SUNXI_DE2_UI_CFG_ATTR_FMT(SUNXI_DE2_FORMAT_XRGB_8888); |
| 166 | break; |
| 167 | } |
| 168 | |
| 169 | writel(SUNXI_DE2_UI_CFG_ATTR_EN | format, &de_ui_regs->cfg[0].attr); |
| 170 | writel(size, &de_ui_regs->cfg[0].size); |
| 171 | writel(0, &de_ui_regs->cfg[0].coord); |
| 172 | writel((bpp / 8) * mode->hactive.typ, &de_ui_regs->cfg[0].pitch); |
| 173 | writel(address, &de_ui_regs->cfg[0].top_laddr); |
| 174 | writel(size, &de_ui_regs->ovl_size); |
| 175 | |
| 176 | /* apply settings */ |
| 177 | writel(1, &de_glb_regs->dbuff); |
| 178 | } |
| 179 | |
| 180 | static int sunxi_de2_init(struct udevice *dev, ulong fbbase, |
| 181 | enum video_log2_bpp l2bpp, |
Jernej Skrabec | b8f7cab | 2017-05-19 17:41:16 +0200 | [diff] [blame] | 182 | struct udevice *disp, int mux, bool is_composite) |
Jernej Skrabec | 8d91b46 | 2017-03-27 19:22:32 +0200 | [diff] [blame] | 183 | { |
| 184 | struct video_priv *uc_priv = dev_get_uclass_priv(dev); |
| 185 | struct display_timing timing; |
| 186 | struct display_plat *disp_uc_plat; |
| 187 | int ret; |
| 188 | |
Simon Glass | 71fa5b4 | 2020-12-03 16:55:18 -0700 | [diff] [blame] | 189 | disp_uc_plat = dev_get_uclass_plat(disp); |
Jernej Skrabec | 8d91b46 | 2017-03-27 19:22:32 +0200 | [diff] [blame] | 190 | debug("Using device '%s', disp_uc_priv=%p\n", disp->name, disp_uc_plat); |
| 191 | if (display_in_use(disp)) { |
| 192 | debug(" - device in use\n"); |
| 193 | return -EBUSY; |
| 194 | } |
| 195 | |
| 196 | disp_uc_plat->source_id = mux; |
| 197 | |
Jernej Skrabec | 8d91b46 | 2017-03-27 19:22:32 +0200 | [diff] [blame] | 198 | ret = display_read_timing(disp, &timing); |
| 199 | if (ret) { |
| 200 | debug("%s: Failed to read timings\n", __func__); |
| 201 | return ret; |
| 202 | } |
| 203 | |
| 204 | sunxi_de2_composer_init(); |
Jernej Skrabec | b8f7cab | 2017-05-19 17:41:16 +0200 | [diff] [blame] | 205 | sunxi_de2_mode_set(mux, &timing, 1 << l2bpp, fbbase, is_composite); |
Jernej Skrabec | 8d91b46 | 2017-03-27 19:22:32 +0200 | [diff] [blame] | 206 | |
| 207 | ret = display_enable(disp, 1 << l2bpp, &timing); |
| 208 | if (ret) { |
| 209 | debug("%s: Failed to enable display\n", __func__); |
| 210 | return ret; |
| 211 | } |
| 212 | |
| 213 | uc_priv->xsize = timing.hactive.typ; |
| 214 | uc_priv->ysize = timing.vactive.typ; |
| 215 | uc_priv->bpix = l2bpp; |
| 216 | debug("fb=%lx, size=%d %d\n", fbbase, uc_priv->xsize, uc_priv->ysize); |
| 217 | |
Emmanuel Vadot | 0219a0c | 2018-05-04 10:26:55 +0200 | [diff] [blame] | 218 | #ifdef CONFIG_EFI_LOADER |
| 219 | efi_add_memory_map(fbbase, |
Michael Walle | 282d386 | 2020-05-17 12:29:19 +0200 | [diff] [blame] | 220 | timing.hactive.typ * timing.vactive.typ * |
| 221 | (1 << l2bpp) / 8, |
| 222 | EFI_RESERVED_MEMORY_TYPE); |
Emmanuel Vadot | 0219a0c | 2018-05-04 10:26:55 +0200 | [diff] [blame] | 223 | #endif |
| 224 | |
Jernej Skrabec | 8d91b46 | 2017-03-27 19:22:32 +0200 | [diff] [blame] | 225 | return 0; |
| 226 | } |
| 227 | |
| 228 | static int sunxi_de2_probe(struct udevice *dev) |
| 229 | { |
Simon Glass | b75b15b | 2020-12-03 16:55:23 -0700 | [diff] [blame] | 230 | struct video_uc_plat *plat = dev_get_uclass_plat(dev); |
Jernej Skrabec | 8d91b46 | 2017-03-27 19:22:32 +0200 | [diff] [blame] | 231 | struct udevice *disp; |
| 232 | int ret; |
Jernej Skrabec | 8d91b46 | 2017-03-27 19:22:32 +0200 | [diff] [blame] | 233 | |
| 234 | /* Before relocation we don't need to do anything */ |
| 235 | if (!(gd->flags & GD_FLG_RELOC)) |
| 236 | return 0; |
| 237 | |
Jernej Skrabec | edee873 | 2021-04-22 01:14:34 +0100 | [diff] [blame] | 238 | ret = uclass_get_device_by_driver(UCLASS_DISPLAY, |
| 239 | DM_DRIVER_GET(sunxi_lcd), &disp); |
Vasily Khoruzhick | 2f0b6e5 | 2017-10-26 21:51:52 -0700 | [diff] [blame] | 240 | if (!ret) { |
| 241 | int mux; |
| 242 | |
| 243 | mux = 0; |
| 244 | |
| 245 | ret = sunxi_de2_init(dev, plat->base, VIDEO_BPP32, disp, mux, |
| 246 | false); |
| 247 | if (!ret) { |
| 248 | video_set_flush_dcache(dev, 1); |
| 249 | return 0; |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | debug("%s: lcd display not found (ret=%d)\n", __func__, ret); |
| 254 | |
Jernej Skrabec | edee873 | 2021-04-22 01:14:34 +0100 | [diff] [blame] | 255 | ret = uclass_get_device_by_driver(UCLASS_DISPLAY, |
| 256 | DM_DRIVER_GET(sunxi_dw_hdmi), &disp); |
Jernej Skrabec | b8f7cab | 2017-05-19 17:41:16 +0200 | [diff] [blame] | 257 | if (!ret) { |
| 258 | int mux; |
| 259 | if (IS_ENABLED(CONFIG_MACH_SUNXI_H3_H5)) |
| 260 | mux = 0; |
| 261 | else |
| 262 | mux = 1; |
| 263 | |
| 264 | ret = sunxi_de2_init(dev, plat->base, VIDEO_BPP32, disp, mux, |
| 265 | false); |
| 266 | if (!ret) { |
| 267 | video_set_flush_dcache(dev, 1); |
| 268 | return 0; |
| 269 | } |
| 270 | } |
| 271 | |
| 272 | debug("%s: hdmi display not found (ret=%d)\n", __func__, ret); |
| 273 | |
Jernej Skrabec | e4aa471 | 2021-04-22 01:14:32 +0100 | [diff] [blame] | 274 | return -ENODEV; |
Jernej Skrabec | 8d91b46 | 2017-03-27 19:22:32 +0200 | [diff] [blame] | 275 | } |
| 276 | |
| 277 | static int sunxi_de2_bind(struct udevice *dev) |
| 278 | { |
Simon Glass | b75b15b | 2020-12-03 16:55:23 -0700 | [diff] [blame] | 279 | struct video_uc_plat *plat = dev_get_uclass_plat(dev); |
Jernej Skrabec | 8d91b46 | 2017-03-27 19:22:32 +0200 | [diff] [blame] | 280 | |
| 281 | plat->size = LCD_MAX_WIDTH * LCD_MAX_HEIGHT * |
| 282 | (1 << LCD_MAX_LOG2_BPP) / 8; |
| 283 | |
| 284 | return 0; |
| 285 | } |
| 286 | |
| 287 | static const struct video_ops sunxi_de2_ops = { |
| 288 | }; |
| 289 | |
| 290 | U_BOOT_DRIVER(sunxi_de2) = { |
| 291 | .name = "sunxi_de2", |
| 292 | .id = UCLASS_VIDEO, |
| 293 | .ops = &sunxi_de2_ops, |
| 294 | .bind = sunxi_de2_bind, |
| 295 | .probe = sunxi_de2_probe, |
| 296 | .flags = DM_FLAG_PRE_RELOC, |
| 297 | }; |
| 298 | |
Simon Glass | 1d8364a | 2020-12-28 20:34:54 -0700 | [diff] [blame] | 299 | U_BOOT_DRVINFO(sunxi_de2) = { |
Jernej Skrabec | 8d91b46 | 2017-03-27 19:22:32 +0200 | [diff] [blame] | 300 | .name = "sunxi_de2" |
| 301 | }; |
Icenowy Zheng | 82576de | 2017-10-26 11:14:47 +0800 | [diff] [blame] | 302 | |
| 303 | /* |
| 304 | * Simplefb support. |
| 305 | */ |
| 306 | #if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_VIDEO_DT_SIMPLEFB) |
| 307 | int sunxi_simplefb_setup(void *blob) |
| 308 | { |
Icenowy Zheng | f6dc771 | 2017-11-01 22:18:07 +0800 | [diff] [blame] | 309 | struct udevice *de2, *hdmi, *lcd; |
Icenowy Zheng | 82576de | 2017-10-26 11:14:47 +0800 | [diff] [blame] | 310 | struct video_priv *de2_priv; |
Simon Glass | b75b15b | 2020-12-03 16:55:23 -0700 | [diff] [blame] | 311 | struct video_uc_plat *de2_plat; |
Icenowy Zheng | 82576de | 2017-10-26 11:14:47 +0800 | [diff] [blame] | 312 | int mux; |
| 313 | int offset, ret; |
| 314 | u64 start, size; |
| 315 | const char *pipeline = NULL; |
| 316 | |
| 317 | debug("Setting up simplefb\n"); |
| 318 | |
| 319 | if (IS_ENABLED(CONFIG_MACH_SUNXI_H3_H5)) |
| 320 | mux = 0; |
| 321 | else |
| 322 | mux = 1; |
| 323 | |
| 324 | /* Skip simplefb setting if DE2 / HDMI is not present */ |
Jernej Skrabec | edee873 | 2021-04-22 01:14:34 +0100 | [diff] [blame] | 325 | ret = uclass_get_device_by_driver(UCLASS_VIDEO, |
| 326 | DM_DRIVER_GET(sunxi_de2), &de2); |
Icenowy Zheng | 82576de | 2017-10-26 11:14:47 +0800 | [diff] [blame] | 327 | if (ret) { |
| 328 | debug("DE2 not present\n"); |
| 329 | return 0; |
Icenowy Zheng | 43768b2 | 2018-07-27 23:50:53 +0800 | [diff] [blame] | 330 | } else if (!device_active(de2)) { |
| 331 | debug("DE2 present but not probed\n"); |
| 332 | return 0; |
Icenowy Zheng | 82576de | 2017-10-26 11:14:47 +0800 | [diff] [blame] | 333 | } |
| 334 | |
Jernej Skrabec | edee873 | 2021-04-22 01:14:34 +0100 | [diff] [blame] | 335 | ret = uclass_get_device_by_driver(UCLASS_DISPLAY, |
| 336 | DM_DRIVER_GET(sunxi_dw_hdmi), &hdmi); |
Icenowy Zheng | 82576de | 2017-10-26 11:14:47 +0800 | [diff] [blame] | 337 | if (ret) { |
| 338 | debug("HDMI not present\n"); |
Icenowy Zheng | de8e06f | 2017-11-01 22:18:06 +0800 | [diff] [blame] | 339 | } else if (device_active(hdmi)) { |
| 340 | if (mux == 0) |
| 341 | pipeline = "mixer0-lcd0-hdmi"; |
| 342 | else |
| 343 | pipeline = "mixer1-lcd1-hdmi"; |
| 344 | } else { |
| 345 | debug("HDMI present but not probed\n"); |
Icenowy Zheng | 82576de | 2017-10-26 11:14:47 +0800 | [diff] [blame] | 346 | } |
| 347 | |
Jernej Skrabec | edee873 | 2021-04-22 01:14:34 +0100 | [diff] [blame] | 348 | ret = uclass_get_device_by_driver(UCLASS_DISPLAY, |
| 349 | DM_DRIVER_GET(sunxi_lcd), &lcd); |
Icenowy Zheng | f6dc771 | 2017-11-01 22:18:07 +0800 | [diff] [blame] | 350 | if (ret) |
| 351 | debug("LCD not present\n"); |
| 352 | else if (device_active(lcd)) |
| 353 | pipeline = "mixer0-lcd0"; |
| 354 | else |
| 355 | debug("LCD present but not probed\n"); |
| 356 | |
Icenowy Zheng | de8e06f | 2017-11-01 22:18:06 +0800 | [diff] [blame] | 357 | if (!pipeline) { |
| 358 | debug("No active display present\n"); |
| 359 | return 0; |
| 360 | } |
Icenowy Zheng | 82576de | 2017-10-26 11:14:47 +0800 | [diff] [blame] | 361 | |
| 362 | de2_priv = dev_get_uclass_priv(de2); |
Simon Glass | 71fa5b4 | 2020-12-03 16:55:18 -0700 | [diff] [blame] | 363 | de2_plat = dev_get_uclass_plat(de2); |
Icenowy Zheng | 82576de | 2017-10-26 11:14:47 +0800 | [diff] [blame] | 364 | |
| 365 | offset = sunxi_simplefb_fdt_match(blob, pipeline); |
| 366 | if (offset < 0) { |
| 367 | eprintf("Cannot setup simplefb: node not found\n"); |
| 368 | return 0; /* Keep older kernels working */ |
| 369 | } |
| 370 | |
| 371 | start = gd->bd->bi_dram[0].start; |
| 372 | size = de2_plat->base - start; |
| 373 | ret = fdt_fixup_memory_banks(blob, &start, &size, 1); |
| 374 | if (ret) { |
| 375 | eprintf("Cannot setup simplefb: Error reserving memory\n"); |
| 376 | return ret; |
| 377 | } |
| 378 | |
| 379 | ret = fdt_setup_simplefb_node(blob, offset, de2_plat->base, |
| 380 | de2_priv->xsize, de2_priv->ysize, |
| 381 | VNBYTES(de2_priv->bpix) * de2_priv->xsize, |
| 382 | "x8r8g8b8"); |
| 383 | if (ret) |
| 384 | eprintf("Cannot setup simplefb: Error setting properties\n"); |
| 385 | |
| 386 | return ret; |
| 387 | } |
| 388 | #endif /* CONFIG_OF_BOARD_SETUP && CONFIG_VIDEO_DT_SIMPLEFB */ |