From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jean-Jacques Hiblot Date: Fri, 4 May 2018 19:58:03 +0200 Subject: [U-Boot] [PATCH v5 4/9] board: ti: dra7xx-evm: turn on USB clocks in late init stage In-Reply-To: <63cc1a70-416f-1198-b69a-8ba6da966077@denx.de> References: <1525444491-24324-1-git-send-email-jjhiblot@ti.com> <1525444491-24324-5-git-send-email-jjhiblot@ti.com> <94cee3cd-3e4a-9e7b-174d-0eba1f52b9c2@ti.com> <63cc1a70-416f-1198-b69a-8ba6da966077@denx.de> Message-ID: <170cd2a6-b143-aa78-872a-18f729855be4@ti.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit To: u-boot@lists.denx.de On 04/05/2018 17:43, Marek Vasut wrote: > On 05/04/2018 04:42 PM, Jean-Jacques Hiblot wrote: >> >> On 04/05/2018 16:38, Marek Vasut wrote: >>> On 05/04/2018 04:34 PM, Jean-Jacques Hiblot wrote: >>>> For USB ports that use the Driver Model, turn on the clocks during the >>>> late init stage. >>>> >>>> Signed-off-by: Jean-Jacques Hiblot >>>> Reviewed-by: Tom Rini >>>> --- >>>> >>>> Changes in v5: None >>>> Changes in v4: None >>>> Changes in v3: None >>>> Changes in v2: None >>>> >>>>   board/ti/dra7xx/evm.c | 19 +++++++++++++++++++ >>>>   1 file changed, 19 insertions(+) >>>> >>>> diff --git a/board/ti/dra7xx/evm.c b/board/ti/dra7xx/evm.c >>>> index 06f061c..c1e1b8e 100644 >>>> --- a/board/ti/dra7xx/evm.c >>>> +++ b/board/ti/dra7xx/evm.c >>>> @@ -647,6 +647,19 @@ int dram_init_banksize(void) >>>>       return 0; >>>>   } >>>>   +#if CONFIG_IS_ENABLED(DM_USB) && CONFIG_IS_ENABLED(OF_CONTROL) >>>> +static int device_okay(const char *path) >>>> +{ >>>> +    int node; >>>> + >>>> +    node = fdt_path_offset(gd->fdt_blob, path); >>>> +    if (node < 0) >>>> +        return 0; >>>> + >>>> +    return fdtdec_get_is_enabled(gd->fdt_blob, node); >>>> +} >>>> +#endif >>>> + >>>>   int board_late_init(void) >>>>   { >>>>   #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG >>>> @@ -686,6 +699,12 @@ int board_late_init(void) >>>>       if (board_is_dra71x_evm()) >>>>           palmas_i2c_write_u8(LP873X_I2C_SLAVE_ADDR, 0x9, 0x7); >>>>   #endif >>>> +#if CONFIG_IS_ENABLED(DM_USB) && CONFIG_IS_ENABLED(OF_CONTROL) >>>> +    if (device_okay("/ocp/omap_dwc3_1 at 48880000")) >>>> +        enable_usb_clocks(0); >>>> +    if (device_okay("/ocp/omap_dwc3_2 at 488c0000")) >>>> +        enable_usb_clocks(1); >>>> +#endif >>> Shouldnt the driver turn this on? >> AFAIK there is no clock driver for the OMAP. So we have to do it before >> the driver is probed. > Maybe it's time to implement it instead of piling up those hacks ? I was thinking along the same lines at some point but then I realized that it will make the SPL really big. And we are already tight on some platforms like am335x. JJ >