[PATCH] Fixes for MPC512x PSC

2010-04-22 Thread Steve Deiters
This will apply on the mpc512x-v2.6.33-devel branch of the DENX git
repository.  This is all mostly based
on what was in the Freescale LTIB release from the Freescale website.

On a somewhat unrelated note, does anyone know if the Freescale LTIB
drivers have been merged into any newer
kernel versions?  In particular, I could not find a branch that has
drivers for the newer NAND Flash controller
that was in the LTIB version.


 In clock.c replaced clk_enable with mpc5121_clk_enable as clk_functions
is not yet set.
 Added initialization of the FIFO address and size registers based on
device tree.
 Removed port-number property from mpc5121ads device tree as the driver
doesn't use it.
 Made sure PSC clocks are enabled early for console.
 Made sure interrupt is requested with IRQF_SHARED as they share the
FIFO irq.
 Moved initialization of CSR to mpc52xx_uart_set_termios so it is done
for the MPC512x
 and also so it is done early in the console setup.

---
 arch/powerpc/boot/dts/mpc5121ads.dts |3 +-
 arch/powerpc/platforms/512x/clock.c  |2 +-
 arch/powerpc/platforms/512x/mpc5121_ads.c|1 +
 arch/powerpc/platforms/512x/mpc512x.h|1 +
 arch/powerpc/platforms/512x/mpc512x_shared.c |   80
++
 drivers/serial/mpc52xx_uart.c|7 +-
 6 files changed, 87 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/boot/dts/mpc5121ads.dts
b/arch/powerpc/boot/dts/mpc5121ads.dts
index d2b2db7..bdaf534 100644
--- a/arch/powerpc/boot/dts/mpc5121ads.dts
+++ b/arch/powerpc/boot/dts/mpc5121ads.dts
@@ -325,6 +325,7 @@
interrupt-parent = < &ipic >;
};
 
+   // UART port numbers are enumerated in the order they
occur
// 512x PSCs are not 52xx PSC compatible
// PSC3 serial port A aka ttyPSC0
ser...@11300 {
@@ -332,7 +333,6 @@
compatible = "fsl,mpc5121-psc-uart",
"fsl,mpc5121-psc";
// Logical port assignment needed until driver
// learns to use aliases
-   port-number = <0>;
cell-index = <3>;
reg = <0x11300 0x100>;
interrupts = <40 0x8>;
@@ -347,7 +347,6 @@
compatible = "fsl,mpc5121-psc-uart",
"fsl,mpc5121-psc";
// Logical port assignment needed until driver
// learns to use aliases
-   port-number = <1>;
cell-index = <4>;
reg = <0x11400 0x100>;
interrupts = <40 0x8>;
diff --git a/arch/powerpc/platforms/512x/clock.c
b/arch/powerpc/platforms/512x/clock.c
index 8733143..d32c83f 100644
--- a/arch/powerpc/platforms/512x/clock.c
+++ b/arch/powerpc/platforms/512x/clock.c
@@ -681,7 +681,7 @@ static void psc_clks_init(void)
psc_calc_rate(clk, pscnum, np);
sprintf(clk->name, "psc%d_mclk", pscnum);
clk_register(clk);
-   clk_enable(clk);
+   mpc5121_clk_enable(clk);
}
}
 }
diff --git a/arch/powerpc/platforms/512x/mpc5121_ads.c
b/arch/powerpc/platforms/512x/mpc5121_ads.c
index aa4d5a8..44a0a51 100644
--- a/arch/powerpc/platforms/512x/mpc5121_ads.c
+++ b/arch/powerpc/platforms/512x/mpc5121_ads.c
@@ -64,6 +64,7 @@ static int __init mpc5121_ads_probe(void)
 void __init mpc5121_ads_init_early(void)
 {
mpc512x_init_diu();
+   mpc5121_psc_early_init();
 }
 
 define_machine(mpc5121_ads) {
diff --git a/arch/powerpc/platforms/512x/mpc512x.h
b/arch/powerpc/platforms/512x/mpc512x.h
index 1cfe9d5..fb69e3f 100644
--- a/arch/powerpc/platforms/512x/mpc512x.h
+++ b/arch/powerpc/platforms/512x/mpc512x.h
@@ -21,3 +21,4 @@ extern void __init mpc512x_init_diu(void);
 extern void __init mpc512x_setup_diu(void);
 extern struct fsl_diu_shared_fb diu_shared_fb;
 #endif /* __MPC512X_H__ */
+extern void __init mpc5121_psc_early_init(void);
diff --git a/arch/powerpc/platforms/512x/mpc512x_shared.c
b/arch/powerpc/platforms/512x/mpc512x_shared.c
index 65b0a5d..1d74046 100644
--- a/arch/powerpc/platforms/512x/mpc512x_shared.c
+++ b/arch/powerpc/platforms/512x/mpc512x_shared.c
@@ -61,6 +61,86 @@ void mpc512x_restart(char *cmd)
;
 }
 
