Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Oct 2013 17:25:24 +0200
From:      Steven Lawrance <stl@koffein.net>
To:        freebsd-arm <freebsd-arm@freebsd.org>
Subject:   pl011 UART driver (as used on Raspberry Pi) baud rate divisor
Message-ID:  <1382282023-sup-4600@luwak.koffein.net>

next in thread | raw e-mail | index | archive | help

--=-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
Yml0cyA9PSAyKQogCQlsaW5lIHw9IExDUl9IX1NUUDI7CiAJZWxzZQpAQCAt
MTY0LDggKzE2MSwxMSBAQAogCWxpbmUgJj0gIH5MQ1JfSF9GRU47CiAJY3Ry
bCB8PSAoQ1JfUlhFIHwgQ1JfVFhFIHwgQ1JfVUFSVEVOKTsKIAotCV9fdWFy
dF9zZXRyZWcoYmFzLCBVQVJUX0lCUkQsICgodWludDMyX3QpKGJhdWQgPj4g
MTYpKSAmIElCUkRfQkRJVklOVCk7Ci0JX191YXJ0X3NldHJlZyhiYXMsIFVB
UlRfRkJSRCwgKHVpbnQzMl90KShiYXVkKSAmIEZCUkRfQkRJVkZSQUMpOwor
CWlmIChiYXMtPnJjbGsgIT0gMCAmJiBiYXVkcmF0ZSAhPSAwKSB7CisJCWJh
dWQgPSBiYXMtPnJjbGsgKiA0IC8gYmF1ZHJhdGU7CisJCV9fdWFydF9zZXRy
ZWcoYmFzLCBVQVJUX0lCUkQsICgodWludDMyX3QpKGJhdWQgPj4gNikpICYg
SUJSRF9CRElWSU5UKTsKKwkJX191YXJ0X3NldHJlZyhiYXMsIFVBUlRfRkJS
RCwgKHVpbnQzMl90KShiYXVkICYgMHgzRikgJiBGQlJEX0JESVZGUkFDKTsK
Kwl9CiAKIAkvKiBBZGQgY29uZmlnLiB0byBsaW5lIGJlZm9yZSByZWVuYWJs
aW5nIFVBUlQgKi8KIAlfX3VhcnRfc2V0cmVnKGJhcywgVUFSVF9MQ1JfSCwg
KF9fdWFydF9nZXRyZWcoYmFzLCBVQVJUX0xDUl9IKSAmCg==

--=-1382282724-191894-1322-3059-1-=--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1382282023-sup-4600>