From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3106C433FE for ; Thu, 14 Oct 2021 19:57:10 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 335FB60F9E for ; Thu, 14 Oct 2021 19:57:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 335FB60F9E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xs4all.nl Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A835183661; Thu, 14 Oct 2021 21:57:07 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xs4all.nl Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 3054283661; Thu, 14 Oct 2021 21:57:06 +0200 (CEST) Received: from sibelius.xs4all.nl (sibelius.xs4all.nl [83.163.83.176]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id BE90F8362C for ; Thu, 14 Oct 2021 21:57:02 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xs4all.nl Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=mark.kettenis@xs4all.nl Received: from localhost (bloch.sibelius.xs4all.nl [local]) by bloch.sibelius.xs4all.nl (OpenSMTPD) with ESMTPA id 25beb0b5; Thu, 14 Oct 2021 21:57:01 +0200 (CEST) Date: Thu, 14 Oct 2021 21:57:01 +0200 (CEST) From: Mark Kettenis To: Simon Glass Cc: kettenis@openbsd.org, u-boot@lists.denx.de, In-Reply-To: (message from Simon Glass on Mon, 11 Oct 2021 11:00:39 -0600) Subject: Re: [PATCH v2 4/7] serial: s5p: Add Apple M1 support References: <20211003183050.67925-1-kettenis@openbsd.org> <20211003183050.67925-5-kettenis@openbsd.org> Message-ID: X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean > From: Simon Glass > Date: Mon, 11 Oct 2021 11:00:39 -0600 > > Hi Mark, > > On Sun, 3 Oct 2021 at 12:33, Mark Kettenis wrote: > > > > Apple M1 SoCs include an S5L UART which is a variant of the S5P > > UART. Add support for this variant and enable it by default > > on Apple SoCs. > > > > Signed-off-by: Mark Kettenis > > --- > > arch/arm/Kconfig | 1 + > > arch/arm/include/asm/arch-m1/uart.h | 41 +++++++++++ > > configs/apple_m1_defconfig | 4 ++ > > drivers/serial/Kconfig | 4 +- > > drivers/serial/serial_s5p.c | 104 ++++++++++++++++++++++------ > > 5 files changed, 130 insertions(+), 24 deletions(-) > > create mode 100644 arch/arm/include/asm/arch-m1/uart.h > > > > Reviewed-by: Simon Glass > [..] > > > diff --git a/drivers/serial/serial_s5p.c b/drivers/serial/serial_s5p.c > > index 6d09952a5d..53a7b0bd1b 100644 > > --- a/drivers/serial/serial_s5p.c > > +++ b/drivers/serial/serial_s5p.c > [..] > > @@ -93,7 +116,7 @@ int s5p_serial_setbrg(struct udevice *dev, int baudrate) > > struct s5p_uart *const uart = plat->reg; > > u32 uclk; > > > > -#ifdef CONFIG_CLK_EXYNOS > > +#if CONFIG_IS_ENABLED(CLK_EXYNOS) || CONFIG_IS_ENABLED(ARCH_APPLE) > > I really don't like making this any worse. > > Does this work? > > ret = clk_get_by_index(...) > if (ret && ret != -ENOSYS) > return ret The problem really is that I'm trying to avoid having to define get_uart_clock() for the new platform. So I need an #if of some sorts to avoid that code. I really think the current diff is the cleanest I can come up. > > struct clk clk; > > u32 ret; > > > > @@ -105,7 +128,7 @@ int s5p_serial_setbrg(struct udevice *dev, int baudrate) > > uclk = get_uart_clk(plat->port_id); > > #endif > > > > - s5p_serial_baud(uart, uclk, baudrate); > > + s5p_serial_baud(uart, plat->reg_width, uclk, baudrate); > > > > return 0; > > } > [..] > > Regards, > Simon >