LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: Jon Masters <jcm@redhat.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	leif.lindholm@linaro.org, grant.likely@linaro.org
Subject: Re: inverse mapping from a struct console to device
Date: Mon, 26 Jan 2015 20:50:57 +0000	[thread overview]
Message-ID: <20150126205056.GA17169@leverpostej> (raw)
In-Reply-To: <54C6984A.20501@redhat.com>

On Mon, Jan 26, 2015 at 07:40:58PM +0000, Jon Masters wrote:
> Hi Folks,
> 
> TLDR: I need a back reference from a console struct to its device. I
> can't see an easy way to do this right now without adding one?

I don't think that's quite what you need. All you need is to be able to
refer to the SPCR at serial probe time (more on that below), when you
should have the data you want.

> I've a quick question. I have prototype code that parses an ACPI table
> known as the SPCR (Serial Port Console Redirection - exists on both x86
> and ARM systems). It finds the correct serial device (but it's not a
> Linux specific DT-style solution so there's no "console=" parameter
> embedded in it or something)

In DT we have /chosen/stdout-path which offers analagous functionality.
It is independent of the command line, and has a standard set of
parameters (<baud>{<parity>{<bits>{<flow>}}}).

To make this work we check against the stdout-path when we register the
UART. Take a look at of_console check (called from uart_add_one_port).

Assuming your UART probing looks similar for ACPI, you can have an
analagous function that goes and checks uport->dev.acpi_dev_node against
entires in the SPCR, configuring the UART as required at this point at
registration time.

This requires that you parse the SPCR earlier, but presumably the SPCR
is simple enough that this is possible (no AML, for instance).

Is there some reason that approach is unworkable?

Mark.

  parent reply	other threads:[~2015-01-26 20:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-26 19:40 Jon Masters
2015-01-26 20:20 ` Greg KH
2015-01-27  3:16   ` Jon Masters
2015-01-26 20:50 ` Mark Rutland [this message]
2015-01-27  3:06   ` Jon Masters
2015-01-27 10:14     ` Mark Rutland
2015-01-27 11:54       ` Jon Masters
2015-01-27 12:30         ` Mark Rutland
2015-01-27 20:42           ` Jon Masters
2015-01-28 22:48             ` Peter Hurley

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=20150126205056.GA17169@leverpostej \
    --to=mark.rutland@arm.com \
    --cc=grant.likely@linaro.org \
    --cc=jcm@redhat.com \
    --cc=leif.lindholm@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: inverse mapping from a struct console to device' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).