2020-10-19 10:34:16

by Marc Kleine-Budde

[permalink] [raw]
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

> After glancing the header file under include/linux/firmware/imx, have not
> found the appropriate svc header. Could you please explain more?

Marc

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


Attachments:
signature.asc (499.00 B)
OpenPGP digital signature

2020-10-19 21:49:55

by Joakim Zhang

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


Hi Marc,

> -----Original Message-----
> From: Marc Kleine-Budde <[email protected]>
> Sent: 2020年10月19日 16:42
> To: Joakim Zhang <[email protected]>; [email protected];
> [email protected]; [email protected]
> Cc: [email protected]; dl-linux-imx <[email protected]>; Ying Liu
> <[email protected]>; [email protected]; Pankaj Bansal
> <[email protected]>; [email protected];
> [email protected]
> 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