devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masahiro Yamada <yamada.masahiro@socionext.com>
To: Mark Rutland <mark.rutland@arm.com>
Cc: devicetree@vger.kernel.org, Pawel Moll <pawel.moll@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	arm@kernel.org, Kumar Gala <galak@codeaurora.org>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 1/4] bus: uniphier-system-bus: add UniPhier System Bus Controller driver
Date: Wed, 25 Nov 2015 01:54:16 +0900	[thread overview]
Message-ID: <CAK7LNAR_6qwVK9fNEAX-L_v1Z5cdGMU33bP75Rdtu5bdmid-3Q@mail.gmail.com> (raw)
In-Reply-To: <20151124115053.GB4108@leverpostej>

Hi Mark,


2015-11-24 20:50 GMT+09:00 Mark Rutland <mark.rutland@arm.com>:
> On Tue, Nov 24, 2015 at 06:39:19PM +0900, Masahiro Yamada wrote:
>> The UniPhier System Bus is an external bus where on-board devices are
>> connected to the UniPhier SoC.  This driver parses the "ranges"
>> property of the System Bus and set up the registers of the System Bus
>> Controller for the correct bus routing.
>
> Could you elaborate on why you need to do that?

In order to have access to the System Bus (external bus),
the System Bus Controller must be set up.


> What needs to be configured specifically?

The base address and the size of each bank (each chip select)
must be set to the registers of the controller.



> [...]
>
>> +The UniPhier System Bus is an external bus where on-board devices are connected
>> +to the UniPhier SoC.  It it a simple parallel bus with address, data, and some
>> +control signals.  It supports up to 8 banks (chip selects).
>> +
>> +Required properties for System Bus:
>> +- compatible: should be "socionext,uniphier-system-bus", "simple-bus".
>
> If the kernel has to perform setup of the bus, then it is not a
> "simple-bus".
>
> Configure the bus, then probe children. Don't use simple-bus jsut to get
> probing.

OK, I will fix in v2.



>> +- #address-cells: should be equal to or grater than 2.  The first cell is the
>
> s/grater/greater/

OK, thanks.


>> +  bank number (chip select).  The rest is the base address within the bank that
>> +  should be mapped onto the parent bus (usually AMBA).
>> +
>> +Optional properties for System Bus:
>> +- #size-cells: should be the same as that of the parent bus, if exists.  The
>> +  value of the parent bus is assumed, if not specified.
>
> This should be just as required as #address-cells, for consistency.

Will fix.


>> +
>> +
>> +UniPhier System Bus Controller
>> +------------------------------
>> +
>> +The UniPhier System Bus Controller is a hardware block with registers that
>> +controls the System Bus accessing; how each bank is mapped onto the parent bus,
>> +various timing parameters of the bus access, etc.
>> +
>> +Required properties for System Bus Controller:
>> +- compatible: should be "socionext,uniphier-system-bus-controller".
>> +- reg: offsets and lengths of the register sets for the device.  It should
>> +  contain 2 regions: base & control register, misc register, in this order.
>
> The example also has a system-bus phandle.

Actually, I was wondering which is better to describe the relation between
the bus and the controller,  phandle or compatible string..



> Is the "misc register" part of the bus controller, or is it a shared
> system controller?

It is a part of the bus controller, but used for another purpose.
(i.e. partly this is syscon.  I know this is strange, but it is
what the hardware developers designed.)



