From: Wolfgang Denk Date: Wed, 07 May 2014 20:12:27 +0200 Subject: [U-Boot] [PATCH] drivers/usb : Introduce APIs for fsl usb registers In-Reply-To: <1399468595-953-1-git-send-email-nikhil.badola@freescale.com> References: <1399468595-953-1-git-send-email-nikhil.badola@freescale.com> Message-ID: <20140507181227.87A20380180@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Nikhil Badola, In message <1399468595-953-1-git-send-email-nikhil.badola@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