Re: [U-Boot] [PATCH 2/2] usb: phy: omap_usb_phy: implement usb_phy_power() for AM437x

2014-07-10 Thread Marek Vasut
On Thursday, July 10, 2014 at 06:06:06 AM, Felipe Balbi wrote:
 On Wed, Jul 09, 2014 at 11:02:43PM -0500, Felipe Balbi wrote:
  Newer AM437x silicon requires us to explicitly power up
  the USB2 PHY. By implementing usb_phy_power() we can
  achieve that.
  
  Signed-off-by: Felipe Balbi ba...@ti.com
  ---
 
 the only change here is the use of {set,clr}bits_le32()

Well, given the pressure before release, I picked the previous one (without 
clrsetbits). I think the original will also generate less code, so let's keep 
it 
at that. Sorry I've been pushing you around.

Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 2/2] usb: phy: omap_usb_phy: implement usb_phy_power() for AM437x

2014-07-09 Thread Felipe Balbi
Newer AM437x silicon requires us to explicitly power up
the USB2 PHY. By implementing usb_phy_power() we can
achieve that.

Signed-off-by: Felipe Balbi ba...@ti.com
---
 arch/arm/include/asm/arch-am33xx/hardware_am43xx.h |  5 +
 drivers/usb/phy/omap_usb_phy.c | 11 ++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/arch/arm/include/asm/arch-am33xx/hardware_am43xx.h 
b/arch/arm/include/asm/arch-am33xx/hardware_am43xx.h
index b470319..efdecf4 100644
--- a/arch/arm/include/asm/arch-am33xx/hardware_am43xx.h
+++ b/arch/arm/include/asm/arch-am33xx/hardware_am43xx.h
@@ -43,6 +43,11 @@
 #define VTP0_CTRL_ADDR 0x44E10E0C
 #define VTP1_CTRL_ADDR 0x48140E10
 
+/* USB CTRL Base Address */
+#define USB1_CTRL  0x44e10628
+#define USB1_CTRL_CM_PWRDN BIT(0)
+#define USB1_CTRL_OTG_PWRDNBIT(1)
+
 /* DDR Base address */
 #define DDR_PHY_CMD_ADDR   0x44E12000
 #define DDR_PHY_DATA_ADDR  0x44E120C8
diff --git a/drivers/usb/phy/omap_usb_phy.c b/drivers/usb/phy/omap_usb_phy.c
index af46db2..53778b3 100644
--- a/drivers/usb/phy/omap_usb_phy.c
+++ b/drivers/usb/phy/omap_usb_phy.c
@@ -222,7 +222,16 @@ static void am437x_enable_usb2_phy2(struct omap_xhci *omap)
 
 void usb_phy_power(int on)
 {
-   return;
+   /*
+* In order to get USB working on newer AM43xx silicon, we must
+* explicitly power the USB PHYs.
+*/
+   if (on)
+   clrbits_le32(USB1_CTRL, USB1_CTRL_CM_PWRDN |
+   USB1_CTRL_OTG_PWRDN);
+   else
+   setbits_le32(USB1_CTRL, USB1_CTRL_CM_PWRDN |
+   USB1_CTRL_OTG_PWRDN);
 }
 #endif /* CONFIG_AM437X_USB2PHY2_HOST */
 
-- 
2.0.0.390.gcb682f8

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/2] usb: phy: omap_usb_phy: implement usb_phy_power() for AM437x

2014-07-09 Thread Felipe Balbi
On Wed, Jul 09, 2014 at 11:02:43PM -0500, Felipe Balbi wrote:
 Newer AM437x silicon requires us to explicitly power up
 the USB2 PHY. By implementing usb_phy_power() we can
 achieve that.
 
 Signed-off-by: Felipe Balbi ba...@ti.com
 ---

the only change here is the use of {set,clr}bits_le32()

  arch/arm/include/asm/arch-am33xx/hardware_am43xx.h |  5 +
  drivers/usb/phy/omap_usb_phy.c | 11 ++-
  2 files changed, 15 insertions(+), 1 deletion(-)
 
 diff --git a/arch/arm/include/asm/arch-am33xx/hardware_am43xx.h 
 b/arch/arm/include/asm/arch-am33xx/hardware_am43xx.h
 index b470319..efdecf4 100644
 --- a/arch/arm/include/asm/arch-am33xx/hardware_am43xx.h
 +++ b/arch/arm/include/asm/arch-am33xx/hardware_am43xx.h
 @@ -43,6 +43,11 @@
  #define VTP0_CTRL_ADDR   0x44E10E0C
  #define VTP1_CTRL_ADDR   0x48140E10
  
 +/* USB CTRL Base Address */
 +#define USB1_CTRL0x44e10628
 +#define USB1_CTRL_CM_PWRDN   BIT(0)
 +#define USB1_CTRL_OTG_PWRDN  BIT(1)
 +
  /* DDR Base address */
  #define DDR_PHY_CMD_ADDR 0x44E12000
  #define DDR_PHY_DATA_ADDR0x44E120C8
 diff --git a/drivers/usb/phy/omap_usb_phy.c b/drivers/usb/phy/omap_usb_phy.c
 index af46db2..53778b3 100644
 --- a/drivers/usb/phy/omap_usb_phy.c
 +++ b/drivers/usb/phy/omap_usb_phy.c
 @@ -222,7 +222,16 @@ static void am437x_enable_usb2_phy2(struct omap_xhci 
 *omap)
  
  void usb_phy_power(int on)
  {
 - return;
 + /*
 +  * In order to get USB working on newer AM43xx silicon, we must
 +  * explicitly power the USB PHYs.
 +  */
 + if (on)
 + clrbits_le32(USB1_CTRL, USB1_CTRL_CM_PWRDN |
 + USB1_CTRL_OTG_PWRDN);
 + else
 + setbits_le32(USB1_CTRL, USB1_CTRL_CM_PWRDN |
 + USB1_CTRL_OTG_PWRDN);
  }
  #endif /* CONFIG_AM437X_USB2PHY2_HOST */
  
 -- 
 2.0.0.390.gcb682f8
 

