1 // SPDX-License-Identifier: GPL-2.0+
4 * Dirk Eibach, Guntermann & Drunck GmbH, eibach@gdsys.de
7 * Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc
15 struct gdsys_rxaui_ctrl_regs {
24 #define rxaui_ctrl_set(map, member, val) \
25 regmap_set(map, struct gdsys_rxaui_ctrl_regs, member, val)
27 #define rxaui_ctrl_get(map, member, valp) \
28 regmap_get(map, struct gdsys_rxaui_ctrl_regs, member, valp)
30 struct gdsys_rxaui_ctrl_priv {
35 int gdsys_rxaui_set_polarity_inversion(struct udevice *dev, bool val)
37 struct gdsys_rxaui_ctrl_priv *priv = dev_get_priv(dev);
40 priv->state = !priv->state;
42 rxaui_ctrl_get(priv->map, ctrl_1, &state);
49 rxaui_ctrl_set(priv->map, ctrl_1, state);
54 static const struct misc_ops gdsys_rxaui_ctrl_ops = {
55 .set_enabled = gdsys_rxaui_set_polarity_inversion,
58 int gdsys_rxaui_ctrl_probe(struct udevice *dev)
60 struct gdsys_rxaui_ctrl_priv *priv = dev_get_priv(dev);
62 regmap_init_mem(dev_ofnode(dev), &priv->map);
69 static const struct udevice_id gdsys_rxaui_ctrl_ids[] = {
70 { .compatible = "gdsys,rxaui_ctrl" },
74 U_BOOT_DRIVER(gdsys_rxaui_ctrl) = {
75 .name = "gdsys_rxaui_ctrl",
77 .ops = &gdsys_rxaui_ctrl_ops,
78 .of_match = gdsys_rxaui_ctrl_ids,
79 .probe = gdsys_rxaui_ctrl_probe,
80 .priv_auto = sizeof(struct gdsys_rxaui_ctrl_priv),