Commit a2dd6877 authored by Murali Karicheri's avatar Murali Karicheri Committed by David S. Miller

soc: ti: K2G: provide APIs to support driver probe deferral

This patch provide APIs to allow client drivers to support
probe deferral. On K2G SoC, devices can be probed only
after the ti_sci_pm_domains driver is probed and ready.
As drivers may get probed at different order, any driver
that depends on knav dma and qmss drivers, for example
netcp network driver, needs to defer probe until
knav devices are probed and ready to service. To do this,
add an API to query the device ready status from the knav
dma and qmss devices.
Signed-off-by: default avatarMurali Karicheri <m-karicheri2@ti.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 350601b4
...@@ -134,6 +134,13 @@ struct knav_dma_chan { ...@@ -134,6 +134,13 @@ struct knav_dma_chan {
static struct knav_dma_pool_device *kdev; static struct knav_dma_pool_device *kdev;
static bool device_ready;
bool knav_dma_device_ready(void)
{
return device_ready;
}
EXPORT_SYMBOL_GPL(knav_dma_device_ready);
static bool check_config(struct knav_dma_chan *chan, struct knav_dma_cfg *cfg) static bool check_config(struct knav_dma_chan *chan, struct knav_dma_cfg *cfg)
{ {
if (!memcmp(&chan->cfg, cfg, sizeof(*cfg))) if (!memcmp(&chan->cfg, cfg, sizeof(*cfg)))
...@@ -773,6 +780,7 @@ static int knav_dma_probe(struct platform_device *pdev) ...@@ -773,6 +780,7 @@ static int knav_dma_probe(struct platform_device *pdev)
debugfs_create_file("knav_dma", S_IFREG | S_IRUGO, NULL, NULL, debugfs_create_file("knav_dma", S_IFREG | S_IRUGO, NULL, NULL,
&knav_dma_debug_ops); &knav_dma_debug_ops);
device_ready = true;
return ret; return ret;
} }
......
...@@ -74,6 +74,13 @@ static DEFINE_MUTEX(knav_dev_lock); ...@@ -74,6 +74,13 @@ static DEFINE_MUTEX(knav_dev_lock);
*/ */
const char *knav_acc_firmwares[] = {"ks2_qmss_pdsp_acc48.bin"}; const char *knav_acc_firmwares[] = {"ks2_qmss_pdsp_acc48.bin"};
static bool device_ready;
bool knav_qmss_device_ready(void)
{
return device_ready;
}
EXPORT_SYMBOL_GPL(knav_qmss_device_ready);
/** /**
* knav_queue_notify: qmss queue notfier call * knav_queue_notify: qmss queue notfier call
* *
...@@ -1849,6 +1856,7 @@ static int knav_queue_probe(struct platform_device *pdev) ...@@ -1849,6 +1856,7 @@ static int knav_queue_probe(struct platform_device *pdev)
debugfs_create_file("qmss", S_IFREG | S_IRUGO, NULL, NULL, debugfs_create_file("qmss", S_IFREG | S_IRUGO, NULL, NULL,
&knav_queue_debug_ops); &knav_queue_debug_ops);
device_ready = true;
return 0; return 0;
err: err:
......
...@@ -167,6 +167,8 @@ struct knav_dma_desc { ...@@ -167,6 +167,8 @@ struct knav_dma_desc {
void *knav_dma_open_channel(struct device *dev, const char *name, void *knav_dma_open_channel(struct device *dev, const char *name,
struct knav_dma_cfg *config); struct knav_dma_cfg *config);
void knav_dma_close_channel(void *channel); void knav_dma_close_channel(void *channel);
int knav_dma_get_flow(void *channel);
bool knav_dma_device_ready(void);
#else #else
static inline void *knav_dma_open_channel(struct device *dev, const char *name, static inline void *knav_dma_open_channel(struct device *dev, const char *name,
struct knav_dma_cfg *config) struct knav_dma_cfg *config)
...@@ -176,6 +178,16 @@ static inline void *knav_dma_open_channel(struct device *dev, const char *name, ...@@ -176,6 +178,16 @@ static inline void *knav_dma_open_channel(struct device *dev, const char *name,
static inline void knav_dma_close_channel(void *channel) static inline void knav_dma_close_channel(void *channel)
{} {}
static inline int knav_dma_get_flow(void *channel)
{
return -EINVAL;
}
static inline bool knav_dma_device_ready(void)
{
return false;
}
#endif #endif
#endif /* __SOC_TI_KEYSTONE_NAVIGATOR_DMA_H__ */ #endif /* __SOC_TI_KEYSTONE_NAVIGATOR_DMA_H__ */
...@@ -86,5 +86,6 @@ int knav_pool_desc_map(void *ph, void *desc, unsigned size, ...@@ -86,5 +86,6 @@ int knav_pool_desc_map(void *ph, void *desc, unsigned size,
void *knav_pool_desc_unmap(void *ph, dma_addr_t dma, unsigned dma_sz); void *knav_pool_desc_unmap(void *ph, dma_addr_t dma, unsigned dma_sz);
dma_addr_t knav_pool_desc_virt_to_dma(void *ph, void *virt); dma_addr_t knav_pool_desc_virt_to_dma(void *ph, void *virt);
void *knav_pool_desc_dma_to_virt(void *ph, dma_addr_t dma); void *knav_pool_desc_dma_to_virt(void *ph, dma_addr_t dma);
bool knav_qmss_device_ready(void);
#endif /* __SOC_TI_KNAV_QMSS_H__ */ #endif /* __SOC_TI_KNAV_QMSS_H__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment