diff options
author | Ludovic Desroches <ludovic.desroches@atmel.com> | 2012-05-16 09:26:01 -0400 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2012-05-17 08:43:00 -0400 |
commit | 6801c41a77123712accfde898820972a1f6fc117 (patch) | |
tree | a802be8f497eb4c24949a40dfd00d52d869b4ed6 /drivers/mmc/host/atmel-mci.c | |
parent | 24011f346471f7636f0ba6ffe2064fdd1a091daa (diff) |
mmc: atmel-mci: add debug logs
Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc/host/atmel-mci.c')
-rw-r--r-- | drivers/mmc/host/atmel-mci.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c index 5fe83008b746..420aca642b14 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c | |||
@@ -630,6 +630,7 @@ static void atmci_send_command(struct atmel_mci *host, | |||
630 | 630 | ||
631 | static void atmci_send_stop_cmd(struct atmel_mci *host, struct mmc_data *data) | 631 | static void atmci_send_stop_cmd(struct atmel_mci *host, struct mmc_data *data) |
632 | { | 632 | { |
633 | dev_dbg(&host->pdev->dev, "send stop command\n"); | ||
633 | atmci_send_command(host, data->stop, host->stop_cmdr); | 634 | atmci_send_command(host, data->stop, host->stop_cmdr); |
634 | atmci_writel(host, ATMCI_IER, ATMCI_CMDRDY); | 635 | atmci_writel(host, ATMCI_IER, ATMCI_CMDRDY); |
635 | } | 636 | } |
@@ -738,6 +739,8 @@ static void atmci_pdc_complete(struct atmel_mci *host) | |||
738 | * to send the stop command or waiting for NBUSY in this case. | 739 | * to send the stop command or waiting for NBUSY in this case. |
739 | */ | 740 | */ |
740 | if (host->data) { | 741 | if (host->data) { |
742 | dev_dbg(&host->pdev->dev, | ||
743 | "(%s) set pending xfer complete\n", __func__); | ||
741 | atmci_set_pending(host, EVENT_XFER_COMPLETE); | 744 | atmci_set_pending(host, EVENT_XFER_COMPLETE); |
742 | tasklet_schedule(&host->tasklet); | 745 | tasklet_schedule(&host->tasklet); |
743 | } | 746 | } |
@@ -775,6 +778,8 @@ static void atmci_dma_complete(void *arg) | |||
775 | * to send the stop command or waiting for NBUSY in this case. | 778 | * to send the stop command or waiting for NBUSY in this case. |
776 | */ | 779 | */ |
777 | if (data) { | 780 | if (data) { |
781 | dev_dbg(&host->pdev->dev, | ||
782 | "(%s) set pending xfer complete\n", __func__); | ||
778 | atmci_set_pending(host, EVENT_XFER_COMPLETE); | 783 | atmci_set_pending(host, EVENT_XFER_COMPLETE); |
779 | tasklet_schedule(&host->tasklet); | 784 | tasklet_schedule(&host->tasklet); |
780 | 785 | ||
@@ -1001,6 +1006,8 @@ atmci_submit_data_dma(struct atmel_mci *host, struct mmc_data *data) | |||
1001 | 1006 | ||
1002 | static void atmci_stop_transfer(struct atmel_mci *host) | 1007 | static void atmci_stop_transfer(struct atmel_mci *host) |
1003 | { | 1008 | { |
1009 | dev_dbg(&host->pdev->dev, | ||
1010 | "(%s) set pending xfer complete\n", __func__); | ||
1004 | atmci_set_pending(host, EVENT_XFER_COMPLETE); | 1011 | atmci_set_pending(host, EVENT_XFER_COMPLETE); |
1005 | atmci_writel(host, ATMCI_IER, ATMCI_NOTBUSY); | 1012 | atmci_writel(host, ATMCI_IER, ATMCI_NOTBUSY); |
1006 | } | 1013 | } |
@@ -1022,6 +1029,8 @@ static void atmci_stop_transfer_dma(struct atmel_mci *host) | |||
1022 | atmci_dma_cleanup(host); | 1029 | atmci_dma_cleanup(host); |
1023 | } else { | 1030 | } else { |
1024 | /* Data transfer was stopped by the interrupt handler */ | 1031 | /* Data transfer was stopped by the interrupt handler */ |
1032 | dev_dbg(&host->pdev->dev, | ||
1033 | "(%s) set pending xfer complete\n", __func__); | ||
1025 | atmci_set_pending(host, EVENT_XFER_COMPLETE); | 1034 | atmci_set_pending(host, EVENT_XFER_COMPLETE); |
1026 | atmci_writel(host, ATMCI_IER, ATMCI_NOTBUSY); | 1035 | atmci_writel(host, ATMCI_IER, ATMCI_NOTBUSY); |
1027 | } | 1036 | } |
@@ -1049,6 +1058,8 @@ static void atmci_start_request(struct atmel_mci *host, | |||
1049 | host->cmd_status = 0; | 1058 | host->cmd_status = 0; |
1050 | host->data_status = 0; | 1059 | host->data_status = 0; |
1051 | 1060 | ||
1061 | dev_dbg(&host->pdev->dev, "start request: cmd %u\n", mrq->cmd->opcode); | ||
1062 | |||
1052 | if (host->need_reset || host->caps.need_reset_after_xfer) { | 1063 | if (host->need_reset || host->caps.need_reset_after_xfer) { |
1053 | iflags = atmci_readl(host, ATMCI_IMR); | 1064 | iflags = atmci_readl(host, ATMCI_IMR); |
1054 | iflags &= (ATMCI_SDIOIRQA | ATMCI_SDIOIRQB); | 1065 | iflags &= (ATMCI_SDIOIRQA | ATMCI_SDIOIRQB); |
@@ -1129,6 +1140,7 @@ static void atmci_queue_request(struct atmel_mci *host, | |||
1129 | host->state = STATE_SENDING_CMD; | 1140 | host->state = STATE_SENDING_CMD; |
1130 | atmci_start_request(host, slot); | 1141 | atmci_start_request(host, slot); |
1131 | } else { | 1142 | } else { |
1143 | dev_dbg(&host->pdev->dev, "queue request\n"); | ||
1132 | list_add_tail(&slot->queue_node, &host->queue); | 1144 | list_add_tail(&slot->queue_node, &host->queue); |
1133 | } | 1145 | } |
1134 | spin_unlock_bh(&host->lock); | 1146 | spin_unlock_bh(&host->lock); |
@@ -1141,6 +1153,7 @@ static void atmci_request(struct mmc_host *mmc, struct mmc_request *mrq) | |||
1141 | struct mmc_data *data; | 1153 | struct mmc_data *data; |
1142 | 1154 | ||
1143 | WARN_ON(slot->mrq); | 1155 | WARN_ON(slot->mrq); |
1156 | dev_dbg(&host->pdev->dev, "MRQ: cmd %u\n", mrq->cmd->opcode); | ||
1144 | 1157 | ||
1145 | /* | 1158 | /* |
1146 | * We may "know" the card is gone even though there's still an | 1159 | * We may "know" the card is gone even though there's still an |
@@ -1530,6 +1543,7 @@ static void atmci_tasklet_func(unsigned long priv) | |||
1530 | 1543 | ||
1531 | do { | 1544 | do { |
1532 | prev_state = state; | 1545 | prev_state = state; |
1546 | dev_dbg(&host->pdev->dev, "FSM: state=%d\n", state); | ||
1533 | 1547 | ||
1534 | switch (state) { | 1548 | switch (state) { |
1535 | case STATE_IDLE: | 1549 | case STATE_IDLE: |
@@ -1542,14 +1556,18 @@ static void atmci_tasklet_func(unsigned long priv) | |||
1542 | * END_REQUEST by default, WAITING_NOTBUSY if it's a | 1556 | * END_REQUEST by default, WAITING_NOTBUSY if it's a |
1543 | * command needing it or DATA_XFER if there is data. | 1557 | * command needing it or DATA_XFER if there is data. |
1544 | */ | 1558 | */ |
1559 | dev_dbg(&host->pdev->dev, "FSM: cmd ready?\n"); | ||
1545 | if (!atmci_test_and_clear_pending(host, | 1560 | if (!atmci_test_and_clear_pending(host, |
1546 | EVENT_CMD_RDY)) | 1561 | EVENT_CMD_RDY)) |
1547 | break; | 1562 | break; |
1548 | 1563 | ||
1564 | dev_dbg(&host->pdev->dev, "set completed cmd ready\n"); | ||
1549 | host->cmd = NULL; | 1565 | host->cmd = NULL; |
1550 | atmci_set_completed(host, EVENT_CMD_RDY); | 1566 | atmci_set_completed(host, EVENT_CMD_RDY); |
1551 | atmci_command_complete(host, mrq->cmd); | 1567 | atmci_command_complete(host, mrq->cmd); |
1552 | if (mrq->data) { | 1568 | if (mrq->data) { |
1569 | dev_dbg(&host->pdev->dev, | ||
1570 | "command with data transfer"); | ||
1553 | /* | 1571 | /* |
1554 | * If there is a command error don't start | 1572 | * If there is a command error don't start |
1555 | * data transfer. | 1573 | * data transfer. |
@@ -1564,6 +1582,8 @@ static void atmci_tasklet_func(unsigned long priv) | |||
1564 | } else | 1582 | } else |
1565 | state = STATE_DATA_XFER; | 1583 | state = STATE_DATA_XFER; |
1566 | } else if ((!mrq->data) && (mrq->cmd->flags & MMC_RSP_BUSY)) { | 1584 | } else if ((!mrq->data) && (mrq->cmd->flags & MMC_RSP_BUSY)) { |
1585 | dev_dbg(&host->pdev->dev, | ||
1586 | "command response need waiting notbusy"); | ||
1567 | atmci_writel(host, ATMCI_IER, ATMCI_NOTBUSY); | 1587 | atmci_writel(host, ATMCI_IER, ATMCI_NOTBUSY); |
1568 | state = STATE_WAITING_NOTBUSY; | 1588 | state = STATE_WAITING_NOTBUSY; |
1569 | } else | 1589 | } else |
@@ -1574,6 +1594,7 @@ static void atmci_tasklet_func(unsigned long priv) | |||
1574 | case STATE_DATA_XFER: | 1594 | case STATE_DATA_XFER: |
1575 | if (atmci_test_and_clear_pending(host, | 1595 | if (atmci_test_and_clear_pending(host, |
1576 | EVENT_DATA_ERROR)) { | 1596 | EVENT_DATA_ERROR)) { |
1597 | dev_dbg(&host->pdev->dev, "set completed data error\n"); | ||
1577 | atmci_set_completed(host, EVENT_DATA_ERROR); | 1598 | atmci_set_completed(host, EVENT_DATA_ERROR); |
1578 | state = STATE_END_REQUEST; | 1599 | state = STATE_END_REQUEST; |
1579 | break; | 1600 | break; |
@@ -1586,10 +1607,14 @@ static void atmci_tasklet_func(unsigned long priv) | |||
1586 | * to the next step which is WAITING_NOTBUSY in write | 1607 | * to the next step which is WAITING_NOTBUSY in write |
1587 | * case and directly SENDING_STOP in read case. | 1608 | * case and directly SENDING_STOP in read case. |
1588 | */ | 1609 | */ |
1610 | dev_dbg(&host->pdev->dev, "FSM: xfer complete?\n"); | ||
1589 | if (!atmci_test_and_clear_pending(host, | 1611 | if (!atmci_test_and_clear_pending(host, |
1590 | EVENT_XFER_COMPLETE)) | 1612 | EVENT_XFER_COMPLETE)) |
1591 | break; | 1613 | break; |
1592 | 1614 | ||
1615 | dev_dbg(&host->pdev->dev, | ||
1616 | "(%s) set completed xfer complete\n", | ||
1617 | __func__); | ||
1593 | atmci_set_completed(host, EVENT_XFER_COMPLETE); | 1618 | atmci_set_completed(host, EVENT_XFER_COMPLETE); |
1594 | 1619 | ||
1595 | if (host->data->flags & MMC_DATA_WRITE) { | 1620 | if (host->data->flags & MMC_DATA_WRITE) { |
@@ -1614,10 +1639,12 @@ static void atmci_tasklet_func(unsigned long priv) | |||
1614 | * included) or a write operation. In the latest case, | 1639 | * included) or a write operation. In the latest case, |
1615 | * we need to send a stop command. | 1640 | * we need to send a stop command. |
1616 | */ | 1641 | */ |
1642 | dev_dbg(&host->pdev->dev, "FSM: not busy?\n"); | ||
1617 | if (!atmci_test_and_clear_pending(host, | 1643 | if (!atmci_test_and_clear_pending(host, |
1618 | EVENT_NOTBUSY)) | 1644 | EVENT_NOTBUSY)) |
1619 | break; | 1645 | break; |
1620 | 1646 | ||
1647 | dev_dbg(&host->pdev->dev, "set completed not busy\n"); | ||
1621 | atmci_set_completed(host, EVENT_NOTBUSY); | 1648 | atmci_set_completed(host, EVENT_NOTBUSY); |
1622 | 1649 | ||
1623 | if (host->data) { | 1650 | if (host->data) { |
@@ -1649,10 +1676,12 @@ static void atmci_tasklet_func(unsigned long priv) | |||
1649 | * in order to go to the end request state instead of | 1676 | * in order to go to the end request state instead of |
1650 | * sending stop again. | 1677 | * sending stop again. |
1651 | */ | 1678 | */ |
1679 | dev_dbg(&host->pdev->dev, "FSM: cmd ready?\n"); | ||
1652 | if (!atmci_test_and_clear_pending(host, | 1680 | if (!atmci_test_and_clear_pending(host, |
1653 | EVENT_CMD_RDY)) | 1681 | EVENT_CMD_RDY)) |
1654 | break; | 1682 | break; |
1655 | 1683 | ||
1684 | dev_dbg(&host->pdev->dev, "FSM: cmd ready\n"); | ||
1656 | host->cmd = NULL; | 1685 | host->cmd = NULL; |
1657 | host->data = NULL; | 1686 | host->data = NULL; |
1658 | data->bytes_xfered = data->blocks * data->blksz; | 1687 | data->bytes_xfered = data->blocks * data->blksz; |
@@ -1858,18 +1887,21 @@ static irqreturn_t atmci_interrupt(int irq, void *dev_id) | |||
1858 | break; | 1887 | break; |
1859 | 1888 | ||
1860 | if (pending & ATMCI_DATA_ERROR_FLAGS) { | 1889 | if (pending & ATMCI_DATA_ERROR_FLAGS) { |
1890 | dev_dbg(&host->pdev->dev, "IRQ: data error\n"); | ||
1861 | atmci_writel(host, ATMCI_IDR, ATMCI_DATA_ERROR_FLAGS | 1891 | atmci_writel(host, ATMCI_IDR, ATMCI_DATA_ERROR_FLAGS |
1862 | | ATMCI_RXRDY | ATMCI_TXRDY | 1892 | | ATMCI_RXRDY | ATMCI_TXRDY |
1863 | | ATMCI_ENDRX | ATMCI_ENDTX | 1893 | | ATMCI_ENDRX | ATMCI_ENDTX |
1864 | | ATMCI_RXBUFF | ATMCI_TXBUFE); | 1894 | | ATMCI_RXBUFF | ATMCI_TXBUFE); |
1865 | 1895 | ||
1866 | host->data_status = status; | 1896 | host->data_status = status; |
1897 | dev_dbg(&host->pdev->dev, "set pending data error\n"); | ||
1867 | smp_wmb(); | 1898 | smp_wmb(); |
1868 | atmci_set_pending(host, EVENT_DATA_ERROR); | 1899 | atmci_set_pending(host, EVENT_DATA_ERROR); |
1869 | tasklet_schedule(&host->tasklet); | 1900 | tasklet_schedule(&host->tasklet); |
1870 | } | 1901 | } |
1871 | 1902 | ||
1872 | if (pending & ATMCI_TXBUFE) { | 1903 | if (pending & ATMCI_TXBUFE) { |
1904 | dev_dbg(&host->pdev->dev, "IRQ: tx buffer empty\n"); | ||
1873 | atmci_writel(host, ATMCI_IDR, ATMCI_TXBUFE); | 1905 | atmci_writel(host, ATMCI_IDR, ATMCI_TXBUFE); |
1874 | atmci_writel(host, ATMCI_IDR, ATMCI_ENDTX); | 1906 | atmci_writel(host, ATMCI_IDR, ATMCI_ENDTX); |
1875 | /* | 1907 | /* |
@@ -1885,6 +1917,7 @@ static irqreturn_t atmci_interrupt(int irq, void *dev_id) | |||
1885 | atmci_pdc_complete(host); | 1917 | atmci_pdc_complete(host); |
1886 | } | 1918 | } |
1887 | } else if (pending & ATMCI_ENDTX) { | 1919 | } else if (pending & ATMCI_ENDTX) { |
1920 | dev_dbg(&host->pdev->dev, "IRQ: end of tx buffer\n"); | ||
1888 | atmci_writel(host, ATMCI_IDR, ATMCI_ENDTX); | 1921 | atmci_writel(host, ATMCI_IDR, ATMCI_ENDTX); |
1889 | 1922 | ||
1890 | if (host->data_size) { | 1923 | if (host->data_size) { |
@@ -1895,6 +1928,7 @@ static irqreturn_t atmci_interrupt(int irq, void *dev_id) | |||
1895 | } | 1928 | } |
1896 | 1929 | ||
1897 | if (pending & ATMCI_RXBUFF) { | 1930 | if (pending & ATMCI_RXBUFF) { |
1931 | dev_dbg(&host->pdev->dev, "IRQ: rx buffer full\n"); | ||
1898 | atmci_writel(host, ATMCI_IDR, ATMCI_RXBUFF); | 1932 | atmci_writel(host, ATMCI_IDR, ATMCI_RXBUFF); |
1899 | atmci_writel(host, ATMCI_IDR, ATMCI_ENDRX); | 1933 | atmci_writel(host, ATMCI_IDR, ATMCI_ENDRX); |
1900 | /* | 1934 | /* |
@@ -1910,6 +1944,7 @@ static irqreturn_t atmci_interrupt(int irq, void *dev_id) | |||
1910 | atmci_pdc_complete(host); | 1944 | atmci_pdc_complete(host); |
1911 | } | 1945 | } |
1912 | } else if (pending & ATMCI_ENDRX) { | 1946 | } else if (pending & ATMCI_ENDRX) { |
1947 | dev_dbg(&host->pdev->dev, "IRQ: end of rx buffer\n"); | ||
1913 | atmci_writel(host, ATMCI_IDR, ATMCI_ENDRX); | 1948 | atmci_writel(host, ATMCI_IDR, ATMCI_ENDRX); |
1914 | 1949 | ||
1915 | if (host->data_size) { | 1950 | if (host->data_size) { |
@@ -1926,15 +1961,19 @@ static irqreturn_t atmci_interrupt(int irq, void *dev_id) | |||
1926 | * The appropriate workaround is to use the BLKE signal. | 1961 | * The appropriate workaround is to use the BLKE signal. |
1927 | */ | 1962 | */ |
1928 | if (pending & ATMCI_BLKE) { | 1963 | if (pending & ATMCI_BLKE) { |
1964 | dev_dbg(&host->pdev->dev, "IRQ: blke\n"); | ||
1929 | atmci_writel(host, ATMCI_IDR, ATMCI_BLKE); | 1965 | atmci_writel(host, ATMCI_IDR, ATMCI_BLKE); |
1930 | smp_wmb(); | 1966 | smp_wmb(); |
1967 | dev_dbg(&host->pdev->dev, "set pending notbusy\n"); | ||
1931 | atmci_set_pending(host, EVENT_NOTBUSY); | 1968 | atmci_set_pending(host, EVENT_NOTBUSY); |
1932 | tasklet_schedule(&host->tasklet); | 1969 | tasklet_schedule(&host->tasklet); |
1933 | } | 1970 | } |
1934 | 1971 | ||
1935 | if (pending & ATMCI_NOTBUSY) { | 1972 | if (pending & ATMCI_NOTBUSY) { |
1973 | dev_dbg(&host->pdev->dev, "IRQ: not_busy\n"); | ||
1936 | atmci_writel(host, ATMCI_IDR, ATMCI_NOTBUSY); | 1974 | atmci_writel(host, ATMCI_IDR, ATMCI_NOTBUSY); |
1937 | smp_wmb(); | 1975 | smp_wmb(); |
1976 | dev_dbg(&host->pdev->dev, "set pending notbusy\n"); | ||
1938 | atmci_set_pending(host, EVENT_NOTBUSY); | 1977 | atmci_set_pending(host, EVENT_NOTBUSY); |
1939 | tasklet_schedule(&host->tasklet); | 1978 | tasklet_schedule(&host->tasklet); |
1940 | } | 1979 | } |
@@ -1945,9 +1984,11 @@ static irqreturn_t atmci_interrupt(int irq, void *dev_id) | |||
1945 | atmci_write_data_pio(host); | 1984 | atmci_write_data_pio(host); |
1946 | 1985 | ||
1947 | if (pending & ATMCI_CMDRDY) { | 1986 | if (pending & ATMCI_CMDRDY) { |
1987 | dev_dbg(&host->pdev->dev, "IRQ: cmd ready\n"); | ||
1948 | atmci_writel(host, ATMCI_IDR, ATMCI_CMDRDY); | 1988 | atmci_writel(host, ATMCI_IDR, ATMCI_CMDRDY); |
1949 | host->cmd_status = status; | 1989 | host->cmd_status = status; |
1950 | smp_wmb(); | 1990 | smp_wmb(); |
1991 | dev_dbg(&host->pdev->dev, "set pending cmd rdy\n"); | ||
1951 | atmci_set_pending(host, EVENT_CMD_RDY); | 1992 | atmci_set_pending(host, EVENT_CMD_RDY); |
1952 | tasklet_schedule(&host->tasklet); | 1993 | tasklet_schedule(&host->tasklet); |
1953 | } | 1994 | } |