Hui Wang | 27 Jun 2012 10:19
Picon

[PATCH 0/4] can: flexcan: upgrade the flexcan.c to support i.MX6

i.MX6 is freescale arm chip, it has two flexcan controllers, when i add this driver to the i.MX6 and run it on
the i.MX6 sabre lite board, this driver has several problems:
1. the value in the device tree is stored in big endian format, while arm works in little endian mode by
default, The [1/4] patch fix this problem.
2. the i.MX6 has a higher can controller and has more registers, and some registers need to be set before the
hardware can work well, The [2/4] patch fix this problem.
3. i.MX6 has two clocks to drive flexcan module. The [3/4] patch fix this problem.
4. i.MX6 has an external PHY to be operated. The [4/4] patch fix this problem.

Hui Wang (4):
      can: flexcan: use be32_to_cpup to handle the value of dt entry
      can: flexcan: add hardware controller version support
      can: flexcan: add ipg and ser clocks support
      can: flexcan: add transceiver switch support when use device tree

 .../devicetree/bindings/net/can/fsl-flexcan.txt    |    7 +
 drivers/net/can/flexcan.c                          |  119 ++++++++++++++++----
 2 files changed, 106 insertions(+), 20 deletions(-)

Thanks,
Hui.

--
To unsubscribe from this list: send the line "unsubscribe linux-can" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Hui Wang | 27 Jun 2012 10:19
Picon

[PATCH 1/4] can: flexcan: use be32_to_cpup to handle the value of dt entry

The freescale arm i.MX series platform can support this driver, and
usually the arm cpu works in the little endian mode by default, while
device tree entry value is stored in big endian format, we should use
be32_to_cpup() to handle them, after modification, it can work well
both on the le cpu and be cpu.

