linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Elbc device driver
@ 2013-10-08 14:06 Mercier Ivan
  2013-10-08 22:34 ` Scott Wood
  0 siblings, 1 reply; 7+ messages in thread
From: Mercier Ivan @ 2013-10-08 14:06 UTC (permalink / raw)
  To: linuxppc-dev

Hi,

I'm working on a powerpc qoriq p3041 and trying to communicate with a
device by elbc bus in gpmc mode.

I 've integrated CONFIG_FSL_LBC in Linux which provide the basic functions.

Now I'm wondering how can I do read and write operations on the
bus.Where is mapped my device?

Should I code .read and .write driver functions?How can I start?

How integrates my device in the device tree?



thanks a lot,

Ivan

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

* Re: Elbc device driver
  2013-10-08 14:06 Elbc device driver Mercier Ivan
@ 2013-10-08 22:34 ` Scott Wood
  2013-10-10 14:54   ` Mercier Ivan
  0 siblings, 1 reply; 7+ messages in thread
From: Scott Wood @ 2013-10-08 22:34 UTC (permalink / raw)
  To: Mercier Ivan; +Cc: linuxppc-dev

On Tue, 2013-10-08 at 16:06 +0200, Mercier Ivan wrote:
> Hi,
> 
> I'm working on a powerpc qoriq p3041 and trying to communicate with a
> device by elbc bus in gpmc mode.
> 
> I 've integrated CONFIG_FSL_LBC in Linux which provide the basic functions.
> 
> Now I'm wondering how can I do read and write operations on the
> bus.Where is mapped my device?

You'll need to use ioremap() or of_iomap() to map it.

> Should I code .read and .write driver functions?How can I start?
> 
> How integrates my device in the device tree?

See Documentation/devicetree/bindings/powerpc/fsl/lbc.txt and examples
such as "board-control" in various device trees.

-Scott

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

* Re: Elbc device driver
  2013-10-08 22:34 ` Scott Wood
@ 2013-10-10 14:54   ` Mercier Ivan
  2013-10-10 15:14     ` Scott Wood
  0 siblings, 1 reply; 7+ messages in thread
From: Mercier Ivan @ 2013-10-10 14:54 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev

Hi,
I've got a KERN_INFO msg: "fsl-lbc a3p400.11: failed to get memory
region" corresponding to my elbc device that I try to map.
                a3p400@3,0 {
                        compatible = "fsl,elbc";
                        reg = <0 0xe0000000 0x1000000>;
                };
The corresponding law on ELBC is 0xe0000000 ->0xf0000000.
I want to map my device on 0xe0000000 ->0xe8000000 as it has 16 adress bits.

Now the controler registers are properly set,but how do I map the device?

Thanks a lot





2013/10/9 Scott Wood <scottwood@freescale.com>:
> On Tue, 2013-10-08 at 16:06 +0200, Mercier Ivan wrote:
>> Hi,
>>
>> I'm working on a powerpc qoriq p3041 and trying to communicate with a
>> device by elbc bus in gpmc mode.
>>
>> I 've integrated CONFIG_FSL_LBC in Linux which provide the basic functions.
>>
>> Now I'm wondering how can I do read and write operations on the
>> bus.Where is mapped my device?
>
> You'll need to use ioremap() or of_iomap() to map it.
>
>> Should I code .read and .write driver functions?How can I start?
>>
>> How integrates my device in the device tree?
>
> See Documentation/devicetree/bindings/powerpc/fsl/lbc.txt and examples
> such as "board-control" in various device trees.
>
> -Scott
>
>
>

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

