Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp565600rdb; Fri, 26 Jan 2024 04:25:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IE9NVO4olIQWqubIaqL06WDK8S4ndSHrA30LbgJjcupfMrPCNczLzhlkobxnsXaLTk1ginD X-Received: by 2002:a05:6a20:72a2:b0:199:f358:b5aa with SMTP id o34-20020a056a2072a200b00199f358b5aamr1102647pzk.117.1706271904160; Fri, 26 Jan 2024 04:25:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706271904; cv=pass; d=google.com; s=arc-20160816; b=SJNe9hrIXZav0x6TX0qQ/862cw6poKoUggDEijL2f4qYiHl/saGK7+Zo+9ufQFboj9 AzmhUOJ+vI78QW26XkpUKbKNuXz8MtGcFhQmJ8lh5JDbr4mCy4kj44xYymLHAcrHQyeM ipaVMJUePduyGhq98vkHMsXv3LQ5O0HB+SJ3YubBQeYZt4G/sQsioJyj85PMaqwG5ugV KlsmP1mY3M7rfZ28muiqXI2ju4LWdA04dkmima5QyktdP54mo/rejrEeQ+xlnJMD2kzu lTO1kyFwMEE2+bQt28DWZbV8h8iJKJnWACijUsg5JSzcKiwydlJXRj+er+4zbTKuDit6 vwHg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=DO5Cw99+U4E+0Nt0Wph/a1bGBWtbN/z5sxXuqQozhd8=; fh=EV6KOG/J+RcU6NxNxLOmneYmN+k6cfX9F0sQTXcW06E=; b=d5DJzIEYBwlOtx/Rw7/8L0C8kfhDgZRF2AKSazJjWxBgIxfINWbFvpnAxmpsY78oNU pr2Uo5eGC9HAM6KwmQq6OdV2NMZ6trNu2R7Mc/Q4T7ne11a0sMjIKXQEyK8o9aOEH4wA 3+IZku0CH9XSNX3ntSQwc3eXmMvdq+6hcd1RwHCp1S5mwaDMvdO+WbVdmFywWqQQlZCS 2GHTYoWR3trThFYeG9uSSJIs6tBIH9EEsJpxLQDcYu0B6UbpKKTiyLgbyMur0J3nAbTa bjOMkIn3jJFI76jfxFi747rXgTSMfYwpF/h2/Dz0WbkYQg8wusPu4hYQipbqYMGjoY2a aqDA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=E4i8Of7c; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-40077-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40077-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id s5-20020a170902ea0500b001d5e55b25cbsi1065008plg.16.2024.01.26.04.25.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 04:25:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-40077-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=E4i8Of7c; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-40077-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40077-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 69CF5B2E15C for ; Fri, 26 Jan 2024 11:56:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 093B818E25; Fri, 26 Jan 2024 11:56:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="E4i8Of7c" Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (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 4D3B91B963 for ; Fri, 26 Jan 2024 11:56:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706270185; cv=none; b=fjlmZKLO7uk7PwXY2cQ67chdukbpbWRoDWEpeI7xPPoCOweizLgcNwwgiDOJc+cOyfdqKNaahNVpdYK/yzlHfrx3IkWfTe/qICaKBChNn+HGugDt3hqZmQontJlkOwmlFVdvqIjClzvvUxVpjZiTIiM20ui9XmH/5pxyGNZfmzA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706270185; c=relaxed/simple; bh=RmGbAEvyMyBmZPV9rMtVayM5gvBAINtVmRS710SV+sM=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=mLYA8dkvfLG9h8RQpyN/amjnqEYs7F3F9s4KWCSmsCtOlL4VycuWGL0Y5qVlSCIlYJ/esCN26mNY5NREbHGPdc6ol6fXIhQIwps3ZgWML4c10zprTKu/vpE5s3/5W/0tLsUa0Ylkg/TDndoTfv87bg4Pxkbljv4uh2nAghh0WI4= 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=E4i8Of7c; arc=none smtp.client-ip=209.85.128.46 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-wm1-f46.google.com with SMTP id 5b1f17b1804b1-40ee6ff0c7dso2612555e9.2 for ; Fri, 26 Jan 2024 03:56:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706270182; x=1706874982; 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=DO5Cw99+U4E+0Nt0Wph/a1bGBWtbN/z5sxXuqQozhd8=; b=E4i8Of7cpOA7zx9jqf89I9uAa1fdpjBU/e5zqku8N7CEnUWrepwJJsthyWVkXFWNLB 1lccH3QzM4z3onDLTQMWKhbDDvtVb8iEfrVnkic2eC1jWc9fsMXdSRy7zLoxMluiYg+0 mxEHN9Rx3W9jGOJYqf0l+nlOi3/UKoxHs5rNpQ+0tzfJ+Xi2MWCmeZoWCH+giIun3+u4 xZex1Zp1HysV8HsCmmxW2ypDHUEKpH+7tnFXwdisQlbLPgQWjpNxcIIYm44fKkwIKBBL 7Rdol7PBjJWsLfwrJLuSQH37jbOQVi9e5au48st2e1XIKWS3fM6eq+c7zFDTpx8dpDJp Wj5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706270182; x=1706874982; 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=DO5Cw99+U4E+0Nt0Wph/a1bGBWtbN/z5sxXuqQozhd8=; b=BN/MPTPeQrKTt+C9C4MHgYCFX6VqwZcbPcJsfFPH0R1lIDv/CJgIfxrrOWOj2Kiry4 I0RDVswqP9oMriXiWXtodkc0u/KcYaPZjpl854wsgRkz7P7fUkjIDHY3j1uulUvdl9mX hB90jiweSPMAOsyVaUFaBeoo8J/YgO4lNUtay+LdNfDjgyITIZH/+418MCJPuDOhHT7Z CSW7ldT8rm2IXmBXwYlA6c7aj/NEzIW48aOrKkBElkkAc2+oC88shL7GXA7qQsAoQU85 IALa+icvz5FtOWWtiyH42umicGH8SGzWKiyN/ozh8njSuE+/H82YvTGk9xjxapFRehDE xUcg== X-Gm-Message-State: AOJu0YwpBMjBHBlEPJTBv92YLVigbmtYTxMTqbs/cZG7+C+HnSmRmimy 4D9FH0vcmxrkvRjQFtLP1sWVNoYxG89Zxm1KcCQlFjH8vc76dkKFU5353vBq2pk= X-Received: by 2002:a05:600c:5191:b0:40e:8799:7348 with SMTP id fa17-20020a05600c519100b0040e87997348mr596666wmb.68.1706270182598; Fri, 26 Jan 2024 03:56:22 -0800 (PST) Received: from [192.168.1.20] ([178.197.215.66]) by smtp.gmail.com with ESMTPSA id vo1-20020a170907a80100b00a2c11a438a8sm556451ejc.25.2024.01.26.03.56.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 26 Jan 2024 03:56:21 -0800 (PST) Message-ID: <3e8dfaf3-85a4-42bf-829c-4835f3de2d35@linaro.org> Date: Fri, 26 Jan 2024 12:56:19 +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 v3 08/17] clk: eyeq5: add platform driver Content-Language: en-US To: =?UTF-8?Q?Th=C3=A9o_Lebrun?= , Gregory CLEMENT , Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Thomas Bogendoerfer , Linus Walleij , =?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?= , Philipp Zabel Cc: Vladimir Kondratiev , linux-mips@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Thomas Petazzoni , Tawfik Bayouk , linux-gpio@vger.kernel.org References: <20240123-mbly-clk-v3-0-392b010b8281@bootlin.com> <20240123-mbly-clk-v3-8-392b010b8281@bootlin.com> <127fd51b-cd64-4e00-99d6-7be9b79f2dcc@linaro.org> <001993b9-ea0c-49c3-a4e5-4cea10c54082@linaro.org> From: Krzysztof Kozlowski Autocrypt: addr=krzysztof.kozlowski@linaro.org; keydata= xsFNBFVDQq4BEAC6KeLOfFsAvFMBsrCrJ2bCalhPv5+KQF2PS2+iwZI8BpRZoV+Bd5kWvN79 cFgcqTTuNHjAvxtUG8pQgGTHAObYs6xeYJtjUH0ZX6ndJ33FJYf5V3yXqqjcZ30FgHzJCFUu JMp7PSyMPzpUXfU12yfcRYVEMQrmplNZssmYhiTeVicuOOypWugZKVLGNm0IweVCaZ/DJDIH gNbpvVwjcKYrx85m9cBVEBUGaQP6AT7qlVCkrf50v8bofSIyVa2xmubbAwwFA1oxoOusjPIE J3iadrwpFvsZjF5uHAKS+7wHLoW9hVzOnLbX6ajk5Hf8Pb1m+VH/E8bPBNNYKkfTtypTDUCj NYcd27tjnXfG+SDs/EXNUAIRefCyvaRG7oRYF3Ec+2RgQDRnmmjCjoQNbFrJvJkFHlPeHaeS BosGY+XWKydnmsfY7SSnjAzLUGAFhLd/XDVpb1Een2XucPpKvt9ORF+48gy12FA5GduRLhQU vK4tU7ojoem/G23PcowM1CwPurC8sAVsQb9KmwTGh7rVz3ks3w/zfGBy3+WmLg++C2Wct6nM Pd8/6CBVjEWqD06/RjI2AnjIq5fSEH/BIfXXfC68nMp9BZoy3So4ZsbOlBmtAPvMYX6U8VwD TNeBxJu5Ex0Izf1NV9CzC3nNaFUYOY8KfN01X5SExAoVTr09ewARA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4aTc5xoAZBLo0OV+Ezo71pg3AYvq0a3/oGRG KQ06ztUMRrj8eVtpImjsWCd0bDWRaaR4vqhCHvAG9iWXZu4qh3ipie2Y0oSJygcZT7H3UZxq fyYKiqEmRuqsvv6dcbblD8ZLkz1EVZL6djImH5zc5x8qpVxlA0A0i23v5QvN00m6G9NFF0Le D2GYIS41Kv4Isx2dEFh+/Q== In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 25/01/2024 12:53, Théo Lebrun wrote: > Hi, > > On Thu Jan 25, 2024 at 8:46 AM CET, Krzysztof Kozlowski wrote: >> On 24/01/2024 17:41, Théo Lebrun wrote: >>> Hello, >>> >>> On Wed Jan 24, 2024 at 8:05 AM CET, Krzysztof Kozlowski wrote: >>>> On 23/01/2024 19:46, Théo Lebrun wrote: >>>>> Add the Mobileye EyeQ5 clock controller driver. It might grow to add >>>>> support for other platforms from Mobileye. >>>>> >>>>> It handles 10 read-only PLLs derived from the main crystal on board. It >>>>> exposes a table-based divider clock used for OSPI. Other platform >>>>> clocks are not configurable and therefore kept as fixed-factor >>>>> devicetree nodes. >>>>> >>>>> Two PLLs are required early on and are therefore registered at >>>>> of_clk_init(). Those are pll-cpu for the GIC timer and pll-per for the >>>>> UARTs. >>>>> >>>> >>>> >>>>> +#define OLB_PCSR1_RESET BIT(0) >>>>> +#define OLB_PCSR1_SSGC_DIV GENMASK(4, 1) >>>>> +/* Spread amplitude (% = 0.1 * SPREAD[4:0]) */ >>>>> +#define OLB_PCSR1_SPREAD GENMASK(9, 5) >>>>> +#define OLB_PCSR1_DIS_SSCG BIT(10) >>>>> +/* Down-spread or center-spread */ >>>>> +#define OLB_PCSR1_DOWN_SPREAD BIT(11) >>>>> +#define OLB_PCSR1_FRAC_IN GENMASK(31, 12) >>>>> + >>>>> +static struct clk_hw_onecell_data *eq5c_clk_data; >>>>> +static struct regmap *eq5c_olb; >>>> >>>> Drop these two. No file-scope regmaps for drivers. Use private container >>>> structures. >>> >>> I wouldn't know how to handle the two steps then. Two clocks and the clk >>> provider are registered at of_clk_init() using CLK_OF_DECLARE_DRIVER(). >> >> Right, if some clocks have to be early, CLK_OF_DECLARE_DRIVER needs >> static ones. But your commit subject says it is a platform driver and >> all other pieces of this code is rather incompatible with this approach. > > That is my bad on the commit subject. What do you refer to by "all other > pieces of this code is rather incompatible with this approach"? That you depend on syscon. If it was regular MMIO block in SoC space, then no problem. If you depend on anything else providing you regmap, then any initcall ordering is fragile and error-prone. Avoid. > > I've tried to minimise the use of static variables. Therefore as soon as > the probe is started, we switch to the usual way of using a private > struct that contains our info. > >> >> Do not use CLK_OF_DECLARE_DRIVER for cases where you have dependencies >> because it forces you to manually order initcalls, which is exactly what >> we do not want. > > What should I be using? I got confirmation from Stephen that this > mixture of CLK_OF_DECLARE_DRIVER() + platform driver is what I should > be using as review in my V1. > > https://lore.kernel.org/lkml/fa32e6fae168e10d42051b89197855e9.sboyd@kernel.org/ I see. In such case I believe it is error on relying on syscon. Best regards, Krzysztof