GPMC in device tree

2015-08-04 Thread Ran Shalit
Hello,

I would please like to ask if describing flash nor used with GPMC,
whould be done as described in:
https://www.kernel.org/doc/Documentation/devicetree/bindings/mtd/gpmc-nor.txt
It is described in the above link as "TI's GPMC", so I'm not sure if
it is relevent for powerpc too.

Thank you,
Ran
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: GPMC in device tree

2015-08-04 Thread Ran Shalit
On Tue, Aug 4, 2015 at 9:54 PM, Scott Wood  wrote:
> On Tue, 2015-08-04 at 18:29 +0300, Ran Shalit wrote:
>> Hello,
>>
>> I would please like to ask if describing flash nor used with GPMC,
>> whould be done as described in:
>> https://www.kernel.org/doc/Documentation/devicetree/bindings/mtd/gpmc-nor.txt
>> It is described in the above link as "TI's GPMC", so I'm not sure if
>> it is relevent for powerpc too.
>
> That binding is for TI GPMC.
>
> Are you saying you have some PPC chip that has a flash controller called GPMC?
>
> -Scott
>

Hi Scott,

Thanks, I've worked with TI's chips, so I now understand that I made
here some confusion...
It is GPCM , not GPMC, my mistake.
We already configured it in u-boot, but on doing read/write from
kernel it doesn not work.
It seems that for the linux to use the correct driver, we need to
define the nor in the device tree.
Is there any example how to define nor GPCM in device tree ? Is it
possible not to override the existing GPCM configuration ?

Thank you!
Ran
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: GPMC in device tree

2015-08-04 Thread Ran Shalit
On Tue, Aug 4, 2015 at 11:31 PM, Scott Wood  wrote:
> On Tue, 2015-08-04 at 23:26 +0300, Ran Shalit wrote:
>> On Tue, Aug 4, 2015 at 9:54 PM, Scott Wood  wrote:
>> > On Tue, 2015-08-04 at 18:29 +0300, Ran Shalit wrote:
>> > > Hello,
>> > >
>> > > I would please like to ask if describing flash nor used with GPMC,
>> > > whould be done as described in:
>> > > https://www.kernel.org/doc/Documentation/devicetree/bindings/mtd/gpmc-nor.txt
>> > > It is described in the above link as "TI's GPMC", so I'm not sure if
>> > > it is relevent for powerpc too.
>> >
>> > That binding is for TI GPMC.
>> >
>> > Are you saying you have some PPC chip that has a flash controller called
>> > GPMC?
>> >
>> > -Scott
>> >
>>
>> Hi Scott,
>>
>> Thanks, I've worked with TI's chips, so I now understand that I made
>> here some confusion...
>> It is GPCM , not GPMC, my mistake.
>> We already configured it in u-boot, but on doing read/write from
>> kernel it doesn not work.
>> It seems that for the linux to use the correct driver, we need to
>> define the nor in the device tree.
>> Is there any example how to define nor GPCM in device tree ? Is it
>> possible not to override the existing GPCM configuration ?
>
> Pretty much all of the mpc8xxx/qoriq device trees have GPCM NOR defined.  See
> Documentation/devicetree/bindings/powerpc/fsl/lbc.txt and examples such as
> arch/powerpc/boot/dts/p4080ds.dts (part of the lbc node is in
> arch/powerpc/boot/dts/fsl/p4080si-post.dtsi).
>
> Linux will not change the GPCM configuration.
>
> -Scott
>

On more thing, if I may.
The localbus is also connected to nvram & cpld.
I've noticed that read/write works well, even though I didn't define
anything in device tree.
Is there any reasom to add these devices into device tree, or can we
use the cpld and nvram without the definition in device tree ?

Thanks,
Ran
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: GPMC in device tree

2015-08-04 Thread Ran Shalit
On Wed, Aug 5, 2015 at 12:25 AM, Scott Wood  wrote:
> On Wed, 2015-08-05 at 00:22 +0300, Ran Shalit wrote:
>> On Tue, Aug 4, 2015 at 11:31 PM, Scott Wood  wrote:
>> > On Tue, 2015-08-04 at 23:26 +0300, Ran Shalit wrote:
>> > > On Tue, Aug 4, 2015 at 9:54 PM, Scott Wood 
>> > > wrote:
>> > > > On Tue, 2015-08-04 at 18:29 +0300, Ran Shalit wrote:
>> > > > > Hello,
>> > > > >
>> > > > > I would please like to ask if describing flash nor used with GPMC,
>> > > > > whould be done as described in:
>> > > > > https://www.kernel.org/doc/Documentation/devicetree/bindings/mtd/gpmc-nor.txt
>> > > > > It is described in the above link as "TI's GPMC", so I'm not sure if
>> > > > > it is relevent for powerpc too.
>> > > >
>> > > > That binding is for TI GPMC.
>> > > >
>> > > > Are you saying you have some PPC chip that has a flash controller
>> > > > called
>> > > > GPMC?
>> > > >
>> > > > -Scott
>> > > >
>> > >
>> > > Hi Scott,
>> > >
>> > > Thanks, I've worked with TI's chips, so I now understand that I made
>> > > here some confusion...
>> > > It is GPCM , not GPMC, my mistake.
>> > > We already configured it in u-boot, but on doing read/write from
>> > > kernel it doesn not work.
>> > > It seems that for the linux to use the correct driver, we need to
>> > > define the nor in the device tree.
>> > > Is there any example how to define nor GPCM in device tree ? Is it
>> > > possible not to override the existing GPCM configuration ?
>> >
>> > Pretty much all of the mpc8xxx/qoriq device trees have GPCM NOR defined.
>> > See
>> > Documentation/devicetree/bindings/powerpc/fsl/lbc.txt and examples such as
>> > arch/powerpc/boot/dts/p4080ds.dts (part of the lbc node is in
>> > arch/powerpc/boot/dts/fsl/p4080si-post.dtsi).
>> >
>> > Linux will not change the GPCM configuration.
>> >
>> > -Scott
>> >
>>
>> On more thing, if I may.
>> The localbus is also connected to nvram & cpld.
>> I've noticed that read/write works well, even though I didn't define
>> anything in device tree.
>> Is there any reasom to add these devices into device tree, or can we
>> use the cpld and nvram without the definition in device tree ?
>
> I don't know what you're doing in your kernel to access devices that aren't
> in the device tree.  You should add the devices to the device tree, and have
> the kernel use it rather than hardcoded info.
>
> -Scott
>
Hi,

