2013-01-29 16:37:40 +00:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2012 Stephen Warren
|
|
|
|
*
|
2013-07-08 07:37:19 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
2013-01-29 16:37:40 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
2017-04-05 22:23:44 +00:00
|
|
|
#include <dm.h>
|
|
|
|
#include <video.h>
|
2013-01-29 16:37:40 +00:00
|
|
|
#include <asm/arch/mbox.h>
|
2017-04-05 22:23:40 +00:00
|
|
|
#include <asm/arch/msg.h>
|
2013-01-29 16:37:40 +00:00
|
|
|
|
2017-04-05 22:23:44 +00:00
|
|
|
static int bcm2835_video_probe(struct udevice *dev)
|
2013-01-29 16:37:40 +00:00
|
|
|
{
|
2017-04-05 22:23:44 +00:00
|
|
|
struct video_uc_platdata *plat = dev_get_uclass_platdata(dev);
|
|
|
|
struct video_priv *uc_priv = dev_get_uclass_priv(dev);
|
2013-01-29 16:37:40 +00:00
|
|
|
int ret;
|
2017-04-05 22:23:44 +00:00
|
|
|
int w, h, pitch;
|
2017-04-05 22:23:41 +00:00
|
|
|
ulong fb_base, fb_size, fb_start, fb_end;
|
2013-01-29 16:37:40 +00:00
|
|
|
|
|
|
|
debug("bcm2835: Query resolution...\n");
|
2017-04-05 22:23:40 +00:00
|
|
|
ret = bcm2835_get_video_size(&w, &h);
|
2017-04-05 22:23:44 +00:00
|
|
|
if (ret)
|
|
|
|
return -EIO;
|
2013-01-29 16:37:40 +00:00
|
|
|
|
|
|
|
debug("bcm2835: Setting up display for %d x %d\n", w, h);
|
2017-04-05 22:23:41 +00:00
|
|
|
ret = bcm2835_set_video_params(&w, &h, 32, BCM2835_MBOX_PIXEL_ORDER_RGB,
|
|
|
|
BCM2835_MBOX_ALPHA_MODE_IGNORED,
|
2017-04-05 22:23:44 +00:00
|
|
|
&fb_base, &fb_size, &pitch);
|
2013-01-29 16:37:40 +00:00
|
|
|
|
|
|
|
debug("bcm2835: Final resolution is %d x %d\n", w, h);
|
|
|
|
|
2016-03-24 09:31:11 +00:00
|
|
|
/* Enable dcache for the frame buffer */
|
2017-04-05 22:23:41 +00:00
|
|
|
fb_start = fb_base & ~(MMU_SECTION_SIZE - 1);
|
|
|
|
fb_end = fb_base + fb_size;
|
2016-03-24 09:31:11 +00:00
|
|
|
fb_end = ALIGN(fb_end, 1 << MMU_SECTION_SHIFT);
|
|
|
|
mmu_set_region_dcache_behaviour(fb_start, fb_end - fb_start,
|
2017-04-05 22:23:41 +00:00
|
|
|
DCACHE_WRITEBACK);
|
2017-04-05 22:23:44 +00:00
|
|
|
video_set_flush_dcache(dev, true);
|
2013-01-29 16:37:40 +00:00
|
|
|
|
2017-04-05 22:23:44 +00:00
|
|
|
uc_priv->xsize = w;
|
|
|
|
uc_priv->ysize = h;
|
|
|
|
uc_priv->bpix = VIDEO_BPP32;
|
|
|
|
plat->base = fb_base;
|
|
|
|
plat->size = fb_size;
|
2013-11-09 10:07:53 +00:00
|
|
|
|
2017-04-05 22:23:44 +00:00
|
|
|
return 0;
|
2013-11-09 10:07:53 +00:00
|
|
|
}
|
2017-04-05 22:23:44 +00:00
|
|
|
|
|
|
|
static const struct udevice_id bcm2835_video_ids[] = {
|
|
|
|
{ .compatible = "brcm,bcm2835-hdmi" },
|
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
|
|
|
U_BOOT_DRIVER(bcm2835_video) = {
|
|
|
|
.name = "bcm2835_video",
|
|
|
|
.id = UCLASS_VIDEO,
|
|
|
|
.of_match = bcm2835_video_ids,
|
|
|
|
.probe = bcm2835_video_probe,
|
|
|
|
};
|