* Re: Elbc device driver
  2013-10-10 14:54   ` Mercier Ivan
@ 2013-10-10 15:14     ` Scott Wood
  2013-10-11 15:03       ` Mercier Ivan
  0 siblings, 1 reply; 7+ messages in thread
From: Scott Wood @ 2013-10-10 15:14 UTC (permalink / raw)
  To: Mercier Ivan; +Cc: linuxppc-dev

On Thu, 2013-10-10 at 16:54 +0200, Mercier Ivan wrote:
> Hi,
> I've got a KERN_INFO msg: "fsl-lbc a3p400.11: failed to get memory
> region" corresponding to my elbc device that I try to map.
>                 a3p400@3,0 {
>                         compatible = "fsl,elbc";
>                         reg = <0 0xe0000000 0x1000000>;
>                 };

The node name and unit address do not match the contents of the node.
The former describes a device that sits on the localbus, while the
latter has a compatible describes the localbus itself.  I don't know
what that reg is, but it doesn't match the unit address.

> The corresponding law on ELBC is 0xe0000000 ->0xf0000000.
> I want to map my device on 0xe0000000 ->0xe8000000 as it has 16 adress bits.
> 
> Now the controler registers are properly set,but how do I map the device?

Your eLBC node should look something like this (I'm assuming CCSR is at
0xffe000000, and that you actually meant 0x0e0000000 and not
0xfe0000000, though probably one of those assumptions is wrong):

	localbus@ffe124000 {
		compatible = "fsl,elbc", "simple-bus";
		reg = <0xf 0xfe124000 0 0x1000>;
		interrupts = <25 2 0 0>;
		#address-cells = <2>;
		#size-cells = <1>;

		ranges = <3 0 0 0xe0000000 0x08000000>;

		/* If at all possible, replace "a3p400" in the node name with
something generic */
		a3p400@3,0 {
			compatible = "something appropriate here";
			reg = <3 0 0x08000000>;
		};
	};

Note that at the dts level, you should be including
arch/powerpc/boot/dts/fsl/p3041-post.dtsi and thus your board dts would
only need to supply reg, ranges, and the a3p400 node (see
arch/powerpc/boot/dts/p3041ds.dts for an example).

-Scott

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

* Re: Elbc device driver
  2013-10-10 15:14     ` Scott Wood
@ 2013-10-11 15:03       ` Mercier Ivan
  2013-10-11 17:35         ` Scott Wood
  0 siblings, 1 reply; 7+ messages in thread
From: Mercier Ivan @ 2013-10-11 15:03 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev

