Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp359992iog; Wed, 15 Jun 2022 03:53:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzFkBxetWviAXTQ9VU6okpvDdbgjt4+nwuq4GosKQ69nJR4C50pN7Wc+YLkegyR1YBEtTjJ X-Received: by 2002:a05:6a00:1305:b0:512:eb1e:7921 with SMTP id j5-20020a056a00130500b00512eb1e7921mr9235188pfu.13.1655290400073; Wed, 15 Jun 2022 03:53:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655290400; cv=none; d=google.com; s=arc-20160816; b=c89k0jENgELU0z1Wx2j55tBRnIV34vPa2dZVFM2BrkUKp9XE9opxef5DJhQmFd6Nq6 YI+Q7Hg8ouAxTScWErPIDicFS3Lrd5gWnZ+CbGhp31i/BRXm+zTFPj9uIP7bd6qXyEqZ gPpNZ+xtpALDb6GPKN+g/molnSUuXkjJlYnraUr5M34XwzSkuTdeia5DPLLNK8dStyRV O6rqufUnDWRk8QgBWyv0zq6Yx2+CWwq8pgA0qP+pY3+W65jMdVwF684JZ3R922HfgpGB v+XpMR9adKYxBidT2FvK5N15wqSrLVTQuJ0FwHKw0+iNQV7NsoWutUbnpP7/mf/rE696 Yg9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=TwNL81TDnzNrHDe4kyf91P59u1RxFP/pD8Vl+luV5e0=; b=BHX1LZJA2zfJmxXo/zYJVtpswZWEc+3d7dhVMfcbqR1VPDgmF1SrprX6LD851T9sEN i5CBBs4ZVU6EiHbD/PnO3gGEjIQF3+RyMajIjHB2krU2ZuiTefkYwaLU8i2GTN+8T+OV DtnXfLzOSDVSwrng+BPyP2Pb3OCAEkq8WVfbFoetxOkwfl3EddGgEEmoRmKT5Qo7bK8G V67CiMLp4dzICb1DTPxN51ftpXVDWns1KmCwZrJIX/3VCMa439GJqs6G5z6uFVAgq9Uu yopXwV0hXtaeq4VQAymdb4dRI4I5Y7d56szICfTUY+3BUpJrZX0RSr8SlImM85RfyyT7 lLxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=MhAG4iha; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o3-20020a17090a420300b001e3022c3e0bsi2061092pjg.30.2022.06.15.03.53.07; Wed, 15 Jun 2022 03:53:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=MhAG4iha; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347204AbiFOKYC (ORCPT + 99 others); Wed, 15 Jun 2022 06:24:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347519AbiFOKYA (ORCPT ); Wed, 15 Jun 2022 06:24:00 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FE761129; Wed, 15 Jun 2022 03:23:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655288639; x=1686824639; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=HquhvexWsP/f5gyfcKiimGA3mEzHOd3dzsAoIQLW4hk=; b=MhAG4ihaQAWOQCsXGwEim98sVcWMtqzvTdE1Ge+g4gCLUKvp6pDBntTg tX29IKV6H6wCXtyM6ZYd08JgOHWv4K1iN7Zl9p1neX1bADudh4zXcuOQO ebEovQtJbfbN2+Qrztmvv3pLOLUyWDGZnoNEcGIZGFNnFqDhjXz0AJq3O CfAtFJ1DOF4WvixThaEnIZaeloQuiRfSBlVchuFAKanla43CTavdmckFL JYtNgjCnHJUukonTNm6DjqqjFpA1hXC7wVEqe1zMb4iEUacH7L6V2V9Xc s2etVTyUiRM1myt4CKBD7IAqr0WxaA4roOQ5vusJuYBv9al0Id/T/j262 Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10378"; a="261937221" X-IronPort-AV: E=Sophos;i="5.91,300,1647327600"; d="scan'208";a="261937221" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jun 2022 03:23:58 -0700 X-IronPort-AV: E=Sophos;i="5.91,300,1647327600"; d="scan'208";a="674421180" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jun 2022 03:23:56 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.95) (envelope-from ) id 1o1QBl-000dIK-SV; Wed, 15 Jun 2022 13:23:53 +0300 Date: Wed, 15 Jun 2022 13:23:53 +0300 From: Andy Shevchenko To: Dinh Nguyen Cc: jarkko.nikula@linux.intel.com, mika.westerberg@linux.intel.com, robh+dt@kernel.org, krzk+dt@kernel.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: Re: [PATCHv3 1/2] i2c: designware: introduce a custom scl recovery for SoCFPGA platforms Message-ID: References: <20220613210032.773826-1-dinguyen@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 15, 2022 at 01:18:55PM +0300, Andy Shevchenko wrote: > On Mon, Jun 13, 2022 at 04:00:31PM -0500, Dinh Nguyen wrote: The below won't fly, see my corrections below. > static int i2c_dw_init_socfpga_recovery_info(struct dw_i2c_dev *dev, > struct i2c_bus_recovery_info *rinfo) > { > rinfo->recover_bus = i2c_socfpga_scl_recovery; > return 0; return 1; > } > > static int i2c_dw_init_generic_recovery_info(struct dw_i2c_dev *dev, > struct i2c_bus_recovery_info *rinfo) > { > struct i2c_adapter *adap = &dev->adapter; > struct gpio_desc *gpio; > > gpio = devm_gpiod_get_optional(dev->dev, "scl", GPIOD_OUT_HIGH); > if (IS_ERR_OR_NULL(gpio)) > return PTR_ERR_OR_ZERO(gpio); > > rinfo->scl_gpiod = gpio; > > gpio = devm_gpiod_get_optional(dev->dev, "sda", GPIOD_IN); > if (IS_ERR(gpio)) > return PTR_ERR(gpio); > rinfo->sda_gpiod = gpio; > > rinfo->recover_bus = i2c_generic_scl_recovery; > > dev_info(dev->dev, "running with gpio recovery mode! scl%s", > rinfo->sda_gpiod ? ",sda" : ""); > > return 0; return 1; > } > > static int i2c_dw_init_recovery_info(struct dw_i2c_dev *dev) > { > struct i2c_bus_recovery_info *rinfo = &dev->rinfo; > struct i2c_adapter *adap = &dev->adapter; > int ret; > > switch (dev->flags & MODEL_MASK) { > case MODEL_SOCFPGA: > ret = i2c_dw_init_socfpga_recovery_info(dev, rinfo); > break; > default: > ret = i2c_dw_init_generic_recovery_info(dev, rinfo); > break; > } > if (ret) /* The recovery is optional, that's why 0 should be returned to the caller */ if (ret <= 0) > return ret; > > rinfo->prepare_recovery = i2c_dw_prepare_recovery; > rinfo->unprepare_recovery = i2c_dw_unprepare_recovery; > adap->bus_recovery_info = rinfo; > > return 0; > } -- With Best Regards, Andy Shevchenko