Lines Matching +full:sci +full:- +full:dev +full:- +full:id

1 // SPDX-License-Identifier: GPL-2.0+
5 * Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/
17 #include <power-domain.h>
26 * struct k3_rproc_privdata - Structure representing Remote processor data.
29 * @sci: Pointer to TISCI handle
31 * @proc_id: TISCI processor ID
32 * @host_id: TISCI host id to which the processor gets assigned to.
38 const struct ti_sci_handle *sci; member
45 * k3_rproc_load() - Load up the Remote processor image
46 * @dev: rproc device pointer
52 static int k3_rproc_load(struct udevice *dev, ulong addr, ulong size) in k3_rproc_load() argument
54 struct k3_rproc_privdata *rproc = dev_get_priv(dev); in k3_rproc_load()
55 const struct ti_sci_proc_ops *pops = &rproc->sci->ops.proc_ops; in k3_rproc_load()
58 dev_dbg(dev, "%s addr = 0x%lx, size = 0x%lx\n", __func__, addr, size); in k3_rproc_load()
61 ret = pops->proc_request(rproc->sci, rproc->proc_id); in k3_rproc_load()
63 dev_err(dev, "Requesting processor failed %d\n", ret); in k3_rproc_load()
67 ret = pops->set_proc_boot_cfg(rproc->sci, rproc->proc_id, addr, 0, 0); in k3_rproc_load()
69 dev_err(dev, "set_proc_boot_cfg failed %d\n", ret); in k3_rproc_load()
73 dev_dbg(dev, "%s: rproc successfully loaded\n", __func__); in k3_rproc_load()
79 * k3_rproc_start() - Start the remote processor
80 * @dev: rproc device pointer
84 static int k3_rproc_start(struct udevice *dev) in k3_rproc_start() argument
86 struct k3_rproc_privdata *rproc = dev_get_priv(dev); in k3_rproc_start()
87 const struct ti_sci_proc_ops *pops = &rproc->sci->ops.proc_ops; in k3_rproc_start()
90 dev_dbg(dev, "%s\n", __func__); in k3_rproc_start()
92 ret = power_domain_on(&rproc->gtc_pwrdmn); in k3_rproc_start()
94 dev_err(dev, "power_domain_on() failed: %d\n", ret); in k3_rproc_start()
99 writel(GTC_CNTR_EN, rproc->gtc_base + GTC_CNTCR_REG); in k3_rproc_start()
103 * assigned-clock-rates during the device probe. So no need to in k3_rproc_start()
106 ret = power_domain_on(&rproc->rproc_pwrdmn); in k3_rproc_start()
108 dev_err(dev, "power_domain_on() failed: %d\n", ret); in k3_rproc_start()
112 if (rproc->host_id != INVALID_ID) { in k3_rproc_start()
113 ret = pops->proc_handover(rproc->sci, rproc->proc_id, in k3_rproc_start()
114 rproc->host_id); in k3_rproc_start()
116 dev_err(dev, "Handover processor failed %d\n", ret); in k3_rproc_start()
120 ret = pops->proc_release(rproc->sci, rproc->proc_id); in k3_rproc_start()
122 dev_err(dev, "Processor release failed %d\n", ret); in k3_rproc_start()
127 dev_dbg(dev, "%s: rproc successfully started\n", __func__); in k3_rproc_start()
133 * k3_rproc_init() - Initialize the remote processor
134 * @dev: rproc device pointer
138 static int k3_rproc_init(struct udevice *dev) in k3_rproc_init() argument
140 dev_dbg(dev, "%s\n", __func__); in k3_rproc_init()
143 dev_dbg(dev, "%s: rproc successfully initialized\n", __func__); in k3_rproc_init()
155 * k3_of_to_priv() - generate private data from device tree
156 * @dev: corresponding k3 remote processor device
161 static int k3_rproc_of_to_priv(struct udevice *dev, in k3_rproc_of_to_priv() argument
166 dev_dbg(dev, "%s\n", __func__); in k3_rproc_of_to_priv()
168 ret = power_domain_get_by_index(dev, &rproc->rproc_pwrdmn, 1); in k3_rproc_of_to_priv()
170 dev_err(dev, "power_domain_get() failed: %d\n", ret); in k3_rproc_of_to_priv()
174 ret = power_domain_get_by_index(dev, &rproc->gtc_pwrdmn, 0); in k3_rproc_of_to_priv()
176 dev_err(dev, "power_domain_get() failed: %d\n", ret); in k3_rproc_of_to_priv()
180 ret = reset_get_by_index(dev, 0, &rproc->rproc_rst); in k3_rproc_of_to_priv()
182 dev_err(dev, "reset_get() failed: %d\n", ret); in k3_rproc_of_to_priv()
186 rproc->sci = ti_sci_get_by_phandle(dev, "ti,sci"); in k3_rproc_of_to_priv()
187 if (IS_ERR(rproc->sci)) { in k3_rproc_of_to_priv()
188 dev_err(dev, "ti_sci get failed: %d\n", ret); in k3_rproc_of_to_priv()
189 return PTR_ERR(rproc->sci); in k3_rproc_of_to_priv()
192 rproc->gtc_base = dev_read_addr_ptr(dev); in k3_rproc_of_to_priv()
193 if (!rproc->gtc_base) { in k3_rproc_of_to_priv()
194 dev_err(dev, "Get address failed\n"); in k3_rproc_of_to_priv()
195 return -ENODEV; in k3_rproc_of_to_priv()
198 rproc->proc_id = dev_read_u32_default(dev, "ti,sci-proc-id", in k3_rproc_of_to_priv()
200 rproc->host_id = dev_read_u32_default(dev, "ti,sci-host-id", in k3_rproc_of_to_priv()
207 * k3_rproc_probe() - Basic probe
208 * @dev: corresponding k3 remote processor device
212 static int k3_rproc_probe(struct udevice *dev) in k3_rproc_probe() argument
217 dev_dbg(dev, "%s\n", __func__); in k3_rproc_probe()
219 priv = dev_get_priv(dev); in k3_rproc_probe()
221 ret = k3_rproc_of_to_priv(dev, priv); in k3_rproc_probe()
223 dev_dbg(dev, "%s: Probe failed with error %d\n", __func__, ret); in k3_rproc_probe()
227 dev_dbg(dev, "Remoteproc successfully probed\n"); in k3_rproc_probe()
233 { .compatible = "ti,am654-rproc"},
240 .id = UCLASS_REMOTEPROC,