linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [POWERPC] Enable correct operation of serial ports with nonzero regshift.
@ 2008-02-13 21:19 Pavel Kiryukhin
  2008-02-14  3:56 ` Kumar Gala
  2008-02-14 18:55 ` [PATCH] [POWERPC] Enable correct operation of serial ports withnonzero regshift Stephen Neuendorffer
  0 siblings, 2 replies; 7+ messages in thread
From: Pavel Kiryukhin @ 2008-02-13 21:19 UTC (permalink / raw)
  To: linuxppc-dev

Add regshift reading to serial drivers.
This enables correct operation of serial ports with nonzero regshift.

Signed-off-by: Pavel Kiryukhin <pkiryukhin@ru.mvista.com>
---
 arch/powerpc/kernel/legacy_serial.c |    6 +++++-
 drivers/serial/of_serial.c          |    6 ++++--
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c
index 61dd174..74bd1f3 100644
--- a/arch/powerpc/kernel/legacy_serial.c
+++ b/arch/powerpc/kernel/legacy_serial.c
@@ -50,7 +50,7 @@ static int __init add_legacy_port(struct device_node *np, int want_index,
 				  phys_addr_t taddr, unsigned long irq,
 				  upf_t flags, int irq_check_parent)
 {
-	const u32 *clk, *spd;
+	const u32 *clk, *spd, *regshift;
 	u32 clock = BASE_BAUD * 16;
 	int index;
 
@@ -62,6 +62,9 @@ static int __init add_legacy_port(struct device_node *np, int want_index,
 	/* get default speed if present */
 	spd = of_get_property(np, "current-speed", NULL);
 
+	/* get regshift if present*/
+	regshift = get_property(np, "reg-shift", NULL);
+
 	/* If we have a location index, then try to use it */
 	if (want_index >= 0 && want_index < MAX_LEGACY_SERIAL_PORTS)
 		index = want_index;
@@ -104,6 +107,7 @@ static int __init add_legacy_port(struct device_node *np, int want_index,
 	legacy_serial_ports[index].uartclk = clock;
 	legacy_serial_ports[index].irq = irq;
 	legacy_serial_ports[index].flags = flags;
+	legacy_serial_ports[index].regshift = regshift ? (u8)*regshift : 0;
 	legacy_serial_infos[index].taddr = taddr;
 	legacy_serial_infos[index].np = of_node_get(np);
 	legacy_serial_infos[index].clock = clock;
diff --git a/drivers/serial/of_serial.c b/drivers/serial/of_serial.c
index a64d858..ea9f1e4 100644
--- a/drivers/serial/of_serial.c
+++ b/drivers/serial/of_serial.c
@@ -30,7 +30,7 @@ static int __devinit of_platform_serial_setup(struct of_device *ofdev,
 {
 	struct resource resource;
 	struct device_node *np = ofdev->node;
-	const unsigned int *clk, *spd;
+	const unsigned int *clk, *spd, *regshift;
 	int ret;
 
 	memset(port, 0, sizeof *port);
@@ -40,7 +40,7 @@ static int __devinit of_platform_serial_setup(struct of_device *ofdev,
 		dev_warn(&ofdev->dev, "no clock-frequency property set\n");
 		return -ENODEV;
 	}
-
+	regshift = get_property(np, "reg-shift", NULL);
 	ret = of_address_to_resource(np, 0, &resource);
 	if (ret) {
 		dev_warn(&ofdev->dev, "invalid address\n");
@@ -57,6 +57,8 @@ static int __devinit of_platform_serial_setup(struct of_device *ofdev,
 		| UPF_FIXED_PORT;
 	port->dev = &ofdev->dev;
 	port->custom_divisor = *clk / (16 * (*spd));
+	if (regshift)
+		port->regshift = *regshift;
 
 	return 0;
 }
-- 
1.5.4.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] [POWERPC] Enable correct operation of serial ports with nonzero regshift.
  2008-02-13 21:19 [PATCH] [POWERPC] Enable correct operation of serial ports with nonzero regshift Pavel Kiryukhin
@ 2008-02-14  3:56 ` Kumar Gala
  2008-02-14  9:10   ` Pavel Kiryukhin
  2008-02-14 18:55 ` [PATCH] [POWERPC] Enable correct operation of serial ports withnonzero regshift Stephen Neuendorffer
  1 sibling, 1 reply; 7+ messages in thread
From: Kumar Gala @ 2008-02-14  3:56 UTC (permalink / raw)
  To: Pavel Kiryukhin; +Cc: linuxppc-dev


On Feb 13, 2008, at 3:19 PM, Pavel Kiryukhin wrote:

> Add regshift reading to serial drivers.
> This enables correct operation of serial ports with nonzero regshift.

what device needs this?

- k

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] [POWERPC] Enable correct operation of serial ports with nonzero regshift.
  2008-02-14  3:56 ` Kumar Gala
@ 2008-02-14  9:10   ` Pavel Kiryukhin
  2008-02-14 14:28     ` Kumar Gala
  0 siblings, 1 reply; 7+ messages in thread
From: Pavel Kiryukhin @ 2008-02-14  9:10 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev

Kumar Gala wrote:
> 
> On Feb 13, 2008, at 3:19 PM, Pavel Kiryukhin wrote:
> 
>> Add regshift reading to serial drivers.
>> This enables correct operation of serial ports with nonzero regshift.
> 
> what device needs this?
> 
> - k

Xilinx opb 16550 uart

--
Pavel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] [POWERPC] Enable correct operation of serial ports with nonzero regshift.
  2008-02-14  9:10   ` Pavel Kiryukhin
@ 2008-02-14 14:28     ` Kumar Gala
  0 siblings, 0 replies; 7+ messages in thread
From: Kumar Gala @ 2008-02-14 14:28 UTC (permalink / raw)
  To: Pavel Kiryukhin; +Cc: linuxppc-dev


On Feb 14, 2008, at 3:10 AM, Pavel Kiryukhin wrote:

> Kumar Gala wrote:
>>
>> On Feb 13, 2008, at 3:19 PM, Pavel Kiryukhin wrote:
>>
>>> Add regshift reading to serial drivers.
>>> This enables correct operation of serial ports with nonzero  
>>> regshift.
>>
>> what device needs this?
>>
>> - k
>
> Xilinx opb 16550 uart

please add that info to the commit message so we know why this change  
was made.  Other it looks ok to me.

- k

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH] [POWERPC] Enable correct operation of serial ports withnonzero regshift.
  2008-02-13 21:19 [PATCH] [POWERPC] Enable correct operation of serial ports with nonzero regshift Pavel Kiryukhin
  2008-02-14  3:56 ` Kumar Gala
@ 2008-02-14 18:55 ` Stephen Neuendorffer
  2008-02-14 23:27   ` Stephen Rothwell
  1 sibling, 1 reply; 7+ messages in thread
From: Stephen Neuendorffer @ 2008-02-14 18:55 UTC (permalink / raw)
  To: Pavel Kiryukhin, linuxppc-dev


> --- a/arch/powerpc/kernel/legacy_serial.c
> +++ b/arch/powerpc/kernel/legacy_serial.c
> +	/* get regshift if present*/
> +	regshift =3D get_property(np, "reg-shift", NULL);

of_get_property, presumably?

--- a/drivers/serial/of_serial.c
+++ b/drivers/serial/of_serial.c
> +	regshift =3D get_property(np, "reg-shift", NULL);

ditto...

Otherwise,=20

Acked-by: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com>

Also, can you post a patch to the Xilinx portion of
booting-without-of.txt that has the device tree entries necessary to get
the uart to work?  (Since I happened to be tracking down what I assume
is the same issue when you posted the patch!)

Steve

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] [POWERPC] Enable correct operation of serial ports withnonzero regshift.
  2008-02-14 18:55 ` [PATCH] [POWERPC] Enable correct operation of serial ports withnonzero regshift Stephen Neuendorffer
@ 2008-02-14 23:27   ` Stephen Rothwell
  2008-02-14 23:33     ` Stephen Neuendorffer
  0 siblings, 1 reply; 7+ messages in thread
From: Stephen Rothwell @ 2008-02-14 23:27 UTC (permalink / raw)
  To: Stephen Neuendorffer; +Cc: linuxppc-dev, Pavel Kiryukhin

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

On Thu, 14 Feb 2008 10:55:31 -0800 "Stephen Neuendorffer" <stephen.neuendorffer@xilinx.com> wrote:
>
> > --- a/arch/powerpc/kernel/legacy_serial.c
> > +++ b/arch/powerpc/kernel/legacy_serial.c
> > +	/* get regshift if present*/
> > +	regshift = get_property(np, "reg-shift", NULL);
> 
> of_get_property, presumably?

Damn, how did I miss that?  :-)

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH] [POWERPC] Enable correct operation of serial ports withnonzero regshift.
  2008-02-14 23:27   ` Stephen Rothwell
@ 2008-02-14 23:33     ` Stephen Neuendorffer
  0 siblings, 0 replies; 7+ messages in thread
From: Stephen Neuendorffer @ 2008-02-14 23:33 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: linuxppc-dev, Pavel Kiryukhin


gcc knows better. :)

