hc
2023-02-17 557c24d082b6ecb9bfe5407b77ae43fa7650a5dc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
 * (C) Copyright 2008-2017 Fuzhou Rockchip Electronics Co., Ltd
 *
 * SPDX-License-Identifier:    GPL-2.0+
 */
 
#include <common.h>
#include "rockchip_phy.h"
 
int rockchip_phy_init(struct rockchip_phy *phy)
{
   if (!phy)
       return -ENODEV;
 
   if (phy->funcs && phy->funcs->init)
       return phy->funcs->init(phy);
 
   return 0;
}
 
int rockchip_phy_power_on(struct rockchip_phy *phy)
{
   if (!phy)
       return -ENODEV;
 
   if (phy->funcs && phy->funcs->power_on)
       return phy->funcs->power_on(phy);
 
   return 0;
}
 
int rockchip_phy_power_off(struct rockchip_phy *phy)
{
   if (!phy)
       return -ENODEV;
 
   if (phy->funcs && phy->funcs->power_off)
       return phy->funcs->power_off(phy);
 
   return 0;
}
 
unsigned long rockchip_phy_set_pll(struct rockchip_phy *phy,
                  unsigned long rate)
{
   if (!phy)
       return -ENODEV;
 
   if (phy->funcs && phy->funcs->set_pll)
       return phy->funcs->set_pll(phy, rate);
 
   return 0;
}
 
int rockchip_phy_set_bus_width(struct rockchip_phy *phy, u32 bus_width)
{
   if (!phy)
       return -ENODEV;
 
   if (phy->funcs && phy->funcs->set_bus_width)
       return phy->funcs->set_bus_width(phy, bus_width);
 
   return 0;
}
 
long rockchip_phy_round_rate(struct rockchip_phy *phy, unsigned long rate)
{
   if (!phy)
       return -ENODEV;
 
   if (phy->funcs && phy->funcs->round_rate)
       return phy->funcs->round_rate(phy, rate);
 
   return 0;
}
 
int rockchip_phy_set_mode(struct rockchip_phy *phy, enum phy_mode mode)
{
   if (!phy)
       return -ENODEV;
 
   if (phy->funcs && phy->funcs->set_mode)
       return phy->funcs->set_mode(phy, mode);
 
   return 0;
}