[PATCH v15 mfd 9/9] mfd: ocelot: add support for the vsc7512 chip via spi

Andy Shevchenko andy.shevchenko at gmail.com
Wed Aug 3 04:45:04 PDT 2022


On Wed, Aug 3, 2022 at 7:48 AM Colin Foster
<colin.foster at in-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.


...

> +#include <asm/byteorder.h>

Not sure I see the user of this header.

...

> +struct regmap *ocelot_spi_init_regmap(struct device *dev, const struct resource *res)
> +{
> +       struct regmap_config regmap_config;
> +
> +       memcpy(&regmap_config, &ocelot_spi_regmap_config, sizeof(regmap_config));
> +
> +       regmap_config.name = res->name;

> +       regmap_config.max_register = res->end - res->start;

Hmm... First of all, resource_size() is for that (with - 1 to the
result). But don't you need to use stride in the calculations?

> +       regmap_config.reg_base = res->start;
> +
> +       return devm_regmap_init(dev, &ocelot_spi_regmap_bus, dev, &regmap_config);
> +}

-- 
With Best Regards,
Andy Shevchenko



More information about the linux-arm-kernel mailing list