Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp5615868imm; Tue, 26 Jun 2018 14:40:05 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKaBxOQAsdacQvJ8D2Hm80+9Ev9vxlet6mt3EWGIBBUSV7nS1dYQOvDrytCCLZ6G7LKMa+v X-Received: by 2002:a63:a809:: with SMTP id o9-v6mr2806873pgf.313.1530049205734; Tue, 26 Jun 2018 14:40:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530049205; cv=none; d=google.com; s=arc-20160816; b=fDd9RhaqGOGw18QrymYzLFDAotJZT/wYuEWFkjrV9S1eIj456OmTUNVi/z8hKQ2ma2 aXTsgjDrggwXUuZmBz3Z+/KjA/3BZ6+UceZlZPcSR5K4sMoHmp4IeefJPmdMPeiuOm+L 0BJ4neFtsanfeBd5YubKtspp/RMUE2TL3rFwGL17Nhpd5wcLy9dIa5spezZvaiX4ZjeI 1EMZ5bZXZlI8oni8lYjrbp80lhc7cJKWX1o2VlKROu+pWfL2wU4CI/ocoTZZ7brPN+JO ZKujqwNYVciG/9HWstuMmzZHMJr2TT+s2TF9w/xpYNZERgvvZ8+YGDHCQ8z11xcQ7bDa XRWQ== 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 :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=shpmv/UaUYIiM+UcTo1JhJ6cwy6JzAX1q4gPO4DoMX8=; b=l7u0BjV8tgtw1Kvos4gSQQCx35La20iDn+ee3kEnrHxGcQ9Osc5EQ4kfADYoehxIOW FTbjDRe7IX2B3EmGYetWQgkFbnIj5X8VjWxk6m9rwA2enK+KD84nB7Hey1gCOuRQBVIj 3AQ3vlZLpc2myAxDZu43sKL4wsp+B/W4JMLtRNj6CdYfWgvnwQ2DYI3L18eNOOX8//od jCzgQD6uwiZlBW5FxTeY3iOIOKeNI1UsWUwMiTQmLuTuK/ASrY+VnM+4g6hTVwB/PCbb e2G0gKBVQoGhHf7FKJR381Z+XMUpIZEAWKSZDrVt9ZR9cIdIN4ia7nAT/kSLBv7+jRhz Fbyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=r0OGvdr4; 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 e7-v6si2102151pgf.317.2018.06.26.14.39.51; Tue, 26 Jun 2018 14:40:05 -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=@kernel.org header.s=default header.b=r0OGvdr4; 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 S1752926AbeFZVjR (ORCPT + 99 others); Tue, 26 Jun 2018 17:39:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:59698 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752175AbeFZVjQ (ORCPT ); Tue, 26 Jun 2018 17:39:16 -0400 Received: from mail-it0-f47.google.com (mail-it0-f47.google.com [209.85.214.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E6A6C23EBF; Tue, 26 Jun 2018 21:39:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1530049156; bh=6D7WDbeFEDS6ujrxcRrtT4Oh+52tXITCPW1f0T0P5AI=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=r0OGvdr4TGwqpcQ46zKs2ohVoXNC4FAngKHaLHd5VeSWoM0J9/FfkgKt+HkrsjrtV TyjXKHO9SS4+QvByynghMxhu3zsRcvR/VVzlQVpdt5yPLZt0YnTSWIqZdqf2KPFXeQ n10EgRqzohNXLsOnLbGb6YWPC4lJXQJGWllwjMlU= Received: by mail-it0-f47.google.com with SMTP id a195-v6so4518373itd.3; Tue, 26 Jun 2018 14:39:16 -0700 (PDT) X-Gm-Message-State: APt69E08V5ZQ+loC6zYCZq5LVl884N5GCCA/MhSTyDf1PxianvJGDpP2 oZ79ucHuPovn17J11iJrxGGh6tPEsByiOVkyxw== X-Received: by 2002:a24:798f:: with SMTP id z137-v6mr2750002itc.19.1530049155573; Tue, 26 Jun 2018 14:39:15 -0700 (PDT) MIME-Version: 1.0 References: <20180619212744.794-1-daniel@zonque.org> In-Reply-To: <20180619212744.794-1-daniel@zonque.org> From: Rob Herring Date: Tue, 26 Jun 2018 15:39:04 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH RFC 0/4] Adding DT functionality to w1 busses To: Daniel Mack Cc: zbr@ioremap.net, Mark Rutland , szabolcs.gyurko@tlt.hu, devicetree@vger.kernel.org, "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 Tue, Jun 19, 2018 at 3:27 PM, Daniel Mack wrote: > In order to fully move battery-supplied devices over to devicetree, the > onewire subsystem must get some updates. > > Currently, the w1 bus system works like this. Device families, such as > battery controllers etc, are registered to the w1 core. Once a master > device is probed, it starts scanning the bus. Slave devices that are > revealed through this scan and that match previously registered > families are then registered, and their .add_slave() callback is > invoked. > > Some devices, such as the ds2760, use that callback to call > platform_device_alloc() at runtime with a fixed device name to > instanciate their only user. That user does the actual work, while the > slave device merely functions as an I/O proxy. In the user > implementation, the w1 slave device is accessible through > dev->parent. Looks to me like you are letting the driver structure define the DT structure. This detail is all irrelevant to DT. > > Now, for devicetree environments, this has to change a bit. First, slave > devices need to have a matching table so they can be listed as sub-nodes > of their master bus controller. Second, the core needs to match the > entries in these tables against the sub-nodes of the master node. > These two are trivial to do. > > The next question is how the w1 slave device and its user(s) are linked > together. I'm proposing a DT layout with the following example: > > onewire { > compatible = "w1-gpio"; > > w1_slave: slave@0 { > compatible = "maxim,w1-ds2760"; > }; > }; > > battery-supply { > compatible = "maxim,ds2760-supply"; > w1-slave = <&w1_slave>; > }; This should just be one node and a child of the 1-wire master. Rob