@@ -127,6 +127,28 @@ uint32_t ssi_transfer(SSIBus *bus, uint32_t val)
return r;
}
+uint32_t ssi_txfifo_transfer(SSIBus *bus, uint32_t val)
+{
+ BusState *b = BUS(bus);
+ BusChild *kid;
+ SSIPeripheralClass *ssc;
+ uint32_t r = 0;
+
+ QTAILQ_FOREACH(kid, &b->children, sibling) {
+ SSIPeripheral *peripheral = SSI_PERIPHERAL(kid->child);
+ ssc = SSI_PERIPHERAL_GET_CLASS(peripheral);
+ if (ssc->set_dummy_byte_accuracy) {
+ ssc->set_dummy_byte_accuracy(peripheral, true);
+ }
+ r |= ssc->transfer_raw(peripheral, val);
+ if (ssc->set_dummy_byte_accuracy) {
+ ssc->set_dummy_byte_accuracy(peripheral, false);
+ }
+ }
+
+ return r;
+}
+
const VMStateDescription vmstate_ssi_peripheral = {
.name = "SSISlave",
.version_id = 1,
@@ -54,6 +54,8 @@ struct SSIPeripheralClass {
* always be called for the device for every txrx access to the parent bus
*/
uint32_t (*transfer_raw)(SSIPeripheral *dev, uint32_t val);
+
+ void (*set_dummy_byte_accuracy)(SSIPeripheral *dev, bool val);
};
struct SSIPeripheral {
@@ -105,5 +107,6 @@ bool ssi_realize_and_unref(DeviceState *dev, SSIBus *bus, Error **errp);
SSIBus *ssi_create_bus(DeviceState *parent, const char *name);
uint32_t ssi_transfer(SSIBus *bus, uint32_t val);
+uint32_t ssi_txfifo_transfer(SSIBus *bus, uint32_t val);
#endif
This patch introduces ssi_txfifo_transfer aimed to be used by SPI controllers transfering through a txfifo. When interacting with a SPI flash (m25p80), ssi_txfifo_transfer will toggle the accuracy from dummy clock cycles to dummy bytes and by doing this above mentioned SPI controllers will obtain support for the commands requiring those. Signed-off-by: Francisco Iglesias <frasse.iglesias@gmail.com> --- hw/ssi/ssi.c | 22 ++++++++++++++++++++++ include/hw/ssi/ssi.h | 3 +++ 2 files changed, 25 insertions(+)