On Sun, May 22, 2022 at 5:50 PM Tomer Maimon <tmaimon77@xxxxxxxxx> wrote: > static const struct of_device_id npcm_rc_match[] = { > { .compatible = "nuvoton,npcm750-reset"}, > + { .compatible = "nuvoton,npcm845-reset"}, > { } > }; > +/* > + * The following procedure should be observed in USB PHY, USB device and > + * USB host initialization at BMC boot > + */ > +static int npcm_usb_reset(struct platform_device *pdev, struct npcm_rc_data *rc) > +{ > + struct device_node *np = pdev->dev.of_node; > + struct device *dev = &pdev->dev; > + > + rc->gcr_regmap = syscon_regmap_lookup_by_phandle(dev->of_node, "syscon"); > + if (IS_ERR(rc->gcr_regmap)) { > + dev_err(&pdev->dev, "Failed to find gcr syscon"); > + return PTR_ERR(rc->gcr_regmap); > + } > + > + if (of_device_is_compatible(np, "nuvoton,npcm750-reset")) > + npcm_usb_reset_npcm7xx(rc); > + else if (of_device_is_compatible(np, "nuvoton,npcm845-reset")) > + npcm_usb_reset_npcm8xx(rc); > + else > + return -ENODEV; > In place of the string comparison in of_device_is_compatible(), maybe just use the .data field of the of_device_id structure to point to the actual reset function. Alternatively, register two separate platform_driver instances here and use separate probe functions that do the soc specific bits and call into shared functions for the bits that are the same. Arnd