]> Git Repo - J-u-boot.git/blame - drivers/video/bcm2835.c
lib: div64: fix typeo in include/div64.h
[J-u-boot.git] / drivers / video / bcm2835.c
CommitLineData
83d290c5 1// SPDX-License-Identifier: GPL-2.0+
6be3c9fc
SW
2/*
3 * (C) Copyright 2012 Stephen Warren
6be3c9fc
SW
4 */
5
6#include <common.h>
ea843b6d
SG
7#include <dm.h>
8#include <video.h>
6be3c9fc 9#include <asm/arch/mbox.h>
2e4170b6 10#include <asm/arch/msg.h>
6be3c9fc 11
ea843b6d 12static int bcm2835_video_probe(struct udevice *dev)
6be3c9fc 13{
ea843b6d
SG
14 struct video_uc_platdata *plat = dev_get_uclass_platdata(dev);
15 struct video_priv *uc_priv = dev_get_uclass_priv(dev);
6be3c9fc 16 int ret;
ea843b6d 17 int w, h, pitch;
7cac2fce 18 ulong fb_base, fb_size, fb_start, fb_end;
6be3c9fc
SW
19
20 debug("bcm2835: Query resolution...\n");
2e4170b6 21 ret = bcm2835_get_video_size(&w, &h);
ea843b6d
SG
22 if (ret)
23 return -EIO;
6be3c9fc 24
6be3c9fc 25 debug("bcm2835: Setting up display for %d x %d\n", w, h);
7cac2fce
SG
26 ret = bcm2835_set_video_params(&w, &h, 32, BCM2835_MBOX_PIXEL_ORDER_RGB,
27 BCM2835_MBOX_ALPHA_MODE_IGNORED,
ea843b6d 28 &fb_base, &fb_size, &pitch);
6be3c9fc
SW
29
30 debug("bcm2835: Final resolution is %d x %d\n", w, h);
31
99de254e 32 /* Enable dcache for the frame buffer */
7cac2fce
SG
33 fb_start = fb_base & ~(MMU_SECTION_SIZE - 1);
34 fb_end = fb_base + fb_size;
99de254e
AG
35 fb_end = ALIGN(fb_end, 1 << MMU_SECTION_SHIFT);
36 mmu_set_region_dcache_behaviour(fb_start, fb_end - fb_start,
7cac2fce 37 DCACHE_WRITEBACK);
ea843b6d 38 video_set_flush_dcache(dev, true);
6be3c9fc 39
ea843b6d
SG
40 uc_priv->xsize = w;
41 uc_priv->ysize = h;
42 uc_priv->bpix = VIDEO_BPP32;
43 plat->base = fb_base;
44 plat->size = fb_size;
44376eff 45
ea843b6d 46 return 0;
44376eff 47}
ea843b6d
SG
48
49static const struct udevice_id bcm2835_video_ids[] = {
50 { .compatible = "brcm,bcm2835-hdmi" },
51 { }
52};
53
54U_BOOT_DRIVER(bcm2835_video) = {
55 .name = "bcm2835_video",
56 .id = UCLASS_VIDEO,
57 .of_match = bcm2835_video_ids,
58 .probe = bcm2835_video_probe,
59};
This page took 0.310699 seconds and 4 git commands to generate.