Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2802028rdb; Fri, 22 Sep 2023 08:44:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE7CdHnVm6ackPgjGkwONFUpzraUhr9n98ApoxuWze4yeS2CXh/ke1puwQhLXx0zuK20LS2 X-Received: by 2002:a17:90a:38a2:b0:274:99ed:a80c with SMTP id x31-20020a17090a38a200b0027499eda80cmr21580pjb.3.1695397483326; Fri, 22 Sep 2023 08:44:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695397483; cv=none; d=google.com; s=arc-20160816; b=Gj6r+j0VpgMLSnXb7xpeGeN9ZbMF6kqION9xfdXn61kmmzeuXr59KWFkn8G9/ABAuo 00SH5wwGnmtMy25t0jdVksNyRy2vt8fucyA/i7RL2jRYrLHwlzN3DG8cBdIRKjnkxqbG 5LTs03JkQubOk2MBvseeL1OEXxBTkIlRhsC3q8C+dlVSGdh098ZBlxa8C63S3ICj4kjx e4vQxa7mDueC3n/MGVqr4uuBY7oRpDXmFWCpQuBSrCPvMG4JRRdXcFXuTAEYiZAtPKjk zzTKn5BqGc5PcQx7rCWxUC3pMhbEeM+KwuhQikadtINNUxdfarkWpNIzRWO1A3fACQvd W75w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:mime-version :references:in-reply-to:from:dkim-signature; bh=1mIxhTKnFz6jPIBGB85iZJtGzL+3q9xOGEF8ZcDvszY=; fh=T50QkcGu1FtT9KQJYT82ykDXfQdx1Z2a49CTeCWAqDM=; b=L65KbWyLdFNQm3uvRbi7wPthfix7rVeQLJQ/09wkLSuADX2Z/qtFHWGDN7PYNsIlJm KPQh8R1xnRNuGN1vBTM2/7AcGJNZGqiWDqk5jUhQSz28CxPBsQkqFrTmnDt0kUJGEk2+ wQObqNJpb6sHvDWB6a3lSpaewD7nRVgxCbEQ9qd2ZA4+d5Z0A+HM0duAVO5WhpMejrBr MtAJ7onzPC+0TLtdsKyy/feiimrR4g9S4ZnnMlCJ2ZnKBWBapWovdi3f17YAyrtSJokL uQp1e9H6HiIN4WtyDxCvqC2jU8EVGM5Ofc7579xMUk3CgvXWDV+Whw3FOm4FEHPcswww AvMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=sncnI5hh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id kk6-20020a17090b4a0600b0027406695b10si4677859pjb.159.2023.09.22.08.44.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 08:44:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=sncnI5hh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id E4F6283CD97D; Fri, 22 Sep 2023 04:19:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233621AbjIVLTw (ORCPT + 99 others); Fri, 22 Sep 2023 07:19:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233717AbjIVLTq (ORCPT ); Fri, 22 Sep 2023 07:19:46 -0400 Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CC25CD9 for ; Fri, 22 Sep 2023 04:19:38 -0700 (PDT) Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 9A4BF41DB4 for ; Fri, 22 Sep 2023 11:19:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1695381576; bh=1mIxhTKnFz6jPIBGB85iZJtGzL+3q9xOGEF8ZcDvszY=; h=From:In-Reply-To:References:Mime-Version:Date:Message-ID:Subject: To:Cc:Content-Type; b=sncnI5hhujRbZJa87Wy2M5hnTaqSGgxdN2aMdCOX6Kxql0lojJxt/7OYHLDhITXoC WwyPMTzQJZVdXHl+6ykml6ze/wZvhtddLvnDi5Bdi7Z9eCzPHv6fs8dEqj6f2GGojK eJr1CUFD/hZ0U9YY5i/5N2tWnf7fScSO9R8N2q+e6uB7cQ8gHl8JHdPiNfkbu9Q+VV Ypf9suBpN9R8+60qokxRygZpI7mi5nesCwKtAUHNkm8QfH247uUtGzsodY1NtBhm9K GP3gVZS2fXv34eJDc32GrwH5COyoZVb8YMZPlDMdjV9vUqlLF0tJ8vfOGkYJVnEl8O T68FqWXTUrpYQ== Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-414bbfbdf37so20859591cf.1 for ; Fri, 22 Sep 2023 04:19:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695381575; x=1695986375; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=1mIxhTKnFz6jPIBGB85iZJtGzL+3q9xOGEF8ZcDvszY=; b=Sow7xo2N+6Kf2Xztjc27OA0tstl64ngNcW6Z9hTToP1/gxsUxPq6u+MOMZxaGdCLa+ TS/6LgCBwcJ31DHSAP1K4V7Khj3/YRwsmdxTGRoUOhi3sEzPBnFlnKcZ5Oa0ZEhwFOuR H8SPDhG6MxWTmMjCGPhNfShTBeea1JuQmMvWGY8lIs28x5PTbGglcPQBMtr/Yc+6bXC5 574EMF9XqUxPwmknsokLkNNHlk74JEWY+nPEMfWRyD/e4/kRj1XiKSaU2nV22Scay/Yu E/gNA5WZ/69OmER23UWoB0kaVfifcowpnZSnYTd6i+iXjC4eHNQBU73ksHROenO6uwkb 2x3A== X-Gm-Message-State: AOJu0YzOPqY2UbHi4l6ixdrIBSTsYlrsX+Vx/zrXmHdUMew+DpqO792J MzsG/3bS6Gf35/bVT8PsMfulEpDX4I0t1GHHEJGjJkTEZtUx7rHenDKpHUUEYEzN575aVCXprOg de+cadqUgpyoTvSPP0z1R5v4WU42rzDTaYmDAqwctuF1XukFL8l3oYm9V3w== X-Received: by 2002:a05:622a:1183:b0:417:98a1:3403 with SMTP id m3-20020a05622a118300b0041798a13403mr8762361qtk.25.1695381575614; Fri, 22 Sep 2023 04:19:35 -0700 (PDT) X-Received: by 2002:a05:622a:1183:b0:417:98a1:3403 with SMTP id m3-20020a05622a118300b0041798a13403mr8762342qtk.25.1695381575315; Fri, 22 Sep 2023 04:19:35 -0700 (PDT) Received: from 348282803490 named unknown by gmailapi.google.com with HTTPREST; Fri, 22 Sep 2023 04:19:34 -0700 From: Emil Renner Berthing In-Reply-To: <0bd1742c-fa39-4f63-a594-6d325dc6b062@codethink.co.uk> References: <20230915072558.118325-1-wangchen20@iscas.ac.cn> <803daa8f-f4bd-34b7-f826-89e1db5f24f6@linaro.org> <862905cc-48c3-2dc9-6032-6ee189a629e6@linaro.org> <0bd1742c-fa39-4f63-a594-6d325dc6b062@codethink.co.uk> Mime-Version: 1.0 Date: Fri, 22 Sep 2023 04:19:34 -0700 Message-ID: Subject: Re: [PATCH 10/12] serial: 8250_dw: Add Sophgo SG2042 support To: Ben Dooks , Emil Renner Berthing , Krzysztof Kozlowski , Wang Chen , linux-riscv@lists.infradead.org, conor@kernel.org, aou@eecs.berkeley.edu, krzysztof.kozlowski+dt@linaro.org, palmer@dabbelt.com, paul.walmsley@sifive.com, robh+dt@kernel.org Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, jszhang@kernel.org, guoren@kernel.org, chao.wei@sophgo.com, xiaoguang.xing@sophgo.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Fri, 22 Sep 2023 04:19:59 -0700 (PDT) Ben Dooks wrote: > On 15/09/2023 11:23, Emil Renner Berthing wrote: > > Krzysztof Kozlowski wrote: > >> On 15/09/2023 12:02, Emil Renner Berthing wrote: > >>> Krzysztof Kozlowski wrote: > >>>> On 15/09/2023 09:25, Wang Chen wrote: > >>>>> From: Emil Renner Berthing > >>>>> > >>>>> Add quirk to skip setting the input clock rate for the uarts on the > >>>>> Sophgo SG2042 SoC similar to the StarFive JH7100. > >>>>> > >>>>> Signed-off-by: Emil Renner Berthing > >>>> > >>>> Missing SoB. > >>>> > >>>>> --- > >>>>> drivers/tty/serial/8250/8250_dw.c | 5 +++-- > >>>>> 1 file changed, 3 insertions(+), 2 deletions(-) > >>>>> > >>>>> diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c > >>>>> index f4cafca1a7da..6c344877a07f 100644 > >>>>> --- a/drivers/tty/serial/8250/8250_dw.c > >>>>> +++ b/drivers/tty/serial/8250/8250_dw.c > >>>>> @@ -770,7 +770,7 @@ static const struct dw8250_platform_data dw8250_renesas_rzn1_data = { > >>>>> .quirks = DW_UART_QUIRK_IS_DMA_FC, > >>>>> }; > >>>>> > >>>>> -static const struct dw8250_platform_data dw8250_starfive_jh7100_data = { > >>>>> +static const struct dw8250_platform_data dw8250_skip_set_rate_data = { > >>>> > >>>> Why? What is wrong with old name? > >>>> > >>>>> .usr_reg = DW_UART_USR, > >>>>> .quirks = DW_UART_QUIRK_SKIP_SET_RATE, > >>>>> }; > >>>>> @@ -780,7 +780,8 @@ static const struct of_device_id dw8250_of_match[] = { > >>>>> { .compatible = "cavium,octeon-3860-uart", .data = &dw8250_octeon_3860_data }, > >>>>> { .compatible = "marvell,armada-38x-uart", .data = &dw8250_armada_38x_data }, > >>>>> { .compatible = "renesas,rzn1-uart", .data = &dw8250_renesas_rzn1_data }, > >>>>> - { .compatible = "starfive,jh7100-uart", .data = &dw8250_starfive_jh7100_data }, > >>>>> + { .compatible = "sophgo,sg2042-uart", .data = &dw8250_skip_set_rate_data }, > >>>>> + { .compatible = "starfive,jh7100-uart", .data = &dw8250_skip_set_rate_data }, > >>>> > >>>> So devices are fully compatible? Then use compatibility and drop this > >>>> patch entirely. > >>> > >>> I'm fine with this, but these are two different companies and SoCs that just > >>> happens to have both implemented the Designware UART with an inflexible input > >>> clock. So if fx. a real quirk is found on the JH7110 then we'd need to either > >>> change the compatible on an unrelated SoC or change compatible on the JH7110 to > >> > >> Wait, why? The compatible is still there, so you just add here proper > >> entry, if ever needed. > > > > Sorry, I messed up my example by writing JH7110 where I meant JH7100 > > > >>> something like "starfive,jh7100-uart-with-quirk" and "starfive,jh7100-uart" will > >>> forever be a quirky way to spell "dw8250 with inflexible input clock". > >>> Is that how device trees are supposed to work? > >> > >> I don't get this part. But anyway if the blocks are really designed or > >> done independently and there is no shared part, except the DWC block, > >> then indeed the compatibility might be just a coincidence... > >> > > > > It is. Sophgo and StarFive are not the same company. Sophgo are using RISC-V > > cores from T-Head and StarFive are using cores from SiFive. They just happen to > > both use the Designware UART in the same way. > > Out of interest, what's the issue with just providing an fixed clock in > the device tree for these machines? You mean adding a "fake" fixed clock to the device tree and specify that in the uart nodes? That would break the clock dependency, so then you'd need to add some other way to tell the clock framework not to shut down the real clock. /Emil