diff options
Diffstat (limited to 'arch/powerpc/sysdev/cpm2.c')
-rw-r--r-- | arch/powerpc/sysdev/cpm2.c | 45 |
1 files changed, 15 insertions, 30 deletions
diff --git a/arch/powerpc/sysdev/cpm2.c b/arch/powerpc/sysdev/cpm2.c index 5a6c5dfc53ef..f1c3395633b9 100644 --- a/arch/powerpc/sysdev/cpm2.c +++ b/arch/powerpc/sysdev/cpm2.c | |||
@@ -115,16 +115,10 @@ EXPORT_SYMBOL(cpm_command); | |||
115 | * Baud rate clocks are zero-based in the driver code (as that maps | 115 | * Baud rate clocks are zero-based in the driver code (as that maps |
116 | * to port numbers). Documentation uses 1-based numbering. | 116 | * to port numbers). Documentation uses 1-based numbering. |
117 | */ | 117 | */ |
118 | #define BRG_INT_CLK (get_brgfreq()) | 118 | void __cpm2_setbrg(uint brg, uint rate, uint clk, int div16, int src) |
119 | #define BRG_UART_CLK (BRG_INT_CLK/16) | ||
120 | |||
121 | /* This function is used by UARTS, or anything else that uses a 16x | ||
122 | * oversampled clock. | ||
123 | */ | ||
124 | void | ||
125 | cpm_setbrg(uint brg, uint rate) | ||
126 | { | 119 | { |
127 | u32 __iomem *bp; | 120 | u32 __iomem *bp; |
121 | u32 val; | ||
128 | 122 | ||
129 | /* This is good enough to get SMCs running..... | 123 | /* This is good enough to get SMCs running..... |
130 | */ | 124 | */ |
@@ -135,34 +129,14 @@ cpm_setbrg(uint brg, uint rate) | |||
135 | brg -= 4; | 129 | brg -= 4; |
136 | } | 130 | } |
137 | bp += brg; | 131 | bp += brg; |
138 | out_be32(bp, (((BRG_UART_CLK / rate) - 1) << 1) | CPM_BRG_EN); | 132 | val = (((clk / rate) - 1) << 1) | CPM_BRG_EN | src; |
139 | |||
140 | cpm2_unmap(bp); | ||
141 | } | ||
142 | |||
143 | /* This function is used to set high speed synchronous baud rate | ||
144 | * clocks. | ||
145 | */ | ||
146 | void | ||
147 | cpm2_fastbrg(uint brg, uint rate, int div16) | ||
148 | { | ||
149 | u32 __iomem *bp; | ||
150 | u32 val; | ||
151 | |||
152 | if (brg < 4) { | ||
153 | bp = cpm2_map_size(im_brgc1, 16); | ||
154 | } else { | ||
155 | bp = cpm2_map_size(im_brgc5, 16); | ||
156 | brg -= 4; | ||
157 | } | ||
158 | bp += brg; | ||
159 | val = ((BRG_INT_CLK / rate) << 1) | CPM_BRG_EN; | ||
160 | if (div16) | 133 | if (div16) |
161 | val |= CPM_BRG_DIV16; | 134 | val |= CPM_BRG_DIV16; |
162 | 135 | ||
163 | out_be32(bp, val); | 136 | out_be32(bp, val); |
164 | cpm2_unmap(bp); | 137 | cpm2_unmap(bp); |
165 | } | 138 | } |
139 | EXPORT_SYMBOL(__cpm2_setbrg); | ||
166 | 140 | ||
167 | int cpm2_clk_setup(enum cpm_clk_target target, int clock, int mode) | 141 | int cpm2_clk_setup(enum cpm_clk_target target, int clock, int mode) |
168 | { | 142 | { |
@@ -377,3 +351,14 @@ void cpm2_set_pin(int port, int pin, int flags) | |||
377 | else | 351 | else |
378 | clrbits32(&iop[port].odr, pin); | 352 | clrbits32(&iop[port].odr, pin); |
379 | } | 353 | } |
354 | |||
355 | static int cpm_init_par_io(void) | ||
356 | { | ||
357 | struct device_node *np; | ||
358 | |||
359 | for_each_compatible_node(np, NULL, "fsl,cpm2-pario-bank") | ||
360 | cpm2_gpiochip_add32(np); | ||
361 | return 0; | ||
362 | } | ||
363 | arch_initcall(cpm_init_par_io); | ||
364 | |||