[U-Boot] [PATCH v4 2/7] gpio: Add Multi-Function-Pin configuration driver for Marvell SoCs

Prafulla Wadaskar prafulla at marvell.com
Thu Dec 9 10:18:39 CET 2010



> -----Original Message-----
> From: u-boot-bounces at lists.denx.de [mailto:u-boot-bounces at lists.denx.de]
> On Behalf Of Albert ARIBAUD
> Sent: Thursday, December 09, 2010 12:29 PM
> To: Chris Moore
> Cc: u-boot at lists.denx.de
> Subject: Re: [U-Boot] [PATCH v4 2/7] gpio: Add Multi-Function-Pin
> configuration driver for Marvell SoCs
> 
> Hi Chris,
> 
> Le 09/12/2010 07:11, Chris Moore a écrit :
> > Hi,
> >
> > Le 07/12/2010 18:39, Albert ARIBAUD a écrit :
> >> Le 07/12/2010 18:10, Prafulla Wadaskar a écrit :
> >>
> >>>>> + val&= ~MFP_AF_MASK;
> >>>> Do we need to do this& here? For val is only 0 here...
> >>> This can be removed.
> >> OTOH, with the&, this line makes no assumption about val, and thus will
> >> work regardless of it. If the& is removed, and if later val is set to
> >> non-zero before reaching this instruction, it will cause a bug.
> >>
> >> IOW, the& makes the statement more resilient.
> >>
> >
> > If val really is zero then the result will always be zero :(
> > Simply removing the & would give a different result.
> > It would be better to remove the whole bloody line ;-)
> >
> > I haven't followed this thread but I suspect the original code was
> wrong.
> 
> Good point as to the removal if the removal must be done :)
> 
> I still think that the original is functionally more correct *if we are
> not sure that val will always be zero.

The earlier code was using read-modify-write strategy for mfpr programming.
It is changed to create-write.
So removing 'and' operation makes more sense, I will post v4.1 for this since I do not want to post entire patch series.

Regards..
Prafulla . .



More information about the U-Boot mailing list