|
5 | 5 |
|
6 | 6 | #include <linux/acpi.h> |
7 | 7 | #include <linux/clk.h> |
| 8 | +#include <linux/cleanup.h> |
8 | 9 | #include <linux/delay.h> |
9 | 10 | #include <linux/devfreq.h> |
10 | 11 | #include <linux/gpio/consumer.h> |
@@ -98,6 +99,24 @@ static const struct __ufs_qcom_bw_table { |
98 | 99 | [MODE_MAX][0][0] = { 7643136, 819200 }, |
99 | 100 | }; |
100 | 101 |
|
| 102 | +static const struct { |
| 103 | + int nminor; |
| 104 | + char *prefix; |
| 105 | +} testbus_info[TSTBUS_MAX] = { |
| 106 | + [TSTBUS_UAWM] = {32, "TSTBUS_UAWM"}, |
| 107 | + [TSTBUS_UARM] = {32, "TSTBUS_UARM"}, |
| 108 | + [TSTBUS_TXUC] = {32, "TSTBUS_TXUC"}, |
| 109 | + [TSTBUS_RXUC] = {32, "TSTBUS_RXUC"}, |
| 110 | + [TSTBUS_DFC] = {32, "TSTBUS_DFC"}, |
| 111 | + [TSTBUS_TRLUT] = {32, "TSTBUS_TRLUT"}, |
| 112 | + [TSTBUS_TMRLUT] = {32, "TSTBUS_TMRLUT"}, |
| 113 | + [TSTBUS_OCSC] = {32, "TSTBUS_OCSC"}, |
| 114 | + [TSTBUS_UTP_HCI] = {32, "TSTBUS_UTP_HCI"}, |
| 115 | + [TSTBUS_COMBINED] = {32, "TSTBUS_COMBINED"}, |
| 116 | + [TSTBUS_WRAPPER] = {32, "TSTBUS_WRAPPER"}, |
| 117 | + [TSTBUS_UNIPRO] = {256, "TSTBUS_UNIPRO"}, |
| 118 | +}; |
| 119 | + |
101 | 120 | static void ufs_qcom_get_default_testbus_cfg(struct ufs_qcom_host *host); |
102 | 121 | static int ufs_qcom_set_core_clk_ctrl(struct ufs_hba *hba, unsigned long freq); |
103 | 122 |
|
@@ -1566,6 +1585,32 @@ int ufs_qcom_testbus_config(struct ufs_qcom_host *host) |
1566 | 1585 | return 0; |
1567 | 1586 | } |
1568 | 1587 |
|
| 1588 | +static void ufs_qcom_dump_testbus(struct ufs_hba *hba) |
| 1589 | +{ |
| 1590 | + struct ufs_qcom_host *host = ufshcd_get_variant(hba); |
| 1591 | + int i, j, nminor = 0, testbus_len = 0; |
| 1592 | + u32 *testbus __free(kfree) = NULL; |
| 1593 | + char *prefix; |
| 1594 | + |
| 1595 | + testbus = kmalloc_array(256, sizeof(u32), GFP_KERNEL); |
| 1596 | + if (!testbus) |
| 1597 | + return; |
| 1598 | + |
| 1599 | + for (j = 0; j < TSTBUS_MAX; j++) { |
| 1600 | + nminor = testbus_info[j].nminor; |
| 1601 | + prefix = testbus_info[j].prefix; |
| 1602 | + host->testbus.select_major = j; |
| 1603 | + testbus_len = nminor * sizeof(u32); |
| 1604 | + for (i = 0; i < nminor; i++) { |
| 1605 | + host->testbus.select_minor = i; |
| 1606 | + ufs_qcom_testbus_config(host); |
| 1607 | + testbus[i] = ufshcd_readl(hba, UFS_TEST_BUS); |
| 1608 | + } |
| 1609 | + print_hex_dump(KERN_ERR, prefix, DUMP_PREFIX_OFFSET, |
| 1610 | + 16, 4, testbus, testbus_len, false); |
| 1611 | + } |
| 1612 | +} |
| 1613 | + |
1569 | 1614 | static int ufs_qcom_dump_regs(struct ufs_hba *hba, size_t offset, size_t len, |
1570 | 1615 | const char *prefix, enum ufshcd_res id) |
1571 | 1616 | { |
@@ -1688,6 +1733,11 @@ static void ufs_qcom_dump_dbg_regs(struct ufs_hba *hba) |
1688 | 1733 | /* Dump MCQ Host Vendor Specific Registers */ |
1689 | 1734 | if (hba->mcq_enabled) |
1690 | 1735 | ufs_qcom_dump_mcq_hci_regs(hba); |
| 1736 | + |
| 1737 | + /* voluntarily yield the CPU as we are dumping too much data */ |
| 1738 | + ufshcd_dump_regs(hba, UFS_TEST_BUS, 4, "UFS_TEST_BUS "); |
| 1739 | + cond_resched(); |
| 1740 | + ufs_qcom_dump_testbus(hba); |
1691 | 1741 | } |
1692 | 1742 | } |
1693 | 1743 |
|
|
0 commit comments