>> +Example
>> +-------
>> +     system_bus: system-bus {
>> +             compatible = "socionext,uniphier-system-bus", "simple-bus";
>> +             #address-cells = <2>;
>> +             #size-cells = <1>;
>> +             ranges = <1 0x00000000 0x42000000 0x02000000
>> +                       5 0x00000000 0x48000000 0x01000000>;
>> +
>> +             eth: ethernet@1,01f00000 {
>> +                     compatible = "smsc,lan9115";
>> +                     reg = <1 0x01f00000 0x1000>;
>> +                     phy-mode = "mii";
>> +                     reg-io-width = <4>;
>> +             };
>> +
>> +             serial: uart@5,00200000 {
>> +                     compatible = "ns16550a";
>> +                     reg = <5 0x00200000 0x20>;
>> +                     clock-frequency = <12288000>;
>> +                     reg-shift = <1>;
>> +             };
>> +     };
>> +
>> +     system-bus-controller@58c00000 {
>> +             compatible = "socionext,uniphier-system-bus-controller";
>> +             reg = <0x58c00000 0x400>, <0x59800000 0x2000>;
>> +             system-bus = <&system_bus>;
>> +     };
>
> Assuming that the controller and bus are 1-1 related, make this a single
> node. e.g.
>
> system-bus {
>         compatible = "socionext,uniphier-system-bus";
>         reg = <0x58c00000 0x400>, <0x59800000 0x2000>;
>         #address-cells = <2>;
>         #size-cells = <1>;
>         ranges = <1 0x00000000 0x42000000 0x02000000>,
>                  <5 0x00000000 0x48000000 0x01000000>;
>
>         ...
>         child nodes here
>         ...
>
> };

Hmm, make sense.  But, I prefer to reflect the hardware structure.

The range of System Bus is <0x40000000 0x10000000>.

The register of the System Bus Controller is
<0x58c00000 0x400>  (and <0x59800000 0x2000>)


The bus and its controller is different.


> [...]
>
>> +static int uniphier_sbc_probe(struct platform_device *pdev)
>> +{
>> +     struct device *dev = &pdev->dev;
>> +     struct uniphier_sbc_priv *priv;
>> +     struct resource *regs;
>> +     struct device_node *bus_np;
>> +     int child_addrc, addrc, sizec, bank;
>> +     u64 child_addr, addr, size;
>> +     const __be32 *ranges;
>> +     int rlen, rone, ret;
>> +
>> +     bus_np = of_find_compatible_node(NULL, NULL,
>> +                                      "socionext,uniphier-system-bus");
>
> This is broken if you ever have multiple instances.
>
> Either use a single node, or if there is a more complex relationship
> between busses and their controllers, describe that explicitly with
> phandles.


Probably, I will stick to phandle in v2.


Thanks,

-- 
Best Regards
Masahiro Yamada

  reply	other threads:[~2015-11-24 16:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-24  9:39 [PATCH 0/4] arm,arm64: uniphier: add a new driver, device tree updates Masahiro Yamada
2015-11-24  9:39 ` [PATCH 1/4] bus: uniphier-system-bus: add UniPhier System Bus Controller driver Masahiro Yamada
2015-11-24 11:50   ` Mark Rutland
2015-11-24 16:54     ` Masahiro Yamada [this message]
     [not found]       ` <CAK7LNAR_6qwVK9fNEAX-L_v1Z5cdGMU33bP75Rdtu5bdmid-3Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-11-24 17:38         ` Mark Rutland
2015-11-26  2:27           ` Masahiro Yamada
2015-11-24  9:39 ` [PATCH 2/4] ARM: dts: uniphier: add better-matching compatible string to extbus nodes Masahiro Yamada
2015-11-24  9:39 ` [PATCH 3/4] ARM: dts: uniphier: rename nodes from extbus to system-bus Masahiro Yamada
2015-11-24  9:39 ` [PATCH 4/4] arm64: dts: uniphier: add PH1-LD10 SoC/board support Masahiro Yamada
2015-11-26  2:30 ` [PATCH 0/4] arm, arm64: uniphier: add a new driver, device tree updates Masahiro Yamada
2015-12-12  0:12 ` [PATCH 0/4] arm,arm64: " Arnd Bergmann
2015-12-12  6:57   ` Masahiro Yamada

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=CAK7LNAR_6qwVK9fNEAX-L_v1Z5cdGMU33bP75Rdtu5bdmid-3Q@mail.gmail.com \
    --to=yamada.masahiro@socionext.com \
    --cc=arm@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=galak@codeaurora.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=pawel.moll@arm.com \
    --cc=robh+dt@kernel.org \
    /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
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;
as well as URLs for NNTP newsgroup(s).