> -----Original Message-----
> From: Stephen Rothwell [mailto:sfr@canb.auug.org.au]
> Sent: Thursday, February 14, 2008 3:27 PM
> To: Stephen Neuendorffer
> Cc: Pavel Kiryukhin; linuxppc-dev@ozlabs.org
> Subject: Re: [PATCH] [POWERPC] Enable correct operation of serial
ports withnonzero regshift.
>=20
> On Thu, 14 Feb 2008 10:55:31 -0800 "Stephen Neuendorffer"
<stephen.neuendorffer@xilinx.com> wrote:
> >
> > > --- a/arch/powerpc/kernel/legacy_serial.c
> > > +++ b/arch/powerpc/kernel/legacy_serial.c
> > > +	/* get regshift if present*/
> > > +	regshift =3D get_property(np, "reg-shift", NULL);
> >
> > of_get_property, presumably?
>=20
> Damn, how did I miss that?  :-)
>=20
> --
> Cheers,
> Stephen Rothwell                    sfr@canb.auug.org.au
> http://www.canb.auug.org.au/~sfr/

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-02-14 23:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-13 21:19 [PATCH] [POWERPC] Enable correct operation of serial ports with nonzero regshift Pavel Kiryukhin
2008-02-14  3:56 ` Kumar Gala
2008-02-14  9:10   ` Pavel Kiryukhin
2008-02-14 14:28     ` Kumar Gala
2008-02-14 18:55 ` [PATCH] [POWERPC] Enable correct operation of serial ports withnonzero regshift Stephen Neuendorffer
2008-02-14 23:27   ` Stephen Rothwell
2008-02-14 23:33     ` Stephen Neuendorffer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).