Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2799310imm; Fri, 24 Aug 2018 05:41:09 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZxm8AQXCX8qyozGEA/v7zEj+Ti58sDV/oI64rGEjOnbfKoBPKKYhC3Tv0CzzbLjTfzdYbI X-Received: by 2002:a63:60c1:: with SMTP id u184-v6mr1596773pgb.266.1535114469031; Fri, 24 Aug 2018 05:41:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535114469; cv=none; d=google.com; s=arc-20160816; b=qkxlo83kENL+WgGCGHeoZCmlkUeelUUUWojx9IfTXJ0X7HXVhFU+L+j1uqmz1cxZwE HKeZFzB/7qE0h8OGe6R/Sb2mmqPjwxdP3IbyMgxPIvvHW0DI0eDFKsXru510dIKWKZQf 4VCc3Nuf9Pw4BZmOsr/gPCEOwBUrqXahaxqQyvyQlK5CnP2cYwU82K6TSxf6Nt1q1a2/ G5F7Mqb1nDKjPCI8LIpfp5ky+/SYGV/vbW/kn8w41a0UJuzLAY8e3Szo0uJPpdTp46L7 rA5o+8lGdamRDyCyR9UrUw5q0PWtypr2IKmvAibSyGy4adASqA/Vb6H9dsGE24B0xLey 6smQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=d1zJjl+Cqkz7kpWzQQ/+ts9Sxx8CImFX5Nt2z2C2kWQ=; b=06Juyph1N3peJ5zXXTM4d6oA1bZ5bZvFn+l1EpRWbfCJwHaM9ks+KegOSpid1F6g+6 Rj7R5hx4Oi49NTSX1CeQk2oUQ/lkT5oKZUeddroQYVXF3M52HClSmQ9ldS3wkhwDT+3e uHh82UvovjKNQ35V6Pgz9w0Qf/vsyaMOUXT5NXhohJqvo7ibdSYqEHqynlSlmvMYlT8c A8uPnYldnS5lwHS25hmhKN3Fpnc/p5pxQKLriGBqGPzooWwJXP3BN64DtHcToFIydFoY S+BPumjYI373SjVobUS+BW9s4Ch7wQwhLhNzQ7aWNFy/i+pvbjjPR+t42AHvTErT08az cVAg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33-v6si6948998ply.251.2018.08.24.05.40.53; Fri, 24 Aug 2018 05:41: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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727101AbeHXQOR (ORCPT + 99 others); Fri, 24 Aug 2018 12:14:17 -0400 Received: from mail.bootlin.com ([62.4.15.54]:47757 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726504AbeHXQOR (ORCPT ); Fri, 24 Aug 2018 12:14:17 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id C8B7322A39; Fri, 24 Aug 2018 14:39:46 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.0 Received: from bbrezillon (AAubervilliers-681-1-53-19.w90-88.abo.wanadoo.fr [90.88.170.19]) by mail.bootlin.com (Postfix) with ESMTPSA id 1B60B206DE; Fri, 24 Aug 2018 14:39:36 +0200 (CEST) Date: Fri, 24 Aug 2018 14:39:34 +0200 From: Boris Brezillon To: 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 Subject: Re: [PATCH v6 01/10] i3c: Add core I3C infrastructure Message-ID: <20180824143934.6d6b6487@bbrezillon> In-Reply-To: References: <20180719152930.3715-1-boris.brezillon@bootlin.com> <20180719152930.3715-2-boris.brezillon@bootlin.com> X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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). > > 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