LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [POWERPC] 4xx: Remove "i2c" and "xxmii-interface" device_types from dts
From: Stefan Roese @ 2008-01-16  9:00 UTC (permalink / raw)
  To: linuxppc-dev

Remove all "i2c" and "xxmii-interface" (rgmii etc) device_type entries
from the 4xx dts files.

Signed-off-by: Stefan Roese <sr@denx.de>
---
 arch/powerpc/boot/dts/bamboo.dts  |    3 ---
 arch/powerpc/boot/dts/ebony.dts   |    2 --
 arch/powerpc/boot/dts/katmai.dts  |    2 --
 arch/powerpc/boot/dts/kilauea.dts |    3 ---
 arch/powerpc/boot/dts/makalu.dts  |    3 ---
 arch/powerpc/boot/dts/rainier.dts |    4 ----
 arch/powerpc/boot/dts/sequoia.dts |    4 ----
 arch/powerpc/boot/dts/taishan.dts |    4 ----
 8 files changed, 0 insertions(+), 25 deletions(-)

diff --git a/arch/powerpc/boot/dts/bamboo.dts b/arch/powerpc/boot/dts/bamboo.dts
index 29f1a6f..7dc37c9 100644
--- a/arch/powerpc/boot/dts/bamboo.dts
+++ b/arch/powerpc/boot/dts/bamboo.dts
@@ -185,7 +185,6 @@
 	   		};
 
 			IIC0: i2c@ef600700 {
-				device_type = "i2c";
 				compatible = "ibm,iic-440ep", "ibm,iic-440gp", "ibm,iic";
 				reg = <ef600700 14>;
 				interrupt-parent = <&UIC0>;
@@ -193,7 +192,6 @@
 			};
 
 			IIC1: i2c@ef600800 {
-				device_type = "i2c";
 				compatible = "ibm,iic-440ep", "ibm,iic-440gp", "ibm,iic";
 				reg = <ef600800 14>;
 				interrupt-parent = <&UIC0>;
@@ -201,7 +199,6 @@
 			};
 
 			ZMII0: emac-zmii@ef600d00 {
-				device_type = "zmii-interface";
 				compatible = "ibm,zmii-440ep", "ibm,zmii-440gp", "ibm,zmii";
 				reg = <ef600d00 c>;
 			};
