summaryrefslogtreecommitdiff
path: root/src/soc/marvell/armada38x/clock.c
diff options
context:
space:
mode:
authorRuilin Hao <rlhao@marvell.com>2015-11-10 00:18:59 -0800
committerPatrick Georgi <pgeorgi@google.com>2016-02-04 11:31:45 +0100
commitde4defbaaf76a8bf7a705e3d1b265e1936cd7481 (patch)
tree8b1184e4496851be3a9a98d8a37527be4891bab9 /src/soc/marvell/armada38x/clock.c
parentc1b9e7934c0b100b8ce558669df8b57a03b2271f (diff)
soc/marvell/armada38x: Add i2c driver for armada38x
Port i2c driver from uboot to coreboot BUG=chrome-os-partner:47462 TEST=emerge-cyclone coreboot BRANCH=tot Change-Id: I8ce2a965acaed68ad0f0518648490ec471c6810b Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Original-Commit-Id: 4c2e9592662787ebed1d0aa8cafaa00fd12c2e9c Original-Change-Id: If791228edf29405fa4b2f959a21510bd7da9865b Original-Signed-off-by: Ruilin Hao <rlhao@marvell.com> Original-Reviewed-on: https://chromium-review.googlesource.com/313342 Original-Commit-Ready: Kan Yan <kyan@google.com> Original-Tested-by: Kan Yan <kyan@google.com> Original-Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-on: https://review.coreboot.org/13113 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/soc/marvell/armada38x/clock.c')
-rw-r--r--src/soc/marvell/armada38x/clock.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/soc/marvell/armada38x/clock.c b/src/soc/marvell/armada38x/clock.c
new file mode 100644
index 0000000000..579e1a3d2b
--- /dev/null
+++ b/src/soc/marvell/armada38x/clock.c
@@ -0,0 +1,35 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2015 Google 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 <soc/common.h>
+#include <soc/clock.h>
+
+uint32_t mv_tclk_get(void)
+{
+ uint32_t tclk_reg_value;
+ uint32_t tclk;
+
+ tclk_reg_value = (mrvl_reg_read(MPP_SAMPLE_AT_RESET));
+ tclk_reg_value = ((tclk_reg_value & (1 << 15)) >> 15);
+ switch (tclk_reg_value) {
+ case 0:
+ tclk = MV_BOARD_TCLK_250MHZ;
+ case 1:
+ tclk = MV_BOARD_TCLK_200MHZ;
+ default:
+ tclk = MV_BOARD_TCLK_250MHZ;
+ }
+ return tclk;
+}