Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev Fix performance regression with previous



details:   https://anonhg.NetBSD.org/src/rev/577cdbfc9a1f
branches:  trunk
changeset: 968052:577cdbfc9a1f
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Wed Jan 01 12:18:18 2020 +0000

description:
Fix performance regression with previous

diffstat:

 sys/dev/fdt/dwcmmc_fdt.c |   7 ++++---
 sys/dev/ic/dwc_mmc.c     |  10 ++++++----
 sys/dev/ic/dwc_mmc_var.h |   4 +++-
 3 files changed, 13 insertions(+), 8 deletions(-)

diffs (86 lines):

diff -r 3788890dc65f -r 577cdbfc9a1f sys/dev/fdt/dwcmmc_fdt.c
--- a/sys/dev/fdt/dwcmmc_fdt.c  Wed Jan 01 12:17:13 2020 +0000
+++ b/sys/dev/fdt/dwcmmc_fdt.c  Wed Jan 01 12:18:18 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dwcmmc_fdt.c,v 1.9 2020/01/01 11:21:15 jmcneill Exp $ */
+/* $NetBSD: dwcmmc_fdt.c,v 1.10 2020/01/01 12:18:18 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015-2018 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dwcmmc_fdt.c,v 1.9 2020/01/01 11:21:15 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwcmmc_fdt.c,v 1.10 2020/01/01 12:18:18 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -156,6 +156,7 @@
                sc->sc_bus_width = 4;
 
        sc->sc_fifo_depth = fifo_depth;
+       sc->sc_ciu_div = esc->sc_conf->ciu_div;
        sc->sc_flags = esc->sc_conf->flags;
        sc->sc_pre_power_on = dwcmmc_fdt_pre_power_on;
        sc->sc_post_power_on = dwcmmc_fdt_post_power_on;
@@ -220,7 +221,7 @@
 dwcmmc_fdt_bus_clock(struct dwc_mmc_softc *sc, int rate)
 {
        struct dwcmmc_fdt_softc *esc = device_private(sc->sc_dev);
-        const u_int ciu_div = esc->sc_conf->ciu_div > 0 ? esc->sc_conf->ciu_div : 1;
+        const u_int ciu_div = sc->sc_ciu_div > 0 ? sc->sc_ciu_div : 1;
        int error;
 
        error = clk_set_rate(esc->sc_clk_ciu, 1000 * rate * ciu_div);
diff -r 3788890dc65f -r 577cdbfc9a1f sys/dev/ic/dwc_mmc.c
--- a/sys/dev/ic/dwc_mmc.c      Wed Jan 01 12:17:13 2020 +0000
+++ b/sys/dev/ic/dwc_mmc.c      Wed Jan 01 12:18:18 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_mmc.c,v 1.19 2020/01/01 11:21:15 jmcneill Exp $ */
+/* $NetBSD: dwc_mmc.c,v 1.20 2020/01/01 12:18:18 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014-2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dwc_mmc.c,v 1.19 2020/01/01 11:21:15 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc_mmc.c,v 1.20 2020/01/01 12:18:18 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -366,10 +366,12 @@
 dwc_mmc_set_clock(struct dwc_mmc_softc *sc, u_int freq)
 {
        const u_int pll_freq = sc->sc_clock_freq / 1000;
-       u_int clk_div;
+       u_int clk_div, ciu_div;
+
+       ciu_div = sc->sc_ciu_div > 0 ? sc->sc_ciu_div : 1;
 
        if (freq != pll_freq)
-               clk_div = howmany(pll_freq, freq);
+               clk_div = howmany(pll_freq, freq * ciu_div);
        else
                clk_div = 0;
 
diff -r 3788890dc65f -r 577cdbfc9a1f sys/dev/ic/dwc_mmc_var.h
--- a/sys/dev/ic/dwc_mmc_var.h  Wed Jan 01 12:17:13 2020 +0000
+++ b/sys/dev/ic/dwc_mmc_var.h  Wed Jan 01 12:18:18 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_mmc_var.h,v 1.10 2020/01/01 11:21:15 jmcneill Exp $ */
+/* $NetBSD: dwc_mmc_var.h,v 1.11 2020/01/01 12:18:18 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014-2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -52,6 +52,8 @@
        int sc_mmc_width;
        int sc_mmc_port;
 
+       u_int sc_ciu_div;
+
        device_t sc_sdmmc_dev;
 
        uint32_t sc_idma_xferlen;



Home | Main Index | Thread Index | Old Index