Message ID | 888d57a2d5e62affb8e29e0098402e428facd969.1695189879.git.wangchen20@iscas.ac.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp3923140vqi; Tue, 19 Sep 2023 23:47:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFnCl87y1RdTboVwN6APL1e5u6VK7pvh4+pOojaKgOG7r1/X1MQ4Ci4fLKA1WOPUgF6OSdf X-Received: by 2002:a17:90a:ea0b:b0:274:98c4:b6e8 with SMTP id w11-20020a17090aea0b00b0027498c4b6e8mr1799452pjy.5.1695192427755; Tue, 19 Sep 2023 23:47:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695192427; cv=none; d=google.com; s=arc-20160816; b=ROrLiUfC59mgkkLwSJRMpgN19p2Ema4vGA31IuyA9YeZC1U62k9RqyRwGCCnRZ0SiU Q8dI9G6gh7yWYJFTDgBpSahou5Hn4AI32uXNuSEuSBT8KIowPOiNYllIh1skDdNsVKud 7rxi/1IHov2H87U6bCu4zQSNKbdxDjpOA0NN2ejrwIpStSVQAxvs5E4foDT/gt6Zzdbf eJF/0kGYXnxsoVDTP+m6CUdZHBkWGXp2naSvwryY8JK1naopmzMK+PRpYadpmt7kwYzC PYkZfu9bhjtU0qHda0gcSHWok7ZfCCxi9puMTPN/up9iSmitXPEWivmgti1p4D97Upx/ 0qBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=HvjyR1db7d2pAH1Oe6CLGqKy2lWY6VTA87peNvZDQh4=; fh=bQJKLQMHSx8zRMKVWETn2inbFK2Baz+k7BY3gTlhRws=; b=fsXK17bokWqgbuWaPA1Q+okazVXhPldy+Wrd/Hb7abbbPUWEG3iqmZwc2bLzIv+PhR ptCxzmZIFhBXWU7Yt0RLRK8/fq6kp/rDgxzMhe2Dvjetzk25yhQIoFv+tlTFGWi+s50/ aKgJaa21lCjmggofkBDU8FqFw+QiWMtkpwvqOf0WwBK75wUqtZtWy1sZElWRlBzosFFs FzThnLVt3D/wEJA0GNKb+bm7gzt2qDsd/zVZMG+9txlzDEbRZmlQcro0fdQY8eqwEuFl wJT1yKV4uu9hY7qWPJdP3/V4OEqOGn3+J5zk7ky5USNdDG+/aR1/aPCdYhsVrUtJdoc5 I0GA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=bKTSTe3D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id bj23-20020a17090b089700b0025bf45ac365si904224pjb.82.2023.09.19.23.47.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 23:47:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=bKTSTe3D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 4AF3D8051170; Tue, 19 Sep 2023 23:40:54 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233349AbjITGkc (ORCPT <rfc822;toshivichauhan@gmail.com> + 26 others); Wed, 20 Sep 2023 02:40:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233350AbjITGk3 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 20 Sep 2023 02:40:29 -0400 Received: from mail-ot1-x32e.google.com (mail-ot1-x32e.google.com [IPv6:2607:f8b0:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49F0DC6; Tue, 19 Sep 2023 23:40:23 -0700 (PDT) Received: by mail-ot1-x32e.google.com with SMTP id 46e09a7af769-6bee392fe9dso4081302a34.1; Tue, 19 Sep 2023 23:40:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695192022; x=1695796822; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HvjyR1db7d2pAH1Oe6CLGqKy2lWY6VTA87peNvZDQh4=; b=bKTSTe3DNPtEnSrDeJP1uNJMb1pGo081102nKwOy+DQ7/DPNoEMtE8F0pY1iii4kXF QaZ2ipnv0Wjgi/j+4jHpmojHCMSw4jt2RBVbpK+LBJPesboo+SYbtxFK2T2sZsjO8DJx kwz+UTRZ0gdJHLBc3N6ZzjMJXfv2mr5h54wj4jbmNwL2L4JwlgTXXWyL+aBkTkC3RXkD RaaN3VZtNM3jrnOn/jKhRnw+pVehLir2Vv8JzcZqfKIkt8fL99lyas6cFgbqFtIZVR88 jdAaqgvUqr9xac+grx4Th9grmDNYYCI5auZnNgOv8ArywbHQAaCBG9Ecq9fa9AyvZVib MYQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695192022; x=1695796822; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HvjyR1db7d2pAH1Oe6CLGqKy2lWY6VTA87peNvZDQh4=; b=b80oXV6/Jox4Ds4ku2YNsw8XUSCcuoniAwGcW053NN5UnTyuCRkB2KxDrHq03SlNMu VC151rYc+Ob/YdM+k6mOasZhrwFI13QG2yZk0rGdkBflj3L+kyjR1grqgbIp370S+NgC HbkVb5i6bITJMClvKvKWBj8h83pJlyBWDmkNZuGI0hkFGhIeD20zktbxwkEkejjN9z6V OcZztsKLoadSUn88bWpDouDVZOBmNUDbUqI1fEemLrsrtAM4xBnWA2qsnH1106AEsctn 8a4dbOvrn0MHSjRsET1V7YC3zoEnJfAh6g4VHvjSPAjkdlOY/j1c4xViB9EjRZYoS8vV InJg== X-Gm-Message-State: AOJu0YxAn9NMbA32MjBRFlzx9LVzQfKeROFDpOnxhfvqKHD+s4j0TkGN cV+aZcdn97WhCtyanOIFklW1+VRAmzyLa6G9 X-Received: by 2002:a05:6830:4a6:b0:6b9:a926:4a12 with SMTP id l6-20020a05683004a600b006b9a9264a12mr1762757otd.28.1695192022495; Tue, 19 Sep 2023 23:40:22 -0700 (PDT) Received: from localhost.localdomain ([122.8.183.87]) by smtp.gmail.com with ESMTPSA id r10-20020a05683001ca00b006b8c6eb962esm5769619ota.52.2023.09.19.23.40.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 23:40:22 -0700 (PDT) From: Chen Wang <unicornxw@gmail.com> X-Google-Original-From: Chen Wang <wangchen20@iscas.ac.cn> To: aou@eecs.berkeley.edu, chao.wei@sophgo.com, conor@kernel.org, devicetree@vger.kernel.org, emil.renner.berthing@canonical.com, guoren@kernel.org, jszhang@kernel.org, krzysztof.kozlowski+dt@linaro.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, palmer@dabbelt.com, paul.walmsley@sifive.com, robh+dt@kernel.org, xiaoguang.xing@sophgo.com Cc: Chen Wang <wangchen20@iscas.ac.cn> Subject: [PATCH v2 08/11] serial: 8250_dw: Add Sophgo SG2042 support Date: Wed, 20 Sep 2023 14:40:15 +0800 Message-Id: <888d57a2d5e62affb8e29e0098402e428facd969.1695189879.git.wangchen20@iscas.ac.cn> X-Mailer: git-send-email 2.34.1 In-Reply-To: <cover.1695189879.git.wangchen20@iscas.ac.cn> References: <cover.1695189879.git.wangchen20@iscas.ac.cn> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 19 Sep 2023 23:40:54 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777538095008990058 X-GMAIL-MSGID: 1777538095008990058 |
Series |
Add Milk-V Pioneer RISC-V board support
|
|
Commit Message
Chen Wang
Sept. 20, 2023, 6:40 a.m. UTC
From: Emil Renner Berthing <emil.renner.berthing@canonical.com> 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 <emil.renner.berthing@canonical.com> Signed-off-by: Chen Wang <wangchen20@iscas.ac.cn> --- drivers/tty/serial/8250/8250_dw.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
Comments
On Wed, Sep 20, 2023 at 2:40 PM Chen Wang <unicornxw@gmail.com> wrote: > > From: Emil Renner Berthing <emil.renner.berthing@canonical.com> > > 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 <emil.renner.berthing@canonical.com> > Signed-off-by: Chen Wang <wangchen20@iscas.ac.cn> > --- > 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 = { > .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 }, Why shall we touch the jh7100 stuff in this patch? > { /* Sentinel */ } > }; > MODULE_DEVICE_TABLE(of, dw8250_of_match); > -- > 2.25.1 >
Ren, thanks for your review. sg2042 and jh7100 use the same uart driver and we here just want to reuse the logic from jh7100. We don't touch jh7100 stuff, we just rename "dw8250_starfive_jh7100_data" to "dw8250_skip_set_rate_data" and make it a common data for both sg2042 and jh7100. 在 2023/9/20 15:53, Guo Ren 写道: > On Wed, Sep 20, 2023 at 2:40 PM Chen Wang <unicornxw@gmail.com> wrote: >> From: Emil Renner Berthing <emil.renner.berthing@canonical.com> >> >> 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 <emil.renner.berthing@canonical.com> >> Signed-off-by: Chen Wang <wangchen20@iscas.ac.cn> >> --- >> 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 = { >> .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 }, > Why shall we touch the jh7100 stuff in this patch? > >> { /* Sentinel */ } >> }; >> MODULE_DEVICE_TABLE(of, dw8250_of_match); >> -- >> 2.25.1 >> >
On Wed, Sep 20, 2023 at 4:06 PM Chen Wang <unicorn_wang@outlook.com> wrote: > > Ren, thanks for your review. > > sg2042 and jh7100 use the same uart driver and we here just want to reuse the logic from jh7100. > We don't touch jh7100 stuff, we just rename "dw8250_starfive_jh7100_data" to "dw8250_skip_set_rate_data" and make it a common data for both sg2042 and jh7100. Okay, I got it now. LGTM Reviewed-by: Guo Ren <guoren@kernel.org> > > 在 2023/9/20 15:53, Guo Ren 写道: > > On Wed, Sep 20, 2023 at 2:40 PM Chen Wang <unicornxw@gmail.com> wrote: > >> From: Emil Renner Berthing <emil.renner.berthing@canonical.com> > >> > >> 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 <emil.renner.berthing@canonical.com> > >> Signed-off-by: Chen Wang <wangchen20@iscas.ac.cn> > >> --- > >> 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 = { > >> .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 }, > > Why shall we touch the jh7100 stuff in this patch? > > > >> { /* Sentinel */ } > >> }; > >> MODULE_DEVICE_TABLE(of, dw8250_of_match); > >> -- > >> 2.25.1 > >> > >
Ben Dooks wrote: > On 20/09/2023 07:40, Chen Wang wrote: > > From: Emil Renner Berthing <emil.renner.berthing@canonical.com> > > > > Add quirk to skip setting the input clock rate for the uarts on the > > Sophgo SG2042 SoC similar to the StarFive JH7100. > > I'd love an actual explanation of why this is necessary here. Makes sense. For the JH7100 the commit message is: On the StarFive JH7100 RISC-V SoC the UART core clocks can't be set to exactly 16 * 115200Hz and many other common bitrates. Trying this will only result in a higher input clock, but low enough that the UART's internal divisor can't come close enough to the baud rate target. So rather than try to set the input clock it's better to skip the clk_set_rate call and rely solely on the UART's internal divisor. @Chen Wang is this also true for the SG2042? /Emil
Emil Renner Berthing <emil.renner.berthing@canonical.com> 于2023年9月22日周五 18:40写道: > > Ben Dooks wrote: > > On 20/09/2023 07:40, Chen Wang wrote: > > > From: Emil Renner Berthing <emil.renner.berthing@canonical.com> > > > > > > Add quirk to skip setting the input clock rate for the uarts on the > > > Sophgo SG2042 SoC similar to the StarFive JH7100. > > > > I'd love an actual explanation of why this is necessary here. > > Makes sense. For the JH7100 the commit message is: > > On the StarFive JH7100 RISC-V SoC the UART core clocks can't be set to > exactly 16 * 115200Hz and many other common bitrates. Trying this will > only result in a higher input clock, but low enough that the UART's > internal divisor can't come close enough to the baud rate target. > So rather than try to set the input clock it's better to skip the > clk_set_rate call and rely solely on the UART's internal divisor. > > @Chen Wang is this also true for the SG2042? > > /Emil Emil & Ben, After double-checking with Sophgo engineers and doing more investigation, we think the original changes(quirk to skip setting the input clock) on UART may not be required. Due to currently, the target of this patchset is just to enable a minimal system and no clock relateding changes are included yet. I will first remove this quirk change on UART and use the fixed frequence - 500M - and reply solely on the UART's internal divisor to work. We will re-evaluate this quirk change in next patchset when we involve clock related stuff. Looping Haijiao, engineer from Sophgo, who is working on clock on sg2042. Regards, Chen
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 = { .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 }, { /* Sentinel */ } }; MODULE_DEVICE_TABLE(of, dw8250_of_match);