summaryrefslogtreecommitdiff
path: root/arch/arm/cpu
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2011-05-20 15:17:07 -0700
committerSimon Glass <sjg@chromium.org>2011-08-24 10:01:50 -0700
commit074d98d2650bf86c0360f5299f551a90fe6e7204 (patch)
tree7dbed4730076d9322814634243ba03eb4c9d7b19 /arch/arm/cpu
parent40e9147ccc3a8a8d841d044373a8e756534640bd (diff)
tegra2: Add PWFM support
This adds support for the PWFM which provides for generation of a selectable-frequency output with configurable duty cycle. BUG=chromium-os:13228 TEST=Build, boot on Seaboard Change-Id: Ic9e29fa9d4576e3cf70f5d67e5012158647c3fb5 Reviewed-on: http://gerrit.chromium.org/gerrit/1364 Tested-by: Simon Glass <sjg@chromium.org> Reviewed-by: Anton Staaf <robotboy@chromium.org>
Diffstat (limited to 'arch/arm/cpu')
-rw-r--r--arch/arm/cpu/armv7/tegra2/Makefile2
-rw-r--r--arch/arm/cpu/armv7/tegra2/pwfm.c37
2 files changed, 38 insertions, 1 deletions
diff --git a/arch/arm/cpu/armv7/tegra2/Makefile b/arch/arm/cpu/armv7/tegra2/Makefile
index 74919b11a17..e23b8e87bf2 100644
--- a/arch/arm/cpu/armv7/tegra2/Makefile
+++ b/arch/arm/cpu/armv7/tegra2/Makefile
@@ -33,7 +33,7 @@ include $(TOPDIR)/config.mk
LIB = $(obj)lib$(SOC).o
SOBJS := lowlevel_init.o
-COBJS := ap20.o board.o clock.o pinmux.o sys_info.o timer.o
+COBJS := ap20.o board.o clock.o pinmux.o pwfm.o sys_info.o timer.o
SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS))
diff --git a/arch/arm/cpu/armv7/tegra2/pwfm.c b/arch/arm/cpu/armv7/tegra2/pwfm.c
new file mode 100644
index 00000000000..1a37243fa47
--- /dev/null
+++ b/arch/arm/cpu/armv7/tegra2/pwfm.c
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2011 The Chromium OS Authors.
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+/* Tegra2 pulse width frequency modulator definitions */
+
+#include <asm/io.h>
+#include <asm/arch/bitfield.h>
+#include <asm/arch/pwfm.h>
+
+void pwfm_setup(struct pwfm_ctlr *pwfm, int enable, int pulse_width,
+ int freq_divider)
+{
+ u32 reg;
+
+ reg = bf_pack(PWFM_ENABLE, enable) |
+ bf_pack(PWFM_WIDTH, pulse_width) |
+ bf_pack(PWFM_DIVIDER, freq_divider);
+ writel(reg, &pwfm->control);
+}