From 1614b67b7224e05d89f704adc5d038a26d286045 Mon Sep 17 00:00:00 2001 From: Anatolij Gustschin Date: Mon, 4 Feb 2013 11:16:02 +0100 Subject: [PATCH] --- yaml --- r: 356471 b: refs/heads/master c: edfcf33cabf29710f12a3bba4a7b3761a918e268 h: refs/heads/master i: 356469: 20017a82a3c58121ec6b4347cbe703a4677a3fa1 356467: 9ea914ffb8ab7892a7bdc9f43b0e5440a6c9d4d2 356463: 57701001f6b316ad73280b4395a0ae35d1e2ce3e v: v3 --- [refs] | 2 +- trunk/arch/powerpc/include/asm/mpc5121.h | 16 ++++++++++ .../powerpc/platforms/512x/mpc512x_shared.c | 30 +++++++++++++++++++ 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 1d726ef9c953..98ec868cc85c 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: b2639b5f1d01f218dc95537a1c352b3a551c4dd5 +refs/heads/master: edfcf33cabf29710f12a3bba4a7b3761a918e268 diff --git a/trunk/arch/powerpc/include/asm/mpc5121.h b/trunk/arch/powerpc/include/asm/mpc5121.h index 8c0ab2ca689c..8ae133eaf9fa 100644 --- a/trunk/arch/powerpc/include/asm/mpc5121.h +++ b/trunk/arch/powerpc/include/asm/mpc5121.h @@ -53,4 +53,20 @@ struct mpc512x_ccm { u32 m4ccr; /* MSCAN4 CCR */ u8 res[0x98]; /* Reserved */ }; + +/* + * LPC Module + */ +struct mpc512x_lpc { + u32 cs_cfg[8]; /* CS config */ + u32 cs_ctrl; /* CS Control Register */ + u32 cs_status; /* CS Status Register */ + u32 burst_ctrl; /* CS Burst Control Register */ + u32 deadcycle_ctrl; /* CS Deadcycle Control Register */ + u32 holdcycle_ctrl; /* CS Holdcycle Control Register */ + u32 alt; /* Address Latch Timing Register */ +}; + +int mpc512x_cs_config(unsigned int cs, u32 val); + #endif /* __ASM_POWERPC_MPC5121_H__ */ diff --git a/trunk/arch/powerpc/platforms/512x/mpc512x_shared.c b/trunk/arch/powerpc/platforms/512x/mpc512x_shared.c index c34443849d9a..824cbee68df2 100644 --- a/trunk/arch/powerpc/platforms/512x/mpc512x_shared.c +++ b/trunk/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);