Yes I understand.
But It is worse noting that I have no localbus entry in the device tree.
Yes, The nvram, cpld which are both connected to device tree, seems to
work without any issues.

Thanks,
Ran
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: GPMC in device tree

2015-08-04 Thread Ran Shalit
On Wed, Aug 5, 2015 at 6:56 AM, Ran Shalit  wrote:
> On Wed, Aug 5, 2015 at 12:25 AM, Scott Wood  wrote:
>> On Wed, 2015-08-05 at 00:22 +0300, Ran Shalit wrote:
>>> On Tue, Aug 4, 2015 at 11:31 PM, Scott Wood  wrote:
>>> > On Tue, 2015-08-04 at 23:26 +0300, Ran Shalit wrote:
>>> > > On Tue, Aug 4, 2015 at 9:54 PM, Scott Wood 
>>> > > wrote:
>>> > > > On Tue, 2015-08-04 at 18:29 +0300, Ran Shalit wrote:
>>> > > > > Hello,
>>> > > > >
>>> > > > > I would please like to ask if describing flash nor used with GPMC,
>>> > > > > whould be done as described in:
>>> > > > > https://www.kernel.org/doc/Documentation/devicetree/bindings/mtd/gpmc-nor.txt
>>> > > > > It is described in the above link as "TI's GPMC", so I'm not sure if
>>> > > > > it is relevent for powerpc too.
>>> > > >
>>> > > > That binding is for TI GPMC.
>>> > > >
>>> > > > Are you saying you have some PPC chip that has a flash controller
>>> > > > called
>>> > > > GPMC?
>>> > > >
>>> > > > -Scott
>>> > > >
>>> > >
>>> > > Hi Scott,
>>> > >
>>> > > Thanks, I've worked with TI's chips, so I now understand that I made
>>> > > here some confusion...
>>> > > It is GPCM , not GPMC, my mistake.
>>> > > We already configured it in u-boot, but on doing read/write from
>>> > > kernel it doesn not work.
>>> > > It seems that for the linux to use the correct driver, we need to
>>> > > define the nor in the device tree.
>>> > > Is there any example how to define nor GPCM in device tree ? Is it
>>> > > possible not to override the existing GPCM configuration ?
>>> >
>>> > Pretty much all of the mpc8xxx/qoriq device trees have GPCM NOR defined.
>>> > See
>>> > Documentation/devicetree/bindings/powerpc/fsl/lbc.txt and examples such as
>>> > arch/powerpc/boot/dts/p4080ds.dts (part of the lbc node is in
>>> > arch/powerpc/boot/dts/fsl/p4080si-post.dtsi).
>>> >
>>> > Linux will not change the GPCM configuration.
>>> >
>>> > -Scott
>>> >
>>>
>>> On more thing, if I may.
>>> The localbus is also connected to nvram & cpld.
>>> I've noticed that read/write works well, even though I didn't define
>>> anything in device tree.
>>> Is there any reasom to add these devices into device tree, or can we
>>> use the cpld and nvram without the definition in device tree ?
>>
>> I don't know what you're doing in your kernel to access devices that aren't
>> in the device tree.  You should add the devices to the device tree, and have
>> the kernel use it rather than hardcoded info.
>>
>> -Scott
>>
> Hi,
>
> Yes I understand.
> But It is worse noting that I have no localbus entry in the device tree.
> Yes, The nvram, cpld which are both connected to device tree, seems to
> work without any issues.
>
> Thanks,
> Ran

I apologyze for the bad english, I meant "it worth to note" that there
is no localbus entry at all in the device tree.
So I wander how the nvram and cpld worked...
If I may please ask, what should be the "compatible" for generic
devices such as  nvram/cpld ?
I assume that if they worked without any entry, it means that there is
no need for specific driver.

Regards,
Ran
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: GPMC in device tree

