Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Wed, 20 Feb 2002 10:04:04 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Wed, 20 Feb 2002 10:03:55 -0500 Received: from gw-nl4.philips.com ([212.153.190.6]:61199 "EHLO gw-nl4.philips.com") by vger.kernel.org with ESMTP id ; Wed, 20 Feb 2002 10:03:40 -0500 From: fabrizio.gennari@philips.com To: linux-kernel@vger.kernel.org Cc: rmk@arm.linux.org.uk Subject: [PATCH] 16C950 clock autodetection X-Mailer: Lotus Notes Release 5.0.5 September 22, 2000 Message-ID: Date: Wed, 20 Feb 2002 16:02:52 +0100 X-MIMETrack: Serialize by Router on hbg001soh/H/SERVER/PHILIPS(Release 5.0.5 |September 22, 2000) at 20/02/2002 16:22:09 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_mixed 00529325C1256B66_=" Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org --=_mixed 00529325C1256B66_= Content-Type: text/plain; charset="us-ascii" Here is a patch that applies to drivers/char/serial.c in kernel 2.4.17, that automatically detects the clock frequency in a 16C950 chip and sets baud_base accordingly. There are two caveats: 1. The patch has been tested on i386 machines and it works. It gives wrong results on ARM. 2. The patch sets baud_base if the serial chip is on a 16-bit PC card. If it is on a PCI card (PCI slot or 32-bit CardBus card) the baud_base is overwritten by the value in serial_pci_tbl[]. Fabrizio Gennari Philips Research Monza via G.Casati 23, 20052 Monza (MI), Italy tel. +39 039 2037816, fax +39 039 2037800 --=_mixed 00529325C1256B66_= Content-Type: application/octet-stream; name="clock.patch" Content-Disposition: attachment; filename="clock.patch" Content-Transfer-Encoding: base64 LS0tIHNlcmlhbC1vbGQuYwlXZWQgRmViIDIwIDE3OjIxOjQ1IDIwMDINCisrKyBzZXJpYWwuYwlX ZWQgRmViIDIwIDE3OjI2OjE2IDIwMDINCkBAIC01Nyw2ICs1Nyw5IEBADQogICogMTAvMDA6IGFk ZCBpbiB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2VsYXBzZWQ7DQorCXByaW50ayhLRVJOX0lORk8gInJlcyAldVxuIixy ZXN1bHQpOw0KKwlyZXR1cm4gcmVzdWx0Ow0KK30NCisNCiAvKg0KICAqIFRoaXMgaXMgYSBoZWxw ZXIgcm91dGluZSB0byBhdXRvZGV0ZWN0IFN0YXJUZWNoL0V4YXIvT3hzZW1pIFVBUlQncy4NCiAg KiBXaGVuIHRoaXMgZnVuY3Rpb24gaXMgY2FsbGVkIHdlIGtub3cgaXQgaXMgYXQgbGVhc3QgYSBT dGFyVGVjaA0KQEAgLTM1NTYsNiArMzYxNyw3IEBADQogCQkJc3RhdGUtPnR5cGUgPSBQT1JUXzE2 Qzk1MDsNCiAJCQlzdGF0ZS0+cmV2aXNpb24gPSBzZXJpYWxfaWNyX3JlYWQoaW5mbywgVUFSVF9S RVYpIHwNCiAJCQkJKHNjcmF0Y2gzIDw8IDgpOw0KKwkJCXN0YXRlLT5iYXVkX2Jhc2U9YXV0b2Rl dGVjdF8xNmM5NTBfY2xvY2soaW5mbyxzdGF0ZSk7DQogCQkJcmV0dXJuOw0KIAkJfQ0KIAl9DQo= --=_mixed 00529325C1256B66_=-- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/