[Top] [All Lists]

Re: [PATCH 03/10] MIPS: PCI: Byteswap not needed in little-endian mode

To: Sergei Shtylyov <>
Subject: Re: [PATCH 03/10] MIPS: PCI: Byteswap not needed in little-endian mode
From: Florian Fainelli <>
Date: Tue, 15 Jan 2013 13:16:12 +0100
Cc: Jayachandran C <>,,
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=20120113; h=x-received:sender:message-id:date:from:organization:user-agent :mime-version:to:cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=+PPuMZX3q7q/QYf4TPilurslNaYh1jyOQuSOKQUsKvc=; b=EX2E1vvM2q/O53XPt+++O/Y6Izw5cd4PrQNSq//bzZlr9xlQXdv6reg+AI1OQLWCaA 7+tG9Bgp71BCguR9S/TAp3SRmt1dVO8aXhCPuejUVscl8bDi4Cua6/DjgdbT1gQq0V5N cw8qfavf0yHQ9xnYFRTbVt5+gogQfCsoZb6YGM6zb5dQ/7RI/EWvrjFEzVaL3POteVNu /xxCgwO6bn5PeDCBL31tB6P7w3d8iVSf5eZ4CP2l0fXoG1A0V+z+U/OE57nDuF5W4/Nm SU2FLoUKK7F62vEP4S/w/00JFYQtj+h8gSxQ6HIVfdLOf0sFOR3ObWg/YH5Qj/fajRX1 fc1Q==
In-reply-to: <>
List-archive: <>
List-help: <>
List-id: linux-mips <>
List-owner: <>
List-post: <>
List-software: Ecartis version 1.0.0
List-subscribe: <>
List-unsubscribe: <>
Organization: OpenWrt
References: <> <> <>
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2
On 01/15/2013 12:58 PM, Sergei Shtylyov wrote:

On 15-01-2013 10:19, Jayachandran C wrote:

Wrap the xlp_enable_pci_bswap() function and its call with
'#ifdef __BIG_ENDIAN'. On Netlogic XLP, the PCIe initialization code
to setup to byteswap is needed only in big-endian mode.

Signed-off-by: Jayachandran C <>


+ * If big-endian, enable hardware byteswap on the PCIe bridges.
+ * This will make both the SoC and PCIe devices behave consistently with
+ * readl/writel.
+ */
+static void xlp_config_pci_bswap(void)
+#ifdef __BIG_ENDIAN
      uint64_t pciebase, sysbase;
      int node, i;
      u32 reg;
@@ -222,7 +228,7 @@ static int xlp_enable_pci_bswap(void)
          reg = nlm_read_bridge_reg(sysbase, BRIDGE_PCIEIO_LIMIT0 + i);
          nlm_write_pci_reg(pciebase, PCIE_BYTE_SWAP_IO_LIM, reg |
-    return 0;

    You misunderstood. #ifdef within functions are frowned upon. Thios
patch is hardly better than previous then.

Jayachandran, you probably need something like this:

#ifdef __BIG_ENDIAN
static void xlp_config_pci_bswap(void)
        /* perform the actual swapping */
static inline void xlp_config_pci_bswap(void) { }

<Prev in Thread] Current Thread [Next in Thread>