Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1192321imm; Wed, 13 Jun 2018 15:07:52 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLEC0O1fam1iWE7ZieFCXqJdvP9HeQoYNUyArrBjJGr8kMOsEjgdJzyoAcd6QZwBHy/VJcm X-Received: by 2002:a17:902:d24:: with SMTP id 33-v6mr6829plu.22.1528927671977; Wed, 13 Jun 2018 15:07:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528927671; cv=none; d=google.com; s=arc-20160816; b=LeSNBzo/f9DXL0if7miCFe00EimXQQlUczxOW4BeAo3/k0At17SGwNQ48JwhY0dKeK 9Dfp67ngSE94+rOruUslcALaNxljt4x/XC24S41SaVPFNzaRBjgZOc5flUJaL7OwUCjo x8yDMZTYORIOrMxpA0/WGY9M4iUNAC9GmCfZN2MARRcKn+tWbZ3gHFsyFxQoA/IkER+f 8Tnop2pKYMrMl4zzknSL0wVIEmubNc++Hxh+6lqwEvLIFAWx/FU0uMI32h0C2eL7oNTp AZbXimFw62CbwsTbsUgzXPn3t5Myuvk0zwlp9NlWotl9Ce9GW6r1tvptHxOBWDYipdWZ lCHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=f6l9yr9JlSw7cERWR4Z64M+8MjRoW8W6SwMmqHoeltU=; b=Q/GipEYaH37s0C6Q/xy/bERrB5T86tlzACAP+lSZil4Em/hSLj3X7g8Jf1ztONDtVD gNtKDtUsJxed1YSaeyx5uO3G5WAsLHVcULh7XHm8jq8NDhWLb3kc23WPs2nHxorgNRBH bvTRXEd8b+YO1wKv4dqrz1iWOYWzDZp4iDj25DLAI0ncz+7X2H9Kyc0KhQxGCUxKgCUr wM9Y71O/SRaMydHgV7owDd+2MqutPnurBZLJ36w1YItgSxB4nhWL0vEowUEYtg1cZyae KBho/iPMEU/y76fu61cur7Ig7tcwez8+xkfjLPJXQKEhXDKu7xGNCd0y3vkGgDjD3Y8a QMww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kAgFeKtP; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a62-v6si3140699pge.492.2018.06.13.15.07.37; Wed, 13 Jun 2018 15:07:51 -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=@linaro.org header.s=google header.b=kAgFeKtP; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935528AbeFMWHO (ORCPT + 99 others); Wed, 13 Jun 2018 18:07:14 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:45776 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935320AbeFMWHM (ORCPT ); Wed, 13 Jun 2018 18:07:12 -0400 Received: by mail-wr0-f193.google.com with SMTP id o12-v6so4278521wrm.12 for ; Wed, 13 Jun 2018 15:07:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=f6l9yr9JlSw7cERWR4Z64M+8MjRoW8W6SwMmqHoeltU=; b=kAgFeKtPfcORz//JBte6hr8ZqH3nck1t2HtrwQUz0K39p+4nbyNXAgBWX+IYPRIxcL 9grGJ/NnnSA4wdHMsNXXEv+bRNI1aQXukLx0p9POQTDaUzbP3kMpKDzthfUE49oySTiB TmPj4ENdt9nCV6gq6inZw8tCUdQmbJFPbPs1M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=f6l9yr9JlSw7cERWR4Z64M+8MjRoW8W6SwMmqHoeltU=; b=TE5CvMXT5LMCef9j2mWNcvMsI2HCaDRKjveRRl5uA13Res2iLvlkiXwR6VadvTR3S1 u5d1FJFxU6MUPAxExrAW3Be/OA3vD+XlPEUMBjQ8bY9+6jEMCrX3h4l3YQIDbt8+zFA+ vyxTFzSIywT1VAfXhJJiDFVSwlnwzfxPISdq5GylPtWAjYZl90i8fjRGBUQcIw3YzPbT JQU1Nwof1jrVzfUiDHj+4cpdi7koS6grSKQQ2GYNDAnSuxl6C8Jbh3+MIs1DFdj6r/zI g9kDElwvXFh3EFhNeEvcwehwp4PGfaYk7blFUR6q9Bc+1Ny9mmSKChF+dXi7PDA/brrE 8MUQ== X-Gm-Message-State: APt69E2sSmj6WDejQkToUYotlYEGyZmgsSxFTpiq2XnF0uQheOH/ICaK JgPjzcNgxH2ptbGYw68uD/ziodAjVrejBDDMCcaV6w== X-Received: by 2002:adf:9405:: with SMTP id 5-v6mr6028332wrq.283.1528927631558; Wed, 13 Jun 2018 15:07:11 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a5d:47d1:0:0:0:0:0 with HTTP; Wed, 13 Jun 2018 15:06:51 -0700 (PDT) In-Reply-To: <0bf3c57c-dac8-8ece-6b8a-3b4d024140fc@broadcom.com> References: <1526668446-20048-1-git-send-email-scott.branden@broadcom.com> <395f1fe8-76f1-8310-d09e-63e25bca23d2@broadcom.com> <0bf3c57c-dac8-8ece-6b8a-3b4d024140fc@broadcom.com> From: Rob Herring Date: Wed, 13 Jun 2018 16:06:51 -0600 Message-ID: Subject: Re: [PATCH] arm64: dts: stingray: use NUM_SATA to configure number of sata ports To: Scott Branden Cc: Florian Fainelli , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , Ray Jui , BCM Kernel Feedback , devicetree@vger.kernel.org, "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 13, 2018 at 2:18 PM, Scott Branden wrote: > Hi Rob, > > Thanks for comment - reply inline. > > > > On 18-06-13 12:31 PM, Florian Fainelli wrote: >> >> On 06/12/2018 03:54 PM, Rob Herring wrote: >>> >>> On Thu, Jun 7, 2018 at 12:53 PM, Scott Branden >>> wrote: >>>> >>>> Hi Rob, >>>> >>>> Could you please kindly comment on change below. >>>> >>>> It allows board variants to be added easily via a simple define for >>>> different number of SATA ports. >>>> >>>> >>>> >>>> On 18-06-04 09:22 AM, Florian Fainelli wrote: >>>>> >>>>> On 05/18/2018 11:34 AM, Scott Branden wrote: >>>>>> >>>>>> Move remaining sata configuration to stingray-sata.dtsi and enable >>>>>> ports based on NUM_SATA defined. >>>>>> Now, all that needs to be done is define NUM_SATA per board. >>>>> >>>>> Rob could you review this and let us know if this approach is okay or >>>>> not? Thank you! >>>>> >>>>>> Signed-off-by: Scott Branden >>>>>> --- >>>>>> diff --git a/arch/arm64/boot/dts/broadcom/stingray/stingray-sata.dtsi >>>>>> b/arch/arm64/boot/dts/broadcom/stingray/stingray-sata.dtsi >>>>>> index 8c68e0c..7f6d176 100644 >>>>>> --- a/arch/arm64/boot/dts/broadcom/stingray/stingray-sata.dtsi >>>>>> +++ b/arch/arm64/boot/dts/broadcom/stingray/stingray-sata.dtsi >>>>>> @@ -43,7 +43,11 @@ >>>>>> interrupts = >>>>> IRQ_TYPE_LEVEL_HIGH>; >>>>>> #address-cells = <1>; >>>>>> #size-cells = <0>; >>>>>> +#if (NUM_SATA > 0) >>>>>> + status = "okay"; >>>>>> +#else >>>>>> status = "disabled"; >>>>>> +#endif >>> >>> This only works if ports are contiguously enabled (0-N). You might not >>> care, but it is not a pattern that works in general. > > Correct - all board designs that include this dtsi file follow such > commonality (ie. design with SATA0 first, etc). By having common board > designs it allows for commonality in dts files rather than duplicating > information everywhere. If somebody designs a bizarro board they are free > to create their own dts file of course. >>> >>> And I'm not a fan >>> of C preprocessing in DT files in general beyond just defines for >>> single numbers. > > The use of a define to specify the number of SATA ports in the board design > meets our requirements of being able to maintain many boards. We need a > method to specify the number of ports in the board design rather than > copying and pasting the information in many dts files. If you have an > alternative upstreamable mechanism to manage the configuration of many > boards without copy and paste that would be ideal? Is this really the only problem with maintaining lots of boards? What about all the other nodes that are conditionally enabled? Really, I don't see the problem with 3 lines per node. Does having an unused port enabled cause problems? If not, you could handle it all at run-time and just shutdown ports which have no link. You'd want to do that anyway for boards with a port, but is not connected to a drive (except for hotplug capable ports). Maybe we could add a property in /chosen that is a list of nodes to enable and either the bootloader or kernel could update their 'status'. Or It could even be done in dtc perhaps with some /directive/. Rob