lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VcfKS9Y+T5LPRk0SFHJCGarJ2wS2gwii=a+1it03S+_Og@mail.gmail.com>
Date:   Fri, 1 Jul 2022 22:38:46 +0200
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Colin Foster <colin.foster@...advantage.com>
Cc:     devicetree <devicetree@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        netdev <netdev@...r.kernel.org>,
        linux-arm Mailing List <linux-arm-kernel@...ts.infradead.org>,
        "open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
        Vladimir Oltean <vladimir.oltean@....com>,
        Lee Jones <lee.jones@...aro.org>,
        Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        Andrew Lunn <andrew@...n.ch>,
        Heiner Kallweit <hkallweit1@...il.com>,
        Russell King <linux@...linux.org.uk>,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        Lars Povlsen <lars.povlsen@...rochip.com>,
        Steen Hegelund <Steen.Hegelund@...rochip.com>,
        Microchip Linux Driver Support <UNGLinuxDriver@...rochip.com>,
        Linus Walleij <linus.walleij@...aro.org>,
        Wolfram Sang <wsa@...nel.org>,
        Terry Bowman <terry.bowman@....com>,
        katie.morris@...advantage.com
Subject: Re: [PATCH v12 net-next 9/9] mfd: ocelot: add support for the vsc7512
 chip via spi

On Fri, Jul 1, 2022 at 9:26 PM Colin Foster
<colin.foster@...advantage.com> 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 <linux/mfd/core.h>
> +#include <linux/mfd/ocelot.h>
> +#include <linux/module.h>
> +#include <linux/regmap.h>

+ blank line?

> +#include <soc/mscc/ocelot.h>

...

> +#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 <linux/iopoll.h>

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 <asm/byteorder.h>

You missed a lot of forward declarations that are used in this file.

Like

struct spi_device;

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