Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/broadcom Add emmc2 clock goop from mlelstv@



details:   https://anonhg.NetBSD.org/src/rev/9945eafdaaf1
branches:  trunk
changeset: 967970:9945eafdaaf1
user:      skrll <skrll%NetBSD.org@localhost>
date:      Mon Dec 30 15:36:37 2019 +0000

description:
Add emmc2 clock goop from mlelstv@

diffstat:

 sys/arch/arm/broadcom/bcm2835_cprman.c   |   8 +++++-
 sys/arch/arm/broadcom/bcm2835var.h       |   3 +-
 sys/arch/arm/broadcom/bcm283x_platform.c |  33 ++++++++++++++++++++++++++++++-
 3 files changed, 39 insertions(+), 5 deletions(-)

diffs (134 lines):

diff -r 7e812bc845da -r 9945eafdaaf1 sys/arch/arm/broadcom/bcm2835_cprman.c
--- a/sys/arch/arm/broadcom/bcm2835_cprman.c    Mon Dec 30 15:31:15 2019 +0000
+++ b/sys/arch/arm/broadcom/bcm2835_cprman.c    Mon Dec 30 15:36:37 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bcm2835_cprman.c,v 1.3 2019/12/24 13:40:56 skrll Exp $ */
+/* $NetBSD: bcm2835_cprman.c,v 1.4 2019/12/30 15:36:37 skrll Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_cprman.c,v 1.3 2019/12/24 13:40:56 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_cprman.c,v 1.4 2019/12/30 15:36:37 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -56,6 +56,7 @@
        CPRMAN_CLOCK_PERIIMAGE = 29,
        CPRMAN_CLOCK_PWM = 30,
        CPRMAN_CLOCK_PCM = 31,
+       CPRMAN_CLOCK_EMMC2 = 51,
        CPRMAN_NCLOCK
 };
 
@@ -133,6 +134,8 @@
                return bcm283x_clk_get_rate_vpu();
        case CPRMAN_CLOCK_EMMC:
                return bcm283x_clk_get_rate_emmc();
+       case CPRMAN_CLOCK_EMMC2:
+               return bcm283x_clk_get_rate_emmc2();
        default:
                panic("unsupported clock id %d\n", clk->id);
        }
@@ -179,6 +182,7 @@
        cprman_add_clock(sc, CPRMAN_CLOCK_UART, "uart");
        cprman_add_clock(sc, CPRMAN_CLOCK_VPU, "vpu");
        cprman_add_clock(sc, CPRMAN_CLOCK_EMMC, "emmc");
+       cprman_add_clock(sc, CPRMAN_CLOCK_EMMC2, "emmc2");
 
        aprint_naive("\n");
        aprint_normal(": BCM283x Clock Controller\n");
diff -r 7e812bc845da -r 9945eafdaaf1 sys/arch/arm/broadcom/bcm2835var.h
--- a/sys/arch/arm/broadcom/bcm2835var.h        Mon Dec 30 15:31:15 2019 +0000
+++ b/sys/arch/arm/broadcom/bcm2835var.h        Mon Dec 30 15:36:37 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bcm2835var.h,v 1.4 2018/04/01 04:35:03 ryo Exp $       */
+/*     $NetBSD: bcm2835var.h,v 1.5 2019/12/30 15:36:37 skrll Exp $     */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -49,5 +49,6 @@
 u_int bcm283x_clk_get_rate_uart(void);
 u_int bcm283x_clk_get_rate_vpu(void);
 u_int bcm283x_clk_get_rate_emmc(void);
+u_int bcm283x_clk_get_rate_emmc2(void);
 
 #endif /* _ARM_BROADCOM_BCM2835_VAR_H_ */
diff -r 7e812bc845da -r 9945eafdaaf1 sys/arch/arm/broadcom/bcm283x_platform.c
--- a/sys/arch/arm/broadcom/bcm283x_platform.c  Mon Dec 30 15:31:15 2019 +0000
+++ b/sys/arch/arm/broadcom/bcm283x_platform.c  Mon Dec 30 15:36:37 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bcm283x_platform.c,v 1.28 2019/12/24 14:10:51 skrll Exp $      */
+/*     $NetBSD: bcm283x_platform.c,v 1.29 2019/12/30 15:36:37 skrll Exp $      */
 
 /*-
  * Copyright (c) 2017 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bcm283x_platform.c,v 1.28 2019/12/24 14:10:51 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm283x_platform.c,v 1.29 2019/12/30 15:36:37 skrll Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_bcm283x.h"
@@ -402,6 +402,7 @@
        struct vcprop_tag_clockrate     vbt_emmcclockrate;
        struct vcprop_tag_clockrate     vbt_armclockrate;
        struct vcprop_tag_clockrate     vbt_vpuclockrate;
+       struct vcprop_tag_clockrate     vbt_emmc2clockrate;
        struct vcprop_tag end;
 } vb __cacheline_aligned = {
        .vb_hdr = {
@@ -488,6 +489,14 @@
                },
                .id = VCPROP_CLK_CORE
        },
+       .vbt_emmc2clockrate = {
+               .tag = {
+                       .vpt_tag = VCPROPTAG_GET_CLOCKRATE,
+                       .vpt_len = VCPROPTAG_LEN(vb.vbt_emmc2clockrate),
+                       .vpt_rcode = VCPROPTAG_REQUEST
+               },
+               .id = VCPROP_CLK_EMMC2
+       },
        .end = {
                .vpt_tag = VCPROPTAG_NULL
        }
@@ -639,6 +648,17 @@
        return 0;
 }
 
+u_int
+bcm283x_clk_get_rate_emmc2(void)
+{
+
+       if (vcprop_tag_success_p(&vb.vbt_emmc2clockrate.tag) &&
+           vb.vbt_emmc2clockrate.rate > 0) {
+               return vb.vbt_emmc2clockrate.rate;
+       }
+       return 0;
+}
+
 
 
 static void
@@ -758,6 +778,15 @@
        if (vcprop_tag_success_p(&vb.vbt_armclockrate.tag))
                printf("%s: arm clock    %d\n", __func__,
                    vb.vbt_armclockrate.rate);
+       if (vcprop_tag_success_p(&vb.vbt_vpuclockrate.tag))
+               printf("%s: vpu clock    %d\n", __func__,
+                   vb.vbt_vpuclockrate.rate);
+       if (vcprop_tag_success_p(&vb.vbt_emmcclockrate.tag))
+               printf("%s: emmc clock   %d\n", __func__,
+                   vb.vbt_emmcclockrate.rate);
+       if (vcprop_tag_success_p(&vb.vbt_emmc2clockrate.tag))
+               printf("%s: emmc2 clock  %d\n", __func__,
+                   vb.vbt_emmcclockrate.rate);
        if (vcprop_tag_success_p(&vb.vbt_fwrev.tag))
                printf("%s: firmware rev %x\n", __func__,
                    vb.vbt_fwrev.rev);



Home | Main Index | Thread Index | Old Index