drivers/usb : Introduce APIs for fsl usb registers
Subsystems (2)
PATCH 1/1 drivers/usb : Introduce APIs for fsl usb registers
Introduce new APIs to write fsl usb registers that have w1c bits. Existing API framework do not take care of w1c bits
--- drivers/usb/host/ehci-fsl.c | 17 ++++++++++++----- include/usb/ehci-fsl.h | 6 ++++++ 2 files changed, 18 insertions(+), 5 deletions(-)
drivers/usb/host/ehci-fsl.c +12 -5
@@ -104,15 +104,22 @@ int ehci_hcd_init(int index, enum usb_init_type init,if (!strncmp (phy_type,"utmi" ,4 )) {#if defined(CONFIG_SYS_FSL_USB_INTERNAL_UTMI_PHY ) -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 );udelay (1000 );/* delay required for PHY Clk to appear */ #endif out_le32 (&(*hcor)->or_portsc[0 ],PORT_PTS_UTMI ); -setbits_be32 (&ehci->control,USB_EN ); +fsl_usb_setbits (&ehci->control,USB_EN , +CONTROL_REGISTER_W1C_MASK ); }else { -setbits_be32 (&ehci->control,PHY_CLK_SEL_ULPI ); -clrsetbits_be32 (&ehci->control,UTMI_PHY_EN ,USB_EN ); +fsl_usb_setbits (&ehci->control,PHY_CLK_SEL_ULPI , +CONTROL_REGISTER_W1C_MASK ); +fsl_usb_clrbits (&ehci->control,UTMI_PHY_EN , +CONTROL_REGISTER_W1C_MASK ); +fsl_usb_setbits (&ehci->control,USB_EN , +CONTROL_REGISTER_W1C_MASK );udelay (1000 );/* delay required for PHY Clk to appear */ if (!usb_phy_clk_valid (ehci))return -EINVAL ;
include/usb/ehci-fsl.h +6 -0
@@ -11,6 +11,12 @@#include <asm/processor.h> +#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)) +/* Global offsets */ #define FSL_SKIP_PCI 0x100
Signature · 1 line
1.7.11.7
PATCH 1/1 drivers/usb : Introduce APIs for fsl usb registers
Dear Nikhil Badola,
Quoted 2 lines · In message <[email protected]> you…
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?
Quoted 6 lines
drivers/usb/host/ehci-fsl.c +4
-2-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 );
...
include/usb/ehci-fsl.h line 19
Quoted 6 lines
include/usb/ehci-fsl.h +6
-0+#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
Signature · 5 lines
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 RitchieA message that is not in the archive (sent off-list or not yet received): 0adb0aa7c7c6434fb762e1d076b24dae@BLUPR03MB133.namprd03.prod.outlook.com
PATCH 1/1 drivers/usb : Introduce APIs for fsl usb registers
Dear "nikhil.badola at freescale.com",
Quoted 9 lines · In message <0adb0aa7c7c6434fb762e1d076b24dae@BLUPR03MB133.namprd03.prod.outlook…
Quoted 3 lines
Why exactly do we need a new API for that? All you'r doing is adding just more bits to the mask, right?
I am adding mask for a register with w1c(write 1 to clear) bits set. So while setting/resetting any other bit in this register, these bits(w1c bits) should not get set so as to prevent them from clearing. For this purpose a new API is needed. This API can be used for any fsl registers that have any number of w1c bit(s). All one needs is to define mask for that register with w1c bits set.
You do not need a new API. We have clrsetbits_*(), which can do exactly what you need.
Best regards,
Wolfgang Denk
Signature · 5 lines
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 "To IBM, 'open' means there is a modicum of interoperability among some of their equipment." - Harv Masterson