14 #include <linux/device.h>
17 #include <linux/module.h>
45 static int mdio_mux_mmioreg_switch_fn(
int current_child,
int desired_child,
50 if (current_child ^ desired_child) {
58 y = (x & ~s->
mask) | desired_child;
61 pr_debug(
"%s: %02x -> %02x\n", __func__, x, y);
86 dev_err(&pdev->
dev,
"could not obtain memory map for node %s\n",
93 dev_err(&pdev->
dev,
"only 8-bit registers are supported\n");
98 if (!iprop || len !=
sizeof(
uint32_t)) {
99 dev_err(&pdev->
dev,
"missing or invalid mux-mask property\n");
103 dev_err(&pdev->
dev,
"only 8-bit registers are supported\n");
112 for_each_available_child_of_node(np, np2) {
114 if (!iprop || len !=
sizeof(
uint32_t)) {
115 dev_err(&pdev->
dev,
"mdio-mux child node %s is "
116 "missing a 'reg' property\n", np2->
full_name);
120 dev_err(&pdev->
dev,
"mdio-mux child node %s has "
121 "a 'reg' value with unmasked bits\n",
130 dev_err(&pdev->
dev,
"failed to register mdio-mux bus %s\n",
135 pdev->
dev.platform_data =
s;
151 .compatible =
"mdio-mux-mmioreg",
159 .name =
"mdio-mux-mmioreg",
161 .of_match_table = mdio_mux_mmioreg_match,
163 .probe = mdio_mux_mmioreg_probe,