[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <DB8PR04MB67954A044B1B67BBE48B9D24E6030@DB8PR04MB6795.eurprd04.prod.outlook.com>
Date: Fri, 16 Oct 2020 10:57:29 +0000
From: Joakim Zhang <qiangqing.zhang@....com>
To: Marc Kleine-Budde <mkl@...gutronix.de>,
"robh+dt@...nel.org" <robh+dt@...nel.org>,
"shawnguo@...nel.org" <shawnguo@...nel.org>,
"s.hauer@...gutronix.de" <s.hauer@...gutronix.de>
CC: "kernel@...gutronix.de" <kernel@...gutronix.de>,
dl-linux-imx <linux-imx@....com>, Ying Liu <victor.liu@....com>,
Peng Fan <peng.fan@....com>,
"linux-can@...r.kernel.org" <linux-can@...r.kernel.org>,
Pankaj Bansal <pankaj.bansal@....com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH 5/6] can: flexcan: add CAN wakeup function for i.MX8QM
Hi Marc,
> -----Original Message-----
> From: Marc Kleine-Budde <mkl@...gutronix.de>
> Sent: 2020年10月16日 18:40
> To: Joakim Zhang <qiangqing.zhang@....com>; robh+dt@...nel.org;
> shawnguo@...nel.org; s.hauer@...gutronix.de
> Cc: kernel@...gutronix.de; dl-linux-imx <linux-imx@....com>; Ying Liu
> <victor.liu@....com>; Peng Fan <peng.fan@....com>;
> linux-can@...r.kernel.org; Pankaj Bansal <pankaj.bansal@....com>;
> netdev@...r.kernel.org; devicetree@...r.kernel.org;
> linux-kernel@...r.kernel.org
> Subject: Re: [PATCH 5/6] can: flexcan: add CAN wakeup function for i.MX8QM
>
> On 10/16/20 12:00 PM, Joakim Zhang wrote:
> >>>> +static int flexcan_stop_mode_enable_scfw(struct flexcan_priv
> >>>> +*priv, bool enabled) {
> >>>> + u8 idx = priv->can_idx;
> >>>> + u32 rsrc_id, val;
> >>>> +
> >>>> + if (idx == 0)
> >>>> + rsrc_id = IMX_SC_R_CAN_0;
> >>>> + else if (idx == 1)
> >>>> + rsrc_id = IMX_SC_R_CAN_1;
> >>>> + else
> >>>> + rsrc_id = IMX_SC_R_CAN_2;
> >>>
> >>> Can you introduce something like and make use of it:
> >>>
> >>> #define IMX_SC_R_CAN(x) (105 + (x))
> >> OK.
> >
> > I thought it over again, from my point of view, use macro here
> > directly could be more intuitive, and can achieve a direct jump.
> > If change to above wrapper, on the contrary make confusion, and
> > generate the magic number 105. ☹
>
> The define should go into the rsrc.h, and probably be:
>
> #define IMX_SC_R_CAN(x) (IMX_SC_R_CAN_0 + (x))
>
> and if you change the firmware interface, you probably have more problems :)
rsrc.h:
/*
* These defines are used to indicate a resource. Resources include peripherals
* and bus masters (but not memory regions). Note items from list should
* never be changed or removed (only added to at the end of the list).
*/
Hmm, it just list all resource id, and never be changed. Anyway, if you think above way is better, I will turn to it.
> >>>> +
> >>>> + if (enabled)
> >>>> + val = 1;
> >>>> + else
> >>>> + val = 0;
> >>>> +
> >>>> + /* stop mode request via scu firmware */
> >>>> + return imx_sc_misc_set_control(priv->sc_ipc_handle, rsrc_id,
> >>>> +IMX_SC_C_IPG_STOP, val); }
> >
> > We still need use IMX_SC_C_IPG_STOP, why not be consistent?
>
> Sorry I don't get what you want to tell me here.
Need me add IMX_SC_C_IPG_STOP macro in the driver directly?
Such as, #define IMX_SC_C_IPG_STOP 52, so that no need to include rsrc.h file in the driver.
Best Regards,
Joakim Zhang
> 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 |
Powered by blists - more mailing lists