Commit e57a80e9 authored by Mamta Shukla's avatar Mamta Shukla

sw: spi: Add check for Divider value

Adding condition to warn about 0 divider value.
It was observed while accessing svec-flash, if frequency for flash is not defined correctly i.e
in operation range of chip and host(i.e vme or pci), divider value 0 doesn't allow flash transfers.

Signed-off-by Mamta Shukla <mamta.ramendra.shukla@cern.ch>
Suggested-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent 347e0de1
......@@ -481,6 +481,12 @@ static int spi_ocores_sw_xfer_next_init(struct spi_ocores *sp)
else
hz = sp->master->cur_msg->spi->max_speed_hz;
divider = (sp->clock_hz / (hz * 2)) - 1;
if (WARN_ON(divider == 0)) {
dev_warn(&sp->master->dev, "divider value is 0\n");
divider =1;
}
spi_ocores_hw_xfer_config(sp, ctrl, divider);
......
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