1 // SPDX-License-Identifier: GPL-2.0+
14 struct gdsys_rxaui_ctrl_regs {
23 #define rxaui_ctrl_set(map, member, val) \
24 regmap_set(map, struct gdsys_rxaui_ctrl_regs, member, val)
26 #define rxaui_ctrl_get(map, member, valp) \
27 regmap_get(map, struct gdsys_rxaui_ctrl_regs, member, valp)
29 struct gdsys_rxaui_ctrl_priv {
34 int gdsys_rxaui_set_polarity_inversion(struct udevice *dev, bool val)
36 struct gdsys_rxaui_ctrl_priv *priv = dev_get_priv(dev);
39 priv->state = !priv->state;
41 rxaui_ctrl_get(priv->map, ctrl_1, &state);
48 rxaui_ctrl_set(priv->map, ctrl_1, state);
53 static const struct misc_ops gdsys_rxaui_ctrl_ops = {
54 .set_enabled = gdsys_rxaui_set_polarity_inversion,
57 int gdsys_rxaui_ctrl_probe(struct udevice *dev)
59 struct gdsys_rxaui_ctrl_priv *priv = dev_get_priv(dev);
61 regmap_init_mem(dev_ofnode(dev), &priv->map);
68 static const struct udevice_id gdsys_rxaui_ctrl_ids[] = {
69 { .compatible = "gdsys,rxaui_ctrl" },
73 U_BOOT_DRIVER(gdsys_rxaui_ctrl) = {
74 .name = "gdsys_rxaui_ctrl",
76 .ops = &gdsys_rxaui_ctrl_ops,
77 .of_match = gdsys_rxaui_ctrl_ids,
78 .probe = gdsys_rxaui_ctrl_probe,
79 .priv_auto = sizeof(struct gdsys_rxaui_ctrl_priv),