LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v10 5/5] [powerpc] Fix up fsl-flexcan device tree binding.
From: Kumar Gala @ 2011-08-10 17:26 UTC (permalink / raw)
  To: Robin Holt
  Cc: socketcan-core@lists.berlios.de, Wood Scott-B07421,
	U Bhaskar-B22300, PPC list, netdev@vger.kernel.org
In-Reply-To: <20110810172040.GX4926@sgi.com>

>>>>>>> So the node names should be
>>>>>>> 		can@1c000 {
>>>>>>> 		can@1d000 {
>>>>>>> correct?
>>>>>>>=20
>>>>>> [Bhaskar] As there are two CAN controllers on P1010,So won't it =
be better
>>>>>> 	    to distinguish it by can0 and can1 instead by simple "can" ?
>>>>>=20
>>>>> It looks like the way to do that is to assign a label to those =
devices
>>>>> and then associate the label with an alias.  I have no idea how =
that
>>>>> works under the hood, but it is the way other files are set up.  =
Take a
>>>>> look at arch/powerpc/boot/dts/bamboo.dts for how they define the =
serial
>>>>> interfaces.
>>>>>=20
>>>>> Grant or Wolfgang, is that the right way to handle the concern =
about
>>>>> names or does it have no practical effect with the Linux kernel?
>>>>=20
>>>> It has not effect.  The label is just if you need to reference it =
via some other means.
>>>=20
>>> Does the alias have an effect?
>>=20
>> nope
>=20
> Then how does the device number get associated with a particular =
device

What do you mean by device number?

> and how is user-space ensured a consistent namespace?

that is left to udev rules.

- k=

^ permalink raw reply

* RE: union/struct representations for MAS Registers
From: David Laight @ 2011-08-10 17:25 UTC (permalink / raw)
  To: Jimi Xenidis, Kumar Gala; +Cc: Linuxppc-dev list
In-Reply-To: <B952E5AF-98EF-46CE-B30F-7E1EA55C33AC@pobox.com>

=20
> I have some and use them in some code, they represent ISA=20
> 2.06 MAVN=3D1 (version 2)
> Can I keep them?
> if so, should I put them somewhere useful to others?
>=20
> Examples:
> union mas1 {
> 	u32 _val;
> 	struct {
> 		u32 v:1;
> 		u32 iprot:1;
> 		u32 tid:14;
> 		u32 _reserved_1:2;
> 		u32 ind:1;
> 		u32 ts:1;
> 		u32 tsize:4;
> 		u32 _reserved_2:8;
> 	};
> };

Bitfields are rather non-portable, the compiler has a lot of choice
about how to align the bits in memory.
Their use to map anything physical is doomed to portabilily issues.

	David

^ permalink raw reply

* Re: union/struct representations for MAS Registers
From: Kumar Gala @ 2011-08-10 17:25 UTC (permalink / raw)
  To: Jimi Xenidis; +Cc: Linuxppc-dev list
In-Reply-To: <B952E5AF-98EF-46CE-B30F-7E1EA55C33AC@pobox.com>


On Aug 10, 2011, at 12:21 PM, Jimi Xenidis wrote:

> I have some and use them in some code, they represent ISA 2.06 MAVN=3D1 =
(version 2)
> Can I keep them?
> if so, should I put them somewhere useful to others?
>=20
> Examples:
> union mas1 {
> 	u32 _val;
> 	struct {
> 		u32 v:1;
> 		u32 iprot:1;
> 		u32 tid:14;
> 		u32 _reserved_1:2;
> 		u32 ind:1;
> 		u32 ts:1;
> 		u32 tsize:4;
> 		u32 _reserved_2:8;
> 	};
> };

Uugh, we really have avoided unions for such things and it would be nice =
to keep it that way.

- k=

^ permalink raw reply

* union/struct representations for MAS Registers
From: Jimi Xenidis @ 2011-08-10 17:21 UTC (permalink / raw)
  To: Kumar Gala; +Cc: Linuxppc-dev list

I have some and use them in some code, they represent ISA 2.06 MAVN=3D1 =
(version 2)
Can I keep them?
if so, should I put them somewhere useful to others?

Examples:
union mas1 {
	u32 _val;
	struct {
		u32 v:1;
		u32 iprot:1;
		u32 tid:14;
		u32 _reserved_1:2;
		u32 ind:1;
		u32 ts:1;
		u32 tsize:4;
		u32 _reserved_2:8;
	};
};

-jx

^ permalink raw reply

* Re: [PATCH v10 5/5] [powerpc] Fix up fsl-flexcan device tree binding.
From: Robin Holt @ 2011-08-10 17:20 UTC (permalink / raw)
  To: Kumar Gala
  Cc: Wood Scott-B07421, netdev@vger.kernel.org, U Bhaskar-B22300,
	socketcan-core@lists.berlios.de, Robin Holt, PPC list
In-Reply-To: <8C9817C6-735D-4B7C-A03B-5661C04C725A@kernel.crashing.org>

On Wed, Aug 10, 2011 at 12:17:45PM -0500, Kumar Gala wrote:
> 
> On Aug 10, 2011, at 12:16 PM, Robin Holt wrote:
> 
> > On Wed, Aug 10, 2011 at 11:53:15AM -0500, Kumar Gala wrote:
> >> 
> >> On Aug 10, 2011, at 11:00 AM, Robin Holt wrote:
> >> 
> >>> On Wed, Aug 10, 2011 at 02:36:20PM +0000, U Bhaskar-B22300 wrote:
> >>>> 
> >>>> 
> >>>>> -----Original Message-----
> >>>>> From: Robin Holt [mailto:holt@sgi.com]
> >>>>> Sent: Wednesday, August 10, 2011 7:46 PM
> >>>>> To: Wolfgang Grandegger
> >>>>> Cc: Robin Holt; Marc Kleine-Budde; U Bhaskar-B22300; Wood Scott-B07421;
> >>>>> netdev@vger.kernel.org; Kumar Gala; socketcan-core@lists.berlios.de; PPC
> >>>>> list
> >>>>> Subject: Re: [PATCH v10 5/5] [powerpc] Fix up fsl-flexcan device tree
> >>>>> binding.
> >>>>> 
> >>>>> On Wed, Aug 10, 2011 at 03:47:43PM +0200, Wolfgang Grandegger wrote:
> >>>>>> Hi Robin,
> >>>>>> 
> >>>>>> On 08/10/2011 05:06 AM, Robin Holt wrote:
> >>>>>>> In working with the socketcan developers, we have come to the
> >>>>>>> conclusion the Documentation...fsl-flexcan.txt device tree
> >>>>>>> documentation needs to be cleaned up.  The driver does not depend
> >>>>>>> upon any properties other
> >>>>>> 
> >>>>>> Your first sentence could be misleading. Please just describe what the
> >>>>>> patch does and why, something like:
> >>>>>> 
> >>>>>> "This patch cleans up the documentation of the device-tree binding for
> >>>>>> the Flexcan devices on Freescale's PowerPC and ARM cores. Extra
> >>>>>> properties are not needed as the frequency of the source clock is
> >>>>>> fixed..." and so on.
> >>>>> 
> >>>>> I borrowed heavily from your message. ;)
> >>>>> 
> >>>>>>> than the required properties so we are removing the file.
> >>>>>>> Additionally, the p1010*dts* files are not following the standard
> >>>>>>> for node naming in that they have a trailing -v1.0.
> >>>>>> 
> >>>>>>> Signed-off-by: Robin Holt <holt@sgi.com>
> >>>>>>> To: Marc Kleine-Budde <mkl@pengutronix.de>,
> >>>>>>> To: Wolfgang Grandegger <wg@grandegger.com>,
> >>>>>>> To: U Bhaskar-B22300 <B22300@freescale.com>
> >>>>>>> To: Scott Wood <scottwood@freescale.com>
> >>>>>>> Cc: socketcan-core@lists.berlios.de,
> >>>>>>> Cc: netdev@vger.kernel.org,
> >>>>>>> Cc: PPC list <linuxppc-dev@lists.ozlabs.org>
> >>>>>>> Cc: Kumar Gala <galak@kernel.crashing.org>
> >>>>>>> ---
> >>>>>>> .../devicetree/bindings/net/can/fsl-flexcan.txt    |   61 ----------
> >>>>> ----------
> >>>>>>> arch/powerpc/boot/dts/p1010rdb.dts                 |    8 ---
> >>>>>>> arch/powerpc/boot/dts/p1010si.dtsi                 |    8 +-
> >>>>>>> 3 files changed, 4 insertions(+), 73 deletions(-)  delete mode
> >>>>>>> 100644 Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
> >>>>>>> 
> >>>>>>> diff --git
> >>>>>>> a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
> >>>>>>> b/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
> >>>>>>> deleted file mode 100644
> >>>>>>> index 1a729f0..0000000
> >>>>>>> --- a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
> >>>>>>> +++ /dev/null
> >>>>>>> @@ -1,61 +0,0 @@
> >>>>>>> -CAN Device Tree Bindings
> >>>>>>> -------------------------
> >>>>>>> -2011 Freescale Semiconductor, Inc.
> >>>>>>> -
> >>>>>>> -fsl,flexcan-v1.0 nodes
> >>>>>>> ------------------------
> >>>>>>> -In addition to the required compatible-, reg- and
> >>>>>>> interrupt-properties, you can -also specify which clock source shall
> >>>>> be used for the controller.
> >>>>>>> -
> >>>>>>> -CPI Clock- Can Protocol Interface Clock
> >>>>>>> -	This CLK_SRC bit of CTRL(control register) selects the clock source
> >>>>> to
> >>>>>>> -	the CAN Protocol Interface(CPI) to be either the peripheral clock
> >>>>>>> -	(driven by the PLL) or the crystal oscillator clock. The selected
> >>>>> clock
> >>>>>>> -	is the one fed to the prescaler to generate the Serial Clock
> >>>>> (Sclock).
> >>>>>>> -	The PRESDIV field of CTRL(control register) controls a prescaler
> >>>>> that
> >>>>>>> -	generates the Serial Clock (Sclock), whose period defines the
> >>>>>>> -	time quantum used to compose the CAN waveform.
> >>>>>>> -
> >>>>>>> -Can Engine Clock Source
> >>>>>>> -	There are two sources for CAN clock
> >>>>>>> -	- Platform Clock  It represents the bus clock
> >>>>>>> -	- Oscillator Clock
> >>>>>>> -
> >>>>>>> -	Peripheral Clock (PLL)
> >>>>>>> -	--------------
> >>>>>>> -		     |
> >>>>>>> -		    ---------		      -------------
> >>>>>>> -		    |       |CPI Clock	      | Prescaler |       Sclock
> >>>>>>> -		    |       |---------------->| (1.. 256) |------------>
> >>>>>>> -		    ---------		      -------------
> >>>>>>> -                     |  |
> >>>>>>> -	--------------  ---------------------CLK_SRC
> >>>>>>> -	Oscillator Clock
> >>>>>>> -
> >>>>>>> -- fsl,flexcan-clock-source : CAN Engine Clock Source.This property
> >>>>> selects
> >>>>>>> -			     the peripheral clock. PLL clock is fed to the
> >>>>>>> -			     prescaler to generate the Serial Clock (Sclock).
> >>>>>>> -			     Valid values are "oscillator" and "platform"
> >>>>>>> -			     "oscillator": CAN engine clock source is
> >>>>> oscillator clock.
> >>>>>>> -			     "platform" The CAN engine clock source is the bus
> >>>>> clock
> >>>>>>> -		             (platform clock).
> >>>>>>> -
> >>>>>>> -- fsl,flexcan-clock-divider : for the reference and system clock, an
> >>>>> additional
> >>>>>>> -			      clock divider can be specified.
> >>>>>>> -- clock-frequency: frequency required to calculate the bitrate for
> >>>>> FlexCAN.
> >>>>>>> -
> >>>>>>> -Note:
> >>>>>>> -	- v1.0 of flexcan-v1.0 represent the IP block version for P1010
> >>>>> SOC.
> >>>>>>> -	- P1010 does not have oscillator as the Clock Source.So the default
> >>>>>>> -	  Clock Source is platform clock.
> >>>>>>> -Examples:
> >>>>>>> -
> >>>>>>> -	can0@1c000 {
> >>>>>>> -		compatible = "fsl,flexcan-v1.0";
> >>>>>>> -		reg = <0x1c000 0x1000>;
> >>>>>>> -		interrupts = <48 0x2>;
> >>>>>>> -		interrupt-parent = <&mpic>;
> >>>>>>> -		fsl,flexcan-clock-source = "platform";
> >>>>>>> -		fsl,flexcan-clock-divqider = <2>;
> >>>>>>> -		clock-frequency = <fixed by u-boot>;
> >>>>>>> -	};
> >>>>>> 
> >>>>>> Do we really want to drop the documentation for that binding. I think
> >>>>>> something like the following text would be still useful:
> >>>>>> 
> >>>>>> ------------------------
> >>>>>> Flexcan CAN contoller on Freescale's ARM and PowerPC processors
> >>>>>> 
> >>>>>> Required properties:
> >>>>>> 
> >>>>>> - compatible : Should be "fsl,flexcan" and optionally
> >>>>>>              "fsl,flexcan-<processor>"
> >>>>>> - reg : Offset and length of the register set for this device
> >>>>>> - interrupts : Interrupt tuple for this device
> >>>>>> 
> >>>>>> Example:
> >>>>>> 
> >>>>>> can@1c000 {
> >>>>>>         compatible = "fsl,p1010-flexcan", "fsl,flexcan";
> >>>>>>         reg = <0x1c000 0x1000>;
> >>>>>>         interrupts = <48 0x2>;
> >>>>>>         interrupt-parent = <&mpic>;
> >>>>>> };
> >>>>>> -------------------------
> >>>>> 
> >>>>> Done, except the
> >>>>>>         compatible = "fsl,p1010-flexcan", "fsl,flexcan";
> >>>>> 
> >>>>> line is
> >>>>> 	compatible = "fsl,flexcan", "fsl,flexcan-p1010";
> >>>>> 
> >>>>>> 
> >>>>>> What do you think?
> >>>>>> 
> >>>>>>> diff --git a/arch/powerpc/boot/dts/p1010rdb.dts
> >>>>>>> b/arch/powerpc/boot/dts/p1010rdb.dts
> >>>>>>> index 6b33b73..d6a0bb2 100644
> >>>>>>> --- a/arch/powerpc/boot/dts/p1010rdb.dts
> >>>>>>> +++ b/arch/powerpc/boot/dts/p1010rdb.dts
> >>>>>>> @@ -169,14 +169,6 @@
> >>>>>>> 			};
> >>>>>>> 		};
> >>>>>>> 
> >>>>>>> -		can0@1c000 {
> >>>>>>> -			fsl,flexcan-clock-source = "platform";
> >>>>>>> -		};
> >>>>>>> -
> >>>>>>> -		can1@1d000 {
> >>>>>>> -			fsl,flexcan-clock-source = "platform";
> >>>>>>> -		};
> >>>>>>> -
> >>>>>>> 		usb@22000 {
> >>>>>>> 			phy_type = "utmi";
> >>>>>>> 		};
> >>>>>>> diff --git a/arch/powerpc/boot/dts/p1010si.dtsi
> >>>>>>> b/arch/powerpc/boot/dts/p1010si.dtsi
> >>>>>>> index 7f51104..20c396d 100644
> >>>>>>> --- a/arch/powerpc/boot/dts/p1010si.dtsi
> >>>>>>> +++ b/arch/powerpc/boot/dts/p1010si.dtsi
> >>>>>>> @@ -141,19 +141,19 @@
> >>>>>>> 		};
> >>>>>>> 
> >>>>>>> 		can0@1c000 {
> >>>>>>> -			compatible = "fsl,flexcan-v1.0";
> >>>>>>> +			compatible = "fsl,p1010-flexcan",
> >>>>>>> +					"fsl,flexcan";
> >>>>>> 
> >>>>>> Does fit on one line.
> >>>>>> 
> >>>>>>> 			reg = <0x1c000 0x1000>;
> >>>>>>> 			interrupts = <48 0x2>;
> >>>>>>> 			interrupt-parent = <&mpic>;
> >>>>>>> -			fsl,flexcan-clock-divider = <2>;
> >>>>>>> 		};
> >>>>>>> 
> >>>>>>> 		can1@1d000 {
> >>>>>>> -			compatible = "fsl,flexcan-v1.0";
> >>>>>>> +			compatible = "fsl,p1010-flexcan",
> >>>>>>> +					"fsl,flexcan";
> >>>>>> 
> >>>>>> Ditto
> >>>>>> 
> >>>>>>> 			reg = <0x1d000 0x1000>;
> >>>>>>> 			interrupts = <61 0x2>;
> >>>>>>> 			interrupt-parent = <&mpic>;
> >>>>>>> -			fsl,flexcan-clock-divider = <2>;
> >>>>>>> 		};
> >>>>>>> 
> >>>>>>> 		L2: l2-cache-controller@20000 {
> >>>>>> 
> >>>>>> Please also correct the node names (not using the number suffix).
> >>>>> 
> >>>>> So the node names should be
> >>>>> 		can@1c000 {
> >>>>> 		can@1d000 {
> >>>>> correct?
> >>>>> 
> >>>> [Bhaskar] As there are two CAN controllers on P1010,So won't it be better
> >>>> 	    to distinguish it by can0 and can1 instead by simple "can" ?
> >>> 
> >>> It looks like the way to do that is to assign a label to those devices
> >>> and then associate the label with an alias.  I have no idea how that
> >>> works under the hood, but it is the way other files are set up.  Take a
> >>> look at arch/powerpc/boot/dts/bamboo.dts for how they define the serial
> >>> interfaces.
> >>> 
> >>> Grant or Wolfgang, is that the right way to handle the concern about
> >>> names or does it have no practical effect with the Linux kernel?
> >> 
> >> It has not effect.  The label is just if you need to reference it via some other means.
> > 
> > Does the alias have an effect?
> 
> nope

Then how does the device number get associated with a particular device
and how is user-space ensured a consistent namespace?

Robin

^ permalink raw reply

* Re: [PATCH v11 5/5] powerpc: Fix up fsl-flexcan device tree binding.
From: Robin Holt @ 2011-08-10 17:19 UTC (permalink / raw)
  To: Scott Wood
  Cc: socketcan-core, netdev, devicetree-discuss, U Bhaskar-B22300,
	Robin Holt, PPC list
In-Reply-To: <4E42B83C.2040705@freescale.com>

On Wed, Aug 10, 2011 at 11:56:28AM -0500, Scott Wood wrote:
> On 08/10/2011 11:27 AM, Robin Holt wrote:
> > -CPI Clock- Can Protocol Interface Clock
> > -	This CLK_SRC bit of CTRL(control register) selects the clock source to
> > -	the CAN Protocol Interface(CPI) to be either the peripheral clock
> > -	(driven by the PLL) or the crystal oscillator clock. The selected clock
> > -	is the one fed to the prescaler to generate the Serial Clock (Sclock).
> > -	The PRESDIV field of CTRL(control register) controls a prescaler that
> > -	generates the Serial Clock (Sclock), whose period defines the
> > -	time quantum used to compose the CAN waveform.
> > +- compatible : Should be "fsl,flexcan" and optionally
> > +               "fsl,flexcan-<processor>"
> 
> fsl,<processor>-flexcan, and it should not be optional, and should come
> before "fsl,flexcan".
> 
> Also may want to list fsl,p1010-rdb as a "canonical compatible" for
> anything which is backwards compatible with p1010's implementation.

How do I specify 'canonical compatible'?  What would be the use of it
in that implementation?

Robin

^ permalink raw reply

* Re: [PATCH v10 5/5] [powerpc] Fix up fsl-flexcan device tree binding.
From: Kumar Gala @ 2011-08-10 17:17 UTC (permalink / raw)
  To: Robin Holt
  Cc: socketcan-core@lists.berlios.de, Wood Scott-B07421,
	U Bhaskar-B22300, PPC list, netdev@vger.kernel.org
In-Reply-To: <20110810171600.GV4926@sgi.com>


On Aug 10, 2011, at 12:16 PM, Robin Holt wrote:

> On Wed, Aug 10, 2011 at 11:53:15AM -0500, Kumar Gala wrote:
>>=20
>> On Aug 10, 2011, at 11:00 AM, Robin Holt wrote:
>>=20
>>> On Wed, Aug 10, 2011 at 02:36:20PM +0000, U Bhaskar-B22300 wrote:
>>>>=20
>>>>=20
>>>>> -----Original Message-----
>>>>> From: Robin Holt [mailto:holt@sgi.com]
>>>>> Sent: Wednesday, August 10, 2011 7:46 PM
>>>>> To: Wolfgang Grandegger
>>>>> Cc: Robin Holt; Marc Kleine-Budde; U Bhaskar-B22300; Wood =
Scott-B07421;
>>>>> netdev@vger.kernel.org; Kumar Gala; =
socketcan-core@lists.berlios.de; PPC
>>>>> list
>>>>> Subject: Re: [PATCH v10 5/5] [powerpc] Fix up fsl-flexcan device =
tree
>>>>> binding.
>>>>>=20
>>>>> On Wed, Aug 10, 2011 at 03:47:43PM +0200, Wolfgang Grandegger =
wrote:
>>>>>> Hi Robin,
>>>>>>=20
>>>>>> On 08/10/2011 05:06 AM, Robin Holt wrote:
>>>>>>> In working with the socketcan developers, we have come to the
>>>>>>> conclusion the Documentation...fsl-flexcan.txt device tree
>>>>>>> documentation needs to be cleaned up.  The driver does not =
depend
>>>>>>> upon any properties other
>>>>>>=20
>>>>>> Your first sentence could be misleading. Please just describe =
what the
>>>>>> patch does and why, something like:
>>>>>>=20
>>>>>> "This patch cleans up the documentation of the device-tree =
binding for
>>>>>> the Flexcan devices on Freescale's PowerPC and ARM cores. Extra
>>>>>> properties are not needed as the frequency of the source clock is
>>>>>> fixed..." and so on.
>>>>>=20
>>>>> I borrowed heavily from your message. ;)
>>>>>=20
>>>>>>> than the required properties so we are removing the file.
>>>>>>> Additionally, the p1010*dts* files are not following the =
standard
>>>>>>> for node naming in that they have a trailing -v1.0.
>>>>>>=20
>>>>>>> Signed-off-by: Robin Holt <holt@sgi.com>
>>>>>>> To: Marc Kleine-Budde <mkl@pengutronix.de>,
>>>>>>> To: Wolfgang Grandegger <wg@grandegger.com>,
>>>>>>> To: U Bhaskar-B22300 <B22300@freescale.com>
>>>>>>> To: Scott Wood <scottwood@freescale.com>
>>>>>>> Cc: socketcan-core@lists.berlios.de,
>>>>>>> Cc: netdev@vger.kernel.org,
>>>>>>> Cc: PPC list <linuxppc-dev@lists.ozlabs.org>
>>>>>>> Cc: Kumar Gala <galak@kernel.crashing.org>
>>>>>>> ---
>>>>>>> .../devicetree/bindings/net/can/fsl-flexcan.txt    |   61 =
----------
>>>>> ----------
>>>>>>> arch/powerpc/boot/dts/p1010rdb.dts                 |    8 ---
>>>>>>> arch/powerpc/boot/dts/p1010si.dtsi                 |    8 +-
>>>>>>> 3 files changed, 4 insertions(+), 73 deletions(-)  delete mode
>>>>>>> 100644 Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
>>>>>>>=20
>>>>>>> diff --git
>>>>>>> a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
>>>>>>> b/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
>>>>>>> deleted file mode 100644
>>>>>>> index 1a729f0..0000000
>>>>>>> --- a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
>>>>>>> +++ /dev/null
>>>>>>> @@ -1,61 +0,0 @@
>>>>>>> -CAN Device Tree Bindings
>>>>>>> -------------------------
>>>>>>> -2011 Freescale Semiconductor, Inc.
>>>>>>> -
>>>>>>> -fsl,flexcan-v1.0 nodes
>>>>>>> ------------------------
>>>>>>> -In addition to the required compatible-, reg- and
>>>>>>> interrupt-properties, you can -also specify which clock source =
shall
>>>>> be used for the controller.
>>>>>>> -
>>>>>>> -CPI Clock- Can Protocol Interface Clock
>>>>>>> -	This CLK_SRC bit of CTRL(control register) selects the =
clock source
>>>>> to
>>>>>>> -	the CAN Protocol Interface(CPI) to be either the =
peripheral clock
>>>>>>> -	(driven by the PLL) or the crystal oscillator clock. The =
selected
>>>>> clock
>>>>>>> -	is the one fed to the prescaler to generate the Serial =
Clock
>>>>> (Sclock).
>>>>>>> -	The PRESDIV field of CTRL(control register) controls a =
prescaler
>>>>> that
>>>>>>> -	generates the Serial Clock (Sclock), whose period =
defines the
>>>>>>> -	time quantum used to compose the CAN waveform.
>>>>>>> -
>>>>>>> -Can Engine Clock Source
>>>>>>> -	There are two sources for CAN clock
>>>>>>> -	- Platform Clock  It represents the bus clock
>>>>>>> -	- Oscillator Clock
>>>>>>> -
>>>>>>> -	Peripheral Clock (PLL)
>>>>>>> -	--------------
>>>>>>> -		     |
>>>>>>> -		    ---------		      -------------
>>>>>>> -		    |       |CPI Clock	      | Prescaler |      =
 Sclock
>>>>>>> -		    |       |---------------->| (1.. 256) =
|------------>
>>>>>>> -		    ---------		      -------------
>>>>>>> -                     |  |
>>>>>>> -	--------------  ---------------------CLK_SRC
>>>>>>> -	Oscillator Clock
>>>>>>> -
>>>>>>> -- fsl,flexcan-clock-source : CAN Engine Clock Source.This =
property
>>>>> selects
>>>>>>> -			     the peripheral clock. PLL clock is =
fed to the
>>>>>>> -			     prescaler to generate the Serial =
Clock (Sclock).
>>>>>>> -			     Valid values are "oscillator" and =
"platform"
>>>>>>> -			     "oscillator": CAN engine clock =
source is
>>>>> oscillator clock.
>>>>>>> -			     "platform" The CAN engine clock =
source is the bus
>>>>> clock
>>>>>>> -		             (platform clock).
>>>>>>> -
>>>>>>> -- fsl,flexcan-clock-divider : for the reference and system =
clock, an
>>>>> additional
>>>>>>> -			      clock divider can be specified.
>>>>>>> -- clock-frequency: frequency required to calculate the bitrate =
for
>>>>> FlexCAN.
>>>>>>> -
>>>>>>> -Note:
>>>>>>> -	- v1.0 of flexcan-v1.0 represent the IP block version =
for P1010
>>>>> SOC.
>>>>>>> -	- P1010 does not have oscillator as the Clock Source.So =
the default
>>>>>>> -	  Clock Source is platform clock.
>>>>>>> -Examples:
>>>>>>> -
>>>>>>> -	can0@1c000 {
>>>>>>> -		compatible =3D "fsl,flexcan-v1.0";
>>>>>>> -		reg =3D <0x1c000 0x1000>;
>>>>>>> -		interrupts =3D <48 0x2>;
>>>>>>> -		interrupt-parent =3D <&mpic>;
>>>>>>> -		fsl,flexcan-clock-source =3D "platform";
>>>>>>> -		fsl,flexcan-clock-divqider =3D <2>;
>>>>>>> -		clock-frequency =3D <fixed by u-boot>;
>>>>>>> -	};
>>>>>>=20
>>>>>> Do we really want to drop the documentation for that binding. I =
think
>>>>>> something like the following text would be still useful:
>>>>>>=20
>>>>>> ------------------------
>>>>>> Flexcan CAN contoller on Freescale's ARM and PowerPC processors
>>>>>>=20
>>>>>> Required properties:
>>>>>>=20
>>>>>> - compatible : Should be "fsl,flexcan" and optionally
>>>>>>              "fsl,flexcan-<processor>"
>>>>>> - reg : Offset and length of the register set for this device
>>>>>> - interrupts : Interrupt tuple for this device
>>>>>>=20
>>>>>> Example:
>>>>>>=20
>>>>>> can@1c000 {
>>>>>>         compatible =3D "fsl,p1010-flexcan", "fsl,flexcan";
>>>>>>         reg =3D <0x1c000 0x1000>;
>>>>>>         interrupts =3D <48 0x2>;
>>>>>>         interrupt-parent =3D <&mpic>;
>>>>>> };
>>>>>> -------------------------
>>>>>=20
>>>>> Done, except the
>>>>>>         compatible =3D "fsl,p1010-flexcan", "fsl,flexcan";
>>>>>=20
>>>>> line is
>>>>> 	compatible =3D "fsl,flexcan", "fsl,flexcan-p1010";
>>>>>=20
>>>>>>=20
>>>>>> What do you think?
>>>>>>=20
>>>>>>> diff --git a/arch/powerpc/boot/dts/p1010rdb.dts
>>>>>>> b/arch/powerpc/boot/dts/p1010rdb.dts
>>>>>>> index 6b33b73..d6a0bb2 100644
>>>>>>> --- a/arch/powerpc/boot/dts/p1010rdb.dts
>>>>>>> +++ b/arch/powerpc/boot/dts/p1010rdb.dts
>>>>>>> @@ -169,14 +169,6 @@
>>>>>>> 			};
>>>>>>> 		};
>>>>>>>=20
>>>>>>> -		can0@1c000 {
>>>>>>> -			fsl,flexcan-clock-source =3D "platform";
>>>>>>> -		};
>>>>>>> -
>>>>>>> -		can1@1d000 {
>>>>>>> -			fsl,flexcan-clock-source =3D "platform";
>>>>>>> -		};
>>>>>>> -
>>>>>>> 		usb@22000 {
>>>>>>> 			phy_type =3D "utmi";
>>>>>>> 		};
>>>>>>> diff --git a/arch/powerpc/boot/dts/p1010si.dtsi
>>>>>>> b/arch/powerpc/boot/dts/p1010si.dtsi
>>>>>>> index 7f51104..20c396d 100644
>>>>>>> --- a/arch/powerpc/boot/dts/p1010si.dtsi
>>>>>>> +++ b/arch/powerpc/boot/dts/p1010si.dtsi
>>>>>>> @@ -141,19 +141,19 @@
>>>>>>> 		};
>>>>>>>=20
>>>>>>> 		can0@1c000 {
>>>>>>> -			compatible =3D "fsl,flexcan-v1.0";
>>>>>>> +			compatible =3D "fsl,p1010-flexcan",
>>>>>>> +					"fsl,flexcan";
>>>>>>=20
>>>>>> Does fit on one line.
>>>>>>=20
>>>>>>> 			reg =3D <0x1c000 0x1000>;
>>>>>>> 			interrupts =3D <48 0x2>;
>>>>>>> 			interrupt-parent =3D <&mpic>;
>>>>>>> -			fsl,flexcan-clock-divider =3D <2>;
>>>>>>> 		};
>>>>>>>=20
>>>>>>> 		can1@1d000 {
>>>>>>> -			compatible =3D "fsl,flexcan-v1.0";
>>>>>>> +			compatible =3D "fsl,p1010-flexcan",
>>>>>>> +					"fsl,flexcan";
>>>>>>=20
>>>>>> Ditto
>>>>>>=20
>>>>>>> 			reg =3D <0x1d000 0x1000>;
>>>>>>> 			interrupts =3D <61 0x2>;
>>>>>>> 			interrupt-parent =3D <&mpic>;
>>>>>>> -			fsl,flexcan-clock-divider =3D <2>;
>>>>>>> 		};
>>>>>>>=20
>>>>>>> 		L2: l2-cache-controller@20000 {
>>>>>>=20
>>>>>> Please also correct the node names (not using the number suffix).
>>>>>=20
>>>>> So the node names should be
>>>>> 		can@1c000 {
>>>>> 		can@1d000 {
>>>>> correct?
>>>>>=20
>>>> [Bhaskar] As there are two CAN controllers on P1010,So won't it be =
better
>>>> 	    to distinguish it by can0 and can1 instead by simple "can" ?
>>>=20
>>> It looks like the way to do that is to assign a label to those =
devices
>>> and then associate the label with an alias.  I have no idea how that
>>> works under the hood, but it is the way other files are set up.  =
Take a
>>> look at arch/powerpc/boot/dts/bamboo.dts for how they define the =
serial
>>> interfaces.
>>>=20
>>> Grant or Wolfgang, is that the right way to handle the concern about
>>> names or does it have no practical effect with the Linux kernel?
>>=20
>> It has not effect.  The label is just if you need to reference it via =
some other means.
>=20
> Does the alias have an effect?

nope

- k

^ permalink raw reply

* Re: [PATCH v10 5/5] [powerpc] Fix up fsl-flexcan device tree binding.
From: Robin Holt @ 2011-08-10 17:16 UTC (permalink / raw)
  To: Kumar Gala
  Cc: Wood Scott-B07421, netdev@vger.kernel.org, U Bhaskar-B22300,
	socketcan-core@lists.berlios.de, Robin Holt, PPC list
In-Reply-To: <63306A24-3FBF-4DAA-A0B9-6005F56BB76F@kernel.crashing.org>

On Wed, Aug 10, 2011 at 11:53:15AM -0500, Kumar Gala wrote:
> 
> On Aug 10, 2011, at 11:00 AM, Robin Holt wrote:
> 
> > On Wed, Aug 10, 2011 at 02:36:20PM +0000, U Bhaskar-B22300 wrote:
> >> 
> >> 
> >>> -----Original Message-----
> >>> From: Robin Holt [mailto:holt@sgi.com]
> >>> Sent: Wednesday, August 10, 2011 7:46 PM
> >>> To: Wolfgang Grandegger
> >>> Cc: Robin Holt; Marc Kleine-Budde; U Bhaskar-B22300; Wood Scott-B07421;
> >>> netdev@vger.kernel.org; Kumar Gala; socketcan-core@lists.berlios.de; PPC
> >>> list
> >>> Subject: Re: [PATCH v10 5/5] [powerpc] Fix up fsl-flexcan device tree
> >>> binding.
> >>> 
> >>> On Wed, Aug 10, 2011 at 03:47:43PM +0200, Wolfgang Grandegger wrote:
> >>>> Hi Robin,
> >>>> 
> >>>> On 08/10/2011 05:06 AM, Robin Holt wrote:
> >>>>> In working with the socketcan developers, we have come to the
> >>>>> conclusion the Documentation...fsl-flexcan.txt device tree
> >>>>> documentation needs to be cleaned up.  The driver does not depend
> >>>>> upon any properties other
> >>>> 
> >>>> Your first sentence could be misleading. Please just describe what the
> >>>> patch does and why, something like:
> >>>> 
> >>>> "This patch cleans up the documentation of the device-tree binding for
> >>>> the Flexcan devices on Freescale's PowerPC and ARM cores. Extra
> >>>> properties are not needed as the frequency of the source clock is
> >>>> fixed..." and so on.
> >>> 
> >>> I borrowed heavily from your message. ;)
> >>> 
> >>>>> than the required properties so we are removing the file.
> >>>>> Additionally, the p1010*dts* files are not following the standard
> >>>>> for node naming in that they have a trailing -v1.0.
> >>>> 
> >>>>> Signed-off-by: Robin Holt <holt@sgi.com>
> >>>>> To: Marc Kleine-Budde <mkl@pengutronix.de>,
> >>>>> To: Wolfgang Grandegger <wg@grandegger.com>,
> >>>>> To: U Bhaskar-B22300 <B22300@freescale.com>
> >>>>> To: Scott Wood <scottwood@freescale.com>
> >>>>> Cc: socketcan-core@lists.berlios.de,
> >>>>> Cc: netdev@vger.kernel.org,
> >>>>> Cc: PPC list <linuxppc-dev@lists.ozlabs.org>
> >>>>> Cc: Kumar Gala <galak@kernel.crashing.org>
> >>>>> ---
> >>>>> .../devicetree/bindings/net/can/fsl-flexcan.txt    |   61 ----------
> >>> ----------
> >>>>> arch/powerpc/boot/dts/p1010rdb.dts                 |    8 ---
> >>>>> arch/powerpc/boot/dts/p1010si.dtsi                 |    8 +-
> >>>>> 3 files changed, 4 insertions(+), 73 deletions(-)  delete mode
> >>>>> 100644 Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
> >>>>> 
> >>>>> diff --git
> >>>>> a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
> >>>>> b/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
> >>>>> deleted file mode 100644
> >>>>> index 1a729f0..0000000
> >>>>> --- a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
> >>>>> +++ /dev/null
> >>>>> @@ -1,61 +0,0 @@
> >>>>> -CAN Device Tree Bindings
> >>>>> -------------------------
> >>>>> -2011 Freescale Semiconductor, Inc.
> >>>>> -
> >>>>> -fsl,flexcan-v1.0 nodes
> >>>>> ------------------------
> >>>>> -In addition to the required compatible-, reg- and
> >>>>> interrupt-properties, you can -also specify which clock source shall
> >>> be used for the controller.
> >>>>> -
> >>>>> -CPI Clock- Can Protocol Interface Clock
> >>>>> -	This CLK_SRC bit of CTRL(control register) selects the clock source
> >>> to
> >>>>> -	the CAN Protocol Interface(CPI) to be either the peripheral clock
> >>>>> -	(driven by the PLL) or the crystal oscillator clock. The selected
> >>> clock
> >>>>> -	is the one fed to the prescaler to generate the Serial Clock
> >>> (Sclock).
> >>>>> -	The PRESDIV field of CTRL(control register) controls a prescaler
> >>> that
> >>>>> -	generates the Serial Clock (Sclock), whose period defines the
> >>>>> -	time quantum used to compose the CAN waveform.
> >>>>> -
> >>>>> -Can Engine Clock Source
> >>>>> -	There are two sources for CAN clock
> >>>>> -	- Platform Clock  It represents the bus clock
> >>>>> -	- Oscillator Clock
> >>>>> -
> >>>>> -	Peripheral Clock (PLL)
> >>>>> -	--------------
> >>>>> -		     |
> >>>>> -		    ---------		      -------------
> >>>>> -		    |       |CPI Clock	      | Prescaler |       Sclock
> >>>>> -		    |       |---------------->| (1.. 256) |------------>
> >>>>> -		    ---------		      -------------
> >>>>> -                     |  |
> >>>>> -	--------------  ---------------------CLK_SRC
> >>>>> -	Oscillator Clock
> >>>>> -
> >>>>> -- fsl,flexcan-clock-source : CAN Engine Clock Source.This property
> >>> selects
> >>>>> -			     the peripheral clock. PLL clock is fed to the
> >>>>> -			     prescaler to generate the Serial Clock (Sclock).
> >>>>> -			     Valid values are "oscillator" and "platform"
> >>>>> -			     "oscillator": CAN engine clock source is
> >>> oscillator clock.
> >>>>> -			     "platform" The CAN engine clock source is the bus
> >>> clock
> >>>>> -		             (platform clock).
> >>>>> -
> >>>>> -- fsl,flexcan-clock-divider : for the reference and system clock, an
> >>> additional
> >>>>> -			      clock divider can be specified.
> >>>>> -- clock-frequency: frequency required to calculate the bitrate for
> >>> FlexCAN.
> >>>>> -
> >>>>> -Note:
> >>>>> -	- v1.0 of flexcan-v1.0 represent the IP block version for P1010
> >>> SOC.
> >>>>> -	- P1010 does not have oscillator as the Clock Source.So the default
> >>>>> -	  Clock Source is platform clock.
> >>>>> -Examples:
> >>>>> -
> >>>>> -	can0@1c000 {
> >>>>> -		compatible = "fsl,flexcan-v1.0";
> >>>>> -		reg = <0x1c000 0x1000>;
> >>>>> -		interrupts = <48 0x2>;
> >>>>> -		interrupt-parent = <&mpic>;
> >>>>> -		fsl,flexcan-clock-source = "platform";
> >>>>> -		fsl,flexcan-clock-divqider = <2>;
> >>>>> -		clock-frequency = <fixed by u-boot>;
> >>>>> -	};
> >>>> 
> >>>> Do we really want to drop the documentation for that binding. I think
> >>>> something like the following text would be still useful:
> >>>> 
> >>>> ------------------------
> >>>> Flexcan CAN contoller on Freescale's ARM and PowerPC processors
> >>>> 
> >>>> Required properties:
> >>>> 
> >>>> - compatible : Should be "fsl,flexcan" and optionally
> >>>>               "fsl,flexcan-<processor>"
> >>>> - reg : Offset and length of the register set for this device
> >>>> - interrupts : Interrupt tuple for this device
> >>>> 
> >>>> Example:
> >>>> 
> >>>>  can@1c000 {
> >>>>          compatible = "fsl,p1010-flexcan", "fsl,flexcan";
> >>>>          reg = <0x1c000 0x1000>;
> >>>>          interrupts = <48 0x2>;
> >>>>          interrupt-parent = <&mpic>;
> >>>>  };
> >>>> -------------------------
> >>> 
> >>> Done, except the
> >>>>          compatible = "fsl,p1010-flexcan", "fsl,flexcan";
> >>> 
> >>> line is
> >>> 	compatible = "fsl,flexcan", "fsl,flexcan-p1010";
> >>> 
> >>>> 
> >>>> What do you think?
> >>>> 
> >>>>> diff --git a/arch/powerpc/boot/dts/p1010rdb.dts
> >>>>> b/arch/powerpc/boot/dts/p1010rdb.dts
> >>>>> index 6b33b73..d6a0bb2 100644
> >>>>> --- a/arch/powerpc/boot/dts/p1010rdb.dts
> >>>>> +++ b/arch/powerpc/boot/dts/p1010rdb.dts
> >>>>> @@ -169,14 +169,6 @@
> >>>>> 			};
> >>>>> 		};
> >>>>> 
> >>>>> -		can0@1c000 {
> >>>>> -			fsl,flexcan-clock-source = "platform";
> >>>>> -		};
> >>>>> -
> >>>>> -		can1@1d000 {
> >>>>> -			fsl,flexcan-clock-source = "platform";
> >>>>> -		};
> >>>>> -
> >>>>> 		usb@22000 {
> >>>>> 			phy_type = "utmi";
> >>>>> 		};
> >>>>> diff --git a/arch/powerpc/boot/dts/p1010si.dtsi
> >>>>> b/arch/powerpc/boot/dts/p1010si.dtsi
> >>>>> index 7f51104..20c396d 100644
> >>>>> --- a/arch/powerpc/boot/dts/p1010si.dtsi
> >>>>> +++ b/arch/powerpc/boot/dts/p1010si.dtsi
> >>>>> @@ -141,19 +141,19 @@
> >>>>> 		};
> >>>>> 
> >>>>> 		can0@1c000 {
> >>>>> -			compatible = "fsl,flexcan-v1.0";
> >>>>> +			compatible = "fsl,p1010-flexcan",
> >>>>> +					"fsl,flexcan";
> >>>> 
> >>>> Does fit on one line.
> >>>> 
> >>>>> 			reg = <0x1c000 0x1000>;
> >>>>> 			interrupts = <48 0x2>;
> >>>>> 			interrupt-parent = <&mpic>;
> >>>>> -			fsl,flexcan-clock-divider = <2>;
> >>>>> 		};
> >>>>> 
> >>>>> 		can1@1d000 {
> >>>>> -			compatible = "fsl,flexcan-v1.0";
> >>>>> +			compatible = "fsl,p1010-flexcan",
> >>>>> +					"fsl,flexcan";
> >>>> 
> >>>> Ditto
> >>>> 
> >>>>> 			reg = <0x1d000 0x1000>;
> >>>>> 			interrupts = <61 0x2>;
> >>>>> 			interrupt-parent = <&mpic>;
> >>>>> -			fsl,flexcan-clock-divider = <2>;
> >>>>> 		};
> >>>>> 
> >>>>> 		L2: l2-cache-controller@20000 {
> >>>> 
> >>>> Please also correct the node names (not using the number suffix).
> >>> 
> >>> So the node names should be
> >>> 		can@1c000 {
> >>> 		can@1d000 {
> >>> correct?
> >>> 
> >> [Bhaskar] As there are two CAN controllers on P1010,So won't it be better
> >> 	    to distinguish it by can0 and can1 instead by simple "can" ?
> > 
> > It looks like the way to do that is to assign a label to those devices
> > and then associate the label with an alias.  I have no idea how that
> > works under the hood, but it is the way other files are set up.  Take a
> > look at arch/powerpc/boot/dts/bamboo.dts for how they define the serial
> > interfaces.
> > 
> > Grant or Wolfgang, is that the right way to handle the concern about
> > names or does it have no practical effect with the Linux kernel?
> 
> It has not effect.  The label is just if you need to reference it via some other means.

Does the alias have an effect?

Robin

^ permalink raw reply

* Re: [PATCH v11 4/5] powerpc: Add flexcan device support for p1010rdb.
From: Kumar Gala @ 2011-08-10 17:01 UTC (permalink / raw)
  To: Robin Holt; +Cc: netdev, U Bhaskar-B22300, socketcan-core, PPC list
In-Reply-To: <1312993670-23999-5-git-send-email-holt@sgi.com>


On Aug 10, 2011, at 11:27 AM, Robin Holt wrote:

> I added a simple clock source for the p1010rdb so the flexcan driver
> could determine a clock frequency.  The p1010 flexcan device only has
> an oscillator of system bus frequency divided by 2.
>=20
> Signed-off-by: Robin Holt <holt@sgi.com>
> Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>,
> Acked-by: Wolfgang Grandegger <wg@grandegger.com>,
> Cc: U Bhaskar-B22300 <B22300@freescale.com>
> Cc: socketcan-core@lists.berlios.de,
> Cc: netdev@vger.kernel.org,
> Cc: PPC list <linuxppc-dev@lists.ozlabs.org>
> Cc: Kumar Gala <galak@kernel.crashing.org>
> ---
> arch/powerpc/platforms/85xx/Kconfig    |    2 +
> arch/powerpc/platforms/85xx/Makefile   |    2 +
> arch/powerpc/platforms/85xx/clock.c    |   52 =
++++++++++++++++++++++++++++++++
> arch/powerpc/platforms/85xx/p1010rdb.c |    8 +++++
> 4 files changed, 64 insertions(+), 0 deletions(-)
> create mode 100644 arch/powerpc/platforms/85xx/clock.c

I dont understand how mpc85xx_clk_functions() ends up being associated =
with the frequency the flexcan is running at.

This either seems to global or I'm missing something.

I still think the clk / freq info should be in the device tree and =
handled in the driver and NOT arch/powerpc platform code.

- k=

^ permalink raw reply

* Re: [PATCH v11 5/5] powerpc: Fix up fsl-flexcan device tree binding.
From: Scott Wood @ 2011-08-10 16:56 UTC (permalink / raw)
  To: Robin Holt
  Cc: socketcan-core, netdev, devicetree-discuss, U Bhaskar-B22300,
	PPC list
In-Reply-To: <1312993670-23999-6-git-send-email-holt@sgi.com>

On 08/10/2011 11:27 AM, Robin Holt wrote:
> -CPI Clock- Can Protocol Interface Clock
> -	This CLK_SRC bit of CTRL(control register) selects the clock source to
> -	the CAN Protocol Interface(CPI) to be either the peripheral clock
> -	(driven by the PLL) or the crystal oscillator clock. The selected clock
> -	is the one fed to the prescaler to generate the Serial Clock (Sclock).
> -	The PRESDIV field of CTRL(control register) controls a prescaler that
> -	generates the Serial Clock (Sclock), whose period defines the
> -	time quantum used to compose the CAN waveform.
> +- compatible : Should be "fsl,flexcan" and optionally
> +               "fsl,flexcan-<processor>"

fsl,<processor>-flexcan, and it should not be optional, and should come
before "fsl,flexcan".

Also may want to list fsl,p1010-rdb as a "canonical compatible" for
anything which is backwards compatible with p1010's implementation.

-Scott

^ permalink raw reply

* Re: [PATCH v10 5/5] [powerpc] Fix up fsl-flexcan device tree binding.
From: Kumar Gala @ 2011-08-10 16:53 UTC (permalink / raw)
  To: Robin Holt
  Cc: Wood Scott-B07421, netdev@vger.kernel.org, U Bhaskar-B22300,
	socketcan-core@lists.berlios.de, PPC list
In-Reply-To: <20110810160054.GT4926@sgi.com>


On Aug 10, 2011, at 11:00 AM, Robin Holt wrote:

> On Wed, Aug 10, 2011 at 02:36:20PM +0000, U Bhaskar-B22300 wrote:
>>=20
>>=20
>>> -----Original Message-----
>>> From: Robin Holt [mailto:holt@sgi.com]
>>> Sent: Wednesday, August 10, 2011 7:46 PM
>>> To: Wolfgang Grandegger
>>> Cc: Robin Holt; Marc Kleine-Budde; U Bhaskar-B22300; Wood =
Scott-B07421;
>>> netdev@vger.kernel.org; Kumar Gala; socketcan-core@lists.berlios.de; =
PPC
>>> list
>>> Subject: Re: [PATCH v10 5/5] [powerpc] Fix up fsl-flexcan device =
tree
>>> binding.
>>>=20
>>> On Wed, Aug 10, 2011 at 03:47:43PM +0200, Wolfgang Grandegger wrote:
>>>> Hi Robin,
>>>>=20
>>>> On 08/10/2011 05:06 AM, Robin Holt wrote:
>>>>> In working with the socketcan developers, we have come to the
>>>>> conclusion the Documentation...fsl-flexcan.txt device tree
>>>>> documentation needs to be cleaned up.  The driver does not depend
>>>>> upon any properties other
>>>>=20
>>>> Your first sentence could be misleading. Please just describe what =
the
>>>> patch does and why, something like:
>>>>=20
>>>> "This patch cleans up the documentation of the device-tree binding =
for
>>>> the Flexcan devices on Freescale's PowerPC and ARM cores. Extra
>>>> properties are not needed as the frequency of the source clock is
>>>> fixed..." and so on.
>>>=20
>>> I borrowed heavily from your message. ;)
>>>=20
>>>>> than the required properties so we are removing the file.
>>>>> Additionally, the p1010*dts* files are not following the standard
>>>>> for node naming in that they have a trailing -v1.0.
>>>>=20
>>>>> Signed-off-by: Robin Holt <holt@sgi.com>
>>>>> To: Marc Kleine-Budde <mkl@pengutronix.de>,
>>>>> To: Wolfgang Grandegger <wg@grandegger.com>,
>>>>> To: U Bhaskar-B22300 <B22300@freescale.com>
>>>>> To: Scott Wood <scottwood@freescale.com>
>>>>> Cc: socketcan-core@lists.berlios.de,
>>>>> Cc: netdev@vger.kernel.org,
>>>>> Cc: PPC list <linuxppc-dev@lists.ozlabs.org>
>>>>> Cc: Kumar Gala <galak@kernel.crashing.org>
>>>>> ---
>>>>> .../devicetree/bindings/net/can/fsl-flexcan.txt    |   61 =
----------
>>> ----------
>>>>> arch/powerpc/boot/dts/p1010rdb.dts                 |    8 ---
>>>>> arch/powerpc/boot/dts/p1010si.dtsi                 |    8 +-
>>>>> 3 files changed, 4 insertions(+), 73 deletions(-)  delete mode
>>>>> 100644 Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
>>>>>=20
>>>>> diff --git
>>>>> a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
>>>>> b/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
>>>>> deleted file mode 100644
>>>>> index 1a729f0..0000000
>>>>> --- a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
>>>>> +++ /dev/null
>>>>> @@ -1,61 +0,0 @@
>>>>> -CAN Device Tree Bindings
>>>>> -------------------------
>>>>> -2011 Freescale Semiconductor, Inc.
>>>>> -
>>>>> -fsl,flexcan-v1.0 nodes
>>>>> ------------------------
>>>>> -In addition to the required compatible-, reg- and
>>>>> interrupt-properties, you can -also specify which clock source =
shall
>>> be used for the controller.
>>>>> -
>>>>> -CPI Clock- Can Protocol Interface Clock
>>>>> -	This CLK_SRC bit of CTRL(control register) selects the clock =
source
>>> to
>>>>> -	the CAN Protocol Interface(CPI) to be either the peripheral =
clock
>>>>> -	(driven by the PLL) or the crystal oscillator clock. The =
selected
>>> clock
>>>>> -	is the one fed to the prescaler to generate the Serial Clock
>>> (Sclock).
>>>>> -	The PRESDIV field of CTRL(control register) controls a prescaler
>>> that
>>>>> -	generates the Serial Clock (Sclock), whose period defines the
>>>>> -	time quantum used to compose the CAN waveform.
>>>>> -
>>>>> -Can Engine Clock Source
>>>>> -	There are two sources for CAN clock
>>>>> -	- Platform Clock  It represents the bus clock
>>>>> -	- Oscillator Clock
>>>>> -
>>>>> -	Peripheral Clock (PLL)
>>>>> -	--------------
>>>>> -		     |
>>>>> -		    ---------		      -------------
>>>>> -		    |       |CPI Clock	      | Prescaler |       Sclock
>>>>> -		    |       |---------------->| (1.. 256) |------------>
>>>>> -		    ---------		      -------------
>>>>> -                     |  |
>>>>> -	--------------  ---------------------CLK_SRC
>>>>> -	Oscillator Clock
>>>>> -
>>>>> -- fsl,flexcan-clock-source : CAN Engine Clock Source.This =
property
>>> selects
>>>>> -			     the peripheral clock. PLL clock is fed to =
the
>>>>> -			     prescaler to generate the Serial Clock =
(Sclock).
>>>>> -			     Valid values are "oscillator" and =
"platform"
>>>>> -			     "oscillator": CAN engine clock source is
>>> oscillator clock.
>>>>> -			     "platform" The CAN engine clock source is =
the bus
>>> clock
>>>>> -		             (platform clock).
>>>>> -
>>>>> -- fsl,flexcan-clock-divider : for the reference and system clock, =
an
>>> additional
>>>>> -			      clock divider can be specified.
>>>>> -- clock-frequency: frequency required to calculate the bitrate =
for
>>> FlexCAN.
>>>>> -
>>>>> -Note:
>>>>> -	- v1.0 of flexcan-v1.0 represent the IP block version for P1010
>>> SOC.
>>>>> -	- P1010 does not have oscillator as the Clock Source.So the =
default
>>>>> -	  Clock Source is platform clock.
>>>>> -Examples:
>>>>> -
>>>>> -	can0@1c000 {
>>>>> -		compatible =3D "fsl,flexcan-v1.0";
>>>>> -		reg =3D <0x1c000 0x1000>;
>>>>> -		interrupts =3D <48 0x2>;
>>>>> -		interrupt-parent =3D <&mpic>;
>>>>> -		fsl,flexcan-clock-source =3D "platform";
>>>>> -		fsl,flexcan-clock-divqider =3D <2>;
>>>>> -		clock-frequency =3D <fixed by u-boot>;
>>>>> -	};
>>>>=20
>>>> Do we really want to drop the documentation for that binding. I =
think
>>>> something like the following text would be still useful:
>>>>=20
>>>> ------------------------
>>>> Flexcan CAN contoller on Freescale's ARM and PowerPC processors
>>>>=20
>>>> Required properties:
>>>>=20
>>>> - compatible : Should be "fsl,flexcan" and optionally
>>>>               "fsl,flexcan-<processor>"
>>>> - reg : Offset and length of the register set for this device
>>>> - interrupts : Interrupt tuple for this device
>>>>=20
>>>> Example:
>>>>=20
>>>>  can@1c000 {
>>>>          compatible =3D "fsl,p1010-flexcan", "fsl,flexcan";
>>>>          reg =3D <0x1c000 0x1000>;
>>>>          interrupts =3D <48 0x2>;
>>>>          interrupt-parent =3D <&mpic>;
>>>>  };
>>>> -------------------------
>>>=20
>>> Done, except the
>>>>          compatible =3D "fsl,p1010-flexcan", "fsl,flexcan";
>>>=20
>>> line is
>>> 	compatible =3D "fsl,flexcan", "fsl,flexcan-p1010";
>>>=20
>>>>=20
>>>> What do you think?
>>>>=20
>>>>> diff --git a/arch/powerpc/boot/dts/p1010rdb.dts
>>>>> b/arch/powerpc/boot/dts/p1010rdb.dts
>>>>> index 6b33b73..d6a0bb2 100644
>>>>> --- a/arch/powerpc/boot/dts/p1010rdb.dts
>>>>> +++ b/arch/powerpc/boot/dts/p1010rdb.dts
>>>>> @@ -169,14 +169,6 @@
>>>>> 			};
>>>>> 		};
>>>>>=20
>>>>> -		can0@1c000 {
>>>>> -			fsl,flexcan-clock-source =3D "platform";
>>>>> -		};
>>>>> -
>>>>> -		can1@1d000 {
>>>>> -			fsl,flexcan-clock-source =3D "platform";
>>>>> -		};
>>>>> -
>>>>> 		usb@22000 {
>>>>> 			phy_type =3D "utmi";
>>>>> 		};
>>>>> diff --git a/arch/powerpc/boot/dts/p1010si.dtsi
>>>>> b/arch/powerpc/boot/dts/p1010si.dtsi
>>>>> index 7f51104..20c396d 100644
>>>>> --- a/arch/powerpc/boot/dts/p1010si.dtsi
>>>>> +++ b/arch/powerpc/boot/dts/p1010si.dtsi
>>>>> @@ -141,19 +141,19 @@
>>>>> 		};
>>>>>=20
>>>>> 		can0@1c000 {
>>>>> -			compatible =3D "fsl,flexcan-v1.0";
>>>>> +			compatible =3D "fsl,p1010-flexcan",
>>>>> +					"fsl,flexcan";
>>>>=20
>>>> Does fit on one line.
>>>>=20
>>>>> 			reg =3D <0x1c000 0x1000>;
>>>>> 			interrupts =3D <48 0x2>;
>>>>> 			interrupt-parent =3D <&mpic>;
>>>>> -			fsl,flexcan-clock-divider =3D <2>;
>>>>> 		};
>>>>>=20
>>>>> 		can1@1d000 {
>>>>> -			compatible =3D "fsl,flexcan-v1.0";
>>>>> +			compatible =3D "fsl,p1010-flexcan",
>>>>> +					"fsl,flexcan";
>>>>=20
>>>> Ditto
>>>>=20
>>>>> 			reg =3D <0x1d000 0x1000>;
>>>>> 			interrupts =3D <61 0x2>;
>>>>> 			interrupt-parent =3D <&mpic>;
>>>>> -			fsl,flexcan-clock-divider =3D <2>;
>>>>> 		};
>>>>>=20
>>>>> 		L2: l2-cache-controller@20000 {
>>>>=20
>>>> Please also correct the node names (not using the number suffix).
>>>=20
>>> So the node names should be
>>> 		can@1c000 {
>>> 		can@1d000 {
>>> correct?
>>>=20
>> [Bhaskar] As there are two CAN controllers on P1010,So won't it be =
better
>> 	    to distinguish it by can0 and can1 instead by simple "can" ?
>=20
> It looks like the way to do that is to assign a label to those devices
> and then associate the label with an alias.  I have no idea how that
> works under the hood, but it is the way other files are set up.  Take =
a
> look at arch/powerpc/boot/dts/bamboo.dts for how they define the =
serial
> interfaces.
>=20
> Grant or Wolfgang, is that the right way to handle the concern about
> names or does it have no practical effect with the Linux kernel?

It has not effect.  The label is just if you need to reference it via =
some other means.

- k=

^ permalink raw reply

* [PATCH v11 4/5] powerpc: Add flexcan device support for p1010rdb.
From: Robin Holt @ 2011-08-10 16:27 UTC (permalink / raw)
  To: Robin Holt, Kumar Gala, Wolfgang Grandegger, U Bhaskar-B22300
  Cc: netdev, U Bhaskar-B22300, socketcan-core, Robin Holt, PPC list
In-Reply-To: <1312993670-23999-1-git-send-email-holt@sgi.com>

I added a simple clock source for the p1010rdb so the flexcan driver
could determine a clock frequency.  The p1010 flexcan device only has
an oscillator of system bus frequency divided by 2.

Signed-off-by: Robin Holt <holt@sgi.com>
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>,
Acked-by: Wolfgang Grandegger <wg@grandegger.com>,
Cc: U Bhaskar-B22300 <B22300@freescale.com>
Cc: socketcan-core@lists.berlios.de,
Cc: netdev@vger.kernel.org,
Cc: PPC list <linuxppc-dev@lists.ozlabs.org>
Cc: Kumar Gala <galak@kernel.crashing.org>
---
 arch/powerpc/platforms/85xx/Kconfig    |    2 +
 arch/powerpc/platforms/85xx/Makefile   |    2 +
 arch/powerpc/platforms/85xx/clock.c    |   52 ++++++++++++++++++++++++++++++++
 arch/powerpc/platforms/85xx/p1010rdb.c |    8 +++++
 4 files changed, 64 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/platforms/85xx/clock.c

diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig
index 498534c..c4304ae 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -70,6 +70,8 @@ config MPC85xx_RDB
 config P1010_RDB
 	bool "Freescale P1010RDB"
 	select DEFAULT_UIMAGE
+	select HAVE_CAN_FLEXCAN if NET && CAN
+	select PPC_CLOCK if CAN_FLEXCAN
 	help
 	  This option enables support for the MPC85xx RDB (P1010 RDB) board
 
diff --git a/arch/powerpc/platforms/85xx/Makefile b/arch/powerpc/platforms/85xx/Makefile
index a971b32..cc7f381 100644
--- a/arch/powerpc/platforms/85xx/Makefile
+++ b/arch/powerpc/platforms/85xx/Makefile
@@ -3,6 +3,8 @@
 #
 obj-$(CONFIG_SMP) += smp.o
 
+obj-$(CONFIG_PPC_CLOCK)   += clock.o
+
 obj-$(CONFIG_MPC8540_ADS) += mpc85xx_ads.o
 obj-$(CONFIG_MPC8560_ADS) += mpc85xx_ads.o
 obj-$(CONFIG_MPC85xx_CDS) += mpc85xx_cds.o
diff --git a/arch/powerpc/platforms/85xx/clock.c b/arch/powerpc/platforms/85xx/clock.c
new file mode 100644
index 0000000..0b6db1d
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/clock.c
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2011 SGI, inc.
+ *
+ * This code is licensed for use under the GPL V2 as published by
+ * the Free Software Foundation.
+ */
+
+#include <linux/device.h>
+#include <linux/err.h>
+#include <linux/of.h>
+
+#include <asm/clk_interface.h>
+
+#include <sysdev/fsl_soc.h>
+
+/*
+ * p1010 needs to provide a clock source for the flexcan driver. The
+ * oscillator for the p1010 processor is only ever the system clock / 2.
+ */
+
+static struct clk *mpc85xx_clk_get(struct device *dev, const char *id)
+{
+	if (!dev)
+		return ERR_PTR(-ENOENT);
+
+	if (!dev->of_node ||
+	    !of_device_is_compatible(dev->of_node, "fsl,flexcan"))
+		return ERR_PTR(-ENOENT);
+
+	return NULL;
+}
+
+static void mpc85xx_clk_put(struct clk *clk)
+{
+	return;
+}
+
+static unsigned long mpc85xx_clk_get_rate(struct clk *clk)
+{
+	return fsl_get_sys_freq() / 2;
+}
+
+static struct clk_interface mpc85xx_clk_functions = {
+	.clk_get = mpc85xx_clk_get,
+	.clk_get_rate = mpc85xx_clk_get_rate,
+	.clk_put = mpc85xx_clk_put,
+};
+
+void __init mpc85xx_clk_init(void)
+{
+	clk_functions = mpc85xx_clk_functions;
+}
diff --git a/arch/powerpc/platforms/85xx/p1010rdb.c b/arch/powerpc/platforms/85xx/p1010rdb.c
index d7387fa..5e52122 100644
--- a/arch/powerpc/platforms/85xx/p1010rdb.c
+++ b/arch/powerpc/platforms/85xx/p1010rdb.c
@@ -81,6 +81,13 @@ static void __init p1010_rdb_setup_arch(void)
 	printk(KERN_INFO "P1010 RDB board from Freescale Semiconductor\n");
 }
 
+extern void mpc85xx_clk_init(void);
+
+static void __init p1010_rdb_init(void)
+{
+	mpc85xx_clk_init();
+}
+
 static struct of_device_id __initdata p1010rdb_ids[] = {
 	{ .type = "soc", },
 	{ .compatible = "soc", },
@@ -111,6 +118,7 @@ define_machine(p1010_rdb) {
 	.name			= "P1010 RDB",
 	.probe			= p1010_rdb_probe,
 	.setup_arch		= p1010_rdb_setup_arch,
+	.init			= p1010_rdb_init,
 	.init_IRQ		= p1010_rdb_pic_init,
 #ifdef CONFIG_PCI
 	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-- 
1.7.2.1

^ permalink raw reply related

* [PATCH v11 2/5] flexcan: Abstract off read/write for big/little endian.
From: Robin Holt @ 2011-08-10 16:27 UTC (permalink / raw)
  To: Robin Holt, Kumar Gala, Wolfgang Grandegger, U Bhaskar-B22300
  Cc: netdev, U Bhaskar-B22300, socketcan-core, Robin Holt, PPC list
In-Reply-To: <1312993670-23999-1-git-send-email-holt@sgi.com>

Make flexcan driver handle register reads in the appropriate endianess.
This was a basic search and replace and then define some inlines.

Signed-off-by: Robin Holt <holt@sgi.com>
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
Acked-by: Wolfgang Grandegger <wg@grandegger.com>
Cc: U Bhaskar-B22300 <B22300@freescale.com>
Cc: socketcan-core@lists.berlios.de
Cc: netdev@vger.kernel.org
Cc: PPC list <linuxppc-dev@lists.ozlabs.org>
---
 drivers/net/can/flexcan.c |  140 ++++++++++++++++++++++++++------------------
 1 files changed, 83 insertions(+), 57 deletions(-)

diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 586b2cd..68cbe52 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -190,6 +190,31 @@ static struct can_bittiming_const flexcan_bittiming_const = {
 };
 
 /*
+ * Abstract off the read/write for arm versus ppc.
+ */
+#if defined(__BIG_ENDIAN)
+static inline u32 flexcan_read(void __iomem *addr)
+{
+	return in_be32(addr);
+}
+
+static inline void flexcan_write(u32 val, void __iomem *addr)
+{
+	out_be32(addr, val);
+}
+#else
+static inline u32 flexcan_read(void __iomem *addr)
+{
+	return readl(addr);
+}
+
+static inline void flexcan_write(u32 val, void __iomem *addr)
+{
+	writel(val, addr);
+}
+#endif
+
+/*
  * Swtich transceiver on or off
  */
 static void flexcan_transceiver_switch(const struct flexcan_priv *priv, int on)
@@ -210,9 +235,9 @@ static inline void flexcan_chip_enable(struct flexcan_priv *priv)
 	struct flexcan_regs __iomem *regs = priv->base;
 	u32 reg;
 
-	reg = readl(&regs->mcr);
+	reg = flexcan_read(&regs->mcr);
 	reg &= ~FLEXCAN_MCR_MDIS;
-	writel(reg, &regs->mcr);
+	flexcan_write(reg, &regs->mcr);
 
 	udelay(10);
 }
@@ -222,9 +247,9 @@ static inline void flexcan_chip_disable(struct flexcan_priv *priv)
 	struct flexcan_regs __iomem *regs = priv->base;
 	u32 reg;
 
-	reg = readl(&regs->mcr);
+	reg = flexcan_read(&regs->mcr);
 	reg |= FLEXCAN_MCR_MDIS;
-	writel(reg, &regs->mcr);
+	flexcan_write(reg, &regs->mcr);
 }
 
 static int flexcan_get_berr_counter(const struct net_device *dev,
@@ -232,7 +257,7 @@ static int flexcan_get_berr_counter(const struct net_device *dev,
 {
 	const struct flexcan_priv *priv = netdev_priv(dev);
 	struct flexcan_regs __iomem *regs = priv->base;
-	u32 reg = readl(&regs->ecr);
+	u32 reg = flexcan_read(&regs->ecr);
 
 	bec->txerr = (reg >> 0) & 0xff;
 	bec->rxerr = (reg >> 8) & 0xff;
@@ -266,15 +291,15 @@ static int flexcan_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
 	if (cf->can_dlc > 0) {
 		u32 data = be32_to_cpup((__be32 *)&cf->data[0]);
-		writel(data, &regs->cantxfg[FLEXCAN_TX_BUF_ID].data[0]);
+		flexcan_write(data, &regs->cantxfg[FLEXCAN_TX_BUF_ID].data[0]);
 	}
 	if (cf->can_dlc > 3) {
 		u32 data = be32_to_cpup((__be32 *)&cf->data[4]);
-		writel(data, &regs->cantxfg[FLEXCAN_TX_BUF_ID].data[1]);
+		flexcan_write(data, &regs->cantxfg[FLEXCAN_TX_BUF_ID].data[1]);
 	}
 
-	writel(can_id, &regs->cantxfg[FLEXCAN_TX_BUF_ID].can_id);
-	writel(ctrl, &regs->cantxfg[FLEXCAN_TX_BUF_ID].can_ctrl);
+	flexcan_write(can_id, &regs->cantxfg[FLEXCAN_TX_BUF_ID].can_id);
+	flexcan_write(ctrl, &regs->cantxfg[FLEXCAN_TX_BUF_ID].can_ctrl);
 
 	kfree_skb(skb);
 
@@ -462,8 +487,8 @@ static void flexcan_read_fifo(const struct net_device *dev,
 	struct flexcan_mb __iomem *mb = &regs->cantxfg[0];
 	u32 reg_ctrl, reg_id;
 
-	reg_ctrl = readl(&mb->can_ctrl);
-	reg_id = readl(&mb->can_id);
+	reg_ctrl = flexcan_read(&mb->can_ctrl);
+	reg_id = flexcan_read(&mb->can_id);
 	if (reg_ctrl & FLEXCAN_MB_CNT_IDE)
 		cf->can_id = ((reg_id >> 0) & CAN_EFF_MASK) | CAN_EFF_FLAG;
 	else
@@ -473,12 +498,12 @@ static void flexcan_read_fifo(const struct net_device *dev,
 		cf->can_id |= CAN_RTR_FLAG;
 	cf->can_dlc = get_can_dlc((reg_ctrl >> 16) & 0xf);
 
-	*(__be32 *)(cf->data + 0) = cpu_to_be32(readl(&mb->data[0]));
-	*(__be32 *)(cf->data + 4) = cpu_to_be32(readl(&mb->data[1]));
+	*(__be32 *)(cf->data + 0) = cpu_to_be32(flexcan_read(&mb->data[0]));
+	*(__be32 *)(cf->data + 4) = cpu_to_be32(flexcan_read(&mb->data[1]));
 
 	/* mark as read */
-	writel(FLEXCAN_IFLAG_RX_FIFO_AVAILABLE, &regs->iflag1);
-	readl(&regs->timer);
+	flexcan_write(FLEXCAN_IFLAG_RX_FIFO_AVAILABLE, &regs->iflag1);
+	flexcan_read(&regs->timer);
 }
 
 static int flexcan_read_frame(struct net_device *dev)
@@ -514,17 +539,17 @@ static int flexcan_poll(struct napi_struct *napi, int quota)
 	 * The error bits are cleared on read,
 	 * use saved value from irq handler.
 	 */
-	reg_esr = readl(&regs->esr) | priv->reg_esr;
+	reg_esr = flexcan_read(&regs->esr) | priv->reg_esr;
 
 	/* handle state changes */
 	work_done += flexcan_poll_state(dev, reg_esr);
 
 	/* handle RX-FIFO */
-	reg_iflag1 = readl(&regs->iflag1);
+	reg_iflag1 = flexcan_read(&regs->iflag1);
 	while (reg_iflag1 & FLEXCAN_IFLAG_RX_FIFO_AVAILABLE &&
 	       work_done < quota) {
 		work_done += flexcan_read_frame(dev);
-		reg_iflag1 = readl(&regs->iflag1);
+		reg_iflag1 = flexcan_read(&regs->iflag1);
 	}
 
 	/* report bus errors */
@@ -534,8 +559,8 @@ static int flexcan_poll(struct napi_struct *napi, int quota)
 	if (work_done < quota) {
 		napi_complete(napi);
 		/* enable IRQs */
-		writel(FLEXCAN_IFLAG_DEFAULT, &regs->imask1);
-		writel(priv->reg_ctrl_default, &regs->ctrl);
+		flexcan_write(FLEXCAN_IFLAG_DEFAULT, &regs->imask1);
+		flexcan_write(priv->reg_ctrl_default, &regs->ctrl);
 	}
 
 	return work_done;
@@ -549,9 +574,9 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id)
 	struct flexcan_regs __iomem *regs = priv->base;
 	u32 reg_iflag1, reg_esr;
 
-	reg_iflag1 = readl(&regs->iflag1);
-	reg_esr = readl(&regs->esr);
-	writel(FLEXCAN_ESR_ERR_INT, &regs->esr);	/* ACK err IRQ */
+	reg_iflag1 = flexcan_read(&regs->iflag1);
+	reg_esr = flexcan_read(&regs->esr);
+	flexcan_write(FLEXCAN_ESR_ERR_INT, &regs->esr);	/* ACK err IRQ */
 
 	/*
 	 * schedule NAPI in case of:
@@ -567,16 +592,16 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id)
 		 * save them for later use.
 		 */
 		priv->reg_esr = reg_esr & FLEXCAN_ESR_ERR_BUS;
-		writel(FLEXCAN_IFLAG_DEFAULT & ~FLEXCAN_IFLAG_RX_FIFO_AVAILABLE,
-		       &regs->imask1);
-		writel(priv->reg_ctrl_default & ~FLEXCAN_CTRL_ERR_ALL,
+		flexcan_write(FLEXCAN_IFLAG_DEFAULT &
+			~FLEXCAN_IFLAG_RX_FIFO_AVAILABLE, &regs->imask1);
+		flexcan_write(priv->reg_ctrl_default & ~FLEXCAN_CTRL_ERR_ALL,
 		       &regs->ctrl);
 		napi_schedule(&priv->napi);
 	}
 
 	/* FIFO overflow */
 	if (reg_iflag1 & FLEXCAN_IFLAG_RX_FIFO_OVERFLOW) {
-		writel(FLEXCAN_IFLAG_RX_FIFO_OVERFLOW, &regs->iflag1);
+		flexcan_write(FLEXCAN_IFLAG_RX_FIFO_OVERFLOW, &regs->iflag1);
 		dev->stats.rx_over_errors++;
 		dev->stats.rx_errors++;
 	}
@@ -585,7 +610,7 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id)
 	if (reg_iflag1 & (1 << FLEXCAN_TX_BUF_ID)) {
 		/* tx_bytes is incremented in flexcan_start_xmit */
 		stats->tx_packets++;
-		writel((1 << FLEXCAN_TX_BUF_ID), &regs->iflag1);
+		flexcan_write((1 << FLEXCAN_TX_BUF_ID), &regs->iflag1);
 		netif_wake_queue(dev);
 	}
 
@@ -599,7 +624,7 @@ static void flexcan_set_bittiming(struct net_device *dev)
 	struct flexcan_regs __iomem *regs = priv->base;
 	u32 reg;
 
-	reg = readl(&regs->ctrl);
+	reg = flexcan_read(&regs->ctrl);
 	reg &= ~(FLEXCAN_CTRL_PRESDIV(0xff) |
 		 FLEXCAN_CTRL_RJW(0x3) |
 		 FLEXCAN_CTRL_PSEG1(0x7) |
@@ -623,11 +648,11 @@ static void flexcan_set_bittiming(struct net_device *dev)
 		reg |= FLEXCAN_CTRL_SMP;
 
 	dev_info(dev->dev.parent, "writing ctrl=0x%08x\n", reg);
-	writel(reg, &regs->ctrl);
+	flexcan_write(reg, &regs->ctrl);
 
 	/* print chip status */
 	dev_dbg(dev->dev.parent, "%s: mcr=0x%08x ctrl=0x%08x\n", __func__,
-		readl(&regs->mcr), readl(&regs->ctrl));
+		flexcan_read(&regs->mcr), flexcan_read(&regs->ctrl));
 }
 
 /*
@@ -648,10 +673,10 @@ static int flexcan_chip_start(struct net_device *dev)
 	flexcan_chip_enable(priv);
 
 	/* soft reset */
-	writel(FLEXCAN_MCR_SOFTRST, &regs->mcr);
+	flexcan_write(FLEXCAN_MCR_SOFTRST, &regs->mcr);
 	udelay(10);
 
-	reg_mcr = readl(&regs->mcr);
+	reg_mcr = flexcan_read(&regs->mcr);
 	if (reg_mcr & FLEXCAN_MCR_SOFTRST) {
 		dev_err(dev->dev.parent,
 			"Failed to softreset can module (mcr=0x%08x)\n",
@@ -673,12 +698,12 @@ static int flexcan_chip_start(struct net_device *dev)
 	 * choose format C
 	 *
 	 */
-	reg_mcr = readl(&regs->mcr);
+	reg_mcr = flexcan_read(&regs->mcr);
 	reg_mcr |= FLEXCAN_MCR_FRZ | FLEXCAN_MCR_FEN | FLEXCAN_MCR_HALT |
 		FLEXCAN_MCR_SUPV | FLEXCAN_MCR_WRN_EN |
 		FLEXCAN_MCR_IDAM_C;
 	dev_dbg(dev->dev.parent, "%s: writing mcr=0x%08x", __func__, reg_mcr);
-	writel(reg_mcr, &regs->mcr);
+	flexcan_write(reg_mcr, &regs->mcr);
 
 	/*
 	 * CTRL
@@ -696,7 +721,7 @@ static int flexcan_chip_start(struct net_device *dev)
 	 * (FLEXCAN_CTRL_ERR_MSK), too. Otherwise we don't get any
 	 * warning or bus passive interrupts.
 	 */
-	reg_ctrl = readl(&regs->ctrl);
+	reg_ctrl = flexcan_read(&regs->ctrl);
 	reg_ctrl &= ~FLEXCAN_CTRL_TSYN;
 	reg_ctrl |= FLEXCAN_CTRL_BOFF_REC | FLEXCAN_CTRL_LBUF |
 		FLEXCAN_CTRL_ERR_STATE | FLEXCAN_CTRL_ERR_MSK;
@@ -704,38 +729,39 @@ static int flexcan_chip_start(struct net_device *dev)
 	/* save for later use */
 	priv->reg_ctrl_default = reg_ctrl;
 	dev_dbg(dev->dev.parent, "%s: writing ctrl=0x%08x", __func__, reg_ctrl);
-	writel(reg_ctrl, &regs->ctrl);
+	flexcan_write(reg_ctrl, &regs->ctrl);
 
 	for (i = 0; i < ARRAY_SIZE(regs->cantxfg); i++) {
-		writel(0, &regs->cantxfg[i].can_ctrl);
-		writel(0, &regs->cantxfg[i].can_id);
-		writel(0, &regs->cantxfg[i].data[0]);
-		writel(0, &regs->cantxfg[i].data[1]);
+		flexcan_write(0, &regs->cantxfg[i].can_ctrl);
+		flexcan_write(0, &regs->cantxfg[i].can_id);
+		flexcan_write(0, &regs->cantxfg[i].data[0]);
+		flexcan_write(0, &regs->cantxfg[i].data[1]);
 
 		/* put MB into rx queue */
-		writel(FLEXCAN_MB_CNT_CODE(0x4), &regs->cantxfg[i].can_ctrl);
+		flexcan_write(FLEXCAN_MB_CNT_CODE(0x4),
+			&regs->cantxfg[i].can_ctrl);
 	}
 
 	/* acceptance mask/acceptance code (accept everything) */
-	writel(0x0, &regs->rxgmask);
-	writel(0x0, &regs->rx14mask);
-	writel(0x0, &regs->rx15mask);
+	flexcan_write(0x0, &regs->rxgmask);
+	flexcan_write(0x0, &regs->rx14mask);
+	flexcan_write(0x0, &regs->rx15mask);
 
 	flexcan_transceiver_switch(priv, 1);
 
 	/* synchronize with the can bus */
-	reg_mcr = readl(&regs->mcr);
+	reg_mcr = flexcan_read(&regs->mcr);
 	reg_mcr &= ~FLEXCAN_MCR_HALT;
-	writel(reg_mcr, &regs->mcr);
+	flexcan_write(reg_mcr, &regs->mcr);
 
 	priv->can.state = CAN_STATE_ERROR_ACTIVE;
 
 	/* enable FIFO interrupts */
-	writel(FLEXCAN_IFLAG_DEFAULT, &regs->imask1);
+	flexcan_write(FLEXCAN_IFLAG_DEFAULT, &regs->imask1);
 
 	/* print chip status */
 	dev_dbg(dev->dev.parent, "%s: reading mcr=0x%08x ctrl=0x%08x\n",
-		__func__, readl(&regs->mcr), readl(&regs->ctrl));
+		__func__, flexcan_read(&regs->mcr), flexcan_read(&regs->ctrl));
 
 	return 0;
 
@@ -757,12 +783,12 @@ static void flexcan_chip_stop(struct net_device *dev)
 	u32 reg;
 
 	/* Disable all interrupts */
-	writel(0, &regs->imask1);
+	flexcan_write(0, &regs->imask1);
 
 	/* Disable + halt module */
-	reg = readl(&regs->mcr);
+	reg = flexcan_read(&regs->mcr);
 	reg |= FLEXCAN_MCR_MDIS | FLEXCAN_MCR_HALT;
-	writel(reg, &regs->mcr);
+	flexcan_write(reg, &regs->mcr);
 
 	flexcan_transceiver_switch(priv, 0);
 	priv->can.state = CAN_STATE_STOPPED;
@@ -854,24 +880,24 @@ static int __devinit register_flexcandev(struct net_device *dev)
 
 	/* select "bus clock", chip must be disabled */
 	flexcan_chip_disable(priv);
-	reg = readl(&regs->ctrl);
+	reg = flexcan_read(&regs->ctrl);
 	reg |= FLEXCAN_CTRL_CLK_SRC;
-	writel(reg, &regs->ctrl);
+	flexcan_write(reg, &regs->ctrl);
 
 	flexcan_chip_enable(priv);
 
 	/* set freeze, halt and activate FIFO, restrict register access */
-	reg = readl(&regs->mcr);
+	reg = flexcan_read(&regs->mcr);
 	reg |= FLEXCAN_MCR_FRZ | FLEXCAN_MCR_HALT |
 		FLEXCAN_MCR_FEN | FLEXCAN_MCR_SUPV;
-	writel(reg, &regs->mcr);
+	flexcan_write(reg, &regs->mcr);
 
 	/*
 	 * Currently we only support newer versions of this core
 	 * featuring a RX FIFO. Older cores found on some Coldfire
 	 * derivates are not yet supported.
 	 */
-	reg = readl(&regs->mcr);
+	reg = flexcan_read(&regs->mcr);
 	if (!(reg & FLEXCAN_MCR_FEN)) {
 		dev_err(dev->dev.parent,
 			"Could not enable RX FIFO, unsupported core\n");
-- 
1.7.2.1

^ permalink raw reply related

* [PATCH v11 1/5] flexcan: Remove #include <mach/clock.h>
From: Robin Holt @ 2011-08-10 16:27 UTC (permalink / raw)
  To: Robin Holt, Kumar Gala, Wolfgang Grandegger, U Bhaskar-B22300
  Cc: netdev, U Bhaskar-B22300, socketcan-core, Robin Holt, PPC list
In-Reply-To: <1312993670-23999-1-git-send-email-holt@sgi.com>

powerpc does not have a mach-####/clock.h.  When testing, I found neither
arm nor powerpc needed the mach/clock.h at all so I removed it.

Signed-off-by: Robin Holt <holt@sgi.com>
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
Acked-by: Wolfgang Grandegger <wg@grandegger.com>
Cc: U Bhaskar-B22300 <B22300@freescale.com>
Cc: socketcan-core@lists.berlios.de
Cc: netdev@vger.kernel.org
Cc: PPC list <linuxppc-dev@lists.ozlabs.org>
---
 drivers/net/can/flexcan.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 1767811..586b2cd 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -35,8 +35,6 @@
 #include <linux/module.h>
 #include <linux/platform_device.h>
 
-#include <mach/clock.h>
-
 #define DRV_NAME			"flexcan"
 
 /* 8 for RX fifo and 2 error handling */
-- 
1.7.2.1

^ permalink raw reply related

* [PATCH v11 0/5] flexcan/powerpc: Add support for powerpc flexcan (freescale p1010)
From: Robin Holt @ 2011-08-10 16:27 UTC (permalink / raw)
  To: Robin Holt, Kumar Gala, Wolfgang Grandegger, U Bhaskar-B22300
  Cc: socketcan-core, netdev, PPC list, Robin Holt

With all the patches applied, my p1010rdb works for communicating between
its two can ports and also can communicate with an external PSOC.  I have
done no testing beyond compile testing on an arm system as I have no
access to an arm based system.

For the first three patches in the series, I believe they are all ready
for forwarding to David S. Miller for the netdev tree.  I think patch
4 is ready for submission to the PPC85xx maintainer.  Patch 5 changed
from the previous post by adding a second compatible string for the
fsl,flexcan-p1010 and bringing back the Documentation file in a more
correct form.

Thanks,
Robin Holt

^ permalink raw reply

* [PATCH v11 5/5] powerpc: Fix up fsl-flexcan device tree binding.
From: Robin Holt @ 2011-08-10 16:27 UTC (permalink / raw)
  To: Robin Holt, Kumar Gala, Wolfgang Grandegger, U Bhaskar-B22300,
	Scott Wood, Grant Likely
  Cc: netdev, devicetree-discuss, socketcan-core, Robin Holt, PPC list
In-Reply-To: <1312993670-23999-1-git-send-email-holt@sgi.com>

This patch cleans up the documentation of the device-tree binding for
the Flexcan devices on Freescale's PowerPC and ARM cores. Extra
properties are not needed as the frequency of the source clock is
fixed, there is not external divider beyond what the driver already
works with, and the clock source can not be selected.

Signed-off-by: Robin Holt <holt@sgi.com>
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>,
To: Wolfgang Grandegger <wg@grandegger.com>,
To: U Bhaskar-B22300 <B22300@freescale.com>
To: Scott Wood <scottwood@freescale.com>
To: Grant Likely <grant.likely@secretlab.ca>
To: Kumar Gala <galak@kernel.crashing.org>
Cc: socketcan-core@lists.berlios.de,
Cc: netdev@vger.kernel.org,
Cc: PPC list <linuxppc-dev@lists.ozlabs.org>
Cc: devicetree-discuss@lists.ozlabs.org
---
 .../devicetree/bindings/net/can/fsl-flexcan.txt    |   70 ++++----------------
 arch/powerpc/boot/dts/p1010rdb.dts                 |   10 +--
 arch/powerpc/boot/dts/p1010si.dtsi                 |   10 +--
 3 files changed, 19 insertions(+), 71 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt b/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
index 1a729f0..869f4ca 100644
--- a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
+++ b/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
@@ -1,61 +1,17 @@
-CAN Device Tree Bindings
-------------------------
-2011 Freescale Semiconductor, Inc.
+Flexcan CAN contoller on Freescale's ARM and PowerPC processors
 
-fsl,flexcan-v1.0 nodes
------------------------
-In addition to the required compatible-, reg- and interrupt-properties, you can
-also specify which clock source shall be used for the controller.
+Required properties:
 
-CPI Clock- Can Protocol Interface Clock
-	This CLK_SRC bit of CTRL(control register) selects the clock source to
-	the CAN Protocol Interface(CPI) to be either the peripheral clock
-	(driven by the PLL) or the crystal oscillator clock. The selected clock
-	is the one fed to the prescaler to generate the Serial Clock (Sclock).
-	The PRESDIV field of CTRL(control register) controls a prescaler that
-	generates the Serial Clock (Sclock), whose period defines the
-	time quantum used to compose the CAN waveform.
+- compatible : Should be "fsl,flexcan" and optionally
+               "fsl,flexcan-<processor>"
+- reg : Offset and length of the register set for this device
+- interrupts : Interrupt tuple for this device
 
-Can Engine Clock Source
-	There are two sources for CAN clock
-	- Platform Clock  It represents the bus clock
-	- Oscillator Clock
+Example:
 
-	Peripheral Clock (PLL)
-	--------------
-		     |
-		    ---------		      -------------
-		    |       |CPI Clock	      | Prescaler |       Sclock
-		    |       |---------------->| (1.. 256) |------------>
-		    ---------		      -------------
-                     |  |
-	--------------  ---------------------CLK_SRC
-	Oscillator Clock
-
-- fsl,flexcan-clock-source : CAN Engine Clock Source.This property selects
-			     the peripheral clock. PLL clock is fed to the
-			     prescaler to generate the Serial Clock (Sclock).
-			     Valid values are "oscillator" and "platform"
-			     "oscillator": CAN engine clock source is oscillator clock.
-			     "platform" The CAN engine clock source is the bus clock
-		             (platform clock).
-
-- fsl,flexcan-clock-divider : for the reference and system clock, an additional
-			      clock divider can be specified.
-- clock-frequency: frequency required to calculate the bitrate for FlexCAN.
-
-Note:
-	- v1.0 of flexcan-v1.0 represent the IP block version for P1010 SOC.
-	- P1010 does not have oscillator as the Clock Source.So the default
-	  Clock Source is platform clock.
-Examples:
-
-	can0@1c000 {
-		compatible = "fsl,flexcan-v1.0";
-		reg = <0x1c000 0x1000>;
-		interrupts = <48 0x2>;
-		interrupt-parent = <&mpic>;
-		fsl,flexcan-clock-source = "platform";
-		fsl,flexcan-clock-divider = <2>;
-		clock-frequency = <fixed by u-boot>;
-	};
+  can@1c000 {
+          compatible = "fsl,p1010-flexcan", "fsl,flexcan";
+          reg = <0x1c000 0x1000>;
+          interrupts = <48 0x2>;
+          interrupt-parent = <&mpic>;
+  };
diff --git a/arch/powerpc/boot/dts/p1010rdb.dts b/arch/powerpc/boot/dts/p1010rdb.dts
index 6b33b73..d6c669c 100644
--- a/arch/powerpc/boot/dts/p1010rdb.dts
+++ b/arch/powerpc/boot/dts/p1010rdb.dts
@@ -23,6 +23,8 @@
 		ethernet2 = &enet2;
 		pci0 = &pci0;
 		pci1 = &pci1;
+		can0 = &can0;
+		can1 = &can1;
 	};
 
 	memory {
@@ -169,14 +171,6 @@
 			};
 		};
 
-		can0@1c000 {
-			fsl,flexcan-clock-source = "platform";
-		};
-
-		can1@1d000 {
-			fsl,flexcan-clock-source = "platform";
-		};
-
 		usb@22000 {
 			phy_type = "utmi";
 		};
diff --git a/arch/powerpc/boot/dts/p1010si.dtsi b/arch/powerpc/boot/dts/p1010si.dtsi
index 7f51104..f00076b 100644
--- a/arch/powerpc/boot/dts/p1010si.dtsi
+++ b/arch/powerpc/boot/dts/p1010si.dtsi
@@ -140,20 +140,18 @@
 			interrupt-parent = <&mpic>;
 		};
 
-		can0@1c000 {
-			compatible = "fsl,flexcan-v1.0";
+		can0: can@1c000 {
+			compatible = "fsl,p1010-flexcan", "fsl,flexcan";
 			reg = <0x1c000 0x1000>;
 			interrupts = <48 0x2>;
 			interrupt-parent = <&mpic>;
-			fsl,flexcan-clock-divider = <2>;
 		};
 
-		can1@1d000 {
-			compatible = "fsl,flexcan-v1.0";
+		can1: can@1d000 {
+			compatible = "fsl,p1010-flexcan", "fsl,flexcan";
 			reg = <0x1d000 0x1000>;
 			interrupts = <61 0x2>;
 			interrupt-parent = <&mpic>;
-			fsl,flexcan-clock-divider = <2>;
 		};
 
 		L2: l2-cache-controller@20000 {
-- 
1.7.2.1

^ permalink raw reply related

* [PATCH v11 3/5] flexcan: Add of_match to platform_device definition.
From: Robin Holt @ 2011-08-10 16:27 UTC (permalink / raw)
  To: Robin Holt, Kumar Gala, Wolfgang Grandegger, U Bhaskar-B22300
  Cc: socketcan-core, netdev, devicetree-discuss, U Bhaskar-B22300,
	Robin Holt, PPC list
In-Reply-To: <1312993670-23999-1-git-send-email-holt@sgi.com>

On powerpc, the OpenFirmware devices are not matched without specifying
an of_match array.  Introduce that array as that is used for matching
on the Freescale P1010 processor.

Signed-off-by: Robin Holt <holt@sgi.com>
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
Acked-by: Wolfgang Grandegger <wg@grandegger.com>
Cc: U Bhaskar-B22300 <B22300@freescale.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: socketcan-core@lists.berlios.de
Cc: netdev@vger.kernel.org
Cc: PPC list <linuxppc-dev@lists.ozlabs.org>
Cc: devicetree-discuss@lists.ozlabs.org
---
 drivers/net/can/flexcan.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 68cbe52..662f832 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -1027,8 +1027,19 @@ static int __devexit flexcan_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static struct of_device_id flexcan_of_match[] = {
+	{
+		.compatible = "fsl,flexcan",
+	},
+	{},
+};
+
 static struct platform_driver flexcan_driver = {
-	.driver.name = DRV_NAME,
+	.driver = {
+		.name = DRV_NAME,
+		.owner = THIS_MODULE,
+		.of_match_table = flexcan_of_match,
+	},
 	.probe = flexcan_probe,
 	.remove = __devexit_p(flexcan_remove),
 };
-- 
1.7.2.1

^ permalink raw reply related

* Re: [PATCH 5/5] [powerpc] Fix up fsl-flexcan device tree binding.
From: Robin Holt @ 2011-08-10 16:16 UTC (permalink / raw)
  To: Kumar Gala
  Cc: netdev, devicetree-discuss@lists.ozlabs.org, U Bhaskar-B22300,
	socketcan-core, Robin Holt, Scott Wood, PPC list
In-Reply-To: <97251371-2772-42A5-A959-D9F7A8D0A65B@kernel.crashing.org>

On Wed, Aug 10, 2011 at 09:52:07AM -0500, Kumar Gala wrote:
> 
> On Aug 9, 2011, at 3:59 PM, Robin Holt wrote:
> 
> > I guess my poor wording may have gotten me in trouble.  I am getting
> > ready to repost this patch, but I want to ensure I am getting it as
> > right as possible.
> > 
> > I think I should reword the commit message to indicate we are removing
> > the Documentation/.../fsl-flexcan.txt file which has essentially become
> > empty and change the p1010si.dtsi file's can nodes to "fsl,p1010-flexcan",
> > "fsl,flexcan".  Is that correct?
> > 
> > Thanks,
> > Robin
> 
> This is wrong.  Again, what binding covers "fsl,flexcan" if you remove fsl-flexcan.txt:
> 
> [galak@right powerpc]$ git grep flexcan Documentation/devicetree/bindings
> Documentation/devicetree/bindings/net/can/fsl-flexcan.txt:fsl,flexcan-v1.0 nodes
> Documentation/devicetree/bindings/net/can/fsl-flexcan.txt:- fsl,flexcan-clock-source : CAN Engine Clock Source.This property selects
> Documentation/devicetree/bindings/net/can/fsl-flexcan.txt:- fsl,flexcan-clock-divider : for the reference and system clock, an additional
> Documentation/devicetree/bindings/net/can/fsl-flexcan.txt:      - v1.0 of flexcan-v1.0 represent the IP block version for P1010 SOC.
> Documentation/devicetree/bindings/net/can/fsl-flexcan.txt:              compatible = "fsl,flexcan-v1.0";
> Documentation/devicetree/bindings/net/can/fsl-flexcan.txt:              fsl,flexcan-clock-source = "platform";
> Documentation/devicetree/bindings/net/can/fsl-flexcan.txt:              fsl,flexcan-clock-divider = <2>;
> 
> Not seeing anything that covers it.
> 
> I think the issue should be resolved by patching fsl-flexcan.txt to remove wording or update it.

Done.

Robin

^ permalink raw reply

* Re: [PATCH v3] powerpc: 85xx: separate e500 from e500mc
From: Scott Wood @ 2011-08-10 16:01 UTC (permalink / raw)
  To: Paul Gortmaker; +Cc: Baruch Siach, linuxppc-dev, Timur Tabi
In-Reply-To: <CAP=VYLoNSaVyfLyKDun-aBEQy+UzKJNwphs2U_74AhKAHgch_Q@mail.gmail.com>

On 08/10/2011 10:39 AM, Paul Gortmaker wrote:
> On Wed, Aug 10, 2011 at 1:21 AM, Baruch Siach <baruch@tkos.co.il> wrote:
>> CONFIG_E500MC breaks e500/e500v2 systems. It defines L1_CACHE_SHIFT to 6, thus
>> breaking clear_pages(), probably others too.
>>
>> This patch adds a new "Processor Type" entry for e500mc, and makes e500 systems
>> depend on PPC_E500_V1_V2.
> 
> Isn't the original invalid configuration still possible, i.e. I can
> choose E500_V1_V2
> and also E500MC at the same time, unless you add something like a
> "depends !E500MC" to  your new V1_V2 option?

They're members of a "choice", not standalone bools -- so they're
mutually exclusive.

> Alternatively, you could treat it like using i386 kernel on a modern
> core by taking
> the LCD for the L1_CACHE_SHIFT of the configured in platforms. 

For alignment you want to err on the high side, but for invalidation you
want to err on the low side.  For dcbz you can't err at all.

And there are other issues than cache size with combining e500v2 and e500mc.

Could it be done with sufficient hoop-jumping?  Probably.  Is it worth
it?  No.  These chips don't even have compatible userspace, unless you
use soft-float.

> I have booted
> a kernel built for an mpc8548 core on a P4080 CPU, so that does work (with only
> minimal dts fiddling).

The opposite direction does not work, and simply booting doesn't mean
there wouldn't be issues in running that kernel on a p4080 (floating
point?  bad cache size information being given to userspace?  emulation
of non-cacheable dcbz?  performance?).

What dts fiddling?

> And it keeps the ability to boot one kernel on several
> platforms open (one of the reasons for the ppc --> powerpc shuffle a couple
> of years ago...)

It's much better than the arch/ppc way of a separate kernel build for
every board.  Beyond a certain point there are diminishing returns on
the effort.

-Scott

^ permalink raw reply

* Re: [PATCH v10 5/5] [powerpc] Fix up fsl-flexcan device tree binding.
From: Robin Holt @ 2011-08-10 16:00 UTC (permalink / raw)
  To: U Bhaskar-B22300
  Cc: Wood Scott-B07421, netdev@vger.kernel.org,
	socketcan-core@lists.berlios.de, Robin Holt, PPC list
In-Reply-To: <9C64B7751C3BCA41B64A68E23005A7BE1C6A21@039-SN1MPN1-002.039d.mgd.msft.net>

On Wed, Aug 10, 2011 at 02:36:20PM +0000, U Bhaskar-B22300 wrote:
> 
> 
> > -----Original Message-----
> > From: Robin Holt [mailto:holt@sgi.com]
> > Sent: Wednesday, August 10, 2011 7:46 PM
> > To: Wolfgang Grandegger
> > Cc: Robin Holt; Marc Kleine-Budde; U Bhaskar-B22300; Wood Scott-B07421;
> > netdev@vger.kernel.org; Kumar Gala; socketcan-core@lists.berlios.de; PPC
> > list
> > Subject: Re: [PATCH v10 5/5] [powerpc] Fix up fsl-flexcan device tree
> > binding.
> > 
> > On Wed, Aug 10, 2011 at 03:47:43PM +0200, Wolfgang Grandegger wrote:
> > > Hi Robin,
> > >
> > > On 08/10/2011 05:06 AM, Robin Holt wrote:
> > > > In working with the socketcan developers, we have come to the
> > > > conclusion the Documentation...fsl-flexcan.txt device tree
> > > > documentation needs to be cleaned up.  The driver does not depend
> > > > upon any properties other
> > >
> > > Your first sentence could be misleading. Please just describe what the
> > > patch does and why, something like:
> > >
> > > "This patch cleans up the documentation of the device-tree binding for
> > > the Flexcan devices on Freescale's PowerPC and ARM cores. Extra
> > > properties are not needed as the frequency of the source clock is
> > > fixed..." and so on.
> > 
> > I borrowed heavily from your message. ;)
> > 
> > > > than the required properties so we are removing the file.
> > > > Additionally, the p1010*dts* files are not following the standard
> > > > for node naming in that they have a trailing -v1.0.
> > >
> > > > Signed-off-by: Robin Holt <holt@sgi.com>
> > > > To: Marc Kleine-Budde <mkl@pengutronix.de>,
> > > > To: Wolfgang Grandegger <wg@grandegger.com>,
> > > > To: U Bhaskar-B22300 <B22300@freescale.com>
> > > > To: Scott Wood <scottwood@freescale.com>
> > > > Cc: socketcan-core@lists.berlios.de,
> > > > Cc: netdev@vger.kernel.org,
> > > > Cc: PPC list <linuxppc-dev@lists.ozlabs.org>
> > > > Cc: Kumar Gala <galak@kernel.crashing.org>
> > > > ---
> > > >  .../devicetree/bindings/net/can/fsl-flexcan.txt    |   61 ----------
> > ----------
> > > >  arch/powerpc/boot/dts/p1010rdb.dts                 |    8 ---
> > > >  arch/powerpc/boot/dts/p1010si.dtsi                 |    8 +-
> > > >  3 files changed, 4 insertions(+), 73 deletions(-)  delete mode
> > > > 100644 Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
> > > >
> > > > diff --git
> > > > a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
> > > > b/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
> > > > deleted file mode 100644
> > > > index 1a729f0..0000000
> > > > --- a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
> > > > +++ /dev/null
> > > > @@ -1,61 +0,0 @@
> > > > -CAN Device Tree Bindings
> > > > -------------------------
> > > > -2011 Freescale Semiconductor, Inc.
> > > > -
> > > > -fsl,flexcan-v1.0 nodes
> > > > ------------------------
> > > > -In addition to the required compatible-, reg- and
> > > > interrupt-properties, you can -also specify which clock source shall
> > be used for the controller.
> > > > -
> > > > -CPI Clock- Can Protocol Interface Clock
> > > > -	This CLK_SRC bit of CTRL(control register) selects the clock source
> > to
> > > > -	the CAN Protocol Interface(CPI) to be either the peripheral clock
> > > > -	(driven by the PLL) or the crystal oscillator clock. The selected
> > clock
> > > > -	is the one fed to the prescaler to generate the Serial Clock
> > (Sclock).
> > > > -	The PRESDIV field of CTRL(control register) controls a prescaler
> > that
> > > > -	generates the Serial Clock (Sclock), whose period defines the
> > > > -	time quantum used to compose the CAN waveform.
> > > > -
> > > > -Can Engine Clock Source
> > > > -	There are two sources for CAN clock
> > > > -	- Platform Clock  It represents the bus clock
> > > > -	- Oscillator Clock
> > > > -
> > > > -	Peripheral Clock (PLL)
> > > > -	--------------
> > > > -		     |
> > > > -		    ---------		      -------------
> > > > -		    |       |CPI Clock	      | Prescaler |       Sclock
> > > > -		    |       |---------------->| (1.. 256) |------------>
> > > > -		    ---------		      -------------
> > > > -                     |  |
> > > > -	--------------  ---------------------CLK_SRC
> > > > -	Oscillator Clock
> > > > -
> > > > -- fsl,flexcan-clock-source : CAN Engine Clock Source.This property
> > selects
> > > > -			     the peripheral clock. PLL clock is fed to the
> > > > -			     prescaler to generate the Serial Clock (Sclock).
> > > > -			     Valid values are "oscillator" and "platform"
> > > > -			     "oscillator": CAN engine clock source is
> > oscillator clock.
> > > > -			     "platform" The CAN engine clock source is the bus
> > clock
> > > > -		             (platform clock).
> > > > -
> > > > -- fsl,flexcan-clock-divider : for the reference and system clock, an
> > additional
> > > > -			      clock divider can be specified.
> > > > -- clock-frequency: frequency required to calculate the bitrate for
> > FlexCAN.
> > > > -
> > > > -Note:
> > > > -	- v1.0 of flexcan-v1.0 represent the IP block version for P1010
> > SOC.
> > > > -	- P1010 does not have oscillator as the Clock Source.So the default
> > > > -	  Clock Source is platform clock.
> > > > -Examples:
> > > > -
> > > > -	can0@1c000 {
> > > > -		compatible = "fsl,flexcan-v1.0";
> > > > -		reg = <0x1c000 0x1000>;
> > > > -		interrupts = <48 0x2>;
> > > > -		interrupt-parent = <&mpic>;
> > > > -		fsl,flexcan-clock-source = "platform";
> > > > -		fsl,flexcan-clock-divqider = <2>;
> > > > -		clock-frequency = <fixed by u-boot>;
> > > > -	};
> > >
> > > Do we really want to drop the documentation for that binding. I think
> > > something like the following text would be still useful:
> > >
> > > ------------------------
> > > Flexcan CAN contoller on Freescale's ARM and PowerPC processors
> > >
> > > Required properties:
> > >
> > > - compatible : Should be "fsl,flexcan" and optionally
> > >                "fsl,flexcan-<processor>"
> > > - reg : Offset and length of the register set for this device
> > > - interrupts : Interrupt tuple for this device
> > >
> > > Example:
> > >
> > >   can@1c000 {
> > >           compatible = "fsl,p1010-flexcan", "fsl,flexcan";
> > >           reg = <0x1c000 0x1000>;
> > >           interrupts = <48 0x2>;
> > >           interrupt-parent = <&mpic>;
> > >   };
> > > -------------------------
> > 
> > Done, except the
> > >           compatible = "fsl,p1010-flexcan", "fsl,flexcan";
> > 
> > line is
> > 	compatible = "fsl,flexcan", "fsl,flexcan-p1010";
> > 
> > >
> > > What do you think?
> > >
> > > > diff --git a/arch/powerpc/boot/dts/p1010rdb.dts
> > > > b/arch/powerpc/boot/dts/p1010rdb.dts
> > > > index 6b33b73..d6a0bb2 100644
> > > > --- a/arch/powerpc/boot/dts/p1010rdb.dts
> > > > +++ b/arch/powerpc/boot/dts/p1010rdb.dts
> > > > @@ -169,14 +169,6 @@
> > > >  			};
> > > >  		};
> > > >
> > > > -		can0@1c000 {
> > > > -			fsl,flexcan-clock-source = "platform";
> > > > -		};
> > > > -
> > > > -		can1@1d000 {
> > > > -			fsl,flexcan-clock-source = "platform";
> > > > -		};
> > > > -
> > > >  		usb@22000 {
> > > >  			phy_type = "utmi";
> > > >  		};
> > > > diff --git a/arch/powerpc/boot/dts/p1010si.dtsi
> > > > b/arch/powerpc/boot/dts/p1010si.dtsi
> > > > index 7f51104..20c396d 100644
> > > > --- a/arch/powerpc/boot/dts/p1010si.dtsi
> > > > +++ b/arch/powerpc/boot/dts/p1010si.dtsi
> > > > @@ -141,19 +141,19 @@
> > > >  		};
> > > >
> > > >  		can0@1c000 {
> > > > -			compatible = "fsl,flexcan-v1.0";
> > > > +			compatible = "fsl,p1010-flexcan",
> > > > +					"fsl,flexcan";
> > >
> > > Does fit on one line.
> > >
> > > >  			reg = <0x1c000 0x1000>;
> > > >  			interrupts = <48 0x2>;
> > > >  			interrupt-parent = <&mpic>;
> > > > -			fsl,flexcan-clock-divider = <2>;
> > > >  		};
> > > >
> > > >  		can1@1d000 {
> > > > -			compatible = "fsl,flexcan-v1.0";
> > > > +			compatible = "fsl,p1010-flexcan",
> > > > +					"fsl,flexcan";
> > >
> > > Ditto
> > >
> > > >  			reg = <0x1d000 0x1000>;
> > > >  			interrupts = <61 0x2>;
> > > >  			interrupt-parent = <&mpic>;
> > > > -			fsl,flexcan-clock-divider = <2>;
> > > >  		};
> > > >
> > > >  		L2: l2-cache-controller@20000 {
> > >
> > > Please also correct the node names (not using the number suffix).
> > 
> > So the node names should be
> > 		can@1c000 {
> > 		can@1d000 {
> > correct?
> > 
> [Bhaskar] As there are two CAN controllers on P1010,So won't it be better
> 	    to distinguish it by can0 and can1 instead by simple "can" ?

It looks like the way to do that is to assign a label to those devices
and then associate the label with an alias.  I have no idea how that
works under the hood, but it is the way other files are set up.  Take a
look at arch/powerpc/boot/dts/bamboo.dts for how they define the serial
interfaces.

Grant or Wolfgang, is that the right way to handle the concern about
names or does it have no practical effect with the Linux kernel?

Thanks,
Robin

^ permalink raw reply

* Re: [PATCH v3] powerpc: 85xx: separate e500 from e500mc
From: Paul Gortmaker @ 2011-08-10 15:39 UTC (permalink / raw)
  To: Baruch Siach; +Cc: Scott Wood, linuxppc-dev, Timur Tabi
In-Reply-To: <b965536bbd0457ab9614777dc00fc0dd22cf1d47.1312953203.git.baruch@tkos.co.il>

On Wed, Aug 10, 2011 at 1:21 AM, Baruch Siach <baruch@tkos.co.il> wrote:
> CONFIG_E500MC breaks e500/e500v2 systems. It defines L1_CACHE_SHIFT to 6,=
 thus
> breaking clear_pages(), probably others too.
>
> This patch adds a new "Processor Type" entry for e500mc, and makes e500 s=
ystems
> depend on PPC_E500_V1_V2.

Isn't the original invalid configuration still possible, i.e. I can
choose E500_V1_V2
and also E500MC at the same time, unless you add something like a
"depends !E500MC" to  your new V1_V2 option?

Alternatively, you could treat it like using i386 kernel on a modern
core by taking
the LCD for the L1_CACHE_SHIFT of the configured in platforms.  I have boot=
ed
a kernel built for an mpc8548 core on a P4080 CPU, so that does work (with =
only
minimal dts fiddling).  And it keeps the ability to boot one kernel on seve=
ral
platforms open (one of the reasons for the ppc --> powerpc shuffle a couple
of years ago...)

Paul.

>
> Cc: Kumar Gala <galak@kernel.crashing.org>
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> ---
>
> Changes from v2:
>
> =A0 =A0 =A0 =A0* s/CONFIG_PPC_E500/CONFIG_PPC_E500_V1_V2/ to avoid confus=
ion as
> =A0 =A0 =A0 =A0 =A0noted by Scott Wood
>
> Changes from v1:
>
> =A0 =A0 =A0 =A0* Rebase on 3.1-rc1
>
> =A0 =A0 =A0 =A0* Remove the list of processor families from the PPC_E500 =
and
> =A0 =A0 =A0 =A0 =A0PPC_E500MC options description. The P20xx can be eithe=
r e500v2 or
> =A0 =A0 =A0 =A0 =A0e500mc.
>
> =A0arch/powerpc/platforms/85xx/Kconfig =A0 =A0| =A0 13 +++++++++----
> =A0arch/powerpc/platforms/Kconfig.cputype | =A0 27 +++++++++++++++-------=
-----
> =A02 files changed, 24 insertions(+), 16 deletions(-)
>
> diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms=
/85xx/Kconfig
> index 498534c..00d4720 100644
> --- a/arch/powerpc/platforms/85xx/Kconfig
> +++ b/arch/powerpc/platforms/85xx/Kconfig
> @@ -13,6 +13,8 @@ if FSL_SOC_BOOKE
>
> =A0if PPC32
>
> +if PPC_E500_V1_V2
> +
> =A0config MPC8540_ADS
> =A0 =A0 =A0 =A0bool "Freescale MPC8540 ADS"
> =A0 =A0 =A0 =A0select DEFAULT_UIMAGE
> @@ -171,10 +173,13 @@ config SBC8560
> =A0 =A0 =A0 =A0help
> =A0 =A0 =A0 =A0 =A0This option enables support for the Wind River SBC8560=
 board
>
> +endif # PPC_E500_V1_V2
> +
> +if PPC_E500MC
> +
> =A0config P2040_RDB
> =A0 =A0 =A0 =A0bool "Freescale P2040 RDB"
> =A0 =A0 =A0 =A0select DEFAULT_UIMAGE
> - =A0 =A0 =A0 select PPC_E500MC
> =A0 =A0 =A0 =A0select PHYS_64BIT
> =A0 =A0 =A0 =A0select SWIOTLB
> =A0 =A0 =A0 =A0select MPC8xxx_GPIO
> @@ -186,7 +191,6 @@ config P2040_RDB
> =A0config P3041_DS
> =A0 =A0 =A0 =A0bool "Freescale P3041 DS"
> =A0 =A0 =A0 =A0select DEFAULT_UIMAGE
> - =A0 =A0 =A0 select PPC_E500MC
> =A0 =A0 =A0 =A0select PHYS_64BIT
> =A0 =A0 =A0 =A0select SWIOTLB
> =A0 =A0 =A0 =A0select MPC8xxx_GPIO
> @@ -198,7 +202,6 @@ config P3041_DS
> =A0config P4080_DS
> =A0 =A0 =A0 =A0bool "Freescale P4080 DS"
> =A0 =A0 =A0 =A0select DEFAULT_UIMAGE
> - =A0 =A0 =A0 select PPC_E500MC
> =A0 =A0 =A0 =A0select PHYS_64BIT
> =A0 =A0 =A0 =A0select SWIOTLB
> =A0 =A0 =A0 =A0select MPC8xxx_GPIO
> @@ -207,13 +210,15 @@ config P4080_DS
> =A0 =A0 =A0 =A0help
> =A0 =A0 =A0 =A0 =A0This option enables support for the P4080 DS board
>
> +endif # PPC_E500MC
> +
> =A0endif # PPC32
>
> =A0config P5020_DS
> =A0 =A0 =A0 =A0bool "Freescale P5020 DS"
> + =A0 =A0 =A0 depends on PPC_E500MC
> =A0 =A0 =A0 =A0select DEFAULT_UIMAGE
> =A0 =A0 =A0 =A0select E500
> - =A0 =A0 =A0 select PPC_E500MC
> =A0 =A0 =A0 =A0select PHYS_64BIT
> =A0 =A0 =A0 =A0select SWIOTLB
> =A0 =A0 =A0 =A0select MPC8xxx_GPIO
> diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platfo=
rms/Kconfig.cputype
> index e06e395..e6cb00c 100644
> --- a/arch/powerpc/platforms/Kconfig.cputype
> +++ b/arch/powerpc/platforms/Kconfig.cputype
> @@ -10,13 +10,13 @@ choice
> =A0 =A0 =A0 =A0prompt "Processor Type"
> =A0 =A0 =A0 =A0depends on PPC32
> =A0 =A0 =A0 =A0help
> - =A0 =A0 =A0 =A0 There are five families of 32 bit PowerPC chips support=
ed.
> + =A0 =A0 =A0 =A0 There are six families of 32 bit PowerPC chips supporte=
d.
> =A0 =A0 =A0 =A0 =A0The most common ones are the desktop and server CPUs (=
601, 603,
> =A0 =A0 =A0 =A0 =A0604, 740, 750, 74xx) CPUs from Freescale and IBM, with=
 their
> =A0 =A0 =A0 =A0 =A0embedded 512x/52xx/82xx/83xx/86xx counterparts.
> - =A0 =A0 =A0 =A0 The other embeeded parts, namely 4xx, 8xx, e200 (55xx) =
and e500
> - =A0 =A0 =A0 =A0 (85xx) each form a family of their own that is not comp=
atible
> - =A0 =A0 =A0 =A0 with the others.
> + =A0 =A0 =A0 =A0 The other embeeded parts, namely 4xx, 8xx, e200 (55xx),=
 e500
> + =A0 =A0 =A0 =A0 (85xx), and e500mc each form a family of their own that=
 is not
> + =A0 =A0 =A0 =A0 compatible with the others.
>
> =A0 =A0 =A0 =A0 =A0If unsure, select 52xx/6xx/7xx/74xx/82xx/83xx/86xx.
>
> @@ -24,10 +24,15 @@ config PPC_BOOK3S_32
> =A0 =A0 =A0 =A0bool "512x/52xx/6xx/7xx/74xx/82xx/83xx/86xx"
> =A0 =A0 =A0 =A0select PPC_FPU
>
> -config PPC_85xx
> - =A0 =A0 =A0 bool "Freescale 85xx"
> +config PPC_E500_V1_V2
> + =A0 =A0 =A0 bool "Freescale e500v1/e500v2"
> + =A0 =A0 =A0 select PPC_85xx
> =A0 =A0 =A0 =A0select E500
>
> +config PPC_E500MC
> + =A0 =A0 =A0 bool "Freescale e500mc/e5500"
> + =A0 =A0 =A0 select PPC_85xx
> +
> =A0config PPC_8xx
> =A0 =A0 =A0 =A0bool "Freescale 8xx"
> =A0 =A0 =A0 =A0select FSL_SOC
> @@ -128,15 +133,13 @@ config TUNE_CELL
> =A0config 8xx
> =A0 =A0 =A0 =A0bool
>
> -config E500
> +config PPC_85xx
> + =A0 =A0 =A0 bool
> =A0 =A0 =A0 =A0select FSL_EMB_PERFMON
> =A0 =A0 =A0 =A0select PPC_FSL_BOOK3E
> - =A0 =A0 =A0 bool
>
> -config PPC_E500MC
> - =A0 =A0 =A0 bool "e500mc Support"
> - =A0 =A0 =A0 select PPC_FPU
> - =A0 =A0 =A0 depends on E500
> +config E500
> + =A0 =A0 =A0 bool
>
> =A0config PPC_FPU
> =A0 =A0 =A0 =A0bool
> --
> 1.7.5.4
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
>

^ permalink raw reply

* Re: [PATCH v10 5/5] [powerpc] Fix up fsl-flexcan device tree binding.
From: Robin Holt @ 2011-08-10 15:35 UTC (permalink / raw)
  To: Kumar Gala
  Cc: netdev, U Bhaskar-B22300, socketcan-core, Robin Holt, Scott Wood,
	PPC list
In-Reply-To: <8ED8063F-7227-402A-89D5-7CE69241AF9C@kernel.crashing.org>

On Wed, Aug 10, 2011 at 09:45:17AM -0500, Kumar Gala wrote:
> 
> On Aug 10, 2011, at 9:15 AM, Robin Holt wrote:
> 
> > On Wed, Aug 10, 2011 at 03:47:43PM +0200, Wolfgang Grandegger wrote:
> >> Hi Robin,
> >> 
> >> On 08/10/2011 05:06 AM, Robin Holt wrote:
> >>> In working with the socketcan developers, we have come to the conclusion
> >>> the Documentation...fsl-flexcan.txt device tree documentation needs to
> >>> be cleaned up.  The driver does not depend upon any properties other
> >> 
> >> Your first sentence could be misleading. Please just describe what the
> >> patch does and why, something like:
> >> 
> >> "This patch cleans up the documentation of the device-tree binding for
> >> the Flexcan devices on Freescale's PowerPC and ARM cores. Extra
> >> properties are not needed as the frequency of the source clock is
> >> fixed..." and so on.
> > 
> > I borrowed heavily from your message. ;)
> > 
> >>> than the required properties so we are removing the file.  Additionally,
> >>> the p1010*dts* files are not following the standard for node naming in
> >>> that they have a trailing -v1.0.
> >> 
> >>> Signed-off-by: Robin Holt <holt@sgi.com>
> >>> To: Marc Kleine-Budde <mkl@pengutronix.de>,
> >>> To: Wolfgang Grandegger <wg@grandegger.com>,
> >>> To: U Bhaskar-B22300 <B22300@freescale.com>
> >>> To: Scott Wood <scottwood@freescale.com>
> >>> Cc: socketcan-core@lists.berlios.de,
> >>> Cc: netdev@vger.kernel.org,
> >>> Cc: PPC list <linuxppc-dev@lists.ozlabs.org>
> >>> Cc: Kumar Gala <galak@kernel.crashing.org>
> >>> ---
> >>> .../devicetree/bindings/net/can/fsl-flexcan.txt    |   61 --------------------
> >>> arch/powerpc/boot/dts/p1010rdb.dts                 |    8 ---
> >>> arch/powerpc/boot/dts/p1010si.dtsi                 |    8 +-
> >>> 3 files changed, 4 insertions(+), 73 deletions(-)
> >>> delete mode 100644 Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
> 
> I don't understand how we can do this?  What binding spec covers the P1010 CAN support if you remove this?

We have added it back in based upon an earlier comment from Wolfgang.
I will post a new version shortly.

Robin

^ permalink raw reply

* [git pull] Please pull powerpc.git merge branch
From: Benjamin Herrenschmidt @ 2011-08-10 15:27 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linuxppc-dev list, Andrew Morton, Linux Kernel list

Hi Linus !

Here are a few fixes for powerpc. Mostly innocuous stuff, in fact most of
it has been in my tree for a while, I just hadn't got a chance to actually
send it as I was travelling.

Cheers,
Ben.

The following changes since commit 53d1e658df6e26d62500410719aaee2b82067c03:

  Merge branch 'devicetree/merge' of git://git.secretlab.ca/git/linux-2.6 (2011-08-04 06:37:07 -1000)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc.git ..BRANCH.NOT.VERIFIED..

Anatolij Gustschin (1):
      MAINTAINERS: change maintainership of mpc5xxx

Anton Blanchard (10):
      powerpc: Fix device tree claim code
      powerpc: Clean up some panic messages in prom_init
      powerpc: Jump label misalignment causes oops at boot
      powerpc: pseries: Fix kexec on machines with more than 4TB of RAM
      powerpc: Move kdump default base address to half RMO size on 64bit
      powerpc: Lack of ibm,io-events not that important!
      powerpc: Make KVM_GUEST default to n
      powerpc/pseries: Fix kexec on recent firmware versions
      powerpc/pseries: Cleanup VPA registration and deregistration errors
      powerpc/pseries: Simplify vpa deregistration functions

Benjamin Herrenschmidt (3):
      powerpc/4xx: Fix build of PCI code on 405
      powerpc: Fix build without CONFIG_PCI
      powerpc: Really fix build without CONFIG_PCI

David Ahern (1):
      powerpc/perf: Disable pagefaults during callchain stack read

Nishanth Aravamudan (1):
      powerpc/kvm: Fix build errors with older toolchains

Peter Zijlstra (1):
      ppc: Remove duplicate definition of PV_POWER7

Scott Wood (2):
      powerpc: mtspr/mtmsr should take an unsigned long
      powerpc: Return the_cpu_ spec from identify_cpu

 MAINTAINERS                                     |    4 +-
 arch/powerpc/include/asm/jump_label.h           |    2 -
 arch/powerpc/include/asm/kdump.h                |   10 -------
 arch/powerpc/include/asm/reg.h                  |    8 +++--
 arch/powerpc/kernel/cputable.c                  |   11 ++++---
 arch/powerpc/kernel/iomap.c                     |    2 +
 arch/powerpc/kernel/machine_kexec.c             |   10 +++++--
 arch/powerpc/kernel/perf_callchain.c            |   20 +++++++++++--
 arch/powerpc/kernel/prom_init.c                 |   14 +++++----
 arch/powerpc/kvm/book3s_hv_rmhandlers.S         |    4 +-
 arch/powerpc/platforms/Kconfig                  |    2 +-
 arch/powerpc/platforms/pseries/dtl.c            |    2 +-
 arch/powerpc/platforms/pseries/hotplug-cpu.c    |    4 +-
 arch/powerpc/platforms/pseries/io_event_irq.c   |    8 ++---
 arch/powerpc/platforms/pseries/kexec.c          |   34 +++++++++++++++--------
 arch/powerpc/platforms/pseries/lpar.c           |   19 ++++++-------
 arch/powerpc/platforms/pseries/plpar_wrappers.h |   12 ++++----
 arch/powerpc/platforms/pseries/setup.c          |    5 ++-
 arch/powerpc/sysdev/ppc4xx_pci.c                |    5 ++-
 19 files changed, 99 insertions(+), 77 deletions(-)
 

^ permalink raw reply

* Re: [PATCH] powerpc/kvm: fix build errors with older toolchains
From: Alexander Graf @ 2011-08-10 14:58 UTC (permalink / raw)
  To: Nishanth Aravamudan
  Cc: kvm, Marcelo Tosatti, linux-kernel, kvm-ppc, Paul Mackerras,
	Avi Kivity, linuxppc-dev
In-Reply-To: <1312397755-15737-1-git-send-email-nacc@us.ibm.com>

On 08/03/2011 08:55 PM, Nishanth Aravamudan wrote:
> On a box with gcc 4.3.2, I see errors like:
>
> arch/powerpc/kvm/book3s_hv_rmhandlers.S:1254: Error: Unrecognized opcode: stxvd2x
> arch/powerpc/kvm/book3s_hv_rmhandlers.S:1316: Error: Unrecognized opcode: lxvd2x

Paul, mind to ack?


Alex

> Signed-off-by: Nishanth Aravamudan<nacc@us.ibm.com>
> ---
>   arch/powerpc/kvm/book3s_hv_rmhandlers.S |    4 ++--
>   1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
> index 6dd3358..de29501 100644
> --- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
> +++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
> @@ -1251,7 +1251,7 @@ BEGIN_FTR_SECTION
>   	reg = 0
>   	.rept	32
>   	li	r6,reg*16+VCPU_VSRS
> -	stxvd2x	reg,r6,r3
> +	STXVD2X(reg,r6,r3)
>   	reg = reg + 1
>   	.endr
>   FTR_SECTION_ELSE
> @@ -1313,7 +1313,7 @@ BEGIN_FTR_SECTION
>   	reg = 0
>   	.rept	32
>   	li	r7,reg*16+VCPU_VSRS
> -	lxvd2x	reg,r7,r4
> +	LXVD2X(reg,r7,r4)
>   	reg = reg + 1
>   	.endr
>   FTR_SECTION_ELSE

^ permalink raw reply

* Re: [PATCH 5/5] [powerpc] Fix up fsl-flexcan device tree binding.
From: Kumar Gala @ 2011-08-10 14:52 UTC (permalink / raw)
  To: Robin Holt
  Cc: netdev, devicetree-discuss@lists.ozlabs.org, U Bhaskar-B22300,
	socketcan-core, Scott Wood, PPC list
In-Reply-To: <20110809205900.GC4926@sgi.com>


On Aug 9, 2011, at 3:59 PM, Robin Holt wrote:

> I guess my poor wording may have gotten me in trouble.  I am getting
> ready to repost this patch, but I want to ensure I am getting it as
> right as possible.
>=20
> I think I should reword the commit message to indicate we are removing
> the Documentation/.../fsl-flexcan.txt file which has essentially =
become
> empty and change the p1010si.dtsi file's can nodes to =
"fsl,p1010-flexcan",
> "fsl,flexcan".  Is that correct?
>=20
> Thanks,
> Robin

This is wrong.  Again, what binding covers "fsl,flexcan" if you remove =
fsl-flexcan.txt:

[galak@right powerpc]$ git grep flexcan =
Documentation/devicetree/bindings
=
Documentation/devicetree/bindings/net/can/fsl-flexcan.txt:fsl,flexcan-v1.0=
 nodes
Documentation/devicetree/bindings/net/can/fsl-flexcan.txt:- =
fsl,flexcan-clock-source : CAN Engine Clock Source.This property selects
Documentation/devicetree/bindings/net/can/fsl-flexcan.txt:- =
fsl,flexcan-clock-divider : for the reference and system clock, an =
additional
Documentation/devicetree/bindings/net/can/fsl-flexcan.txt:      - v1.0 =
of flexcan-v1.0 represent the IP block version for P1010 SOC.
Documentation/devicetree/bindings/net/can/fsl-flexcan.txt:              =
compatible =3D "fsl,flexcan-v1.0";
Documentation/devicetree/bindings/net/can/fsl-flexcan.txt:              =
fsl,flexcan-clock-source =3D "platform";
Documentation/devicetree/bindings/net/can/fsl-flexcan.txt:              =
fsl,flexcan-clock-divider =3D <2>;

Not seeing anything that covers it.

I think the issue should be resolved by patching fsl-flexcan.txt to =
remove wording or update it.

- k=

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox