
On Mon, Aug 7, 2017 at 10:31 PM, Chris Packham judge.packham@gmail.com wrote:
Hi,
I'm looking at a problem on the db-88f6820-amc board (which has it's env on spi flash). Somewhere in the init sequence we get a crash.
git bisect leads me to commit 8fee8845e7 ("enf_sf: reuse setup_flash_device instead of open coding it") but I don't think that's actually the problem. The real problem seems to be the way setup_spi_device() relies on the speed to come from the device-tree. Even when I specify a speed for the spi-flash in the device tree it doesn't seem to stick. The only thing that seems to work is restoring the CONFIG_ENV_SPI_MAX_HZ in the DM_SPI_FLASH case.
I can submit that as a patch but it seems contrary to the intentions of commit 96907c0fe5 ("dm: spi: Read default speed and mode values from DT").
Does anyone have any thoughts as to where to go with this?
So now I've actually been able to see the failure with an ICD attached the problem is a divide by 0 in mvebu_spi_set_speed() because the speed is being passed down as 0. Moving up the stack this appears to be coming from the parent_platdata looked up by spi_get_bus_and_cs(). So it looks like the spi-max-frequency property hasn't been parsed up from the device tree prior to this call.