Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp4326321imb; Wed, 6 Mar 2019 10:35:00 -0800 (PST) X-Google-Smtp-Source: APXvYqwbwlM4kyrcNMCGvy4ujL3t9lkotLCY6fmQ7lHd82VVJpBFxIY1W2iLGCe2dIsksOGwU6sn X-Received: by 2002:a17:902:bd06:: with SMTP id p6mr8465128pls.130.1551897300642; Wed, 06 Mar 2019 10:35:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551897300; cv=none; d=google.com; s=arc-20160816; b=frb120RAP5Ms/j/1Rd5noCPihksJllkIJyfNwnmdGhgP8N634b5hGZRhEHRNViVNfB NJahUbcenXUwxz8eXPpADHJtbMooSfAnR3ttqL4xaZOvYqgnnEHv8etqoCqwZADjKjhJ U//klzu1tlFdByT8vvAyeXgYcjmCNGsN+kPWQuVmvn92tTNfOBflxt+LYiC97Zc+/Naq oF5KucVEw9pNPi7axYHtipvjLDUZEoRoFI1/bGR9jp936s5GRJWBC2nSLIfDSIKbxz8i uu+z0/37UhU9Z40W0tRmDTD/pTd7rfl5xrDyVPkAMlonsZvSXipZ1ppPnfh2cvXKjiib Y9ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:user-agent:message-id:to:cc:subject :from:references:in-reply-to:content-transfer-encoding:mime-version :dkim-signature; bh=inNLbCn7qWyE4bFk/j33KayWnaoDdSWy/WP1zu9bfC0=; b=aEmyqXNfEIih1JLmdqJB+bkwmXMnXCaKFwZF8uAVypKOtuSY6ftUeEDeeHXzteUqrp 5QmKf2ELuQy2FqVViZOXFWVpb4ybjptQOtpBuLk8TgChuihnlyoNBiwdItnppWit2pS7 E2TtMDBjD2Yw+BvJzgUcKFYBKrzXESrA0IJh1Gz5zzaK7JV1gNSKWHsKbg+lI+KynpcA MEU90WWIbrSI2WQ6YMNbe1av8gomycYCuSTQOvZZq7b4107NmBNQv09oeEdiI5vF5Nu9 qeZ7qr3ZuE6bQCTDBLVlHCWOgGCGX4SktfNZUGmLUtlLxyL02g1KOnpqAe9ZWUjtC4Iw VjQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=poPqh5Qw; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b8si2193788pla.290.2019.03.06.10.34.45; Wed, 06 Mar 2019 10:35:00 -0800 (PST) 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=@kernel.org header.s=default header.b=poPqh5Qw; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730608AbfCFSAI (ORCPT + 99 others); Wed, 6 Mar 2019 13:00:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:35568 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728944AbfCFSAI (ORCPT ); Wed, 6 Mar 2019 13:00:08 -0500 Received: from localhost (unknown [104.132.0.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C49A720652; Wed, 6 Mar 2019 18:00:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1551895206; bh=gKXUJgtTS6AIBw7vEV/Mub5TOrGtfxQInsx8I4Q4MP4=; h=In-Reply-To:References:From:Subject:Cc:To:Date:From; b=poPqh5QwHJ+lNcL8w8IYd4j4wKSfW8+yxNusZsoZcZZ3k3+twCAakuC3jXoZXpPtO rvIK4IHExO+LeJ3T50k+YykLuBxB+Zm4ngaRmo08B2TPdiWTES1hUQmLxR3tNZZ17k A2TTv67XccT/by2EE+9Gy3XCidw6FeGrsQ31bB7U= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: References: <20190226223429.193873-1-sboyd@kernel.org> <20190226223429.193873-7-sboyd@kernel.org> From: Stephen Boyd Subject: Re: [PATCH v2 6/8] clk: Allow parents to be specified without string names Cc: linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, Miquel Raynal , Russell King , Jeffrey Hugo , Chen-Yu Tsai To: Jerome Brunet , Michael Turquette Message-ID: <155189520594.20095.18225586788918924296@swboyd.mtv.corp.google.com> User-Agent: alot/0.8 Date: Wed, 06 Mar 2019 10:00:05 -0800 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Jerome Brunet (2019-03-02 10:40:42) > On Tue, 2019-02-26 at 14:34 -0800, Stephen Boyd wrote: > > The common clk framework is lacking in ability to describe the clk > > topology without specifying strings for every possible parent-child > > link. There are a few drawbacks to the current approach: > >=20 > > 1) String comparisons are used for everything, including describing > > topologies that are 'local' to a single clock controller. > >=20 > > 2) clk providers (e.g. i2c clk drivers) need to create globally unique > > clk names to avoid collisions in the clk namespace, leading to awkward > > name generation code in various clk drivers. > >=20 > > 3) DT bindings may not fully describe the clk topology and linkages > > between clk controllers because drivers can easily rely on globally un= ique > > strings to describe connections between clks. > >=20 > > This leads to confusing DT bindings, complicated clk name generation > > code, and inefficient string comparisons during clk registration just so > > that the clk framework can detect the topology of the clk tree. > > Furthermore, some drivers call clk_get() and then __clk_get_name() to > > extract the globally unique clk name just so they can specify the parent > > of the clk they're registering. We have of_clk_parent_fill() but that > > mostly only works for single clks registered from a DT node, which isn't > > the norm. Let's simplify this all by introducing two new ways of > > specifying clk parents. > >=20 > > The first method is an array of pointers to clk_hw structures > > corresponding to the parents at that index. This works for clks that are > > registered when we have access to all the clk_hw pointers for the > > parents. > >=20 > > The second method is a mix of clk_hw pointers and strings of local and > > global parent clk names. If the .name member of the map is set we'll > > look for that clk by performing a DT based lookup of the device the clk > > is registered with and the .name specified in the map. If that fails, > > we'll fallback to the .fallback member and perform a global clk name > > lookup like we've always done before. >=20 > Nitpick: I think you forgot to update the commit message when renaming the > struct members Fixed. Thanks! >=20 > >=20 > > Using either one of these new methods is entirely optional. Existing > > drivers will continue to work, and they can migrate to this new approach > > as they see fit. Eventually, we'll want to get rid of the 'parent_names' > > array in struct clk_init_data and use one of these new methods instead. > >=20 >=20 > Being able to specify parents from DT is great addition !!! Thx ! Woohooo! >=20 > Overall, it looks good but with such big patch on framework is not easy g= et a > clear idea. I'll try to give it a spin next week. Ok. Please be aware that I found one bug already but there are probably more lurking. I've also pushed the branch out to clk.git on kernel.org if you're interested in looking at the mass conversions going on. https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-parent-re= write