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 | |
| 6 | #include <common.h> |
| 7 | #include <dm.h> |
| 8 | #include <dm/device-internal.h> |
| 9 | #include <generic-phy.h> |
| 10 | #include <reset-uclass.h> |
| 11 | |
| 12 | static const struct phy_ops apple_atcphy_ops = { |
| 13 | }; |
| 14 | |
| 15 | static struct driver apple_atcphy_driver = { |
| 16 | .name = "apple-atcphy", |
| 17 | .id = UCLASS_PHY, |
| 18 | .ops = &apple_atcphy_ops, |
| 19 | }; |
| 20 | |
| 21 | static int apple_atcphy_reset_of_xlate(struct reset_ctl *reset_ctl, |
| 22 | struct ofnode_phandle_args *args) |
| 23 | { |
| 24 | if (args->args_count != 0) |
| 25 | return -EINVAL; |
| 26 | |
| 27 | return 0; |
| 28 | } |
| 29 | |
| 30 | static const struct reset_ops apple_atcphy_reset_ops = { |
| 31 | .of_xlate = apple_atcphy_reset_of_xlate, |
| 32 | }; |
| 33 | |
| 34 | static int apple_atcphy_reset_probe(struct udevice *dev) |
| 35 | { |
| 36 | struct udevice *child; |
| 37 | |
| 38 | device_bind(dev, &apple_atcphy_driver, "apple-atcphy", NULL, |
| 39 | dev_ofnode(dev), &child); |
| 40 | |
| 41 | return 0; |
| 42 | } |
| 43 | |
| 44 | static const struct udevice_id apple_atcphy_ids[] = { |
| 45 | { .compatible = "apple,t6000-atcphy" }, |
| 46 | { .compatible = "apple,t8103-atcphy" }, |
| 47 | { } |
| 48 | }; |
| 49 | |
| 50 | U_BOOT_DRIVER(apple_atcphy_reset) = { |
| 51 | .name = "apple-atcphy-reset", |
| 52 | .id = UCLASS_RESET, |
| 53 | .of_match = apple_atcphy_ids, |
| 54 | .ops = &apple_atcphy_reset_ops, |
| 55 | .probe = apple_atcphy_reset_probe, |
| 56 | }; |