Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2478916pxb; Mon, 18 Jan 2021 20:36:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJwr72jRs9N3/p5oF/2CB7STDx/6wdfNaw45MB76HVErTWRa8YskN8RiL3soasQ+0FQ3z92k X-Received: by 2002:a05:6402:104e:: with SMTP id e14mr1988015edu.316.1611030974384; Mon, 18 Jan 2021 20:36:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611030974; cv=none; d=google.com; s=arc-20160816; b=BSycgmQO+P456aQmiXr4qEwtVWWhljrg4zhs39GatSKOtrLQwnlNkCIYOBEh/Nx1D+ tz+0IFdts+L+jgRkXn1M4WSCMkkvpJ8aTlz4SHaTd8QvCSzEg/VDNn59teYaipwnqkCb K4NyhNJR59A1/DgepyUQgshVJv9KvrtuLFdlsYPmv/kxQgkAXfESlid1Q2qsXVfKYtp1 GA1PmErSYykJoLxTzBj61BfIduOT1S5SqGCIXFtIRzP9Df60Y5uxDYqX2NCnbftXWM1+ 3zJx9ZCCT4lrLj/JyUsSJofEk68mbBxmNSyuS3Hp7YIIZuq0RqL+JI3CaPUsYjL8xxT5 /Ehg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=09OWnlfXjcogYNVXeufU+daH3KK6SF0uozk3EDI2xc0=; b=0dyWBLijyEcRczQNoMGApusyzjGF8vzWo32VLHTWan0HWXaXf4sO2tbmOy02bHLmsn 5s7KUZ+mQs+8v1mSmfCfVYQJMu9njGEBFrJHi6QesLPHbDweF/Sn4mpNlC5qF/J9I9Nt CXg3dEZyTVtfnJNhNILKxNHloaLjGrtnA7Ol28aEqm7XUS3ZoJghDirRhGE5YpE5vyZe OGZ6AsBNva6dxdHgjDzVJFEYB/1tcYF/pdNTREOmcgrykaVFQ1gYTDpRkohvn4yyrGWN gVhxp1WE7+ienRQXV3Pjigk6S7PQM//SWYRrna8bg7vtDN5VwCcsmzKlOyNcwNkLcUf7 buCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ev4ise7m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id um29si7263423ejb.722.2021.01.18.20.35.51; Mon, 18 Jan 2021 20:36:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ev4ise7m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405323AbhARO4l (ORCPT + 99 others); Mon, 18 Jan 2021 09:56:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405446AbhARO4X (ORCPT ); Mon, 18 Jan 2021 09:56:23 -0500 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B8EEC061575 for ; Mon, 18 Jan 2021 06:55:43 -0800 (PST) Received: by mail-ed1-x52a.google.com with SMTP id bx12so3892575edb.8 for ; Mon, 18 Jan 2021 06:55:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=09OWnlfXjcogYNVXeufU+daH3KK6SF0uozk3EDI2xc0=; b=Ev4ise7mk+YfkUErtOqsnwcDFyrMpCScNp5Psyu6jm+IHZGb5AwxdoGBoXxuFX61mn v2wNMdPzRA6DGQ8J8z4yP8QZBUdxpmSc05ndX3QWTS6XRi52tsQwLDjoAaMSXQn7zPLo PsvzPQv221Crp/lfaRs//J6sa5jk4TF72mUxit1qwocnPg4B8nnuhf0d4TM0t7cDiQ0F JcXBLfrE+G/mFv1ucW2UAxMuvZZbQWbewZ2DpHcPPDqqkxwgBbCEy2W4Wk+jD/4X+8xJ ficH1ht6iUzOuUBsJ5itApxU1eCDRDbauNKd7+kNvcME5dJbo+1Odl9v0dDFzTN1mZy/ RBeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=09OWnlfXjcogYNVXeufU+daH3KK6SF0uozk3EDI2xc0=; b=pTalj51f4XZRzJnqdJGFtpsPyiss82VPaFGQqxQVyAMRtKVjxEy38rsOroRrI45wjP Tn+5YrCDrDySlTfxaH9mwTlaS3cDOZvY9FeWyYMd3eZLHMSMZ7UBAKPun0/vKyI5zGm6 mdcFgWjbxOKv2DYpsVNOVd4ST7gCtENgTOcUN+2X8m+DTcSKpZFnzCJIm4l2q7gsunrR UBkQtzEYsalCFx/B/8jZUfmrIsL9NyeBQqqI6SYqnqOiWmyl3xjm4aNSUkGqcNUFaBAI 62gD+jOfVWyV7YmYtvs4uoWRykYWogopAx26DInuVCVl1ZE0gJIJkaS4zU6KnYi1Vu+L /G5Q== X-Gm-Message-State: AOAM530AFCVwerRLsNM1Ed+bars/M4L8MSv4sKDsLTa6XIEqNqujU0rk 9gow/118k43j3uIK0GRc3AX9krYliSebv2uac6ZEWw== X-Received: by 2002:a50:d6dc:: with SMTP id l28mr19968203edj.105.1610981741946; Mon, 18 Jan 2021 06:55:41 -0800 (PST) MIME-Version: 1.0 References: <20210111054428.3273-1-dqfext@gmail.com> <20210111054428.3273-3-dqfext@gmail.com> In-Reply-To: <20210111054428.3273-3-dqfext@gmail.com> From: Linus Walleij Date: Mon, 18 Jan 2021 15:55:30 +0100 Message-ID: Subject: Re: [PATCH net-next 2/2] drivers: net: dsa: mt7530: MT7530 optional GPIO support To: DENG Qingfang Cc: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Jakub Kicinski , Rob Herring , Matthias Brugger , Sean Wang , Landen Chao , Philipp Zabel , Russell King , netdev , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Linux ARM , "moderated list:ARM/Mediatek SoC support" , "linux-kernel@vger.kernel.org" , =?UTF-8?Q?Ren=C3=A9_van_Dorst?= , Frank Wunderlich Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 11, 2021 at 6:46 AM DENG Qingfang wrote: > MT7530's LED controller can drive up to 15 LED/GPIOs. > > Add support for GPIO control and allow users to use its GPIOs by > setting gpio-controller property in device tree. > > Signed-off-by: DENG Qingfang Double-check the initial output conditions as indicated by Russell, if you really want to be thorough, use an oscilloscope but check the specs at least. > +static u32 > +mt7530_gpio_to_bit(unsigned int offset) > +{ > + return BIT(offset + offset / 3); > +} So for offset 0..14 this becomes bits 0, 1, 2, 4, 5, 6, 8, 9, 10, 12 ... 18 What is the logic in this and is it what you intend? Please add a comment explaining what the offset is supposed to become for offsets 0..14 and why. > + gc->ngpio = 15; And it really IS 15 not 16? Not that I know network equipment very well... Yours, Linus Walleij