RE: [PATCH V2 8/8] can: flexcan: add CAN wakeup function for i.MX8QM

From: Joakim Zhang
Date: Mon Oct 19 2020 - 05:03:24 EST



Hi Marc,

> -----Original Message-----
> From: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx>
> Sent: 2020年10月19日 16:42
> To: Joakim Zhang <qiangqing.zhang@xxxxxxx>; robh+dt@xxxxxxxxxx;
> shawnguo@xxxxxxxxxx; s.hauer@xxxxxxxxxxxxxx
> Cc: kernel@xxxxxxxxxxxxxx; dl-linux-imx <linux-imx@xxxxxxx>; Ying Liu
> <victor.liu@xxxxxxx>; linux-can@xxxxxxxxxxxxxxx; Pankaj Bansal
> <pankaj.bansal@xxxxxxx>; netdev@xxxxxxxxxxxxxxx;
> linux-kernel@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH V2 8/8] can: flexcan: add CAN wakeup function for
> i.MX8QM
>
> On 10/19/20 10:39 AM, Joakim Zhang wrote:
> >>> +#define FLEXCAN_IMX_SC_R_CAN(x) (IMX_SC_R_CAN_0 + (x))
> >>
> >> Why not move it into the appropriate svc header file?
> >
> > Sorry, not quite understand. Which file do you mean the appropriate
> > svc header file? Is it include/dt-bindings/firmware/imx/rsrc.h?
>
> yes, I meant that:
>
> > include/dt-bindings/firmware/imx/rsrc.h:111:#define IMX_SC_R_CAN_0
> 105

As I can see in rsrc.h file, it just list each resource sequentially, and there is a note in the comments:
"Note items from list should never be changed or removed (only added to at the end of the list)."
So the driver author doesn't want any scu users to change these resource macro. If we only do below change for CAN, but keep other devices unchanged,
It would be very strange. And I think this code change could not be accepted. There may be another consideration, now we only has 3 CAN instances, how can we handle
if later SoCs have more CAN instances, and they still want to reuse this header file. This is also reason I prefer to use these defined macros directly in flexcan driver.

--- a/include/dt-bindings/firmware/imx/rsrc.h
+++ b/include/dt-bindings/firmware/imx/rsrc.h
@@ -108,9 +108,7 @@
#define IMX_SC_R_ADC_1 102
#define IMX_SC_R_FTM_0 103
#define IMX_SC_R_FTM_1 104
-#define IMX_SC_R_CAN_0 105
-#define IMX_SC_R_CAN_1 106
-#define IMX_SC_R_CAN_2 107
+#define IMX_SC_R_CAN(x) (105 + (x))
#define IMX_SC_R_DMA_1_CH0 108
#define IMX_SC_R_DMA_1_CH1 109
#define IMX_SC_R_DMA_1_CH2 110

Add @Aisheng Dong, could above code changes can be accepted by you?

Best Regards,
Joakim Zhang