mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-12-11 22:03:15 +00:00
83d290c56f
When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
83 lines
2.1 KiB
C
83 lines
2.1 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* Copyright 2014 Freescale Semiconductor, Inc.
|
|
* Author: Priyanka Jain <Priyanka.Jain@freescale.com>
|
|
*/
|
|
|
|
#include <asm/io.h>
|
|
#include <common.h>
|
|
#include <command.h>
|
|
#include <fsl_diu_fb.h>
|
|
#include <linux/ctype.h>
|
|
#include <video_fb.h>
|
|
|
|
#include "../common/diu_ch7301.h"
|
|
|
|
#include "cpld.h"
|
|
#include "t104xrdb.h"
|
|
|
|
/*
|
|
* DIU Area Descriptor
|
|
*
|
|
* Note that we need to byte-swap the value before it's written to the AD
|
|
* register. So even though the registers don't look like they're in the same
|
|
* bit positions as they are on the MPC8610, the same value is written to the
|
|
* AD register on the MPC8610 and on the P1022.
|
|
*/
|
|
#define AD_BYTE_F 0x10000000
|
|
#define AD_ALPHA_C_SHIFT 25
|
|
#define AD_BLUE_C_SHIFT 23
|
|
#define AD_GREEN_C_SHIFT 21
|
|
#define AD_RED_C_SHIFT 19
|
|
#define AD_PIXEL_S_SHIFT 16
|
|
#define AD_COMP_3_SHIFT 12
|
|
#define AD_COMP_2_SHIFT 8
|
|
#define AD_COMP_1_SHIFT 4
|
|
#define AD_COMP_0_SHIFT 0
|
|
|
|
void diu_set_pixel_clock(unsigned int pixclock)
|
|
{
|
|
unsigned long speed_ccb, temp;
|
|
u32 pixval;
|
|
int ret;
|
|
|
|
speed_ccb = get_bus_freq(0);
|
|
temp = 1000000000 / pixclock;
|
|
temp *= 1000;
|
|
pixval = speed_ccb / temp;
|
|
|
|
/* Program HDMI encoder */
|
|
ret = diu_set_dvi_encoder(temp);
|
|
if (ret) {
|
|
puts("Failed to set DVI encoder\n");
|
|
return;
|
|
}
|
|
|
|
/* Program pixel clock */
|
|
out_be32((unsigned *)CONFIG_SYS_FSL_SCFG_PIXCLK_ADDR,
|
|
((pixval << PXCK_BITS_START) & PXCK_MASK));
|
|
|
|
/* enable clock*/
|
|
out_be32((unsigned *)CONFIG_SYS_FSL_SCFG_PIXCLK_ADDR, PXCKEN_MASK |
|
|
((pixval << PXCK_BITS_START) & PXCK_MASK));
|
|
}
|
|
|
|
int platform_diu_init(unsigned int xres, unsigned int yres, const char *port)
|
|
{
|
|
u32 pixel_format;
|
|
u8 sw;
|
|
|
|
/*Configure Display ouput port as HDMI*/
|
|
sw = CPLD_READ(sfp_ctl_status);
|
|
CPLD_WRITE(sfp_ctl_status , sw & ~(CPLD_DIU_SEL_DFP));
|
|
|
|
pixel_format = cpu_to_le32(AD_BYTE_F | (3 << AD_ALPHA_C_SHIFT) |
|
|
(0 << AD_BLUE_C_SHIFT) | (1 << AD_GREEN_C_SHIFT) |
|
|
(2 << AD_RED_C_SHIFT) | (8 << AD_COMP_3_SHIFT) |
|
|
(8 << AD_COMP_2_SHIFT) | (8 << AD_COMP_1_SHIFT) |
|
|
(8 << AD_COMP_0_SHIFT) | (3 << AD_PIXEL_S_SHIFT));
|
|
|
|
printf("DIU: Switching to monitor DVI @ %ux%u\n", xres, yres);
|
|
|
|
return fsl_diu_init(xres, yres, pixel_format, 0);
|
|
}
|