diff options
Diffstat (limited to 'arch/ppc/platforms/mpc8272ads_setup.c')
-rw-r--r-- | arch/ppc/platforms/mpc8272ads_setup.c | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/arch/ppc/platforms/mpc8272ads_setup.c b/arch/ppc/platforms/mpc8272ads_setup.c index bc9b94f77e39..e62b75707f7a 100644 --- a/arch/ppc/platforms/mpc8272ads_setup.c +++ b/arch/ppc/platforms/mpc8272ads_setup.c | |||
@@ -26,11 +26,35 @@ | |||
26 | #include <asm/irq.h> | 26 | #include <asm/irq.h> |
27 | #include <asm/ppc_sys.h> | 27 | #include <asm/ppc_sys.h> |
28 | #include <asm/ppcboot.h> | 28 | #include <asm/ppcboot.h> |
29 | #include <linux/fs_uart_pd.h> | ||
29 | 30 | ||
30 | #include "pq2ads_pd.h" | 31 | #include "pq2ads_pd.h" |
31 | 32 | ||
32 | static void init_fcc1_ioports(void); | 33 | static void init_fcc1_ioports(void); |
33 | static void init_fcc2_ioports(void); | 34 | static void init_fcc2_ioports(void); |
35 | static void init_scc1_uart_ioports(void); | ||
36 | static void init_scc4_uart_ioports(void); | ||
37 | |||
38 | static struct fs_uart_platform_info mpc8272_uart_pdata[] = { | ||
39 | [fsid_scc1_uart] = { | ||
40 | .init_ioports = init_scc1_uart_ioports, | ||
41 | .fs_no = fsid_scc1_uart, | ||
42 | .brg = 1, | ||
43 | .tx_num_fifo = 4, | ||
44 | .tx_buf_size = 32, | ||
45 | .rx_num_fifo = 4, | ||
46 | .rx_buf_size = 32, | ||
47 | }, | ||
48 | [fsid_scc4_uart] = { | ||
49 | .init_ioports = init_scc4_uart_ioports, | ||
50 | .fs_no = fsid_scc4_uart, | ||
51 | .brg = 4, | ||
52 | .tx_num_fifo = 4, | ||
53 | .tx_buf_size = 32, | ||
54 | .rx_num_fifo = 4, | ||
55 | .rx_buf_size = 32, | ||
56 | }, | ||
57 | }; | ||
34 | 58 | ||
35 | static struct fs_mii_bus_info mii_bus_info = { | 59 | static struct fs_mii_bus_info mii_bus_info = { |
36 | .method = fsmii_bitbang, | 60 | .method = fsmii_bitbang, |
@@ -201,6 +225,55 @@ static void __init mpc8272ads_fixup_enet_pdata(struct platform_device *pdev, | |||
201 | } | 225 | } |
202 | } | 226 | } |
203 | 227 | ||
228 | static void mpc8272ads_fixup_uart_pdata(struct platform_device *pdev, | ||
229 | int idx) | ||
230 | { | ||
231 | bd_t *bd = (bd_t *) __res; | ||
232 | struct fs_uart_platform_info *pinfo; | ||
233 | int num = ARRAY_SIZE(mpc8272_uart_pdata); | ||
234 | int id = fs_uart_id_scc2fsid(idx); | ||
235 | |||
236 | /* no need to alter anything if console */ | ||
237 | if ((id <= num) && (!pdev->dev.platform_data)) { | ||
238 | pinfo = &mpc8272_uart_pdata[id]; | ||
239 | pinfo->uart_clk = bd->bi_intfreq; | ||
240 | pdev->dev.platform_data = pinfo; | ||
241 | } | ||
242 | } | ||
243 | |||
244 | static void init_scc1_uart_ioports(void) | ||
245 | { | ||
246 | cpm2_map_t* immap = ioremap(CPM_MAP_ADDR, sizeof(cpm2_map_t)); | ||
247 | |||
248 | /* SCC1 is only on port D */ | ||
249 | setbits32(&immap->im_ioport.iop_ppard,0x00000003); | ||
250 | clrbits32(&immap->im_ioport.iop_psord,0x00000001); | ||
251 | setbits32(&immap->im_ioport.iop_psord,0x00000002); | ||
252 | clrbits32(&immap->im_ioport.iop_pdird,0x00000001); | ||
253 | setbits32(&immap->im_ioport.iop_pdird,0x00000002); | ||
254 | |||
255 | /* Wire BRG1 to SCC1 */ | ||
256 | clrbits32(&immap->im_cpmux.cmx_scr,0x00ffffff); | ||
257 | |||
258 | iounmap(immap); | ||
259 | } | ||
260 | |||
261 | static void init_scc4_uart_ioports(void) | ||
262 | { | ||
263 | cpm2_map_t* immap = ioremap(CPM_MAP_ADDR, sizeof(cpm2_map_t)); | ||
264 | |||
265 | setbits32(&immap->im_ioport.iop_ppard,0x00000600); | ||
266 | clrbits32(&immap->im_ioport.iop_psord,0x00000600); | ||
267 | clrbits32(&immap->im_ioport.iop_pdird,0x00000200); | ||
268 | setbits32(&immap->im_ioport.iop_pdird,0x00000400); | ||
269 | |||
270 | /* Wire BRG4 to SCC4 */ | ||
271 | clrbits32(&immap->im_cpmux.cmx_scr,0x000000ff); | ||
272 | setbits32(&immap->im_cpmux.cmx_scr,0x0000001b); | ||
273 | |||
274 | iounmap(immap); | ||
275 | } | ||
276 | |||
204 | static int mpc8272ads_platform_notify(struct device *dev) | 277 | static int mpc8272ads_platform_notify(struct device *dev) |
205 | { | 278 | { |
206 | static const struct platform_notify_dev_map dev_map[] = { | 279 | static const struct platform_notify_dev_map dev_map[] = { |
@@ -209,6 +282,10 @@ static int mpc8272ads_platform_notify(struct device *dev) | |||
209 | .rtn = mpc8272ads_fixup_enet_pdata | 282 | .rtn = mpc8272ads_fixup_enet_pdata |
210 | }, | 283 | }, |
211 | { | 284 | { |
285 | .bus_id = "fsl-cpm-scc:uart", | ||
286 | .rtn = mpc | ||
287 | }, | ||
288 | { | ||
212 | .bus_id = NULL | 289 | .bus_id = NULL |
213 | } | 290 | } |
214 | }; | 291 | }; |
@@ -230,7 +307,44 @@ int __init mpc8272ads_init(void) | |||
230 | ppc_sys_device_enable(MPC82xx_CPM_FCC1); | 307 | ppc_sys_device_enable(MPC82xx_CPM_FCC1); |
231 | ppc_sys_device_enable(MPC82xx_CPM_FCC2); | 308 | ppc_sys_device_enable(MPC82xx_CPM_FCC2); |
232 | 309 | ||
310 | /* to be ready for console, let's attach pdata here */ | ||
311 | #ifdef CONFIG_SERIAL_CPM_SCC1 | ||
312 | ppc_sys_device_setfunc(MPC82xx_CPM_SCC1, PPC_SYS_FUNC_UART); | ||
313 | ppc_sys_device_enable(MPC82xx_CPM_SCC1); | ||
314 | |||
315 | #endif | ||
316 | |||
317 | #ifdef CONFIG_SERIAL_CPM_SCC4 | ||
318 | ppc_sys_device_setfunc(MPC82xx_CPM_SCC4, PPC_SYS_FUNC_UART); | ||
319 | ppc_sys_device_enable(MPC82xx_CPM_SCC4); | ||
320 | #endif | ||
321 | |||
322 | |||
233 | return 0; | 323 | return 0; |
234 | } | 324 | } |
235 | 325 | ||
326 | /* | ||
327 | To prevent confusion, console selection is gross: | ||
328 | by 0 assumed SCC1 and by 1 assumed SCC4 | ||
329 | */ | ||
330 | struct platform_device* early_uart_get_pdev(int index) | ||
331 | { | ||
332 | bd_t *bd = (bd_t *) __res; | ||
333 | struct fs_uart_platform_info *pinfo; | ||
334 | |||
335 | struct platform_device* pdev = NULL; | ||
336 | if(index) { /*assume SCC4 here*/ | ||
337 | pdev = &ppc_sys_platform_devices[MPC82xx_CPM_SCC4]; | ||
338 | pinfo = &mpc8272<F12>_uart_pdata[1]; | ||
339 | } else { /*over SCC1*/ | ||
340 | pdev = &ppc_sys_platform_devices[MPC82xx_CPM_SCC1]; | ||
341 | pinfo = &mpc8272_uart_pdata[0]; | ||
342 | } | ||
343 | |||
344 | pinfo->uart_clk = bd->bi_intfreq; | ||
345 | pdev->dev.platform_data = pinfo; | ||
346 | ppc_sys_fixup_mem_resource(pdev, IMAP_ADDR); | ||
347 | return NULL; | ||
348 | } | ||
349 | |||
236 | arch_initcall(mpc8272ads_init); | 350 | arch_initcall(mpc8272ads_init); |