-- 
balbi


signature.asc
Description: Digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 2/2] usb: phy: omap_usb_phy: implement usb_phy_power() for AM437x

2014-06-23 Thread Felipe Balbi
Newer AM437x silicon requires us to explicitly power up
the USB2 PHY. By implementing usb_phy_power() we can
achieve that.

Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/usb/phy/omap_usb_phy.c | 17 -
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/phy/omap_usb_phy.c b/drivers/usb/phy/omap_usb_phy.c
index af46db2..0ed3e70 100644
--- a/drivers/usb/phy/omap_usb_phy.c
+++ b/drivers/usb/phy/omap_usb_phy.c
@@ -222,7 +222,22 @@ static void am437x_enable_usb2_phy2(struct omap_xhci *omap)
 
 void usb_phy_power(int on)
 {
-   return;
+   u32 val;
+
+   /* USB1_CTRL */
+   val = readl(0x44e10628);
+   if (on) {
+   /*
+* these bits are re-used on AM437x to power up/down the USB
+* CM and OTG PHYs, if we don't toggle them, USB will not be
+* functional on newer silicon revisions
+*/
+   val = ~0x3;
+   } else {
+   val |= 0x3;
+   }
+
+   writel(val, 0x44e10628);
 }
 #endif /* CONFIG_AM437X_USB2PHY2_HOST */
 
-- 
2.0.0.390.gcb682f8

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/2] usb: phy: omap_usb_phy: implement usb_phy_power() for AM437x

2014-06-23 Thread Michael Trimarchi
Hi

Il 23/giu/2014 23:26 Felipe Balbi ba...@ti.com ha scritto:

 Newer AM437x silicon requires us to explicitly power up
 the USB2 PHY. By implementing usb_phy_power() we can
 achieve that.

 Signed-off-by: Felipe Balbi ba...@ti.com
 ---
  drivers/usb/phy/omap_usb_phy.c | 17 -
  1 file changed, 16 insertions(+), 1 deletion(-)

 diff --git a/drivers/usb/phy/omap_usb_phy.c
b/drivers/usb/phy/omap_usb_phy.c
 index af46db2..0ed3e70 100644
 --- a/drivers/usb/phy/omap_usb_phy.c
 +++ b/drivers/usb/phy/omap_usb_phy.c
 @@ -222,7 +222,22 @@ static void am437x_enable_usb2_phy2(struct omap_xhci
*omap)

  void usb_phy_power(int on)
  {
 -   return;
 +   u32 val;
 +
 +   /* USB1_CTRL */
 +   val = readl(0x44e10628);

Can you please describe 0x44e...

 +   if (on) {
 +   /*
 +* these bits are re-used on AM437x to power up/down the
USB
 +* CM and OTG PHYs, if we don't toggle them, USB will not
be
 +* functional on newer silicon revisions
 +*/
 +   val = ~0x3;
 +   } else {
 +   val |= 0x3;

ditto

 +   }
 +
 +   writel(val, 0x44e10628);

ditto

  }
  #endif /* CONFIG_AM437X_USB2PHY2_HOST */


Michael

 --
 2.0.0.390.gcb682f8

 ___
 U-Boot mailing list
 U-Boot@lists.denx.de
 http://lists.denx.de/mailman/listinfo/u-boot
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/2] usb: phy: omap_usb_phy: implement usb_phy_power() for AM437x

2014-06-23 Thread Felipe Balbi
Hi,

On Mon, Jun 23, 2014 at 11:28:30PM +0200, Michael Trimarchi wrote:
  @@ -222,7 +222,22 @@ static void am437x_enable_usb2_phy2(struct omap_xhci
 *omap)
 
   void usb_phy_power(int on)
   {
  -   return;
  +   u32 val;
  +
  +   /* USB1_CTRL */
  +   val = readl(0x44e10628);
 
 Can you please describe 0x44e...

describe in what way ? The comment right above it, tells you what it is,
so does the comment in the if block. Now, if what you're asking is for
#defines for those constants, sure, I can do that.

-- 
balbi


signature.asc
Description: Digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/2] usb: phy: omap_usb_phy: implement usb_phy_power() for AM437x

2014-06-23 Thread Michael Trimarchi
Hi

Il 23/giu/2014 23:58 Felipe Balbi ba...@ti.com ha scritto:

 Hi,

 On Mon, Jun 23, 2014 at 11:28:30PM +0200, Michael Trimarchi wrote:
   @@ -222,7 +222,22 @@ static void am437x_enable_usb2_phy2(struct
omap_xhci
  *omap)
  
void usb_phy_power(int on)
{
   -   return;
   +   u32 val;
   +
   +   /* USB1_CTRL */
   +   val = readl(0x44e10628);
 
  Can you please describe 0x44e...

 describe in what way ? The comment right above it, tells you what it is,
 so does the comment in the if block. Now, if what you're asking is for
 #defines for those constants, sure, I can do that.

Yes, this was the suggestione


 --
 balbi
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot