* [PATCH 0/2] can: flexcan: fix regression from v4.16-rc1
@ 2018-04-25 14:50 Uwe Kleine-König
2018-04-25 14:50 ` [PATCH 1/2] can: flexcan: fix endianess detection Uwe Kleine-König
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Uwe Kleine-König @ 2018-04-25 14:50 UTC (permalink / raw)
To: Wolfgang Grandegger, Marc Kleine-Budde
Cc: Gavin Schenk, linux-arm-kernel, kernel, linux-can
Hello,
when porting the kernel from a i.MX25 based machine to 4.17-rc1 (but
still using the old dtb) can failed to probe. After some research we
noticed that a commit that was merged in the v4.16 merge window
introduced a change that broke using an older device tree.
This series first commit fixes the issue.
The second patch introduces a fallback compatible which matches the
usual dt-style on i.MX. (Before v4.16-rc1 there was a wrong fallback
compatible that was removed.)
Best regards
Uwe
Uwe Kleine-König (2):
can: flexcan: fix endianess detection
arm: dts: imx[35]*: declare flexcan devices to be compatible to
imx25's flexcan
arch/arm/boot/dts/imx35.dtsi | 4 ++--
arch/arm/boot/dts/imx53.dtsi | 4 ++--
drivers/net/can/flexcan.c | 26 ++++++++++++++------------
3 files changed, 18 insertions(+), 16 deletions(-)
--
2.17.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] can: flexcan: fix endianess detection
2018-04-25 14:50 [PATCH 0/2] can: flexcan: fix regression from v4.16-rc1 Uwe Kleine-König
@ 2018-04-25 14:50 ` Uwe Kleine-König
2018-04-26 6:06 ` Schenk, Gavin
2018-04-26 7:19 ` Marc Kleine-Budde
2018-04-25 14:50 ` [PATCH 2/2] arm: dts: imx[35]*: declare flexcan devices to be compatible to imx25's flexcan Uwe Kleine-König
2018-04-25 15:07 ` [PATCH 0/2] can: flexcan: fix regression from v4.16-rc1 Marc Kleine-Budde
2 siblings, 2 replies; 6+ messages in thread
From: Uwe Kleine-König @ 2018-04-25 14:50 UTC (permalink / raw)
To: Wolfgang Grandegger, Marc Kleine-Budde
Cc: Gavin Schenk, linux-arm-kernel, kernel, linux-can
In commit 88462d2a7830 ("can: flexcan: Remodel FlexCAN register r/w APIs
for big endian FlexCAN controllers.") the following logic was
implemented:
if the dt property "big-endian" is given or
the device is compatible to "fsl,p1010-flexcan":
use big-endian mode;
else
use little-endian mode;
This relies on commit d50f4630c2e1 ("arm: dts: Remove p1010-flexcan
compatible from imx series dts") which was applied a few commits later.
Without this commit (or an old device tree used for booting a new
kernel) the flexcan devices on i.MX25, i.MX28, i.MX35 and i.MX53 match
the 'the device is compatible to "fsl,p1010-flexcan"' test and so are
switched erroneously to big endian mode.
Instead of the check above put a flag into devtype data and rely on
of_match_device yielding the most compatible match
Fixes: 88462d2a7830 ("can: flexcan: Remodel FlexCAN register r/w APIs for big endian FlexCAN controllers.")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/net/can/flexcan.c | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 634c51e6b8ae..a6cbbe689eab 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -262,6 +262,7 @@ struct flexcan_regs {
struct flexcan_devtype_data {
u32 quirks; /* quirks needed for different IP cores */
+ bool default_be;
};
struct flexcan_priv {
@@ -289,6 +290,12 @@ struct flexcan_priv {
static const struct flexcan_devtype_data fsl_p1010_devtype_data = {
.quirks = FLEXCAN_QUIRK_BROKEN_WERR_STATE |
FLEXCAN_QUIRK_BROKEN_PERR_STATE,
+ .default_be = true,
+};
+
+static const struct flexcan_devtype_data fsl_imx25_devtype_data = {
+ .quirks = FLEXCAN_QUIRK_BROKEN_WERR_STATE |
+ FLEXCAN_QUIRK_BROKEN_PERR_STATE,
};
static const struct flexcan_devtype_data fsl_imx28_devtype_data = {
@@ -1251,9 +1258,9 @@ static void unregister_flexcandev(struct net_device *dev)
static const struct of_device_id flexcan_of_match[] = {
{ .compatible = "fsl,imx6q-flexcan", .data = &fsl_imx6q_devtype_data, },
{ .compatible = "fsl,imx28-flexcan", .data = &fsl_imx28_devtype_data, },
- { .compatible = "fsl,imx53-flexcan", .data = &fsl_p1010_devtype_data, },
- { .compatible = "fsl,imx35-flexcan", .data = &fsl_p1010_devtype_data, },
- { .compatible = "fsl,imx25-flexcan", .data = &fsl_p1010_devtype_data, },
+ { .compatible = "fsl,imx53-flexcan", .data = &fsl_imx25_devtype_data, },
+ { .compatible = "fsl,imx35-flexcan", .data = &fsl_imx25_devtype_data, },
+ { .compatible = "fsl,imx25-flexcan", .data = &fsl_imx25_devtype_data, },
{ .compatible = "fsl,p1010-flexcan", .data = &fsl_p1010_devtype_data, },
{ .compatible = "fsl,vf610-flexcan", .data = &fsl_vf610_devtype_data, },
{ .compatible = "fsl,ls1021ar2-flexcan", .data = &fsl_ls1021a_r2_devtype_data, },
@@ -1337,18 +1344,13 @@ static int flexcan_probe(struct platform_device *pdev)
priv = netdev_priv(dev);
- if (of_property_read_bool(pdev->dev.of_node, "big-endian")) {
+ if (of_property_read_bool(pdev->dev.of_node, "big-endian") ||
+ devtype_data->default_be) {
priv->read = flexcan_read_be;
priv->write = flexcan_write_be;
} else {
- if (of_device_is_compatible(pdev->dev.of_node,
- "fsl,p1010-flexcan")) {
- priv->read = flexcan_read_be;
- priv->write = flexcan_write_be;
- } else {
- priv->read = flexcan_read_le;
- priv->write = flexcan_write_le;
- }
+ priv->read = flexcan_read_le;
+ priv->write = flexcan_write_le;
}
priv->can.clock.freq = clock_freq;
--
2.17.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] arm: dts: imx[35]*: declare flexcan devices to be compatible to imx25's flexcan
2018-04-25 14:50 [PATCH 0/2] can: flexcan: fix regression from v4.16-rc1 Uwe Kleine-König
2018-04-25 14:50 ` [PATCH 1/2] can: flexcan: fix endianess detection Uwe Kleine-König
@ 2018-04-25 14:50 ` Uwe Kleine-König
2018-04-25 15:07 ` [PATCH 0/2] can: flexcan: fix regression from v4.16-rc1 Marc Kleine-Budde
2 siblings, 0 replies; 6+ messages in thread
From: Uwe Kleine-König @ 2018-04-25 14:50 UTC (permalink / raw)
To: Wolfgang Grandegger, Marc Kleine-Budde
Cc: Gavin Schenk, linux-arm-kernel, kernel, linux-can
Commit d50f4630c2e1 ("arm: dts: Remove p1010-flexcan compatible from imx
series dts") removed the fallback compatible "fsl,p1010-flexcan" from
the imx device trees. As the flexcan cores on i.MX25, i.MX35 and i.MX53
are identical, introduce the first as fallback for the two latter ones.
Fixes: d50f4630c2e1 ("arm: dts: Remove p1010-flexcan compatible from imx series dts")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
arch/arm/boot/dts/imx35.dtsi | 4 ++--
arch/arm/boot/dts/imx53.dtsi | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/arm/boot/dts/imx35.dtsi b/arch/arm/boot/dts/imx35.dtsi
index bf343195697e..54111ed218b1 100644
--- a/arch/arm/boot/dts/imx35.dtsi
+++ b/arch/arm/boot/dts/imx35.dtsi
@@ -303,7 +303,7 @@
};
can1: can@53fe4000 {
- compatible = "fsl,imx35-flexcan";
+ compatible = "fsl,imx35-flexcan", "fsl,imx25-flexcan";
reg = <0x53fe4000 0x1000>;
clocks = <&clks 33>, <&clks 33>;
clock-names = "ipg", "per";
@@ -312,7 +312,7 @@
};
can2: can@53fe8000 {
- compatible = "fsl,imx35-flexcan";
+ compatible = "fsl,imx35-flexcan", "fsl,imx25-flexcan";
reg = <0x53fe8000 0x1000>;
clocks = <&clks 34>, <&clks 34>;
clock-names = "ipg", "per";
diff --git a/arch/arm/boot/dts/imx53.dtsi b/arch/arm/boot/dts/imx53.dtsi
index 7d647d043f52..3d65c0192f69 100644
--- a/arch/arm/boot/dts/imx53.dtsi
+++ b/arch/arm/boot/dts/imx53.dtsi
@@ -551,7 +551,7 @@
};
can1: can@53fc8000 {
- compatible = "fsl,imx53-flexcan";
+ compatible = "fsl,imx53-flexcan", "fsl,imx25-flexcan";
reg = <0x53fc8000 0x4000>;
interrupts = <82>;
clocks = <&clks IMX5_CLK_CAN1_IPG_GATE>,
@@ -561,7 +561,7 @@
};
can2: can@53fcc000 {
- compatible = "fsl,imx53-flexcan";
+ compatible = "fsl,imx53-flexcan", "fsl,imx25-flexcan";
reg = <0x53fcc000 0x4000>;
interrupts = <83>;
clocks = <&clks IMX5_CLK_CAN2_IPG_GATE>,
--
2.17.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] can: flexcan: fix regression from v4.16-rc1
2018-04-25 14:50 [PATCH 0/2] can: flexcan: fix regression from v4.16-rc1 Uwe Kleine-König
2018-04-25 14:50 ` [PATCH 1/2] can: flexcan: fix endianess detection Uwe Kleine-König
2018-04-25 14:50 ` [PATCH 2/2] arm: dts: imx[35]*: declare flexcan devices to be compatible to imx25's flexcan Uwe Kleine-König
@ 2018-04-25 15:07 ` Marc Kleine-Budde
2 siblings, 0 replies; 6+ messages in thread
From: Marc Kleine-Budde @ 2018-04-25 15:07 UTC (permalink / raw)
To: Uwe Kleine-König, Wolfgang Grandegger
Cc: Gavin Schenk, linux-arm-kernel, kernel, linux-can
[-- Attachment #1.1.1: Type: text/plain, Size: 898 bytes --]
On 04/25/2018 04:50 PM, Uwe Kleine-König wrote:
> Hello,
>
> when porting the kernel from a i.MX25 based machine to 4.17-rc1 (but
> still using the old dtb) can failed to probe. After some research we
> noticed that a commit that was merged in the v4.16 merge window
> introduced a change that broke using an older device tree.
>
> This series first commit fixes the issue.
> The second patch introduces a fallback compatible which matches the
> usual dt-style on i.MX. (Before v4.16-rc1 there was a wrong fallback
> compatible that was removed.)
Applied both to linux-can + added stable on Cc.
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 |
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] can: flexcan: fix endianess detection
2018-04-25 14:50 ` [PATCH 1/2] can: flexcan: fix endianess detection Uwe Kleine-König
@ 2018-04-26 6:06 ` Schenk, Gavin
2018-04-26 7:19 ` Marc Kleine-Budde
1 sibling, 0 replies; 6+ messages in thread
From: Schenk, Gavin @ 2018-04-26 6:06 UTC (permalink / raw)
To: u.kleine-koenig@pengutronix.de, wg@grandegger.com,
mkl@pengutronix.de
Cc: kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org,
linux-can@vger.kernel.org
Hi,
> In commit 88462d2a7830 ("can: flexcan: Remodel FlexCAN register r/w APIs
> for big endian FlexCAN controllers.") the following logic was
> implemented:
>
> if the dt property "big-endian" is given or
> the device is compatible to "fsl,p1010-flexcan":
> use big-endian mode;
> else
> use little-endian mode;
>
> This relies on commit d50f4630c2e1 ("arm: dts: Remove p1010-flexcan
> compatible from imx series dts") which was applied a few commits later.
> Without this commit (or an old device tree used for booting a new
> kernel) the flexcan devices on i.MX25, i.MX28, i.MX35 and i.MX53 match
> the 'the device is compatible to "fsl,p1010-flexcan"' test and so are
> switched erroneously to big endian mode.
>
> Instead of the check above put a flag into devtype data and rely on
> of_match_device yielding the most compatible match
>
> Fixes: 88462d2a7830 ("can: flexcan: Remodel FlexCAN register r/w APIs for big
> endian FlexCAN controllers.")
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tested-by: Gavin Schenk <g.schenk@eckelmann.de>
Regards
Gavin Schenk
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] can: flexcan: fix endianess detection
2018-04-25 14:50 ` [PATCH 1/2] can: flexcan: fix endianess detection Uwe Kleine-König
2018-04-26 6:06 ` Schenk, Gavin
@ 2018-04-26 7:19 ` Marc Kleine-Budde
1 sibling, 0 replies; 6+ messages in thread
From: Marc Kleine-Budde @ 2018-04-26 7:19 UTC (permalink / raw)
To: Uwe Kleine-König, Wolfgang Grandegger
Cc: Gavin Schenk, kernel, linux-arm-kernel, linux-can
[-- Attachment #1.1.1: Type: text/plain, Size: 1908 bytes --]
On 04/25/2018 04:50 PM, Uwe Kleine-König wrote:
> In commit 88462d2a7830 ("can: flexcan: Remodel FlexCAN register r/w APIs
> for big endian FlexCAN controllers.") the following logic was
> implemented:
>
> if the dt property "big-endian" is given or
> the device is compatible to "fsl,p1010-flexcan":
> use big-endian mode;
> else
> use little-endian mode;
>
> This relies on commit d50f4630c2e1 ("arm: dts: Remove p1010-flexcan
> compatible from imx series dts") which was applied a few commits later.
> Without this commit (or an old device tree used for booting a new
> kernel) the flexcan devices on i.MX25, i.MX28, i.MX35 and i.MX53 match
> the 'the device is compatible to "fsl,p1010-flexcan"' test and so are
> switched erroneously to big endian mode.
>
> Instead of the check above put a flag into devtype data and rely on
> of_match_device yielding the most compatible match
>
> Fixes: 88462d2a7830 ("can: flexcan: Remodel FlexCAN register r/w APIs for big endian FlexCAN controllers.")
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> drivers/net/can/flexcan.c | 26 ++++++++++++++------------
> 1 file changed, 14 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
> index 634c51e6b8ae..a6cbbe689eab 100644
> --- a/drivers/net/can/flexcan.c
> +++ b/drivers/net/can/flexcan.c
> @@ -262,6 +262,7 @@ struct flexcan_regs {
>
> struct flexcan_devtype_data {
> u32 quirks; /* quirks needed for different IP cores */
> + bool default_be;
> };
What about adding this to quirks?
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 |
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-04-26 7:19 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-25 14:50 [PATCH 0/2] can: flexcan: fix regression from v4.16-rc1 Uwe Kleine-König
2018-04-25 14:50 ` [PATCH 1/2] can: flexcan: fix endianess detection Uwe Kleine-König
2018-04-26 6:06 ` Schenk, Gavin
2018-04-26 7:19 ` Marc Kleine-Budde
2018-04-25 14:50 ` [PATCH 2/2] arm: dts: imx[35]*: declare flexcan devices to be compatible to imx25's flexcan Uwe Kleine-König
2018-04-25 15:07 ` [PATCH 0/2] can: flexcan: fix regression from v4.16-rc1 Marc Kleine-Budde
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).