Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Wang Huan | b4ecc8c | 2014-09-05 13:52:50 +0800 | [diff] [blame] | 2 | /* |
| 3 | * Copyright 2014 Freescale Semiconductor, Inc. |
| 4 | * |
| 5 | * FSL DCU Framebuffer driver |
Wang Huan | b4ecc8c | 2014-09-05 13:52:50 +0800 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #include <common.h> |
| 9 | #include <fsl_dcu_fb.h> |
| 10 | #include "div64.h" |
| 11 | #include "../common/dcu_sii9022a.h" |
| 12 | |
| 13 | DECLARE_GLOBAL_DATA_PTR; |
| 14 | |
| 15 | unsigned int dcu_set_pixel_clock(unsigned int pixclock) |
| 16 | { |
| 17 | unsigned long long div; |
| 18 | |
| 19 | div = (unsigned long long)(gd->bus_clk / 1000); |
| 20 | div *= (unsigned long long)pixclock; |
| 21 | do_div(div, 1000000000); |
| 22 | |
| 23 | return div; |
| 24 | } |
| 25 | |
Igor Opaniuk | a6eedb6 | 2019-06-10 14:47:49 +0300 | [diff] [blame] | 26 | int platform_dcu_init(struct fb_info *fbinfo, |
| 27 | unsigned int xres, unsigned int yres, |
Wang Huan | b4ecc8c | 2014-09-05 13:52:50 +0800 | [diff] [blame] | 28 | const char *port, |
| 29 | struct fb_videomode *dcu_fb_videomode) |
| 30 | { |
| 31 | const char *name; |
| 32 | unsigned int pixel_format; |
| 33 | |
| 34 | if (strncmp(port, "twr_lcd", 4) == 0) { |
| 35 | name = "TWR_LCD_RGB card"; |
| 36 | } else { |
| 37 | name = "HDMI"; |
| 38 | dcu_set_dvi_encoder(dcu_fb_videomode); |
| 39 | } |
| 40 | |
| 41 | printf("DCU: Switching to %s monitor @ %ux%u\n", name, xres, yres); |
| 42 | |
| 43 | pixel_format = 32; |
Igor Opaniuk | a6eedb6 | 2019-06-10 14:47:49 +0300 | [diff] [blame] | 44 | fsl_dcu_init(fbinfo, xres, yres, pixel_format); |
Wang Huan | b4ecc8c | 2014-09-05 13:52:50 +0800 | [diff] [blame] | 45 | |
| 46 | return 0; |
| 47 | } |