Subject: mpc5125 shared uart-spi driver

From: "[email-masked]" <[email-masked]>
Date: Mon, 19 Mar 2012 14:45:39 +0100 (CET)

Hi all,
I am developing on a custom mpc5125 board.

The hardware people designed the board so that the console serial port (PSC1 as ttyPSC0) is "shared" with a 74HC595 shift register (!!),
which drivers some leds.
In other words: when I want to drive the leds I have to "switch" the port in spi mode, do the spi transfer, then return to uart serial mode.
A strobe pin allows not to disturb leds when uart mode is active.

This configuration surely will cause some glitches on the serial port, but finally it is not a big problem, since I use the serial console only as a debug help.
Uart works at 115200 bps, spi works at 10 MHz.

So I am trying to find a "nice and elegant" way to do this by (eventually) tweaking the spi driver : my first idea is
declaring in the dts file uart and spi on the same address, but "tweak" spi so that it does probe and then
puts the port as it was before probing (uart mode).
Then I should modify the spi driver so that before doing transfers it puts the port in spi mode, and after transfers
it puts back to uart.

Kernel is 2.6.29 .

Any suggestions are welcome...

Thanks,
regards

Lucio Dona'