aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/omap_hsi
diff options
context:
space:
mode:
authorDjamil Elaidi <d-elaidi@ti.com>2011-11-11 13:55:48 +0100
committerDan Murphy <dmurphy@ti.com>2011-12-06 08:12:19 -0600
commit9ba0feb1ee3f6b7f0c5e120b1b8922a5157e2e6f (patch)
tree624de0a5ef9e7fd1a7493d939d0541f3e99aaf16 /drivers/omap_hsi
parentc3a20057083a146990ee829d668e658ea0e77896 (diff)
downloadkernel_samsung_espresso10-9ba0feb1ee3f6b7f0c5e120b1b8922a5157e2e6f.zip
kernel_samsung_espresso10-9ba0feb1ee3f6b7f0c5e120b1b8922a5157e2e6f.tar.gz
kernel_samsung_espresso10-9ba0feb1ee3f6b7f0c5e120b1b8922a5157e2e6f.tar.bz2
OMAP3: xSI: add RX/TX transfer ongoing function
New functions to check if HSI or SSI controller, port or channel has a read or write pending. Change-Id: Id0bad5e359de6aaeddc517d3d92d0db795d55cc1 Signed-off-by: Djamil Elaidi <d-elaidi@ti.com>
Diffstat (limited to 'drivers/omap_hsi')
-rw-r--r--drivers/omap_hsi/hsi_driver.h3
-rw-r--r--drivers/omap_hsi/hsi_driver_int.c50
2 files changed, 53 insertions, 0 deletions
diff --git a/drivers/omap_hsi/hsi_driver.h b/drivers/omap_hsi/hsi_driver.h
index 411b488..abe090f 100644
--- a/drivers/omap_hsi/hsi_driver.h
+++ b/drivers/omap_hsi/hsi_driver.h
@@ -247,6 +247,9 @@ void hsi_bus_exit(void);
void hsi_reset_ch_read(struct hsi_channel *ch);
void hsi_reset_ch_write(struct hsi_channel *ch);
+bool hsi_is_channel_transfer_ongoing(struct hsi_channel *ch);
+bool hsi_is_port_transfer_ongoing(struct hsi_port *pport);
+bool hsi_is_controller_transfer_ongoing(struct hsi_dev *hsi_ctrl);
bool hsi_is_channel_busy(struct hsi_channel *ch);
bool hsi_is_hsi_port_busy(struct hsi_port *pport);
bool hsi_is_hsi_controller_busy(struct hsi_dev *hsi_ctrl);
diff --git a/drivers/omap_hsi/hsi_driver_int.c b/drivers/omap_hsi/hsi_driver_int.c
index f4143c8..8451798 100644
--- a/drivers/omap_hsi/hsi_driver_int.c
+++ b/drivers/omap_hsi/hsi_driver_int.c
@@ -35,6 +35,56 @@ void hsi_reset_ch_write(struct hsi_channel *ch)
ch->write_data.lch = -1;
}
+/* Check if a Write (data transfer from AP to CP) or
+ * Read (data transfer from CP to AP) is
+ * ongoing for a given HSI channel
+ */
+bool hsi_is_channel_transfer_ongoing(struct hsi_channel *ch)
+{
+ if ((ch->write_data.addr == NULL) && (ch->read_data.addr == NULL))
+ return false;
+
+ return true;
+}
+
+/* Check if a Write (data transfer from AP to CP) or
+ * Read (data transfer from CP to AP) is
+ * ongoing in given HSI port
+ */
+bool hsi_is_port_transfer_ongoing(struct hsi_port *pport)
+{
+ struct hsi_dev *hsi_ctrl = pport->hsi_controller;
+ int ch;
+
+ for (ch = 0; ch < pport->max_ch; ch++)
+ if (hsi_is_channel_transfer_ongoing(&pport->hsi_channel[ch])) {
+ dev_dbg(hsi_ctrl->dev, "Port %d; channel %d transfer"
+ "ongoing\n", pport->port_number, ch);
+ return true;
+ }
+
+ return false;
+}
+
+/* Check if a Write (data transfer from AP to CP) or
+ * Read (data transfer from CP to AP) is
+ * ongoing in whole HSI controller
+ */
+bool hsi_is_controller_transfer_ongoing(struct hsi_dev *hsi_ctrl)
+{
+ int port;
+
+ for (port = 0; port < hsi_ctrl->max_p; port++)
+ if (hsi_is_port_transfer_ongoing(&hsi_ctrl->hsi_port[port])) {
+ dev_dbg(hsi_ctrl->dev, "Transfer ongoing in Port %d\n",
+ port + 1);
+ return true;
+ }
+
+ dev_dbg(hsi_ctrl->dev, "No Transfer ongoing in HSI controller\n");
+ return false;
+}
+
/* Check if a Write (data transfer from AP to CP) is
* ongoing for a given HSI channel
*/