Cc: linux-can <at> vger.kernel.org
Cc: Marc Kleine-Budde <mkl <at> pengutronix.de>
Cc: David S. Miller <davem <at> davemloft.net>
Cc: Shawn Guo <shawn.guo <at> linaro.org>
Signed-off-by: Hui Wang <jason77.wang <at> gmail.com>
---
 drivers/net/can/flexcan.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 38c0690..81d4741 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
 <at>  <at>  -939,12 +939,12  <at>  <at>  static int __devinit flexcan_probe(struct platform_device *pdev)
 		return PTR_ERR(pinctrl);

 	if (pdev->dev.of_node) {
-		const u32 *clock_freq_p;
+		const __be32 *clock_freq_p;

 		clock_freq_p = of_get_property(pdev->dev.of_node,
 						"clock-frequency", NULL);
 		if (clock_freq_p)
-			clock_freq = *clock_freq_p;
(Continue reading)

Hui Wang | 27 Jun 2012 10:19
Picon

[PATCH 2/4] can: flexcan: add hardware controller version support

At least in the i.MX series, the flexcan contrller divides into ver_3
and ver_10, current driver is for ver_3 controller.

i.MX6 has ver_10 controller, it has more reigsters than ver_3 has.
The rxfgmask (Rx FIFO Global Mask) register is one of the new added.
Its reset value is 0xffffffff, this means ID Filter Table must be
checked when receive a packet, but the driver is designed to accept
everything during the chip start, we need to clear this register to
follow this design.

Add a hw_ver entry in the device tree, this can let us distinguish
which version the controller is, if we don't set value to this entry,
the hw_ver is 3 by default, this is backward compatible for existing
platforms like powerpc and imx35.

Cc: linux-can <at> vger.kernel.org
Cc: Marc Kleine-Budde <mkl <at> pengutronix.de>
Cc: David S. Miller <davem <at> davemloft.net>
Cc: Shawn Guo <shawn.guo <at> linaro.org>
Signed-off-by: Hui Wang <jason77.wang <at> gmail.com>
---
 .../devicetree/bindings/net/can/fsl-flexcan.txt    |    3 +++
 drivers/net/can/flexcan.c                          |   20 +++++++++++++++++++-
 2 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt b/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
index f31b686..19952cd 100644
--- a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
+++ b/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
 <at>  <at>  -12,6 +12,8  <at>  <at>  Required properties:
(Continue reading)

Hui Wang | 27 Jun 2012 10:19
Picon

[PATCH 3/4] can: flexcan: add ipg and ser clocks support

Some i.MX chip (like i.MX6) has two clocks to drive flexcan module,
one is ipg clock, another is serial clock, if we want the flexcan
to work, we need to enable both two clocks, but current driver only
support one clock.

My modification doesn't break existing platforms. For those without
clocks (like powerpc platforms), two clk pointers are set to NULL as
before, for those only have one clock (like i.MX25 and i.MX35), the
second clk pointer is set to NULL.

Cc: linux-can <at> vger.kernel.org
Cc: Marc Kleine-Budde <mkl <at> pengutronix.de>
Cc: David S. Miller <davem <at> davemloft.net>
Cc: Shawn Guo <shawn.guo <at> linaro.org>
Signed-off-by: Hui Wang <jason77.wang <at> gmail.com>
---
 drivers/net/can/flexcan.c |   49 +++++++++++++++++++++++++++++---------------
 1 files changed, 32 insertions(+), 17 deletions(-)

diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 9d024a4..a23c11e 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
 <at>  <at>  -185,7 +185,8  <at>  <at>  struct flexcan_priv {
 	u32 reg_ctrl_default;
 	u32 hw_ver;

-	struct clk *clk;
+	struct clk *clk_ipg;
+	struct clk *clk_per;
(Continue reading)

Hui Wang | 27 Jun 2012 10:19
Picon

[PATCH 4/4] can: flexcan: add transceiver switch support when use device tree

Some platforms (like i.MX6) has an external PHY, the PHY is operated
by some gpios. If the system registers a platform_data, we can
set a callback function pointer to pdata->transceiver_switch to
implement PHY switch. If we use device tree, we couldn't pass
platform_data to the driver, so i move the switch function to the
driver and add device tree entries to let user set which gpios
are used to operate PHY.

This design doesn't break existing platforms, if a platform doesn't
need PHY switch, it doesn't need to set dt entries just as before,
if a platform has platform_data, the pdata->transceiver_switch has
higher priority.

Cc: linux-can <at> vger.kernel.org
Cc: Marc Kleine-Budde <mkl <at> pengutronix.de>
Cc: David S. Miller <davem <at> davemloft.net>
Cc: Shawn Guo <shawn.guo <at> linaro.org>
Signed-off-by: Hui Wang <jason77.wang <at> gmail.com>
---
 .../devicetree/bindings/net/can/fsl-flexcan.txt    |    4 ++
 drivers/net/can/flexcan.c                          |   46 ++++++++++++++++++++
 2 files changed, 50 insertions(+), 0 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt b/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
index 19952cd..a32bfdb 100644
--- a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
+++ b/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
 <at>  <at>  -14,6 +14,8  <at>  <at>  Required properties:
 - clock-frequency : The oscillator frequency driving the flexcan device
 - hw-version : The controller version, for imx25, imx35 and imx53, the version
(Continue reading)

Marc Kleine-Budde | 27 Jun 2012 10:26
Picon
Favicon

Re: [PATCH 4/4] can: flexcan: add transceiver switch support when use device tree

On 06/27/2012 10:19 AM, Hui Wang wrote:
> Some platforms (like i.MX6) has an external PHY, the PHY is operated
> by some gpios. If the system registers a platform_data, we can
> set a callback function pointer to pdata->transceiver_switch to
> implement PHY switch. If we use device tree, we couldn't pass
> platform_data to the driver, so i move the switch function to the
> driver and add device tree entries to let user set which gpios
> are used to operate PHY.
> 
> This design doesn't break existing platforms, if a platform doesn't
> need PHY switch, it doesn't need to set dt entries just as before,
> if a platform has platform_data, the pdata->transceiver_switch has
> higher priority.
> 
> Cc: linux-can <at> vger.kernel.org
> Cc: Marc Kleine-Budde <mkl <at> pengutronix.de>
> Cc: David S. Miller <davem <at> davemloft.net>
> Cc: Shawn Guo <shawn.guo <at> linaro.org>
> Signed-off-by: Hui Wang <jason77.wang <at> gmail.com>

please coordinate whith Shawn Guo, he has posted a similar patch some
days ago. http://www.spinics.net/lists/netdev/msg202442.html

Marc

--

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |
(Continue reading)

Hui Wang | 27 Jun 2012 11:55
Picon

Re: [PATCH 4/4] can: flexcan: add transceiver switch support when use device tree

Marc Kleine-Budde wrote:
> On 06/27/2012 10:19 AM, Hui Wang wrote:
>   
>> Some platforms (like i.MX6) has an external PHY, the PHY is operated
>> by some gpios. If the system registers a platform_data, we can
>> set a callback function pointer to pdata->transceiver_switch to
>> implement PHY switch. If we use device tree, we couldn't pass
>> platform_data to the driver, so i move the switch function to the
>> driver and add device tree entries to let user set which gpios
>> are used to operate PHY.
>>
>> This design doesn't break existing platforms, if a platform doesn't
>> need PHY switch, it doesn't need to set dt entries just as before,
>> if a platform has platform_data, the pdata->transceiver_switch has
>> higher priority.
>>
>> Cc: linux-can <at> vger.kernel.org
>> Cc: Marc Kleine-Budde <mkl <at> pengutronix.de>
>> Cc: David S. Miller <davem <at> davemloft.net>
>> Cc: Shawn Guo <shawn.guo <at> linaro.org>
>> Signed-off-by: Hui Wang <jason77.wang <at> gmail.com>
>>     
>
> please coordinate whith Shawn Guo, he has posted a similar patch some
> days ago. http://www.spinics.net/lists/netdev/msg202442.html
>
> Marc
>
>   
After read and compared with his patch:
(Continue reading)

Marc Kleine-Budde | 27 Jun 2012 12:02
Picon
Favicon

Re: [PATCH 4/4] can: flexcan: add transceiver switch support when use device tree

On 06/27/2012 11:55 AM, Hui Wang wrote:
> Marc Kleine-Budde wrote:
>> On 06/27/2012 10:19 AM, Hui Wang wrote:
>>  
>>> Some platforms (like i.MX6) has an external PHY, the PHY is operated
>>> by some gpios. If the system registers a platform_data, we can
>>> set a callback function pointer to pdata->transceiver_switch to
>>> implement PHY switch. If we use device tree, we couldn't pass
>>> platform_data to the driver, so i move the switch function to the
>>> driver and add device tree entries to let user set which gpios
>>> are used to operate PHY.
>>>
>>> This design doesn't break existing platforms, if a platform doesn't
>>> need PHY switch, it doesn't need to set dt entries just as before,
>>> if a platform has platform_data, the pdata->transceiver_switch has
>>> higher priority.
>>>
>>> Cc: linux-can <at> vger.kernel.org
>>> Cc: Marc Kleine-Budde <mkl <at> pengutronix.de>
>>> Cc: David S. Miller <davem <at> davemloft.net>
>>> Cc: Shawn Guo <shawn.guo <at> linaro.org>
>>> Signed-off-by: Hui Wang <jason77.wang <at> gmail.com>
>>>     
>>
>> please coordinate whith Shawn Guo, he has posted a similar patch some
>> days ago. http://www.spinics.net/lists/netdev/msg202442.html
>>
>> Marc
>>
>>   
(Continue reading)

Shawn Guo | 27 Jun 2012 13:22
Favicon

Re: [PATCH 4/4] can: flexcan: add transceiver switch support when use device tree

On 27 June 2012 17:55, Hui Wang <jason77.wang <at> gmail.com> wrote:
> After read and compared with his patch:
> 1. Shawn use gpio_is_valid(gpio) instead of (gpio >= 0), it is good.
> 2. Shawn add a flag to record active level, it is good.
> 3. Shawn only add 1 gpio, this is not enough for imx6 sabre lite board.
> 4. Shawn forget to call gpio_release()

I'm about to resend my series to have linux-can copied and use
devm_gpio_request_one instead.  Do you want me to add STBY gpio
support into my patch?

Regards,
Shawn
--
To unsubscribe from this list: send the line "unsubscribe linux-can" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Marc Kleine-Budde | 27 Jun 2012 13:46
Picon
Favicon

Re: [PATCH 4/4] can: flexcan: add transceiver switch support when use device tree

On 06/27/2012 01:22 PM, Shawn Guo wrote:
> On 27 June 2012 17:55, Hui Wang <jason77.wang <at> gmail.com> wrote:
>> After read and compared with his patch:
>> 1. Shawn use gpio_is_valid(gpio) instead of (gpio >= 0), it is good.
>> 2. Shawn add a flag to record active level, it is good.
>> 3. Shawn only add 1 gpio, this is not enough for imx6 sabre lite board.
>> 4. Shawn forget to call gpio_release()
> 
> I'm about to resend my series to have linux-can copied and use
> devm_gpio_request_one instead.  Do you want me to add STBY gpio
> support into my patch?

devm is a good idea.

Marc

--

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

Hui Wang | 28 Jun 2012 03:53
Picon

Re: [PATCH 4/4] can: flexcan: add transceiver switch support when use device tree

Shawn Guo wrote:
> On 27 June 2012 17:55, Hui Wang <jason77.wang <at> gmail.com> wrote:
>   
>> After read and compared with his patch:
>> 1. Shawn use gpio_is_valid(gpio) instead of (gpio >= 0), it is good.
>> 2. Shawn add a flag to record active level, it is good.
>> 3. Shawn only add 1 gpio, this is not enough for imx6 sabre lite board.
>> 4. Shawn forget to call gpio_release()
>>     
>
> I'm about to resend my series to have linux-can copied and use
> devm_gpio_request_one instead.  Do you want me to add STBY gpio
> support into my patch?
>   
Yes.

Thanks,
Hui.
> Regards,
> Shawn
>
>   

--
To unsubscribe from this list: send the line "unsubscribe linux-can" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Marc Kleine-Budde | 27 Jun 2012 10:45
Picon
Favicon

Re: [PATCH 3/4] can: flexcan: add ipg and ser clocks support

On 06/27/2012 10:19 AM, Hui Wang wrote:
> Some i.MX chip (like i.MX6) has two clocks to drive flexcan module,
> one is ipg clock, another is serial clock, if we want the flexcan
> to work, we need to enable both two clocks, but current driver only
> support one clock.
> 
> My modification doesn't break existing platforms. For those without
> clocks (like powerpc platforms), two clk pointers are set to NULL as
> before, for those only have one clock (like i.MX25 and i.MX35), the
> second clk pointer is set to NULL.

Looks good at the first sight. Will test on hardware later.

Tnx, Marc

--

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

Marc Kleine-Budde | 27 Jun 2012 10:27
Picon
Favicon

Re: [PATCH 2/4] can: flexcan: add hardware controller version support

On 06/27/2012 10:19 AM, Hui Wang wrote:
> At least in the i.MX series, the flexcan contrller divides into ver_3
> and ver_10, current driver is for ver_3 controller.
> 
> i.MX6 has ver_10 controller, it has more reigsters than ver_3 has.
> The rxfgmask (Rx FIFO Global Mask) register is one of the new added.
> Its reset value is 0xffffffff, this means ID Filter Table must be
> checked when receive a packet, but the driver is designed to accept
> everything during the chip start, we need to clear this register to
> follow this design.
> 
> Add a hw_ver entry in the device tree, this can let us distinguish
> which version the controller is, if we don't set value to this entry,
> the hw_ver is 3 by default, this is backward compatible for existing
> platforms like powerpc and imx35.

Is it possible to read this value from the hardware?
Another possibility would be to introduce a new compatible device in the
device tree.

Marc

--

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

Wolfgang Grandegger | 27 Jun 2012 10:56

Re: [PATCH 2/4] can: flexcan: add hardware controller version support

On 06/27/2012 10:27 AM, Marc Kleine-Budde wrote:
> On 06/27/2012 10:19 AM, Hui Wang wrote:
>> At least in the i.MX series, the flexcan contrller divides into ver_3
>> and ver_10, current driver is for ver_3 controller.
>>
>> i.MX6 has ver_10 controller, it has more reigsters than ver_3 has.
>> The rxfgmask (Rx FIFO Global Mask) register is one of the new added.
>> Its reset value is 0xffffffff, this means ID Filter Table must be
>> checked when receive a packet, but the driver is designed to accept
>> everything during the chip start, we need to clear this register to
>> follow this design.
>>
>> Add a hw_ver entry in the device tree, this can let us distinguish
>> which version the controller is, if we don't set value to this entry,
>> the hw_ver is 3 by default, this is backward compatible for existing
>> platforms like powerpc and imx35.
> 
> Is it possible to read this value from the hardware?
> Another possibility would be to introduce a new compatible device in the
> device tree.

I vote for the latter. IIRC, in the past we already had some discussion
on how to handle version dependent Flexcan hardware, e.g. by using
flexcan-vX.X or being expicit using fsl,p1010-flexcan. Search for "Add
support for powerpc" in the netdev mailing list. I added the
devicetree-discuss ml for that reason.

Wolfgang.

--
(Continue reading)

Wolfgang Grandegger | 27 Jun 2012 11:43

Re: [PATCH 2/4] can: flexcan: add hardware controller version support

Hi Marc,

On 06/27/2012 10:56 AM, Wolfgang Grandegger wrote:
> On 06/27/2012 10:27 AM, Marc Kleine-Budde wrote:
>> On 06/27/2012 10:19 AM, Hui Wang wrote:
>>> At least in the i.MX series, the flexcan contrller divides into ver_3
>>> and ver_10, current driver is for ver_3 controller.
>>>
>>> i.MX6 has ver_10 controller, it has more reigsters than ver_3 has.
>>> The rxfgmask (Rx FIFO Global Mask) register is one of the new added.
>>> Its reset value is 0xffffffff, this means ID Filter Table must be
>>> checked when receive a packet, but the driver is designed to accept
>>> everything during the chip start, we need to clear this register to
>>> follow this design.
>>>
>>> Add a hw_ver entry in the device tree, this can let us distinguish
>>> which version the controller is, if we don't set value to this entry,
>>> the hw_ver is 3 by default, this is backward compatible for existing
>>> platforms like powerpc and imx35.
>>
>> Is it possible to read this value from the hardware?
>> Another possibility would be to introduce a new compatible device in the
>> device tree.
> 
> I vote for the latter. IIRC, in the past we already had some discussion
> on how to handle version dependent Flexcan hardware, e.g. by using
> flexcan-vX.X or being expicit using fsl,p1010-flexcan. Search for "Add
> support for powerpc" in the netdev mailing list. I added the
> devicetree-discuss ml for that reason.

(Continue reading)

Marc Kleine-Budde | 27 Jun 2012 11:51
Picon
Favicon

Re: [PATCH 2/4] can: flexcan: add hardware controller version support

On 06/27/2012 11:43 AM, Wolfgang Grandegger wrote:
> Hi Marc,
> 
> On 06/27/2012 10:56 AM, Wolfgang Grandegger wrote:
>> On 06/27/2012 10:27 AM, Marc Kleine-Budde wrote:
>>> On 06/27/2012 10:19 AM, Hui Wang wrote:
>>>> At least in the i.MX series, the flexcan contrller divides into ver_3
>>>> and ver_10, current driver is for ver_3 controller.
>>>>
>>>> i.MX6 has ver_10 controller, it has more reigsters than ver_3 has.
>>>> The rxfgmask (Rx FIFO Global Mask) register is one of the new added.
>>>> Its reset value is 0xffffffff, this means ID Filter Table must be
>>>> checked when receive a packet, but the driver is designed to accept
>>>> everything during the chip start, we need to clear this register to
>>>> follow this design.
>>>>
>>>> Add a hw_ver entry in the device tree, this can let us distinguish
>>>> which version the controller is, if we don't set value to this entry,
>>>> the hw_ver is 3 by default, this is backward compatible for existing
>>>> platforms like powerpc and imx35.
>>>
>>> Is it possible to read this value from the hardware?
>>> Another possibility would be to introduce a new compatible device in the
>>> device tree.
>>
>> I vote for the latter. IIRC, in the past we already had some discussion
>> on how to handle version dependent Flexcan hardware, e.g. by using
>> flexcan-vX.X or being expicit using fsl,p1010-flexcan. Search for "Add
>> support for powerpc" in the netdev mailing list. I added the
>> devicetree-discuss ml for that reason.
(Continue reading)

Hui Wang | 27 Jun 2012 12:13
Picon

Re: [PATCH 2/4] can: flexcan: add hardware controller version support

Marc Kleine-Budde wrote:
> On 06/27/2012 11:43 AM, Wolfgang Grandegger wrote:
>   
>> Hi Marc,
>>
>> On 06/27/2012 10:56 AM, Wolfgang Grandegger wrote:
>>     
>>> On 06/27/2012 10:27 AM, Marc Kleine-Budde wrote:
>>>       
>>>> On 06/27/2012 10:19 AM, Hui Wang wrote:
>>>>         
>>>>> At least in the i.MX series, the flexcan contrller divides into ver_3
>>>>> and ver_10, current driver is for ver_3 controller.
>>>>>
>>>>> i.MX6 has ver_10 controller, it has more reigsters than ver_3 has.
>>>>> The rxfgmask (Rx FIFO Global Mask) register is one of the new added.
>>>>> Its reset value is 0xffffffff, this means ID Filter Table must be
>>>>> checked when receive a packet, but the driver is designed to accept
>>>>> everything during the chip start, we need to clear this register to
>>>>> follow this design.
>>>>>
>>>>> Add a hw_ver entry in the device tree, this can let us distinguish
>>>>> which version the controller is, if we don't set value to this entry,
>>>>> the hw_ver is 3 by default, this is backward compatible for existing
>>>>> platforms like powerpc and imx35.
>>>>>           
>>>> Is it possible to read this value from the hardware?
>>>> Another possibility would be to introduce a new compatible device in the
>>>> device tree.
>>>>         
(Continue reading)

Marc Kleine-Budde | 27 Jun 2012 12:24
Picon
Favicon

Re: [PATCH 2/4] can: flexcan: add hardware controller version support

On 06/27/2012 12:13 PM, Hui Wang wrote:
[...]

>>> What compatible string do they actually use for the i.MX6Q board? Shawn
>>> or Hui? We need to fix that. From the discussion mentioned above I think
>>>     
> Currently i modified the can1 DT entry in the  imx6q.dtsi like this:
>            flexcan <at> 02090000 { /* CAN1 */
>                reg = <0x02090000 0x4000>;
>                interrupts = <0 110 0x04>;
>                hw-version = <10>;
                 ^^^^^^^^^^^^^^^^^^

remove

>            };
> 
> and the DT entry in the imx6q-sabrelite.dts like this:
>            flexcan <at> 02090000 { /* CAN1 */
>                compatible = "fsl,imx6q-flexcan", "fsl,p1010-flexcan";
                                                   ^^^^^^^^^^^^^^^^^^^

If imx6q is the first sock with this core "fsl,imx6q-flexcan" is the
official name. "fsl,p1010-flexcan" will be removed. The compatible
should go into the imx6q.dtsi

>                phy-en-gpio = <&gpio1 4 0>;
>                phy-stby-gpio = <&gpio1 2 0>;
>                pinctrl-names = "default";
>                pinctrl-0 = <&pinctrl_flexcan1_1>;
(Continue reading)

Wolfgang Grandegger | 27 Jun 2012 12:57

Re: [PATCH 2/4] can: flexcan: add hardware controller version support

On 06/27/2012 12:13 PM, Hui Wang wrote:
> Marc Kleine-Budde wrote:
>> On 06/27/2012 11:43 AM, Wolfgang Grandegger wrote:
>>  
>>> Hi Marc,
>>>
>>> On 06/27/2012 10:56 AM, Wolfgang Grandegger wrote:
>>>    
>>>> On 06/27/2012 10:27 AM, Marc Kleine-Budde wrote:
>>>>      
>>>>> On 06/27/2012 10:19 AM, Hui Wang wrote:
>>>>>        
>>>>>> At least in the i.MX series, the flexcan contrller divides into ver_3
>>>>>> and ver_10, current driver is for ver_3 controller.
>>>>>>
>>>>>> i.MX6 has ver_10 controller, it has more reigsters than ver_3 has.
>>>>>> The rxfgmask (Rx FIFO Global Mask) register is one of the new added.
>>>>>> Its reset value is 0xffffffff, this means ID Filter Table must be
>>>>>> checked when receive a packet, but the driver is designed to accept
>>>>>> everything during the chip start, we need to clear this register to
>>>>>> follow this design.
>>>>>>
>>>>>> Add a hw_ver entry in the device tree, this can let us distinguish
>>>>>> which version the controller is, if we don't set value to this entry,
>>>>>> the hw_ver is 3 by default, this is backward compatible for existing
>>>>>> platforms like powerpc and imx35.
>>>>>>           
>>>>> Is it possible to read this value from the hardware?
>>>>> Another possibility would be to introduce a new compatible device
>>>>> in the
(Continue reading)

Marc Kleine-Budde | 27 Jun 2012 10:38
Picon
Favicon

Re: [PATCH 1/4] can: flexcan: use be32_to_cpup to handle the value of dt entry

On 06/27/2012 10:19 AM, Hui Wang wrote:
> The freescale arm i.MX series platform can support this driver, and
> usually the arm cpu works in the little endian mode by default, while
> device tree entry value is stored in big endian format, we should use
> be32_to_cpup() to handle them, after modification, it can work well
> both on the le cpu and be cpu.

good catch. We didn't notice since this clock has only been used on
powerpc so far. However you should not need to set this property, as ARM
has proper clock tree support and the clock rate is taken from the clock
tree not the device tree.

Applied to can-master.

Marc

> Cc: linux-can <at> vger.kernel.org
> Cc: Marc Kleine-Budde <mkl <at> pengutronix.de>
> Cc: David S. Miller <davem <at> davemloft.net>
> Cc: Shawn Guo <shawn.guo <at> linaro.org>
> Signed-off-by: Hui Wang <jason77.wang <at> gmail.com>
> ---
>  drivers/net/can/flexcan.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
> index 38c0690..81d4741 100644
> --- a/drivers/net/can/flexcan.c
> +++ b/drivers/net/can/flexcan.c
>  <at>  <at>  -939,12 +939,12  <at>  <at>  static int __devinit flexcan_probe(struct platform_device *pdev)
(Continue reading)

Wolfgang Grandegger | 27 Jun 2012 11:07

Re: [PATCH 1/4] can: flexcan: use be32_to_cpup to handle the value of dt entry

On 06/27/2012 10:19 AM, Hui Wang wrote:
> The freescale arm i.MX series platform can support this driver, and
> usually the arm cpu works in the little endian mode by default, while
> device tree entry value is stored in big endian format, we should use
> be32_to_cpup() to handle them, after modification, it can work well
> both on the le cpu and be cpu.

Oops, that reminds me that other Linux-CAN (of-)drivers do require a
similar fix to work on little endian platforms. Not your business, of
course.

Wolfgang.

--
To unsubscribe from this list: send the line "unsubscribe linux-can" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Gmane