diff options
author | Vignesh Raghavendra <vigneshr@ti.com> | 2020-07-06 13:26:24 +0530 |
---|---|---|
committer | Lokesh Vutla <lokeshvutla@ti.com> | 2020-07-13 20:58:34 +0530 |
commit | b3f95997cefbfd53dcb02df95dcb03462430bcb6 (patch) | |
tree | 1158b04728fb0b99a02444e3600f912097e09180 | |
parent | 5d257849987fbeab96bf8cd953cab7c825a9b359 (diff) | |
download | u-boot-b3f95997cefbfd53dcb02df95dcb03462430bcb6.tar.gz |
soc: ti: k3-ringacc: Separate soc specific initialization
In preparation of adding more K3 SoCs, separate soc specific
initialization add a SoC specific initialization hook.
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
-rw-r--r-- | drivers/soc/ti/k3-navss-ringacc.c | 49 |
1 files changed, 40 insertions, 9 deletions
diff --git a/drivers/soc/ti/k3-navss-ringacc.c b/drivers/soc/ti/k3-navss-ringacc.c index 81de75af20..c48e9befe4 100644 --- a/drivers/soc/ti/k3-navss-ringacc.c +++ b/drivers/soc/ti/k3-navss-ringacc.c @@ -180,6 +180,10 @@ struct k3_nav_ring { int proxy_id; }; +struct k3_nav_ringacc_ops { + int (*init)(struct udevice *dev, struct k3_nav_ringacc *ringacc); +}; + /** * struct k3_nav_ringacc - Rings accelerator descriptor * @@ -195,6 +199,7 @@ struct k3_nav_ring { * @tisci - pointer ti-sci handle * @tisci_ring_ops - ti-sci rings ops * @tisci_dev_id - ti-sci device id + * @ops: SoC specific ringacc operation */ struct k3_nav_ringacc { struct udevice *dev; @@ -213,6 +218,8 @@ struct k3_nav_ringacc { const struct ti_sci_handle *tisci; const struct ti_sci_rm_ringacc_ops *tisci_ring_ops; u32 tisci_dev_id; + + const struct k3_nav_ringacc_ops *ops; }; static long k3_nav_ringacc_ring_get_fifo_pos(struct k3_nav_ring *ring) @@ -1008,18 +1015,11 @@ static int k3_nav_ringacc_probe_dt(struct k3_nav_ringacc *ringacc) return 0; } -static int k3_nav_ringacc_probe(struct udevice *dev) +static int k3_nav_ringacc_init(struct udevice *dev, struct k3_nav_ringacc *ringacc) { - struct k3_nav_ringacc *ringacc; void __iomem *base_fifo, *base_rt; int ret, i; - ringacc = dev_get_priv(dev); - if (!ringacc) - return -ENOMEM; - - ringacc->dev = dev; - ret = k3_nav_ringacc_probe_dt(ringacc); if (ret) return ret; @@ -1089,11 +1089,42 @@ static int k3_nav_ringacc_probe(struct udevice *dev) return 0; } +struct ringacc_match_data { + struct k3_nav_ringacc_ops ops; +}; + +static struct ringacc_match_data k3_nav_ringacc_data = { + .ops = { + .init = k3_nav_ringacc_init, + }, +}; + static const struct udevice_id knav_ringacc_ids[] = { - { .compatible = "ti,am654-navss-ringacc" }, + { .compatible = "ti,am654-navss-ringacc", .data = (ulong)&k3_nav_ringacc_data, }, {}, }; +static int k3_nav_ringacc_probe(struct udevice *dev) +{ + struct k3_nav_ringacc *ringacc; + int ret; + const struct ringacc_match_data *match_data; + + match_data = (struct ringacc_match_data *)dev_get_driver_data(dev); + + ringacc = dev_get_priv(dev); + if (!ringacc) + return -ENOMEM; + + ringacc->dev = dev; + ringacc->ops = &match_data->ops; + ret = ringacc->ops->init(dev, ringacc); + if (ret) + return ret; + + return 0; +} + U_BOOT_DRIVER(k3_navss_ringacc) = { .name = "k3-navss-ringacc", .id = UCLASS_MISC, |