[U-Boot] [PATCH] Revert "imx: wdog: correct wcr register settings"

Wolfgang Denk wd at denx.de
Thu Oct 1 22:50:08 CEST 2015


Dear Fabio,

In message <CAOMZO5BEfS10XVztnigMejMVJYLvv+jqDLZYom9K8-G+Zi1TXA at mail.gmail.com> you wrote:
> 
> > I'm sorry, but I fail to understand how writew() can be better than
> > another I/O accessor.  Neither of these has the capability to detect
> > the endianess of this specific register interface ?
> 
> It's not that writew() is better. The problem is that we cannot use
> clrsetbits_le16() for a big endian controller.

On ARM (a LE architecture), clrsetbits_le16() maps down into:

	clrsetbits_le16 ->
	out_le16 / in_le16 ->
	out_arch, w,le16 / in_arch, w,le16 ->
	__raw_writew(cpu_to_le16()) / le16__to_cpu(__raw_readw()) ->
	__raw_writew() / __raw_readw()

while

	writew() ->
	__raw_writew(cpu_to_le16(v),__mem_pci(c))
	__raw_writew()

Both map into __raw_writew() [which then boild down into
__arch_putw() which is just a volatile unsigned short write access.

So both clrsetbits_le16() and writew() are little endian accessors.
In which way would one write other data to the device than the other?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The human race has one really effective weapon, and that is laughter.
                                                         - Mark Twain


More information about the U-Boot mailing list