Bug in of_mpc8xxx_spi chipselect

Michael Barkowski michaelbarkowski at ruggedcom.com
Wed Sep 9 23:42:03 EST 2009


Just want to document this bug, since I don't have time to make a patch:

In of_mpc8xxx_spi_get_chipselects():

	pinfo->alow_flags[i] = flags & OF_GPIO_ACTIVE_LOW;

	ret = gpio_direction_output(pinfo->gpios[i],
				    pinfo->alow_flags[i]);


The initial value of the chip should be disabled.  If SPI_CS_HIGH, value of 0 means disabled - ok, but...

If not SPI_CS_HIGH for a given device (which is the case for most devices), that device will be enabled until it is disabled at the end of the first transaction to that device.  If there are transactions to other devices on the same bus in the meantime, this device may be confused and fail the first transaction.

Maybe the chip select should be disabled until the device entry is initialized with full knowledge of its configuration.  Not sure of the right solution.

-- 
Michael Barkowski
905-482-4577


More information about the Linuxppc-dev mailing list