Kieran Bingham <[email protected]> writes:

> From: Kieran Bingham <[email protected]>
>
> This patch was created by pulling in the code required from the Arago Tree.
> Checked by running on a Spectrum Digital DM365EVM Revision C.

As Sergei pointed out, this is not an adequate changelog.

This type of background info should go after the '---' line so it
doesn't make it as part of the git history.

What goes here is the what, why and how of the patch itself.  History
and background info goes after the '---'.

Also, considering it was taken from another tree, I'm assuming you are
not the original author (unless you completely re-wrote this) so the
From: line above should have the original author and the changelog should
mention your updates/changes etc.

> Signed-off-by: Kieran Bingham <[email protected]>
> ---
>  arch/arm/mach-davinci/board-dm365-evm.c |   13 +++++++++++++
>  drivers/usb/musb/davinci.c              |   12 ++++++++++++
>  drivers/usb/musb/davinci.h              |    4 ++++
>  3 files changed, 29 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/mach-davinci/board-dm365-evm.c 
> b/arch/arm/mach-davinci/board-dm365-evm.c
> index fdb073e..c4a05fc 100644
> --- a/arch/arm/mach-davinci/board-dm365-evm.c
> +++ b/arch/arm/mach-davinci/board-dm365-evm.c
> @@ -18,6 +18,7 @@
>  #include <linux/i2c.h>
>  #include <linux/io.h>
>  #include <linux/clk.h>
> +#include <linux/gpio.h>
>  #include <linux/i2c/at24.h>
>  #include <linux/leds.h>
>  #include <linux/mtd/mtd.h>
> @@ -39,6 +40,7 @@
>  #include <mach/mmc.h>
>  #include <mach/nand.h>
>  #include <mach/keyscan.h>
> +#include <mach/usb.h>
>  
>  #include <media/tvp514x.h>
>  
> @@ -590,6 +592,15 @@ static struct spi_board_info dm365_evm_spi_info[] 
> __initconst = {
>       },
>  };
>  
> +static void dm365evm_usb_configure(void)
> +{
> +     davinci_cfg_reg(DM365_GPIO33);
> +     gpio_request(33, "usb");

This can fail.  Please check return value.

> +     gpio_direction_output(33, 1);
> +     davinci_setup_usb(500, 8);
> +}
> +
> +
>  static __init void dm365_evm_init(void)
>  {
>       evm_init_i2c();
> @@ -607,6 +618,8 @@ static __init void dm365_evm_init(void)
>       dm365_init_rtc();
>       dm365_init_ks(&dm365evm_ks_data);
>  
> +     dm365evm_usb_configure();
> +
>       dm365_init_spi0(BIT(0), dm365_evm_spi_info,
>                       ARRAY_SIZE(dm365_evm_spi_info));
>  }
> diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c
> index ce2e16f..3736792 100644
> --- a/drivers/usb/musb/davinci.c
> +++ b/drivers/usb/musb/davinci.c
> @@ -64,6 +64,16 @@ 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()) {
> +             /*
> +              * DM365 PHYCLKFREQ field [15:12] is set to 2
> +              * to get clock from 24MHz crystal
> +              */
> +             phy_ctrl |= USBPHY_CLKFREQ_24MHZ;
> +             /*phy_ctrl &= ~USBPHY_PHYPDWN;*/
> +     }
> +

Again, as Sergei mentioned, thisis board-specific data and should be passed in
from the board file, not set conditionally in the driver.

Kevin

>       __raw_writel(phy_ctrl, USB_PHY_CTRL);
>  
>       /* wait for PLL to lock before proceeding */
> @@ -188,6 +198,8 @@ static void davinci_source_power(struct musb *musb, int 
> is_on, int immediate)
>       if (immediate)
>               vbus_state = is_on;
>  #endif
> +     if (cpu_is_davinci_dm365())
> +             gpio_set_value(33, is_on);
>  }
>  
>  static void davinci_set_vbus(struct musb *musb, int is_on)
> diff --git a/drivers/usb/musb/davinci.h b/drivers/usb/musb/davinci.h
> index 046c844..0577ec6 100644
> --- a/drivers/usb/musb/davinci.h
> +++ b/drivers/usb/musb/davinci.h
> @@ -16,6 +16,10 @@
>  
>  /* Integrated highspeed/otg PHY */
>  #define USBPHY_CTL_PADDR     (DAVINCI_SYSTEM_MODULE_BASE + 0x34)
> +#define USBPHY_NDATAPOL              BIT(18)
> +#define USBPHY_SESSION_VBUS  BIT(17)
> +#define USBPHY_PERI_USBID    BIT(16)
> +#define USBPHY_CLKFREQ_24MHZ BIT(13)
>  #define USBPHY_DATAPOL               BIT(11) /* (dm355) switch D+/D- */
>  #define USBPHY_PHYCLKGD              BIT(8)
>  #define USBPHY_SESNDEN               BIT(7)  /* v(sess_end) comparator */
> -- 
> 1.6.2.1
>
> _______________________________________________
> Davinci-linux-open-source mailing list
> [email protected]
> http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to