Received: by 2002:ac0:cd04:0:0:0:0:0 with SMTP id w4csp229920imn; Fri, 1 Jul 2022 13:51:12 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uadVtZPl6uqai2+6Ia+vZaeSEVBgFtOrG771MJxE6MOC57neyn28qIpu9kwpAgUmaSPmhg X-Received: by 2002:a05:6402:34c8:b0:437:74d5:f8df with SMTP id w8-20020a05640234c800b0043774d5f8dfmr21262569edc.274.1656708672096; Fri, 01 Jul 2022 13:51:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656708672; cv=none; d=google.com; s=arc-20160816; b=mTxonxrMTFT0DVJ2xEv26op22uF6qxvbxiMnLCQ68R0B+u32eksUbdzz6wV6Oo4UHH 6Wbn/SL9a89ui2d2NUmXaVaHDto0zPoB1Dywwkf4DqFnEOmZTwZbSHT+FA9bhUPOz/hh XNZJcgMIlwNQEDas1X7sCtPZ/1Glkap1vtQE1XJBNg9CrjXi1lEgWI3Jwgd7Hy9N3hIQ o8U28HyKO8yfNfk2CE+6DdHu40B3M8hvSbwpmO+GO5/Uh9KTolxBlN3S3NDteF6m/oXu ISIJ0Aeo9VzBXbplBbKLVXCdjmzBi6JPXeSIRNC3fWHeQ1UgMnB9hj9QgCMG5l1SWd7z F40w== 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=Vmpdhz2MZms21RljAHKQJe5ukt7DpuDeSaFEOMnP2tg=; b=kzN4hdXj4U8jxDo/tgDeDTV/xSkF7UpBcoFPM1LJsXWkCZd/isGVOsSZ8Sp9+0C0dS IqSqu+q42bzzCjlBKadjhmWi03hJyVA4Nx+NUCv6AfZfRewmabqbYpKr863BzNY2EZmA x0Ia3bUlLhCxoIXvgQMA8n9zzpzjRZFSbRnfPkfYIiZ2T6ez8My39ZO1YUopozQqalKY TV8jnpvQAnpeypv1lsRcROK4u7mcaYU/03URrvW4ZR1o1umWLkUd/WFVYp9oimqFJWXb +UTq6wl1aMPGMjfSc9xqwMoz+eXbg/3FkIjde5StODmTtIBvH4l/FEptt76zn9vQyver lpQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=OHthEuiG; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h7-20020a17090619c700b006fec302305asi7699939ejd.281.2022.07.01.13.50.46; Fri, 01 Jul 2022 13:51:12 -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=@gmail.com header.s=20210112 header.b=OHthEuiG; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231607AbiGAUj0 (ORCPT + 99 others); Fri, 1 Jul 2022 16:39:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230497AbiGAUjZ (ORCPT ); Fri, 1 Jul 2022 16:39:25 -0400 Received: from mail-yb1-xb2e.google.com (mail-yb1-xb2e.google.com [IPv6:2607:f8b0:4864:20::b2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 694935A2D9; Fri, 1 Jul 2022 13:39:24 -0700 (PDT) Received: by mail-yb1-xb2e.google.com with SMTP id o19so5977830ybg.2; Fri, 01 Jul 2022 13:39:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Vmpdhz2MZms21RljAHKQJe5ukt7DpuDeSaFEOMnP2tg=; b=OHthEuiGA0aw0q3wK0vCa25L6+8RrWXc+L3SxWr/oP5eTN+QlIlRI4dCxxuWyn7cWi BXjq76rdjYJdx/oOOWcAnPikEXvJrSqeOB31Me2F0asjXUGMTrrxbmJlb8caVC1Up9m8 vpyOEY/h+2nphaFjowQnRxgO2BPNfsBJ5mMxRH8cwygRLznaSbhvRW9mf4MnHVvyNm+2 o34c0T3JpNjpFgQlFId/4mZaa89u7cRCdtNDX06Cw6IwEuOvWYipi9itXyfn6rfB2D58 JnIpLj01BuGh8F/bPRfj/Cdc+ntjq7mwMya/W0DoUVLEZ/imHP2C+TcPpvuw9vIMxqnk XGnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Vmpdhz2MZms21RljAHKQJe5ukt7DpuDeSaFEOMnP2tg=; b=xIxpfmLHFFKkZ7s5Vw5WCkGrlzjfMZSOcmVCPn5FfqpJCp3INMqLaMYaTCvSdiYO0W kXvD9alcnjRkdNNjOb7QJwdI3QP8Y6cz2RB0ztlNgLeUqz1+PMBAVze7tvOmt+LMwlGX H3gjI8hbSYgjfVUusMOPG/yTO2LDrUt+y2NTWpAndhMvZAdgAdpNZamak9p/ZP5Om96l zowwagS0lM4qOpqtBXBv2kNqGyJ7xB55QNjCfo9wrMuCWVtNP3WdPFfxdlP4jgUEo3t3 XmT7WYP5j+MufnBIcr5Qt3w/PxyBIMxda0mq/LcUC9tgzN8NqDIr5rRbWd0jcoyZnKCa lT0w== X-Gm-Message-State: AJIora8Z/bv+qU8IqRXIybKipKir8GcbIfzfm/nRh80shrIEO554PtDo pS5h4fOsuCtduE5Sa891P0sPWkNZGn2rJCk+N50= X-Received: by 2002:a05:6902:10c9:b0:668:e27c:8f7 with SMTP id w9-20020a05690210c900b00668e27c08f7mr17229851ybu.128.1656707963560; Fri, 01 Jul 2022 13:39:23 -0700 (PDT) MIME-Version: 1.0 References: <20220701192609.3970317-1-colin.foster@in-advantage.com> <20220701192609.3970317-10-colin.foster@in-advantage.com> In-Reply-To: <20220701192609.3970317-10-colin.foster@in-advantage.com> From: Andy Shevchenko Date: Fri, 1 Jul 2022 22:38:46 +0200 Message-ID: Subject: Re: [PATCH v12 net-next 9/9] mfd: ocelot: add support for the vsc7512 chip via spi To: Colin Foster Cc: devicetree , Linux Kernel Mailing List , netdev , linux-arm Mailing List , "open list:GPIO SUBSYSTEM" , Vladimir Oltean , Lee Jones , Rob Herring , Krzysztof Kozlowski , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Lars Povlsen , Steen Hegelund , Microchip Linux Driver Support , Linus Walleij , Wolfram Sang , Terry Bowman , katie.morris@in-advantage.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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 Fri, Jul 1, 2022 at 9:26 PM Colin Foster wrote: > > The VSC7512 is a networking chip that contains several peripherals. Many of > these peripherals are currently supported by the VSC7513 and VSC7514 chips, > but those run on an internal CPU. The VSC7512 lacks this CPU, and must be > controlled externally. > > Utilize the existing drivers by referencing the chip as an MFD. Add support > for the two MDIO buses, the internal phys, pinctrl, and serial GPIO. ... > +config MFD_OCELOT > + tristate "Microsemi Ocelot External Control Support" > + depends on SPI_MASTER > + select MFD_CORE > + select REGMAP_SPI > + help > + Ocelot is a family of networking chips that support multiple ethernet > + and fibre interfaces. In addition to networking, they contain several > + other functions, including pinctrl, MDIO, and communication with > + external chips. While some chips have an internal processor capable of > + running an OS, others don't. All chips can be controlled externally > + through different interfaces, including SPI, I2C, and PCIe. > + > + Say yes here to add support for Ocelot chips (VSC7511, VSC7512, > + VSC7513, VSC7514) controlled externally. > + > + If unsure, say N. What will be the module name? ... It misses a few inclusions, like kernel.h for ARRAY_SIZE() and types.h for booleans. > +#include > +#include > +#include > +#include + blank line? > +#include ... > +#define GCB_SOFT_RST 0x0008 > + > +#define SOFT_CHIP_RST 0x1 It's not clear what these values are: register offsets? Bit fields of the hardware registers? Commands to some IPC? > +#define VSC7512_GCB_RST_SLEEP 100 > +#define VSC7512_GCB_RST_TIMEOUT 100000 Missed units in both cases. ... > +static int ocelot_gcb_chip_rst_status(struct ocelot_ddata *ddata) > +{ > + int val, err; > + > + err = regmap_read(ddata->gcb_regmap, GCB_SOFT_RST, &val); > + if (err) > + val = -1; Can be returned directly. Why not a proper error code, btw? > + return val; > +} ... > +#include What for? Maybe it should be ioport.h ? ... > + static const u8 dummy_buf[16] = {0}; On stack for DMA?! Hmm... ... > + err = spi_setup(spi); > + if (err < 0) { > + return dev_err_probe(&spi->dev, err, > + "Error performing SPI setup\n"); > + } {} are not needed. ... > + err = ocelot_spi_initialize(dev); > + if (err) { > + return dev_err_probe(dev, err, > + "Error initializing SPI bus after reset\n"); > + } {} are not needed. > + err = ocelot_core_init(dev); > + if (err < 0) { Ditto. > + return dev_err_probe(dev, err, > + "Error initializing Ocelot core\n"); > + return err; Dead code. > + } ... > +#include You missed a lot of forward declarations that are used in this file. Like struct spi_device; -- With Best Regards, Andy Shevchenko