1 /* 2 * (C) Copyright 2008-2017 Fuzhou Rockchip Electronics Co., Ltd 3 * 4 * SPDX-License-Identifier: GPL-2.0+ 5 */ 6 7 #ifndef _ROCKCHIP_PHY_H_ 8 #define _ROCKCHIP_PHY_H_ 9 10 enum phy_mode { 11 PHY_MODE_INVALID, 12 PHY_MODE_MIPI_DPHY, 13 PHY_MODE_VIDEO_LVDS, 14 PHY_MODE_VIDEO_TTL, 15 }; 16 17 struct rockchip_phy; 18 19 struct rockchip_phy_funcs { 20 int (*init)(struct rockchip_phy *phy); 21 int (*power_on)(struct rockchip_phy *phy); 22 int (*power_off)(struct rockchip_phy *phy); 23 unsigned long (*set_pll)(struct rockchip_phy *phy, unsigned long rate); 24 int (*set_bus_width)(struct rockchip_phy *phy, u32 bus_width); 25 long (*round_rate)(struct rockchip_phy *phy, unsigned long rate); 26 int (*set_mode)(struct rockchip_phy *phy, enum phy_mode mode); 27 }; 28 29 struct rockchip_phy { 30 struct udevice *dev; 31 const struct rockchip_phy_funcs *funcs; 32 const void *data; 33 int soc_type; 34 }; 35 36 int rockchip_phy_init(struct rockchip_phy *phy); 37 int rockchip_phy_power_off(struct rockchip_phy *phy); 38 int rockchip_phy_power_on(struct rockchip_phy *phy); 39 unsigned long rockchip_phy_set_pll(struct rockchip_phy *phy, 40 unsigned long rate); 41 int rockchip_phy_set_bus_width(struct rockchip_phy *phy, u32 bus_width); 42 long rockchip_phy_round_rate(struct rockchip_phy *phy, unsigned long rate); 43 int rockchip_phy_set_mode(struct rockchip_phy *phy, enum phy_mode mode); 44 45 #endif 46