2015-08-05 Thread Ran Shalit
On Wed, Aug 5, 2015 at 9:11 AM, Ran Shalit  wrote:
> On Wed, Aug 5, 2015 at 6:56 AM, Ran Shalit  wrote:
>> On Wed, Aug 5, 2015 at 12:25 AM, Scott Wood  wrote:
>>> On Wed, 2015-08-05 at 00:22 +0300, Ran Shalit wrote:
>>>> On Tue, Aug 4, 2015 at 11:31 PM, Scott Wood  
>>>> wrote:
>>>> > On Tue, 2015-08-04 at 23:26 +0300, Ran Shalit wrote:
>>>> > > On Tue, Aug 4, 2015 at 9:54 PM, Scott Wood 
>>>> > > wrote:
>>>> > > > On Tue, 2015-08-04 at 18:29 +0300, Ran Shalit wrote:
>>>> > > > > Hello,
>>>> > > > >
>>>> > > > > I would please like to ask if describing flash nor used with GPMC,
>>>> > > > > whould be done as described in:
>>>> > > > > https://www.kernel.org/doc/Documentation/devicetree/bindings/mtd/gpmc-nor.txt
>>>> > > > > It is described in the above link as "TI's GPMC", so I'm not sure 
>>>> > > > > if
>>>> > > > > it is relevent for powerpc too.
>>>> > > >
>>>> > > > That binding is for TI GPMC.
>>>> > > >
>>>> > > > Are you saying you have some PPC chip that has a flash controller
>>>> > > > called
>>>> > > > GPMC?
>>>> > > >
>>>> > > > -Scott
>>>> > > >
>>>> > >
>>>> > > Hi Scott,
>>>> > >
>>>> > > Thanks, I've worked with TI's chips, so I now understand that I made
>>>> > > here some confusion...
>>>> > > It is GPCM , not GPMC, my mistake.
>>>> > > We already configured it in u-boot, but on doing read/write from
>>>> > > kernel it doesn not work.
>>>> > > It seems that for the linux to use the correct driver, we need to
>>>> > > define the nor in the device tree.
>>>> > > Is there any example how to define nor GPCM in device tree ? Is it
>>>> > > possible not to override the existing GPCM configuration ?
>>>> >
>>>> > Pretty much all of the mpc8xxx/qoriq device trees have GPCM NOR defined.
>>>> > See
>>>> > Documentation/devicetree/bindings/powerpc/fsl/lbc.txt and examples such 
>>>> > as
>>>> > arch/powerpc/boot/dts/p4080ds.dts (part of the lbc node is in
>>>> > arch/powerpc/boot/dts/fsl/p4080si-post.dtsi).
>>>> >
>>>> > Linux will not change the GPCM configuration.
>>>> >
>>>> > -Scott
>>>> >
>>>>
>>>> On more thing, if I may.
>>>> The localbus is also connected to nvram & cpld.
>>>> I've noticed that read/write works well, even though I didn't define
>>>> anything in device tree.
>>>> Is there any reasom to add these devices into device tree, or can we
>>>> use the cpld and nvram without the definition in device tree ?
>>>
>>> I don't know what you're doing in your kernel to access devices that aren't
>>> in the device tree.  You should add the devices to the device tree, and have
>>> the kernel use it rather than hardcoded info.
>>>
>>> -Scott
>>>
>> Hi,
>>
>> Yes I understand.
>> But It is worse noting that I have no localbus entry in the device tree.
>> Yes, The nvram, cpld which are both connected to device tree, seems to
>> work without any issues.
>>
>> Thanks,
>> Ran
>
> I apologyze for the bad english, I meant "it worth to note" that there
> is no localbus entry at all in the device tree.
> So I wander how the nvram and cpld worked...
> If I may please ask, what should be the "compatible" for generic
> devices such as  nvram/cpld ?
> I assume that if they worked without any entry, it means that there is
> no need for specific driver.
>
> Regards,
> Ran

Hi,

After studing the localbus configuration as should be configured in
device tree for powerpc, I think I have come with the following
configuration, (not yet tested on board):


