Skip to content

Commit 4dc953b

Browse files
plbossartvinodkoul
authored andcommitted
soundwire: cadence: split access to IP_MCP_CONTROL fields
The latest Cadence IP splits the MCP_CONTROL fields in two registers: MCP_CONTROL and IP_MCP_CONTROL. Rename the relevant fields and change the access methods used for those fields. For existing solutions, this is an iso-functionality change. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Link: https://lore.kernel.org/r/20230314015410.487311-15-yung-chuan.liao@linux.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent c575371 commit 4dc953b

1 file changed

Lines changed: 25 additions & 16 deletions

File tree

drivers/soundwire/cadence_master.c

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,18 @@ MODULE_PARM_DESC(cdns_mcp_int_mask, "Cadence MCP IntMask");
4141

4242
#define CDNS_MCP_CONTROL 0x4
4343

44-
#define CDNS_MCP_CONTROL_RST_DELAY GENMASK(10, 8)
4544
#define CDNS_MCP_CONTROL_CMD_RST BIT(7)
4645
#define CDNS_MCP_CONTROL_SOFT_RST BIT(6)
47-
#define CDNS_MCP_CONTROL_SW_RST BIT(5)
4846
#define CDNS_MCP_CONTROL_HW_RST BIT(4)
49-
#define CDNS_MCP_CONTROL_CLK_PAUSE BIT(3)
5047
#define CDNS_MCP_CONTROL_CLK_STOP_CLR BIT(2)
51-
#define CDNS_MCP_CONTROL_CMD_ACCEPT BIT(1)
52-
#define CDNS_MCP_CONTROL_BLOCK_WAKEUP BIT(0)
48+
49+
#define CDNS_IP_MCP_CONTROL 0x4 /* IP offset added at run-time */
50+
51+
#define CDNS_IP_MCP_CONTROL_RST_DELAY GENMASK(10, 8)
52+
#define CDNS_IP_MCP_CONTROL_SW_RST BIT(5)
53+
#define CDNS_IP_MCP_CONTROL_CLK_PAUSE BIT(3)
54+
#define CDNS_IP_MCP_CONTROL_CMD_ACCEPT BIT(1)
55+
#define CDNS_IP_MCP_CONTROL_BLOCK_WAKEUP BIT(0)
5356

5457
#define CDNS_MCP_CMDCTRL 0x8
5558

@@ -1050,24 +1053,30 @@ static void cdns_update_slave_status_work(struct work_struct *work)
10501053
void sdw_cdns_check_self_clearing_bits(struct sdw_cdns *cdns, const char *string,
10511054
bool initial_delay, int reset_iterations)
10521055
{
1056+
u32 ip_mcp_control;
10531057
u32 mcp_control;
10541058
u32 mcp_config_update;
10551059
int i;
10561060

10571061
if (initial_delay)
10581062
usleep_range(1000, 1500);
10591063

1064+
ip_mcp_control = cdns_ip_readl(cdns, CDNS_IP_MCP_CONTROL);
1065+
1066+
/* the following bits should be cleared immediately */
1067+
if (ip_mcp_control & CDNS_IP_MCP_CONTROL_SW_RST)
1068+
dev_err(cdns->dev, "%s failed: IP_MCP_CONTROL_SW_RST is not cleared\n", string);
1069+
10601070
mcp_control = cdns_readl(cdns, CDNS_MCP_CONTROL);
10611071

10621072
/* the following bits should be cleared immediately */
10631073
if (mcp_control & CDNS_MCP_CONTROL_CMD_RST)
10641074
dev_err(cdns->dev, "%s failed: MCP_CONTROL_CMD_RST is not cleared\n", string);
10651075
if (mcp_control & CDNS_MCP_CONTROL_SOFT_RST)
10661076
dev_err(cdns->dev, "%s failed: MCP_CONTROL_SOFT_RST is not cleared\n", string);
1067-
if (mcp_control & CDNS_MCP_CONTROL_SW_RST)
1068-
dev_err(cdns->dev, "%s failed: MCP_CONTROL_SW_RST is not cleared\n", string);
10691077
if (mcp_control & CDNS_MCP_CONTROL_CLK_STOP_CLR)
10701078
dev_err(cdns->dev, "%s failed: MCP_CONTROL_CLK_STOP_CLR is not cleared\n", string);
1079+
10711080
mcp_config_update = cdns_readl(cdns, CDNS_MCP_CONFIG_UPDATE);
10721081
if (mcp_config_update & CDNS_MCP_CONFIG_UPDATE_BIT)
10731082
dev_err(cdns->dev, "%s failed: MCP_CONFIG_UPDATE_BIT is not cleared\n", string);
@@ -1344,8 +1353,8 @@ int sdw_cdns_init(struct sdw_cdns *cdns)
13441353
CDNS_MCP_CONTROL_CMD_RST);
13451354

13461355
/* Set cmd accept mode */
1347-
cdns_updatel(cdns, CDNS_MCP_CONTROL, CDNS_MCP_CONTROL_CMD_ACCEPT,
1348-
CDNS_MCP_CONTROL_CMD_ACCEPT);
1356+
cdns_ip_updatel(cdns, CDNS_IP_MCP_CONTROL, CDNS_IP_MCP_CONTROL_CMD_ACCEPT,
1357+
CDNS_IP_MCP_CONTROL_CMD_ACCEPT);
13491358

13501359
/* Configure mcp config */
13511360
val = cdns_readl(cdns, CDNS_MCP_CONFIG);
@@ -1606,9 +1615,9 @@ int sdw_cdns_clock_stop(struct sdw_cdns *cdns, bool block_wake)
16061615
* in clock stop state
16071616
*/
16081617
if (block_wake)
1609-
cdns_updatel(cdns, CDNS_MCP_CONTROL,
1610-
CDNS_MCP_CONTROL_BLOCK_WAKEUP,
1611-
CDNS_MCP_CONTROL_BLOCK_WAKEUP);
1618+
cdns_ip_updatel(cdns, CDNS_IP_MCP_CONTROL,
1619+
CDNS_IP_MCP_CONTROL_BLOCK_WAKEUP,
1620+
CDNS_IP_MCP_CONTROL_BLOCK_WAKEUP);
16121621

16131622
list_for_each_entry(slave, &cdns->bus.slaves, node) {
16141623
if (slave->status == SDW_SLAVE_ATTACHED ||
@@ -1681,11 +1690,11 @@ int sdw_cdns_clock_restart(struct sdw_cdns *cdns, bool bus_reset)
16811690
return ret;
16821691
}
16831692

1684-
cdns_updatel(cdns, CDNS_MCP_CONTROL,
1685-
CDNS_MCP_CONTROL_BLOCK_WAKEUP, 0);
1693+
cdns_ip_updatel(cdns, CDNS_IP_MCP_CONTROL,
1694+
CDNS_IP_MCP_CONTROL_BLOCK_WAKEUP, 0);
16861695

1687-
cdns_updatel(cdns, CDNS_MCP_CONTROL, CDNS_MCP_CONTROL_CMD_ACCEPT,
1688-
CDNS_MCP_CONTROL_CMD_ACCEPT);
1696+
cdns_ip_updatel(cdns, CDNS_IP_MCP_CONTROL, CDNS_IP_MCP_CONTROL_CMD_ACCEPT,
1697+
CDNS_IP_MCP_CONTROL_CMD_ACCEPT);
16891698

16901699
if (!bus_reset) {
16911700

0 commit comments

Comments
 (0)