On Tue, Sep 14, 2010 at 21:56, Bob Liu wrote: > On Tue, Sep 14, 2010 at 7:18 PM, Mike Frysinger wrote: >> On Tue, Sep 14, 2010 at 06:29, <[email protected]> wrote: >>> Modified: trunk/drivers/spi/bfin_sport_spi.c (9136 => 9137) >>> >>> --- trunk/drivers/spi/bfin_sport_spi.c 2010-09-14 08:34:15 UTC (rev >>> 9136) >>> +++ trunk/drivers/spi/bfin_sport_spi.c 2010-09-14 10:29:03 UTC (rev >>> 9137) >>> @@ -348,6 +348,11 @@ >>> transfer = drv_data->cur_transfer; >>> chip = drv_data->cur_chip; >>> >>> + if (transfer->speed_hz) { >>> + chip->baud = hz_to_spi_baud(transfer->speed_hz); >>> + drv_data->regs->tclkdiv = chip->baud; >>> + SSYNC(); >>> + } >> >> i dont think this is correct. chip->baud is the default speed which >> is setup in the bfin_sport_spi_setup() function. by changing it in >> the transfer function, the default speed is now whatever the last >> transfer set things to. > > bfin_sport_spi_setup() only setup the default speed. > But the user maybe need to set special speed in a spi transfer. > It was implemented through ioctl comand "CMD_SPI_SET_BAUDRATE" in > adc_spi_ioctl(), > and this value will be transfer to spi controller driver through > struct spi_transfer. > struct spi_transfer t = { > .len = count, > .speed_hz = spi_adc->hz, > }; > > What about set back the default speed after a spi_transfer ?
that's my point. your change here clobbers the default speed. it looks like whatever speed is used in the per-transfer struct then becomes the default after that transfer. yes, the SPORT/SPI needs to use the per-transfer speed *only if it has been specified*, but it needs to do it for that transfer only. then it must use the default speed set up by the bfin_sport_spi_setup function for everything else. so this change fixes one bug but introduces another, so it needs to be fixed. -mike _______________________________________________ Linux-kernel-commits mailing list [email protected] https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits
