On Wed, 06 Jan 2021, Xu Yilun wrote: > The patch specifies the 2 retimer sub devices and their resources in the > parent driver's mfd_cell. It also adds the register definition of the > retimer sub devices. > > There are 2 ethernet retimer chips (C827) connected to the Intel MAX 10 > BMC. They are managed by the BMC firmware, and host could query them via > retimer interfaces (shared registers) on the BMC. The 2 retimers have > identical register interfaces in different register addresses or fields, > so it is better we define 2 retimer devices and handle them with the same > driver. > > Signed-off-by: Xu Yilun <yilun...@intel.com> > --- > drivers/mfd/intel-m10-bmc.c | 19 ++++++++++++++++++- > include/linux/mfd/intel-m10-bmc.h | 7 +++++++ > 2 files changed, 25 insertions(+), 1 deletion(-) > > diff --git a/drivers/mfd/intel-m10-bmc.c b/drivers/mfd/intel-m10-bmc.c > index b84579b..e0a99a0 100644 > --- a/drivers/mfd/intel-m10-bmc.c > +++ b/drivers/mfd/intel-m10-bmc.c > @@ -17,9 +17,26 @@ enum m10bmc_type { > M10_N3000, > }; > > +static struct resource retimer0_resources[] = { > + {M10BMC_PKVL_A_VER, M10BMC_PKVL_A_VER, "version", IORESOURCE_REG, }, > +}; > + > +static struct resource retimer1_resources[] = { > + {M10BMC_PKVL_B_VER, M10BMC_PKVL_B_VER, "version", IORESOURCE_REG, }, > +};
Please use the DEFINE_RES_*() helpers for this. > static struct mfd_cell m10bmc_pacn3000_subdevs[] = { > { .name = "n3000bmc-hwmon" }, > - { .name = "n3000bmc-retimer" }, > + { > + .name = "n3000bmc-retimer", > + .num_resources = ARRAY_SIZE(retimer0_resources), > + .resources = retimer0_resources, > + }, > + { > + .name = "n3000bmc-retimer", > + .num_resources = ARRAY_SIZE(retimer1_resources), > + .resources = retimer1_resources, > + }, > { .name = "n3000bmc-secure" }, > }; > > diff --git a/include/linux/mfd/intel-m10-bmc.h > b/include/linux/mfd/intel-m10-bmc.h > index c8ef2f1..d6216f9 100644 > --- a/include/linux/mfd/intel-m10-bmc.h > +++ b/include/linux/mfd/intel-m10-bmc.h > @@ -21,6 +21,13 @@ > #define M10BMC_VER_PCB_INFO_MSK GENMASK(31, 24) > #define M10BMC_VER_LEGACY_INVALID 0xffffffff > > +/* Retimer related registers, in system register region */ > +#define M10BMC_PKVL_LSTATUS 0x164 > +#define M10BMC_PKVL_A_VER 0x254 > +#define M10BMC_PKVL_B_VER 0x258 > +#define M10BMC_PKVL_SERDES_VER GENMASK(15, 0) > +#define M10BMC_PKVL_SBUS_VER GENMASK(31, 16) > + > /** > * struct intel_m10bmc - Intel MAX 10 BMC parent driver data structure > * @dev: this device -- Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog