Re: [PATCH v4 1/6] can: flexcan: Remodel FlexCAN register r/w APIs for big endian FlexCAN controllers.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 11/26/2017 03:20 AM, Pankaj Bansal wrote:
>>> diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
>>> index a13a489..4c873fb 100644
>>> --- a/drivers/net/can/flexcan.c
>>> +++ b/drivers/net/can/flexcan.c
>>
>> [...]
>> I think this will select LE for non DT devices, right?
>>
> 
> Yes.  As per below code snippet:
> 
> static struct property *__of_find_property(const struct device_node *np,
> 					   const char *name, int *lenp)
> {
> 	struct property *pp;
> 
> 	if (!np)
> 		return NULL;
>               ....
> }
> 
> If no device node is present null is returned.
> So we select le as default.

This is what I found out, too.

>>> +	if (of_property_read_bool(pdev->dev.of_node, "big-endian")) {
>>> +		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->can.clock.freq = clock_freq;
>>>  	priv->can.bittiming_const = &flexcan_bittiming_const;
>>>  	priv->can.do_set_mode = flexcan_set_mode;

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: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux