Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1582362pxb; Mon, 8 Mar 2021 00:48:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJx0eYSX2EXghUihMqVI7wj5UCZGYqwpuBv3ENDr1GLNl2zb+U8hT0Ex1UajIkwemJwlPrl5 X-Received: by 2002:a50:f38f:: with SMTP id g15mr20791464edm.262.1615193308502; Mon, 08 Mar 2021 00:48:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615193308; cv=none; d=google.com; s=arc-20160816; b=NzEwH3+ZHW+VatAOshae3bmaGc29tPxzbJkcmU3IJhFhGdPGg1yGfGkcAgskFqiHiu GEywux8gHEoKmL+ybpwc1ROhUKoV5SAgTM9+V4kqJA1pZwnZLpMX1lmkzmTtuXuGjhjW Stszy3oCRilfw7mQCZRyN91+kzirYjylyoyAsLRHBZkpnEfyzHsyGCZUqa3m87kbrSzh 0BT1FH8ytTi2hMyHcMGMjaSp2BG5eQXRad0enb/lzO8Pqss721C7YAh29onIFSsJ00rq QAqszkwQFPPuboOTfG7EN/uYZZwwDoag9h/bSbmmh/dN8KrybN3xIQYAMTtcAdOU54Jo mqdA== 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:from:in-reply-to :references:mime-version; bh=idle5xLu52lK6hHesv6Zvw3rifnSNDluxt4tlFsGgyI=; b=wPIT6/3Gscf6ChHeJACpjQTSsFBl54H/M4pYrXWEahi1UuZ0ygelSiosPIz/uLkKgA 9e/cRm0FbYbc77s9t8ASSiCNEgfgyRoGQN9/fkLzdLDgcWDbFWqGC+rdrGh2VoKtMvB2 AvT0VkaR+I09wAVHcIAJI5j1Nf3/nZl/TgF0wQLYbURnVgUmE8IKRQoELJzvbgu2WzLA 6qMawh9kj9QJcp3QxihkR2i64sT+t+SgGN43m89t8mxhmvA2GveV+H1BdL8mpD1TmXAf 9W3az8YT2fcMwgDk9k2a3/PEXrPRiVQft/YgM2Qw22aahdZQPIj1qXeOoTUXdGNGNpOs OIvg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i18si6429940ejy.707.2021.03.08.00.48.06; Mon, 08 Mar 2021 00:48:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231789AbhCHIgN (ORCPT + 99 others); Mon, 8 Mar 2021 03:36:13 -0500 Received: from mail-ua1-f50.google.com ([209.85.222.50]:41880 "EHLO mail-ua1-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230341AbhCHIfn (ORCPT ); Mon, 8 Mar 2021 03:35:43 -0500 Received: by mail-ua1-f50.google.com with SMTP id u13so3058585uap.8; Mon, 08 Mar 2021 00:35:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=idle5xLu52lK6hHesv6Zvw3rifnSNDluxt4tlFsGgyI=; b=oiYtZLRswgQPNDA0pie/fGCNrVixepzOUCAcx3ZtuN+oD3k2SP/RK6QTM9yiE57YyR GLRzZTW0xRqxezlAluCyalxDILBdkDMUGzR0sGqNKqq6SWVSmTFj8nxSuiPo4G3dUT6w +yeEtRP3qI/x/wVjlegPE6K+uBHZrxrUsqabQE6kgS4TRmTLLczJ5h7NwMuSppJo2OeH BZ7z9XnzJUrkvZMF/yZOTKf6TWTKeTEJZYd/d3DbMX8Ppal6dlW1g2L4hc127rWQnnPV FHINLY54NnLkXjNml3OTxwiMyhc90Y5PyiuigPZ5jB3LC8zK4tH5+TKP59RnMshIGexT pY5A== X-Gm-Message-State: AOAM533zWeNyUyLA57d90ju/RQ70Z3zQp7x6z+Y4xBatgACeKgzwSniq 84F7ijJWKuWgZQP/RsCf8yGcVNCKC1oUsQIxjl0= X-Received: by 2002:ab0:20b3:: with SMTP id y19mr11998385ual.2.1615192543092; Mon, 08 Mar 2021 00:35:43 -0800 (PST) MIME-Version: 1.0 References: <20210305132859.8208-1-wsa+renesas@sang-engineering.com> In-Reply-To: <20210305132859.8208-1-wsa+renesas@sang-engineering.com> From: Geert Uytterhoeven Date: Mon, 8 Mar 2021 09:35:31 +0100 Message-ID: Subject: Re: [PATCH] clocksource: sh_cmt: use CMTOUT_IE only when supported To: Wolfram Sang , Phong Hoang Cc: Linux-Renesas , Linux Kernel Mailing List , Daniel Lezcano , =?UTF-8?Q?Niklas_S=C3=B6derlund?= Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Wolfram, Phong-san, On Fri, Mar 5, 2021 at 2:30 PM Wolfram Sang wrote: > CMTOUT_IE is only supported for older SoCs. Newer SoCs shall not set > this bit. So, add a version check. > > Reported-by: Phong Hoang > Signed-off-by: Wolfram Sang Thanks for your patch! As R-Car Gen2/3 indeed don't have this bit: Reviewed-by: Geert Uytterhoeven But given my comments below, I think it would make sense to change the one-line summary to e.g. "clocksource: sh_cmt: R-Car Gen2/Gen3 do not have CMTOUT_IE". > --- a/drivers/clocksource/sh_cmt.c > +++ b/drivers/clocksource/sh_cmt.c > @@ -143,6 +143,7 @@ struct sh_cmt_device { > #define SH_CMT32_CMCSR_SSIE (1 << 10) > #define SH_CMT32_CMCSR_CMS (1 << 9) > #define SH_CMT32_CMCSR_CMM (1 << 8) > +/* CMTOUT_IE only for SH_CMT_32BIT and SH_CMT_48BIT */ > #define SH_CMT32_CMCSR_CMTOUT_IE (1 << 7) > #define SH_CMT32_CMCSR_CMR_NONE (0 << 4) > #define SH_CMT32_CMCSR_CMR_DMA (1 << 4) > @@ -339,8 +340,9 @@ static int sh_cmt_enable(struct sh_cmt_channel *ch) > sh_cmt_write_cmcsr(ch, SH_CMT16_CMCSR_CMIE | > SH_CMT16_CMCSR_CKS512); > } else { > - sh_cmt_write_cmcsr(ch, SH_CMT32_CMCSR_CMM | > - SH_CMT32_CMCSR_CMTOUT_IE | > + u32 cmtout = ch->cmt->info->model <= SH_CMT_48BIT ? > + SH_CMT32_CMCSR_CMTOUT_IE : 0; > + sh_cmt_write_cmcsr(ch, cmtout | SH_CMT32_CMCSR_CMM | > SH_CMT32_CMCSR_CMR_IRQ | > SH_CMT32_CMCSR_CKS_RCLK8); > } Note that this bit is still set for all "32-bit" and all other "48-bit" variants: SH_CMT_32BIT: sh7720: CMTOUT_IE supported sh7343/7366: no docs sh7722/sh7723: limited docs, but "Supports canceling of the standby state in U-standby mode." sh7724: CMTOUT_IE supported SH_CMT_48BIT: sh73a0/r8a7740: CMTOUT_IE supported on channels 1/2/3, not on 0/4/5 So even not all older models support this bit. Probably this bit should only be set when the timer is configured as a wake-up source. But that is out-of-scope for this patch. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds