Commit c93749e4 authored by Pavel Pisa's avatar Pavel Pisa Committed by Ille, Ondrej, Ing.

driver: update after MODE, SETTINGS, COMMAND, STATUS split.

Signed-off-by: Pavel Pisa's avatarPavel Pisa <pisa@cmp.felk.cvut.cz>
parent 901a996a
......@@ -139,7 +139,7 @@ u32 ctu_can_fd_get_version(struct ctucanfd_priv *priv)
void ctu_can_fd_enable(struct ctucanfd_priv *priv, bool enable)
{
union ctu_can_fd_mode_command_status_settings reg;
union ctu_can_fd_mode_settings reg;
reg.u32 = priv->read_reg(priv, CTU_CAN_FD_MODE);
reg.s.ena = enable ? CTU_CAN_ENABLED : CTU_CAN_DISABLED;
......@@ -148,7 +148,7 @@ void ctu_can_fd_enable(struct ctucanfd_priv *priv, bool enable)
void ctu_can_fd_reset(struct ctucanfd_priv *priv)
{
union ctu_can_fd_mode_command_status_settings mode;
union ctu_can_fd_mode_settings mode;
mode.u32 = 0;
mode.s.rst = 1;
......@@ -160,7 +160,7 @@ void ctu_can_fd_reset(struct ctucanfd_priv *priv)
bool ctu_can_fd_set_ret_limit(struct ctucanfd_priv *priv, bool enable, u8 limit)
{
union ctu_can_fd_mode_command_status_settings reg;
union ctu_can_fd_mode_settings reg;
if (limit > CTU_CAN_FD_RETR_MAX)
return false;
......@@ -176,7 +176,7 @@ void ctu_can_fd_set_mode_reg(struct ctucanfd_priv *priv,
const struct can_ctrlmode *mode)
{
u32 flags = mode->flags;
union ctu_can_fd_mode_command_status_settings reg;
union ctu_can_fd_mode_settings reg;
reg.u32 = priv->read_reg(priv, CTU_CAN_FD_MODE);
......@@ -211,29 +211,29 @@ void ctu_can_fd_set_mode_reg(struct ctucanfd_priv *priv,
void ctu_can_fd_rel_rx_buf(struct ctucanfd_priv *priv)
{
union ctu_can_fd_mode_command_status_settings reg;
union ctu_can_fd_status_command reg;
reg.u32 = priv->read_reg(priv, CTU_CAN_FD_MODE);
reg.u32 = 0;
reg.s.rrb = 1;
priv->write_reg(priv, CTU_CAN_FD_MODE, reg.u32);
priv->write_reg(priv, CTU_CAN_FD_STATUS, reg.u32);
}
void ctu_can_fd_clr_overrun_flag(struct ctucanfd_priv *priv)
{
union ctu_can_fd_mode_command_status_settings reg;
union ctu_can_fd_status_command reg;
reg.u32 = priv->read_reg(priv, CTU_CAN_FD_MODE);
reg.u32 = 0;
reg.s.cdo = 1;
priv->write_reg(priv, CTU_CAN_FD_MODE, reg.u32);
priv->write_reg(priv, CTU_CAN_FD_STATUS, reg.u32);
}
void ctu_can_fd_abort_tx(struct ctucanfd_priv *priv)
{
union ctu_can_fd_mode_command_status_settings reg;
union ctu_can_fd_status_command reg;
reg.u32 = priv->read_reg(priv, CTU_CAN_FD_MODE);
reg.u32 = 0;
reg.s.abt = 1;
priv->write_reg(priv, CTU_CAN_FD_MODE, reg.u32);
priv->write_reg(priv, CTU_CAN_FD_STATUS, reg.u32);
}
// TODO: rather than set(value, mask) interface, provide
......
......@@ -291,13 +291,13 @@ void ctu_can_fd_abort_tx(struct ctucanfd_priv *priv);
* Returns:
* Mode/status structure with multiple mode flags.
*/
static inline union ctu_can_fd_mode_command_status_settings
static inline union ctu_can_fd_status_command
ctu_can_get_status(struct ctucanfd_priv *priv)
{
/* MODE and STATUS are within the same word */
union ctu_can_fd_mode_command_status_settings res;
union ctu_can_fd_status_command res;
res.u32 = priv->read_reg(priv, CTU_CAN_FD_MODE);
res.u32 = priv->read_reg(priv, CTU_CAN_FD_STATUS);
return res;
}
......@@ -313,7 +313,7 @@ static inline union ctu_can_fd_mode_command_status_settings
*/
static inline bool ctu_can_fd_is_enabled(struct ctucanfd_priv *priv)
{
union ctu_can_fd_mode_command_status_settings reg;
union ctu_can_fd_mode_settings reg;
reg.u32 = priv->read_reg(priv, CTU_CAN_FD_MODE);
return reg.s.ena == CTU_CAN_ENABLED;
......
......@@ -252,8 +252,8 @@ int main(int argc, char *argv[])
addrs[0] = pci_find_bar(0x1172, 0xcafd, 0, 1);
if (!addrs[0])
addrs[0] = pci_find_bar(0x1760, 0xff00, 0, 1);
if (!addrs[0])
err(1, "-p PCI device not found");
if (!addrs[0])
err(1, "-p PCI device not found");
addrs[1] = addrs[0] + 0x4000;
break;
case 'h':
......@@ -323,7 +323,7 @@ int main(int argc, char *argv[])
ctu_can_fd_reset(priv);
{
union ctu_can_fd_mode_command_status_settings mode;
union ctu_can_fd_mode_settings mode;
mode.u32 = priv->read_reg(priv, CTU_CAN_FD_MODE);
if (mode.s.ena) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment