Upstream fix for i.MX6 breakage, Rebase mvebu distro boot patch

This commit is contained in:
Peter Robinson 2016-04-28 11:21:47 +01:00
parent 493343ed76
commit c56130ee24
4 changed files with 76 additions and 150 deletions

View File

@ -1,129 +0,0 @@
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

@ -0,0 +1,57 @@
From patchwork Thu Apr 28 02:07:53 2016
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: [U-Boot] video: ipu_common: fix build error
From: Peng Fan <van.freenix@gmail.com>
X-Patchwork-Id: 615976
Message-Id: <1461809273-4603-1-git-send-email-van.freenix@gmail.com>
To: u-boot@lists.denx.de
Cc: Tom Rini <trini@konsulko.com>, Fabio Estevam <fabio.estevam@nxp.com>
Date: Thu, 28 Apr 2016 10:07:53 +0800
Some toolchains fail to build
"clk->rate = (u64)(clk->parent->rate * 16) / div;"
And the cast usage is wrong.
Use the following code to fix the issue,
"
do_div(parent_rate, div);
clk->rate = parent_rate;
"
Reported-by: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Peng Fan <van.freenix@gmail.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Peter Robinson <pbrobinson@gmail.com>
---
Hi Peter,
Please help test this patch to see whether this fix your issue or not.
Thanks for pointing out this issue.
Thanks,
Peng.
drivers/video/ipu_common.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/video/ipu_common.c b/drivers/video/ipu_common.c
index 36d4b23..5676a0f 100644
--- a/drivers/video/ipu_common.c
+++ b/drivers/video/ipu_common.c
@@ -352,7 +352,9 @@ static int ipu_pixel_clk_set_rate(struct clk *clk, unsigned long rate)
*/
__raw_writel((div / 16) << 16, DI_BS_CLKGEN1(clk->id));
- clk->rate = (u64)(clk->parent->rate * 16) / div;
+ do_div(parent_rate, div);
+
+ clk->rate = parent_rate;
return 0;
}

View File

@ -1,15 +1,7 @@
From patchwork Fri Jan 15 01:20:50 2016
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: [U-Boot] arm: mvebu: enable generic distro boot config
From: Dennis Gilmore <dennis@ausil.us>
X-Patchwork-Id: 567887
Message-Id: <1452820850-12020-1-git-send-email-dennis@ausil.us>
To: u-boot@lists.denx.de, sr@denx.de, thomas@wytron.com.tw,
bmeng.cn@gmail.com, sjg@chromium.org, nikita@compulab.co.il
Cc: Dennis Gilmore <dennis@ausil.us>, Dennis Gilmore <dgilmore@redhat.com>
Date: Thu, 14 Jan 2016 19:20:50 -0600
From 24fcb059b32a34f772e4de114671973f603c4493 Mon Sep 17 00:00:00 2001
From: Peter Robinson <pbrobinson@gmail.com>
Date: Thu, 28 Apr 2016 11:02:53 +0100
Subject: [PATCH] arm: mvebu: enable generic distro boot config
Switch all of the mvebu boards to support disto generic booting
This will enable Fedora, Debian and other distros to support
@ -22,10 +14,10 @@ Signed-off-by: Dennis Gilmore <dgilmore@redhat.com>
2 files changed, 85 insertions(+), 6 deletions(-)
diff --git a/include/configs/clearfog.h b/include/configs/clearfog.h
index f0de827..926b3c5 100644
index ffaeedb..fd0114e 100644
--- a/include/configs/clearfog.h
+++ b/include/configs/clearfog.h
@@ -104,11 +104,6 @@
@@ -90,11 +90,6 @@
#define CONFIG_SYS_CONSOLE_INFO_QUIET /* don't print console @ startup */
#define CONFIG_SYS_ALT_MEMTEST
@ -38,7 +30,7 @@ index f0de827..926b3c5 100644
/*
* Select the boot device here
diff --git a/include/configs/mv-common.h b/include/configs/mv-common.h
index d12d725..e219243 100644
index 6d4bbd1..7050a83 100644
--- a/include/configs/mv-common.h
+++ b/include/configs/mv-common.h
@@ -57,7 +57,7 @@
@ -49,8 +41,8 @@ index d12d725..e219243 100644
+#define CONFIG_BOOTDELAY 2 /* default enable autoboot */
#define CONFIG_PREBOOT
#define CONFIG_OF_LIBFDT /* Device tree support */
@@ -152,4 +152,88 @@
/*
@@ -148,4 +148,88 @@
#define CONFIG_LZO
#endif
@ -139,3 +131,6 @@ index d12d725..e219243 100644
+#endif
+
#endif /* _MV_COMMON_H */
--
2.7.4

View File

@ -2,7 +2,7 @@
Name: uboot-tools
Version: 2016.05
Release: 0.3%{?candidate:.%{candidate}}%{?dist}
Release: 0.4%{?candidate:.%{candidate}}%{?dist}
Summary: U-Boot utilities
Group: Development/Tools
@ -15,9 +15,8 @@ Source2: armv8-boards
Patch1: 0001-Copy-gcc5-over-to-compiler-gcc6.h-as-a-beginning-of-.patch
Patch2: 0004-Add-BOOTENV_INIT_COMMAND-for-commands-that-may-be-ne.patch
Patch3: 0005-port-utilite-to-distro-generic-boot-commands.patch
# Needs a rebase
#Patch4: mvebu-enable-generic-distro-boot-config.patch
Patch5: 0001-Revert-video-ipu-avoid-overflow-issue.patch
Patch4: mvebu-enable-generic-distro-boot-config.patch
Patch5: U-Boot-video-ipu_common-fix-build-error.patch
BuildRequires: bc
BuildRequires: dtc
@ -193,6 +192,10 @@ install -p -m 0644 tools/env/fw_env.config $RPM_BUILD_ROOT%{_sysconfdir}
%endif
%changelog
* Thu Apr 28 2016 Peter Robinson <pbrobinson@fedoraproject.org> 2016.05-0.4rc3
- Upstream fix for i.MX6 breakage
- Rebase mvebu distro boot patch
* Wed Apr 27 2016 Peter Robinson <pbrobinson@fedoraproject.org> 2016.05-0.3rc3
- Add work around for imx6 and renable devices