From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2C5BC433DB for ; Mon, 18 Jan 2021 14:57:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 819AC22C7E for ; Mon, 18 Jan 2021 14:57:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405457AbhARO4v (ORCPT ); Mon, 18 Jan 2021 09:56:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405445AbhARO4X (ORCPT ); Mon, 18 Jan 2021 09:56:23 -0500 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48DB9C061574 for ; Mon, 18 Jan 2021 06:55:43 -0800 (PST) Received: by mail-ed1-x532.google.com with SMTP id u19so17925225edx.2 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=NGe6Ti4c9U7yxZFhwyZHjNQM0DbPTSxqIQhtBOGuGemkJ/HLfHZt9v4DAh37i/FDJF pJ1Az079ypFtyVZUnvYFmHb+O7VAPE4btpt8wh02WUdsdFQcksaNjGDjgthx7RrlN6Nb x5KTXLsb68R7sepPSqz5LrK0E8dhsaLQTi/PDv7v6aAfkoyTGMSQHKxbXYriRxUZjTKL PzouK3ih4YKZjO1+TGEYp5MNrUTkrgp3Q3BBojCLeR/9JOMHo5LwToKOaPq25D7bi+i5 PA5XjpfRZJLoD9PtBTszepHCOqUWctAJDn/+EA8LG9a78id8hvmDXb0d/QVGjNk7dhHI n1SA== X-Gm-Message-State: AOAM531n8cAk3Dxp+1l1Pce5ARduPUXTGhdVejSz4O2vKdmqGqv5MG2/ xijJVZ8BbehnKSd7/WbaV2ADe7bNuWcjN2TdUtfMjg== X-Google-Smtp-Source: ABdhPJy+a9+KdfIbj4llUoSCWn/X0q20L19eACDpfVzZgzCAWDztQO7cPFmXXFG84iqiR4H9I/Tc4icao+FF/ozbz+k= 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: netdev@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