Received: by 2002:a05:7412:7c14:b0:fa:6e18:a558 with SMTP id ii20csp190573rdb; Mon, 22 Jan 2024 00:29:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IFV/FNvzhQGLZYUM9bTijWbu+/QNUVQc86uqJmEOblmWVigDFnDS2NOOnXO9b9y+33n9s0L X-Received: by 2002:a05:6a00:894:b0:6db:624e:93cd with SMTP id q20-20020a056a00089400b006db624e93cdmr1507204pfj.23.1705912182990; Mon, 22 Jan 2024 00:29:42 -0800 (PST) Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id s12-20020a63dc0c000000b005cee03a5355si7605418pgg.518.2024.01.22.00.29.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 00:29:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-32517-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=KsF3yMVM; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-32517-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32517-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 97C0C284F6F for ; Mon, 22 Jan 2024 08:29:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4552621116; Mon, 22 Jan 2024 08:29:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="KsF3yMVM" Received: from mail-il1-f175.google.com (mail-il1-f175.google.com [209.85.166.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3D67D21113 for ; Mon, 22 Jan 2024 08:29:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705912163; cv=none; b=osylJMVE2VwW1KxsGC2/7kHgjQhym6Ewi/givqD/+55Yp5H0l9xNl1YbnnSCR8H5rHxX1yoWi7c+N77f/6adBOiilVhtVWiCmfvOV8Z0G69hbdy8aQ26BIKWWQV/X/eqGimNusbct3Hi084r6pshqe19RCJWgqNwvZv4erPt1LY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705912163; c=relaxed/simple; bh=+ikdmAivMW5Ys6TtpLLGLtsg3lDwPNzM403zL0ZyXn4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=RO1MH81cGMdeDW1QjOU0GF86DRw6LpumrBG6RagnLAG9pYTFRVUoLT7uA89qhNdTwPuCeoeNjJXGHJp+pGz+uUWI5SQblr+ZxERKy7UwiHsfMuOAwjAjHEic8WZEdHgsd+T5zpsNEonjWabOwR1504p3AR/QwwPs9xiFPT3eT4U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=KsF3yMVM; arc=none smtp.client-ip=209.85.166.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-il1-f175.google.com with SMTP id e9e14a558f8ab-361a02f3328so8054045ab.0 for ; Mon, 22 Jan 2024 00:29:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1705912160; x=1706516960; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=fW6DPlivnSwy1GouZq7jYrje/aUT9F7NfiEPtiXR/fs=; b=KsF3yMVMEUP3NiFmmtq5fz3uBo2Q66ixrTkLu2OqZ7r9eTGXgZvEgfbhdi15bntIeo pjQI2LfXcGle/7fGis8knwIb4TS6XSt9hC3gVEWnfFgDOv6EwU++mWTwOp0L2SiPto+x XPYymjODL12FlIlNFso6A1FnSn+D4WU2nMusbTkDfNVSG4GIbf8hojJaY6v74UWevvOW S8TDStphjalpKkn7hTDJL61Ctwub3TaeKBnOIKp1HpZOKp3r48FXTFiecLYUsgQ5hppk ykb8ZBtcrGDxTSGzmNSM/V5BMYxzo/b1KWf4rfRir5c3upl4WlIJUVBFmfFCtYyqFRdf 6WEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705912160; x=1706516960; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=fW6DPlivnSwy1GouZq7jYrje/aUT9F7NfiEPtiXR/fs=; b=vdidlD9v2Jy/fq0vBFm+1yLy4tmglGCnRUWztHZw69Sm6wAFAZrZkS5DG82H/AZhch XEXAagkGzEupl7kIv7lbnKLNWdpmGB1VZuO9gEe4h/YF0SyH/psb0CPc7SpuoTM5TKTT 4HdmjWv8dX1OQFPfqryljkwUOj5GVIFvYhuUwPvqObNz5CcUsbKXTzOnIPiEsbU9FMmG 4WYs+56+fDQKSFuOA7vM/rMNTyg6zFAyqWaolxoy2LjmAi2IWovQ40F4ocG60qETBh2U atRaklmKMhPaoXZVLSD3Sq5Oqa0w8qckrLJQ5CUTNBJrr500qfwMgfHvVeWxNo43pnJK 5Uuw== X-Gm-Message-State: AOJu0YyXF6/8MGNxJ1tWUxmP6UxMioOx2m3vHQOgOxFczHDHSsSKOnUG ttkUQrtWOzw2t7nh8SYVmmmgniAvt56EP5iPfpPRP9cdYV0gZLyIiLPL/UbAIPk= X-Received: by 2002:a92:c213:0:b0:361:ad0d:7e07 with SMTP id j19-20020a92c213000000b00361ad0d7e07mr4720833ilo.48.1705912160312; Mon, 22 Jan 2024 00:29:20 -0800 (PST) Received: from [192.168.1.20] ([178.197.215.66]) by smtp.gmail.com with ESMTPSA id n6-20020a056e0208e600b0036193f4e5c4sm3677321ilt.25.2024.01.22.00.29.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 22 Jan 2024 00:29:19 -0800 (PST) Message-ID: <90ae0cad-34a8-4e19-a72f-5e497b72b45c@linaro.org> Date: Mon, 22 Jan 2024 09:29:15 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v7 2/3] rtc: sophgo: add rtc support for Sophgo CV1800 SoC Content-Language: en-US To: Jingbao Qiu , alexandre.belloni@bootlin.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, chao.wei@sophgo.com, unicorn_wang@outlook.com, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu Cc: linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, dlan@gentoo.org References: <20240122080631.2880-1-qiujingbao.dlmu@gmail.com> From: Krzysztof Kozlowski Autocrypt: addr=krzysztof.kozlowski@lin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qa+XdUEciwG/SgNyxBZepj41oVq FPSVE+Ni2tNrW/e16b8mgXNngHSnbsr6pAIXZH3qFW+4TKPMGZ2rZ6zITrMip+12jgw4mGjy 5y06JZvA02rZT2k9aa7i9dUUFggaanI09jNGbRA/ABEBAAHCwXwEGAEKACYCGwwWIQSb0H4O DFH41ZZ3t1Qbk0N9O0FimwUCYDzvagUJFF+UtgAKCRAbk0N9O0Fim9JzD/0auoGtUu4mgnna oEEpQEOjgT7l9TVuO3Qa/SeH+E0m55y5Fjpp6ZToc481za3xAcxK/BtIX5Wn1mQ6+szfrJQ6 59y2io437BeuWIRjQniSxHz1kgtFECiV30yHRgOoQlzUea7FgsnuWdstgfWi6LxstswEzxLZ Sj1EqpXYZE4uLjh6dW292sO+j4LEqPYr53hyV4I2LPmptPE9Rb9yCTAbSUlzgjiyyjuXhcwM qf3lzsm02y7Ooq+ERVKiJzlvLd9tSe4jRx6Z6LMXhB21fa5DGs/tHAcUF35hSJrvMJzPT/+u /oVmYDFZkbLlqs2XpWaVCo2jv8+iHxZZ9FL7F6AHFzqEFdqGnJQqmEApiRqH6b4jRBOgJ+cY qc+rJggwMQcJL9F+oDm3wX47nr6jIsEB5ZftdybIzpMZ5V9v45lUwmdnMrSzZVgC4jRGXzsU EViBQt2CopXtHtYfPAO5nAkIvKSNp3jmGxZw4aTc5xoAZBLo0OV+Ezo71pg3AYvq0a3/oGRG KQ06ztUMRrj8eVtpImjsWCd0bDWRaaR4vqhCHvAG9iWXZu4qh3ipie2Y0oSJygcZT7H3UZxq fyYKiqEmRuqsvv6dcbblD8ZLkz1EVZL6djImH5zc5x8qpVxlA0A0i23v5QvN00m6G9NFF0Le D2GYIS41Kv4Isx2dEFh+/Q== In-Reply-To: <20240122080631.2880-1-qiujingbao.dlmu@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 22/01/2024 09:06, Jingbao Qiu wrote: > Implement the RTC driver for CV1800, which able to provide time alarm > and calibrate functionality. > > Signed-off-by: Jingbao Qiu > --- > > Depends on https://lore.kernel.org/all/IA1PR20MB4953C774D41EDF1EADB6EC18BB6D2@IA1PR20MB4953.namprd20.prod.outlook.com/ > Why? How could a RTC driver depend on clock driver or clock bindings? This looks wrong and it prevents your driver being merged via easy path. > diff --git a/drivers/rtc/rtc-cv1800.c b/drivers/rtc/rtc-cv1800.c > new file mode 100644 > index 000000000000..fbf2e575ea94 > --- /dev/null > +++ b/drivers/rtc/rtc-cv1800.c > @@ -0,0 +1,406 @@ > +// SPDX-License-Identifier: GPL-2.0-only > +/* > + * rtc-cv1800.c: RTC driver for Sophgo cv1800 RTC > + * > + * Author: Jingbao Qiu > + */ > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include Drop > +#include > +#include Keep the includes sorted, prefferably alphabetically. .. > + > +static int cv1800_rtc_probe(struct platform_device *pdev) > +{ > + struct cv1800_rtc_priv *rtc; > + uint32_t ctrl_val; > + void __iomem *base; > + int ret; > + > + rtc = devm_kzalloc(&pdev->dev, sizeof(struct cv1800_rtc_priv), sizeof(*) > + GFP_KERNEL); > + if (!rtc) > + return -ENOMEM; > + > + base = devm_platform_ioremap_resource(pdev, 0); > + if (IS_ERR(base)) > + return PTR_ERR(base); > + > + rtc->rtc_map = Unneeded blank line. Don't wrap at =. > + devm_regmap_init_mmio(&pdev->dev, base, &cv1800_rtc_regmap_config); > + if (IS_ERR(rtc->rtc_map)) > + return PTR_ERR(rtc->rtc_map); > + > + rtc->irq = platform_get_irq(pdev, 0); > + if (rtc->irq < 0) > + return rtc->irq; > + > + ret = devm_request_irq(&pdev->dev, rtc->irq, cv1800_rtc_irq_handler, > + IRQF_TRIGGER_HIGH, "alarm", &pdev->dev); > + if (ret) > + return dev_err_probe(&pdev->dev, ret, > + "cannot register interrupt handler\n"); > + > + rtc->clk = devm_clk_get_enabled(&pdev->dev, NULL); > + if (IS_ERR(rtc->clk)) > + return dev_err_probe(&pdev->dev, PTR_ERR(rtc->clk), > + "clk not found\n"); > + > + rtc->rtc_dev = devm_rtc_allocate_device(&pdev->dev); > + if (IS_ERR(rtc->rtc_dev)) > + return PTR_ERR(rtc->rtc_dev); > + > + platform_set_drvdata(pdev, rtc); > + > + rtc->rtc_dev->ops = &cv1800_rtc_ops; > + rtc->rtc_dev->range_max = U32_MAX; > + > + /* if use internal clk,so coarse calibrate rtc */ > + regmap_read(rtc->rtc_map, CTRL, &ctrl_val); > + ctrl_val &= CTRL_MODE_MASK; Best regards, Krzysztof