diff mbox

Enable USB on dm365

Message ID 1311841267-31932-1-git-send-email-const@MakeLinux.com (mailing list archive)
State Changes Requested
Headers show

Commit Message

Constantine Shulyupin July 28, 2011, 8:21 a.m. UTC
From: Constantine Shulyupin <const@MakeLinux.com>


Signed-off-by: Constantine Shulyupin <const@MakeLinux.com>
---
 arch/arm/mach-davinci/board-dm365-evm.c |    2 ++
 drivers/usb/musb/davinci.c              |    6 ++++++
 drivers/usb/musb/davinci.h              |    1 +
 3 files changed, 9 insertions(+), 0 deletions(-)

Comments

Sergei Shtylyov July 29, 2011, 10:35 a.m. UTC | #1
Hello.

On 28-07-2011 12:21, const@MakeLinux.com wrote:

> From: Constantine Shulyupin<const@MakeLinux.com>

    Please in the future add "v2" (or whatever version it's gonna be) after 
"PATCH" in the subject, and describe the changes that you've done below your 
signoff and the --- tear line.

> Signed-off-by: Constantine Shulyupin<const@MakeLinux.com>

> diff --git a/arch/arm/mach-davinci/board-dm365-evm.c b/arch/arm/mach-davinci/board-dm365-evm.c
> index 8710614..c62ca53 100644
> --- a/arch/arm/mach-davinci/board-dm365-evm.c
> +++ b/arch/arm/mach-davinci/board-dm365-evm.c
> @@ -39,6 +39,7 @@
>   #include<mach/mmc.h>
>   #include<mach/nand.h>
>   #include<mach/keyscan.h>
> +#include<mach/usb.h>
>
>   #include<media/tvp514x.h>
>
> @@ -612,6 +613,7 @@ static __init void dm365_evm_init(void)
>
>   	dm365_init_spi0(BIT(0), dm365_evm_spi_info,
>   			ARRAY_SIZE(dm365_evm_spi_info));
> +	davinci_setup_usb(500, 8);
>   }
>
>   MACHINE_START(DAVINCI_DM365_EVM, "DaVinci DM365 EVM")

    The patch needs to be split here (and the second part pushed thru the 
'linux-usb' mailing list.
    I also wonder whether we should setup PinMux to activate VBUS, once we 
dropped the GPIO manipulation.

> diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c
> index 2a2adf6..905a107 100644
> --- a/drivers/usb/musb/davinci.c
> +++ b/drivers/usb/musb/davinci.c
> @@ -72,6 +72,11 @@ static inline void phy_on(void)
>   	/* power everything up; start the on-chip PHY and its PLL */
>   	phy_ctrl&= ~(USBPHY_OSCPDWN | USBPHY_OTGPDWN | USBPHY_PHYPDWN);
>   	phy_ctrl |= USBPHY_SESNDEN | USBPHY_VBDTCTEN | USBPHY_PHYPLLON;
> +
> +	if (cpu_is_davinci_dm365()) {
> +		phy_ctrl |= USBPHY_CLKFREQ_24MHZ;
> +	}

    I'm still thinking this should belong to the board code. That, and {} are 
not needed.

> +
>   	__raw_writel(phy_ctrl, USB_PHY_CTRL);
>
>   	/* wait for PLL to lock before proceeding */
> diff --git a/drivers/usb/musb/davinci.h b/drivers/usb/musb/davinci.h
> index 046c844..1bf50e6 100644
> --- a/drivers/usb/musb/davinci.h
> +++ b/drivers/usb/musb/davinci.h
> @@ -17,6 +17,7 @@
>   /* Integrated highspeed/otg PHY */
>   #define USBPHY_CTL_PADDR	(DAVINCI_SYSTEM_MODULE_BASE + 0x34)
>   #define USBPHY_DATAPOL		BIT(11)	/* (dm355) switch D+/D- */
> +#define USBPHY_CLKFREQ_24MHZ    BIT(13)

    Please indent with tabs, not spaces.

WBR, Sergei
Constantine Shulyupin July 29, 2011, 1:50 p.m. UTC | #2
Thank you for your feedback.
There is no need to switch VBUS via GPIO. May be it is already done in u-boot.

On Fri, Jul 29, 2011 at 1:35 PM, Sergei Shtylyov <sshtylyov@mvista.com> wrote:
> Hello.
>
> On 28-07-2011 12:21, const@MakeLinux.com wrote:
>
>> From: Constantine Shulyupin<const@MakeLinux.com>
>
>   Please in the future add "v2" (or whatever version it's gonna be) after
> "PATCH" in the subject, and describe the changes that you've done below your
> signoff and the --- tear line.
>
>> Signed-off-by: Constantine Shulyupin<const@MakeLinux.com>
>
>> diff --git a/arch/arm/mach-davinci/board-dm365-evm.c
>> b/arch/arm/mach-davinci/board-dm365-evm.c
>> index 8710614..c62ca53 100644
>> --- a/arch/arm/mach-davinci/board-dm365-evm.c
>> +++ b/arch/arm/mach-davinci/board-dm365-evm.c
>> @@ -39,6 +39,7 @@
>>  #include<mach/mmc.h>
>>  #include<mach/nand.h>
>>  #include<mach/keyscan.h>
>> +#include<mach/usb.h>
>>
>>  #include<media/tvp514x.h>
>>
>> @@ -612,6 +613,7 @@ static __init void dm365_evm_init(void)
>>
>>        dm365_init_spi0(BIT(0), dm365_evm_spi_info,
>>                        ARRAY_SIZE(dm365_evm_spi_info));
>> +       davinci_setup_usb(500, 8);
>>  }
>>
>>  MACHINE_START(DAVINCI_DM365_EVM, "DaVinci DM365 EVM")
>
>   The patch needs to be split here (and the second part pushed thru the
> 'linux-usb' mailing list.
>   I also wonder whether we should setup PinMux to activate VBUS, once we
> dropped the GPIO manipulation.
>
>> diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c
>> index 2a2adf6..905a107 100644
>> --- a/drivers/usb/musb/davinci.c
>> +++ b/drivers/usb/musb/davinci.c
>> @@ -72,6 +72,11 @@ static inline void phy_on(void)
>>        /* power everything up; start the on-chip PHY and its PLL */
>>        phy_ctrl&= ~(USBPHY_OSCPDWN | USBPHY_OTGPDWN | USBPHY_PHYPDWN);
>>        phy_ctrl |= USBPHY_SESNDEN | USBPHY_VBDTCTEN | USBPHY_PHYPLLON;
>> +
>> +       if (cpu_is_davinci_dm365()) {
>> +               phy_ctrl |= USBPHY_CLKFREQ_24MHZ;
>> +       }
>
>   I'm still thinking this should belong to the board code. That, and {} are
> not needed.
>
>> +
>>        __raw_writel(phy_ctrl, USB_PHY_CTRL);
>>
>>        /* wait for PLL to lock before proceeding */
>> diff --git a/drivers/usb/musb/davinci.h b/drivers/usb/musb/davinci.h
>> index 046c844..1bf50e6 100644
>> --- a/drivers/usb/musb/davinci.h
>> +++ b/drivers/usb/musb/davinci.h
>> @@ -17,6 +17,7 @@
>>  /* Integrated highspeed/otg PHY */
>>  #define USBPHY_CTL_PADDR      (DAVINCI_SYSTEM_MODULE_BASE + 0x34)
>>  #define USBPHY_DATAPOL                BIT(11) /* (dm355) switch D+/D- */
>> +#define USBPHY_CLKFREQ_24MHZ    BIT(13)
>
>   Please indent with tabs, not spaces.
>
> WBR, Sergei
>
Sergei Shtylyov Aug. 1, 2011, 8:54 a.m. UTC | #3
Hello.

On 29-07-2011 17:50, Constantine Shulyupin wrote:

> Thank you for your feedback.
> There is no need to switch VBUS via GPIO. May be it is already done in u-boot.

    Still, would be good if MUSB could control it (preferrably implicitly).

WBR, Sergei
diff mbox

Patch

diff --git a/arch/arm/mach-davinci/board-dm365-evm.c b/arch/arm/mach-davinci/board-dm365-evm.c
index 8710614..c62ca53 100644
--- a/arch/arm/mach-davinci/board-dm365-evm.c
+++ b/arch/arm/mach-davinci/board-dm365-evm.c
@@ -39,6 +39,7 @@ 
 #include <mach/mmc.h>
 #include <mach/nand.h>
 #include <mach/keyscan.h>
+#include <mach/usb.h>
 
 #include <media/tvp514x.h>
 
@@ -612,6 +613,7 @@  static __init void dm365_evm_init(void)
 
 	dm365_init_spi0(BIT(0), dm365_evm_spi_info,
 			ARRAY_SIZE(dm365_evm_spi_info));
+	davinci_setup_usb(500, 8);
 }
 
 MACHINE_START(DAVINCI_DM365_EVM, "DaVinci DM365 EVM")
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c
index 2a2adf6..905a107 100644
--- a/drivers/usb/musb/davinci.c
+++ b/drivers/usb/musb/davinci.c
@@ -72,6 +72,11 @@  static inline void phy_on(void)
 	/* power everything up; start the on-chip PHY and its PLL */
 	phy_ctrl &= ~(USBPHY_OSCPDWN | USBPHY_OTGPDWN | USBPHY_PHYPDWN);
 	phy_ctrl |= USBPHY_SESNDEN | USBPHY_VBDTCTEN | USBPHY_PHYPLLON;
+
+	if (cpu_is_davinci_dm365()) {
+		phy_ctrl |= USBPHY_CLKFREQ_24MHZ;
+	}
+
 	__raw_writel(phy_ctrl, USB_PHY_CTRL);
 
 	/* wait for PLL to lock before proceeding */
diff --git a/drivers/usb/musb/davinci.h b/drivers/usb/musb/davinci.h
index 046c844..1bf50e6 100644
--- a/drivers/usb/musb/davinci.h
+++ b/drivers/usb/musb/davinci.h
@@ -17,6 +17,7 @@ 
 /* Integrated highspeed/otg PHY */
 #define USBPHY_CTL_PADDR	(DAVINCI_SYSTEM_MODULE_BASE + 0x34)
 #define USBPHY_DATAPOL		BIT(11)	/* (dm355) switch D+/D- */
+#define USBPHY_CLKFREQ_24MHZ    BIT(13)
 #define USBPHY_PHYCLKGD		BIT(8)
 #define USBPHY_SESNDEN		BIT(7)	/* v(sess_end) comparator */
 #define USBPHY_VBDTCTEN		BIT(6)	/* v(bus) comparator */