From: Michal Simek <monstr-pSz03upnqPeHXe+LvDLADg@public.gmane.org>
To: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: microblaze-uclinux-rVRm/Wmeqae7NGdpmJTKYQ@public.gmane.org,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
duyl-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org,
linnj-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org,
edgar.iglesias-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
"David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>,
john.williams-g5w7nrANp4BDPfheJLI6IQ@public.gmane.org
Subject: [PATCH 3/7] of: Fix uart16550 initialization on little-endian systems
Date: Wed, 29 Sep 2010 15:52:14 +1000 [thread overview]
Message-ID: <1285739538-29058-4-git-send-email-monstr@monstr.eu> (raw)
In-Reply-To: <1285739538-29058-3-git-send-email-monstr-pSz03upnqPeHXe+LvDLADg@public.gmane.org>
Convert values from big-endian to cpu-endian.
Signed-off-by: Michal Simek <monstr-pSz03upnqPeHXe+LvDLADg@public.gmane.org>
CC: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
CC: "David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
CC: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
CC: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
CC: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
---
drivers/serial/of_serial.c | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/drivers/serial/of_serial.c b/drivers/serial/of_serial.c
index 2af8fd1..0e4d894 100644
--- a/drivers/serial/of_serial.c
+++ b/drivers/serial/of_serial.c
@@ -31,17 +31,19 @@ static int __devinit of_platform_serial_setup(struct platform_device *ofdev,
{
struct resource resource;
struct device_node *np = ofdev->dev.of_node;
- const unsigned int *clk, *spd;
+ const unsigned int *spd;
+ unsigned int clk;
const u32 *prop;
int ret, prop_size;
memset(port, 0, sizeof *port);
spd = of_get_property(np, "current-speed", NULL);
- clk = of_get_property(np, "clock-frequency", NULL);
- if (!clk) {
+ prop = of_get_property(np, "clock-frequency", NULL);
+ if (!prop) {
dev_warn(&ofdev->dev, "no clock-frequency property set\n");
return -ENODEV;
}
+ clk = be32_to_cpup(prop);
ret = of_address_to_resource(np, 0, &resource);
if (ret) {
@@ -55,23 +57,24 @@ static int __devinit of_platform_serial_setup(struct platform_device *ofdev,
/* Check for shifted address mapping */
prop = of_get_property(np, "reg-offset", &prop_size);
if (prop && (prop_size == sizeof(u32)))
- port->mapbase += *prop;
+ port->mapbase += be32_to_cpup(prop);
/* Check for registers offset within the devices address range */
prop = of_get_property(np, "reg-shift", &prop_size);
if (prop && (prop_size == sizeof(u32)))
- port->regshift = *prop;
+ port->regshift = be32_to_cpup(prop);
port->irq = irq_of_parse_and_map(np, 0);
port->iotype = UPIO_MEM;
port->type = type;
- port->uartclk = *clk;
+ port->uartclk = clk;
port->flags = UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF | UPF_IOREMAP
| UPF_FIXED_PORT | UPF_FIXED_TYPE;
port->dev = &ofdev->dev;
+
/* If current-speed was set, then try not to change it. */
if (spd)
- port->custom_divisor = *clk / (16 * (*spd));
+ port->custom_divisor = clk / (16 * be32_to_cpup(spd));
return 0;
}
--
1.5.5.1
next prev parent reply other threads:[~2010-09-29 5:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1285739538-29058-1-git-send-email-monstr@monstr.eu>
[not found] ` <1285739538-29058-1-git-send-email-monstr-pSz03upnqPeHXe+LvDLADg@public.gmane.org>
2010-09-29 5:52 ` [PATCH 1/7] of: GPIO: Fix OF probing on little-endian systems Michal Simek
[not found] ` <1285739538-29058-2-git-send-email-monstr-pSz03upnqPeHXe+LvDLADg@public.gmane.org>
2010-09-29 5:52 ` [PATCH 2/7] of: MTD: " Michal Simek
[not found] ` <1285739538-29058-3-git-send-email-monstr-pSz03upnqPeHXe+LvDLADg@public.gmane.org>
2010-09-29 5:52 ` Michal Simek [this message]
[not found] ` <1285739538-29058-4-git-send-email-monstr-pSz03upnqPeHXe+LvDLADg@public.gmane.org>
2010-09-29 5:52 ` [PATCH 4/7] net: emaclite: Add support for little-endian platforms Michal Simek
2010-09-29 6:11 ` Grant Likely
[not found] ` <20100929061146.GA2439-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org>
2010-09-29 6:27 ` David Miller
[not found] ` <20100928.232722.189705899.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2010-09-29 7:33 ` Michal Simek
2010-09-29 6:29 ` [PATCH 3/7] of: Fix uart16550 initialization on little-endian systems Grant Likely
2010-09-29 6:29 ` [PATCH 2/7] of: MTD: Fix OF probing " Grant Likely
2010-09-29 6:30 ` [PATCH 1/7] of: GPIO: " Grant Likely
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1285739538-29058-4-git-send-email-monstr@monstr.eu \
--to=monstr-psz03upnqpehxe+lvdladg@public.gmane.org \
--cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=duyl-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org \
--cc=edgar.iglesias-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=john.williams-g5w7nrANp4BDPfheJLI6IQ@public.gmane.org \
--cc=linnj-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=microblaze-uclinux-rVRm/Wmeqae7NGdpmJTKYQ@public.gmane.org \
--cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox