summaryrefslogtreecommitdiff
path: root/packages/linux
diff options
context:
space:
mode:
authorJohn Bowler <jbowler@nslu2-linux.org>2005-11-02 04:09:46 +0000
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>2005-11-02 04:09:46 +0000
commitff245f6bb447698a3b996b5faa506f20e1604a9e (patch)
tree0fe300183969971cf2fd234658542f117b5074fa /packages/linux
parent3469835f91be2a76c54709799c0728757fed6cc9 (diff)
parent7602ae6fadf1bfb5a03f862f179743da6245680e (diff)
merge of 1671361e7579e71d868be23893006f827fbff717
and 57d918c4d3b1b0b352541f3d7274331f8e9002bd
Diffstat (limited to 'packages/linux')
-rw-r--r--packages/linux/linux-openzaurus-2.6.14-git3/serial-add-support-for-non-standard-xtals-to-16c950-driver.patch155
-rw-r--r--packages/linux/linux-openzaurus_2.6.14-git3.bb6
2 files changed, 159 insertions, 2 deletions
diff --git a/packages/linux/linux-openzaurus-2.6.14-git3/serial-add-support-for-non-standard-xtals-to-16c950-driver.patch b/packages/linux/linux-openzaurus-2.6.14-git3/serial-add-support-for-non-standard-xtals-to-16c950-driver.patch
new file mode 100644
index 0000000000..18bf4268fc
--- /dev/null
+++ b/packages/linux/linux-openzaurus-2.6.14-git3/serial-add-support-for-non-standard-xtals-to-16c950-driver.patch
@@ -0,0 +1,155 @@
+
+From: Petr Vandrovec <vandrove@vc.cvut.cz>
+
+Patch below adds support for using different prescaler than 16 for 16c950
+chips. This is needed for using Fujitsu-Siemens Connect2Air compact-flash
+card, which comes (apparently) with 806kHz clocks, and so you have to
+program prescaler for division by 7, and DLAB to 1, to get 115200Bd.
+
+To get card properly running you also have to add lines below to
+/etc/pcmcia/serial.opts so kernel knows that base speed is not 115200 but
+50400 (50400 * 16 = 806400; 806400 / 7 = 115200). As I've found no code
+specifying baud_rate in serial_cs, I assume that specifying it in
+serial.opts is right way to do this type of things.
+
+Patch also fixes problem that for UPF_MAGIC_MULTIPLIER maximum possible
+baud rate passed to uart code was uartclk / 16 while correct value for
+these devices (and for 16c950) is uartclk / 4.
+
+Patch also fixes problem that for UPF_MAGIC_MULTIPLIER devices with
+baud_rate 19200 or 9600 spd_cust did not work correctly. Not that such
+devices exist, but we should not ignore spd_cust, user probably knows why
+he asked for spd_cust.
+
+serial.opts:
+
+case "$MANFID-$FUNCID-$PRODID_1-$PRODID_2-$PRODID_3-$PRODID_4" in
+'0279,950b-2-GPRS Modem---')
+ SERIAL_OPTS="baud_base 50400"
+ ;;
+esac
+
+Cc: David Woodhouse <dwmw2@infradead.org>
+Signed-off-by: Andrew Morton <akpm@osdl.org>
+---
+
+ drivers/serial/8250.c | 82 +++++++++++++++++++++++++++++++++++++++-----------
+ 1 files changed, 64 insertions(+), 18 deletions(-)
+
+diff -puN drivers/serial/8250.c~serial-add-support-for-non-standard-xtals-to-16c950-driver drivers/serial/8250.c
+--- devel/drivers/serial/8250.c~serial-add-support-for-non-standard-xtals-to-16c950-driver 2005-09-12 03:34:57.000000000 -0700
++++ devel-akpm/drivers/serial/8250.c 2005-09-12 03:34:57.000000000 -0700
+@@ -1653,24 +1653,58 @@ static void serial8250_shutdown(struct u
+ serial_unlink_irq_chain(up);
+ }
+
+-static unsigned int serial8250_get_divisor(struct uart_port *port, unsigned int baud)
++static unsigned int serial8250_get_divisor(struct uart_port *port, unsigned int baud,
++ unsigned int *prescaler)
+ {
+- unsigned int quot;
+-
+- /*
+- * Handle magic divisors for baud rates above baud_base on
+- * SMSC SuperIO chips.
++ /*
++ * Use special handling only if user did not supply its own divider.
++ * spd_cust is defined in terms of baud_base, so always use default
++ * prescaler when spd_cust is requested.
+ */
+- if ((port->flags & UPF_MAGIC_MULTIPLIER) &&
+- baud == (port->uartclk/4))
+- quot = 0x8001;
+- else if ((port->flags & UPF_MAGIC_MULTIPLIER) &&
+- baud == (port->uartclk/8))
+- quot = 0x8002;
+- else
+- quot = uart_get_divisor(port, baud);
+
+- return quot;
++ *prescaler = 16;
++ if (baud != 38400 || (port->flags & UPF_SPD_MASK) != UPF_SPD_CUST) {
++ unsigned int quot = port->uartclk / baud;
++
++ /*
++ * Handle magic divisors for baud rates above baud_base on
++ * SMSC SuperIO chips.
++ */
++ if (port->flags & UPF_MAGIC_MULTIPLIER) {
++ if (quot == 4) {
++ return 0x8001;
++ } else if (quot == 8) {
++ return 0x8002;
++ }
++ }
++ if (port->type == PORT_16C950) {
++ /*
++ * This computes TCR value (4 to 16), not CPR value (which can
++ * be between 1.000 and 31.875) - chip I have uses XTAL of
++ * 806400Hz, and so a division by 7 is required to get 115200Bd.
++ * I'm leaving CPR disabled for now, until someone will
++ * hit even more exotic XTAL (it is needed to get 500kbps
++ * or 1000kbps from 18.432MHz XTAL, but I have no device
++ * which would benefit from doing that).
++ *
++ * If we can use divide by 16, use it. Otherwise look for
++ * better prescaler, from 15 to 4. If quotient cannot
++ * be divided by any integer value between 4 and 15, use 4.
++ */
++ if (quot & 0x0F) {
++ unsigned int div;
++
++ for (div = 15; div > 4; div--) {
++ if (quot % div == 0) {
++ break;
++ }
++ }
++ *prescaler = div;
++ return quot / div;
++ }
++ }
++ }
++ return uart_get_divisor(port, baud);
+ }
+
+ static void
+@@ -1680,7 +1714,7 @@ serial8250_set_termios(struct uart_port
+ struct uart_8250_port *up = (struct uart_8250_port *)port;
+ unsigned char cval, fcr = 0;
+ unsigned long flags;
+- unsigned int baud, quot;
++ unsigned int baud, quot, prescaler;
+
+ switch (termios->c_cflag & CSIZE) {
+ case CS5:
+@@ -1712,8 +1746,13 @@ serial8250_set_termios(struct uart_port
+ /*
+ * Ask the core to calculate the divisor for us.
+ */
+- baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16);
+- quot = serial8250_get_divisor(port, baud);
++
++ if (port->type == PORT_16C950 || (port->flags & UPF_MAGIC_MULTIPLIER)) {
++ baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/4);
++ } else {
++ baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16);
++ }
++ quot = serial8250_get_divisor(port, baud, &prescaler);
+
+ /*
+ * Oxford Semi 952 rev B workaround
+@@ -1817,6 +1856,13 @@ serial8250_set_termios(struct uart_port
+ serial_outp(up, UART_DLM, quot >> 8); /* MS of divisor */
+
+ /*
++ * Program prescaler for 16C950 chips.
++ */
++ if (up->port.type == PORT_16C950) {
++ serial_icr_write(up, UART_TCR, prescaler == 16 ? 0 : prescaler);
++ }
++
++ /*
+ * LCR DLAB must be set to enable 64-byte FIFO mode. If the FCR
+ * is written without DLAB set, this mode will be disabled.
+ */
+_
diff --git a/packages/linux/linux-openzaurus_2.6.14-git3.bb b/packages/linux/linux-openzaurus_2.6.14-git3.bb
index 653d5497ca..ae21521d20 100644
--- a/packages/linux/linux-openzaurus_2.6.14-git3.bb
+++ b/packages/linux/linux-openzaurus_2.6.14-git3.bb
@@ -1,6 +1,6 @@
include linux-openzaurus.inc
-PR = "r0"
+PR = "r1"
DEFAULT_PREFERENCE = "-1"
@@ -20,6 +20,7 @@ SRC_URI = "ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.14.tar.gz \
${RPSRC}/pxa_i2c_fixes-r3.patch;patch=1 \
${RPSRC}/pxa_ohci_platform-r2.patch;patch=1 \
${RPSRC}/pxa_ohci_suspend-r2.patch;patch=1 \
+ ${RPSRC}/revert_bootmem-r0.patch;patch=1 \
${RPSRC}/ide_not_removable-r0.patch;patch=1 \
${RPSRC}/sharpsl_pm-r10.patch;patch=1 \
${RPSRC}/corgi_pm-r4.patch;patch=1 \
@@ -33,7 +34,7 @@ SRC_URI = "ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.14.tar.gz \
${RPSRC}/input_power-r2.patch;patch=1 \
${RPSRC}/jffs2_longfilename-r0.patch;patch=1 \
${RPSRC}/sharpsl_bl_kick-r1.patch;patch=1 \
- ${RPSRC}/corgi_snd-r11.patch;patch=1 \
+ ${RPSRC}/corgi_snd-r14.patch;patch=1 \
${RPSRC}/export_scoop-r0.patch;patch=1 \
${RPSRC}/pxa25x_cpufreq-r0.patch;patch=1 \
${RPSRC}/fbdev/fbdev-r0.patch;patch=1 \
@@ -68,6 +69,7 @@ SRC_URI = "ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.14.tar.gz \
file://pxa-serial-hack.patch;patch=1 \
${RPSRC}/jl1/pxa-linking-bug.patch;patch=1 \
file://dtl1_cs-add-socket-revE.patch;patch=1 \
+ file://serial-add-support-for-non-standard-xtals-to-16c950-driver.patch;patch=1 \
file://connectplus-remove-ide-HACK.patch;patch=1 \
file://defconfig-c7x0 \
file://defconfig-ipaq-pxa270 \