+#define DEFAULT_FIFO_SIZE 16
+
+static unsigned int get_fifo_size(struct device_node *np, int psc_num,
char *fifo_name)
+{
+   const unsigned int *fp;
+
+   fp = of_get_property(np, fifo_name, NULL);
+   if (fp) {
+   /* make sure has at least 1 byte */
+   return *fp ? *fp : 1;
+   }
+
+   printk(KERN_WARNING "no %s property for psc%d defaulting to
%d\n",
+   fifo_name, psc_num, DEFAULT_FIFO_SIZE);
+   return DEFAULT_FIFO_SIZE;
+}
+
+static void __init mpc5121_psc_lowlevel_clock_init(void)
+{

Re: [PATCH] Fixes for MPC512x PSC

2010-04-23 Thread Albrecht Dre�
Hi Steve:

A while ago I posted a patch which improves the baud rate calculation of the 
'5200, but also refactors the driver a little bit so it also influences the 
'512x.  However, there has been some confusion about the config regs of the 
521x's uart.  It would be great if you colud have a look at the patch 
<http://lists.ozlabs.org/pipermail/linuxppc-dev/2010-March/081477.html>, in 
particular function mpc512x_psc_set_baudrate(), and comment on it.  Some more 
infor is in the thread 
<http://lists.ozlabs.org/pipermail/linuxppc-dev/2010-March/080867.html>.

Thanks in advance,
Albrecht.


- Original Nachricht 
Von: Steve Deiters 
An:  linuxppc-dev@lists.ozlabs.org
Datum:   23.04.2010 02:13
Betreff: [PATCH] Fixes for MPC512x PSC

> This will apply on the mpc512x-v2.6.33-devel branch of the DENX git
> repository.  This is all mostly based
> on what was in the Freescale LTIB release from the Freescale website.
> 
> On a somewhat unrelated note, does anyone know if the Freescale LTIB
> drivers have been merged into any newer
> kernel versions?  In particular, I could not find a branch that has
> drivers for the newer NAND Flash controller
> that was in the LTIB version.
> 
> 
>  In clock.c replaced clk_enable with mpc5121_clk_enable as clk_functions
> is not yet set.
>  Added initialization of the FIFO address and size registers based on
> device tree.
>  Removed port-number property from mpc5121ads device tree as the driver
> doesn't use it.
>  Made sure PSC clocks are enabled early for console.
>  Made sure interrupt is requested with IRQF_SHARED as they share the
> FIFO irq.
>  Moved initialization of CSR to mpc52xx_uart_set_termios so it is done
> for the MPC512x
>  and also so it is done early in the console setup.

Traumziele - von Beschreibung bis Buchung jetzt kompakt auf den Reise-Seiten 
von Arcor.de! http://www.arcor.de/rd/footer.reise
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH] Fixes for MPC512x PSC

2010-04-23 Thread Anatolij Gustschin
On Thu, 22 Apr 2010 19:13:21 -0500
"Steve Deiters"  wrote:

> This will apply on the mpc512x-v2.6.33-devel branch of the DENX git
> repository.  This is all mostly based
> on what was in the Freescale LTIB release from the Freescale website.

Please don't use mpc512x-v2.6.33-devel branch, it is obsolete.
Fixes to serial PSC driver have been merged into mainline kernel,
so with v2.6.34-rc5 you do not need all this stuff your patch
addresses.

> On a somewhat unrelated note, does anyone know if the Freescale LTIB
> drivers have been merged into any newer
> kernel versions?  In particular, I could not find a branch that has
> drivers for the newer NAND Flash controller
> that was in the LTIB version.

Pull from mtd-2.6 tree [1] to get newer mpc512x NAND driver.

[1] http://git.infradead.org/mtd-2.6.git

Anatolij
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev