linux/drivers
Anton Vorontsov a44648b057 spi_mpc83xx: fix prescale modulus calculation
Long ago I've noticed (but didn't pay much attention) that
spi_mpc83xx using PM calculations that differs from what
specs describe. I.e.

u8 pm = mpc83xx_spi->spibrg / (spi->max_speed_hz * 4);

While specs says: "The SPI baud rate generator clock source (either
system clock or system clock divided by 16, depending on DIV16 bit) is
divided by 4 * ([PM] + 1), a range from 4 to 64.".

Thus " - 1" is missing in the spi_mpc83xx's formula.

Why nobody noticed that bug? Probably because sysclk usually less then
user expects, e.g. you expect 200 MHz, but real clock is 198 MHz,
and integer rounding helps when this formula is used.

Suppose it's SPI in QE, SYSCLK at 198 MHz, thus SPIBRG at 99MHz, 25 MHz
requested.

PM = (99MHz / ( 25 MHz * 4 )), PM == 0, output SPICLK will be 24.75 MHz

At lower frequencies this bug is more noticeable, though.

And this bug shows itself in all its beauty if SYSCLK is equal or a bit
more than you expect (200 MHz SYSCLK, 100 MHz SPIBRG):
PM = (100MHz / ( 25 MHz * 4 )), PM == 1, output SPICLK will be 12.625 MHz!

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-08-11 15:47:41 -07:00
..
acorn/char Remove the arm26 port 2007-07-31 15:39:39 -07:00
acpi ACPI: delete CONFIG_ACPI_PROCFS_SLEEP (again) 2007-07-31 20:40:08 -07:00
amba
ata [ARM] pata_icside: fix the FIXMEs 2007-08-06 16:10:54 +01:00
atm
auxdisplay
base CPU online file permission 2007-07-31 15:39:39 -07:00
block cciss: fix memory leak 2007-07-31 15:39:43 -07:00
bluetooth
cdrom
char drivers/char/pcmcia/cm40x0_cs.c: fix release function call 2007-08-11 15:47:40 -07:00
clocksource
connector
cpufreq
crypto
dio
dma [NET_DMA]: remove unused dma_memcpy_to_kernel_iovec 2007-07-31 02:28:03 -07:00
edac drivers/edac: fix pasemi kconfig depends 2007-07-26 11:35:18 -07:00
eisa
fc4
firewire firewire: fw-core: make two variables static 2007-08-02 20:34:17 +02:00
firmware
hid HID: Never call hid_free_buffers() when usbhid_device has been freed 2007-08-02 13:48:04 +02:00
hwmon hwmon: fscher read control bugfix 2007-07-30 21:14:00 -04:00
i2c Replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION 2007-07-29 16:45:38 -07:00
ide scc_pata: PIO fixes 2007-08-01 23:46:46 +02:00
ieee1394 ieee1394: sbp2: more correct Kconfig dependencies 2007-08-02 20:34:16 +02:00
infiniband in-string typos of "error" 2007-07-31 15:39:40 -07:00
input [MIPS] Fixup secure computing stuff. 2007-07-31 21:35:21 +01:00
isdn Remove 'isdn_* is defined but unused' warnings 2007-07-31 15:39:44 -07:00
kvm KVM: x86 emulator: fix debug reg mov instructions 2007-08-06 17:54:41 -07:00
leds
lguest lguest: Fix Malicious Guest GDT Host Crash 2007-08-09 08:14:56 -07:00
macintosh
mca
md md: handle writes to broken raid10 arrays gracefully 2007-07-31 15:39:38 -07:00
media V4L/DVB (5939): dvb-pll: make struct dvb_pll_fcv1236d static 2007-07-30 16:26:37 -03:00
message Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6 2007-08-06 17:48:34 -07:00
mfd
misc Pull auto-load-modules into release branch 2007-07-25 01:36:53 -04:00
mmc mmc: at91_mci: remove whitespace at the end of lines 2007-08-09 16:13:44 +02:00
mtd [MTD] Makefile fix for mtdsuper 2007-08-03 12:42:40 +01:00
net drivers/net/ibmveth.c: memset fix 2007-08-07 17:36:20 -04:00
nubus
of
oprofile
parisc
parport parport_pc locking fix 2007-07-31 15:39:37 -07:00
pci pci: rename __pci_reenable_device() to pci_reenable_device() 2007-08-01 10:00:56 -04:00
pcmcia pcmcia: give socket time to power down 2007-07-31 15:39:38 -07:00
pnp ACPI: restore CONFIG_ACPI_SLEEP 2007-07-29 16:53:59 -07:00
power
ps3
rapidio
rtc rtc-m48t59 driver NO_IRQ mode fixup 2007-07-31 15:39:44 -07:00
s390 Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6 2007-08-06 17:48:34 -07:00
sbus Videopix Frame Grabber: Fix unreleased lock in vfc_debug() 2007-07-31 15:39:43 -07:00
scsi Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6 2007-08-06 17:48:34 -07:00
serial serial: fix 8250 early console setup 2007-08-03 15:02:56 -07:00
sh
sn
spi spi_mpc83xx: fix prescale modulus calculation 2007-08-11 15:47:41 -07:00
tc
telephony
uio
usb USB: "sparse" cleanups for usb gadgets 2007-07-30 13:27:47 -07:00
video matroxfb: rectify jitter (G450/G550) 2007-08-11 15:47:40 -07:00
w1 drivers/ misc __iomem annotations 2007-07-26 11:11:57 -07:00
xen xenbus_xs.c: fix a use-after-free 2007-07-26 11:35:17 -07:00
zorro
Kconfig
Makefile [WATCHDOG] Fix pcwd_init_module crash 2007-07-29 18:58:39 +00:00