diff --git a/arch/powerpc/boot/dts/ebony.dts b/arch/powerpc/boot/dts/ebony.dts
index f8790c4..106ef37 100644
--- a/arch/powerpc/boot/dts/ebony.dts
+++ b/arch/powerpc/boot/dts/ebony.dts
@@ -215,7 +215,6 @@
 
 			IIC0: i2c@40000400 {
 				/* FIXME */
-				device_type = "i2c";
 				compatible = "ibm,iic-440gp", "ibm,iic";
 				reg = <40000400 14>;
 				interrupt-parent = <&UIC0>;
@@ -223,7 +222,6 @@
 			};
 			IIC1: i2c@40000500 {
 				/* FIXME */
-				device_type = "i2c";
 				compatible = "ibm,iic-440gp", "ibm,iic";
 				reg = <40000500 14>;
 				interrupt-parent = <&UIC0>;
diff --git a/arch/powerpc/boot/dts/katmai.dts b/arch/powerpc/boot/dts/katmai.dts
index 9bdfc0f..bc32ac7 100644
--- a/arch/powerpc/boot/dts/katmai.dts
+++ b/arch/powerpc/boot/dts/katmai.dts
@@ -187,7 +187,6 @@
 	   		};
 
 			IIC0: i2c@10000400 {
-				device_type = "i2c";
 				compatible = "ibm,iic-440spe", "ibm,iic-440gp", "ibm,iic";
 				reg = <10000400 14>;
 				interrupt-parent = <&UIC0>;
@@ -195,7 +194,6 @@
 			};
 
 			IIC1: i2c@10000500 {
-				device_type = "i2c";
 				compatible = "ibm,iic-440spe", "ibm,iic-440gp", "ibm,iic";
 				reg = <10000500 14>;
 				interrupt-parent = <&UIC0>;
diff --git a/arch/powerpc/boot/dts/kilauea.dts b/arch/powerpc/boot/dts/kilauea.dts
index 67c7ea1..8baef61 100644
--- a/arch/powerpc/boot/dts/kilauea.dts
+++ b/arch/powerpc/boot/dts/kilauea.dts
@@ -182,7 +182,6 @@
 			};
 
 			IIC0: i2c@ef600400 {
-				device_type = "i2c";
 				compatible = "ibm,iic-405ex", "ibm,iic";
 				reg = <ef600400 14>;
 				interrupt-parent = <&UIC0>;
@@ -190,7 +189,6 @@
 			};
 
 			IIC1: i2c@ef600500 {
-				device_type = "i2c";
 				compatible = "ibm,iic-405ex", "ibm,iic";
 				reg = <ef600500 14>;
 				interrupt-parent = <&UIC0>;
@@ -199,7 +197,6 @@
 
 
 			RGMII0: emac-rgmii@ef600b00 {
-				device_type = "rgmii-interface";
 				compatible = "ibm,rgmii-405ex", "ibm,rgmii";
 				reg = <ef600b00 104>;
 				has-mdio;
diff --git a/arch/powerpc/boot/dts/makalu.dts b/arch/powerpc/boot/dts/makalu.dts
index bdd70e4..710c011 100644
--- a/arch/powerpc/boot/dts/makalu.dts
+++ b/arch/powerpc/boot/dts/makalu.dts
@@ -182,7 +182,6 @@
 			};
 
 			IIC0: i2c@ef600400 {
-				device_type = "i2c";
 				compatible = "ibm,iic-405ex", "ibm,iic";
 				reg = <ef600400 14>;
 				interrupt-parent = <&UIC0>;
@@ -190,7 +189,6 @@
 			};
 
 			IIC1: i2c@ef600500 {
-				device_type = "i2c";
 				compatible = "ibm,iic-405ex", "ibm,iic";
 				reg = <ef600500 14>;
 				interrupt-parent = <&UIC0>;
@@ -199,7 +197,6 @@
 
 
 			RGMII0: emac-rgmii@ef600b00 {
-				device_type = "rgmii-interface";
 				compatible = "ibm,rgmii-405ex", "ibm,rgmii";
 				reg = <ef600b00 104>;
 				has-mdio;
diff --git a/arch/powerpc/boot/dts/rainier.dts b/arch/powerpc/boot/dts/rainier.dts
index d3c2ac3..f947c75 100644
--- a/arch/powerpc/boot/dts/rainier.dts
+++ b/arch/powerpc/boot/dts/rainier.dts
@@ -229,7 +229,6 @@
 	   		};
 
 			IIC0: i2c@ef600700 {
-				device_type = "i2c";
 				compatible = "ibm,iic-440grx", "ibm,iic";
 				reg = <ef600700 14>;
 				interrupt-parent = <&UIC0>;
@@ -237,7 +236,6 @@
 			};
 
 			IIC1: i2c@ef600800 {
-				device_type = "i2c";
 				compatible = "ibm,iic-440grx", "ibm,iic";
 				reg = <ef600800 14>;
 				interrupt-parent = <&UIC0>;
@@ -245,13 +243,11 @@
 			};
 
 			ZMII0: emac-zmii@ef600d00 {
-				device_type = "zmii-interface";
 				compatible = "ibm,zmii-440grx", "ibm,zmii";
 				reg = <ef600d00 c>;
 			};
 
 			RGMII0: emac-rgmii@ef601000 {
-				device_type = "rgmii-interface";
 				compatible = "ibm,rgmii-440grx", "ibm,rgmii";
 				reg = <ef601000 8>;
 				has-mdio;
diff --git a/arch/powerpc/boot/dts/sequoia.dts b/arch/powerpc/boot/dts/sequoia.dts
index d9046c1..276f596 100644
--- a/arch/powerpc/boot/dts/sequoia.dts
+++ b/arch/powerpc/boot/dts/sequoia.dts
@@ -236,7 +236,6 @@
 	   		};
 
 			IIC0: i2c@ef600700 {
-				device_type = "i2c";
 				compatible = "ibm,iic-440epx", "ibm,iic";
 				reg = <ef600700 14>;
 				interrupt-parent = <&UIC0>;
@@ -244,7 +243,6 @@
 			};
 
 			IIC1: i2c@ef600800 {
-				device_type = "i2c";
 				compatible = "ibm,iic-440epx", "ibm,iic";
 				reg = <ef600800 14>;
 				interrupt-parent = <&UIC0>;
@@ -252,13 +250,11 @@
 			};
 
 			ZMII0: emac-zmii@ef600d00 {
-				device_type = "zmii-interface";
 				compatible = "ibm,zmii-440epx", "ibm,zmii";
 				reg = <ef600d00 c>;
 			};
 
 			RGMII0: emac-rgmii@ef601000 {
-				device_type = "rgmii-interface";
 				compatible = "ibm,rgmii-440epx", "ibm,rgmii";
 				reg = <ef601000 8>;
 				has-mdio;
diff --git a/arch/powerpc/boot/dts/taishan.dts b/arch/powerpc/boot/dts/taishan.dts
index 0706a4a..8278068 100644
--- a/arch/powerpc/boot/dts/taishan.dts
+++ b/arch/powerpc/boot/dts/taishan.dts
@@ -203,7 +203,6 @@
 
 			IIC0: i2c@40000400 {
 				/* FIXME */
-				device_type = "i2c";
 				compatible = "ibm,iic-440gp", "ibm,iic";
 				reg = <40000400 14>;
 				interrupt-parent = <&UIC0>;
@@ -211,7 +210,6 @@
 			};
 			IIC1: i2c@40000500 {
 				/* FIXME */
-				device_type = "i2c";
 				compatible = "ibm,iic-440gp", "ibm,iic";
 				reg = <40000500 14>;
 				interrupt-parent = <&UIC0>;
@@ -225,13 +223,11 @@
 			};
 
 			ZMII0: emac-zmii@40000780 {
-				device_type = "zgmii-interface";
 				compatible = "ibm,zmii-440gx", "ibm,zmii";
 				reg = <40000780 c>;
 			};
 
 			RGMII0: emac-rgmii@40000790 {
-				device_type = "rgmii-interface";
 				compatible = "ibm,rgmii";
 				reg = <40000790 8>;
 			};
-- 
1.5.4.rc3

^ permalink raw reply related

* PPC440SPe: generating PCIe INTx
From: kannappan @ 2008-01-16  8:46 UTC (permalink / raw)
  To: linuxppc-embedded

[-- Attachment #1: Type: text/plain, Size: 867 bytes --]

Hello All,
 
I would like to know how to generate PCIe INTx interrupt from Legacy
PCIe EP in PPC440SPe.
 
Also, please clarify,
Page 741 of the user manual (PPC440SPe_UM2014_V1_26.pdf) write
Assert_INTx message to INT_ADDR[61:63].
Page 739, table 27-9, mentions, Assert_INTA by writing to Outbound GBIF
write channel 9, A[52:59]=0x20.
 
Whether the INT_ADDR is any addresses BAR3 / POM3 address?
What is the Assert_INTx value to be written to INT_ADDR[61:63]?  How do
I correlate with the message code values given in PCI express system
architecture?
 
The message codes given in PCI express system architecture is as follows
 

INTx Messages
Message Code

Assert_INTA
0010 0000

Assert_INTB
0010 0001

Assert_INTC
0010 0010

Assert_INTD
0010 0011

Deassert_INTA
0010 0100

Deassert_INTB
0010 0101

Deassert_INTC
0010 0110

Deassert_INTD
0010 0111
 
 
Regards,
Kans.

[-- Attachment #2: Type: text/html, Size: 12516 bytes --]

^ permalink raw reply

* [PATCH] net: NEWEMAC: Remove "rgmii-interface" from rgmii matching table
From: Stefan Roese @ 2008-01-16  9:37 UTC (permalink / raw)
  To: linuxppc-dev, netdev

With the removal the the "rgmii-interface" device_type property from the
dts files, the newemac driver needs an update to only rely on compatible
property.

Signed-off-by: Stefan Roese <sr@denx.de>
---
 drivers/net/ibm_newemac/rgmii.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ibm_newemac/rgmii.c b/drivers/net/ibm_newemac/rgmii.c
index 9bc1132..5757788 100644
--- a/drivers/net/ibm_newemac/rgmii.c
+++ b/drivers/net/ibm_newemac/rgmii.c
@@ -302,7 +302,6 @@ static int __devexit rgmii_remove(struct of_device *ofdev)
 static struct of_device_id rgmii_match[] =
 {
 	{
-		.type		= "rgmii-interface",
 		.compatible	= "ibm,rgmii",
 	},
 	{
-- 
1.5.4.rc3

^ permalink raw reply related

* Re: [PATCH] net: NEWEMAC: Remove "rgmii-interface" from rgmii matching table
From: David Gibson @ 2008-01-16  9:39 UTC (permalink / raw)
  To: Stefan Roese; +Cc: linuxppc-dev, netdev
In-Reply-To: <1200476230-14026-1-git-send-email-sr@denx.de>

On Wed, Jan 16, 2008 at 10:37:10AM +0100, Stefan Roese wrote:
> With the removal the the "rgmii-interface" device_type property from the
> dts files, the newemac driver needs an update to only rely on compatible
> property.

In fact, this patch should go in before the one changing the dts
files.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

^ permalink raw reply

* Re: [PATCH] [POWERPC] 4xx: Remove "i2c" and "xxmii-interface" device_types from dts
From: David Gibson @ 2008-01-16  9:40 UTC (permalink / raw)
  To: Stefan Roese; +Cc: linuxppc-dev
In-Reply-To: <1200474000-5630-1-git-send-email-sr@denx.de>

On Wed, Jan 16, 2008 at 10:00:00AM +0100, Stefan Roese wrote:
> Remove all "i2c" and "xxmii-interface" (rgmii etc) device_type entries
> from the 4xx dts files.
> 
> Signed-off-by: Stefan Roese <sr@denx.de>

Acked-by: David Gibson <david@gibson.dropbear.id.au>

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

^ permalink raw reply

* Re: [PATCH] net: NEWEMAC: Remove "rgmii-interface" from rgmii matching table
From: Benjamin Herrenschmidt @ 2008-01-16  9:53 UTC (permalink / raw)
  To: Stefan Roese; +Cc: linuxppc-dev, netdev
In-Reply-To: <1200476230-14026-1-git-send-email-sr@denx.de>


On Wed, 2008-01-16 at 10:37 +0100, Stefan Roese wrote:
> With the removal the the "rgmii-interface" device_type property from the
> dts files, the newemac driver needs an update to only rely on compatible
> property.
> 
> Signed-off-by: Stefan Roese <sr@denx.de>

I need to test if it works on CAB, can't change the DT on those. I'll
let you know tomorrow.

> ---
>  drivers/net/ibm_newemac/rgmii.c |    1 -
>  1 files changed, 0 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/ibm_newemac/rgmii.c b/drivers/net/ibm_newemac/rgmii.c
> index 9bc1132..5757788 100644
> --- a/drivers/net/ibm_newemac/rgmii.c
> +++ b/drivers/net/ibm_newemac/rgmii.c
> @@ -302,7 +302,6 @@ static int __devexit rgmii_remove(struct of_device *ofdev)
>  static struct of_device_id rgmii_match[] =
>  {
>  	{
> -		.type		= "rgmii-interface",
>  		.compatible	= "ibm,rgmii",
>  	},
>  	{

^ permalink raw reply

* ppc: 4xx: sysctl table check failed: /kernel/l2cr .1.31 Missing strategy
From: Stefan Roese @ 2008-01-16 10:55 UTC (permalink / raw)
  To: linuxppc-dev, linux-kernel

I'm seeing this error message when booting an recent arch/ppc kernel on
4xx platforms (tested on Ocotea and other 4xx platforms). Booting NFS
rootfs still works fine, but this message kind of makes me "nervous".
This is not seen on 4xx arch/powerpc platforms. Here the bootlog:

Linux version 2.6.24-rc8 (stefan@ubuntu) (gcc version 4.2.2) #1 Wed Jan 16 11:51:57 CET 2008
IBM Ocotea port (MontaVista Software, Inc. <source@mvista.com>)
Zone PFN ranges:
  DMA             0 ->    65536
  Normal      65536 ->    65536
Movable zone start PFN for each node
early_node_map[1] active PFN ranges
    0:        0 ->    65536
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 65024
Kernel command line: root=/dev/nfs rw nfsroot=192.168.1.1:/opt/eldk-4.1/ppc_4xx ip=192.168.80.2:192.168.1.1::255.255.0.0:ocotea:eth0:off panic=1 console=ttyS0,115200
PID hash table entries: 1024 (order: 10, 4096 bytes)
console [ttyS0] enabled
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
Memory: 257536k available (1660k kernel code, 540k data, 104k init, 0k highmem)
SLUB: Genslabs=11, HWalign=32, Order=0-1, MinObjects=4, CPUs=1, Nodes=1
Mount-cache hash table entries: 512
net_namespace: 64 bytes
NET: Registered protocol family 16
PCI: Probing PCI hardware
NET: Registered protocol family 2
IP route cache hash table entries: 2048 (order: 1, 8192 bytes)
TCP established hash table entries: 8192 (order: 4, 65536 bytes)
TCP bind hash table entries: 8192 (order: 3, 32768 bytes)
TCP: Hash tables configured (established 8192 bind 8192)
TCP reno registered
sysctl table check failed: /kernel/l2cr .1.31 Missing strategy
Call Trace:
[cfc11df0] [c00082d0] show_stack+0x44/0x1ac (unreliable)
[cfc11e30] [c0034ffc] set_fail+0x50/0x68
[cfc11e50] [c0035428] sysctl_check_table+0x414/0x70c
[cfc11ec0] [c003543c] sysctl_check_table+0x428/0x70c
[cfc11f30] [c0021fe4] register_sysctl_table+0x64/0xb4
[cfc11f50] [c0213858] register_ppc_htab_sysctl+0x18/0x2c
[cfc11f60] [c02121f4] kernel_init+0xd0/0x2b0
[cfc11ff0] [c0003b3c] kernel_thread+0x44/0x60
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered (default)
...

Any ideas?

Thanks.

Best regards,
Stefan

^ permalink raw reply

* MPC52xx problems with fec-driver
From: Mehlan, Markus (Ritter Elektronik) @ 2008-01-16 12:20 UTC (permalink / raw)
  To: linuxppc-embedded

Hi,

i have a mpc5200b-based board with 2 ethernet interfaces,
Kernel 2.6.23.1-rt5 (arch=3Dpowerpc), last fec/bestcomm-patches:
eth0: mpc52xx_FEC
eth1: natsemi dp8381x

The natsemi driver works pretty, but the FEC makes problems:
If i ping the board i get damaged packages. The interrupt-counter
for the control-irq (mpc52xx-fec_ctrl) stays on zero.

The FEC interface works with an older kernel (2.6.14-rt22 arch=3Dppc).

Markus

root@phyCORE-MPC5200B-tiny:~ cat /proc/interrupts
           CPU0
 66:          5   MPC52xx IRQ[0-3]  Edge      eth1
132:       1368  MPC52xx Peripherals Edge      mpc52xx_psc_uart
133:          0  MPC52xx Peripherals Edge      mpc52xx-fec_ctrl
143:          2  MPC52xx Peripherals Edge      i2c-mpc
144:         60  MPC52xx Peripherals Edge      i2c-mpc
145:          0  MPC52xx Peripherals Edge      can0
146:          0  MPC52xx Peripherals Edge      can1
192:         32  MPC52xx SDMA Edge      mpc52xx-fec_rx
193:         35  MPC52xx SDMA Edge      mpc52xx-fec_tx
BAD:          0

ritter-ewc2:/home/meh # ping -a 192.168.0.9
PING 192.168.0.9 (192.168.0.9) 56(84) bytes of data.
64 bytes from 192.168.0.9: icmp_seq=3D3 ttl=3D64 time=3D0.267 ms
64 bytes from 192.168.0.9: icmp_seq=3D11 ttl=3D64 time=3D0.271 ms
64 bytes from 192.168.0.9: icmp_seq=3D17 ttl=3D64 time=3D0.266 ms
wrong data byte #20 should be 0x14 but was 0x0
#8      8 9 a b c d e f 10 11 12 13 0 15 16 17 18 19 1a 1b 1c 1d 1e 1f
20 21 22 23 24 25 26 27
#40     28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37

--- 192.168.0.9 ping statistics ---
19 packets transmitted, 3 received, 84% packet loss, time 18026ms

------------------------------------------------------------------
Using ritter_el392 machine description
Linux version 2.6.23.1-rt5-el392trunk (meh@ritter-ewc2) (gcc version
4.1.2) #445 PREEMPT RT Wed Jan 16 12:05:52 CET 2008
Found initrd at 0xc3a2e000:0xc3f47e63
Zone PFN ranges:
  DMA             0 ->    16384
  Normal      16384 ->    16384
Movable zone start PFN for each node
early_node_map[1] active PFN ranges
    0:        0 ->    16384
Real-Time Preemption Support (C) 2004-2007 Ingo Molnar
Built 1 zonelists in Zone order.  Total pages: 16256
Kernel command line: console=3DttyPSC0,115200 root=3D/dev/ram0 rw
ip=3D192.168.0.10:192.168.0.1::255.255.255.0:RITTER_EL392:eth1:off =
panic=3D1
WARNING: experimental RCU implementation.
MPC52xx PIC is up and running!
PID hash table entries: 256 (order: 8, 1024 bytes)
console [ttyPSC0] enabled
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 56972k/65536k available (2412k kernel code, 8500k reserved, 132k
data, 101k bss, 148k init)
Mount-cache hash table entries: 512
NET: Registered protocol family 16
PCI: Probing PCI hardware
DMA: MPC52xx BestComm driver
DMA: MPC52xx BestComm engine @f0001200 ok !
Generic PHY xxx: Registered new driver
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 4, 73728 bytes)
TCP bind hash table entries: 2048 (order: 3, 57344 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
checking if image is initramfs...it isn't (no cpio magic); looks like an
initrd
Freeing initrd memory: 5223k freed
io scheduler noop registered (default)
Serial: MPC52xx PSC UART driver
f0002c00.serial: ttyPSC0 at MMIO 0xf0002c00 (irq =3D 132) is a MPC52xx =
PSC
RAMDISK driver initialized: 2 RAM disks of 20480K size 1024 blocksize
mpc52xx-mscan initializing
mpc52xx-mscan mpc52xx-mscan.0: probe for a port 0xC500A900 done
mpc52xx-mscan mpc52xx-mscan.1: probe for a port 0xC500C980 done
mpc52xx MII bus: probed
natsemi dp8381x driver, version 2.1, Sept 11, 2006
  originally by Donald Becker <becker@scyld.com>
  2.4.x kernel port by Jeff Garzik, Tjeerd Mulder
PCI: Enabling device 0000:00:18.0 (0006 -> 0007)
natsemi eth1: NatSemi DP8381[56] at 0xa0000000 (0000:00:18.0),
00:0b:93:80:01:00, IRQ 66, port TP.
i2c /dev entries driver
pcf8563 1-0051: chip found, driver version 0.4.2
pcf8563 1-0051: rtc core: registered pcf8563 as rtc0
MPC52xx Watchdog Timer on GPT0
MPC52xx Watchdog-Relay on GPIO
Registered led device: el392:right
Registered led device: el392:middle
Registered led device: el392:left
EL392 Front-LEDs found
TCP cubic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
NET: Registered protocol family 15
can: controller area network core (rev 20070916 abi 8)
NET: Registered protocol family 29
can: raw protocol (rev 20070916)
pcf8563 1-0051: setting the system clock to 2008-01-16 12:06:42
(1200485202)
eth1: DSPCFG accepted after 0 usec.
eth1: link up.
eth1: Setting full-duplex based on negotiated link capability.
IP-Config: Complete:
      device=3Deth1, addr=3D192.168.0.10, mask=3D255.255.255.0,
gw=3D255.255.255.255,
     host=3DRITTER_EL392, domain=3D, nis-domain=3D(none),
     bootserver=3D192.168.0.1, rootserver=3D192.168.0.1, rootpath=3D
RAMDISK: Compressed image found at block 0
VFS: Mounted root (ext2 filesystem).
Freeing unused kernel memory: 148k init
mounting filesystems...done.
running rc.d services...
mounting... tmpfs at /dev
creating static nodes
creating initial udev device nodes...done
udev startup is finished
loading modules
syslogd starting
klogd starting
starting network interfaces...
can0: baudrate 250
can1: baudrate 250
net eth0: attached phy 0 to driver Generic PHY
PURE-FTPD: No /etc/pure-ftpd.defaults found.
/usr/sbin/pure-ftpd
PURE-FTPD: Starting pure-ftpd: /usr/sbin/pure-ftpd
PURE-FTPD: no upload script defined, skipping
Done
Starting telnetd...
thttpd:  starting
thttpd:  done
el392 login:=20
PHY: f0003000:00 - Link is Up - 100/Full
net eth0: attached phy 0 to driver Generic PHY

^ permalink raw reply

* Re: [PATCH] [POWERPC] 4xx: Remove "i2c" and "xxmii-interface" device_types from dts
From: Josh Boyer @ 2008-01-16 12:40 UTC (permalink / raw)
  To: Stefan Roese; +Cc: linuxppc-dev
In-Reply-To: <1200474000-5630-1-git-send-email-sr@denx.de>

On Wed, 16 Jan 2008 10:00:00 +0100
Stefan Roese <sr@denx.de> wrote:

> Remove all "i2c" and "xxmii-interface" (rgmii etc) device_type entries
> from the 4xx dts files.

Holding on this one until Ben or I can check Axon to see if it's DT can
handle no device_type for xxmii-interface.

josh

^ permalink raw reply

* Re: i2c device for a linux 2.6 in XUPV2P
From: greenlean @ 2008-01-16 12:43 UTC (permalink / raw)
  To: linuxppc-embedded
In-Reply-To: <ef1737dc0712241327t3cc7c14kcb91e9a4e550df18@mail.gmail.com>


Hi Josep,

I have read this post in linuxppc-embedded and you said that you're running
linux 2.6 in the XUPV2P. I'm beginning in this world (fpga and linux) and
nothing is running. I'm trying to boot kernel 2.6 on that board, but it is
resisting me. I have successfully booted it up on the ML403, but all my
attempts in the XUPV2P are crashing, maybe you could help me.

My problem is that I can't see anything in the minicom console when I
download the kernel. I build the kernel succesfully, using both UART IP
cores (UARTLite and UART16550) but in both cases there is no prompt in
minicom. I start with the TestApp generated by EDK and both MemTest and
PeripheralTest are running fine. But then when I do dow zImage, there is no
prompt.

I think I'm using correctly the drivers, when I use UARTLite I configure the
boud rate at arch/ppc/boot/common/ns16550.c and I configure the kernel with:
   * initial command string console=ttyUL0,<baudrate> 
   *  and in Device Drivers/Character Devices/Serial Drivers I choose Xilinx
uartlite serial port to include in the kernel and Support for console on
Xilinx UartLite serial port.

and when I use the UART16550 I configure it 
   * initial command string console=ttyS0,<baudrate> 
   *  and in Device Drivers/Character Devices/Serial Drivers I choose Xilinx
8250/16550 and compatible support and console on 8250/16550 and compatible
serial port

I think that's the correct configuration,I read it in this list and in some
application notes from Xilinx which isn't very well.

By the other side I'm overwriting the xparameter_ml300.h file of the kernel
with the one generated by EDK 9.1i SP2, I'm using only this file from the
bsp generated by EDK.

I'm using the kernel from xilinx git and I've tried the one from secretlab,
but not the same as you, I'm using the (linux-2.6-virtex). I don't know how
to download or change to the branch "virtex-for-2.6.24" that you're using
(I'm new to git too, some help will be welcome).

Thanks I really need some guide for the process. If you know about any patch
or which is the problem I'm suffering please tell me.


Josep Maria Batlle wrote:
> 
> Hi all,
> 
> I have booted up linux 2.6 on Xilinx XUPV2P (using the base of ml300
> config
> file).
> Now I am trying to use the i2c in the user-space. First of all: is it
> possible?
> 
> My first attempts have not worked. I have made this:
> 1) I enable "I2C Support" and "I2C device interface" in the kernel
> recompilation.
> 2) I added the "i2c-0" device in /dev (# mknod i2c-0 c 89 0)
> 3) then I run a simple program to open the device (provided by the
> "dev-interface" file of i2c kernel documentation) that returns this errno
> message: "No such device".
> 
> I have tried to use the device number 1, 2, 3, 4 but these have not
> worked.
> I have tried to use the device "i2cn" but not worked. I have tried to use
> all the BSP's from the EDK (7.1i) and then only the "xparameters_ml300.h"
> in
> the compilation. After all of this, now I am modifying the RFS for
> "mdev"...
> Somebody can tell me what I am doing wrong if this use is possible?
> 
> I use the kernel tree "virtex-for-2.6.24" from SecretLab and Busybox
> 1.7.2.
> 
> Thanks.
> 
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded
> 

-- 
View this message in context: http://www.nabble.com/i2c-device-for-a-linux-2.6-in-XUPV2P-tp14491409p14879785.html
Sent from the linuxppc-embedded mailing list archive at Nabble.com.

^ permalink raw reply

* Please pull from 'for-2.6.25' branch of 4xx tree
From: Josh Boyer @ 2008-01-16 12:49 UTC (permalink / raw)
  To: paulus, linuxppc-dev

Hi Paul,

Please pull from:

 master.kernel.org:/pub/scm/linux/kernel/git/jwboyer/powerpc-4xx.git for-2.6.25

to pick up a small number of changes for 2.6.25.  Mostly Xilinx stuff
from Stephen and Grant, with a couple of EMAC enables and a bug fix.

I'll likely send another pull request with some more patches from
Stefan and David, as well as the PIKA Warp platform patches.  But I
need to look at those a bit longer.

josh

Grant Likely (1):
      [POWERPC] 4xx: typo in calling machine_device_initcall() for Sequoia board

Hollis Blanchard (1):
      [POWERPC] 4xx: enable built-in networking for Sequoia defconfig

Josh Boyer (1):
      Merge branch 'virtex-for-2.6.25' of git://git.secretlab.ca/git/linux-2.6-v

Matthias Fuchs (1):
      [POWERPC] 4xx: Add 405GPr and 405EP support in boot wrapper

Stefan Roese (2):
      [POWERPC] 4xx: Add EMAC support to Kilauea defconfig
      [POWERPC] 4xx: PCIe: Increase max busses per port to 64

Stephen Neuendorffer (5):
      [POWERPC] Xilinx: update compatible list for interrupt controller
      [POWERPC] Xilinx: Add correct compatible list for device tree bus bindings
      [POWERPC] Xilinx: Update booting-without-of.
      [POWERPC] Xilinx: updated device tree compatibility to match uboot bsp gen
      [POWERPC] Xilinx uartlite: Section type fixups

 Documentation/powerpc/booting-without-of.txt |   56 +++++++++++-------
 arch/powerpc/boot/4xx.c                      |   81 +++++++++++++++++++++++--
 arch/powerpc/boot/4xx.h                      |    1 +
 arch/powerpc/boot/dcr.h                      |    5 ++
 arch/powerpc/boot/serial.c                   |    3 +-
 arch/powerpc/configs/bamboo_defconfig        |    4 +-
 arch/powerpc/configs/kilauea_defconfig       |   23 +++++++-
 arch/powerpc/configs/sequoia_defconfig       |   24 ++++++-
 arch/powerpc/platforms/40x/virtex.c          |   12 ++++-
 arch/powerpc/platforms/44x/sequoia.c         |    2 +-
 arch/powerpc/sysdev/ppc4xx_pci.c             |    2 +-
 arch/powerpc/sysdev/xilinx_intc.c            |    8 ++-
 drivers/serial/uartlite.c                    |    6 +-
 13 files changed, 180 insertions(+), 47 deletions(-)

^ permalink raw reply

* Re: [PATCH] [POWERPC] 4xx: Remove "i2c" and "xxmii-interface" device_types from dts
From: Stefan Roese @ 2008-01-16 13:01 UTC (permalink / raw)
  To: Josh Boyer; +Cc: linuxppc-dev
In-Reply-To: <20080116064008.390db210@zod.rchland.ibm.com>

Josh,

On Wednesday 16 January 2008, Josh Boyer wrote:
> > Remove all "i2c" and "xxmii-interface" (rgmii etc) device_type entries
> > from the 4xx dts files.
>
> Holding on this one until Ben or I can check Axon to see if it's DT can
> handle no device_type for xxmii-interface.

Best would be, if you would hold this patch at least until the newemac patch 
is pulled.

Best regards,
Stefan

^ permalink raw reply

* Re: [PATCH] [POWERPC] 4xx: Remove "i2c" and "xxmii-interface" device_types from dts
From: Josh Boyer @ 2008-01-16 13:08 UTC (permalink / raw)
  To: Stefan Roese; +Cc: linuxppc-dev
In-Reply-To: <200801161401.22855.sr@denx.de>

On Wed, 16 Jan 2008 14:01:22 +0100
Stefan Roese <sr@denx.de> wrote:

> Josh,
> 
> On Wednesday 16 January 2008, Josh Boyer wrote:
> > > Remove all "i2c" and "xxmii-interface" (rgmii etc) device_type entries
> > > from the 4xx dts files.
> >
> > Holding on this one until Ben or I can check Axon to see if it's DT can
> > handle no device_type for xxmii-interface.
> 
> Best would be, if you would hold this patch at least until the newemac patch 
> is pulled.

Sure, I was already planning on doing that anyway.  It's early, and
the Axon verification is really for that newemac patch anyway, not
this one :)

josh

^ permalink raw reply

* ml310 kernel2.6 booting problems
From: Joachim Meyer @ 2008-01-16 13:25 UTC (permalink / raw)
  To: linuxppc-embedded

Hi

I made an Ace file with my Kernel and load it with the Flash Card.
I made the Initial release CF image on the card and copied my ace file in an folder, from which I boot with the DIP-Switch.
If I used 
"console=ttyUL0 ,9600 root=/dev/xsysace/disc0/part2 rw "
in the Kernel config booting aborts like this:
----------------------------------------------------------------------------------------------------------------
....
[    5.715168] 000001c0: 00000000 00000000 00000000 00000000 ................
[    5.797484] 000001d0: 00000000 00000000 00000000 00000000 ................
[    5.879741] 000001e0: 00000000 00000000 00000000 00000000 ................
[    5.962057] 000001f0: 00000000 00000000 00000000 00000000 ................
[    6.044365] xsysace xsysace.0: capacity: 1000944 sectors
[    6.109986]  xsa:<7>xsysace xsysace.0: fsm_state=0, id_req_count=0
[    6.207902]  xsa1 xsa2
[    6.226842] Xilinx SystemACE device driver, major=254
[    6.281419] tun: Universal TUN/TAP device driver, 1.6
[    6.341706] tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com>
[    6.419485] mice: PS/2 mouse device common for all mice
[    6.478716] TCP cubic registered
[    6.516974] NET: Registered protocol family 1
[    6.568940] NET: Registered protocol family 17
[    6.627483] VFS: Cannot open root device "xsysace/disc0/part2" or unknown-block(0,0)
[    6.714743] Please append a correct "root=" boot option; here are the available partitions:
[    6.814732] fe00     500472 xsa (driver?)
[    6.862193]   fe01      98248 xsa1
[    6.902974]   fe02     402192 xsa2
[    6.943603] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[    7.042832] Rebooting in 180 seconds..
------------------------------------------------------------------------------------------------------------------------------------

I tried to use this:
"console=ttyUL0 ,9600 root=fe02 rw" 
and with this, after making ace-file etc. I get:
-------------------------------------------------------------------------------------------------------
...
[    5.447429] 00000190: 00000000 00000000 00000000 00000000 ................
[    5.529734] 000001a0: 00000000 00000000 00000000 00000000 ................
[    5.612002] 000001b0: 00000000 00000000 00000000 00000000 ................
[    5.694288] 000001c0: 00000000 00000000 00000000 00000000 ................
[    5.776594] 000001d0: 00000000 00000000 00000000 00000000 ................
[    5.858861] 000001e0: 00000000 00000000 00000000 00000000 ................
[    5.941167] 000001f0: 00000000 00000000 00000000 00000000 ................
[    6.023453] xsysace xsysace.0: capacity: 1000944 sectors
[    6.090042]  xsa:<7>xsysace xsysace.0: fsm_state=0, id_req_count=0
[    6.186832]  xsa1 xsa2
[    6.205880] Xilinx SystemACE device driver, major=254
[    6.260331] tun: Universal TUN/TAP device driver, 1.6
[    6.320626] tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com>
[    6.398443] mice: PS/2 mouse device common for all mice
[    6.457695] TCP cubic registered
[    6.495755] NET: Registered protocol family 1
[    6.547840] NET: Registered protocol family 17
[   12.726608] kjournald starting.  Commit interval 5 seconds
[   12.862678] EXT3 FS on xsa2, internal journal
[   12.899229] EXT3-fs: recovery complete.
[   12.982635] EXT3-fs: mounted filesystem with ordered data mode.
[   13.038505] VFS: Mounted root (ext3 filesystem).
[   13.094113] Freeing unused kernel memory: 96k init
[   13.159079] Warning: unable to open an initial console.
-------------------------------------------------------------------------------------------------

what is the Problem here?
What should I consider when I configure the kernel, what when building an rootfs?

Greetings
Joachim
_________________________________________________________________________
In 5 Schritten zur eigenen Homepage. Jetzt Domain sichern und gestalten! 
Nur 3,99 EUR/Monat! http://www.maildomain.web.de/?mc=021114

^ permalink raw reply

* Re: ml310 kernel2.6 booting problems
From: Grant Likely @ 2008-01-16 14:50 UTC (permalink / raw)
  To: Joachim Meyer; +Cc: linuxppc-embedded
In-Reply-To: <537566320@web.de>

On 1/16/08, Joachim Meyer <Jogi95@web.de> wrote:
> Hi
>
> I made an Ace file with my Kernel and load it with the Flash Card.
> I made the Initial release CF image on the card and copied my ace file in an folder, from which I boot with the DIP-Switch.
> If I used
> "console=ttyUL0 ,9600 root=/dev/xsysace/disc0/part2 rw "

try root=/dev/xsa2
Also, the ',9600' is unnecessary with the uartlite.

>
> I tried to use this:
> "console=ttyUL0 ,9600 root=fe02 rw"
> and with this, after making ace-file etc. I get:
> [   12.862678] EXT3 FS on xsa2, internal journal
> [   12.899229] EXT3-fs: recovery complete.
> [   12.982635] EXT3-fs: mounted filesystem with ordered data mode.
> [   13.038505] VFS: Mounted root (ext3 filesystem).
> [   13.094113] Freeing unused kernel memory: 96k init
> [   13.159079] Warning: unable to open an initial console.

You're probably missing the /dev/console device file

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply

* Re: [PATCH] net: NEWEMAC: Remove "rgmii-interface" from rgmii matching table
From: Josh Boyer @ 2008-01-16 15:01 UTC (permalink / raw)
  To: benh; +Cc: linuxppc-dev, Stefan Roese, netdev
In-Reply-To: <1200477239.6755.21.camel@pasglop>

On Wed, 16 Jan 2008 20:53:59 +1100
Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:

> 
> On Wed, 2008-01-16 at 10:37 +0100, Stefan Roese wrote:
> > With the removal the the "rgmii-interface" device_type property from the
> > dts files, the newemac driver needs an update to only rely on compatible
> > property.
> > 
> > Signed-off-by: Stefan Roese <sr@denx.de>
> 
> I need to test if it works on CAB, can't change the DT on those. I'll
> let you know tomorrow.

This should be fine on CAB.  The rgmii node has:

compatible = "ibm,rgmii-axon", "ibm,rgmii"

so the match should still catch on the latter.

josh

^ permalink raw reply

* Fixed phy
From: Rune Torgersen @ 2008-01-16 16:50 UTC (permalink / raw)
  To: linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 372 bytes --]


Hi
We're doing a port to 2.6.24-rc7, and we need to set up two ethernets with fixed phy's as they have phyless interfaces to a switch.
WE cannot find any good examples on how to do this. We've found the fixed speed PHY emulation in the configuration, but are unsure on how to set the PHY's up in the device tree.

This is using a 8280 cpu and ethernet on the FCC's

[-- Attachment #2: Type: text/html, Size: 748 bytes --]

^ permalink raw reply

* Re: ml310 kernel2.6 booting problems
From: Joachim Meyer @ 2008-01-16 20:02 UTC (permalink / raw)
  To: Grant Likely; +Cc: linuxppc-embedded

Thx for the answer

It's right, there is no /dev/console, but the MontaVista-Linux-kernel can =
fully boot with this rootFS, how comes=3F
Doesn't matter, I was going to make my own RootFS anyway, so can you give =
me an hint how I would
do this best=3F
I tried the Klingauf-Script (www.klingauf.com) with busybox, but I still h=
ave no console in my /dev/ and it doesn't work.
I tried out buildroot, but I was a little overstrained with the configurat=
ion and when I did "make" it aborted with an error message
after a long time of working
Then I tried ELDK. I read that I could use the Directory "<install-dir>/pp=
c=5F4xx/" as rootfs but when I go there and look inside=20
/dev I find only one entry:
prw------- 1 jogi jogi 0 2007-01-20 04:58 initctl
So this won't work, would it=3F

Which way would be the best for me to get an good RootFS easily=3F
If the answer would be buildroot can you give me a short summary which set=
tings are importent=3F
I read I can use my crosstool-Xcompiler, but I couldn't figure out how.=20

Greetings & Thx
Joachim

=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=

Erweitern Sie FreeMail zu einem noch leistungsst=E4rkeren E-Mail-Postfach!	=09
Mehr Infos unter http://produkte.web.de/club/=3Fmc=3D021131

^ permalink raw reply

* Re: ml310 kernel2.6 booting problems
From: Grant Likely @ 2008-01-16 20:30 UTC (permalink / raw)
  To: Joachim Meyer; +Cc: linuxppc-embedded
In-Reply-To: <538215286@web.de>

On 1/16/08, Joachim Meyer <Jogi95@web.de> wrote:
> Thx for the answer
>
> It's right, there is no /dev/console, but the MontaVista-Linux-kernel can fully boot with this rootFS, how comes?

hmmm, I don't know.  The montavista kernel might be running a
different binary as the init process.  Compare the kernel parameter
lines between the two.

> Doesn't matter, I was going to make my own RootFS anyway, so can you give me an hint how I would
> do this best?
> I tried the Klingauf-Script (www.klingauf.com) with busybox, but I still have no console in my /dev/ and it doesn't work.

Creating a console device is easy:

$ mknod /dev/console c 5 1

> I tried out buildroot, but I was a little overstrained with the configuration and when I did "make" it aborted with an error message
> after a long time of working
> Then I tried ELDK. I read that I could use the Directory "<install-dir>/ppc_4xx/" as rootfs but when I go there and look inside
> /dev I find only one entry:
> prw------- 1 jogi jogi 0 2007-01-20 04:58 initctl
> So this won't work, would it?

Looks like you haven't installed ELDK correctly.  I recommend
rereading the instructions and giving it another try.  ELDK is a great
starting point.

>
> Which way would be the best for me to get an good RootFS easily?
> If the answer would be buildroot can you give me a short summary which settings are importent?

Personally, I use buildroot, but you should start with ELDK to get things going.

Cheers,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply

* Re: [PATCH 3/4] powerpc: Katana750i - Add DTS file
From: Mark A. Greer @ 2008-01-16 20:48 UTC (permalink / raw)
  To: Mark A. Greer, linuxppc-dev
In-Reply-To: <20080116002228.GC4283@localhost.localdomain>

On Wed, Jan 16, 2008 at 11:22:28AM +1100, David Gibson wrote:
> On Tue, Jan 15, 2008 at 12:08:06PM -0700, Mark A. Greer wrote:
> > On Tue, Jan 15, 2008 at 10:34:06AM +1100, David Gibson wrote:
> > > On Mon, Jan 14, 2008 at 03:59:26PM -0700, Mark A. Greer wrote:
> > > > From: Mark A. Greer <mgreer@mvista.com>
> > 
> > Hi David.  Thanks for the review.
> > 
> > > > Add DTS file for the Emerson Katana 750i & 752i platforms.
> > > 
> > > [snip]
> > > > +/dts-v1/;
> > > > +
> > > > +/ {
> > > > +	#address-cells = <1>;
> > > > +	#size-cells = <1>;
> > > > +	model = "Katana-75xi";	/* Default */
> > > > +	compatible = "emerson,katana-750i";
> > > > +	coherency-off;
> > > 
> > > Where is this flag used from?
> > 
> > Its used in the bootwrapper if & when you use the mv64x60 code to setup
> > some of the windows to the I/O ctlrs.  This port does use that code
> > (because firmware doesn't do it properly) so I need the flag.
> 
> Hrm.. ok.  I'm just wondering if a new flag is really the right
> approach for this, or whether you should be basing the setup off the
> compatible property, either for the board or for the main bridge.

I'd prefer to keep the flag.  Otherwise, the bootwrapper will need a
table to look up the compatible field to see if coherency is supposed
to be on or off.  We'd have to add an entry to that table for any
compatible that need coherency off, etc.  A flag seems cleaner.

<snip>

> > > > +		flash@e8000000 {
> > > > +			#address-cells = <1>;
> > > > +			#size-cells = <1>;
> > > > +			compatible = "cfi-flash";
> > > > +			bank-width = <4>;
> > > > +			device-width = <2>;
> > > > +			reg = <0xe8000000 0x04000000>;
> > > > +			monitor@0 {
> > > > +				label = "Monitor";
> > > 
> > > If you're using the "label" property, it would be normal to name the
> > > nodes simply "partition@address".
> > 
> > I'm using the partition names that were used in the equivalent code
> > under arch/ppc.  I'm trying to keep things looking the same as they used
> > to as much as possible.  Besides, I don't see any others doing it that
> > way.
> 
> My point is that the partition code uses either "label" (if present)
> or the node name for the partition name.  If label properties are
> present, the node name is redundant information, so it seems more
> sensible to leave something generic there.

Ah, okay.  I'll do:
	partition@0 {
		label = "Monitor";
		reg = <0x00000000 0x00100000>;
	}
	partition@100000 {
		label = "Primary Kernel";
		reg = <0x00100000 0x00180000>;
	}
	...


> [snip]
> > > > +		CUNIT: cunit@f200 {
> > > 
> > > What is this device?  It needs some sort of "compatible" value.
> > 
> > Does it?  Its a separate block of regs but its only used in the mpsc
> > node--its never looked up on its own by kernel code.  Do all nodes need
> > "compatible" even when it'll never be used?  (Just want to know.)
> 
> Hrm.. if it's really just extra mpsc registers, should it be a
> seperate device, or just another range in the mpsc's "reg" property?

Okay, putting into the reg property makes sense.  Its values will be
put into both mpsc@xxx 'reg' properties since its share.  That doesn't
matter, correct? 

Also, would you mind letting it go thru as it is now and I'll make a
separate patch to change this dts, the prpmc2800.dts, and related code
afterwards?

> [snip]
> > > > +		mpp@f000 {
> > > > +			compatible = "marvell,mv64360-mpp";
> > > > +			reg = <0xf000 0x10>;
> > > > +		};
> > > > +
> > > > +		gpp@f100 {
> > > > +			compatible = "marvell,mv64360-gpp";
> > > > +			reg = <0xf100 0x20>;
> > > > +		};
> > > 
> > > What are these two devices?
> > 
> > mpp == multi-purpose pins
> > gpp == general purpose pins
> > 
> > They're really 2 separate reg blocks and are used for any number of
> > things including incoming PCI interrupts.  I'm not accessing them
> > currently so I can eliminate them in this dts.
> 
> Hrm.  The device tree should generally describe the hardware, even if
> Linux doesn't use it yet.  Are these basically some sort of GPIO
> interface?  If so you should look at the new GPIO binding which has
> been proposed.

I should take the time to read up on that but neither of these are used
by the katana so I'll get rid of them for now.  I can always put them
back.

> [snip] 
> > > > +	chosen {
> > > > +		bootargs = "ip=on";
> > > 
> > > The dts file should not include a "bootargs" value.  The wrapper will
> > > fill that in from the kernel config.
> > 
> > Actually, the kernel .config CONFIG_CMDLINE is only used by the kernel
> > when nothing is passed in from the bootwrapper.  The bootwrapper gets
> > the cmdline from either bootargs or from the __builtin_cmdline section.
> > 
> > I prefer to not rely on CONFIG_CMDLINE because it doesn't afford the
> > user a chance to edit or add to the cmdline when booting.  You can always
> > type in the whole thing at the "Linux/PowerPC load: " prompt but I'd rather
> > see what is going to be used and then edit it if I want to.  With
> > CONFIG_CMDLINE, it just gets used if nothing was passed in from the
> > bootwrapper.
> > 
> > That raises an issue that I've for time time (I've tried to get rid of
> > __builtin_cmdline before but was unsuccessful).
> > 
> > We currently have 3 possible sources for a default cmdline--seems like
> > at least one too many.
> 
> Yes :(.  I've looked at this before, though obviously I never got to
> figuring out what to do about it.
> 
> > IMHO we need a way to change the default cmdline in the field so
> > sysadmins can change it per board and not have to type it in every time
> > they boot.  /chosen/bootargs and __builtin_cmdline can both do that.
> > We don't need both, though.  And, since bootargs is specified by OF
> > and documented in booting-without-of.txt, can we finally get rid of
> > __builtin_cmdline?  I'd sure like to.
> > 
> > We can probably get rid of CONFIG_CMDLINE too since everyone uses DTs
> > now and they can have a /chosen/bootargs.  Anyone have a reason to keep
> > CONFIG_CMDLINE around?
> > 
> > Would you mind elaborating on why you are opposed to /chosen/bootargs?
> 
> Just because it's nasty for people to have to go in and change the dts
> just to change their default command line - which they might well want
> to do for things as simple as setting a default root device.

Yeah, but changing CONFIG_CMDLINE requires a kernel rebuild so
that's not great either.  Modifying __builtin_cmdline is probably the
easiest way to change things in the field (assuming you have a zImage)
but its also the least standard way of the three. :(

Mark

^ permalink raw reply

* Re: [PATCH] MTD for Taco
From: Sean MacLennan @ 2008-01-16 21:25 UTC (permalink / raw)
  Cc: linuxppc-dev, Stefan Roese
In-Reply-To: <478AEB39.70106@pikatech.com>

Sean MacLennan wrote:
> How about adding a config option that lets you specify 8 bit access? 
> Something like CONFIG_NDFC_8BIT_ACCESS. We could default it to no and 
> put a little blurb that says something like:
>
> On some platforms the 32bit read/writes cause a machine access 
> exception. If you get a machine access exception while reading the NAND 
> bad block table, try turning on 8 bit access.
>   
I know it would be better if 32 bit access just worked, but nobody 
actively objected to this idea, so here is a patch ;)

Cheers,
   Sean

Signed-off-by: Sean MacLennan <smaclennan@pikatech.com>
---
diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
index 246d451..2809ded 100644
--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -153,11 +153,21 @@ config MTD_NAND_S3C2410_HWECC
 
 config MTD_NAND_NDFC
 	tristate "NDFC NanD Flash Controller"
-	depends on 4xx && !PPC_MERGE
+	depends on 4xx
 	select MTD_NAND_ECC_SMC
 	help
 	 NDFC Nand Flash Controllers are integrated in IBM/AMCC's 4xx SoCs
 
+config NDFC_8BIT_ACCESS
+	bool "NDFC 8-bit access only"
+	depends on MTD_NAND_NDFC
+	default n
+	help
+	 The NDFC supports 32 bit read/writes to the NAND to improve
+	 performance. On some platforms this does not work. If you get
+	 a machine access exception while reading the bad block table,
+	 try setting this to Y.
+
 config MTD_NAND_S3C2410_CLKSTOP
 	bool "S3C2410 NAND IDLE clock stop"
 	depends on MTD_NAND_S3C2410
diff --git a/drivers/mtd/nand/ndfc.c b/drivers/mtd/nand/ndfc.c
index 1c0e89f..ac06099 100644
--- a/drivers/mtd/nand/ndfc.c
+++ b/drivers/mtd/nand/ndfc.c
@@ -24,11 +24,13 @@
 #include <linux/platform_device.h>
 
 #include <asm/io.h>
+#ifndef CONFIG_PPC_MERGE
 #ifdef CONFIG_40x
 #include <asm/ibm405.h>
 #else
 #include <asm/ibm44x.h>
 #endif
+#endif
 
 struct ndfc_nand_mtd {
 	struct mtd_info			mtd;
@@ -110,6 +112,37 @@ static int ndfc_calculate_ecc(struct mtd_info *mtd,
 	return 0;
 }
 
+#ifdef CONFIG_NDFC_8BIT_ACCESS
+static void ndfc_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
+{
+	struct ndfc_controller *ndfc = &ndfc_ctrl;
+	uint8_t *p = (uint8_t *) buf;
+
+	for (; len > 0; len--)
+		*p++ = __raw_readb(ndfc->ndfcbase + NDFC_DATA);
+}
+
+static void ndfc_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
+{
+	struct ndfc_controller *ndfc = &ndfc_ctrl;
+	uint8_t *p = (uint8_t *) buf;
+
+	for (; len > 0; len--)
+		__raw_writeb(*p++, ndfc->ndfcbase + NDFC_DATA);
+}
+
+static int ndfc_verify_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
+{
+	struct ndfc_controller *ndfc = &ndfc_ctrl;
+	uint8_t *p = (uint8_t *) buf;
+
+	for (; len > 0; len--)
+		if (*p++ != __raw_readb(ndfc->ndfcbase + NDFC_DATA))
+			return -EFAULT;
+
+	return 0;
+}
+#else
 /*
  * Speedups for buffer read/write/verify
  *
@@ -145,6 +178,7 @@ static int ndfc_verify_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
 			return -EFAULT;
 	return 0;
 }
+#endif
 
 /*
  * Initialize chip structure
@@ -236,6 +270,8 @@ static int ndfc_nand_probe(struct platform_device *pdev)
 
 #ifndef CONFIG_PHYS_64BIT
 	ndfc->ndfcbase = ioremap((phys_addr_t)phys, res->end - res->start + 1);
+#elif defined(CONFIG_PPC_MERGE)
+	ndfc->ndfcbase = ioremap(phys, res->end - res->start + 1);
 #else
 	ndfc->ndfcbase = ioremap64(phys, res->end - res->start + 1);
 #endif

^ permalink raw reply related

* [Add mpc5121 support PATCH v2 4/8] Device tree for MPC5121 ADS
From: John Rigby @ 2008-01-16 21:37 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <1200519447-25555-3-git-send-email-jrigby@freescale.com>

Minimal tree for mpc5121 ads.

Signed-off-by: John Rigby <jrigby@freescale.com>
---
 arch/powerpc/boot/dts/mpc5121ads.dts |  116 ++++++++++++++++++++++++++++++++++
 1 files changed, 116 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/boot/dts/mpc5121ads.dts

diff --git a/arch/powerpc/boot/dts/mpc5121ads.dts b/arch/powerpc/boot/dts/mpc5121ads.dts
new file mode 100644
index 0000000..fac1f15
--- /dev/null
+++ b/arch/powerpc/boot/dts/mpc5121ads.dts
@@ -0,0 +1,116 @@
+/*
+ * MPC5121E MDS Device Tree Source
+ *
+ * Copyright 2007 Freescale Semiconductor Inc.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+/ {
+	model = "MPC5121ADS";
+	compatible = "fsl,mpc5121ads";
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		PowerPC,5121@0 {
+			device_type = "cpu";
+			reg = <0>;
+			d-cache-line-size = <20>;	// 32 bytes
+			i-cache-line-size = <20>;	// 32 bytes
+			d-cache-size = <8000>;		// L1, 32K
+			i-cache-size = <8000>;		// L1, 32K
+			timebase-frequency = <d#49500000>; // 49.5 MHz (csb/4)
+			bus-frequency = <d#198000000>;	// 198 MHz csb bus
+			clock-frequency = <d#396000000>;// 396 MHz ppc core
+		};
+	};
+
+	memory {
+		device_type = "memory";
+		reg = <00000000 10000000>;	// 256MB at 0
+	};
+
+	localbus@80000020 {
+		compatible = "fsl,mpc5121ads_localbus";
+		#address-cells = <2>;
+		#size-cells = <1>;
+		reg = <80000020 40>;
+
+		ranges = <0 0 fc000000 04000000
+			  2 0 82000000 00008000>;
+
+		flash@0,0 {
+			compatible = "cfi-flash";
+			reg = <0 0 4000000>;
+			bank-width = <4>;
+			device-width = <1>;
+		};
+
+		board-control@2,0 {
+			compatible = "fsl,mpc5121ads-cpld";
+			reg = <2 0 8000>;
+		};
+	};
+
+	soc@80000000 {
+		compatible = "fsl,mpc5121-immr";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		#interrupt-cells = <2>;
+		ranges = <0 80000000 400000>;
+		reg = <80000000 400000>;
+		bus-frequency = <d#66000000>;	// 66 MHz ips bus
+
+
+		// IPIC
+		// interrupts cell = <intr #, sense>
+		// sense values match linux IORESOURCE_IRQ_* defines:
+		// sense == 8: Level, low assertion
+		// sense == 2: Edge, high-to-low change
+		//
+		ipic: interrupt-controller@c00 {
+			compatible = "fsl,ipic";
+			interrupt-controller;
+			#address-cells = <0>;
+			#interrupt-cells = <2>;
+			reg = <c00 100>;
+		};
+
+		// 512x PSCs are not 52xx PSCs compatible
+		// PSC3 serial port A aka ttyPSC0
+		serial@11300 {
+			device_type = "serial";
+			compatible = "fsl,mpc5121-psc-uart";
+			port-number = <0>;  // Logical port assignment
+			cell-index = <3>;
+			reg = <11300 100>;
+			interrupts = <28 8>; // actually the fifo irq
+			interrupt-parent = < &ipic >;
+		};
+
+		// PSC4 serial port B aka ttyPSC1
+		serial@11400 {
+			device_type = "serial";
+			compatible = "fsl,mpc5121-psc-uart";
+			port-number = <1>;  // Logical port assignment
+			cell-index = <4>;
+			reg = <11400 100>;
+			interrupts = <28 8>; // actually the fifo irq
+			interrupt-parent = < &ipic >;
+		};
+
+		pscsfifo@11f00 {
+			compatible = "fsl,mpc512x-psc-fifo";
+			reg = <11f00 100>;
+			interrupts = <28 8>;
+			interrupt-parent = < &ipic >;
+		};
+	};
+};
-- 
1.5.3.5.726.g41a7a

^ permalink raw reply related

* [Add mpc5121 support PATCH v2 8/8] Add MPC512x support to MPC52xx psc driver
From: John Rigby @ 2008-01-16 21:37 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <1200519447-25555-7-git-send-email-jrigby@freescale.com>

Add 512x support using the psc_ops framework established
with the previous patch.

Signed-off-by: John Rigby <jrigby@freescale.com>
---
 drivers/serial/Kconfig            |   12 ++--
 drivers/serial/mpc52xx_uart.c     |  174 +++++++++++++++++++++++++++++++++++--
 include/asm-powerpc/mpc52xx_psc.h |   48 ++++++++++
 3 files changed, 220 insertions(+), 14 deletions(-)

diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index d7e1996..c7a4ba9 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -1114,17 +1114,17 @@ config SERIAL_SGI_L1_CONSOLE
 		say Y.  Otherwise, say N.
 
 config SERIAL_MPC52xx
-	tristate "Freescale MPC52xx family PSC serial support"
-	depends on PPC_MPC52xx
+	tristate "Freescale MPC52xx/MPC512x family PSC serial support"
+	depends on PPC_MPC52xx || PPC_MPC512x
 	select SERIAL_CORE
 	help
-	  This drivers support the MPC52xx PSC serial ports. If you would
-	  like to use them, you must answer Y or M to this option. Not that
+	  This driver supports MPC52xx and MPC512x PSC serial ports. If you would
+	  like to use them, you must answer Y or M to this option. Note that
 	  for use as console, it must be included in kernel and not as a
 	  module.
 
 config SERIAL_MPC52xx_CONSOLE
-	bool "Console on a Freescale MPC52xx family PSC serial port"
+	bool "Console on a Freescale MPC52xx/MPC512x family PSC serial port"
 	depends on SERIAL_MPC52xx=y
 	select SERIAL_CORE_CONSOLE
 	help
@@ -1132,7 +1132,7 @@ config SERIAL_MPC52xx_CONSOLE
 	  of the Freescale MPC52xx family as a console.
 
 config SERIAL_MPC52xx_CONSOLE_BAUD
-	int "Freescale MPC52xx family PSC serial port baud"
+	int "Freescale MPC52xx/MPC512x family PSC serial port baud"
 	depends on SERIAL_MPC52xx_CONSOLE=y
 	default "9600"
 	help
diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c
index 0f6036b..212872d 100644
--- a/drivers/serial/mpc52xx_uart.c
+++ b/drivers/serial/mpc52xx_uart.c
@@ -16,6 +16,9 @@
  * Some of the code has been inspired/copied from the 2.4 code written
  * by Dale Farnsworth <dfarnsworth@mvista.com>.
  *
+ * Copyright (C) 2008 Freescale Semiconductor Inc.
+ *                    John Rigby <jrigby@gmail.com>
+ * Added support for MPC5121
  * Copyright (C) 2006 Secret Lab Technologies Ltd.
  *                    Grant Likely <grant.likely@secretlab.ca>
  * Copyright (C) 2004-2006 Sylvain Munaut <tnt@246tNt.com>
@@ -77,6 +80,7 @@
 #endif
 
 #include <asm/mpc52xx.h>
+#include <asm/mpc512x.h>
 #include <asm/mpc52xx_psc.h>
 
 #if defined(CONFIG_SERIAL_MPC52xx_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
@@ -126,12 +130,6 @@ static irqreturn_t mpc52xx_uart_int(int irq, void *dev_id);
 #define uart_console(port)	(0)
 #endif
 
-#if defined(CONFIG_PPC_MERGE)
-static const struct of_device_id mpc52xx_uart_of_match[] = {
-	{ .type = "serial", .compatible = "mpc5200-psc-uart", },
-	{},
-};
-#endif
 
 /* ======================================================================== */
 /* PSC fifo operations for isolating differences between 52xx and 512x      */
@@ -156,6 +154,7 @@ struct psc_ops {
 	unsigned long	(*getuartclk)(void *p);
 };
 
+#ifdef CONFIG_PPC_MPC52xx
 #define FIFO_52xx(port) ((struct mpc52xx_psc_fifo __iomem *)(PSC(port)+1))
 static void mpc52xx_psc_fifo_init(struct uart_port *port)
 {
@@ -288,7 +287,161 @@ static struct psc_ops mpc52xx_psc_ops = {
 	.getuartclk = mpc52xx_getuartclk,
 };
 
-static struct psc_ops *psc_ops = &mpc52xx_psc_ops;
+#endif /* CONFIG_MPC52xx */
+
+#ifdef CONFIG_PPC_MPC512x
+#define FIFO_512x(port) ((struct mpc512x_psc_fifo __iomem *)(PSC(port)+1))
+static void mpc512x_psc_fifo_init(struct uart_port *port)
+{
+	out_be32(&FIFO_512x(port)->txcmd, MPC512x_PSC_FIFO_RESET_SLICE);
+	out_be32(&FIFO_512x(port)->txcmd, MPC512x_PSC_FIFO_ENABLE_SLICE);
+	out_be32(&FIFO_512x(port)->txalarm, 1);
+	out_be32(&FIFO_512x(port)->tximr, 0);
+
+	out_be32(&FIFO_512x(port)->rxcmd, MPC512x_PSC_FIFO_RESET_SLICE);
+	out_be32(&FIFO_512x(port)->rxcmd, MPC512x_PSC_FIFO_ENABLE_SLICE);
+	out_be32(&FIFO_512x(port)->rxalarm, 1);
+	out_be32(&FIFO_512x(port)->rximr, 0);
+
+	out_be32(&FIFO_512x(port)->tximr, MPC512x_PSC_FIFO_ALARM);
+	out_be32(&FIFO_512x(port)->rximr, MPC512x_PSC_FIFO_ALARM);
+}
+
+static int mpc512x_psc_raw_rx_rdy(struct uart_port *port)
+{
+	return !(in_be32(&FIFO_512x(port)->rxsr) & MPC512x_PSC_FIFO_EMPTY);
+}
+
+static int mpc512x_psc_raw_tx_rdy(struct uart_port *port)
+{
+	return !(in_be32(&FIFO_512x(port)->txsr) & MPC512x_PSC_FIFO_FULL);
+}
+
+static int mpc512x_psc_rx_rdy(struct uart_port *port)
+{
+	return in_be32(&FIFO_512x(port)->rxsr)
+	    & in_be32(&FIFO_512x(port)->rximr)
+	    & MPC512x_PSC_FIFO_ALARM;
+}
+
+static int mpc512x_psc_tx_rdy(struct uart_port *port)
+{
+	return in_be32(&FIFO_512x(port)->txsr)
+	    & in_be32(&FIFO_512x(port)->tximr)
+	    & MPC512x_PSC_FIFO_ALARM;
+}
+
+static int mpc512x_psc_tx_empty(struct uart_port *port)
+{
+	return in_be32(&FIFO_512x(port)->txsr)
+	    & MPC512x_PSC_FIFO_EMPTY;
+}
+
+static void mpc512x_psc_stop_rx(struct uart_port *port)
+{
+	unsigned long rx_fifo_imr;
+
+	rx_fifo_imr = in_be32(&FIFO_512x(port)->rximr);
+	rx_fifo_imr &= ~MPC512x_PSC_FIFO_ALARM;
+	out_be32(&FIFO_512x(port)->rximr, rx_fifo_imr);
+}
+
+static void mpc512x_psc_start_tx(struct uart_port *port)
+{
+	unsigned long tx_fifo_imr;
+
+	tx_fifo_imr = in_be32(&FIFO_512x(port)->tximr);
+	tx_fifo_imr |= MPC512x_PSC_FIFO_ALARM;
+	out_be32(&FIFO_512x(port)->tximr, tx_fifo_imr);
+}
+
+static void mpc512x_psc_stop_tx(struct uart_port *port)
+{
+	unsigned long tx_fifo_imr;
+
+	tx_fifo_imr = in_be32(&FIFO_512x(port)->tximr);
+	tx_fifo_imr &= ~MPC512x_PSC_FIFO_ALARM;
+	out_be32(&FIFO_512x(port)->tximr, tx_fifo_imr);
+}
+
+static void mpc512x_psc_rx_clr_irq(struct uart_port *port)
+{
+	out_be32(&FIFO_512x(port)->rxisr, in_be32(&FIFO_512x(port)->rxisr));
+}
+
+static void mpc512x_psc_tx_clr_irq(struct uart_port *port)
+{
+	out_be32(&FIFO_512x(port)->txisr, in_be32(&FIFO_512x(port)->txisr));
+}
+
+static void mpc512x_psc_write_char(struct uart_port *port, unsigned char c)
+{
+	out_8(&FIFO_512x(port)->txdata_8, c);
+}
+
+static unsigned char mpc512x_psc_read_char(struct uart_port *port)
+{
+	return in_8(&FIFO_512x(port)->rxdata_8);
+}
+
+static void mpc512x_psc_cw_disable_ints(struct uart_port *port)
+{
+	port->read_status_mask =
+		in_be32(&FIFO_512x(port)->tximr) << 16 |
+		in_be32(&FIFO_512x(port)->rximr);
+	out_be32(&FIFO_512x(port)->tximr, 0);
+	out_be32(&FIFO_512x(port)->rximr, 0);
+}
+
+static void mpc512x_psc_cw_restore_ints(struct uart_port *port)
+{
+	out_be32(&FIFO_512x(port)->tximr,
+		(port->read_status_mask >> 16) & 0x7f);
+	out_be32(&FIFO_512x(port)->rximr, port->read_status_mask & 0x7f);
+}
+
+static unsigned long mpc512x_getuartclk(void *p)
+{
+	return mpc512x_find_ips_freq(p);
+}
+
+static struct psc_ops mpc512x_psc_ops = {
+	.fifo_init = mpc512x_psc_fifo_init,
+	.raw_rx_rdy = mpc512x_psc_raw_rx_rdy,
+	.raw_tx_rdy = mpc512x_psc_raw_tx_rdy,
+	.rx_rdy = mpc512x_psc_rx_rdy,
+	.tx_rdy = mpc512x_psc_tx_rdy,
+	.tx_empty = mpc512x_psc_tx_empty,
+	.stop_rx = mpc512x_psc_stop_rx,
+	.start_tx = mpc512x_psc_start_tx,
+	.stop_tx = mpc512x_psc_stop_tx,
+	.rx_clr_irq = mpc512x_psc_rx_clr_irq,
+	.tx_clr_irq = mpc512x_psc_tx_clr_irq,
+	.write_char = mpc512x_psc_write_char,
+	.read_char = mpc512x_psc_read_char,
+	.cw_disable_ints = mpc512x_psc_cw_disable_ints,
+	.cw_restore_ints = mpc512x_psc_cw_restore_ints,
+	.getuartclk = mpc512x_getuartclk,
+};
+#endif
+
+static struct psc_ops *psc_ops;
+
+#if defined(CONFIG_PPC_MERGE)
+static const struct of_device_id mpc52xx_uart_of_match[] = {
+#ifdef CONFIG_PPC_MPC52xx
+	{.type = "serial",
+	 .compatible = "mpc5200-psc-uart",
+	 .data = &mpc52xx_psc_ops},
+#endif
+#ifdef CONFIG_PPC_MPC512x
+	{.type = "serial",
+	 .compatible = "fsl,mpc5121-psc-uart",
+	 .data = &mpc512x_psc_ops},
+#endif
+	{},
+};
+#endif
 
 /* ======================================================================== */
 /* UART operations                                                          */
@@ -1205,15 +1358,19 @@ mpc52xx_uart_of_enumerate(void)
 	static int enum_done;
 	struct device_node *np;
 	const unsigned int *devno;
+	const struct  of_device_id *match;
 	int i;
 
 	if (enum_done)
 		return;
 
 	for_each_node_by_type(np, "serial") {
-		if (!of_match_node(mpc52xx_uart_of_match, np))
+		match = of_match_node(mpc52xx_uart_of_match, np);
+		if (!match)
 			continue;
 
+		psc_ops = match->data;
+
 		/* Is a particular device number requested? */
 		devno = of_get_property(np, "port-number", NULL);
 		mpc52xx_uart_of_assign(np, devno ? *devno : -1);
@@ -1274,6 +1431,7 @@ mpc52xx_uart_init(void)
 		return ret;
 	}
 #else
+	psc_ops = &mpc52xx_psc_ops;
 	ret = platform_driver_register(&mpc52xx_uart_platform_driver);
 	if (ret) {
 		printk(KERN_ERR "%s: platform_driver_register failed (%i)\n",
diff --git a/include/asm-powerpc/mpc52xx_psc.h b/include/asm-powerpc/mpc52xx_psc.h
index bea42b9..710c5d3 100644
--- a/include/asm-powerpc/mpc52xx_psc.h
+++ b/include/asm-powerpc/mpc52xx_psc.h
@@ -190,5 +190,53 @@ struct mpc52xx_psc_fifo {
 	u16		tflwfptr;	/* PSC + 0x9e */
 };
 
+#define MPC512x_PSC_FIFO_RESET_SLICE	0x80
+#define MPC512x_PSC_FIFO_ENABLE_SLICE	0x01
+#define MPC512x_PSC_FIFO_ENABLE_DMA	0x04
+
+#define MPC512x_PSC_FIFO_EMPTY		0x1
+#define MPC512x_PSC_FIFO_FULL		0x2
+#define MPC512x_PSC_FIFO_ALARM		0x4
+#define MPC512x_PSC_FIFO_URERR		0x8
+#define MPC512x_PSC_FIFO_ORERR		0x01
+#define MPC512x_PSC_FIFO_MEMERROR	0x02
+
+struct mpc512x_psc_fifo {
+	u32		reserved1[10];
+	u32		txcmd;		/* PSC + 0x80 */
+	u32		txalarm;	/* PSC + 0x84 */
+	u32		txsr;		/* PSC + 0x88 */
+	u32		txisr;		/* PSC + 0x8c */
+	u32		tximr;		/* PSC + 0x90 */
+	u32		txcnt;		/* PSC + 0x94 */
+	u32		txptr;		/* PSC + 0x98 */
+	u32		txsz;		/* PSC + 0x9c */
+	u32		reserved2[7];
+	union {
+		u8	txdata_8;
+		u16	txdata_16;
+		u32	txdata_32;
+	} txdata; 			/* PSC + 0xbc */
+#define txdata_8 txdata.txdata_8
+#define txdata_16 txdata.txdata_16
+#define txdata_32 txdata.txdata_32
+	u32		rxcmd;		/* PSC + 0xc0 */
+	u32		rxalarm;	/* PSC + 0xc4 */
+	u32		rxsr;		/* PSC + 0xc8 */
+	u32		rxisr;		/* PSC + 0xcc */
+	u32		rximr;		/* PSC + 0xd0 */
+	u32		rxcnt;		/* PSC + 0xd4 */
+	u32		rxptr;		/* PSC + 0xd8 */
+	u32		rxsz;		/* PSC + 0xdc */
+	u32		reserved3[7];
+	union {
+		u8	rxdata_8;
+		u16	rxdata_16;
+		u32	rxdata_32;
+	} rxdata; 			/* PSC + 0xfc */
+#define rxdata_8 rxdata.rxdata_8
+#define rxdata_16 rxdata.rxdata_16
+#define rxdata_32 rxdata.rxdata_32
+};
 
 #endif  /* __ASM_MPC52xx_PSC_H__ */
-- 
1.5.3.5.726.g41a7a

^ permalink raw reply related

* [Add mpc5121 support PATCH v2 7/8] Factor out 52xx dependencies from 52xx psc driver
From: John Rigby @ 2008-01-16 21:37 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <1200519447-25555-6-git-send-email-jrigby@freescale.com>

PSCs change from 5200 to 5121
this patch localizes the differences in
preparation for adding 5121 support

Signed-off-by: John Rigby <jrigby@freescale.com>
---
 drivers/serial/mpc52xx_uart.c |  256 ++++++++++++++++++++++++++++++----------
 1 files changed, 192 insertions(+), 64 deletions(-)

diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c
index 9bf4521..0f6036b 100644
--- a/drivers/serial/mpc52xx_uart.c
+++ b/drivers/serial/mpc52xx_uart.c
@@ -67,7 +67,6 @@
 #include <linux/serial.h>
 #include <linux/sysrq.h>
 #include <linux/console.h>
-
 #include <linux/delay.h>
 #include <linux/io.h>
 
@@ -110,8 +109,8 @@ static struct device_node *mpc52xx_uart_nodes[MPC52xx_PSC_MAXNUM];
 static void mpc52xx_uart_of_enumerate(void);
 #endif
 
+
 #define PSC(port) ((struct mpc52xx_psc __iomem *)((port)->membase))
-#define FIFO(port) ((struct mpc52xx_psc_fifo __iomem *)(PSC(port)+1))
 
 
 /* Forward declaration of the interruption handling routine */
@@ -134,6 +133,162 @@ static const struct of_device_id mpc52xx_uart_of_match[] = {
 };
 #endif
 
+/* ======================================================================== */
+/* PSC fifo operations for isolating differences between 52xx and 512x      */
+/* ======================================================================== */
+
+struct psc_ops {
+	void		(*fifo_init)(struct uart_port *port);
+	int		(*raw_rx_rdy)(struct uart_port *port);
+	int		(*raw_tx_rdy)(struct uart_port *port);
+	int		(*rx_rdy)(struct uart_port *port);
+	int		(*tx_rdy)(struct uart_port *port);
+	int		(*tx_empty)(struct uart_port *port);
+	void		(*stop_rx)(struct uart_port *port);
+	void		(*start_tx)(struct uart_port *port);
+	void		(*stop_tx)(struct uart_port *port);
+	void		(*rx_clr_irq)(struct uart_port *port);
+	void		(*tx_clr_irq)(struct uart_port *port);
+	void		(*write_char)(struct uart_port *port, unsigned char c);
+	unsigned char	(*read_char)(struct uart_port *port);
+	void		(*cw_disable_ints)(struct uart_port *port);
+	void		(*cw_restore_ints)(struct uart_port *port);
+	unsigned long	(*getuartclk)(void *p);
+};
+
+#define FIFO_52xx(port) ((struct mpc52xx_psc_fifo __iomem *)(PSC(port)+1))
+static void mpc52xx_psc_fifo_init(struct uart_port *port)
+{
+	struct mpc52xx_psc __iomem *psc = PSC(port);
+	struct mpc52xx_psc_fifo __iomem *fifo = FIFO_52xx(port);
+
+	/* /32 prescaler */
+	out_be16(&psc->mpc52xx_psc_clock_select, 0xdd00);
+
+	out_8(&fifo->rfcntl, 0x00);
+	out_be16(&fifo->rfalarm, 0x1ff);
+	out_8(&fifo->tfcntl, 0x07);
+	out_be16(&fifo->tfalarm, 0x80);
+
+	port->read_status_mask |= MPC52xx_PSC_IMR_RXRDY | MPC52xx_PSC_IMR_TXRDY;
+	out_be16(&psc->mpc52xx_psc_imr, port->read_status_mask);
+}
+
+static int mpc52xx_psc_raw_rx_rdy(struct uart_port *port)
+{
+	return in_be16(&PSC(port)->mpc52xx_psc_status)
+	    & MPC52xx_PSC_SR_RXRDY;
+}
+
+static int mpc52xx_psc_raw_tx_rdy(struct uart_port *port)
+{
+	return in_be16(&PSC(port)->mpc52xx_psc_status)
+	    & MPC52xx_PSC_SR_TXRDY;
+}
+
+
+static int mpc52xx_psc_rx_rdy(struct uart_port *port)
+{
+	return in_be16(&PSC(port)->mpc52xx_psc_status)
+	    & port->read_status_mask
+	    & MPC52xx_PSC_SR_RXRDY;
+}
+
+static int mpc52xx_psc_tx_rdy(struct uart_port *port)
+{
+	return in_be16(&PSC(port)->mpc52xx_psc_status)
+	    & port->read_status_mask
+	    & MPC52xx_PSC_SR_TXRDY;
+}
+
+static int mpc52xx_psc_tx_empty(struct uart_port *port)
+{
+	return in_be16(&PSC(port)->mpc52xx_psc_status)
+	    & MPC52xx_PSC_SR_TXEMP;
+}
+
+static void mpc52xx_psc_start_tx(struct uart_port *port)
+{
+	port->read_status_mask |= MPC52xx_PSC_IMR_TXRDY;
+	out_be16(&PSC(port)->mpc52xx_psc_imr, port->read_status_mask);
+}
+
+static void mpc52xx_psc_stop_tx(struct uart_port *port)
+{
+	port->read_status_mask &= ~MPC52xx_PSC_IMR_TXRDY;
+	out_be16(&PSC(port)->mpc52xx_psc_imr, port->read_status_mask);
+}
+
+static void mpc52xx_psc_stop_rx(struct uart_port *port)
+{
+	port->read_status_mask &= ~MPC52xx_PSC_IMR_RXRDY;
+	out_be16(&PSC(port)->mpc52xx_psc_imr, port->read_status_mask);
+}
+
+static void mpc52xx_psc_rx_clr_irq(struct uart_port *port)
+{
+}
+
+static void mpc52xx_psc_tx_clr_irq(struct uart_port *port)
+{
+}
+
+static void mpc52xx_psc_write_char(struct uart_port *port, unsigned char c)
+{
+	out_8(&PSC(port)->mpc52xx_psc_buffer_8, c);
+}
+
+static unsigned char mpc52xx_psc_read_char(struct uart_port *port)
+{
+	return in_8(&PSC(port)->mpc52xx_psc_buffer_8);
+}
+
+static void mpc52xx_psc_cw_disable_ints(struct uart_port *port)
+{
+	out_be16(&PSC(port)->mpc52xx_psc_imr, 0);
+}
+
+static void mpc52xx_psc_cw_restore_ints(struct uart_port *port)
+{
+	out_be16(&PSC(port)->mpc52xx_psc_imr, port->read_status_mask);
+}
+
+/* Search for bus-frequency property in this node or a parent */
+static unsigned long mpc52xx_getuartclk(void *p)
+{
+#if defined(CONFIG_PPC_MERGE)
+	/*
+	 * 5200 UARTs have a / 32 prescaler
+	 * but the generic serial code assumes 16
+	 * so return ipb freq / 2
+	 */
+	return mpc52xx_find_ipb_freq(p) / 2;
+#else
+	pr_debug("unexpected call to mpc52xx_getuartclk with arch/ppc\n");
+	return NULL;
+#endif
+}
+
+static struct psc_ops mpc52xx_psc_ops = {
+	.fifo_init = mpc52xx_psc_fifo_init,
+	.raw_rx_rdy = mpc52xx_psc_raw_rx_rdy,
+	.raw_tx_rdy = mpc52xx_psc_raw_tx_rdy,
+	.rx_rdy = mpc52xx_psc_rx_rdy,
+	.tx_rdy = mpc52xx_psc_tx_rdy,
+	.tx_empty = mpc52xx_psc_tx_empty,
+	.stop_rx = mpc52xx_psc_stop_rx,
+	.start_tx = mpc52xx_psc_start_tx,
+	.stop_tx = mpc52xx_psc_stop_tx,
+	.rx_clr_irq = mpc52xx_psc_rx_clr_irq,
+	.tx_clr_irq = mpc52xx_psc_tx_clr_irq,
+	.write_char = mpc52xx_psc_write_char,
+	.read_char = mpc52xx_psc_read_char,
+	.cw_disable_ints = mpc52xx_psc_cw_disable_ints,
+	.cw_restore_ints = mpc52xx_psc_cw_restore_ints,
+	.getuartclk = mpc52xx_getuartclk,
+};
+
+static struct psc_ops *psc_ops = &mpc52xx_psc_ops;
 
 /* ======================================================================== */
 /* UART operations                                                          */
@@ -142,8 +297,7 @@ static const struct of_device_id mpc52xx_uart_of_match[] = {
 static unsigned int
 mpc52xx_uart_tx_empty(struct uart_port *port)
 {
-	int status = in_be16(&PSC(port)->mpc52xx_psc_status);
-	return (status & MPC52xx_PSC_SR_TXEMP) ? TIOCSER_TEMT : 0;
+	return psc_ops->tx_empty(port) ? TIOCSER_TEMT : 0;
 }
 
 static void
@@ -163,16 +317,14 @@ static void
 mpc52xx_uart_stop_tx(struct uart_port *port)
 {
 	/* port->lock taken by caller */
-	port->read_status_mask &= ~MPC52xx_PSC_IMR_TXRDY;
-	out_be16(&PSC(port)->mpc52xx_psc_imr, port->read_status_mask);
+	psc_ops->stop_tx(port);
 }
 
 static void
 mpc52xx_uart_start_tx(struct uart_port *port)
 {
 	/* port->lock taken by caller */
-	port->read_status_mask |= MPC52xx_PSC_IMR_TXRDY;
-	out_be16(&PSC(port)->mpc52xx_psc_imr, port->read_status_mask);
+	psc_ops->start_tx(port);
 }
 
 static void
@@ -185,8 +337,7 @@ mpc52xx_uart_send_xchar(struct uart_port *port, char ch)
 	if (ch) {
 		/* Make sure tx interrupts are on */
 		/* Truly necessary ??? They should be anyway */
-		port->read_status_mask |= MPC52xx_PSC_IMR_TXRDY;
-		out_be16(&PSC(port)->mpc52xx_psc_imr, port->read_status_mask);
+		psc_ops->start_tx(port);
 	}
 
 	spin_unlock_irqrestore(&port->lock, flags);
@@ -196,8 +347,7 @@ static void
 mpc52xx_uart_stop_rx(struct uart_port *port)
 {
 	/* port->lock taken by caller */
-	port->read_status_mask &= ~MPC52xx_PSC_IMR_RXRDY;
-	out_be16(&PSC(port)->mpc52xx_psc_imr, port->read_status_mask);
+	psc_ops->stop_rx(port);
 }
 
 static void
@@ -224,7 +374,6 @@ static int
 mpc52xx_uart_startup(struct uart_port *port)
 {
 	struct mpc52xx_psc __iomem *psc = PSC(port);
-	struct mpc52xx_psc_fifo __iomem *fifo = FIFO(port);
 	int ret;
 
 	/* Request IRQ */
@@ -239,15 +388,7 @@ mpc52xx_uart_startup(struct uart_port *port)
 
 	out_be32(&psc->sicr, 0);	/* UART mode DCD ignored */
 
-	out_be16(&psc->mpc52xx_psc_clock_select, 0xdd00); /* /16 prescaler on */
-
-	out_8(&fifo->rfcntl, 0x00);
-	out_be16(&fifo->rfalarm, 0x1ff);
-	out_8(&fifo->tfcntl, 0x07);
-	out_be16(&fifo->tfalarm, 0x80);
-
-	port->read_status_mask |= MPC52xx_PSC_IMR_RXRDY | MPC52xx_PSC_IMR_TXRDY;
-	out_be16(&psc->mpc52xx_psc_imr, port->read_status_mask);
+	psc_ops->fifo_init(port);
 
 	out_8(&psc->command, MPC52xx_PSC_TX_ENABLE);
 	out_8(&psc->command, MPC52xx_PSC_RX_ENABLE);
@@ -330,8 +471,7 @@ mpc52xx_uart_set_termios(struct uart_port *port, struct ktermios *new,
 	 * boot for the console, all stuff is not yet ready to receive at that
 	 * time and that just makes the kernel oops */
 	/* while (j-- && mpc52xx_uart_int_rx_chars(port)); */
-	while (!(in_be16(&psc->mpc52xx_psc_status) & MPC52xx_PSC_SR_TXEMP) &&
-	       --j)
+	while (!mpc52xx_uart_tx_empty(port) && --j)
 		udelay(1);
 
 	if (!j)
@@ -459,11 +599,9 @@ mpc52xx_uart_int_rx_chars(struct uart_port *port)
 	unsigned short status;
 
 	/* While we can read, do so ! */
-	while ((status = in_be16(&PSC(port)->mpc52xx_psc_status)) &
-		MPC52xx_PSC_SR_RXRDY) {
-
+	while (psc_ops->raw_rx_rdy(port)) {
 		/* Get the char */
-		ch = in_8(&PSC(port)->mpc52xx_psc_buffer_8);
+		ch = psc_ops->read_char(port);
 
 		/* Handle sysreq char */
 #ifdef SUPPORT_SYSRQ
@@ -478,6 +616,8 @@ mpc52xx_uart_int_rx_chars(struct uart_port *port)
 		flag = TTY_NORMAL;
 		port->icount.rx++;
 
+		status = in_be16(&PSC(port)->mpc52xx_psc_status);
+
 		if (status & (MPC52xx_PSC_SR_PE |
 			      MPC52xx_PSC_SR_FE |
 			      MPC52xx_PSC_SR_RB)) {
@@ -507,7 +647,7 @@ mpc52xx_uart_int_rx_chars(struct uart_port *port)
 
 	tty_flip_buffer_push(tty);
 
-	return in_be16(&PSC(port)->mpc52xx_psc_status) & MPC52xx_PSC_SR_RXRDY;
+	return psc_ops->raw_rx_rdy(port);
 }
 
 static inline int
@@ -517,7 +657,7 @@ mpc52xx_uart_int_tx_chars(struct uart_port *port)
 
 	/* Process out of band chars */
 	if (port->x_char) {
-		out_8(&PSC(port)->mpc52xx_psc_buffer_8, port->x_char);
+		psc_ops->write_char(port, port->x_char);
 		port->icount.tx++;
 		port->x_char = 0;
 		return 1;
@@ -530,8 +670,8 @@ mpc52xx_uart_int_tx_chars(struct uart_port *port)
 	}
 
 	/* Send chars */
-	while (in_be16(&PSC(port)->mpc52xx_psc_status) & MPC52xx_PSC_SR_TXRDY) {
-		out_8(&PSC(port)->mpc52xx_psc_buffer_8, xmit->buf[xmit->tail]);
+	while (psc_ops->raw_tx_rdy(port)) {
+		psc_ops->write_char(port, xmit->buf[xmit->tail]);
 		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
 		port->icount.tx++;
 		if (uart_circ_empty(xmit))
@@ -557,7 +697,6 @@ mpc52xx_uart_int(int irq, void *dev_id)
 	struct uart_port *port = dev_id;
 	unsigned long pass = ISR_PASS_LIMIT;
 	unsigned int keepgoing;
-	unsigned short status;
 
 	spin_lock(&port->lock);
 
@@ -566,18 +705,12 @@ mpc52xx_uart_int(int irq, void *dev_id)
 		/* If we don't find anything to do, we stop */
 		keepgoing = 0;
 
-		/* Read status */
-		status = in_be16(&PSC(port)->mpc52xx_psc_isr);
-		status &= port->read_status_mask;
-
-		/* Do we need to receive chars ? */
-		/* For this RX interrupts must be on and some chars waiting */
-		if (status & MPC52xx_PSC_IMR_RXRDY)
+		psc_ops->rx_clr_irq(port);
+		if (psc_ops->rx_rdy(port))
 			keepgoing |= mpc52xx_uart_int_rx_chars(port);
 
-		/* Do we need to send chars ? */
-		/* For this, TX must be ready and TX interrupt enabled */
-		if (status & MPC52xx_PSC_IMR_TXRDY)
+		psc_ops->tx_clr_irq(port);
+		if (psc_ops->tx_rdy(port))
 			keepgoing |= mpc52xx_uart_int_tx_chars(port);
 
 		/* Limit number of iteration */
@@ -644,36 +777,33 @@ static void
 mpc52xx_console_write(struct console *co, const char *s, unsigned int count)
 {
 	struct uart_port *port = &mpc52xx_uart_ports[co->index];
-	struct mpc52xx_psc __iomem *psc = PSC(port);
 	unsigned int i, j;
 
 	/* Disable interrupts */
-	out_be16(&psc->mpc52xx_psc_imr, 0);
+	psc_ops->cw_disable_ints(port);
 
 	/* Wait the TX buffer to be empty */
 	j = 5000000;	/* Maximum wait */
-	while (!(in_be16(&psc->mpc52xx_psc_status) & MPC52xx_PSC_SR_TXEMP) &&
-	       --j)
+	while (!mpc52xx_uart_tx_empty(port) && --j)
 		udelay(1);
 
 	/* Write all the chars */
 	for (i = 0; i < count; i++, s++) {
 		/* Line return handling */
 		if (*s == '\n')
-			out_8(&psc->mpc52xx_psc_buffer_8, '\r');
+			psc_ops->write_char(port, '\r');
 
 		/* Send the char */
-		out_8(&psc->mpc52xx_psc_buffer_8, *s);
+		psc_ops->write_char(port, *s);
 
 		/* Wait the TX buffer to be empty */
 		j = 20000;	/* Maximum wait */
-		while (!(in_be16(&psc->mpc52xx_psc_status) &
-			 MPC52xx_PSC_SR_TXEMP) && --j)
+		while (!mpc52xx_uart_tx_empty(port) && --j)
 			udelay(1);
 	}
 
 	/* Restore interrupt state */
-	out_be16(&psc->mpc52xx_psc_imr, port->read_status_mask);
+	psc_ops->cw_restore_ints(port);
 }
 
 #if !defined(CONFIG_PPC_MERGE)
@@ -718,7 +848,7 @@ mpc52xx_console_setup(struct console *co, char *options)
 {
 	struct uart_port *port = &mpc52xx_uart_ports[co->index];
 	struct device_node *np = mpc52xx_uart_nodes[co->index];
-	unsigned int ipb_freq;
+	unsigned int uartclk;
 	struct resource res;
 	int ret;
 
@@ -750,17 +880,16 @@ mpc52xx_console_setup(struct console *co, char *options)
 		return ret;
 	}
 
-	/* Search for bus-frequency property in this node or a parent */
-	ipb_freq = mpc52xx_find_ipb_freq(np);
-	if (ipb_freq == 0) {
-		pr_debug("Could not find IPB bus frequency!\n");
+	uartclk = psc_ops->getuartclk(np);
+	if (uartclk == 0) {
+		pr_debug("Could not find uart clock frequency!\n");
 		return -EINVAL;
 	}
 
 	/* Basic port init. Needed since we use some uart_??? func before
 	 * real init for early access */
 	spin_lock_init(&port->lock);
-	port->uartclk	= ipb_freq / 2;
+	port->uartclk = uartclk;
 	port->ops	= &mpc52xx_uart_ops;
 	port->mapbase = res.start;
 	port->membase = ioremap(res.start, sizeof(struct mpc52xx_psc));
@@ -946,7 +1075,7 @@ static int __devinit
 mpc52xx_uart_of_probe(struct of_device *op, const struct of_device_id *match)
 {
 	int idx = -1;
-	unsigned int ipb_freq;
+	unsigned int uartclk;
 	struct uart_port *port = NULL;
 	struct resource res;
 	int ret;
@@ -962,10 +1091,9 @@ mpc52xx_uart_of_probe(struct of_device *op, const struct of_device_id *match)
 	pr_debug("Found %s assigned to ttyPSC%x\n",
 		 mpc52xx_uart_nodes[idx]->full_name, idx);
 
-	/* Search for bus-frequency property in this node or a parent */
-	ipb_freq = mpc52xx_find_ipb_freq(op->node);
-	if (ipb_freq == 0) {
-		dev_dbg(&op->dev, "Could not find IPB bus frequency!\n");
+	uartclk = psc_ops->getuartclk(op->node);
+	if (uartclk == 0) {
+		dev_dbg(&op->dev, "Could not find uart clock frequency!\n");
 		return -EINVAL;
 	}
 
@@ -973,7 +1101,7 @@ mpc52xx_uart_of_probe(struct of_device *op, const struct of_device_id *match)
 	port = &mpc52xx_uart_ports[idx];
 
 	spin_lock_init(&port->lock);
-	port->uartclk	= ipb_freq / 2;
+	port->uartclk = uartclk;
 	port->fifosize	= 512;
 	port->iotype	= UPIO_MEM;
 	port->flags	= UPF_BOOT_AUTOCONF |
-- 
1.5.3.5.726.g41a7a

^ permalink raw reply related

* [Add mpc5121 support PATCH v2 6/8] Cleanup checkpatch.pl problems in mpc52xx_uart.c
From: John Rigby @ 2008-01-16 21:37 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <1200519447-25555-5-git-send-email-jrigby@freescale.com>

In preparation of adding MPC5121 support
cleanup some things that checkpatch.pl complains
about also some minor fixes suggested by
Stephen Rothwell.

Signed-off-by: John Rigby <jrigby@freescale.com>
---
 drivers/serial/mpc52xx_uart.c |  204 ++++++++++++++++++++++-------------------
 1 files changed, 109 insertions(+), 95 deletions(-)

diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c
index 25a91c9..9bf4521 100644
--- a/drivers/serial/mpc52xx_uart.c
+++ b/drivers/serial/mpc52xx_uart.c
@@ -36,7 +36,7 @@
  * DCD. However, the pin multiplexing aren't changed and should be set either
  * by the bootloader or in the platform init code.
  *
- * The idx field must be equal to the PSC index ( e.g. 0 for PSC1, 1 for PSC2,
+ * The idx field must be equal to the PSC index (e.g. 0 for PSC1, 1 for PSC2,
  * and so on). So the PSC1 is mapped to /dev/ttyPSC0, PSC2 to /dev/ttyPSC1 and
  * so on. But be warned, it's an ABSOLUTE REQUIREMENT ! This is needed mainly
  * fpr the console code : without this 1:1 mapping, at early boot time, when we
@@ -68,11 +68,11 @@
 #include <linux/sysrq.h>
 #include <linux/console.h>
 
-#include <asm/delay.h>
-#include <asm/io.h>
+#include <linux/delay.h>
+#include <linux/io.h>
 
 #if defined(CONFIG_PPC_MERGE)
-#include <asm/of_platform.h>
+#include <linux/of_platform.h>
 #else
 #include <linux/platform_device.h>
 #endif
@@ -115,19 +115,20 @@ static void mpc52xx_uart_of_enumerate(void);
 
 
 /* Forward declaration of the interruption handling routine */
-static irqreturn_t mpc52xx_uart_int(int irq,void *dev_id);
+static irqreturn_t mpc52xx_uart_int(int irq, void *dev_id);
 
 
 /* Simple macro to test if a port is console or not. This one is taken
  * for serial_core.c and maybe should be moved to serial_core.h ? */
 #ifdef CONFIG_SERIAL_CORE_CONSOLE
-#define uart_console(port)	((port)->cons && (port)->cons->index == (port)->line)
+#define uart_console(port) \
+	((port)->cons && (port)->cons->index == (port)->line)
 #else
 #define uart_console(port)	(0)
 #endif
 
 #if defined(CONFIG_PPC_MERGE)
-static struct of_device_id mpc52xx_uart_of_match[] = {
+static const struct of_device_id mpc52xx_uart_of_match[] = {
 	{ .type = "serial", .compatible = "mpc5200-psc-uart", },
 	{},
 };
@@ -163,7 +164,7 @@ mpc52xx_uart_stop_tx(struct uart_port *port)
 {
 	/* port->lock taken by caller */
 	port->read_status_mask &= ~MPC52xx_PSC_IMR_TXRDY;
-	out_be16(&PSC(port)->mpc52xx_psc_imr,port->read_status_mask);
+	out_be16(&PSC(port)->mpc52xx_psc_imr, port->read_status_mask);
 }
 
 static void
@@ -171,7 +172,7 @@ mpc52xx_uart_start_tx(struct uart_port *port)
 {
 	/* port->lock taken by caller */
 	port->read_status_mask |= MPC52xx_PSC_IMR_TXRDY;
-	out_be16(&PSC(port)->mpc52xx_psc_imr,port->read_status_mask);
+	out_be16(&PSC(port)->mpc52xx_psc_imr, port->read_status_mask);
 }
 
 static void
@@ -185,7 +186,7 @@ mpc52xx_uart_send_xchar(struct uart_port *port, char ch)
 		/* Make sure tx interrupts are on */
 		/* Truly necessary ??? They should be anyway */
 		port->read_status_mask |= MPC52xx_PSC_IMR_TXRDY;
-		out_be16(&PSC(port)->mpc52xx_psc_imr,port->read_status_mask);
+		out_be16(&PSC(port)->mpc52xx_psc_imr, port->read_status_mask);
 	}
 
 	spin_unlock_irqrestore(&port->lock, flags);
@@ -196,7 +197,7 @@ mpc52xx_uart_stop_rx(struct uart_port *port)
 {
 	/* port->lock taken by caller */
 	port->read_status_mask &= ~MPC52xx_PSC_IMR_RXRDY;
-	out_be16(&PSC(port)->mpc52xx_psc_imr,port->read_status_mask);
+	out_be16(&PSC(port)->mpc52xx_psc_imr, port->read_status_mask);
 }
 
 static void
@@ -211,10 +212,10 @@ mpc52xx_uart_break_ctl(struct uart_port *port, int ctl)
 	unsigned long flags;
 	spin_lock_irqsave(&port->lock, flags);
 
-	if ( ctl == -1 )
-		out_8(&PSC(port)->command,MPC52xx_PSC_START_BRK);
+	if (ctl == -1)
+		out_8(&PSC(port)->command, MPC52xx_PSC_START_BRK);
 	else
-		out_8(&PSC(port)->command,MPC52xx_PSC_STOP_BRK);
+		out_8(&PSC(port)->command, MPC52xx_PSC_STOP_BRK);
 
 	spin_unlock_irqrestore(&port->lock, flags);
 }
@@ -233,10 +234,10 @@ mpc52xx_uart_startup(struct uart_port *port)
 		return ret;
 
 	/* Reset/activate the port, clear and enable interrupts */
-	out_8(&psc->command,MPC52xx_PSC_RST_RX);
-	out_8(&psc->command,MPC52xx_PSC_RST_TX);
+	out_8(&psc->command, MPC52xx_PSC_RST_RX);
+	out_8(&psc->command, MPC52xx_PSC_RST_TX);
 
-	out_be32(&psc->sicr,0);	/* UART mode DCD ignored */
+	out_be32(&psc->sicr, 0);	/* UART mode DCD ignored */
 
 	out_be16(&psc->mpc52xx_psc_clock_select, 0xdd00); /* /16 prescaler on */
 
@@ -246,10 +247,10 @@ mpc52xx_uart_startup(struct uart_port *port)
 	out_be16(&fifo->tfalarm, 0x80);
 
 	port->read_status_mask |= MPC52xx_PSC_IMR_RXRDY | MPC52xx_PSC_IMR_TXRDY;
-	out_be16(&psc->mpc52xx_psc_imr,port->read_status_mask);
+	out_be16(&psc->mpc52xx_psc_imr, port->read_status_mask);
 
-	out_8(&psc->command,MPC52xx_PSC_TX_ENABLE);
-	out_8(&psc->command,MPC52xx_PSC_RX_ENABLE);
+	out_8(&psc->command, MPC52xx_PSC_TX_ENABLE);
+	out_8(&psc->command, MPC52xx_PSC_RX_ENABLE);
 
 	return 0;
 }
@@ -260,12 +261,12 @@ mpc52xx_uart_shutdown(struct uart_port *port)
 	struct mpc52xx_psc __iomem *psc = PSC(port);
 
 	/* Shut down the port.  Leave TX active if on a console port */
-	out_8(&psc->command,MPC52xx_PSC_RST_RX);
+	out_8(&psc->command, MPC52xx_PSC_RST_RX);
 	if (!uart_console(port))
-		out_8(&psc->command,MPC52xx_PSC_RST_TX);
+		out_8(&psc->command, MPC52xx_PSC_RST_TX);
 
 	port->read_status_mask = 0;
-	out_be16(&psc->mpc52xx_psc_imr,port->read_status_mask);
+	out_be16(&psc->mpc52xx_psc_imr, port->read_status_mask);
 
 	/* Release interrupt */
 	free_irq(port->irq, port);
@@ -273,7 +274,7 @@ mpc52xx_uart_shutdown(struct uart_port *port)
 
 static void
 mpc52xx_uart_set_termios(struct uart_port *port, struct ktermios *new,
-                         struct ktermios *old)
+			 struct ktermios *old)
 {
 	struct mpc52xx_psc __iomem *psc = PSC(port);
 	unsigned long flags;
@@ -285,14 +286,14 @@ mpc52xx_uart_set_termios(struct uart_port *port, struct ktermios *new,
 	mr1 = 0;
 
 	switch (new->c_cflag & CSIZE) {
-		case CS5:	mr1 |= MPC52xx_PSC_MODE_5_BITS;
-				break;
-		case CS6:	mr1 |= MPC52xx_PSC_MODE_6_BITS;
-				break;
-		case CS7:	mr1 |= MPC52xx_PSC_MODE_7_BITS;
-				break;
-		case CS8:
-		default:	mr1 |= MPC52xx_PSC_MODE_8_BITS;
+	case CS5:	mr1 |= MPC52xx_PSC_MODE_5_BITS;
+		break;
+	case CS6:	mr1 |= MPC52xx_PSC_MODE_6_BITS;
+		break;
+	case CS7:	mr1 |= MPC52xx_PSC_MODE_7_BITS;
+		break;
+	case CS8:
+	default:	mr1 |= MPC52xx_PSC_MODE_8_BITS;
 	}
 
 	if (new->c_cflag & PARENB) {
@@ -334,24 +335,24 @@ mpc52xx_uart_set_termios(struct uart_port *port, struct ktermios *new,
 		udelay(1);
 
 	if (!j)
-		printk(	KERN_ERR "mpc52xx_uart.c: "
+		printk(KERN_ERR "mpc52xx_uart.c: "
 			"Unable to flush RX & TX fifos in-time in set_termios."
-			"Some chars may have been lost.\n" );
+			"Some chars may have been lost.\n");
 
 	/* Reset the TX & RX */
-	out_8(&psc->command,MPC52xx_PSC_RST_RX);
-	out_8(&psc->command,MPC52xx_PSC_RST_TX);
+	out_8(&psc->command, MPC52xx_PSC_RST_RX);
+	out_8(&psc->command, MPC52xx_PSC_RST_TX);
 
 	/* Send new mode settings */
-	out_8(&psc->command,MPC52xx_PSC_SEL_MODE_REG_1);
-	out_8(&psc->mode,mr1);
-	out_8(&psc->mode,mr2);
-	out_8(&psc->ctur,ctr >> 8);
-	out_8(&psc->ctlr,ctr & 0xff);
+	out_8(&psc->command, MPC52xx_PSC_SEL_MODE_REG_1);
+	out_8(&psc->mode, mr1);
+	out_8(&psc->mode, mr2);
+	out_8(&psc->ctur, ctr >> 8);
+	out_8(&psc->ctlr, ctr & 0xff);
 
 	/* Reenable TX & RX */
-	out_8(&psc->command,MPC52xx_PSC_TX_ENABLE);
-	out_8(&psc->command,MPC52xx_PSC_RX_ENABLE);
+	out_8(&psc->command, MPC52xx_PSC_TX_ENABLE);
+	out_8(&psc->command, MPC52xx_PSC_RX_ENABLE);
 
 	/* We're all set, release the lock */
 	spin_unlock_irqrestore(&port->lock, flags);
@@ -366,7 +367,8 @@ mpc52xx_uart_type(struct uart_port *port)
 static void
 mpc52xx_uart_release_port(struct uart_port *port)
 {
-	if (port->flags & UPF_IOREMAP) { /* remapped by us ? */
+	/* remapped by us ? */
+	if (port->flags & UPF_IOREMAP) {
 		iounmap(port->membase);
 		port->membase = NULL;
 	}
@@ -381,7 +383,7 @@ mpc52xx_uart_request_port(struct uart_port *port)
 
 	if (port->flags & UPF_IOREMAP) /* Need to remap ? */
 		port->membase = ioremap(port->mapbase,
-		                        sizeof(struct mpc52xx_psc));
+					sizeof(struct mpc52xx_psc));
 
 	if (!port->membase)
 		return -EINVAL;
@@ -400,22 +402,22 @@ mpc52xx_uart_request_port(struct uart_port *port)
 static void
 mpc52xx_uart_config_port(struct uart_port *port, int flags)
 {
-	if ( (flags & UART_CONFIG_TYPE) &&
-	     (mpc52xx_uart_request_port(port) == 0) )
-	     	port->type = PORT_MPC52xx;
+	if ((flags & UART_CONFIG_TYPE)
+		&& (mpc52xx_uart_request_port(port) == 0))
+		port->type = PORT_MPC52xx;
 }
 
 static int
 mpc52xx_uart_verify_port(struct uart_port *port, struct serial_struct *ser)
 {
-	if ( ser->type != PORT_UNKNOWN && ser->type != PORT_MPC52xx )
+	if (ser->type != PORT_UNKNOWN && ser->type != PORT_MPC52xx)
 		return -EINVAL;
 
-	if ( (ser->irq != port->irq) ||
-	     (ser->io_type != SERIAL_IO_MEM) ||
-	     (ser->baud_base != port->uartclk)  ||
-	     (ser->iomem_base != (void*)port->mapbase) ||
-	     (ser->hub6 != 0 ) )
+	if ((ser->irq != port->irq) ||
+	    (ser->io_type != SERIAL_IO_MEM) ||
+	    (ser->baud_base != port->uartclk)  ||
+	    (ser->iomem_base != (void *)port->mapbase) ||
+	    (ser->hub6 != 0))
 		return -EINVAL;
 
 	return 0;
@@ -457,8 +459,8 @@ mpc52xx_uart_int_rx_chars(struct uart_port *port)
 	unsigned short status;
 
 	/* While we can read, do so ! */
-	while ( (status = in_be16(&PSC(port)->mpc52xx_psc_status)) &
-	        MPC52xx_PSC_SR_RXRDY) {
+	while ((status = in_be16(&PSC(port)->mpc52xx_psc_status)) &
+		MPC52xx_PSC_SR_RXRDY) {
 
 		/* Get the char */
 		ch = in_8(&PSC(port)->mpc52xx_psc_buffer_8);
@@ -476,9 +478,9 @@ mpc52xx_uart_int_rx_chars(struct uart_port *port)
 		flag = TTY_NORMAL;
 		port->icount.rx++;
 
-		if ( status & (MPC52xx_PSC_SR_PE |
-		               MPC52xx_PSC_SR_FE |
-		               MPC52xx_PSC_SR_RB) ) {
+		if (status & (MPC52xx_PSC_SR_PE |
+			      MPC52xx_PSC_SR_FE |
+			      MPC52xx_PSC_SR_RB)) {
 
 			if (status & MPC52xx_PSC_SR_RB) {
 				flag = TTY_BREAK;
@@ -489,7 +491,7 @@ mpc52xx_uart_int_rx_chars(struct uart_port *port)
 				flag = TTY_FRAME;
 
 			/* Clear error condition */
-			out_8(&PSC(port)->command,MPC52xx_PSC_RST_ERR_STAT);
+			out_8(&PSC(port)->command, MPC52xx_PSC_RST_ERR_STAT);
 
 		}
 		tty_insert_flip_char(tty, ch, flag);
@@ -570,16 +572,16 @@ mpc52xx_uart_int(int irq, void *dev_id)
 
 		/* Do we need to receive chars ? */
 		/* For this RX interrupts must be on and some chars waiting */
-		if ( status & MPC52xx_PSC_IMR_RXRDY )
+		if (status & MPC52xx_PSC_IMR_RXRDY)
 			keepgoing |= mpc52xx_uart_int_rx_chars(port);
 
 		/* Do we need to send chars ? */
 		/* For this, TX must be ready and TX interrupt enabled */
-		if ( status & MPC52xx_PSC_IMR_TXRDY )
+		if (status & MPC52xx_PSC_IMR_TXRDY)
 			keepgoing |= mpc52xx_uart_int_tx_chars(port);
 
 		/* Limit number of iteration */
-		if ( !(--pass) )
+		if (!(--pass))
 			keepgoing = 0;
 
 	} while (keepgoing);
@@ -598,7 +600,7 @@ mpc52xx_uart_int(int irq, void *dev_id)
 
 static void __init
 mpc52xx_console_get_options(struct uart_port *port,
-                            int *baud, int *parity, int *bits, int *flow)
+			    int *baud, int *parity, int *bits, int *flow)
 {
 	struct mpc52xx_psc __iomem *psc = PSC(port);
 	unsigned char mr1;
@@ -606,7 +608,7 @@ mpc52xx_console_get_options(struct uart_port *port,
 	pr_debug("mpc52xx_console_get_options(port=%p)\n", port);
 
 	/* Read the mode registers */
-	out_8(&psc->command,MPC52xx_PSC_SEL_MODE_REG_1);
+	out_8(&psc->command, MPC52xx_PSC_SEL_MODE_REG_1);
 	mr1 = in_8(&psc->mode);
 
 	/* CT{U,L}R are write-only ! */
@@ -618,11 +620,18 @@ mpc52xx_console_get_options(struct uart_port *port,
 
 	/* Parse them */
 	switch (mr1 & MPC52xx_PSC_MODE_BITS_MASK) {
-		case MPC52xx_PSC_MODE_5_BITS:	*bits = 5; break;
-		case MPC52xx_PSC_MODE_6_BITS:	*bits = 6; break;
-		case MPC52xx_PSC_MODE_7_BITS:	*bits = 7; break;
-		case MPC52xx_PSC_MODE_8_BITS:
-		default:			*bits = 8;
+	case MPC52xx_PSC_MODE_5_BITS:
+		*bits = 5;
+		break;
+	case MPC52xx_PSC_MODE_6_BITS:
+		*bits = 6;
+		break;
+	case MPC52xx_PSC_MODE_7_BITS:
+		*bits = 7;
+		break;
+	case MPC52xx_PSC_MODE_8_BITS:
+	default:
+		*bits = 8;
 	}
 
 	if (mr1 & MPC52xx_PSC_MODE_PARNONE)
@@ -659,7 +668,7 @@ mpc52xx_console_write(struct console *co, const char *s, unsigned int count)
 		/* Wait the TX buffer to be empty */
 		j = 20000;	/* Maximum wait */
 		while (!(in_be16(&psc->mpc52xx_psc_status) &
-		         MPC52xx_PSC_SR_TXEMP) && --j)
+			 MPC52xx_PSC_SR_TXEMP) && --j)
 			udelay(1);
 	}
 
@@ -732,16 +741,18 @@ mpc52xx_console_setup(struct console *co, char *options)
 	}
 
 	pr_debug("Console on ttyPSC%x is %s\n",
-	         co->index, mpc52xx_uart_nodes[co->index]->full_name);
+		 co->index, mpc52xx_uart_nodes[co->index]->full_name);
 
 	/* Fetch register locations */
-	if ((ret = of_address_to_resource(np, 0, &res)) != 0) {
+	ret = of_address_to_resource(np, 0, &res);
+	if (ret) {
 		pr_debug("Could not get resources for PSC%x\n", co->index);
 		return ret;
 	}
 
 	/* Search for bus-frequency property in this node or a parent */
-	if ((ipb_freq = mpc52xx_find_ipb_freq(np)) == 0) {
+	ipb_freq = mpc52xx_find_ipb_freq(np);
+	if (ipb_freq == 0) {
 		pr_debug("Could not find IPB bus frequency!\n");
 		return -EINVAL;
 	}
@@ -759,7 +770,8 @@ mpc52xx_console_setup(struct console *co, char *options)
 		return -EINVAL;
 
 	pr_debug("mpc52xx-psc uart at %p, mapped to %p, irq=%x, freq=%i\n",
-	         (void*)port->mapbase, port->membase, port->irq, port->uartclk);
+		 (void *)port->mapbase, port->membase,
+		 port->irq, port->uartclk);
 
 	/* Setup the port parameters accoding to options */
 	if (options)
@@ -768,7 +780,7 @@ mpc52xx_console_setup(struct console *co, char *options)
 		mpc52xx_console_get_options(port, &baud, &parity, &bits, &flow);
 
 	pr_debug("Setting console parameters: %i %i%c1 flow=%c\n",
-	         baud, bits, parity, flow);
+		 baud, bits, parity, flow);
 
 	return uart_set_options(port, co, baud, parity, bits, flow);
 }
@@ -783,7 +795,7 @@ static struct console mpc52xx_console = {
 	.device	= uart_console_device,
 	.setup	= mpc52xx_console_setup,
 	.flags	= CON_PRINTBUFFER,
-	.index	= -1,	/* Specified on the cmdline (e.g. console=ttyPSC0 ) */
+	.index	= -1,	/* Specified on the cmdline (e.g. console=ttyPSC0) */
 	.data	= &mpc52xx_uart_driver,
 };
 
@@ -811,7 +823,6 @@ console_initcall(mpc52xx_console_init);
 /* ======================================================================== */
 
 static struct uart_driver mpc52xx_uart_driver = {
-	.owner		= THIS_MODULE,
 	.driver_name	= "mpc52xx_psc_uart",
 	.dev_name	= "ttyPSC",
 	.major		= SERIAL_PSC_MAJOR,
@@ -839,7 +850,7 @@ mpc52xx_uart_probe(struct platform_device *dev)
 	if (idx < 0 || idx >= MPC52xx_PSC_MAXNUM)
 		return -EINVAL;
 
-	if (!mpc52xx_match_psc_function(idx,"uart"))
+	if (!mpc52xx_match_psc_function(idx, "uart"))
 		return -ENODEV;
 
 	/* Init the port structure */
@@ -850,13 +861,13 @@ mpc52xx_uart_probe(struct platform_device *dev)
 	port->fifosize	= 512;
 	port->iotype	= UPIO_MEM;
 	port->flags	= UPF_BOOT_AUTOCONF |
-			  ( uart_console(port) ? 0 : UPF_IOREMAP );
+			  (uart_console(port) ? 0 : UPF_IOREMAP);
 	port->line	= idx;
 	port->ops	= &mpc52xx_uart_ops;
 	port->dev	= &dev->dev;
 
 	/* Search for IRQ and mapbase */
-	for (i=0 ; i<dev->num_resources ; i++, res++) {
+	for (i = 0 ; i < dev->num_resources ; i++, res++) {
 		if (res->flags & IORESOURCE_MEM)
 			port->mapbase = res->start;
 		else if (res->flags & IORESOURCE_IRQ)
@@ -868,7 +879,7 @@ mpc52xx_uart_probe(struct platform_device *dev)
 	/* Add the port to the uart sub-system */
 	ret = uart_add_one_port(&mpc52xx_uart_driver, port);
 	if (!ret)
-		platform_set_drvdata(dev, (void*)port);
+		platform_set_drvdata(dev, (void *)port);
 
 	return ret;
 }
@@ -919,6 +930,7 @@ static struct platform_driver mpc52xx_uart_platform_driver = {
 	.resume		= mpc52xx_uart_resume,
 #endif
 	.driver		= {
+		.owner	= THIS_MODULE,
 		.name	= "mpc52xx-psc",
 	},
 };
@@ -948,10 +960,11 @@ mpc52xx_uart_of_probe(struct of_device *op, const struct of_device_id *match)
 	if (idx >= MPC52xx_PSC_MAXNUM)
 		return -EINVAL;
 	pr_debug("Found %s assigned to ttyPSC%x\n",
-	         mpc52xx_uart_nodes[idx]->full_name, idx);
+		 mpc52xx_uart_nodes[idx]->full_name, idx);
 
 	/* Search for bus-frequency property in this node or a parent */
-	if ((ipb_freq = mpc52xx_find_ipb_freq(op->node)) == 0) {
+	ipb_freq = mpc52xx_find_ipb_freq(op->node);
+	if (ipb_freq == 0) {
 		dev_dbg(&op->dev, "Could not find IPB bus frequency!\n");
 		return -EINVAL;
 	}
@@ -964,22 +977,23 @@ mpc52xx_uart_of_probe(struct of_device *op, const struct of_device_id *match)
 	port->fifosize	= 512;
 	port->iotype	= UPIO_MEM;
 	port->flags	= UPF_BOOT_AUTOCONF |
-			  ( uart_console(port) ? 0 : UPF_IOREMAP );
+			  (uart_console(port) ? 0 : UPF_IOREMAP);
 	port->line	= idx;
 	port->ops	= &mpc52xx_uart_ops;
 	port->dev	= &op->dev;
 
 	/* Search for IRQ and mapbase */
-	if ((ret = of_address_to_resource(op->node, 0, &res)) != 0)
+	ret = of_address_to_resource(op->node, 0, &res);
+	if (ret)
 		return ret;
 
 	port->mapbase = res.start;
 	port->irq = irq_of_parse_and_map(op->node, 0);
 
 	dev_dbg(&op->dev, "mpc52xx-psc uart at %p, irq=%x, freq=%i\n",
-	        (void*)port->mapbase, port->irq, port->uartclk);
+		(void *)port->mapbase, port->irq, port->uartclk);
 
-	if ((port->irq==NO_IRQ) || !port->mapbase) {
+	if ((port->irq == NO_IRQ) || !port->mapbase) {
 		printk(KERN_ERR "Could not allocate resources for PSC\n");
 		return -EINVAL;
 	}
@@ -987,7 +1001,7 @@ mpc52xx_uart_of_probe(struct of_device *op, const struct of_device_id *match)
 	/* Add the port to the uart sub-system */
 	ret = uart_add_one_port(&mpc52xx_uart_driver, port);
 	if (!ret)
-		dev_set_drvdata(&op->dev, (void*)port);
+		dev_set_drvdata(&op->dev, (void *)port);
 
 	return ret;
 }
@@ -1050,6 +1064,7 @@ mpc52xx_uart_of_assign(struct device_node *np, int idx)
 	if (idx < 0)
 		return; /* No free slot; abort */
 
+	of_node_get(np);
 	/* If the slot is already occupied, then swap slots */
 	if (mpc52xx_uart_nodes[idx] && (free_idx != -1))
 		mpc52xx_uart_nodes[free_idx] = mpc52xx_uart_nodes[idx];
@@ -1059,7 +1074,7 @@ mpc52xx_uart_of_assign(struct device_node *np, int idx)
 static void
 mpc52xx_uart_of_enumerate(void)
 {
-	static int enum_done = 0;
+	static int enum_done;
 	struct device_node *np;
 	const unsigned int *devno;
 	int i;
@@ -1073,7 +1088,7 @@ mpc52xx_uart_of_enumerate(void)
 
 		/* Is a particular device number requested? */
 		devno = of_get_property(np, "port-number", NULL);
-		mpc52xx_uart_of_assign(of_node_get(np), devno ? *devno : -1);
+		mpc52xx_uart_of_assign(np, devno ? *devno : -1);
 	}
 
 	enum_done = 1;
@@ -1081,15 +1096,13 @@ mpc52xx_uart_of_enumerate(void)
 	for (i = 0; i < MPC52xx_PSC_MAXNUM; i++) {
 		if (mpc52xx_uart_nodes[i])
 			pr_debug("%s assigned to ttyPSC%x\n",
-			         mpc52xx_uart_nodes[i]->full_name, i);
+				 mpc52xx_uart_nodes[i]->full_name, i);
 	}
 }
 
 MODULE_DEVICE_TABLE(of, mpc52xx_uart_of_match);
 
 static struct of_platform_driver mpc52xx_uart_of_driver = {
-	.owner		= THIS_MODULE,
-	.name		= "mpc52xx-psc-uart",
 	.match_table	= mpc52xx_uart_of_match,
 	.probe		= mpc52xx_uart_of_probe,
 	.remove		= mpc52xx_uart_of_remove,
@@ -1115,7 +1128,8 @@ mpc52xx_uart_init(void)
 
 	printk(KERN_INFO "Serial: MPC52xx PSC UART driver\n");
 
-	if ((ret = uart_register_driver(&mpc52xx_uart_driver)) != 0) {
+	ret = uart_register_driver(&mpc52xx_uart_driver);
+	if (ret) {
 		printk(KERN_ERR "%s: uart_register_driver failed (%i)\n",
 		       __FILE__, ret);
 		return ret;
-- 
1.5.3.5.726.g41a7a

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox