return qmc_chan;
 }
 
+int qmc_chan_count_phandles(struct device_node *np, const char *phandles_name)
+{
+       int count;
+
+       /* phandles are fixed args phandles with one arg */
+       count = of_count_phandle_with_args(np, phandles_name, NULL);
+       if (count < 0)
+               return count;
+
+       return count / 2;
+}
+EXPORT_SYMBOL(qmc_chan_count_phandles);
+
 struct qmc_chan *qmc_chan_get_byphandles_index(struct device_node *np,
                                               const char *phandles_name,
                                               int index)
 
 struct device;
 struct qmc_chan;
 
+int qmc_chan_count_phandles(struct device_node *np, const char *phandles_name);
+
 struct qmc_chan *qmc_chan_get_byphandles_index(struct device_node *np,
                                               const char *phandles_name,
                                               int index);