From patchwork Wed Jul 9 08:23:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Antoine Tenart X-Patchwork-Id: 4512421 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C89C5BEEAA for ; Wed, 9 Jul 2014 08:26:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CAE3B202B4 for ; Wed, 9 Jul 2014 08:26:10 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CE776202F0 for ; Wed, 9 Jul 2014 08:26:09 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X4nAW-0001Oy-TK; Wed, 09 Jul 2014 08:24:00 +0000 Received: from top.free-electrons.com ([176.31.233.9] helo=mail.free-electrons.com) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X4nAU-0001Ds-Bk for linux-arm-kernel@lists.infradead.org; Wed, 09 Jul 2014 08:23:59 +0000 Received: by mail.free-electrons.com (Postfix, from userid 106) id BB65F79A; Wed, 9 Jul 2014 10:23:37 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from kwain (col31-4-88-188-83-94.fbx.proxad.net [88.188.83.94]) by mail.free-electrons.com (Postfix) with ESMTPSA id D374E158; Wed, 9 Jul 2014 10:23:36 +0200 (CEST) Date: Wed, 9 Jul 2014 10:23:31 +0200 From: Antoine =?iso-8859-1?Q?T=E9nart?= To: Tejun Heo Subject: Re: [PATCH v9 3/7] ata: libahci: allow to use multiple PHYs Message-ID: <20140709082331.GA4510@kwain> References: <1404728173-20263-1-git-send-email-antoine.tenart@free-electrons.com> <1404728173-20263-4-git-send-email-antoine.tenart@free-electrons.com> <20140708134000.GC4979@htj.dyndns.org> <20140708170353.GA16148@kwain> <20140708171817.GH4979@htj.dyndns.org> <20140708174900.GC16148@kwain> <20140708214010.GI4979@htj.dyndns.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20140708214010.GI4979@htj.dyndns.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140709_012358_702701_AA836AF2 X-CRM114-Status: GOOD ( 31.33 ) X-Spam-Score: 0.3 (/) Cc: thomas.petazzoni@free-electrons.com, zmxu@marvell.com, Hans de Goede , devicetree@vger.kernel.org, Antoine =?iso-8859-1?Q?T=E9nart?= , linux-kernel@vger.kernel.org, kishon@ti.com, linux-ide@vger.kernel.org, alexandre.belloni@free-electrons.com, jszhang@marvell.com, linux-arm-kernel@lists.infradead.org, sebastian.hesselbarth@gmail.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Tejun, On Tue, Jul 08, 2014 at 05:40:10PM -0400, Tejun Heo wrote: > Hey, > > On Tue, Jul 08, 2014 at 07:49:00PM +0200, Antoine Ténart wrote: > > > So, yeah, it's being used both as input and output and we also have > > > the arguments which affect port_map, right? It does seem confusing. > > > > I do see priv->port_map as being automatically set and then restricted > > if needed by the port_map input here. I don't see how that's confusing. > > The only modification is we restrict the port_map parameter to the set > > of available ports. The port_map argument affected priv->port_map before > > this patch. > > It is confusing. If you wanna pass around available ports in hpriv, > please add a separate field and replace the arguments to > save_initial_config(). I don't get it. Which argument should I replace in save_initial_config()? The change is we compute hpriv->port_map. I don't see which arguments we can add or replace. If that's more clear, the modification here is equivalent to (when using the new bindings): It just use the argument port_map on the real set of ports. If that's still not clear, I can add a separate field. But the field will store the exact same information as hpriv->port_map. We will have something like: if (hpriv->available_port_map) hpriv->port_map &= hpriv->available_port_map; > > > Well, so does clk. Let's say clk is more restricted and phy can be > > > one or more per port and thus needs to be dynamic. If so, shouldn't > > > we at least have some correlation between phys and ports? It bothers > > > me that now libahci is carrying random number of resources that it has > > > no idea how to associate with the ports it manages. What if later we > > > want to involve phy driver in power managing unoccupied ports? > > > > I see. This is a first (working) attempt to have a one node per port. I > > agree that would be nice to have a correlation between ports and PHYs. > > This can definitively be added when needed without changing the dt > > bindings as only the internal representation changes. This would also > > require to get all phys from the port nodes, which is again internal > > stuff. > > > > Don't you think we can go by steps, and have a following up series for > > this when needed (like in a power managing series for unoccupied ports)? > > I don't know. It isn't exactly difficult to make it per-port, is it? > We already have ahci_port_priv and wouldn't the code actually be > simpler that way? I had a quick look on this, and it does not seems to be that simple. The ahci_port_priv is stored inside the ata_port struct and not accessible (as of now) from the ahci_host_priv one. The ahci_port_priv is initialized at the end of ahci_platform_init_host(), far after we need it. This requires quite a lot of changes. Or is there another way? To be honest, we are now at v9 and it's been quite a long time since v1. I'd really like it to be merged in 3.17. As I see it, this patch keeps the same logic as what was in place before, only with more PHYs. Don't take me wrong, I really think this is a good idea to have a per-port PHY information. But this is a refactoring not clearly related to this series as the logic is not changed. This definitively can be the subject of a dedicated series, especially if I got it right and the required modifications are not that obvious. What do you think? Thanks, Antoine diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c index 40ea583d3610..f9d3cfd5d1bd 100644 --- a/drivers/ata/libahci.c +++ b/drivers/ata/libahci.c @@ -513,7 +513,7 @@ void ahci_save_initial_config(struct device *dev, /* record values to use during operation */ hpriv->cap = cap; hpriv->cap2 = cap2; - hpriv->port_map = port_map; + hpriv->port_map &= port_map; if (!hpriv->start_engine) hpriv->start_engine = ahci_start_engine;