Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3121376imm; Fri, 24 Aug 2018 10:54:23 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaezbTDW0m4YAnlIPRaUUm5OToEQZ8yGxmCVB27G2iHQRBqbbxCs0oQwXf8JdplP9fdIKmV X-Received: by 2002:a62:201b:: with SMTP id g27-v6mr3036567pfg.253.1535133263283; Fri, 24 Aug 2018 10:54:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535133263; cv=none; d=google.com; s=arc-20160816; b=o7yRp3lq1WMKLTi2UizZ5TNG8XhL0y3GBWEpQMYevjcukMXnfk5PSBhmY8gxlBH5IM 5NjijSEOron2ox4bPJOG26WCWhtBJ5gpEQ/HTbRfSvIe/KSSkKLviHF9vXn7W3Ub8LpE wfhRImNxekFnP6Rf6TYPn4pFAVKDCLjDobJacwtqUrs0Hu9R7cdlbMND9+KXv9AM+aRW X8dgMZfdYn6hq6jE6TL3xe/kxlpx0oHbBVwEiKrbuQRMoVdtqdHTpt4SlaXzk1aPjTDD ckof4E37tunO/Zb/A4PqXzWZ1K78bFnW78KImRd4bGqW9uTvzI4PQjHWMSXZijriKe0g mmYg== 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=s+iTPN6p+odsUGvcF9UKLMrlVfmUwBa1+UfWEmd+Pa8=; b=iWZGh1FK3PXWAIH+8vVWDXiSQFYL3JmSuGjS/Kbi+LXV/rqtLh2LOjE7YdTRvE7hLG QY/4mK00TIZ8dhe2QJZqmcSdgwh6YrhaHe84TcPrdX4lElsqWolk4qNqHvXzho9Yjur8 u49u/ZuQlGDv0z3EBh8J6mmncbpqE/NyNcY1dmSwU5j9jcaIqPJuHpUgYrNwKxh4G5hl TE3eybp/aMPi9vxo9B4MFqFTq9gSUb1k+Uywr4hjZsWupUjz6yOlohX+QFlGMNj4oTZL kQFOxeLfb4qgsMImiiRMVxdQtaKZvYblqq5JJ09GH3+RY1Yy6OT35mnP+QyeUyuc/NFB Yagw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=ibJAnnrv; 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 n9-v6si7462200pgm.226.2018.08.24.10.54.07; Fri, 24 Aug 2018 10:54:23 -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=ibJAnnrv; 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 S1727610AbeHXV2m (ORCPT + 99 others); Fri, 24 Aug 2018 17:28:42 -0400 Received: from smtprelay2.synopsys.com ([198.182.60.111]:38544 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726601AbeHXV2m (ORCPT ); Fri, 24 Aug 2018 17:28:42 -0400 Received: from mailhost.synopsys.com (mailhost2.synopsys.com [10.13.184.66]) by smtprelay.synopsys.com (Postfix) with ESMTP id 571ED10C1BAC; Fri, 24 Aug 2018 10:53:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1535133182; bh=pU6Vt7axWq5CX5naq7DXYQ1wFeapZtzLGaLvIpFHHmw=; h=Subject:To:CC:References:From:Date:In-Reply-To:From; b=ibJAnnrvg8P17BDi0++Rgi4Z2v0FiZn9LFgtcmpozeiUw6RpBSBsfrlrSIUFN6FMd 9MdOQhFRDVw1Xp5aC72BwoIjjeEx7C8GPc/UmjJ4AyLW7lPqpxjw/WZo3GZzRqTSoI pfrkVDGxVc1vJU60xoAIo+1TqB3lNkREqKI+P1yxe00TScEuLES7uyEuab3NF/4YYN RMQdQnF64QRd05NfuANVbhq1FYxrPRtlhN8zlalPFiNOHgWmBnKNKmts7sMyCJTpfS Q4se1IrEf0GhdoHdO7ep/Vv+d9mQ7pmY55VsQ2Cd5uPmni5zIXe5wRS08lUxUnBQLW bCkl/IyCDl/KA== Received: from us01wehtc1.internal.synopsys.com (us01wehtc1-vip.internal.synopsys.com [10.12.239.236]) by mailhost.synopsys.com (Postfix) with ESMTP id 5817B3CB3; Fri, 24 Aug 2018 10:52:58 -0700 (PDT) Received: from DE02WEHTCB.internal.synopsys.com (10.225.19.94) by us01wehtc1.internal.synopsys.com (10.12.239.231) with Microsoft SMTP Server (TLS) id 14.3.361.1; Fri, 24 Aug 2018 10:52:58 -0700 Received: from DE02WEHTCA.internal.synopsys.com (10.225.19.92) by DE02WEHTCB.internal.synopsys.com (10.225.19.94) with Microsoft SMTP Server (TLS) id 14.3.361.1; Fri, 24 Aug 2018 19:52:56 +0200 Received: from [10.0.2.15] (10.107.25.66) by DE02WEHTCA.internal.synopsys.com (10.225.19.80) with Microsoft SMTP Server (TLS) id 14.3.361.1; Fri, 24 Aug 2018 19:52:55 +0200 Subject: Re: [PATCH v6 01/10] i3c: Add core I3C infrastructure To: Boris Brezillon , vitor , , Sekhar Nori CC: Wolfram Sang , , "Jonathan Corbet" , , Greg Kroah-Hartman , Arnd Bergmann , 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" , , , Geert Uytterhoeven , Linus Walleij , Xiang Lin , Przemyslaw Gaj , Peter Rosin References: <20180719152930.3715-1-boris.brezillon@bootlin.com> <20180719152930.3715-2-boris.brezillon@bootlin.com> <20180824143934.6d6b6487@bbrezillon> From: vitor Message-ID: Date: Fri, 24 Aug 2018 18:52:52 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180824143934.6d6b6487@bbrezillon> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [10.107.25.66] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Boris, On 24-08-2018 13:39, Boris Brezillon wrote: > Hi Vitor, > > On Wed, 22 Aug 2018 17:43:34 +0100 > vitor wrote: > >> Hi Boris, >> >> >> On 19-07-2018 16:29, Boris Brezillon wrote: >>> +int i3c_bus_register(struct i3c_bus *i3cbus) >>> +{ >>> + struct i2c_dev_desc *desc; >>> + >>> + i3c_bus_for_each_i2cdev(i3cbus, desc) { >>> + switch (desc->boardinfo->lvr & I3C_LVR_I2C_INDEX_MASK) { >>> + case I3C_LVR_I2C_INDEX(0): >>> + if (i3cbus->mode < I3C_BUS_MODE_MIXED_FAST) >>> + i3cbus->mode = I3C_BUS_MODE_MIXED_FAST; >>> + break; >>> + >>> + case I3C_LVR_I2C_INDEX(1): >>> + case I3C_LVR_I2C_INDEX(2): >>> + if (i3cbus->mode < I3C_BUS_MODE_MIXED_SLOW) >>> + i3cbus->mode = I3C_BUS_MODE_MIXED_SLOW; >>> + break; >>> + >>> + default: >>> + return -EINVAL; >>> + } >>> + } >>> + >>> + if (!i3cbus->scl_rate.i3c) >>> + i3cbus->scl_rate.i3c = I3C_BUS_TYP_I3C_SCL_RATE; >>> + >>> + if (!i3cbus->scl_rate.i2c) { >>> + if (i3cbus->mode == I3C_BUS_MODE_MIXED_SLOW) >>> + i3cbus->scl_rate.i2c = I3C_BUS_I2C_FM_SCL_RATE; >>> + else >>> + i3cbus->scl_rate.i2c = I3C_BUS_I2C_FM_PLUS_SCL_RATE; >>> + } >>> + >>> + /* >>> + * I3C/I2C frequency may have been overridden, check that user-provided >>> + * values are not exceeding max possible frequency. >>> + */ >>> + if (i3cbus->scl_rate.i3c > I3C_BUS_MAX_I3C_SCL_RATE || >>> + i3cbus->scl_rate.i2c > I3C_BUS_I2C_FM_PLUS_SCL_RATE) { >>> + return -EINVAL; >>> + } >>> + >>> + dev_set_name(&i3cbus->dev, "i3c-%d", i3cbus->id); >>> + >>> + return device_add(&i3cbus->dev); >>> +} >> During the tests of the bus with i2c devices I found the i2c_dev_desc >> objects aren't allocated before this function. This cause i3cbus->mode = >> I3C_BUS_MODE_PURE. > I just checked and DT parsing (+ I2C descs creation) is done before > i3c_bus_register() is called, so we should be good. How did you declare > your I2C devices (right now, only DT declaration is supported). During the DT parsing, you create the i2c_dev_boardinfo. the i2c_dev_desc is created in i3c_master_bus_init() which is after the i3c_mater_create_bus(). One possible way to fix this is to pass master also to i3c_bus_register and iterate over i2c_dev_board_info list. >> I want to do something for the slave and secondary master, do you >> already have infrastructure that you can share? > What do you mean? > > Regards, > > Boris I want start to add the secondary master functionality but it is also necessary to add the infrastructure to the subsystem. So, to avoid duplicated work can you share your plans for the secondary master? Best regards, Vitor Soares