[coreboot-gerrit] New patch to review for coreboot: libpayload: mvmap2315: Introduce timer driver

hakim giydan (hgiydan@marvell.com) gerrit at coreboot.org
Thu Sep 22 00:55:17 CEST 2016


hakim giydan (hgiydan at marvell.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/16692

-gerrit

commit 8810812f6fd61fbaef8a6e51cb73def48f8b683f
Author: Hakim Giydan <hgiydan at marvell.com>
Date:   Wed Sep 21 15:50:39 2016 -0700

    libpayload: mvmap2315: Introduce timer driver
    
    Testing: booted successfully.
    
    Change-Id: I4a50c9fb7aec929ea29a3cf2eec3e424e3629c92
    Signed-off-by: Hakim Giydan <hgiydan at marvell.com>
---
 payloads/libpayload/drivers/Makefile.inc      |  1 +
 payloads/libpayload/drivers/timer/Kconfig     | 13 ++++++++++++
 payloads/libpayload/drivers/timer/mvmap2315.c | 30 +++++++++++++++++++++++++++
 3 files changed, 44 insertions(+)

diff --git a/payloads/libpayload/drivers/Makefile.inc b/payloads/libpayload/drivers/Makefile.inc
index 75f08f2..899c5d2 100644
--- a/payloads/libpayload/drivers/Makefile.inc
+++ b/payloads/libpayload/drivers/Makefile.inc
@@ -57,6 +57,7 @@ libc-$(CONFIG_LP_TIMER_BG4CD) += timer/bg4cd.c
 libc-$(CONFIG_LP_TIMER_IMG_PISTACHIO) += timer/img_pistachio.c
 libc-$(CONFIG_LP_TIMER_CYGNUS) += timer/cygnus.c
 libc-$(CONFIG_LP_TIMER_ARMADA38X) += timer/armada38x.c
+libc-$(CONFIG_LP_TIMER_MVMAP2315) += timer/mvmap2315.c
 
 # Video console drivers
 libc-$(CONFIG_LP_VIDEO_CONSOLE) += video/video.c
diff --git a/payloads/libpayload/drivers/timer/Kconfig b/payloads/libpayload/drivers/timer/Kconfig
index 0b981b0..b3ab6ec 100644
--- a/payloads/libpayload/drivers/timer/Kconfig
+++ b/payloads/libpayload/drivers/timer/Kconfig
@@ -61,6 +61,9 @@ config TIMER_IMG_PISTACHIO
 config TIMER_MTK
 	bool "Timer for MediaTek MT8173"
 
+config TIMER_MVMAP2315
+	bool "Timer for Marvell MVMAP2315"
+
 endchoice
 
 config TIMER_MCT_HZ
@@ -108,6 +111,16 @@ config ARMADA38X_TIMER_REG
         default 0xF1020314
         depends on TIMER_ARMADA38X
 
+config MVMAP2315_TIMER_FREQ
+	int "Hardware timer frequency"
+	depends on TIMER_MVMAP2315
+	default 1000000
+
+config MVMAP2315_TIMER_REG
+	hex "Timer register address"
+	depends on TIMER_MVMAP2315
+	default 0xE1020004
+
 config IPROC_PERIPH_GLB_TIM_REG_BASE
 	hex "Cygnus timer base address"
 	depends on TIMER_CYGNUS
diff --git a/payloads/libpayload/drivers/timer/mvmap2315.c b/payloads/libpayload/drivers/timer/mvmap2315.c
new file mode 100644
index 0000000..e288f52
--- /dev/null
+++ b/payloads/libpayload/drivers/timer/mvmap2315.c
@@ -0,0 +1,30 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2016 Marvell Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <assert.h>
+#include <libpayload.h>
+
+static u32 *reg = (void *)CONFIG_LP_MVMAP2315_TIMER_REG;
+
+uint64_t timer_hz(void)
+{
+	return CONFIG_LP_MVMAP2315_TIMER_FREQ;
+}
+
+uint64_t timer_raw_value(void)
+{
+	/* invert count to change from down to up count */
+	return ~readl(reg);
+}



More information about the coreboot-gerrit mailing list