aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-powerpc
diff options
context:
space:
mode:
authorLaurent Pinchart <laurentp@cse-semaphore.com>2008-07-22 12:00:43 -0400
committerKumar Gala <galak@kernel.crashing.org>2008-07-28 09:47:45 -0400
commitdddb8d311157d054da5441385f681b8cc0e5a94b (patch)
treee4a21e86291c011382f68fc063792c560d995f37 /include/asm-powerpc
parente517881e427757afc3cce6d76173b1d898b30ab3 (diff)
cpm2: Rework baud rate generators configuration to support external clocks.
The CPM2 BRG setup functions cpm_setbrg and cpm2_fastbrg don't support external clocks. This patch adds a new exported __cpm2_setbrg function that takes the clock rate and clock source as extra parameters, and moves cpm_setbrg and cpm2_fastbrg to include/asm-powerpc/cpm2.h where they become inline wrappers around __cpm2_setbrg. Signed-off-by: Laurent Pinchart <laurentp@cse-semaphore.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'include/asm-powerpc')
-rw-r--r--include/asm-powerpc/cpm2.h46
1 files changed, 33 insertions, 13 deletions
diff --git a/include/asm-powerpc/cpm2.h b/include/asm-powerpc/cpm2.h
index 2c7fd9cee291..2a6fa0183ac9 100644
--- a/include/asm-powerpc/cpm2.h
+++ b/include/asm-powerpc/cpm2.h
@@ -12,6 +12,7 @@
12 12
13#include <asm/immap_cpm2.h> 13#include <asm/immap_cpm2.h>
14#include <asm/cpm.h> 14#include <asm/cpm.h>
15#include <sysdev/fsl_soc.h>
15 16
16#ifdef CONFIG_PPC_85xx 17#ifdef CONFIG_PPC_85xx
17#define CPM_MAP_ADDR (get_immrbase() + 0x80000) 18#define CPM_MAP_ADDR (get_immrbase() + 0x80000)
@@ -93,10 +94,40 @@ extern cpm_cpm2_t __iomem *cpmp; /* Pointer to comm processor */
93#define cpm_dpfree cpm_muram_free 94#define cpm_dpfree cpm_muram_free
94#define cpm_dpram_addr cpm_muram_addr 95#define cpm_dpram_addr cpm_muram_addr
95 96
96extern void cpm_setbrg(uint brg, uint rate);
97extern void cpm2_fastbrg(uint brg, uint rate, int div16);
98extern void cpm2_reset(void); 97extern void cpm2_reset(void);
99 98
99/* Baud rate generators.
100*/
101#define CPM_BRG_RST ((uint)0x00020000)
102#define CPM_BRG_EN ((uint)0x00010000)
103#define CPM_BRG_EXTC_INT ((uint)0x00000000)
104#define CPM_BRG_EXTC_CLK3_9 ((uint)0x00004000)
105#define CPM_BRG_EXTC_CLK5_15 ((uint)0x00008000)
106#define CPM_BRG_ATB ((uint)0x00002000)
107#define CPM_BRG_CD_MASK ((uint)0x00001ffe)
108#define CPM_BRG_DIV16 ((uint)0x00000001)
109
110#define CPM2_BRG_INT_CLK (get_brgfreq())
111#define CPM2_BRG_UART_CLK (CPM2_BRG_INT_CLK/16)
112
113extern void __cpm2_setbrg(uint brg, uint rate, uint clk, int div16, int src);
114
115/* This function is used by UARTS, or anything else that uses a 16x
116 * oversampled clock.
117 */
118static inline void cpm_setbrg(uint brg, uint rate)
119{
120 __cpm2_setbrg(brg, rate, CPM2_BRG_UART_CLK, 0, CPM_BRG_EXTC_INT);
121}
122
123/* This function is used to set high speed synchronous baud rate
124 * clocks.
125 */
126static inline void cpm2_fastbrg(uint brg, uint rate, int div16)
127{
128 __cpm2_setbrg(brg, rate, CPM2_BRG_INT_CLK, div16, CPM_BRG_EXTC_INT);
129}
130
100/* Function code bits, usually generic to devices. 131/* Function code bits, usually generic to devices.
101*/ 132*/
102#define CPMFCR_GBL ((u_char)0x20) /* Set memory snooping */ 133#define CPMFCR_GBL ((u_char)0x20) /* Set memory snooping */
@@ -195,17 +226,6 @@ typedef struct smc_uart {
195#define SMCM_TX ((unsigned char)0x02) 226#define SMCM_TX ((unsigned char)0x02)
196#define SMCM_RX ((unsigned char)0x01) 227#define SMCM_RX ((unsigned char)0x01)
197 228
198/* Baud rate generators.
199*/
200#define CPM_BRG_RST ((uint)0x00020000)
201#define CPM_BRG_EN ((uint)0x00010000)
202#define CPM_BRG_EXTC_INT ((uint)0x00000000)
203#define CPM_BRG_EXTC_CLK3_9 ((uint)0x00004000)
204#define CPM_BRG_EXTC_CLK5_15 ((uint)0x00008000)
205#define CPM_BRG_ATB ((uint)0x00002000)
206#define CPM_BRG_CD_MASK ((uint)0x00001ffe)
207#define CPM_BRG_DIV16 ((uint)0x00000001)
208
209/* SCCs. 229/* SCCs.
210*/ 230*/
211#define SCC_GSMRH_IRP ((uint)0x00040000) 231#define SCC_GSMRH_IRP ((uint)0x00040000)