Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/sunxi SD/MMC clock fixes
details: https://anonhg.NetBSD.org/src/rev/115d9b1ee2be
branches: trunk
changeset: 825074:115d9b1ee2be
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Thu Jun 29 10:53:59 2017 +0000
description:
SD/MMC clock fixes
diffstat:
sys/arch/arm/sunxi/sun8i_h3_ccu.c | 13 +++++++++----
sys/arch/arm/sunxi/sunxi_ccu.c | 7 ++++---
sys/arch/arm/sunxi/sunxi_ccu.h | 3 ++-
sys/arch/arm/sunxi/sunxi_ccu_nkmp.c | 7 +++++--
sys/arch/arm/sunxi/sunxi_ccu_nm.c | 6 ++++--
5 files changed, 24 insertions(+), 12 deletions(-)
diffs (144 lines):
diff -r 73cb4f3242db -r 115d9b1ee2be sys/arch/arm/sunxi/sun8i_h3_ccu.c
--- a/sys/arch/arm/sunxi/sun8i_h3_ccu.c Thu Jun 29 09:26:06 2017 +0000
+++ b/sys/arch/arm/sunxi/sun8i_h3_ccu.c Thu Jun 29 10:53:59 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sun8i_h3_ccu.c,v 1.2 2017/06/29 09:26:06 jmcneill Exp $ */
+/* $NetBSD: sun8i_h3_ccu.c,v 1.3 2017/06/29 10:53:59 jmcneill Exp $ */
/*-
* Copyright (c) 2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: sun8i_h3_ccu.c,v 1.2 2017/06/29 09:26:06 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sun8i_h3_ccu.c,v 1.3 2017/06/29 10:53:59 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -138,8 +138,13 @@
static struct sunxi_ccu_clk sun8i_h3_ccu_clks[] = {
SUNXI_CCU_NKMP(H3_CLK_PLL_PERIPH0, "pll_periph0", "hosc",
- PLL_PERIPH0_CTRL_REG, __BITS(12,8), __BITS(5,3), 0, __BITS(17,16), __BIT(31),
- 0),
+ PLL_PERIPH0_CTRL_REG, /* reg */
+ __BITS(12,8), /* n */
+ __BITS(5,4), /* k */
+ 0, /* m */
+ __BITS(17,16), /* p */
+ __BIT(31), /* enable */
+ SUNXI_CCU_NKMP_DIVIDE_BY_TWO),
SUNXI_CCU_PREDIV(H3_CLK_AHB1, "ahb1", ahb1_parents,
AHB1_APB1_CFG_REG, /* reg */
diff -r 73cb4f3242db -r 115d9b1ee2be sys/arch/arm/sunxi/sunxi_ccu.c
--- a/sys/arch/arm/sunxi/sunxi_ccu.c Thu Jun 29 09:26:06 2017 +0000
+++ b/sys/arch/arm/sunxi/sunxi_ccu.c Thu Jun 29 10:53:59 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_ccu.c,v 1.2 2017/06/29 09:26:06 jmcneill Exp $ */
+/* $NetBSD: sunxi_ccu.c,v 1.3 2017/06/29 10:53:59 jmcneill Exp $ */
/*-
* Copyright (c) 2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -31,7 +31,7 @@
#include "opt_fdt_arm.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sunxi_ccu.c,v 1.2 2017/06/29 09:26:06 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_ccu.c,v 1.3 2017/06/29 10:53:59 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -327,10 +327,11 @@
case SUNXI_CCU_GATE: type = "gate"; break;
case SUNXI_CCU_NM: type = "nm"; break;
case SUNXI_CCU_NKMP: type = "nkmp"; break;
+ case SUNXI_CCU_PREDIV: type = "prediv"; break;
default: type = "???"; break;
}
- printf(" %-12s %2s %-12s %-5s ",
+ printf(" %-12s %2s %-12s %-7s ",
clk->base.name,
clkp_parent ? "<-" : "",
clkp_parent ? clkp_parent->name : "",
diff -r 73cb4f3242db -r 115d9b1ee2be sys/arch/arm/sunxi/sunxi_ccu.h
--- a/sys/arch/arm/sunxi/sunxi_ccu.h Thu Jun 29 09:26:06 2017 +0000
+++ b/sys/arch/arm/sunxi/sunxi_ccu.h Thu Jun 29 10:53:59 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_ccu.h,v 1.2 2017/06/29 09:26:06 jmcneill Exp $ */
+/* $NetBSD: sunxi_ccu.h,v 1.3 2017/06/29 10:53:59 jmcneill Exp $ */
/*-
* Copyright (c) 2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -94,6 +94,7 @@
uint32_t lock;
uint32_t enable;
uint32_t flags;
+#define SUNXI_CCU_NKMP_DIVIDE_BY_TWO __BIT(0)
};
int sunxi_ccu_nkmp_enable(struct sunxi_ccu_softc *,
diff -r 73cb4f3242db -r 115d9b1ee2be sys/arch/arm/sunxi/sunxi_ccu_nkmp.c
--- a/sys/arch/arm/sunxi/sunxi_ccu_nkmp.c Thu Jun 29 09:26:06 2017 +0000
+++ b/sys/arch/arm/sunxi/sunxi_ccu_nkmp.c Thu Jun 29 10:53:59 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_ccu_nkmp.c,v 1.1 2017/06/29 09:26:06 jmcneill Exp $ */
+/* $NetBSD: sunxi_ccu_nkmp.c,v 1.2 2017/06/29 10:53:59 jmcneill Exp $ */
/*-
* Copyright (c) 2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sunxi_ccu_nkmp.c,v 1.1 2017/06/29 09:26:06 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_ccu_nkmp.c,v 1.2 2017/06/29 10:53:59 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -95,6 +95,9 @@
m++;
p++;
+ if (nkmp->flags & SUNXI_CCU_NKMP_DIVIDE_BY_TWO)
+ m *= 2;
+
return (u_int)((uint64_t)rate * n * k) / (m * p);
}
diff -r 73cb4f3242db -r 115d9b1ee2be sys/arch/arm/sunxi/sunxi_ccu_nm.c
--- a/sys/arch/arm/sunxi/sunxi_ccu_nm.c Thu Jun 29 09:26:06 2017 +0000
+++ b/sys/arch/arm/sunxi/sunxi_ccu_nm.c Thu Jun 29 10:53:59 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_ccu_nm.c,v 1.2 2017/06/29 09:26:06 jmcneill Exp $ */
+/* $NetBSD: sunxi_ccu_nm.c,v 1.3 2017/06/29 10:53:59 jmcneill Exp $ */
/*-
* Copyright (c) 2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sunxi_ccu_nm.c,v 1.2 2017/06/29 09:26:06 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_ccu_nm.c,v 1.3 2017/06/29 10:53:59 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -146,6 +146,7 @@
if (nm->flags & SUNXI_CCU_NM_ROUND_DOWN) {
const int diff = new_rate - rate;
if (diff >= 0 && rate > best_rate) {
+ best_diff = diff;
best_rate = rate;
best_n = n;
best_m = m;
@@ -154,6 +155,7 @@
} else {
const int diff = abs(new_rate - rate);
if (diff < best_diff) {
+ best_diff = diff;
best_rate = rate;
best_n = n;
best_m = m;
Home |
Main Index |
Thread Index |
Old Index