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 uevent: use add_uevent_var() instead of open coding it 2007-04-27 10:57:29 -07:00
ata [ARM] pata_icside: fix the FIXMEs 2007-08-06 16:10:54 +01:00
atm [ATM]: nicstar needs virt_to_bus 2007-07-18 02:13:42 -07:00
auxdisplay Use menuconfig objects II - auxdisplay 2007-07-16 09:05:40 -07:00
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 [Bluetooth] Remove the redundant non-seekable llseek method 2007-07-11 06:53:45 +02:00
cdrom [BLOCK] Get rid of request_queue_t typedef 2007-07-24 09:28:11 +02:00
char drivers/char/pcmcia/cm40x0_cs.c: fix release function call 2007-08-11 15:47:40 -07:00
clocksource x86_64: fix typo in acpi_pm.c 2007-07-21 18:37:12 -07:00
connector Use menuconfig objects: connector 2007-07-16 09:05:40 -07:00
cpufreq [CPUFREQ] Restore previously used governor on a hot-replugged CPU 2007-07-13 01:29:51 -04:00
crypto Use menuconfig objects: crypto hw 2007-07-16 09:05:40 -07:00
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 virtual_eisa_root_init() should be __init 2007-05-08 11:15:02 -07:00
fc4
firewire firewire: fw-core: make two variables static 2007-08-02 20:34:17 +02:00
firmware edd: switch to pci_get based API 2007-07-16 09:05:42 -07:00
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 leds: Convert from struct class_device to struct device 2007-07-16 01:15:51 +01:00
lguest lguest: Fix Malicious Guest GDT Host Crash 2007-08-09 08:14:56 -07:00
macintosh [POWERPC] Clean up duplicate includes in drivers/macintosh/ 2007-07-22 21:31:00 +10:00
mca mca: add integrated device bus matching 2007-05-09 12:30:49 -07:00
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 some kmalloc/memset ->kzalloc (tree wide) 2007-07-19 10:04:50 -07:00
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 some kmalloc/memset ->kzalloc (tree wide) 2007-07-19 10:04:50 -07:00
of Create drivers/of/platform.c 2007-07-20 14:25:51 +10:00
oprofile [CELL] oprofile: add support to OProfile for profiling CELL BE SPUs 2007-07-20 21:42:24 +02:00
parisc serial: add early_serial_setup() back to header file 2007-07-18 08:38:22 -07:00
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 Don't compile the PMU power driver on 64-bit PowerPC 2007-07-23 12:42:45 +01:00
ps3 [POWERPC] PS3: Storage Driver Core 2007-06-28 19:19:20 +10:00
rapidio some kmalloc/memset ->kzalloc (tree wide) 2007-07-19 10:04:50 -07:00
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 some kmalloc/memset ->kzalloc (tree wide) 2007-07-19 10:04:50 -07:00
sn some kmalloc/memset ->kzalloc (tree wide) 2007-07-19 10:04:50 -07:00
spi spi_mpc83xx: fix prescale modulus calculation 2007-08-11 15:47:41 -07:00
tc zs: move to the serial subsystem 2007-07-18 08:38:22 -07:00
telephony some kmalloc/memset ->kzalloc (tree wide) 2007-07-19 10:04:50 -07:00
uio UIO: Hilscher CIF card driver 2007-07-18 15:57:16 -07:00
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 sysfs: add parameter "struct bin_attribute *" in .read/.write methods for sysfs binary attributes 2007-07-11 16:09:09 -07:00
Kconfig Begin to consolidate of_device.c 2007-07-20 13:39:59 +10:00
Makefile [WATCHDOG] Fix pcwd_init_module crash 2007-07-29 18:58:39 +00:00