localbus@e0005000 {
#address-cells = <2>;
#size-cells = <1>;
compatible = "fsl,mpc8349-localbus", "simple-bus";
 reg = <0xe0005000 0x1000>;
 interrupts = <77 0x8>;
 interrupt-parent = <&ipic>;


/* NOR and NAND Flashes */
   ranges = <0x0 0x0 0xff80 0x0080 /* 8MB NOR Flash */

Re: GPMC in device tree

2015-08-08 Thread Ran Shalit
On Thu, Aug 6, 2015 at 6:07 AM, Scott Wood  wrote:
> On Wed, 2015-08-05 at 17:27 +0300, Ran Shalit wrote:
>> On Wed, Aug 5, 2015 at 9:11 AM, Ran Shalit  wrote:
>> > On Wed, Aug 5, 2015 at 6:56 AM, Ran Shalit  wrote:
>> > > On Wed, Aug 5, 2015 at 12:25 AM, Scott Wood 
>> > > wrote:
>> > > > On Wed, 2015-08-05 at 00:22 +0300, Ran Shalit wrote:
>> > > > > On more thing, if I may.
>> > > > > The localbus is also connected to nvram & cpld.
>> > > > > I've noticed that read/write works well, even though I didn't define
>> > > > > anything in device tree.
>> > > > > Is there any reasom to add these devices into device tree, or can we
>> > > > > use the cpld and nvram without the definition in device tree ?
>> > > >
>> > > > I don't know what you're doing in your kernel to access devices that
>> > > > aren't
>> > > > in the device tree.  You should add the devices to the device tree,
>> > > > and have
>> > > > the kernel use it rather than hardcoded info.
>> > > >
>> > > > -Scott
>> > > >
>> > > Hi,
>> > >
>> > > Yes I understand.
>> > > But It is worse noting that I have no localbus entry in the device tree.
>> > > Yes, The nvram, cpld which are both connected to device tree, seems to
>> > > work without any issues.
>> > >
>> > > Thanks,
>> > > Ran
>> >
>> > I apologyze for the bad english, I meant "it worth to note" that there
>> > is no localbus entry at all in the device tree.
>> > So I wander how the nvram and cpld worked...
>
> I don't know how it worked -- presumably there's something in your kernel
> that hardcodes knowledge of those devices.
>
>> > If I may please ask, what should be the "compatible" for generic
>> > devices such as  nvram/cpld ?
>
> CPLD is not a generic device.  The compatible should describe the logic that
> has been programmed into the CPLD.
>
>> > I assume that if they worked without any entry, it means that there is
>> > no need for specific driver.
>> >
>> > Regards,
>> > Ran
>>
>> Hi,
>>
>> After studing the localbus configuration as should be configured in
>> device tree for powerpc, I think I have come with the following
>> configuration, (not yet tested on board):
>>
>>
>>  localbus@e0005000{
>> #address-cells = <2>;
>> #size-cells = <1>;
>> compatible = "fsl,mpc8349-localbus", "simple-bus";
>>  reg = <0xe0005000 0x1000>;
>>  interrupts = <77 0x8>;
>>  interrupt-parent = <&ipic>;
>>
>>
>> /* NOR and NAND Flashes */
>>ranges = <0x0 0x0 0xff80 0x0080 /* 8MB NOR Flash */
>>  0x1 0x0 0xF800 0x0800  /* User flash (same
>> nor, in burst mode) 128M */
>>  0x2 0x0 0xf7e0 0x0020>;/*NVRAM/CPLD C2 is
>> selected in CPLD , */
>> /*nvram 0xf7e0 1MB */
>> /*cpld  0xf7f0 1M  (<- different address!)*/
>> nor@0,0 {
>> #address-cells = <1>;
>> #size-cells = <1>;
>> compatible = "cfi-flash";
>> reg = <0x0 0x0 0x100>;
>> #bank-width = <1>;
>> device-width = <4>;
>>
>> };
>> };
>

Hi ,

I reboot the board, with the new device tree localbus, but I don't
have any new /dev/mtdX entry for the NOR flash.
There is no HW issue, becuase we can R/W access the NOR flash from u-boot.
Is there any hint what can be the issue here ? I've checked in kernel
config and validated that mtd is supported.
The NOR flash is S29GL512P , SPANSION.

localbus@e0005000 {
#address-cells = <2>;
#size-cells = <1>;
   compatible = "fsl,mpc8349-localbus", "simple-bus";
reg = <0xe0005000 0x1000>;
interrupts = <77 0x8>;
interrupt-parent = <&ipic>;


# NOR and NAND Flashes
  ranges = <0x0 0x0 0xff80 0x0080
0x1 0x0 0xF800 0x0800
0x2 0x0 0xf7e0 0x0020>;
nor@0,0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "cfi-flash";
reg = <0x0 0x0 0x0080>;
#bank-width = <1>;
device-width = <1>;

};
};

Best Regards,
Ran
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: GPMC in device tree

