Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp127335imm; Thu, 28 Jun 2018 16:20:10 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIVgwZL8S1ilj4EC3+ZvWOSRtlCar0DSROCATMUg8tPKX6+FI9R1d54IRCsLRj7I0SRoDm9 X-Received: by 2002:a17:902:b20d:: with SMTP id t13-v6mr12546124plr.121.1530228010030; Thu, 28 Jun 2018 16:20:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530228009; cv=none; d=google.com; s=arc-20160816; b=nCqRIUDQpg7xqoVaiK2/dNsJcZ5i97AU0XmKZ4l3S+YOjN4Nif63yJh5NhvN4sToi9 K/0so9CzyJTx/LU6LkpkRA95NdtIvwlJE///d1zSCwIfhvrp7pKKiRX15TuAcW9TqCq/ IeabMM66d+Y3FlxLS3lco8Z5/pLJbFdFZHHurA016CrUxV9UlDJ9v1EU1tLN1j/mZv4E dMbF4WNHPtB6pUI5cEXo3l7+/otuFHubgOM0Pls6fqiT6mHqSKy1kow2j6z6MNNCIHzn 60qLC1vn34+VjPVpb0sWsp4DSHOBt7uE11gFbnYybSn5mDHsC1i6eks2POGBYmlduE3O KSWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=T62JFXDgaBeNeQC2RaOZWATzy1iMNWV4vwsjCL5HG9U=; b=nHca++rW0cgd/X8axsw03KHohUUgjhIrs7nucZ+Csx/b3fH/FBJlmMp/ZPxG4MPrsX Z/vrP6OFwVbI9MW8QmAVW1Ans0mFAXWh6eEMy/keajZ4XvE+JNoZvZagFrRCEiLJqXUG qkHnB3uIkS+qdJ6sBqNVs33OLCmfW96tyopy6GJ/QbJEYMsBsFqLn/BERi9TBPx9cOkx WPqMeZAOu1ZCCbbbA76zGLAipWXIIp94raniVUiXtYWO46o5MjQll6LkbtAv/3hlOjgX TtRrWE1gcoRwg7tLAW2Dyw0E9kit4Olk3U+X1kZyv87kmW4Ektq5B8TBWDTcz1dqeNAz 6yZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=MK26VK39; 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=synopsys.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c4-v6si8280198pfk.361.2018.06.28.16.19.24; Thu, 28 Jun 2018 16:20:09 -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=@synopsys.com header.s=mail header.b=MK26VK39; 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=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935450AbeF1PjY (ORCPT + 99 others); Thu, 28 Jun 2018 11:39:24 -0400 Received: from smtprelay.synopsys.com ([198.182.47.9]:51157 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934364AbeF1PjU (ORCPT ); Thu, 28 Jun 2018 11:39:20 -0400 Received: from mailhost.synopsys.com (mailhost2.synopsys.com [10.13.184.66]) by smtprelay.synopsys.com (Postfix) with ESMTP id 855C124E1150; Thu, 28 Jun 2018 08:39:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1530200360; bh=wO8lm6gnGh5gksVx9oLMnLEtrQdBWOJZb9Oxq00burE=; h=Subject:To:CC:References:From:Date:In-Reply-To:From; b=MK26VK395HRa6pRt9A0QlCD6PWqh60PziSZMsS9qY+M03r9Ia5wzjfnIaWkCrTkc9 pNfDmABtwpLVAaUkUdMtq8v5zVYFGCbTe6o/MUUvhFYBG5hNdwrqOXL58YbiU8RMa+ ZK7D2EvHNUK35HdusNRSrJVWYfJUC6847ahyvC3hNM8VkZEXyn5Kxt0eM0W2qt1+Ot GB8y8pusr2FminDyrz2IVxfCbZ0zZQfwFM0suGF4vLAVHIBhr4LojJE6vSP64JVtgf zluD7iAetmreci8JRAbGVe1ym8aZz+XZeXOzGAN2GUcKZOIAznZgzkdtgBBFkLn2E7 YVa9Wv6IaNkOw== Received: from us01wehtc1.internal.synopsys.com (us01wehtc1.internal.synopsys.com [10.12.239.235]) by mailhost.synopsys.com (Postfix) with ESMTP id BEC7C3BE9; Thu, 28 Jun 2018 08:39:16 -0700 (PDT) Received: from DE02WEHTCA.internal.synopsys.com (10.225.19.92) by us01wehtc1.internal.synopsys.com (10.12.239.231) with Microsoft SMTP Server (TLS) id 14.3.361.1; Thu, 28 Jun 2018 08:39:16 -0700 Received: from DE02WEHTCB.internal.synopsys.com (10.225.19.94) by DE02WEHTCA.internal.synopsys.com (10.225.19.92) with Microsoft SMTP Server (TLS) id 14.3.361.1; Thu, 28 Jun 2018 17:39:14 +0200 Received: from [10.0.2.15] (10.107.25.57) by DE02WEHTCB.internal.synopsys.com (10.225.19.80) with Microsoft SMTP Server (TLS) id 14.3.361.1; Thu, 28 Jun 2018 17:39:14 +0200 Subject: Re: [PATCH v5 01/10] i3c: Add core I3C infrastructure To: Boris Brezillon , Wolfram Sang , , Jonathan Corbet , , Greg Kroah-Hartman , Arnd Bergmann CC: Przemyslaw Sroka , Arkadiusz Golec , Alan Douglas , Bartosz Folta , Damian Kos , Alicja Jurasik-Urbaniak , Cyprian Wronka , Suresh Punnoose , Rafal Ciepiela , Thomas Petazzoni , Nishanth Menon , Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , "Kumar Gala" , , , Vitor Soares , Geert Uytterhoeven , Linus Walleij , Xiang Lin , , Sekhar Nori , Przemyslaw Gaj References: <20180622104930.32050-1-boris.brezillon@bootlin.com> <20180622104930.32050-2-boris.brezillon@bootlin.com> From: vitor Message-ID: <088dc947-da66-cec9-44a8-0f1097690bfd@synopsys.com> Date: Thu, 28 Jun 2018 16:38:56 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180622104930.32050-2-boris.brezillon@bootlin.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Originating-IP: [10.107.25.57] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Boris, On 22-06-2018 11:49, Boris Brezillon wrote: > +static int of_i3c_master_add_i3c_dev(struct i3c_master_controller *master, > + struct device_node *node, u32 *reg) > +{ > + struct i3c_device_info info = { }; > + enum i3c_addr_slot_status addrstatus; > + struct i3c_device *i3cdev; > + u32 init_dyn_addr = 0; > + > + if (reg[0]) { > + if (reg[0] > I3C_MAX_ADDR) > + return -EINVAL; > + > + addrstatus = i3c_bus_get_addr_slot_status(master->bus, reg[0]); > + if (addrstatus != I3C_ADDR_SLOT_FREE) > + return -EINVAL; > + } > + > + info.static_addr = reg[0]; > + > + if (!of_property_read_u32(node, "assigned-address", &init_dyn_addr)) { > + if (init_dyn_addr > I3C_MAX_ADDR) > + return -EINVAL; > + > + addrstatus = i3c_bus_get_addr_slot_status(master->bus, > + init_dyn_addr); > + if (addrstatus != I3C_ADDR_SLOT_FREE) > + return -EINVAL; > + } > + > + info.pid = ((u64)reg[1] << 32) | reg[2]; > + > + if ((info.pid & GENMASK_ULL(63, 48)) || > + I3C_PID_RND_LOWER_32BITS(info.pid)) > + return -EINVAL; > + > + i3cdev = i3c_master_alloc_i3c_dev(master, &info, &i3c_device_type); > + if (IS_ERR(i3cdev)) > + return PTR_ERR(i3cdev); > + > + i3cdev->init_dyn_addr = init_dyn_addr; > + i3cdev->dev.of_node = node; > + list_add_tail(&i3cdev->common.node, &master->bus->devs.i3c); > + > + return 0; > +} > + I'm writing the driver for the Synopsys master and but now I getting an issue. I use the "slot" of the device to do all transfers, something like you use in DAA. I using the master_priv to save the "slot" per device but the problem is when I call the i3c_master_add_i3c_dev_locked() to retrieve the info I don't have it yet. From my analysis this can be solve with:     - send PID, BCR and DCR when I call i3c_master_add_i3c_dev_locked() or similar function.     - Pre-allocate an i3c_device -> attach it (slot data goes to master_priv) -> retrieve info -> if there is already an i3c_device with same PID destroy the pre-allocated one.     - Replace the info.dyn_address with a structure with dyn_address and slot and use it in CCC structure. This is something that will need to be supported for I3C HCI spec too. Do you have any suggestion? Best regards, Vitor Soares