From mboxrd@z Thu Jan 1 00:00:00 1970 From: Giulio Benetti Date: Tue, 17 Dec 2019 19:37:39 +0100 Subject: [PATCH 14/20] serial_lpuart: add clock enable if CONFIG_CLK is defined In-Reply-To: <20191210004838.11f47099@jawa> References: <20191204174439.69934-1-giulio.benetti@benettiengineering.com> <20191204174439.69934-15-giulio.benetti@benettiengineering.com> <20191208155224.1a616652@jawa> <584853ba-6c78-c3b8-1abf-01b2eafe9de5@benettiengineering.com> <20191210004838.11f47099@jawa> Message-ID: <0fd5ca0d-ff73-e2e0-1f6e-b57812f9c25b@benettiengineering.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Lukasz and all, On 12/10/19 12:48 AM, Lukasz Majewski wrote: > On Mon, 9 Dec 2019 16:20:10 +0100 > Giulio Benetti wrote: > >> Hi Lukasz, >> >> On 12/8/19 3:52 PM, Lukasz Majewski wrote: >>> On Wed, 4 Dec 2019 18:44:33 +0100 >>> Giulio Benetti wrote: >>> >>>> This driver assumes that lpuart clock is already enabled before >>>> probing but using DM only lpuart won't be automatically enabled so >>>> add clk_enable() when probing if CONFIG_CLK is defined. >>>> >>>> Signed-off-by: Giulio Benetti >>>> --- >>>> drivers/serial/serial_lpuart.c | 13 +++++++++++++ >>>> 1 file changed, 13 insertions(+) >>>> >>>> diff --git a/drivers/serial/serial_lpuart.c >>>> b/drivers/serial/serial_lpuart.c index 4b0a964d1b..52bd2baf7d >>>> 100644 --- a/drivers/serial/serial_lpuart.c >>>> +++ b/drivers/serial/serial_lpuart.c >>>> @@ -483,6 +483,19 @@ static int lpuart_serial_pending(struct >>>> udevice *dev, bool input) >>>> static int lpuart_serial_probe(struct udevice *dev) >>>> { >>>> +#if CONFIG_IS_ENABLED(CLK) >>>> + struct clk per_clk; >>>> + int ret; >>>> + >>>> + ret = clk_get_by_name(dev, "per", &per_clk); While adding support for OF_PLATDATA, I've realized that when using OF_PLATDATA I can only use clk_get_by_index_platdata() but often imx peripheral drivers(as done in Linux) get clock by name("per" clock) instead of other clock sources. So here the problem is that I can't know for sure which id "per" clock source will have. I wouldn't use 0 as default clock-id since it's not sure "per" will be the 0 index. And this will occur for fsl_esdhc_imx.c driver too. Do you have any suggestions? Thanks in advance Best regards -- Giulio Benetti Benetti Engineering sas