2015-08-09 Thread Ran Shalit
On Sun, Aug 9, 2015 at 9:27 AM, Ran Shalit  wrote:
> On Thu, Aug 6, 2015 at 6:07 AM, Scott Wood  wrote:
>> On Wed, 2015-08-05 at 17:27 +0300, Ran Shalit wrote:
>>> On Wed, Aug 5, 2015 at 9:11 AM, Ran Shalit  wrote:
>>> > On Wed, Aug 5, 2015 at 6:56 AM, Ran Shalit  wrote:
>>> > > On Wed, Aug 5, 2015 at 12:25 AM, Scott Wood 
>>> > > wrote:
>>> > > > On Wed, 2015-08-05 at 00:22 +0300, Ran Shalit wrote:
>>> > > > > On more thing, if I may.
>>> > > > > The localbus is also connected to nvram & cpld.
>>> > > > > I've noticed that read/write works well, even though I didn't define
>>> > > > > anything in device tree.
>>> > > > > Is there any reasom to add these devices into device tree, or can we
>>> > > > > use the cpld and nvram without the definition in device tree ?
>>> > > >
>>> > > > I don't know what you're doing in your kernel to access devices that
>>> > > > aren't
>>> > > > in the device tree.  You should add the devices to the device tree,
>>> > > > and have
>>> > > > the kernel use it rather than hardcoded info.
>>> > > >
>>> > > > -Scott
>>> > > >
>>> > > Hi,
>>> > >
>>> > > Yes I understand.
>>> > > But It is worse noting that I have no localbus entry in the device tree.
>>> > > Yes, The nvram, cpld which are both connected to device tree, seems to
>>> > > work without any issues.
>>> > >
>>> > > Thanks,
>>> > > Ran
>>> >
>>> > I apologyze for the bad english, I meant "it worth to note" that there
>>> > is no localbus entry at all in the device tree.
>>> > So I wander how the nvram and cpld worked...
>>
>> I don't know how it worked -- presumably there's something in your kernel
>> that hardcodes knowledge of those devices.
>>
>>> > If I may please ask, what should be the "compatible" for generic
>>> > devices such as  nvram/cpld ?
>>
>> CPLD is not a generic device.  The compatible should describe the logic that
>> has been programmed into the CPLD.
>>
>>> > I assume that if they worked without any entry, it means that there is
>>> > no need for specific driver.
>>> >
>>> > Regards,
>>> > Ran
>>>
>>> Hi,
>>>
>>> After studing the localbus configuration as should be configured in
>>> device tree for powerpc, I think I have come with the following
>>> configuration, (not yet tested on board):
>>>
>>>
>>>  localbus@e0005000{
>>> #address-cells = <2>;
>>> #size-cells = <1>;
>>> compatible = "fsl,mpc8349-localbus", "simple-bus";
>>>  reg = <0xe0005000 0x1000>;
>>>  interrupts = <77 0x8>;
>>>  interrupt-parent = <&ipic>;
>>>
>>>
>>> /* NOR and NAND Flashes */
>>>ranges = <0x0 0x0 0xff80 0x0080 /* 8MB NOR Flash */
>>>  0x1 0x0 0xF800 0x0800  /* User flash (same
>>> nor, in burst mode) 128M */
>>>  0x2 0x0 0xf7e0 0x0020>;/*NVRAM/CPLD C2 is
>>> selected in CPLD , */
>>> /*nvram 0xf7e0 1MB */
>>> /*cpld  0xf7f0 1M  (<- different address!)*/
>>> nor@0,0 {
>>> #address-cells = <1>;
>>> #size-cells = <1>;
>>> compatible = "cfi-flash";
>>> reg = <0x0 0x0 0x100>;
>>> #bank-width = <1>;
>>> device-width = <4>;
>>>
>>> };
>>> };
>>
>
> Hi ,
>
> I reboot the board, with the new device tree localbus, but I don't
> have any new /dev/mtdX entry for the NOR flash.
> There is no HW issue, becuase we can R/W access the NOR flash from u-boot.
> Is there any hint what can be the issue here ? I've checked in kernel
> config and validated that mtd is supported.
> The NOR flash is S29GL512P , SPANSION.
>
> localbus@e0005000 {
> #address-cells = <2>;
> #size-cells = <1>;
>compatible = "fsl,mpc8349-localbus", "simple-bus";
> reg = <0xe0005000 0x1000>;
> interrupts = <77 0x8>;
> interrupt-parent = <&ipic>;
>
>
> # NOR and NAND Flashes
>   ranges = <0x0 0x0 0xff80 0x0080
> 0x1 0x0 0xF800 0x0800
> 0x2 0x0 0xf7e0 0x0020>;
> nor@0,0 {
> #address-cells = <1>;
> #size-cells = <1>;
> compatible = "cfi-flash";
> reg = <0x0 0x0 0x0080>;
> #bank-width = <1>;
> device-width = <1>;
>
> };
> };
>
> Best Regards,
> Ran

Hello,

Just to update,
I eventually solved this issue.
I don't do any configuration in device tree. All BRx configuration is
already done in u-boot (as was done from the start), and everything
seems to work OK: cpld, nvram.

For NOR FPGA I only added NOR configuration to kernel:

CONFIG_MTD_PHYSMAP=y
CONFIG_MTD_PHYSMAP_START=0xf800
CONFIG_MTD_PHYSMAP_LEN=0x780
CONFIG_MTD_PHYSMAP_BANKWIDTH=4

Thank you for the tips,
Ran
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

using general IRQs

2015-08-10 Thread Ran Shalit
Hello,

MPC8349 has general IRQ numbered 0-7,
It is required to bind these IRQs with some routine , i.e. they are
not used with any specific driver.

- Should they be configured as gpios in device tree so that we can use
the gpio as irq in linux ? Is there any example ?
- After configuration, can the gpios be used in linux using the
standard /sys/class/gpio ?

Regards,
Ran
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: using general IRQs

2015-08-10 Thread Ran Shalit
On Mon, Aug 10, 2015 at 10:48 AM, Ran Shalit  wrote:
> Hello,
>
> MPC8349 has general IRQ numbered 0-7,
> It is required to bind these IRQs with some routine , i.e. they are
> not used with any specific driver.
>
> - Should they be configured as gpios in device tree so that we can use
> the gpio as irq in linux ? Is there any example ?
> - After configuration, can the gpios be used in linux using the
> standard /sys/class/gpio ?
>
> Regards,
> Ran

I am trying to use only IRQ4, so I have tried to configure it as
following in device tree:

device tree:

  intc@0{
 compatible = "intc";
 #address-cells = <1>;
 #size-cells = <0>;
 reg = <0 0x1000>;
 interrupts = <4 0x8>;
  };

But I don't see IRQ4 listed in the interrupt list:
# cat /proc/interrupts
   CPU0
 16: 93  IPIC   9 Level serial
 18:  0  IPIC  14 Level i2c-mpc
 19:  0  IPIC  15 Level i2c-mpc
 21:  0  IPIC  18 Level phy_interrupt
 32:  0  IPIC  32 Level eth0_g0_tx
 33: 14  IPIC  33 Level eth0_g0_rx
 34:  0  IPIC  34 Level eth0_g0_er
 35:  0  IPIC  35 Level eth1_g0_tx
 36:  0  IPIC  36 Level eth1_g0_rx
 37:  0  IPIC  37 Level eth1_g0_er
