From: viresh.kumar@st.com (Viresh KUMAR)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 04/11] ST SPEAr: Added basic header files for SPEAr platform
Date: Wed, 3 Mar 2010 10:37:34 +0530 [thread overview]
Message-ID: <1267592861-26911-5-git-send-email-viresh.kumar@st.com> (raw)
In-Reply-To: <1267592861-26911-4-git-send-email-viresh.kumar@st.com>
Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
---
arch/arm/plat-spear/include/plat/gpt.h | 108 ++++++++++++++++++++++++++++++++
1 files changed, 108 insertions(+), 0 deletions(-)
create mode 100644 arch/arm/plat-spear/include/plat/gpt.h
diff --git a/arch/arm/plat-spear/include/plat/gpt.h b/arch/arm/plat-spear/include/plat/gpt.h
new file mode 100644
index 0000000..1ac6cf0
--- /dev/null
+++ b/arch/arm/plat-spear/include/plat/gpt.h
@@ -0,0 +1,108 @@
+/*
+ * arch/arm/plat-spear/include/plat/gpt.h
+ *
+ * SPEAr General Purpose Timers header file
+ *
+ * Copyright (C) 2010 ST Microelectronics
+ * shiraz hashim <shiraz.hashim@st.com>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#ifndef __ASM_PLAT_GPT_H
+#define __ASM_PLAT_GPT_H
+
+/* register offsets */
+#define GPT_CTRL_OFF 0x80 /* Control Register */
+#define GPT_INT_OFF 0x84 /* Interrupt Regiset */
+#define GPT_LOAD_OFF 0x88 /* Load Register */
+#define GPT_COUNT_OFF 0x8C /* Current Count Register */
+
+/* CTRL Reg Bit Values */
+#define GPT_CTRL_MATCH_INT 0x0100
+#define GPT_CTRL_ENABLE 0x0020
+#define GPT_CTRL_MODE_AR 0x0010
+
+#define GPT_CTRL_PRESCALER1 0x0
+#define GPT_CTRL_PRESCALER2 0x1
+#define GPT_CTRL_PRESCALER4 0x2
+#define GPT_CTRL_PRESCALER8 0x3
+#define GPT_CTRL_PRESCALER16 0x4
+#define GPT_CTRL_PRESCALER32 0x5
+#define GPT_CTRL_PRESCALER64 0x6
+#define GPT_CTRL_PRESCALER128 0x7
+#define GPT_CTRL_PRESCALER256 0x8
+
+/* INT Reg Bit Values */
+#define GPT_STATUS_MATCH 0x0001
+
+/* clock sources */
+#define SPEAR_TIMER_SRC_PLL3_CLK 0x00
+#define SPEAR_TIMER_SRC_SYS_CLK 0x01
+
+/**
+ * struct spear_timer - spear general purpose timer representation
+ * @id: timer identifier 0 onwards
+ * @phys_base: physical base address of timer
+ * @irq: irq to which this gpt is attached
+ * @prescaler: the prescaler for input freq at which timer is working
+ * @fclk: gpt functional clock
+ * @io_base: virtual base address of timer
+ * @reserved: indication that gpt is reserved now
+ * @enabled: indication that gpt is enabled
+ *
+ * The timer structure represent the timer channel available in SPEAr. Each
+ * timer unit in SPEAr contains two individual timer channels with different
+ * set of configuration registers * and irq. But the point to remember is
+ * this that the fclk is common for each channels withing a timer unit.
+ */
+
+struct spear_timer {
+ unsigned int id;
+ unsigned long phys_base;
+ int irq;
+ int prescaler;
+ struct clk *fclk;
+ void __iomem *io_base;
+ unsigned reserved:1;
+ unsigned enabled:1;
+};
+
+/*
+ * Following functions are exported by gpt.c which can be used by other
+ * kernel entities
+ */
+int spear_timer_init(struct spear_timer *, int);
+
+struct spear_timer *spear_timer_request(void);
+struct spear_timer *spear_timer_request_specific(int id);
+
+int spear_timer_free(struct spear_timer *timer);
+int spear_timer_enable(struct spear_timer *timer);
+int spear_timer_disable(struct spear_timer *timer);
+
+int spear_timer_get_irq(struct spear_timer *timer);
+
+struct clk *spear_timer_get_fclk(struct spear_timer *timer);
+
+int spear_timer_start(struct spear_timer *timer);
+int spear_timer_stop(struct spear_timer *timer);
+
+int spear_timer_set_source(struct spear_timer *timer, int source);
+int spear_timer_set_load(struct spear_timer *timer, int autoreload,
+ u16 value);
+int spear_timer_set_load_start(struct spear_timer *timer, int autoreload,
+ u16 value);
+int spear_timer_match_irq(struct spear_timer *timer, int enable);
+int spear_timer_set_prescaler(struct spear_timer *timer, int prescaler);
+
+int spear_timer_read_status(struct spear_timer *timer);
+int spear_timer_clear_status(struct spear_timer *timer, u16 value);
+
+int spear_timer_read_counter(struct spear_timer *timer);
+
+int spear_timer_active(struct spear_timer *);
+
+#endif /* __ASM_PLAT_GPT_H */
--
1.6.0.2
next prev parent reply other threads:[~2010-03-03 5:07 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-03 5:07 [PATCH 00/11] Adding Support for SPEAr Platform under ARM architecture Viresh KUMAR
2010-03-03 5:07 ` [PATCH 01/11] ST SPEAr: Added ARM PrimeXsys System Controller SP810 header file Viresh KUMAR
2010-03-03 5:07 ` [PATCH 02/11] ST SPEAr: Added basic header files for SPEAr3xx machine family Viresh KUMAR
2010-03-03 5:07 ` [PATCH 03/11] ST SPEAr: Added basic header files for SPEAr6xx " Viresh KUMAR
2010-03-03 5:07 ` Viresh KUMAR [this message]
2010-03-03 5:07 ` [PATCH 05/11] ST SPEAr: Added clock framework for SPEAr platform and machines Viresh KUMAR
2010-03-03 5:07 ` [PATCH 06/11] ST SPEAr: Added source files for SPEAr platform Viresh KUMAR
2010-03-03 5:07 ` [PATCH 07/11] ST SPEAr: Added source files for SPEAr3xx machine family Viresh KUMAR
2010-03-03 5:07 ` [PATCH 08/11] ST SPEAr: Added source files for SPEAr6xx " Viresh KUMAR
2010-03-03 5:07 ` [PATCH 09/11] ST SPEAr: Added support for SPEAr platform and machines in arch/arm/ Viresh KUMAR
2010-03-03 5:07 ` [PATCH 10/11] ST SPEAr: Added default configuration files for SPEAr machines Viresh KUMAR
2010-03-03 5:07 ` [PATCH 11/11] ST SPEAr: Updated Maintainers and added Documentation/arm/SPEAr Viresh KUMAR
2010-03-11 20:18 ` [PATCH 10/11] ST SPEAr: Added default configuration files for SPEAr machines Linus Walleij
2010-03-11 20:26 ` Russell King - ARM Linux
2010-03-12 4:12 ` Viresh KUMAR
2010-03-09 6:46 ` [PATCH 07/11] ST SPEAr: Added source files for SPEAr3xx machine family Linus Walleij
2010-03-09 7:05 ` Viresh KUMAR
2010-03-10 5:15 ` Linus Walleij
2010-03-10 6:10 ` viresh kumar
2010-03-11 10:41 ` Russell King - ARM Linux
2010-03-12 5:19 ` Viresh KUMAR
2010-03-11 11:22 ` [PATCH 06/11] ST SPEAr: Added source files for SPEAr platform Linus Walleij
2010-03-11 7:00 ` [PATCH 05/11] ST SPEAr: Added clock framework for SPEAr platform and machines Linus Walleij
2010-03-11 10:18 ` Shiraz HASHIM
2010-03-12 8:46 ` Linus Walleij
2010-03-12 4:19 ` Viresh KUMAR
2010-03-11 10:28 ` Russell King - ARM Linux
2010-03-12 4:22 ` Viresh KUMAR
2010-03-10 5:40 ` [PATCH 04/11] ST SPEAr: Added basic header files for SPEAr platform Linus Walleij
2010-03-10 6:32 ` Viresh KUMAR
2010-03-10 9:31 ` Linus Walleij
2010-03-10 10:11 ` Viresh KUMAR
2010-03-10 14:16 ` Paul Mundt
2010-03-10 16:36 ` Thomas Gleixner
2010-03-10 22:16 ` Tony Lindgren
2010-03-10 23:29 ` Paul Mundt
2010-03-10 23:42 ` Thomas Gleixner
2010-03-11 6:43 ` Linus Walleij
2010-03-11 9:47 ` Shiraz HASHIM
2010-03-11 11:26 ` Linus Walleij
2010-03-09 20:42 ` [PATCH 02/11] ST SPEAr: Added basic header files for SPEAr3xx machine family Linus Walleij
2010-03-10 6:01 ` Viresh KUMAR
2010-03-10 6:07 ` Linus Walleij
2010-03-11 10:33 ` Russell King - ARM Linux
2010-03-12 4:39 ` Viresh KUMAR
2010-03-09 20:14 ` [PATCH 01/11] ST SPEAr: Added ARM PrimeXsys System Controller SP810 header file Linus Walleij
2010-03-10 5:09 ` Viresh KUMAR
2010-03-11 10:45 ` Russell King - ARM Linux
2010-03-12 5:19 ` Viresh KUMAR
2010-03-07 15:54 ` [PATCH 00/11] Adding Support for SPEAr Platform under ARM architecture viresh kumar
2010-03-08 13:48 ` Armando VISCONTI
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1267592861-26911-5-git-send-email-viresh.kumar@st.com \
--to=viresh.kumar@st.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).