public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sshtylyov@ru•mvista.com>
To: John Linn <john.linn@xilinx•com>
Cc: linuxppc-dev@ozlabs•org
Subject: Re: [PATCH 2/3] [POWERPC][V3] Xilinx: of_serial support for Xilinx uart	16550.
Date: Thu, 03 Apr 2008 16:25:30 +0400	[thread overview]
Message-ID: <47F4CCBA.9060706@ru.mvista.com> (raw)
In-Reply-To: <20080402232213.5D87515B8067@mail37-sin.bigfish.com>

Hello.

John Linn wrote:

> The Xilinx 16550 uart core is not a standard 16550 because it uses
> word-based addressing rather than byte-based addressing. With
> additional properties it is compatible with the open firmware
> 'ns16550' compatible binding.

> This code updates the of_serial driver to handle the reg-offset
> and reg-shift properties to enable this core to be used.

> Signed-off-by: John Linn <john.linn@xilinx•com>
> ---

> diff --git a/drivers/serial/of_serial.c b/drivers/serial/of_serial.c
> index 2efb892..73c47a5 100644
> --- a/drivers/serial/of_serial.c
> +++ b/drivers/serial/of_serial.c
> @@ -31,7 +31,8 @@ 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;
> -	int ret;
> +	const u32 *prop;
> +	int ret, prop_size;
>  
>  	memset(port, 0, sizeof *port);
>  	spd = of_get_property(np, "current-speed", NULL);
> @@ -49,6 +50,17 @@ static int __devinit of_platform_serial_setup(struct of_device *ofdev,
>  
>  	spin_lock_init(&port->lock);
>  	port->mapbase = resource.start;
> +
> +	/* Check for shifted address mapping */
> +	prop = of_get_property(np, "reg-offset", &prop_size);
> +	if (prop && (prop_size == sizeof(u32)))
> +		port->mapbase += *prop;

    I disagree. That trick leads to I/O resource misaccounting/misreporting. 
You should teach 8250.c about the offset trick instead, just as it's been 
taught the shift trick in its time.

> +
> +	/* Check for registers offset within the devices address range */
> +	prop = of_get_property(np, "reg-shift", &prop_size);
> +	if (prop && (prop_size == sizeof(u32)))
> +		port->regshift = *prop;
> +
>  	port->irq = irq_of_parse_and_map(np, 0);
>  	port->iotype = UPIO_MEM;
>  	port->type = type;

WBR, Sergei

      parent reply	other threads:[~2008-04-03 12:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-02 23:22 [PATCH 2/3] [POWERPC][V3] Xilinx: of_serial support for Xilinx uart 16550 John Linn
2008-04-02 23:34 ` Arnd Bergmann
2008-04-03  2:43   ` Grant Likely
2008-04-03  4:16     ` Arnd Bergmann
2008-04-03 13:29       ` John Linn
2008-04-03 22:36       ` [PATCH 2/3] [POWERPC][V3] Xilinx: of_serial support for Xilinxuart 16550 Stephen Neuendorffer
2008-04-05 14:45       ` [PATCH 2/3] [POWERPC][V3] Xilinx: of_serial support for Xilinx uart 16550 Josh Boyer
2008-04-08  2:44         ` David Gibson
2008-04-03 12:25 ` Sergei Shtylyov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47F4CCBA.9060706@ru.mvista.com \
    --to=sshtylyov@ru$(echo .)mvista.com \
    --cc=john.linn@xilinx$(echo .)com \
    --cc=linuxppc-dev@ozlabs$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox