Commit 74e931f0 authored by Jarkko Nikula's avatar Jarkko Nikula Committed by Alexandre Belloni

i3c: mipi-i3c-hci: Switch to lower_32_bits()/upper_32_bits() helpers

Rather than having own lo32()/hi32() helpers for dealing with 32-bit and
64-bit build targets switch to generic lower_32_bits()/upper_32_bits()
helpers.
Signed-off-by: default avatarJarkko Nikula <jarkko.nikula@linux.intel.com>
Link: https://lore.kernel.org/r/20240628131559.502822-1-jarkko.nikula@linux.intel.comSigned-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
parent d9deb28f
...@@ -147,21 +147,6 @@ struct hci_dma_dev_ibi_data { ...@@ -147,21 +147,6 @@ struct hci_dma_dev_ibi_data {
unsigned int max_len; unsigned int max_len;
}; };
static inline u32 lo32(dma_addr_t physaddr)
{
return physaddr;
}
static inline u32 hi32(dma_addr_t physaddr)
{
/* trickery to avoid compiler warnings on 32-bit build targets */
if (sizeof(dma_addr_t) > 4) {
u64 hi = physaddr;
return hi >> 32;
}
return 0;
}
static void hci_dma_cleanup(struct i3c_hci *hci) static void hci_dma_cleanup(struct i3c_hci *hci)
{ {
struct hci_rings_data *rings = hci->io_data; struct hci_rings_data *rings = hci->io_data;
...@@ -265,10 +250,10 @@ static int hci_dma_init(struct i3c_hci *hci) ...@@ -265,10 +250,10 @@ static int hci_dma_init(struct i3c_hci *hci)
if (!rh->xfer || !rh->resp || !rh->src_xfers) if (!rh->xfer || !rh->resp || !rh->src_xfers)
goto err_out; goto err_out;
rh_reg_write(CMD_RING_BASE_LO, lo32(rh->xfer_dma)); rh_reg_write(CMD_RING_BASE_LO, lower_32_bits(rh->xfer_dma));
rh_reg_write(CMD_RING_BASE_HI, hi32(rh->xfer_dma)); rh_reg_write(CMD_RING_BASE_HI, upper_32_bits(rh->xfer_dma));
rh_reg_write(RESP_RING_BASE_LO, lo32(rh->resp_dma)); rh_reg_write(RESP_RING_BASE_LO, lower_32_bits(rh->resp_dma));
rh_reg_write(RESP_RING_BASE_HI, hi32(rh->resp_dma)); rh_reg_write(RESP_RING_BASE_HI, upper_32_bits(rh->resp_dma));
regval = FIELD_PREP(CR_RING_SIZE, rh->xfer_entries); regval = FIELD_PREP(CR_RING_SIZE, rh->xfer_entries);
rh_reg_write(CR_SETUP, regval); rh_reg_write(CR_SETUP, regval);
...@@ -404,8 +389,8 @@ static int hci_dma_queue_xfer(struct i3c_hci *hci, ...@@ -404,8 +389,8 @@ static int hci_dma_queue_xfer(struct i3c_hci *hci,
hci_dma_unmap_xfer(hci, xfer_list, i); hci_dma_unmap_xfer(hci, xfer_list, i);
return -ENOMEM; return -ENOMEM;
} }
*ring_data++ = lo32(xfer->data_dma); *ring_data++ = lower_32_bits(xfer->data_dma);
*ring_data++ = hi32(xfer->data_dma); *ring_data++ = upper_32_bits(xfer->data_dma);
} else { } else {
*ring_data++ = 0; *ring_data++ = 0;
*ring_data++ = 0; *ring_data++ = 0;
......
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