aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorAnatolij Gustschin <agust@denx.de>2013-02-04 05:16:02 -0500
committerAnatolij Gustschin <agust@denx.de>2013-02-04 18:29:26 -0500
commitedfcf33cabf29710f12a3bba4a7b3761a918e268 (patch)
treeb9f679459510a074153e0ab63dbceb02f7860eb7 /arch/powerpc
parentb2639b5f1d01f218dc95537a1c352b3a551c4dd5 (diff)
powerpc/512x: add function for chip select parameter configuration
Add ability to configure chip select (CS) parameters for devices that need different CS parameters setup after their configuration. I.e. an FPGA device on LP bus can require different CS parameters for its bus interface after loading firmware into it. A driver can easily reconfigure the LPC CS parameters using this function. Acked-by: Timur Tabi <timur@tabi.org> Signed-off-by: Anatolij Gustschin <agust@denx.de>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/include/asm/mpc5121.h16
-rw-r--r--arch/powerpc/platforms/512x/mpc512x_shared.c30
2 files changed, 46 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/mpc5121.h b/arch/powerpc/include/asm/mpc5121.h
index 8c0ab2ca689c..8ae133eaf9fa 100644
--- a/arch/powerpc/include/asm/mpc5121.h
+++ b/arch/powerpc/include/asm/mpc5121.h
@@ -53,4 +53,20 @@ struct mpc512x_ccm {
53 u32 m4ccr; /* MSCAN4 CCR */ 53 u32 m4ccr; /* MSCAN4 CCR */
54 u8 res[0x98]; /* Reserved */ 54 u8 res[0x98]; /* Reserved */
55}; 55};
56
57/*
58 * LPC Module
59 */
60struct mpc512x_lpc {
61 u32 cs_cfg[8]; /* CS config */
62 u32 cs_ctrl; /* CS Control Register */
63 u32 cs_status; /* CS Status Register */
64 u32 burst_ctrl; /* CS Burst Control Register */
65 u32 deadcycle_ctrl; /* CS Deadcycle Control Register */
66 u32 holdcycle_ctrl; /* CS Holdcycle Control Register */
67 u32 alt; /* Address Latch Timing Register */
68};
69
70int mpc512x_cs_config(unsigned int cs, u32 val);
71
56#endif /* __ASM_POWERPC_MPC5121_H__ */ 72#endif /* __ASM_POWERPC_MPC5121_H__ */
diff --git a/arch/powerpc/platforms/512x/mpc512x_shared.c b/arch/powerpc/platforms/512x/mpc512x_shared.c
index c34443849d9a..824cbee68df2 100644
--- a/arch/powerpc/platforms/512x/mpc512x_shared.c
+++ b/arch/powerpc/platforms/512x/mpc512x_shared.c
@@ -436,3 +436,33 @@ void __init mpc512x_init(void)
436 mpc512x_restart_init(); 436 mpc512x_restart_init();
437 mpc512x_psc_fifo_init(); 437 mpc512x_psc_fifo_init();
438} 438}
439
440/**
441 * mpc512x_cs_config - Setup chip select configuration
442 * @cs: chip select number
443 * @val: chip select configuration value
444 *
445 * Perform chip select configuration for devices on LocalPlus Bus.
446 * Intended to dynamically reconfigure the chip select parameters
447 * for configurable devices on the bus.
448 */
449int mpc512x_cs_config(unsigned int cs, u32 val)
450{
451 static struct mpc512x_lpc __iomem *lpc;
452 struct device_node *np;
453
454 if (cs > 7)
455 return -EINVAL;
456
457 if (!lpc) {
458 np = of_find_compatible_node(NULL, NULL, "fsl,mpc5121-lpc");
459 lpc = of_iomap(np, 0);
460 of_node_put(np);
461 if (!lpc)
462 return -ENOMEM;
463 }
464
465 out_be32(&lpc->cs_cfg[cs], val);
466 return 0;
467}
468EXPORT_SYMBOL(mpc512x_cs_config);