Re: [PATCH v3 02/14] soc: ti: k3: add navss ringacc driver

From: Grygorii Strashko
Date: Wed Oct 30 2019 - 09:09:57 EST




On 29/10/2019 10:52, Lokesh Vutla wrote:
Hi Grygorii,

[...snip..]

+
+static int k3_ringacc_ring_access_io(struct k3_ring *ring, void *elem,
+ enum k3_ringacc_access_mode access_mode)
+{
+ void __iomem *ptr;
+
+ switch (access_mode) {
+ case K3_RINGACC_ACCESS_MODE_PUSH_HEAD:
+ case K3_RINGACC_ACCESS_MODE_POP_HEAD:
+ ptr = (void __iomem *)&ring->fifos->head_data;
+ break;
+ case K3_RINGACC_ACCESS_MODE_PUSH_TAIL:
+ case K3_RINGACC_ACCESS_MODE_POP_TAIL:
+ ptr = (void __iomem *)&ring->fifos->tail_data;
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ ptr += k3_ringacc_ring_get_fifo_pos(ring);
+
+ switch (access_mode) {
+ case K3_RINGACC_ACCESS_MODE_POP_HEAD:
+ case K3_RINGACC_ACCESS_MODE_POP_TAIL:
+ dev_dbg(ring->parent->dev,
+ "memcpy_fromio(x): --> ptr(%p), mode:%d\n", ptr,
+ access_mode);
+ memcpy_fromio(elem, ptr, (4 << ring->elm_size));

Does this work for any elem_size < 64 or any element size not aligned with 64?

Max value of elem_size is 6 as per TRM.


IIUC, in message mode, ring element should be inserted in a single burst write
and there is no doorbell facility. If the above conditions are not met, we are
supposed to use proxy.

In this driver, I don't see any restrictions on the ring element size for
message mode and directly written to io. Am I missing something?


You are right and corresponding check can be added at k3_ringacc_ring_cfg() for the case
K3_RINGACC_RING_MODE_MESSAGE and no proxy

[..]

--
Best regards,
grygorii