LOC:  60756   Local timer interrupts for timer event device
LOC:  1   Local timer interrupts for others
SPU:  0   Spurious interrupts
PMI:  0   Performance monitoring interrupts
MCE:  0   Machine check exceptions


Regards,
Ran
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: using general IRQs

2015-08-10 Thread Ran Shalit
On Tue, Aug 11, 2015 at 5:29 AM, Scott Wood  wrote:
> On Mon, 2015-08-10 at 13:40 +0300, Ran Shalit wrote:
>> On Mon, Aug 10, 2015 at 10:48 AM, Ran Shalit  wrote:
>> > Hello,
>> >
>> > MPC8349 has general IRQ numbered 0-7,
>> > It is required to bind these IRQs with some routine , i.e. they are
>> > not used with any specific driver.
>> >
>> > - Should they be configured as gpios in device tree so that we can use
>> > the gpio as irq in linux ? Is there any example ?
>> > - After configuration, can the gpios be used in linux using the
>> > standard /sys/class/gpio ?
>> >
>> > Regards,
>> > Ran
>
> What do you mean by "general IRQ"?  Do you mean external IRQs?
>
>> I am trying to use only IRQ4, so I have tried to configure it as
>> following in device tree:
>>
>> device tree:
>>
>>   intc@0{
>>  compatible = "intc";
>>  #address-cells = <1>;
>>  #size-cells = <0>;
>>  reg = <0 0x1000>;
>>  interrupts = <4 0x8>;
>>   };
>>
>> But I don't see IRQ4 listed in the interrupt list:
>> # cat /proc/interrupts
>
> /proc/interrupts shows virtual interrupts, which do not necessarily
> correspond to anything in the device tree.  In particular, virtual interrupts
> under 16 are reserved for ISA interrupts, and thus any mpic interrupts in
> that range will be remapped.
>
> Additionally, putting an interrupt in the device tree does not make it show
> up in /proc/interrupts.  Only interrupts for which a driver has registered a
> handler will show up in /proc/interrupts.
>
> -Scott
>
>
Hi Scott,

I meant  external IRQ.
I am actually trying to use irq 4 interrupt.

