From owner-freebsd-arm@FreeBSD.ORG Sun Oct 20 15:26:21 2013 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 396E4B68 for ; Sun, 20 Oct 2013 15:26:21 +0000 (UTC) (envelope-from stl@koffein.net) Received: from hapkido.dreamhost.com (hapkido.dreamhost.com [66.33.216.122]) by mx1.freebsd.org (Postfix) with ESMTP id 1B6E72E33 for ; Sun, 20 Oct 2013 15:26:20 +0000 (UTC) Received: from homiemail-a4.g.dreamhost.com (caiajhbdcagg.dreamhost.com [208.97.132.66]) by hapkido.dreamhost.com (Postfix) with ESMTP id 461FDDC493 for ; Sun, 20 Oct 2013 08:26:14 -0700 (PDT) Received: from homiemail-a4.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a4.g.dreamhost.com (Postfix) with ESMTP id 3DADC51C063 for ; Sun, 20 Oct 2013 08:26:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=koffein.net; h=from:to :subject:date:message-id:mime-version:content-type: content-transfer-encoding; s=koffein.net; bh=OUVp4su4yYdy8FcTQIH Wo7/4lK8=; b=2jigZouEJHyFRxcQDxf9hrUYe/PDSFfYe+5fX9ZznAAT/qyIYOl 8G8lj3ofSmXK5+nyqSa9GULVSy8/H5LTlGAgtMLounJgFEThcXl1d0ZHj3cBZijD npkoE+5s1vmSjr64ZnC3oVnpJJ3jNkZgj8b+PQWzZursOPs/kjbeCU3w= Received: from localhost (unknown [213.211.139.38]) (Authenticated sender: stl@koffein.net) by homiemail-a4.g.dreamhost.com (Postfix) with ESMTPA id DAA7A51C05F for ; Sun, 20 Oct 2013 08:26:07 -0700 (PDT) From: Steven Lawrance To: freebsd-arm Subject: pl011 UART driver (as used on Raspberry Pi) baud rate divisor Date: Sun, 20 Oct 2013 17:25:24 +0200 Message-Id: <1382282023-sup-4600@luwak.koffein.net> User-Agent: Sup/0.14.1 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-1382282724-191894-1322-3059-1-=" Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Oct 2013 15:26:21 -0000 --=-1382282724-191894-1322-3059-1-= Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Hi all, attached is a small patch to calculate the baud rate divisor for the pl011 UART. The existing code used hardcoded values which work for a UARTCLK frequency of 3Mhz and a baud rate of 115200. If my calculations are correct, the same values should still end up being set on the RPI but this patch allows it to work on an i.MX233 with a fixed 24MHz clock frequency and it obeys the values in the FDT. Is someone able to test it on the Raspberry Pi? cheers, -- Steven Lawrance stl@koffein.net --=-1382282724-191894-1322-3059-1-= Content-Disposition: attachment; filename="pl011_baudrate.patch" Content-Type: application/octet-stream; name="pl011_baudrate.patch" Content-Transfer-Encoding: base64 SW5kZXg6IHN5cy9kZXYvdWFydC91YXJ0X2Rldl9wbDAxMS5jCj09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT0KLS0tIHN5cy9kZXYvdWFydC91YXJ0X2Rldl9wbDAx MS5jCShyZXZpc2lvbiAyNTY3NzkpCisrKyBzeXMvZGV2L3VhcnQvdWFydF9k ZXZfcGwwMTEuYwkoYXJiZXRza29waWEpCkBAIC0xNDcsOSArMTQ3LDYgQEAK IAkJYnJlYWs7CiAJfQogCi0JLyogVE9ETzogQ2FsY3VsYXRlIGRpdmlzb3Jz ICovCi0JYmF1ZCA9ICgweDEgPDwgMTYpIHwgMHgyODsKLQogCWlmIChzdG9w Yml0cyA9PSAyKQogCQlsaW5lIHw9IExDUl9IX1NUUDI7CiAJZWxzZQpAQCA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