[U-Boot] [PATCH] drivers/usb : Introduce APIs for fsl usb registers

Wolfgang Denk wd at denx.de
Wed May 7 20:12:27 CEST 2014


Dear Nikhil Badola,

In message <1399468595-953-1-git-send-email-nikhil.badola at freescale.com> you wrote:
> Introduce new APIs to write fsl usb registers that have w1c bits.
> Existing API framework do not take care of w1c bits

Why exactly do we need a new API for that?  All you'r doing is adding
just more bits to the mask, right?

> -		setbits_be32(&ehci->control, PHY_CLK_SEL_UTMI);
> -		setbits_be32(&ehci->control, UTMI_PHY_EN);
> +		fsl_usb_setbits(&ehci->control, PHY_CLK_SEL_UTMI,
> +				CONTROL_REGISTER_W1C_MASK);
> +		fsl_usb_setbits(&ehci->control, UTMI_PHY_EN,
> +				CONTROL_REGISTER_W1C_MASK);
...

> +#define CONTROL_REGISTER_W1C_MASK       0x00020000  /* W1C: PHY_CLK_VALID */
> +#define fsl_usb_setbits(_addr, _v, _mask) out_be32((_addr), \
> +			((in_be32(_addr) & ~_mask) | _v))
> +#define fsl_usb_clrbits(_addr, _v, _mask) out_be32((_addr), \
> +			((in_be32(_addr) & ~_mask) & ~_v))
> +

I cannot understand in which way

	fsl_usb_setbits(&ehci->control, PHY_CLK_SEL_UTMI, CONTROL_REGISTER_W1C_MASK);

would be different from

	setbits_be32(&ehci->control, PHY_CLK_SEL_UTMI | CONTROL_REGISTER_W1C_MASK);

?


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
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
I am not now, nor have I ever been, a member of the demigodic party.
                                                   -- Dennis Ritchie


More information about the U-Boot mailing list