I've added the above in device tree, and in kernel code I do:
np = of_find_node_by_name(NULL,"hello");
  if (np == NULL)
{
printk("Error node not found\n");
}
  printk("Node np = 0x%0x\n",np); <-- Node np = 0xdfffe2f0
  virq = irq_of_parse_and_map(np,0);

  printk(" VIRQ: %d \n" , virq);  <-- virq = 0 !!??
  if (0 > (error=request_irq(virq, &hello_IRQHandler, IRQF_SHARED,
"hello", &value))) {
  printk(KERN_WARNING"hello_IRQHandler: Init: Unable to allocate
IRQ error = %d\n\n", error);
return -1;
  <-- request_irq return -22 
  }


 But it fails in request_irq (it return -22).
Also, irq_of_parse_and_map(np,0) returns 0. I think it should have returned 4.

Regards,
Ran
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: using general IRQs

2015-08-10 Thread Ran Shalit
On Tue, Aug 11, 2015 at 6:47 AM, Scott Wood  wrote:
> On Tue, 2015-08-11 at 06:45 +0300, Ran Shalit wrote:
>> On Tue, Aug 11, 2015 at 5:29 AM, Scott Wood  wrote:
>> > On Mon, 2015-08-10 at 13:40 +0300, Ran Shalit wrote:
>> > > On Mon, Aug 10, 2015 at 10:48 AM, Ran Shalit 
>> > > wrote:
>> > > > Hello,
>> > > >
>> > > > MPC8349 has general IRQ numbered 0-7,
>> > > > It is required to bind these IRQs with some routine , i.e. they are
>> > > > not used with any specific driver.
>> > > >
>> > > > - Should they be configured as gpios in device tree so that we can use
>> > > > the gpio as irq in linux ? Is there any example ?
>> > > > - After configuration, can the gpios be used in linux using the
>> > > > standard /sys/class/gpio ?
>> > > >
>> > > > Regards,
>> > > > Ran
>> >
>> > What do you mean by "general IRQ"?  Do you mean external IRQs?
>> >
>> > > I am trying to use only IRQ4, so I have tried to configure it as
>> > > following in device tree:
>> > >
>> > > device tree:
>> > >
>> > >   intc@0{
>> > >  compatible = "intc";
>> > >  #address-cells = <1>;
>> > >  #size-cells = <0>;
>> > >  reg = <0 0x1000>;
>> > >  interrupts = <4 0x8>;
>> > >   };
>> > >
>> > > But I don't see IRQ4 listed in the interrupt list:
>> > > # cat /proc/interrupts
>> >
>> > /proc/interrupts shows virtual interrupts, which do not necessarily
>> > correspond to anything in the device tree.  In particular, virtual
>> > interrupts
>> > under 16 are reserved for ISA interrupts, and thus any mpic interrupts in
>> > that range will be remapped.
>> >
>> > Additionally, putting an interrupt in the device tree does not make it
>> > show
>> > up in /proc/interrupts.  Only interrupts for which a driver has
>> > registered a
>> > handler will show up in /proc/interrupts.
>> >
>> > -Scott
>> >
>> >
>> Hi Scott,
>>
>> I meant  external IRQ.
>> I am actually trying to use irq 4 interrupt.
>>
>> I've added the above in device tree, and in kernel code I do:
>> np = of_find_node_by_name(NULL,"hello");
>
> Why are you looking for a node named "hello" when your node is named "intc"?
I apologyze, this is the node I'm using

hello@0{
 compatible = "hello";
  #address-cells = <1>;
  #size-cells = <0>;
  reg = <0 0x1000>;
  interrupts = <4 0x8>;
};

>
>>   if (np == NULL)
>> {
>> printk("Error node not found\n");
>> }
>>   printk("Node np = 0x%0x\n",np); <-- Node np =
>> 0xdfffe2f0
>
> How could you possibly have gotten a non-NULL value for np, with the above
> code and node, unless there's something you're not showing?
You are right, The node is named hello in my device

>
>>   virq = irq_of_parse_and_map(np,0);
>>
>>   printk(" VIRQ: %d \n" , virq);  <-- virq = 0
>> !!??
>
> virq = 0 means the lookup failed.  Either there was no interrupt in the node,
> or it couldn't be mapped for some reason.
>
>>   if (0 > (error=request_irq(virq, &hello_IRQHandler, IRQF_SHARED,
>> "hello", &value))) {
>>   printk(KERN_WARNING"hello_IRQHandler: Init: Unable to allocate
>> IRQ error = %d\n\n", error);
>> return -1;
>>   <-- request_irq return -22 
>>   }
>>
>>
>>  But it fails in request_irq (it return -22).
>> Also, irq_of_parse_and_map(np,0) returns 0. I think it should have returned
>> 4.
>
> I already explained why it won't return 4 (see the part about virtual
> interrupts).

Thank you very much,
I now have success with the request_irq code.

Best Regards,
Ran
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

gdb with powerpc

2015-08-11 Thread Ran Shalit
Hello,

I would like to ask if anyone tried remote debugging with
gdb/gdbserver on powerpc.
I've tried to cross-compile gdb for powerpc, but I get into troubles.
I am using the following compiler:
powerpc-buildroot-linux-gnu-gcc (Buildroot 2014.11) 4.8.3

I've downloaded several version, gdb version 6 and above all have same
error as following:

gcc -c -g -O2-I. -I.././gdb -I.././gdb/config
-DLOCALEDIR="\"/home/tigran/gdb/share/locale\"" -DHAVE_CONFIG_H
-I.././gdb/../include/opcode -I.././gdb/../readline/.. -I../bfd
-I.././gdb/../bfd -I.././gdb/../include -I../intl -I.././gdb/../intl
-DMI_OUT=1 -DTUI=1 -Wimplicit -Wreturn-type -Wcomment -Wtrigraphs
-Wformat -Wparentheses -Wpointer-arith -Wformat-nonliteral
-Wunused-label -Wunused-function -Wno-pointer-sign -Wuninitialized
ppc-linux-nat.c
ppc-linux-nat.c: In function ‘ppc_register_u_addr’:
ppc-linux-nat.c:186:47: error: ‘PT_R0’ undeclared (first use in this function)
 u_addr = ((regno - tdep->ppc_gp0_regnum + PT_R0) * wordsize);


Trying to compile older version 5.3 also fails in different way:

gcc -c -g -O2 -DDEFAULT_INLINE=PSIM_INLINE_LOCALS
-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN -DWITH_SMP=5
-DHAVE_TERMIOS_STRUCTURE -DHAVE_TERMIOS_CLINE -DHAVE_DEVZERO -I.
-I. -I./../../include -I../../bfd -I./../../bfd -I../../gdb
-I./../../gdb  -I./../../gdb/config -I./../../mmalloc -I../../intl
-I./../../intl support.c
In file included from cpu.h:25:0,
 from support.c:27:
./ppc-instructions: In function ‘convert_to_integer’:
idecode_fields.h:105:31: error: label at end of compound statement
 #define LABEL(dest)  XCONCAT4(label__,dest,__,MY_PREFIX)
   ^

As an alternative, Is anyone familiar with binary package with
gdb/gdbserver for powerpc used with x86 host ?

Best Regards,
Ran
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

IRQ handler is not called with external IRQ

2015-08-16 Thread Ran Shalit
Hello,


I have strange behaviour with external IRQ:
The registration on external IRQ is successful, but on simulating
interrupt the interrupt handler called.
It seems that the interrupt was received according to SEPNR which
shows that IRQ #2 interrupt is pending, but the handler was not
called.

These are the steps I done:

1. in DTS (using all external IRQ #2):

  intc2@0{
  compatible = "intc2";
   #address-cells = <1>;
   #size-cells = <0>;
   reg = <0 0x1000>;
   interrupts = <2 0x8> ;
   interrupt-parent = <&ipic>;
  };

2. registration in kernel for all interrupts:

  np = of_find_node_by_name(NULL,"intc2");
  if (np == NULL)
  {
  printk("Error node not found\n");
  }
 printk("Node np = 0x%0x\n",np);
 virq = irq_of_parse_and_map(np,0);
 printk(KERN_INFO"IRQHandler: ISR Setup VIRQ: %d \n" , virq);
 if (0 > (error=request_irq(virq, &IRQHandler, 0, "intc2", &value))) {
 printk(KERN_WARNING"IRQHandler: Init: Unable to allocate IRQ
error = %d\n\n", error);
 return -1;
  }


3. interrupt handler code:

int newval = 0;
static irqreturn_t hello_IRQHandler(int irq, void *dev_id)
{
 unsigned int status;
 struct timespec curr_tm;
 printk("key_irq!\n");
 return IRQ_HANDLED;
}

4. in boot I get print which show success with request_irq():

intc_init
Node np = 0xdfffe288
IRQHandler: ISR Setup VIRQ: 22
NET: Registered protocol family 17

5. forcing interrupt in IRQ #2, or #4 result in SEPNR change, but
there is no printing from interrupt handler

6. validation in SEPNR register that interrupt was received:

# devmem2 0xe72c
/dev/mem opened.
Memory mapped at address 0xb7b8.
Value at address 0xE72C (0xb7b8072c): 0x2000


Thank you for any suggestion,

Ran
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: IRQ handler is not called with external IRQ

2015-08-17 Thread Ran Shalit
On Mon, Aug 17, 2015 at 8:24 AM, Ran Shalit  wrote:
> Hello,
>
>
> I have strange behaviour with external IRQ:
> The registration on external IRQ is successful, but on simulating
> interrupt the interrupt handler called.
> It seems that the interrupt was received according to SEPNR which
> shows that IRQ #2 interrupt is pending, but the handler was not
> called.
>
> These are the steps I done:
>
> 1. in DTS (using all external IRQ #2):
>
>   intc2@0{
>   compatible = "intc2";
>#address-cells = <1>;
>#size-cells = <0>;
>reg = <0 0x1000>;
>interrupts = <2 0x8> ;
>interrupt-parent = <&ipic>;
>   };
>
> 2. registration in kernel for all interrupts:
>
>   np = of_find_node_by_name(NULL,"intc2");
>   if (np == NULL)
>   {
>   printk("Error node not found\n");
>   }
>  printk("Node np = 0x%0x\n",np);
>  virq = irq_of_parse_and_map(np,0);
>  printk(KERN_INFO"IRQHandler: ISR Setup VIRQ: %d \n" , virq);
>  if (0 > (error=request_irq(virq, &IRQHandler, 0, "intc2", &value))) {
>  printk(KERN_WARNING"IRQHandler: Init: Unable to allocate IRQ
> error = %d\n\n", error);
>  return -1;
>   }
>
>
> 3. interrupt handler code:
>
> int newval = 0;
> static irqreturn_t hello_IRQHandler(int irq, void *dev_id)
> {
>  unsigned int status;
>  struct timespec curr_tm;
>  printk("key_irq!\n");
>  return IRQ_HANDLED;
> }
>
> 4. in boot I get print which show success with request_irq():
>
> intc_init
> Node np = 0xdfffe288
> IRQHandler: ISR Setup VIRQ: 22
> NET: Registered protocol family 17
>
> 5. forcing interrupt in IRQ #2, or #4 result in SEPNR change, but
> there is no printing from interrupt handler
>
> 6. validation in SEPNR register that interrupt was received:
>
> # devmem2 0xe72c
> /dev/mem opened.
> Memory mapped at address 0xb7b8.
> Value at address 0xE72C (0xb7b8072c): 0x2000
>
>
> Thank you for any suggestion,
>
> Ran

The issue been resolved after changing device tree interrupt numbers
according to  Table 8-6 in reference manual.
Thank you very much for the feedbacks.


Regards,

Ran
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

floating-point

2015-09-08 Thread Ran Shalit
Hello,

Is floating point should be supported by default in kernel.
I see that I can't use floating point in application, although kernel
is configured with CONFIG_PPC_FPU
Does kernel required any additional configurations for floating-point?


Regards,
Ran
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

use interrupt without clearing ?

2015-10-11 Thread Ran Shalit
Hello,

Is it possible to register an interrupt (in linux), without using the
automatic clear of interrupt.
I need this just for testing.

Regards,
Ran
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: use interrupt without clearing ?

2015-10-12 Thread Ran Shalit
On Mon, Oct 12, 2015 at 5:53 AM, Michael Ellerman  wrote:
> On Sun, 2015-10-11 at 15:13 +0300, Ran Shalit wrote:
>> Hello,
>>
>> Is it possible to register an interrupt (in linux), without using the
>> automatic clear of interrupt.
>> I need this just for testing.
>
> Hi Ran,
>
> You need to give us much more info than that before anyone will be able to
> answer your question. Linux runs on lots of different powerpc machines, so
> without knowing what hardware you're talking about it's impossible to
> answer.
>
> cheers
>
>

Hi,

The interrupt for external IRQ.
It is configured in device tree as following:


intc4@0{
compatible = "intc4";
 #address-cells = <1>;
 #size-cells = <0>;
 reg = <0 0x1000>;
 interrupts = <20 0x8> ;
 interrupt-parent = <&ipic>;
};

It works OK (with normal clearing of interrupt), but we need to
implement a testing requirement as following (startup BIT  testing):

1. an interrupt is given - and not being cleared automatically
2. need to validate that there is a pending interrupt
3. and then we can clear the interrupt and restore the mechnism to its
normal usage (automatic cleari of interrupt)

Regards,
Ran
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev