* [PATCH 1/7] of: GPIO: Fix OF probing on little-endian systems [not found] ` <1285739538-29058-1-git-send-email-monstr-pSz03upnqPeHXe+LvDLADg@public.gmane.org> @ 2010-09-29 5:52 ` Michal Simek [not found] ` <1285739538-29058-2-git-send-email-monstr-pSz03upnqPeHXe+LvDLADg@public.gmane.org> 0 siblings, 1 reply; 10+ messages in thread From: Michal Simek @ 2010-09-29 5:52 UTC (permalink / raw) To: linux-kernel-u79uwXL29TY76Z2rM5mHXA Cc: microblaze-uclinux-rVRm/Wmeqae7NGdpmJTKYQ, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Tejun Heo, duyl-gjFFaj9aHVfQT0dZR+AlfA, linnj-gjFFaj9aHVfQT0dZR+AlfA, edgar.iglesias-Re5JQEeQqe8AvxtiuMwx3w, Anton Vorontsov, john.williams-g5w7nrANp4BDPfheJLI6IQ DTB is always big-endian that's why is necessary to convert it. Signed-off-by: Michal Simek <monstr-pSz03upnqPeHXe+LvDLADg@public.gmane.org> CC: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> CC: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> CC: Anton Vorontsov <avorontsov-hkdhdckH98+B+jHODAdFcQ@public.gmane.org> CC: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org CC: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org --- drivers/gpio/xilinx_gpio.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/xilinx_gpio.c b/drivers/gpio/xilinx_gpio.c index 7096909..846fbd5 100644 --- a/drivers/gpio/xilinx_gpio.c +++ b/drivers/gpio/xilinx_gpio.c @@ -171,13 +171,13 @@ static int __devinit xgpio_of_probe(struct device_node *np) /* Update GPIO state shadow register with default value */ tree_info = of_get_property(np, "xlnx,dout-default", NULL); if (tree_info) - chip->gpio_state = *tree_info; + chip->gpio_state = be32_to_cpup(tree_info); /* Update GPIO direction shadow register with default value */ chip->gpio_dir = 0xFFFFFFFF; /* By default, all pins are inputs */ tree_info = of_get_property(np, "xlnx,tri-default", NULL); if (tree_info) - chip->gpio_dir = *tree_info; + chip->gpio_dir = be32_to_cpup(tree_info); /* Check device node and parent device node for device width */ chip->mmchip.gc.ngpio = 32; /* By default assume full GPIO controller */ @@ -186,7 +186,7 @@ static int __devinit xgpio_of_probe(struct device_node *np) tree_info = of_get_property(np->parent, "xlnx,gpio-width", NULL); if (tree_info) - chip->mmchip.gc.ngpio = *tree_info; + chip->mmchip.gc.ngpio = be32_to_cpup(tree_info); spin_lock_init(&chip->gpio_lock); -- 1.5.5.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
[parent not found: <1285739538-29058-2-git-send-email-monstr-pSz03upnqPeHXe+LvDLADg@public.gmane.org>]
* [PATCH 2/7] of: MTD: Fix OF probing on little-endian systems [not found] ` <1285739538-29058-2-git-send-email-monstr-pSz03upnqPeHXe+LvDLADg@public.gmane.org> @ 2010-09-29 5:52 ` Michal Simek [not found] ` <1285739538-29058-3-git-send-email-monstr-pSz03upnqPeHXe+LvDLADg@public.gmane.org> 2010-09-29 6:30 ` [PATCH 1/7] of: GPIO: " Grant Likely 1 sibling, 1 reply; 10+ messages in thread From: Michal Simek @ 2010-09-29 5:52 UTC (permalink / raw) To: linux-kernel-u79uwXL29TY76Z2rM5mHXA Cc: microblaze-uclinux-rVRm/Wmeqae7NGdpmJTKYQ, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Tejun Heo, linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, duyl-gjFFaj9aHVfQT0dZR+AlfA, linnj-gjFFaj9aHVfQT0dZR+AlfA, edgar.iglesias-Re5JQEeQqe8AvxtiuMwx3w, David Woodhouse, john.williams-g5w7nrANp4BDPfheJLI6IQ Convert big-endian DTB to little-endian if necessary. Signed-off-by: Michal Simek <monstr-pSz03upnqPeHXe+LvDLADg@public.gmane.org> CC: David Woodhouse <dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org> CC: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> CC: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> CC: linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org CC: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org CC: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org --- drivers/mtd/maps/physmap_of.c | 2 +- drivers/mtd/ofpart.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c index fe63f6b..ec3edf6 100644 --- a/drivers/mtd/maps/physmap_of.c +++ b/drivers/mtd/maps/physmap_of.c @@ -294,7 +294,7 @@ static int __devinit of_flash_probe(struct platform_device *dev, info->list[i].map.name = dev_name(&dev->dev); info->list[i].map.phys = res.start; info->list[i].map.size = res_size; - info->list[i].map.bankwidth = *width; + info->list[i].map.bankwidth = be32_to_cpup(width); err = -ENOMEM; info->list[i].map.virt = ioremap(info->list[i].map.phys, diff --git a/drivers/mtd/ofpart.c b/drivers/mtd/ofpart.c index 8bf7dc6..7bd171e 100644 --- a/drivers/mtd/ofpart.c +++ b/drivers/mtd/ofpart.c @@ -53,8 +53,8 @@ int __devinit of_mtd_parse_partitions(struct device *dev, continue; } - (*pparts)[i].offset = reg[0]; - (*pparts)[i].size = reg[1]; + (*pparts)[i].offset = be32_to_cpu(reg[0]); + (*pparts)[i].size = be32_to_cpu(reg[1]); partname = of_get_property(pp, "label", &len); if (!partname) -- 1.5.5.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
[parent not found: <1285739538-29058-3-git-send-email-monstr-pSz03upnqPeHXe+LvDLADg@public.gmane.org>]
* [PATCH 3/7] of: Fix uart16550 initialization on little-endian systems [not found] ` <1285739538-29058-3-git-send-email-monstr-pSz03upnqPeHXe+LvDLADg@public.gmane.org> @ 2010-09-29 5:52 ` Michal Simek [not found] ` <1285739538-29058-4-git-send-email-monstr-pSz03upnqPeHXe+LvDLADg@public.gmane.org> 2010-09-29 6:29 ` [PATCH 2/7] of: MTD: Fix OF probing " Grant Likely 1 sibling, 1 reply; 10+ messages in thread From: Michal Simek @ 2010-09-29 5:52 UTC (permalink / raw) To: linux-kernel-u79uwXL29TY76Z2rM5mHXA Cc: microblaze-uclinux-rVRm/Wmeqae7NGdpmJTKYQ, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Tejun Heo, duyl-gjFFaj9aHVfQT0dZR+AlfA, linnj-gjFFaj9aHVfQT0dZR+AlfA, edgar.iglesias-Re5JQEeQqe8AvxtiuMwx3w, David S. Miller, john.williams-g5w7nrANp4BDPfheJLI6IQ 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 ^ permalink raw reply related [flat|nested] 10+ messages in thread
[parent not found: <1285739538-29058-4-git-send-email-monstr-pSz03upnqPeHXe+LvDLADg@public.gmane.org>]
* [PATCH 4/7] net: emaclite: Add support for little-endian platforms [not found] ` <1285739538-29058-4-git-send-email-monstr-pSz03upnqPeHXe+LvDLADg@public.gmane.org> @ 2010-09-29 5:52 ` Michal Simek 2010-09-29 6:11 ` Grant Likely 2010-09-29 6:29 ` [PATCH 3/7] of: Fix uart16550 initialization on little-endian systems Grant Likely 1 sibling, 1 reply; 10+ messages in thread From: Michal Simek @ 2010-09-29 5:52 UTC (permalink / raw) To: linux-kernel-u79uwXL29TY76Z2rM5mHXA Cc: Eric Dumazet, microblaze-uclinux-rVRm/Wmeqae7NGdpmJTKYQ, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, duyl-gjFFaj9aHVfQT0dZR+AlfA, netdev-u79uwXL29TY76Z2rM5mHXA, linnj-gjFFaj9aHVfQT0dZR+AlfA, edgar.iglesias-Re5JQEeQqe8AvxtiuMwx3w, David S. Miller, john.williams-g5w7nrANp4BDPfheJLI6IQ Upcomming Microblaze is little endian that's why is necessary to fix protocol and length loading. Signed-off-by: Michal Simek <monstr-pSz03upnqPeHXe+LvDLADg@public.gmane.org> CC: "David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org> CC: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> CC: Eric Dumazet <eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> CC: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org CC: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org CC: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org --- drivers/net/xilinx_emaclite.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c index 71122ee..533ebb1 100644 --- a/drivers/net/xilinx_emaclite.c +++ b/drivers/net/xilinx_emaclite.c @@ -430,8 +430,8 @@ static u16 xemaclite_recv_data(struct net_local *drvdata, u8 *data) } /* Get the protocol type of the ethernet frame that arrived */ - proto_type = ((in_be32(addr + XEL_HEADER_OFFSET + - XEL_RXBUFF_OFFSET) >> XEL_HEADER_SHIFT) & + proto_type = ((ntohl(in_be32(addr + XEL_HEADER_OFFSET + + XEL_RXBUFF_OFFSET)) >> XEL_HEADER_SHIFT) & XEL_RPLR_LENGTH_MASK); /* Check if received ethernet frame is a raw ethernet frame @@ -439,9 +439,9 @@ static u16 xemaclite_recv_data(struct net_local *drvdata, u8 *data) if (proto_type > (ETH_FRAME_LEN + ETH_FCS_LEN)) { if (proto_type == ETH_P_IP) { - length = ((in_be32(addr + + length = ((ntohl(in_be32(addr + XEL_HEADER_IP_LENGTH_OFFSET + - XEL_RXBUFF_OFFSET) >> + XEL_RXBUFF_OFFSET)) >> XEL_HEADER_SHIFT) & XEL_RPLR_LENGTH_MASK); length += ETH_HLEN + ETH_FCS_LEN; -- 1.5.5.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 4/7] net: emaclite: Add support for little-endian platforms 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> 0 siblings, 1 reply; 10+ messages in thread From: Grant Likely @ 2010-09-29 6:11 UTC (permalink / raw) To: Michal Simek Cc: linux-kernel, john.williams, edgar.iglesias, duyl, linnj, microblaze-uclinux, David S. Miller, Eric Dumazet, netdev, devicetree-discuss On Wed, Sep 29, 2010 at 03:52:15PM +1000, Michal Simek wrote: > Upcomming Microblaze is little endian that's why is necessary > to fix protocol and length loading. > > Signed-off-by: Michal Simek <monstr@monstr.eu> > CC: "David S. Miller" <davem@davemloft.net> > CC: Grant Likely <grant.likely@secretlab.ca> > CC: Eric Dumazet <eric.dumazet@gmail.com> > CC: netdev@vger.kernel.org > CC: linux-kernel@vger.kernel.org > CC: devicetree-discuss@lists.ozlabs.org This should go via davem, but it looks correct to me. Acked-by: Grant Likely <grant.likely@secretlab.ca> > --- > drivers/net/xilinx_emaclite.c | 8 ++++---- > 1 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c > index 71122ee..533ebb1 100644 > --- a/drivers/net/xilinx_emaclite.c > +++ b/drivers/net/xilinx_emaclite.c > @@ -430,8 +430,8 @@ static u16 xemaclite_recv_data(struct net_local *drvdata, u8 *data) > } > > /* Get the protocol type of the ethernet frame that arrived */ > - proto_type = ((in_be32(addr + XEL_HEADER_OFFSET + > - XEL_RXBUFF_OFFSET) >> XEL_HEADER_SHIFT) & > + proto_type = ((ntohl(in_be32(addr + XEL_HEADER_OFFSET + > + XEL_RXBUFF_OFFSET)) >> XEL_HEADER_SHIFT) & > XEL_RPLR_LENGTH_MASK); > > /* Check if received ethernet frame is a raw ethernet frame > @@ -439,9 +439,9 @@ static u16 xemaclite_recv_data(struct net_local *drvdata, u8 *data) > if (proto_type > (ETH_FRAME_LEN + ETH_FCS_LEN)) { > > if (proto_type == ETH_P_IP) { > - length = ((in_be32(addr + > + length = ((ntohl(in_be32(addr + > XEL_HEADER_IP_LENGTH_OFFSET + > - XEL_RXBUFF_OFFSET) >> > + XEL_RXBUFF_OFFSET)) >> > XEL_HEADER_SHIFT) & > XEL_RPLR_LENGTH_MASK); > length += ETH_HLEN + ETH_FCS_LEN; > -- > 1.5.5.1 > ^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <20100929061146.GA2439-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org>]
* Re: [PATCH 4/7] net: emaclite: Add support for little-endian platforms [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> 0 siblings, 1 reply; 10+ messages in thread From: David Miller @ 2010-09-29 6:27 UTC (permalink / raw) To: grant.likely-s3s/WqlpOiPyB63q8FvJNQ Cc: eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w, microblaze-uclinux-rVRm/Wmeqae7NGdpmJTKYQ, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linux-kernel-u79uwXL29TY76Z2rM5mHXA, duyl-gjFFaj9aHVfQT0dZR+AlfA, netdev-u79uwXL29TY76Z2rM5mHXA, linnj-gjFFaj9aHVfQT0dZR+AlfA, edgar.iglesias-Re5JQEeQqe8AvxtiuMwx3w, john.williams-g5w7nrANp4BDPfheJLI6IQ From: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> Date: Wed, 29 Sep 2010 15:11:46 +0900 > On Wed, Sep 29, 2010 at 03:52:15PM +1000, Michal Simek wrote: >> Upcomming Microblaze is little endian that's why is necessary >> to fix protocol and length loading. >> >> Signed-off-by: Michal Simek <monstr-pSz03upnqPeHXe+LvDLADg@public.gmane.org> >> CC: "David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org> >> CC: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> >> CC: Eric Dumazet <eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >> CC: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org >> CC: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org >> CC: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org > > This should go via davem, but it looks correct to me. > > Acked-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> It doesn't need to, the microblaze guys can integrate this directly: Acked-by: David S. Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org> ^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <20100928.232722.189705899.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>]
* Re: [PATCH 4/7] net: emaclite: Add support for little-endian platforms [not found] ` <20100928.232722.189705899.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org> @ 2010-09-29 7:33 ` Michal Simek 0 siblings, 0 replies; 10+ messages in thread From: Michal Simek @ 2010-09-29 7:33 UTC (permalink / raw) To: microblaze-uclinux-rVRm/Wmeqae7NGdpmJTKYQ Cc: eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w, netdev-u79uwXL29TY76Z2rM5mHXA, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linux-kernel-u79uwXL29TY76Z2rM5mHXA, duyl-gjFFaj9aHVfQT0dZR+AlfA, linnj-gjFFaj9aHVfQT0dZR+AlfA, edgar.iglesias-Re5JQEeQqe8AvxtiuMwx3w, john.williams-g5w7nrANp4BDPfheJLI6IQ David Miller wrote: > From: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> > Date: Wed, 29 Sep 2010 15:11:46 +0900 > >> On Wed, Sep 29, 2010 at 03:52:15PM +1000, Michal Simek wrote: >>> Upcomming Microblaze is little endian that's why is necessary >>> to fix protocol and length loading. >>> >>> Signed-off-by: Michal Simek <monstr-pSz03upnqPeHXe+LvDLADg@public.gmane.org> >>> CC: "David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org> >>> CC: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> >>> CC: Eric Dumazet <eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >>> CC: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org >>> CC: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org >>> CC: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org >> This should go via davem, but it looks correct to me. >> >> Acked-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> > > It doesn't need to, the microblaze guys can integrate this directly: > > Acked-by: David S. Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org> Thanks for ACKs. I will add them and will take care about it. Michal -- Michal Simek, Ing. (M.Eng) w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/ Microblaze U-BOOT custodian ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/7] of: Fix uart16550 initialization on little-endian systems [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:29 ` Grant Likely 1 sibling, 0 replies; 10+ messages in thread From: Grant Likely @ 2010-09-29 6:29 UTC (permalink / raw) To: Michal Simek Cc: microblaze-uclinux-rVRm/Wmeqae7NGdpmJTKYQ, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Tejun Heo, duyl-gjFFaj9aHVfQT0dZR+AlfA, linnj-gjFFaj9aHVfQT0dZR+AlfA, edgar.iglesias-Re5JQEeQqe8AvxtiuMwx3w, David S. Miller, john.williams-g5w7nrANp4BDPfheJLI6IQ On Wed, Sep 29, 2010 at 03:52:14PM +1000, Michal Simek wrote: > 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 Applied, thanks. g. > --- > 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 > ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/7] of: MTD: Fix OF probing on little-endian systems [not found] ` <1285739538-29058-3-git-send-email-monstr-pSz03upnqPeHXe+LvDLADg@public.gmane.org> 2010-09-29 5:52 ` [PATCH 3/7] of: Fix uart16550 initialization " Michal Simek @ 2010-09-29 6:29 ` Grant Likely 1 sibling, 0 replies; 10+ messages in thread From: Grant Likely @ 2010-09-29 6:29 UTC (permalink / raw) To: Michal Simek Cc: microblaze-uclinux-rVRm/Wmeqae7NGdpmJTKYQ, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Tejun Heo, linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, duyl-gjFFaj9aHVfQT0dZR+AlfA, linnj-gjFFaj9aHVfQT0dZR+AlfA, edgar.iglesias-Re5JQEeQqe8AvxtiuMwx3w, David Woodhouse, john.williams-g5w7nrANp4BDPfheJLI6IQ On Wed, Sep 29, 2010 at 03:52:13PM +1000, Michal Simek wrote: > Convert big-endian DTB to little-endian if necessary. > > Signed-off-by: Michal Simek <monstr-pSz03upnqPeHXe+LvDLADg@public.gmane.org> > CC: David Woodhouse <dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org> > CC: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> > CC: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> > CC: linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org > CC: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > CC: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org Applied, thanks. g. > --- > drivers/mtd/maps/physmap_of.c | 2 +- > drivers/mtd/ofpart.c | 4 ++-- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c > index fe63f6b..ec3edf6 100644 > --- a/drivers/mtd/maps/physmap_of.c > +++ b/drivers/mtd/maps/physmap_of.c > @@ -294,7 +294,7 @@ static int __devinit of_flash_probe(struct platform_device *dev, > info->list[i].map.name = dev_name(&dev->dev); > info->list[i].map.phys = res.start; > info->list[i].map.size = res_size; > - info->list[i].map.bankwidth = *width; > + info->list[i].map.bankwidth = be32_to_cpup(width); > > err = -ENOMEM; > info->list[i].map.virt = ioremap(info->list[i].map.phys, > diff --git a/drivers/mtd/ofpart.c b/drivers/mtd/ofpart.c > index 8bf7dc6..7bd171e 100644 > --- a/drivers/mtd/ofpart.c > +++ b/drivers/mtd/ofpart.c > @@ -53,8 +53,8 @@ int __devinit of_mtd_parse_partitions(struct device *dev, > continue; > } > > - (*pparts)[i].offset = reg[0]; > - (*pparts)[i].size = reg[1]; > + (*pparts)[i].offset = be32_to_cpu(reg[0]); > + (*pparts)[i].size = be32_to_cpu(reg[1]); > > partname = of_get_property(pp, "label", &len); > if (!partname) > -- > 1.5.5.1 > ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/7] of: GPIO: Fix OF probing on little-endian systems [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 @ 2010-09-29 6:30 ` Grant Likely 1 sibling, 0 replies; 10+ messages in thread From: Grant Likely @ 2010-09-29 6:30 UTC (permalink / raw) To: Michal Simek Cc: microblaze-uclinux-rVRm/Wmeqae7NGdpmJTKYQ, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Tejun Heo, duyl-gjFFaj9aHVfQT0dZR+AlfA, linnj-gjFFaj9aHVfQT0dZR+AlfA, edgar.iglesias-Re5JQEeQqe8AvxtiuMwx3w, Anton Vorontsov, john.williams-g5w7nrANp4BDPfheJLI6IQ On Wed, Sep 29, 2010 at 03:52:12PM +1000, Michal Simek wrote: > DTB is always big-endian that's why is necessary > to convert it. > > Signed-off-by: Michal Simek <monstr-pSz03upnqPeHXe+LvDLADg@public.gmane.org> > CC: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> > CC: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> > CC: Anton Vorontsov <avorontsov-hkdhdckH98+B+jHODAdFcQ@public.gmane.org> > CC: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > CC: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org Applied, thanks. g. > --- > drivers/gpio/xilinx_gpio.c | 6 +++--- > 1 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpio/xilinx_gpio.c b/drivers/gpio/xilinx_gpio.c > index 7096909..846fbd5 100644 > --- a/drivers/gpio/xilinx_gpio.c > +++ b/drivers/gpio/xilinx_gpio.c > @@ -171,13 +171,13 @@ static int __devinit xgpio_of_probe(struct device_node *np) > /* Update GPIO state shadow register with default value */ > tree_info = of_get_property(np, "xlnx,dout-default", NULL); > if (tree_info) > - chip->gpio_state = *tree_info; > + chip->gpio_state = be32_to_cpup(tree_info); > > /* Update GPIO direction shadow register with default value */ > chip->gpio_dir = 0xFFFFFFFF; /* By default, all pins are inputs */ > tree_info = of_get_property(np, "xlnx,tri-default", NULL); > if (tree_info) > - chip->gpio_dir = *tree_info; > + chip->gpio_dir = be32_to_cpup(tree_info); > > /* Check device node and parent device node for device width */ > chip->mmchip.gc.ngpio = 32; /* By default assume full GPIO controller */ > @@ -186,7 +186,7 @@ static int __devinit xgpio_of_probe(struct device_node *np) > tree_info = of_get_property(np->parent, > "xlnx,gpio-width", NULL); > if (tree_info) > - chip->mmchip.gc.ngpio = *tree_info; > + chip->mmchip.gc.ngpio = be32_to_cpup(tree_info); > > spin_lock_init(&chip->gpio_lock); > > -- > 1.5.5.1 > ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2010-09-29 7:33 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[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 ` [PATCH 3/7] of: Fix uart16550 initialization " Michal Simek
[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
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).