From mboxrd@z Thu Jan 1 00:00:00 1970 From: maitysanchayan at gmail.com Date: Fri, 8 Jan 2016 11:20:41 +0530 Subject: [U-Boot] [PATCH v5] colibri_vf: Add board_usb_phy_mode function In-Reply-To: <568ED4BD.1040208@denx.de> References: <90c1bac58603f7ee6b898989949e06acc121a75e.1447080516.git.maitysanchayan@gmail.com> <20151124102304.GA4804@Sanchayan-Arch.toradex.int> <56543E07.907@denx.de> <20160107200204.GA5281@Sanchayan-Arch> <568ED4BD.1040208@denx.de> Message-ID: <20160108055041.GA2977@Sanchayan-Arch.toradex.int> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hello, On 16-01-07 22:12:29, Stefano Babic wrote: > Hi, > > On 07/01/2016 21:02, maitysanchayan at gmail.com wrote: > > Hello Stefano, > > > > Ping? > > > > I just checked the master branch and this has not been picked up yet. > > > > Can you check ? I see: > > commit 01a8cf91513981d05bf89840d768e9c060ee998b > Author: Sanchayan Maity > Date: Thu Nov 12 11:47:35 2015 +0530 > > colibri_vf: Add board_usb_phy_mode function Yes, this seems to be present but the first and second patch in the series which make changes to the ehci-vf driver are not present. - Sanchayan. > > Regards, > Stefano > > > - Sanchayan. > > > > On 15-11-24 11:37:59, Stefano Babic wrote: > >> On 24/11/2015 11:23, maitysanchayan at gmail.com wrote: > >>> Hello, > >>> > >>> Ping? > >>> > >>> Any further feedback? Is the patchset good to get accepted? > >> > >> I'll pick it up > >> > >> Best regards, > >> Stefano Babic > >> > >>> > >>> Thanks. > >>> > >>> Regards, > >>> Sanchayan. > >>> > >>> On 15-11-12 11:47:35, Sanchayan Maity wrote: > >>>> Add board_usb_phy_mode function for detecting whether a port is > >>>> being used as host or client using a GPIO. On Colibri Vybrid we > >>>> provide GPIO 102 for this very same purpose. > >>>> > >>>> Signed-off-by: Sanchayan Maity > >>>> --- > >>>> Changes since v4: > >>>> No need to break after return. > >>>> > >>>> Changes since v3: > >>>> Return USB_INIT_DEVICE or USB_INIT_HOST after checking for > >>>> the GPIO state to account for the fact that the previous > >>>> logic breaks in case if the enum for USB mode were to ever > >>>> be changed. > >>>> > >>>> Add comments based on Stefan's feedback. > >>>> > >>>> Changes since v2: > >>>> > >>>> Instead of returning 0 from board_usb_phy_mode return it as > >>>> USB_INIT_HOST. > >>>> > >>>> Changes since v1: > >>>> > >>>> Move the GPIO request call to the board_init function as all > >>>> further calls to board_usb_phy_mode will actually result in the > >>>> gpio_request failing. > >>>> --- > >>>> board/toradex/colibri_vf/colibri_vf.c | 33 ++++++++++++++++++++++++++++++++- > >>>> 1 file changed, 32 insertions(+), 1 deletion(-) > >>>> > >>>> diff --git a/board/toradex/colibri_vf/colibri_vf.c b/board/toradex/colibri_vf/colibri_vf.c > >>>> index a6d1c5b..c65ccb3 100644 > >>>> --- a/board/toradex/colibri_vf/colibri_vf.c > >>>> +++ b/board/toradex/colibri_vf/colibri_vf.c > >>>> @@ -21,6 +21,7 @@ > >>>> #include > >>>> #include > >>>> #include > >>>> +#include > >>>> > >>>> DECLARE_GLOBAL_DATA_PTR; > >>>> > >>>> @@ -34,6 +35,7 @@ DECLARE_GLOBAL_DATA_PTR; > >>>> PAD_CTL_DSE_50ohm | PAD_CTL_OBE_IBE_ENABLE) > >>>> > >>>> #define USB_PEN_GPIO 83 > >>>> +#define USB_CDET_GPIO 102 > >>>> > >>>> static struct ddrmc_cr_setting colibri_vf_cr_settings[] = { > >>>> /* levelling */ > >>>> @@ -92,6 +94,7 @@ static struct ddrmc_cr_setting colibri_vf_cr_settings[] = { > >>>> > >>>> static const iomux_v3_cfg_t usb_pads[] = { > >>>> VF610_PAD_PTD4__GPIO_83, > >>>> + VF610_PAD_PTC29__GPIO_102, > >>>> }; > >>>> > >>>> int dram_init(void) > >>>> @@ -280,7 +283,6 @@ static void setup_iomux_gpio(void) > >>>> VF610_PAD_PTB23__GPIO_93, > >>>> VF610_PAD_PTB26__GPIO_96, > >>>> VF610_PAD_PTB28__GPIO_98, > >>>> - VF610_PAD_PTC29__GPIO_102, > >>>> VF610_PAD_PTC30__GPIO_103, > >>>> VF610_PAD_PTA7__GPIO_134, > >>>> }; > >>>> @@ -509,6 +511,10 @@ int board_init(void) > >>>> > >>>> setbits_le32(&scsc->sosc_ctr, SCSC_SOSC_CTR_SOSC_EN); > >>>> > >>>> +#ifdef CONFIG_USB_EHCI_VF > >>>> + gpio_request(USB_CDET_GPIO, "usb-cdet-gpio"); > >>>> +#endif > >>>> + > >>>> return 0; > >>>> } > >>>> > >>>> @@ -554,4 +560,29 @@ int board_ehci_hcd_init(int port) > >>>> } > >>>> return 0; > >>>> } > >>>> + > >>>> +int board_usb_phy_mode(int port) > >>>> +{ > >>>> + switch (port) { > >>>> + case 0: > >>>> + /* > >>>> + * Port 0 is used only in client mode on Colibri Vybrid modules > >>>> + * Check for state of USB client gpio pin and accordingly return > >>>> + * USB_INIT_DEVICE or USB_INIT_HOST. > >>>> + */ > >>>> + if (gpio_get_value(USB_CDET_GPIO)) > >>>> + return USB_INIT_DEVICE; > >>>> + else > >>>> + return USB_INIT_HOST; > >>>> + case 1: > >>>> + /* Port 1 is used only in host mode on Colibri Vybrid modules */ > >>>> + return USB_INIT_HOST; > >>>> + default: > >>>> + /* > >>>> + * There are only two USB controllers on Vybrid. Ideally we will > >>>> + * not reach here. However return USB_INIT_HOST if we do. > >>>> + */ > >>>> + return USB_INIT_HOST; > >>>> + } > >>>> +} > >>>> #endif > >>>> -- > >>>> 2.6.2 > >>>> > >> > >> > >> -- > >> ===================================================================== > >> DENX Software Engineering GmbH, Managing Director: Wolfgang Denk > >> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany > >> Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de > >> ===================================================================== > > -- > ===================================================================== > DENX Software Engineering GmbH, Managing Director: Wolfgang Denk > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany > Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de > =====================================================================