Skip to content

Commit 0d1aadf

Browse files
ConchuODJassiBrar
authored andcommitted
mailbox: mpfs: account for mbox offsets while sending
The mailbox offset is not only used for receiving messages, but it is also used by messages sent to the system controller by Linux that have a payload, such as the "digital signature service". It is also overloaded by certain other services (reprogramming of the FPGA fabric, see Link:) to have a meaning other than the offset the system controller should read from. When the driver was written, no such services of the latter type were in use & those of the former used an offset of zero so this has gone un-noticed. Link: https://www.microsemi.com/document-portal/doc_download/1245815-polarfire-fpga-and-polarfire-soc-fpga-system-services-user-guide # Section 5.2 Fixes: 83d7b15 ("mbox: add polarfire soc system controller mailbox") Signed-off-by: Conor Dooley <conor.dooley@microchip.com> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
1 parent 2e10289 commit 0d1aadf

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

drivers/mailbox/mailbox-mpfs.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,21 +100,20 @@ static int mpfs_mbox_send_data(struct mbox_chan *chan, void *data)
100100

101101
for (index = 0; index < (msg->cmd_data_size / 4); index++)
102102
writel_relaxed(word_buf[index],
103-
mbox->mbox_base + index * 0x4);
103+
mbox->mbox_base + msg->mbox_offset + index * 0x4);
104104
if (extra_bits) {
105105
u8 i;
106106
u8 byte_off = ALIGN_DOWN(msg->cmd_data_size, 4);
107107
u8 *byte_buf = msg->cmd_data + byte_off;
108108

109-
val = readl_relaxed(mbox->mbox_base + index * 0x4);
109+
val = readl_relaxed(mbox->mbox_base + msg->mbox_offset + index * 0x4);
110110

111111
for (i = 0u; i < extra_bits; i++) {
112112
val &= ~(0xffu << (i * 8u));
113113
val |= (byte_buf[i] << (i * 8u));
114114
}
115115

116-
writel_relaxed(val,
117-
mbox->mbox_base + index * 0x4);
116+
writel_relaxed(val, mbox->mbox_base + msg->mbox_offset + index * 0x4);
118117
}
119118
}
120119

0 commit comments

Comments
 (0)