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 X-Spam-Level: X-Spam-Status: No, score=-12.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D10CC4338F for ; Tue, 3 Aug 2021 07:37:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3DDC260725 for ; Tue, 3 Aug 2021 07:37:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234209AbhHCHiC (ORCPT ); Tue, 3 Aug 2021 03:38:02 -0400 Received: from smtp-relay-canonical-0.canonical.com ([185.125.188.120]:54048 "EHLO smtp-relay-canonical-0.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234082AbhHCHiC (ORCPT ); Tue, 3 Aug 2021 03:38:02 -0400 Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (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-canonical-0.canonical.com (Postfix) with ESMTPS id 24FB93F346 for ; Tue, 3 Aug 2021 07:37:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1627976271; bh=HMiKxFSYa20UfSETkthFhrIjVbst/OK+au8qKZgzUks=; h=To:Cc:References:From:Subject:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=tZPpox8+0BquNgSZ6ecGhH7CeD6Gfbvs8fSbHlXERoCPYAgrhBx0xV+eqLRUCk7dd 4s0XBWSKA3EWT4F6raOkB/wPlEJCAIVKHN9iJeN4YluKq5kil8flQDBO4IUOUQeApJ dKtNloUtPxbD7QsOyvmdXXY3ZnGGRa0uhKLdiws/JRty/qpemQqor8EMDDhp78xFNC SDsVuB0FCthYlZS6/+NEIFInmL/GlRaZu7xpGzkIw0569HElsijNyAThfKZEZC0y1V SVMP1i0bkrAhPMAa0O+AY+r4rOsbYaTl2yaoEnYocmFw85Txf7sNnm27gJ8IgGlwSW nWrvRf1uMKOHQ== Received: by mail-ed1-f69.google.com with SMTP id o90-20020a5093e30000b02903bb95130460so10043482eda.0 for ; Tue, 03 Aug 2021 00:37:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:references:from:subject:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=HMiKxFSYa20UfSETkthFhrIjVbst/OK+au8qKZgzUks=; b=un81zaA6SDNcrKDqrOqQhge17ujNC+7sqOlgcHWW3lsRfN+ioQs6qisFFW4npvTzf4 LZYn1Rb0eQpfOuXvIc1bWa8WVinCmecULEtv3o79UgrfQqCSO5pDCm0ucn5ALx/pTyuk KXhVeGKsG5s6c7dud60h+Rpm0XGMM4EdY4ZhM/IoenQdsrOxcqyEbHKitR6DFp2YfwQR JLCbmOmfUdOpK7R9HIbKo1JD3dehu0owqicjj5ZRCRmVhaynP/j+bmJn1R3NJgcD6a0R sMbn3+zdS4eWsJmyEz8kZou8p42aNyFPUug5scHwzhHRR9tSaZaowltAiOPp2JUnPyST jlqg== X-Gm-Message-State: AOAM5324LTYeTb8xb4sa1NLGGIRRkgndHVfhkQZyapePA+HEdweEGs/L eZMRMCPekMShhECVqbapwOaP8G/aaJn00eNnb5pzF4cbcs9+y9QLbcA0oGs+RlmXfFN0TewEE99 bIG2YXu277fgHWFGUYOkI8pbh6lR0ahIXDglvA1E= X-Received: by 2002:a17:906:350c:: with SMTP id r12mr19518851eja.44.1627976270909; Tue, 03 Aug 2021 00:37:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzyFBe5dbNxwlXlBXERsGZZkwqR37lHAwmEzaRMwA5uBHV4D/DUtM//HZhRsSt8v4oHJ3em0g== X-Received: by 2002:a17:906:350c:: with SMTP id r12mr19518821eja.44.1627976270751; Tue, 03 Aug 2021 00:37:50 -0700 (PDT) Received: from [192.168.8.102] ([86.32.43.172]) by smtp.gmail.com with ESMTPSA id fi23sm4651493ejc.83.2021.08.03.00.37.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 03 Aug 2021 00:37:49 -0700 (PDT) To: Sam Protsenko Cc: Sylwester Nawrocki , Chanwoo Choi , Linus Walleij , Tomasz Figa , Rob Herring , Stephen Boyd , Michael Turquette , Jiri Slaby , Greg Kroah-Hartman , Charles Keepax , Ryu Euiyoul , Tom Gall , Sumit Semwal , John Stultz , Amit Pundir , devicetree , linux-arm Mailing List , linux-clk , "open list:GPIO SUBSYSTEM" , Linux Kernel Mailing List , Linux Samsung SOC , "open list:SERIAL DRIVERS" References: <20210730144922.29111-1-semen.protsenko@linaro.org> <20210730144922.29111-5-semen.protsenko@linaro.org> From: Krzysztof Kozlowski Subject: Re: [PATCH 04/12] tty: serial: samsung: Init USI to keep clocks running Message-ID: <7364ccb2-70da-6400-ae6d-6a30171b6678@canonical.com> Date: Tue, 3 Aug 2021 09:37:47 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org On 03/08/2021 01:06, Sam Protsenko wrote: (...) >>> diff --git a/include/linux/serial_s3c.h b/include/linux/serial_s3c.h >>> index f6c3323fc4c5..013c2646863e 100644 >>> --- a/include/linux/serial_s3c.h >>> +++ b/include/linux/serial_s3c.h >>> @@ -28,6 +28,15 @@ >>> #define S3C2410_UFSTAT (0x18) >>> #define S3C2410_UMSTAT (0x1C) >>> >>> +/* USI Control Register offset */ >>> +#define USI_CON (0xC4) >>> +/* USI Option Register offset */ >>> +#define USI_OPTION (0xC8) >>> +/* USI_CON[0] = 0b0: clear USI global software reset (Active High) */ >>> +#define USI_RESET (0<<0) >> >> Just 0x0. I understand you wanted to hint it is a bit field, but the >> shift of 0 actually creates more questions. >> > > After some consideration I decided to adhere to existing style and do > something like this (in v2): > > 8<--------------------------------------------------------------------->8 > #define USI_CON (0xC4) > #define USI_OPTION (0xC8) > > #define USI_CON_RESET_CLEAR (0<<0) > #define USI_CON_RESET_SET (1<<0) > #define USI_CON_RESET_MASK (1<<0) > > #define USI_OPTION_HWACG_CLKREQ_ON (1<<1) > #define USI_OPTION_HWACG_CLKSTOP_ON (1<<2) > #define USI_OPTION_HWACG_MASK (3<<1) > 8<--------------------------------------------------------------------->8 > > The whole reason for those comments was missing public TRM. But in the > end I decided it just looks ugly. Also, this way I can do RMW > operation (discussed above) in more logical way. > > Please let me know if code snippets above look good to you. Please skip the USI_CON_RESET_CLEAR. There is no such pattern in the code. Clearing bit is an obvious operation and such code is already everywhere: val &= ~USI_CON_RESET (or &= ~USI_RESET_MASK) Therefore for USI_CON_RESET only: #define USI_CON_RESET (1<<0) #define USI_CON_RESET_MASK (1<<0) Best regards, Krzysztof 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 X-Spam-Level: X-Spam-Status: No, score=-11.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F537C4338F for ; Tue, 3 Aug 2021 07:39:56 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3D44860EB9 for ; Tue, 3 Aug 2021 07:39:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3D44860EB9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=canonical.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:Subject:From:References:Cc:To:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=9zUI+VvX1S01xbg8ojH/4qIMrCLw+pwMZtmoRUfWHvg=; b=T7B8CuQ12Z9QyPUcVpbiZyIKOM ILZrGp10Mz1OSuMsqSBJsqOQj1eKOPXIiPByyEK8Q0IZK34n4Uri6xqhIeBlqwkPppDfouv8UbAob wzlyGJuKAHrdRxslm1nR92VNG4R8QVOog4DRlyvOxMUPlqjDLfXqF831Y+R+pQSZLL0VU7juOM4uj 3ZBwIWOJKU86TFwwvZw1cZirxtG47AHKGORWnBgioVk5WVX5+0fWAEByyEtINwtOMXWU9l6gKE2ZQ yg47zUsSXPqTX5nUoSYLbIpoK9s3kGkA0wR18iXqOi5vrte70BtLACryxrcs5tv5BB4qs7NfZyled T9I8JfgQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mAp09-001QPC-Jo; Tue, 03 Aug 2021 07:38:13 +0000 Received: from smtp-relay-canonical-0.canonical.com ([185.125.188.120]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mAp05-001QOp-SO for linux-arm-kernel@lists.infradead.org; Tue, 03 Aug 2021 07:38:11 +0000 Received: from mail-lj1-f200.google.com (mail-lj1-f200.google.com [209.85.208.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-canonical-0.canonical.com (Postfix) with ESMTPS id 21CA93F09E for ; Tue, 3 Aug 2021 07:38:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1627976282; bh=HMiKxFSYa20UfSETkthFhrIjVbst/OK+au8qKZgzUks=; h=To:Cc:References:From:Subject:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=Ej9HUkeqk/vK6o9+n7edHlFETjphRjqQGxC8APW2FqkoUvY2krfUYoNdDf7+S39Zr qSdCMks49jvaSr+ooOYMwUmY3jKx71PY3M4ipRUoQzLE6Wx2SlWWCXlgDV33pT+ypA ggat7Nca42x7EnqYUpkBatygfOGmxGMMGHaEcwCFehrL8mtmUC43zxetE/AHe8laMg nyuoxpdwLePetCseFYgUSoG+Is/vMaetNSaDol80BlXgPNTjLlgVS+zrsOtCSSnPqp HqSZQgRcZKwUjM2k1sF/mvkLwZXqwEUzhwbJObeA6eR75WHJ2Og2E77tIejAAYyAcV n1iNzGeibUjPg== Received: by mail-lj1-f200.google.com with SMTP id b12-20020a2e858c0000b02901990f5ca735so3838392lji.22 for ; Tue, 03 Aug 2021 00:38:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:references:from:subject:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=HMiKxFSYa20UfSETkthFhrIjVbst/OK+au8qKZgzUks=; b=m9Hko7hDONzIV+JF51Z/7SKYd0zNlXsV3hb/LkundWlqjoyRFwjwsLvYikDF2oRnZp Y1um+dusNb+IasM5JWd3r1BANgn9aUuv0xSudFCby08ZO+N6M//mJ1W0l+MInUHw1gif 94A+Rn21s47q8K99YLRBpBgXQPnHTPVPxIbSvQkYx/VFzWc7crirPjQtiMxEEFTMqR+1 oQOqqjs+0hmzIi7dHhoblNzSU+jeEzg3LWkwfIKNJBr6GmMDkrwcaiLAyHru1Fdb0iKI HFYOm0YLrwwxAD+xi+XT5uoTaFryyphtp8Z1ENpXIGJYuUt0xJd+kYxFefL8004Qec8Z rs/g== X-Gm-Message-State: AOAM533KVAG81kXnyGJ+2PlCGGddoGVOwGjX72i6Cb4mnBkefkKkMGMB AbVZ5qxyZJINTiMkvuqwvJUDPSlyl88xHSYSU3uASnIPGMPASvGyPapPrdj6/cP3nTdRAxR/6ru Ch/WJDkZ8Dwlt/XM+zg8kAwMMuhCZvyYquPVNn6aufd3L0HsHprZ1 X-Received: by 2002:a17:906:350c:: with SMTP id r12mr19518864eja.44.1627976271046; Tue, 03 Aug 2021 00:37:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzyFBe5dbNxwlXlBXERsGZZkwqR37lHAwmEzaRMwA5uBHV4D/DUtM//HZhRsSt8v4oHJ3em0g== X-Received: by 2002:a17:906:350c:: with SMTP id r12mr19518821eja.44.1627976270751; Tue, 03 Aug 2021 00:37:50 -0700 (PDT) Received: from [192.168.8.102] ([86.32.43.172]) by smtp.gmail.com with ESMTPSA id fi23sm4651493ejc.83.2021.08.03.00.37.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 03 Aug 2021 00:37:49 -0700 (PDT) To: Sam Protsenko Cc: Sylwester Nawrocki , Chanwoo Choi , Linus Walleij , Tomasz Figa , Rob Herring , Stephen Boyd , Michael Turquette , Jiri Slaby , Greg Kroah-Hartman , Charles Keepax , Ryu Euiyoul , Tom Gall , Sumit Semwal , John Stultz , Amit Pundir , devicetree , linux-arm Mailing List , linux-clk , "open list:GPIO SUBSYSTEM" , Linux Kernel Mailing List , Linux Samsung SOC , "open list:SERIAL DRIVERS" References: <20210730144922.29111-1-semen.protsenko@linaro.org> <20210730144922.29111-5-semen.protsenko@linaro.org> From: Krzysztof Kozlowski Subject: Re: [PATCH 04/12] tty: serial: samsung: Init USI to keep clocks running Message-ID: <7364ccb2-70da-6400-ae6d-6a30171b6678@canonical.com> Date: Tue, 3 Aug 2021 09:37:47 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210803_003810_095945_830A2F88 X-CRM114-Status: GOOD ( 20.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 03/08/2021 01:06, Sam Protsenko wrote: (...) >>> diff --git a/include/linux/serial_s3c.h b/include/linux/serial_s3c.h >>> index f6c3323fc4c5..013c2646863e 100644 >>> --- a/include/linux/serial_s3c.h >>> +++ b/include/linux/serial_s3c.h >>> @@ -28,6 +28,15 @@ >>> #define S3C2410_UFSTAT (0x18) >>> #define S3C2410_UMSTAT (0x1C) >>> >>> +/* USI Control Register offset */ >>> +#define USI_CON (0xC4) >>> +/* USI Option Register offset */ >>> +#define USI_OPTION (0xC8) >>> +/* USI_CON[0] = 0b0: clear USI global software reset (Active High) */ >>> +#define USI_RESET (0<<0) >> >> Just 0x0. I understand you wanted to hint it is a bit field, but the >> shift of 0 actually creates more questions. >> > > After some consideration I decided to adhere to existing style and do > something like this (in v2): > > 8<--------------------------------------------------------------------->8 > #define USI_CON (0xC4) > #define USI_OPTION (0xC8) > > #define USI_CON_RESET_CLEAR (0<<0) > #define USI_CON_RESET_SET (1<<0) > #define USI_CON_RESET_MASK (1<<0) > > #define USI_OPTION_HWACG_CLKREQ_ON (1<<1) > #define USI_OPTION_HWACG_CLKSTOP_ON (1<<2) > #define USI_OPTION_HWACG_MASK (3<<1) > 8<--------------------------------------------------------------------->8 > > The whole reason for those comments was missing public TRM. But in the > end I decided it just looks ugly. Also, this way I can do RMW > operation (discussed above) in more logical way. > > Please let me know if code snippets above look good to you. Please skip the USI_CON_RESET_CLEAR. There is no such pattern in the code. Clearing bit is an obvious operation and such code is already everywhere: val &= ~USI_CON_RESET (or &= ~USI_RESET_MASK) Therefore for USI_CON_RESET only: #define USI_CON_RESET (1<<0) #define USI_CON_RESET_MASK (1<<0) Best regards, Krzysztof _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel