diff options
author | Anatolij Gustschin <agust@denx.de> | 2013-02-04 11:16:02 +0100 |
---|---|---|
committer | Anatolij Gustschin <agust@denx.de> | 2013-02-04 23:29:26 +0000 |
commit | edfcf33cabf29710f12a3bba4a7b3761a918e268 (patch) | |
tree | b9f679459510a074153e0ab63dbceb02f7860eb7 /arch/powerpc/platforms | |
parent | b2639b5f1d01f218dc95537a1c352b3a551c4dd5 (diff) | |
download | talos-obmc-linux-edfcf33cabf29710f12a3bba4a7b3761a918e268.tar.gz talos-obmc-linux-edfcf33cabf29710f12a3bba4a7b3761a918e268.zip |
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/platforms')
-rw-r--r-- | arch/powerpc/platforms/512x/mpc512x_shared.c | 30 |
1 files changed, 30 insertions, 0 deletions
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) mpc512x_restart_init(); mpc512x_psc_fifo_init(); } + +/** + * mpc512x_cs_config - Setup chip select configuration + * @cs: chip select number + * @val: chip select configuration value + * + * Perform chip select configuration for devices on LocalPlus Bus. + * Intended to dynamically reconfigure the chip select parameters + * for configurable devices on the bus. + */ +int mpc512x_cs_config(unsigned int cs, u32 val) +{ + static struct mpc512x_lpc __iomem *lpc; + struct device_node *np; + + if (cs > 7) + return -EINVAL; + + if (!lpc) { + np = of_find_compatible_node(NULL, NULL, "fsl,mpc5121-lpc"); + lpc = of_iomap(np, 0); + of_node_put(np); + if (!lpc) + return -ENOMEM; + } + + out_be32(&lpc->cs_cfg[cs], val); + return 0; +} +EXPORT_SYMBOL(mpc512x_cs_config); |