Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3152646ybi; Mon, 29 Jul 2019 01:49:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqxlaVR5RRzGmPYprbZSXvqLMpcXJNzMigis6Va4TpQFhB+3h22DlTDk1ksTJ/9be3QEAJzZ X-Received: by 2002:a63:6901:: with SMTP id e1mr72468210pgc.390.1564390175522; Mon, 29 Jul 2019 01:49:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564390175; cv=none; d=google.com; s=arc-20160816; b=DyTWpLvoEFUFUzAnWKE20ZvUdPU9HnSscou8oEmavqM7/YfAqknVpl1TF6vBzM9YWc MsiqCVp3bgnNQbgXL2ZEjxdyNyFyAOa37mKQEvbuWQDF5ouHG3lMdD894oTJ0XzEGnQk 8MvJNeRbX/a4uB7PJZd1EwaRZKizqBEafSkqwsFY4I7o8F8anXrmuXggBcE0aZ5v8Rww tB6GunpqQ6CzXcZ1C/fM2Pb4Gmft6nWaHKWXHHJKJ7a2xFaDcANfbOHdICNtNUt9NzFz HncEMcMxYRF/pdv2CfmjnjKrBvOarwrNsZfCkLnCG83cxlk86jwLQCWqBpUiWOqLmsSW sojg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=qcDHQ1YIyua0Lz0XKlvtzGchQOF/q8YhLFhQTQqfSnA=; b=zvGbDuIqhI2mixewHBUZhnrW4y+m1sfDDXPQ2LkG4cQ1eeI3x2YtajPLL1vuh7Bd3D 1OOgCSDIpc4cgGQUOdfQ7vqpkTBpuyY4HUYx+5TupgiKrqbLMkLwbBB1YcDUFBWekNG0 sUN5JeMINwLHK8p6ZN32JjZ42DWSA/JcNEN2g9sjqo4jNjXA2J2LQ+D3Jq+WEHRYJK3G C8bpKXJoISEAN2UCgWaOelib9GOsTGPp5iHI3dqLDHIiNSqHAODcJgheyESxTLSEuOld rGjZAOHy4o6R2Ijwh0JJULYaCV5ihSFvyLp7zfWsuLd3A+rk+u1euYI0bKzpOyK0Fv9B WiFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=02iwdyH2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v14si25792414pgb.375.2019.07.29.01.49.19; Mon, 29 Jul 2019 01:49:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=02iwdyH2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726964AbfG2Hmn (ORCPT + 99 others); Mon, 29 Jul 2019 03:42:43 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:42913 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726937AbfG2Hmm (ORCPT ); Mon, 29 Jul 2019 03:42:42 -0400 Received: by mail-wr1-f65.google.com with SMTP id x1so10732221wrr.9 for ; Mon, 29 Jul 2019 00:42:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=qcDHQ1YIyua0Lz0XKlvtzGchQOF/q8YhLFhQTQqfSnA=; b=02iwdyH22+odFMvWr/fUSOWV/YsZSHqKDJDdL3e/jHLksFamrMNdydoLixPsostjig yYzQEFDjoaLkJAPyPt/dX5djgi4pTpVW7k5O+EuK9vRV4b+kvVD3KdHyP+fHdAXOLJZw fs4K6etimfyGJgHmMkzEWYXpz0YXtnA5d3Ujv3pcGXoUovVU2fuxrFw2Zx9N+4HQJ2Xh 6ZfZtL98PhcYOUCA0uf9O/gU8Ho3Ar5Xd5LTTZyfiGybMwcM7ykT0tlFaILBVDsfNIyn qOJAT7FJydgp4as6OIcwX3bPsXYJAYc4F7EkgbuacqIjLhJho48k5LzbAupoJo3tSI69 B2mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=qcDHQ1YIyua0Lz0XKlvtzGchQOF/q8YhLFhQTQqfSnA=; b=KgwKc4gCmudkURlT26craxfRsAGCrBuPHW+oUpexPiOrKqmmgIFRaoBarhXK5qbF/o Eg0sC4o9G6fwolOHxsvqfVKAN5NvVSDVYL1rLKgr025+kzqrK7CN0YfTO2x/WzRroTwz Eg+YNJFB0NmbssGtJYkf7zBPTOLjnfDNFuOlQghp81oB3DrTPzAq0OijwGIxt4o9UByg afUoXvd2oDZuM0CMn/wQdujd19f6paBT494+tt2KR12wpZx7MLcQ6Il8m9SYuc38Kyr/ Xn6sSZH2655AytHIiRQTXlDhdXB7B8t/beyS7L4V5Z1sYNUJraK1cKM4qg5KSJub/FlO +krA== X-Gm-Message-State: APjAAAUBZuBdOFi3l2Ss+mDkv1ydec11ecNcLlWoL7nn2xjSxcRXHvtT soEjkqdxevIQ7wR5ji6CPYugBQ== X-Received: by 2002:adf:cd04:: with SMTP id w4mr69069194wrm.230.1564386159762; Mon, 29 Jul 2019 00:42:39 -0700 (PDT) Received: from localhost ([2a01:e34:eeb6:4690:ecfa:1144:aa53:4a82]) by smtp.gmail.com with ESMTPSA id m24sm37058830wmi.39.2019.07.29.00.42.38 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 29 Jul 2019 00:42:39 -0700 (PDT) From: Jerome Brunet To: Neil Armstrong , khilman@baylibre.com Cc: linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, martin.blumenstingl@googlemail.com, linux-gpio@vger.kernel.org Subject: Re: [RFC/RFT v3 04/14] clk: meson: eeclk: add setup callback In-Reply-To: <55ce9b5e-de2f-9da3-8eec-13b5ead23e6c@baylibre.com> References: <20190701091258.3870-1-narmstrong@baylibre.com> <20190701091258.3870-5-narmstrong@baylibre.com> <1jh8836w49.fsf@starbuckisacylon.baylibre.com> <55ce9b5e-de2f-9da3-8eec-13b5ead23e6c@baylibre.com> Date: Mon, 29 Jul 2019 09:42:37 +0200 Message-ID: <1j1ry9s2vm.fsf@starbuckisacylon.baylibre.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 26 Jul 2019 at 16:50, Neil Armstrong wrote: > On 03/07/2019 16:17, Jerome Brunet wrote: >> On Mon 01 Jul 2019 at 11:12, Neil Armstrong wrote: >> >>> Add a setup() callback in the eeclk structure, to call an optional >>> call() function at end of eeclk probe to setup clocks. >>> >>> It's used for the G12A clock controller to setup the CPU clock >>> notifiers. >> >> I'd prefer if you implement the probe function in the related controller >> have this probe function call meson_eeclkc_probe() for the common part >> >> In your case, I suppose it means implementing the g12a controller probe >> to deal with the notifiers > > Sure, but with this eeclk setup callback I can provide a different setup() callback > for g12a and g12b (and later sm1), without this means adding a top data struct > containing a setup() callback pointer and the soc meson_eeclkc_data struct to be able > to call a setup() for each family like done actually, but this will broke eeclk since > the match_data data won't be a meson_eeclkc_data() struct anymore. meson_eeclkc_probe is an helper we added to factorize common code out of the clock controllers we had. I don't like the idea to now add callback in it deal with the specifics of each SoCs. It feels like we are going in circles. I think SoC/controller specific stuff should be dealt with in related probe function of each clock controller which would then call the 'common helper' if necessary. If the common part interface needs to be reworked, maybe changing the parameters, I'm ok with it. > > If you still prefer this, I can rework it like that. > > I'm rebasing all the stuff on v5.3-rc1 and plan to repost an updated version > shortly, solving this would be easier. > > Neil > >> >>> >>> Signed-off-by: Neil Armstrong >>> --- >>> drivers/clk/meson/meson-eeclk.c | 6 ++++++ >>> drivers/clk/meson/meson-eeclk.h | 1 + >>> 2 files changed, 7 insertions(+) >>> >>> diff --git a/drivers/clk/meson/meson-eeclk.c b/drivers/clk/meson/meson-eeclk.c >>> index 6ba2094be257..81fd2abcd173 100644 >>> --- a/drivers/clk/meson/meson-eeclk.c >>> +++ b/drivers/clk/meson/meson-eeclk.c >>> @@ -61,6 +61,12 @@ int meson_eeclkc_probe(struct platform_device *pdev) >>> } >>> } >>> >>> + if (data->setup) { >>> + ret = data->setup(pdev); >>> + if (ret) >>> + return ret; >>> + } >>> + >>> return devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get, >>> data->hw_onecell_data); >>> } >>> diff --git a/drivers/clk/meson/meson-eeclk.h b/drivers/clk/meson/meson-eeclk.h >>> index 9ab5d6fa7ccb..7fdf424f71a6 100644 >>> --- a/drivers/clk/meson/meson-eeclk.h >>> +++ b/drivers/clk/meson/meson-eeclk.h >>> @@ -20,6 +20,7 @@ struct meson_eeclkc_data { >>> const struct reg_sequence *init_regs; >>> unsigned int init_count; >>> struct clk_hw_onecell_data *hw_onecell_data; >>> + int (*setup)(struct platform_device *pdev); >>> }; >>> >>> int meson_eeclkc_probe(struct platform_device *pdev); >>> -- >>> 2.21.0