* specifying two conflicting configs
@ 2012-07-24 9:34 Attila Kinali
[not found] ` <20120724113450.328c27430ebc4438d0048346-HB9FjVmMKa7tRgLqZ5aouw@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Attila Kinali @ 2012-07-24 9:34 UTC (permalink / raw)
To: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ
Hi,
I have here an embedded system where i use a serial port as SD Card
interface as well as SPI interface. I select what i want to use
by setting a GPIO pin high or low.
Currently i'm using two different dts files, one that specifies the
serial port as SD Card interface and one that specifies the serial
port as SPI interface.
Now i would like to merge them into one file so that i can select
which mode to use at runtime. The documentation gave me the impression
that this should be possible, but i was not able to figure out how
to do it.
Would someone be so kind and point me to the documentation/example
i've missed?
The current configuration i use is either:
ssp0: ssp@80010000 {
compatible = "fsl,imx23-mmc";
pinctrl-names = "default";
pinctrl-0 = <&mmc0_8bit_pins_a &mmc1_pins_fixup>;
bus-width = <8>;
status = "okay";
};
or:
ssp0: ssp@80010000 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "fsl,imx23-spi";
fsl,ssp-dma-channel = <1>;
pinctrl-names = "default";
pinctrl-0 = <&spi_pins_a>;
status = "okay";
};
Thanks in advance
Attila Kinali
--
It is upon moral qualities that a society is ultimately founded. All
the prosperity and technological sophistication in the world is of no
use without that foundation.
-- Miss Matheson, The Diamond Age, Neil Stephenson
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: specifying two conflicting configs
[not found] ` <20120724113450.328c27430ebc4438d0048346-HB9FjVmMKa7tRgLqZ5aouw@public.gmane.org>
@ 2012-07-25 3:48 ` David Gibson
[not found] ` <20120725034801.GB23430-MK4v0fQdeXQXU02nzanrWNbf9cGiqdzd@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: David Gibson @ 2012-07-25 3:48 UTC (permalink / raw)
To: Attila Kinali; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ
On Tue, Jul 24, 2012 at 11:34:50AM +0200, Attila Kinali wrote:
> Hi,
>
> I have here an embedded system where i use a serial port as SD Card
> interface as well as SPI interface. I select what i want to use
> by setting a GPIO pin high or low.
>
> Currently i'm using two different dts files, one that specifies the
> serial port as SD Card interface and one that specifies the serial
> port as SPI interface.
>
> Now i would like to merge them into one file so that i can select
> which mode to use at runtime. The documentation gave me the impression
> that this should be possible, but i was not able to figure out how
> to do it.
>
> Would someone be so kind and point me to the documentation/example
> i've missed?
>
> The current configuration i use is either:
>
> ssp0: ssp@80010000 {
> compatible = "fsl,imx23-mmc";
> pinctrl-names = "default";
> pinctrl-0 = <&mmc0_8bit_pins_a &mmc1_pins_fixup>;
> bus-width = <8>;
> status = "okay";
> };
>
> or:
>
> ssp0: ssp@80010000 {
> #address-cells = <1>;
> #size-cells = <0>;
> compatible = "fsl,imx23-spi";
> fsl,ssp-dma-channel = <1>;
> pinctrl-names = "default";
> pinctrl-0 = <&spi_pins_a>;
> status = "okay";
>
> };
So, Mitch may have better insights here, but my inclination would be
to do something like this:
ssp-mux@80010000 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "yourvendor,ssp-mux";
control-line = <&gpio 17>;
ranges = <0x0 0x80010000>;
ssp-mmc@0 {
compatible = "fsl,imx23-mmc";
/* ... */
status = "okay";
};
ssp-spi@1 {
compatible = "fsl,imx23-spi";
/* ... */
status = "disabled";
};
};
ranges would need tweaking depending on #size-cells of the parent and
the existing node reg properties, which you don't show.
A hackier, but possibly simpler alternative would be to simply include
both nodes, but have the one that's active by default marked status =
"okay" and the other marked status = "disabled". Platform specific
knowledge would then me needed to know that with the right gpio magic
the original one can be disabled and the other enabled.
--
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 [flat|nested] 4+ messages in thread
* Re: specifying two conflicting configs
[not found] ` <20120725034801.GB23430-MK4v0fQdeXQXU02nzanrWNbf9cGiqdzd@public.gmane.org>
@ 2012-07-26 0:53 ` Mitch Bradley
2012-07-27 3:05 ` Olof Johansson
1 sibling, 0 replies; 4+ messages in thread
From: Mitch Bradley @ 2012-07-26 0:53 UTC (permalink / raw)
To: David Gibson; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ
On 7/25/2012 11:48 AM, David Gibson wrote:
> On Tue, Jul 24, 2012 at 11:34:50AM +0200, Attila Kinali wrote:
>> Hi,
>>
>> I have here an embedded system where i use a serial port as SD Card
>> interface as well as SPI interface. I select what i want to use
>> by setting a GPIO pin high or low.
>>
>> Currently i'm using two different dts files, one that specifies the
>> serial port as SD Card interface and one that specifies the serial
>> port as SPI interface.
>>
>> Now i would like to merge them into one file so that i can select
>> which mode to use at runtime. The documentation gave me the impression
>> that this should be possible, but i was not able to figure out how
>> to do it.
>>
>> Would someone be so kind and point me to the documentation/example
>> i've missed?
>>
>> The current configuration i use is either:
>>
>> ssp0: ssp@80010000 {
>> compatible = "fsl,imx23-mmc";
>> pinctrl-names = "default";
>> pinctrl-0 = <&mmc0_8bit_pins_a &mmc1_pins_fixup>;
>> bus-width = <8>;
>> status = "okay";
>> };
>>
>> or:
>>
>> ssp0: ssp@80010000 {
>> #address-cells = <1>;
>> #size-cells = <0>;
>> compatible = "fsl,imx23-spi";
>> fsl,ssp-dma-channel = <1>;
>> pinctrl-names = "default";
>> pinctrl-0 = <&spi_pins_a>;
>> status = "okay";
>>
>> };
>
> So, Mitch may have better insights here, but my inclination would be
> to do something like this:
The example below looks okay to me, except for the
ranges property. It doesn't seem that the mux node
"passes through" the address space - because then
the @1 sub-device would have the address 8001001
>
> ssp-mux@80010000 {
> #address-cells = <1>;
> #size-cells = <0>;
> compatible = "yourvendor,ssp-mux";
> control-line = <&gpio 17>;
> ranges = <0x0 0x80010000>;
>
> ssp-mmc@0 {
> compatible = "fsl,imx23-mmc";
> /* ... */
> status = "okay";
> };
>
> ssp-spi@1 {
> compatible = "fsl,imx23-spi";
> /* ... */
> status = "disabled";
> };
> };
>
> ranges would need tweaking depending on #size-cells of the parent and
> the existing node reg properties, which you don't show.
>
> A hackier, but possibly simpler alternative would be to simply include
> both nodes, but have the one that's active by default marked status =
> "okay" and the other marked status = "disabled". Platform specific
> knowledge would then me needed to know that with the right gpio magic
> the original one can be disabled and the other enabled.
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: specifying two conflicting configs
[not found] ` <20120725034801.GB23430-MK4v0fQdeXQXU02nzanrWNbf9cGiqdzd@public.gmane.org>
2012-07-26 0:53 ` Mitch Bradley
@ 2012-07-27 3:05 ` Olof Johansson
1 sibling, 0 replies; 4+ messages in thread
From: Olof Johansson @ 2012-07-27 3:05 UTC (permalink / raw)
To: David Gibson; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ
On Tue, Jul 24, 2012 at 8:48 PM, David Gibson
<david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org> wrote:
> On Tue, Jul 24, 2012 at 11:34:50AM +0200, Attila Kinali wrote:
>> Hi,
>>
>> I have here an embedded system where i use a serial port as SD Card
>> interface as well as SPI interface. I select what i want to use
>> by setting a GPIO pin high or low.
>>
>> Currently i'm using two different dts files, one that specifies the
>> serial port as SD Card interface and one that specifies the serial
>> port as SPI interface.
>>
>> Now i would like to merge them into one file so that i can select
>> which mode to use at runtime. The documentation gave me the impression
>> that this should be possible, but i was not able to figure out how
>> to do it.
>>
>> Would someone be so kind and point me to the documentation/example
>> i've missed?
>>
>> The current configuration i use is either:
>>
>> ssp0: ssp@80010000 {
>> compatible = "fsl,imx23-mmc";
>> pinctrl-names = "default";
>> pinctrl-0 = <&mmc0_8bit_pins_a &mmc1_pins_fixup>;
>> bus-width = <8>;
>> status = "okay";
>> };
>>
>> or:
>>
>> ssp0: ssp@80010000 {
>> #address-cells = <1>;
>> #size-cells = <0>;
>> compatible = "fsl,imx23-spi";
>> fsl,ssp-dma-channel = <1>;
>> pinctrl-names = "default";
>> pinctrl-0 = <&spi_pins_a>;
>> status = "okay";
>>
>> };
>
> So, Mitch may have better insights here, but my inclination would be
> to do something like this:
>
> ssp-mux@80010000 {
> #address-cells = <1>;
> #size-cells = <0>;
> compatible = "yourvendor,ssp-mux";
> control-line = <&gpio 17>;
> ranges = <0x0 0x80010000>;
>
> ssp-mmc@0 {
> compatible = "fsl,imx23-mmc";
> /* ... */
> status = "okay";
> };
>
> ssp-spi@1 {
> compatible = "fsl,imx23-spi";
> /* ... */
> status = "disabled";
> };
> };
>
> ranges would need tweaking depending on #size-cells of the parent and
> the existing node reg properties, which you don't show.
>
> A hackier, but possibly simpler alternative would be to simply include
> both nodes, but have the one that's active by default marked status =
> "okay" and the other marked status = "disabled". Platform specific
> knowledge would then me needed to know that with the right gpio magic
> the original one can be disabled and the other enabled.
I think the missing piece for a bystander looking at this proposal
(besides Mitch' comment about ranges) is that the probing by the
kernel would stop at the mux level, and the driver binding on the mux
device would have the option of restarting tree walk on its children.
That means that the standard unmodified drivers can be used since the
selection is done outside of them.
-Olof
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-07-27 3:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-24 9:34 specifying two conflicting configs Attila Kinali
[not found] ` <20120724113450.328c27430ebc4438d0048346-HB9FjVmMKa7tRgLqZ5aouw@public.gmane.org>
2012-07-25 3:48 ` David Gibson
[not found] ` <20120725034801.GB23430-MK4v0fQdeXQXU02nzanrWNbf9cGiqdzd@public.gmane.org>
2012-07-26 0:53 ` Mitch Bradley
2012-07-27 3:05 ` Olof Johansson
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).