Lines Matching +full:syscon +full:- +full:wakeup

1 // SPDX-License-Identifier: GPL-2.0
3 * mtu3_dr.c - dual role switch and host glue layer
13 #include <linux/mfd/syscon.h>
50 * ip-sleep wakeup mode:
57 switch (ssusb->uwk_vers) { in ssusb_wakeup_ip_sleep_set()
59 reg = ssusb->uwk_reg_base + PERI_WK_CTRL1; in ssusb_wakeup_ip_sleep_set()
64 reg = ssusb->uwk_reg_base + PERI_WK_CTRL0; in ssusb_wakeup_ip_sleep_set()
69 reg = ssusb->uwk_reg_base + PERI_WK_CTRL0; in ssusb_wakeup_ip_sleep_set()
74 reg = ssusb->uwk_reg_base + PERI_SSUSB_SPM_CTRL; in ssusb_wakeup_ip_sleep_set()
81 regmap_update_bits(ssusb->uwk, reg, msk, val); in ssusb_wakeup_ip_sleep_set()
90 /* wakeup function is optional */ in ssusb_wakeup_of_property_parse()
91 ssusb->uwk_en = of_property_read_bool(dn, "wakeup-source"); in ssusb_wakeup_of_property_parse()
92 if (!ssusb->uwk_en) in ssusb_wakeup_of_property_parse()
96 "mediatek,syscon-wakeup", 2, 0, &args); in ssusb_wakeup_of_property_parse()
100 ssusb->uwk_reg_base = args.args[0]; in ssusb_wakeup_of_property_parse()
101 ssusb->uwk_vers = args.args[1]; in ssusb_wakeup_of_property_parse()
102 ssusb->uwk = syscon_node_to_regmap(args.np); in ssusb_wakeup_of_property_parse()
104 dev_info(ssusb->dev, "uwk - reg:0x%x, version:%d\n", in ssusb_wakeup_of_property_parse()
105 ssusb->uwk_reg_base, ssusb->uwk_vers); in ssusb_wakeup_of_property_parse()
107 return PTR_ERR_OR_ZERO(ssusb->uwk); in ssusb_wakeup_of_property_parse()
112 if (ssusb->uwk_en) in ssusb_wakeup_set()
120 xhci_cap = mtu3_readl(ssusb->ippc_base, U3D_SSUSB_IP_XHCI_CAP); in host_ports_num_get()
121 ssusb->u2_ports = SSUSB_IP_XHCI_U2_PORT_NUM(xhci_cap); in host_ports_num_get()
122 ssusb->u3_ports = SSUSB_IP_XHCI_U3_PORT_NUM(xhci_cap); in host_ports_num_get()
124 dev_dbg(ssusb->dev, "host - u2_ports:%d, u3_ports:%d\n", in host_ports_num_get()
125 ssusb->u2_ports, ssusb->u3_ports); in host_ports_num_get()
131 void __iomem *ibase = ssusb->ippc_base; in ssusb_host_enable()
132 int num_u3p = ssusb->u3_ports; in ssusb_host_enable()
133 int num_u2p = ssusb->u2_ports; in ssusb_host_enable()
145 if ((0x1 << i) & ssusb->u3p_dis_msk) { in ssusb_host_enable()
158 if ((0x1 << i) & ssusb->u2p_dis_msk) in ssusb_host_enable()
176 void __iomem *ibase = ssusb->ippc_base; in ssusb_host_disable()
177 int num_u3p = ssusb->u3_ports; in ssusb_host_disable()
178 int num_u2p = ssusb->u2_ports; in ssusb_host_disable()
184 if ((0x1 << i) & ssusb->u3p_dis_msk) in ssusb_host_disable()
194 if ((0x1 << i) & ssusb->u2p_dis_msk) in ssusb_host_disable()
210 void __iomem *ibase = ssusb->ippc_base; in ssusb_host_resume()
211 int u3p_skip_msk = ssusb->u3p_dis_msk; in ssusb_host_resume()
212 int u2p_skip_msk = ssusb->u2p_dis_msk; in ssusb_host_resume()
213 int num_u3p = ssusb->u3_ports; in ssusb_host_resume()
214 int num_u2p = ssusb->u2_ports; in ssusb_host_resume()
220 if (ssusb->otg_switch.is_u3_drd) in ssusb_host_resume()
253 void __iomem *ibase = ssusb->ippc_base; in ssusb_host_suspend()
254 int num_u3p = ssusb->u3_ports; in ssusb_host_suspend()
255 int num_u2p = ssusb->u2_ports; in ssusb_host_suspend()
261 if ((0x1 << i) & ssusb->u3p_dis_msk) in ssusb_host_suspend()
271 if ((0x1 << i) & ssusb->u2p_dis_msk) in ssusb_host_suspend()
296 /* if port0 supports dual-role, works as host mode by default */ in ssusb_host_setup()
297 ssusb_set_vbus(&ssusb->otg_switch, 1); in ssusb_host_setup()
302 if (ssusb->is_host) in ssusb_host_cleanup()
303 ssusb_set_vbus(&ssusb->otg_switch, 0); in ssusb_host_cleanup()
316 struct device *parent_dev = ssusb->dev; in ssusb_host_init()
335 of_platform_depopulate(ssusb->dev); in ssusb_host_exit()