[PATCH] bus: imx-weim: add DT overlay support for WEIM bus

Ivan Bornyakov i.bornyakov at metrotek.ru
Mon Feb 21 00:02:44 PST 2022


On Mon, Feb 21, 2022 at 03:25:29PM +0800, Shawn Guo wrote:
> On Sat, Feb 05, 2022 at 08:50:06AM +0300, Ivan Bornyakov wrote:
> > Add OF reconfiguration notifier handler for WEIM bus to setup Chip
> > Select timings on runtime creation of child devices.
> > 
> > However, it is not possible to load another DT overlay with conflicting
> > CS timings with previously loaded overlay, even if the first one is
> > unloaded.
> 
> Are we doing anything if that happens?
> 

On device removal there is no access to device node properties, thus it
is not possible to find out which of CS timings was configured for this
device to clear theirs 'is_applied'.

So, if we apply one DT overlay, configure some CS timings, remove this
overlay, apply another with conflicting timings, we will fail here

static int weim_timing_setup(...)
{
	...

	for (reg_idx = 0; reg_idx < num_regs; reg_idx++) {
		...

		/* prevent re-configuring a CS that's already been configured */
		cst = &ts->cs[cs_idx];
		if (cst->is_applied && memcmp(value, cst->regs,
					devtype->cs_regs_count * sizeof(u32))) {
			dev_err(dev, "fsl,weim-cs-timing conflict on %pOF", np);
			return -EINVAL;
		}
		...
	}
	...
}




More information about the linux-arm-kernel mailing list