Add work around for imx6 and renable devices

This commit is contained in:
Peter Robinson 2016-04-27 17:39:31 +01:00
parent 914a23e7a0
commit 493343ed76
3 changed files with 142 additions and 1 deletions

View File

@ -0,0 +1,129 @@
From d0c5ac609ca8c4c2eed36fca380202b62bb4451e Mon Sep 17 00:00:00 2001
From: Peter Robinson <pbrobinson@gmail.com>
Date: Wed, 27 Apr 2016 17:00:10 +0100
Subject: [PATCH] Revert "video: ipu: avoid overflow issue"
This reverts commit 3cb4f25cc702db17455583599d0940c81337a17a.
---
drivers/video/ipu_common.c | 73 ++++++++++++----------------------------------
1 file changed, 19 insertions(+), 54 deletions(-)
diff --git a/drivers/video/ipu_common.c b/drivers/video/ipu_common.c
index 36d4b23..9f85102 100644
--- a/drivers/video/ipu_common.c
+++ b/drivers/video/ipu_common.c
@@ -19,7 +19,6 @@
#include <asm/errno.h>
#include <asm/arch/imx-regs.h>
#include <asm/arch/crm_regs.h>
-#include <div64.h>
#include "ipu.h"
#include "ipu_regs.h"
@@ -276,84 +275,50 @@ static inline void ipu_ch_param_set_buffer(uint32_t ch, int bufNum,
static void ipu_pixel_clk_recalc(struct clk *clk)
{
- u32 div;
- u64 final_rate = (unsigned long long)clk->parent->rate * 16;
-
- div = __raw_readl(DI_BS_CLKGEN0(clk->id));
- debug("read BS_CLKGEN0 div:%d, final_rate:%lld, prate:%ld\n",
- div, final_rate, clk->parent->rate);
-
- clk->rate = 0;
- if (div != 0) {
- do_div(final_rate, div);
- clk->rate = final_rate;
- }
+ u32 div = __raw_readl(DI_BS_CLKGEN0(clk->id));
+ if (div == 0)
+ clk->rate = 0;
+ else
+ clk->rate = (clk->parent->rate * 16) / div;
}
static unsigned long ipu_pixel_clk_round_rate(struct clk *clk,
unsigned long rate)
{
- u64 div, final_rate;
- u32 remainder;
- u64 parent_rate = (unsigned long long)clk->parent->rate * 16;
-
+ u32 div, div1;
+ u32 tmp;
/*
* Calculate divider
* Fractional part is 4 bits,
* so simply multiply by 2^4 to get fractional part.
*/
- div = parent_rate;
- remainder = do_div(div, rate);
- /* Round the divider value */
- if (remainder > (rate / 2))
- div++;
+ tmp = (clk->parent->rate * 16);
+ div = tmp / rate;
+
if (div < 0x10) /* Min DI disp clock divider is 1 */
div = 0x10;
if (div & ~0xFEF)
div &= 0xFF8;
else {
- /* Round up divider if it gets us closer to desired pix clk */
- if ((div & 0xC) == 0xC) {
- div += 0x10;
- div &= ~0xF;
- }
+ div1 = div & 0xFE0;
+ if ((tmp/div1 - tmp/div) < rate / 4)
+ div = div1;
+ else
+ div &= 0xFF8;
}
- final_rate = parent_rate;
- do_div(final_rate, div);
-
- return final_rate;
+ return (clk->parent->rate * 16) / div;
}
static int ipu_pixel_clk_set_rate(struct clk *clk, unsigned long rate)
{
- u64 div, parent_rate;
- u32 remainder;
-
- parent_rate = (unsigned long long)clk->parent->rate * 16;
- div = parent_rate;
- remainder = do_div(div, rate);
- /* Round the divider value */
- if (remainder > (rate / 2))
- div++;
-
- /* Round up divider if it gets us closer to desired pix clk */
- if ((div & 0xC) == 0xC) {
- div += 0x10;
- div &= ~0xF;
- }
- if (div > 0x1000)
- debug("Overflow, DI_BS_CLKGEN0 div:0x%x\n", (u32)div);
+ u32 div = (clk->parent->rate * 16) / rate;
__raw_writel(div, DI_BS_CLKGEN0(clk->id));
- /*
- * Setup pixel clock timing
- * Down time is half of period
- */
+ /* Setup pixel clock timing */
__raw_writel((div / 16) << 16, DI_BS_CLKGEN1(clk->id));
- clk->rate = (u64)(clk->parent->rate * 16) / div;
-
+ clk->rate = (clk->parent->rate * 16) / div;
return 0;
}
--
2.7.4

View File

@ -18,6 +18,7 @@ Bananapro
CHIP CHIP
Chuwi_V7_CW0825 Chuwi_V7_CW0825
clearfog clearfog
cm_fx6
Colombus Colombus
colorfly_e708_q1 colorfly_e708_q1
CSQ_CS908 CSQ_CS908
@ -43,6 +44,7 @@ Lamobo_R1
Linksprite_pcDuino Linksprite_pcDuino
Linksprite_pcDuino3 Linksprite_pcDuino3
Linksprite_pcDuino3_Nano Linksprite_pcDuino3_Nano
marsboard
Marsboard_A10 Marsboard_A10
Mele_A1000 Mele_A1000
Mele_A1000G_quad Mele_A1000G_quad
@ -57,6 +59,8 @@ mk802ii
MK808C MK808C
MSI_Primo73 MSI_Primo73
MSI_Primo81 MSI_Primo81
mx6cuboxi
novena
nyan-big nyan-big
odroid odroid
odroid-xu3 odroid-xu3
@ -80,6 +84,7 @@ q8_a23_tablet_800x480
q8_a33_tablet_1024x600 q8_a33_tablet_1024x600
q8_a33_tablet_800x480 q8_a33_tablet_800x480
r7-tv-dongle r7-tv-dongle
riotboard
rock2 rock2
rpi_2 rpi_2
rpi_3_32b rpi_3_32b
@ -89,9 +94,12 @@ snow
spring spring
sunxi_Gemei_G9 sunxi_Gemei_G9
trimslice trimslice
udoo
UTOO_P66 UTOO_P66
vexpress_ca15_tc2 vexpress_ca15_tc2
vexpress_ca9x4 vexpress_ca9x4
wandboard
warp
Wexler_TAB7200 Wexler_TAB7200
Wits_Pro_A20_DKT Wits_Pro_A20_DKT
Yones_Toptech_BS1078_V2 Yones_Toptech_BS1078_V2

View File

@ -2,7 +2,7 @@
Name: uboot-tools Name: uboot-tools
Version: 2016.05 Version: 2016.05
Release: 0.2%{?candidate:.%{candidate}}%{?dist} Release: 0.3%{?candidate:.%{candidate}}%{?dist}
Summary: U-Boot utilities Summary: U-Boot utilities
Group: Development/Tools Group: Development/Tools
@ -17,6 +17,7 @@ Patch2: 0004-Add-BOOTENV_INIT_COMMAND-for-commands-that-may-be-ne.patch
Patch3: 0005-port-utilite-to-distro-generic-boot-commands.patch Patch3: 0005-port-utilite-to-distro-generic-boot-commands.patch
# Needs a rebase # Needs a rebase
#Patch4: mvebu-enable-generic-distro-boot-config.patch #Patch4: mvebu-enable-generic-distro-boot-config.patch
Patch5: 0001-Revert-video-ipu-avoid-overflow-issue.patch
BuildRequires: bc BuildRequires: bc
BuildRequires: dtc BuildRequires: dtc
@ -192,6 +193,9 @@ install -p -m 0644 tools/env/fw_env.config $RPM_BUILD_ROOT%{_sysconfdir}
%endif %endif
%changelog %changelog
* Wed Apr 27 2016 Peter Robinson <pbrobinson@fedoraproject.org> 2016.05-0.3rc3
- Add work around for imx6 and renable devices
* Tue Apr 26 2016 Peter Robinson <pbrobinson@fedoraproject.org> 2016.05-0.2rc3 * Tue Apr 26 2016 Peter Robinson <pbrobinson@fedoraproject.org> 2016.05-0.2rc3
- 2016.05 RC3 - 2016.05 RC3
- Add some useful device READMEs that contain locations of needed firmware blobs etc - Add some useful device READMEs that contain locations of needed firmware blobs etc