Re: [PATCH V8 1/3] mfd: Add support for UP board CPLD/FPGA

From: Krzysztof Kozlowski
Date: Thu Dec 28 2023 - 10:31:20 EST


On 28/12/2023 16:15, larry.lai wrote:
> The UP Squared board <http://www.upboard.com> implements certain
> features (pin control, onboard LEDs or CEC) through an on-board CPLD/FPGA.
>
> This driver implements the line protocol to read and write registers
> from the FPGA through regmap. The register address map is also included.
>

...

> +#define FIRMWARE_ID_BUILD_OFFSET 12
> +#define FIRMWARE_ID_MAJOR_OFFSET 8
> +#define FIRMWARE_ID_MINOR_OFFSET 4
> +#define FIRMWARE_ID_PATCH_OFFSET 0
> +#define FIRMWARE_ID_MASK GENMASK(3, 0)
> +
> +/*
> + * read CPLD register on custom protocol
> + * send clock and addr bit in strobe and datain pins then read from dataout pin
> + */
> +static int upboard_cpld_read(void *context, unsigned int reg, unsigned int *val)
> +{
> + struct upboard_fpga * const fpga = context;

This const does not make sense. Drop it. Unless you wanted to say
something else, like struct is not modified, but then please read C
tutorials. This applies to all your three patches.

Best regards,
Krzysztof