Mark Kettenis | b99c635 | 2023-07-14 22:21:42 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * Copyright (C) 2022 Mark Kettenis <kettenis@openbsd.org> |
| 4 | */ |
| 5 | |
Mark Kettenis | b99c635 | 2023-07-14 22:21:42 +0200 | [diff] [blame] | 6 | #include <dm.h> |
| 7 | #include <dm/device-internal.h> |
| 8 | #include <generic-phy.h> |
| 9 | #include <reset-uclass.h> |
| 10 | |
| 11 | static const struct phy_ops apple_atcphy_ops = { |
| 12 | }; |
| 13 | |
| 14 | static struct driver apple_atcphy_driver = { |
| 15 | .name = "apple-atcphy", |
| 16 | .id = UCLASS_PHY, |
| 17 | .ops = &apple_atcphy_ops, |
| 18 | }; |
| 19 | |
| 20 | static int apple_atcphy_reset_of_xlate(struct reset_ctl *reset_ctl, |
| 21 | struct ofnode_phandle_args *args) |
| 22 | { |
| 23 | if (args->args_count != 0) |
| 24 | return -EINVAL; |
| 25 | |
| 26 | return 0; |
| 27 | } |
| 28 | |
| 29 | static const struct reset_ops apple_atcphy_reset_ops = { |
| 30 | .of_xlate = apple_atcphy_reset_of_xlate, |
| 31 | }; |
| 32 | |
| 33 | static int apple_atcphy_reset_probe(struct udevice *dev) |
| 34 | { |
| 35 | struct udevice *child; |
| 36 | |
| 37 | device_bind(dev, &apple_atcphy_driver, "apple-atcphy", NULL, |
| 38 | dev_ofnode(dev), &child); |
| 39 | |
| 40 | return 0; |
| 41 | } |
| 42 | |
| 43 | static const struct udevice_id apple_atcphy_ids[] = { |
| 44 | { .compatible = "apple,t6000-atcphy" }, |
| 45 | { .compatible = "apple,t8103-atcphy" }, |
| 46 | { } |
| 47 | }; |
| 48 | |
| 49 | U_BOOT_DRIVER(apple_atcphy_reset) = { |
| 50 | .name = "apple-atcphy-reset", |
| 51 | .id = UCLASS_RESET, |
| 52 | .of_match = apple_atcphy_ids, |
| 53 | .ops = &apple_atcphy_reset_ops, |
| 54 | .probe = apple_atcphy_reset_probe, |
| 55 | }; |