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 Add H6 support



details:   https://anonhg.NetBSD.org/src/rev/d40097a8f445
branches:  trunk
changeset: 359655:d40097a8f445
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Mon Feb 19 20:22:48 2018 +0000

description:
Add H6 support

diffstat:

 sys/arch/arm/sunxi/sunxi_emac.c |  22 ++++++++++++++++------
 sys/arch/arm/sunxi/sunxi_mmc.c  |  22 ++++++++++++++++++++--
 2 files changed, 36 insertions(+), 8 deletions(-)

diffs (110 lines):

diff -r 1d2c31cd4a68 -r d40097a8f445 sys/arch/arm/sunxi/sunxi_emac.c
--- a/sys/arch/arm/sunxi/sunxi_emac.c   Mon Feb 19 20:15:23 2018 +0000
+++ b/sys/arch/arm/sunxi/sunxi_emac.c   Mon Feb 19 20:22:48 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_emac.c,v 1.12 2017/12/22 13:39:57 jmcneill Exp $ */
+/* $NetBSD: sunxi_emac.c,v 1.13 2018/02/19 20:22:48 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2016-2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -33,7 +33,7 @@
 #include "opt_net_mpsafe.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sunxi_emac.c,v 1.12 2017/12/22 13:39:57 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_emac.c,v 1.13 2018/02/19 20:22:48 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -126,15 +126,17 @@
 static int sunxi_emac_pause_time = PAUSE_TIME_DEFAULT;
 
 enum sunxi_emac_type {
-       EMAC_A83T = 1,
+       EMAC_A64 = 1,
+       EMAC_A83T,
        EMAC_H3,
-       EMAC_A64,
+       EMAC_H6,
 };
 
 static const struct of_compat_data compat_data[] = {
        { "allwinner,sun8i-a83t-emac",  EMAC_A83T },
        { "allwinner,sun8i-h3-emac",    EMAC_H3 },
        { "allwinner,sun50i-a64-emac",  EMAC_A64 },
+       { "allwinner,sun50i-h6-emac",   EMAC_H6 },
        { NULL }
 };
 
@@ -933,11 +935,19 @@
        else
                reg |= EMAC_CLK_PIT_MII | EMAC_CLK_SRC_MII;
 
-       if (of_getprop_uint32(sc->phandle, "tx-delay", &tx_delay) == 0) {
+       if (of_getprop_uint32(sc->phandle, "allwinner,tx-delay-ps",
+           &tx_delay) == 0) {
+               reg &= ~EMAC_CLK_ETXDC;
+               reg |= ((tx_delay / 100) << EMAC_CLK_ETXDC_SHIFT);
+       } else if (of_getprop_uint32(sc->phandle, "tx-delay", &tx_delay) == 0) {
                reg &= ~EMAC_CLK_ETXDC;
                reg |= (tx_delay << EMAC_CLK_ETXDC_SHIFT);
        }
-       if (of_getprop_uint32(sc->phandle, "rx-delay", &rx_delay) == 0) {
+       if (of_getprop_uint32(sc->phandle, "allwinner,rx-delay-ps",
+           &rx_delay) == 0) {
+               reg &= ~EMAC_CLK_ERXDC;
+               reg |= ((rx_delay / 100) << EMAC_CLK_ERXDC_SHIFT);
+       } else if (of_getprop_uint32(sc->phandle, "rx-delay", &rx_delay) == 0) {
                reg &= ~EMAC_CLK_ERXDC;
                reg |= (rx_delay << EMAC_CLK_ERXDC_SHIFT);
        }
diff -r 1d2c31cd4a68 -r d40097a8f445 sys/arch/arm/sunxi/sunxi_mmc.c
--- a/sys/arch/arm/sunxi/sunxi_mmc.c    Mon Feb 19 20:15:23 2018 +0000
+++ b/sys/arch/arm/sunxi/sunxi_mmc.c    Mon Feb 19 20:22:48 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_mmc.c,v 1.19 2018/01/08 14:40:18 jakllsch Exp $ */
+/* $NetBSD: sunxi_mmc.c,v 1.20 2018/02/19 20:26:51 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014-2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
 #include "opt_sunximmc.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sunxi_mmc.c,v 1.19 2018/01/08 14:40:18 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_mmc.c,v 1.20 2018/02/19 20:26:51 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -252,6 +252,22 @@
        .flags = SUNXI_MMC_FLAG_CALIB_REG,
 };
 
+static const struct sunxi_mmc_config sun50i_h6_mmc_config = {
+       .idma_xferlen = 0x10000,
+       .dma_ftrglevel = 0x20070008,
+       .delays = NULL,
+       .flags = SUNXI_MMC_FLAG_CALIB_REG |
+                SUNXI_MMC_FLAG_NEW_TIMINGS |
+                SUNXI_MMC_FLAG_MASK_DATA0,
+};
+
+static const struct sunxi_mmc_config sun50i_h6_emmc_config = {
+       .idma_xferlen = 0x2000,
+       .dma_ftrglevel = 0x20070008,
+       .delays = NULL,
+       .flags = SUNXI_MMC_FLAG_CALIB_REG,
+};
+
 static const struct of_compat_data compat_data[] = {
        { "allwinner,sun4i-a10-mmc",    (uintptr_t)&sun4i_a10_mmc_config },
        { "allwinner,sun5i-a13-mmc",    (uintptr_t)&sun5i_a13_mmc_config },
@@ -260,6 +276,8 @@
        { "allwinner,sun9i-a80-mmc",    (uintptr_t)&sun9i_a80_mmc_config },
        { "allwinner,sun50i-a64-mmc",   (uintptr_t)&sun50i_a64_mmc_config },
        { "allwinner,sun50i-a64-emmc",  (uintptr_t)&sun50i_a64_emmc_config },
+       { "allwinner,sun50i-h6-mmc",    (uintptr_t)&sun50i_h6_mmc_config },
+       { "allwinner,sun50i-h6-emmc",   (uintptr_t)&sun50i_h6_emmc_config },
        { NULL }
 };
 



Home | Main Index | Thread Index | Old Index