Hi,
this should be correct (I'm using chip select 3 for this device)
        lbc: localbus@ffe124000 {
                reg = <0xf 0xfe124000 0 0x1000>;
                ranges = <3 0 0xf 0xe0000000 0x08000000>;

                a3p400{
                        #address-cells = <1>;
                        #size-cells = <1>;
                        compatible = "my_a3p_driver";
                        reg = <0x0 0x0 0x800000>;
                };
        };

yeah, I'm including p3041-post.dtsi.

so it I get it, I should code my driver doing basically:
{
        static u8 __iomem * a3p
        struct device_node *np;

         np = of_find_compatible_node(NULL, NULL, "my_a3p_driver");
        if (!np) {
                printk(KERN_CRIT "Could not find my_a3p_driver node\n");
                return;
        }

        a3p_bcsr = of_iomap(np, 0);
        of_node_put(np);

        if (!a3p_bcsr) {
                printk(KERN_CRIT "Could not remap BCSR\n");
                return;
        }
}

Thanks for your help Scott


2013/10/10 Scott Wood <scottwood@freescale.com>:
> On Thu, 2013-10-10 at 16:54 +0200, Mercier Ivan wrote:
>> Hi,
>> I've got a KERN_INFO msg: "fsl-lbc a3p400.11: failed to get memory
>> region" corresponding to my elbc device that I try to map.
>>                 a3p400@3,0 {
>>                         compatible = "fsl,elbc";
>>                         reg = <0 0xe0000000 0x1000000>;
>>                 };
>
> The node name and unit address do not match the contents of the node.
> The former describes a device that sits on the localbus, while the
> latter has a compatible describes the localbus itself.  I don't know
> what that reg is, but it doesn't match the unit address.
>
>> The corresponding law on ELBC is 0xe0000000 ->0xf0000000.
>> I want to map my device on 0xe0000000 ->0xe8000000 as it has 16 adress bits.
>>
>> Now the controler registers are properly set,but how do I map the device?
>
> Your eLBC node should look something like this (I'm assuming CCSR is at
> 0xffe000000, and that you actually meant 0x0e0000000 and not
> 0xfe0000000, though probably one of those assumptions is wrong):
>
>         localbus@ffe124000 {
>                 compatible = "fsl,elbc", "simple-bus";
>                 reg = <0xf 0xfe124000 0 0x1000>;
>                 interrupts = <25 2 0 0>;
>                 #address-cells = <2>;
>                 #size-cells = <1>;
>
>                 ranges = <3 0 0 0xe0000000 0x08000000>;
>
>                 /* If at all possible, replace "a3p400" in the node name with
> something generic */
>                 a3p400@3,0 {
>                         compatible = "something appropriate here";
>                         reg = <3 0 0x08000000>;
>                 };
>         };
>
> Note that at the dts level, you should be including
> arch/powerpc/boot/dts/fsl/p3041-post.dtsi and thus your board dts would
> only need to supply reg, ranges, and the a3p400 node (see
> arch/powerpc/boot/dts/p3041ds.dts for an example).
>
> -Scott
>
>
>

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

* Re: Elbc device driver
  2013-10-11 15:03       ` Mercier Ivan
@ 2013-10-11 17:35         ` Scott Wood
  2013-10-22  9:43           ` Mercier Ivan
  0 siblings, 1 reply; 7+ messages in thread
From: Scott Wood @ 2013-10-11 17:35 UTC (permalink / raw)
  To: Mercier Ivan; +Cc: linuxppc-dev

On Fri, 2013-10-11 at 17:03 +0200, Mercier Ivan wrote:
> Hi,
> this should be correct (I'm using chip select 3 for this device)
>         lbc: localbus@ffe124000 {
>                 reg = <0xf 0xfe124000 0 0x1000>;
>                 ranges = <3 0 0xf 0xe0000000 0x08000000>;
> 
>                 a3p400{
>                         #address-cells = <1>;
>                         #size-cells = <1>;
>                         compatible = "my_a3p_driver";
>                         reg = <0x0 0x0 0x800000>;
>                 };
>         };

Compatible describes the device, not the driver.  It takes the format
"vendor,device".  The node name, OTOH, is normally a generic description
of the device's functionality ("flash", "ethernet", "board-control",
etc).

You don't need #address-cells/#size-cells on the a3p400 node unless it
has child nodes with reg or ranges.

-Scott

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

* Re: Elbc device driver
  2013-10-11 17:35         ` Scott Wood
@ 2013-10-22  9:43           ` Mercier Ivan
  0 siblings, 0 replies; 7+ messages in thread
From: Mercier Ivan @ 2013-10-22  9:43 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev

Ok Scott,
now it works!
We had severals hardware problem.
Thanks for your help

2013/10/11 Scott Wood <scottwood@freescale.com>:
> On Fri, 2013-10-11 at 17:03 +0200, Mercier Ivan wrote:
>> Hi,
>> this should be correct (I'm using chip select 3 for this device)
>>         lbc: localbus@ffe124000 {
>>                 reg = <0xf 0xfe124000 0 0x1000>;
>>                 ranges = <3 0 0xf 0xe0000000 0x08000000>;
>>
>>                 a3p400{
>>                         #address-cells = <1>;
>>                         #size-cells = <1>;
>>                         compatible = "my_a3p_driver";
>>                         reg = <0x0 0x0 0x800000>;
>>                 };
>>         };
>
> Compatible describes the device, not the driver.  It takes the format
> "vendor,device".  The node name, OTOH, is normally a generic description
> of the device's functionality ("flash", "ethernet", "board-control",
> etc).
>
> You don't need #address-cells/#size-cells on the a3p400 node unless it
> has child nodes with reg or ranges.
>
> -Scott
>
>
>

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

end of thread, other threads:[~2013-10-22  9:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-08 14:06 Elbc device driver Mercier Ivan
2013-10-08 22:34 ` Scott Wood
2013-10-10 14:54   ` Mercier Ivan
2013-10-10 15:14     ` Scott Wood
2013-10-11 15:03       ` Mercier Ivan
2013-10-11 17:35         ` Scott Wood
2013-10-22  9:43           ` Mercier Ivan

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