Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

SH: pci-sh7780: enable big-endian operation.

If in big-endian mode, switch the PCI bus, too.

Tested on both litte-endian and big-endian sh7785lcr.

Signed-off-by: Thomas Schwinge <thomas@codesourcery.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: linux-sh@vger.kernel.org
Signed-off-by: Paul Mundt <lethal@linux-sh.org>

authored by

Thomas Schwinge and committed by
Paul Mundt
bfc906d8 49d4bcad

+12 -3
+12 -3
arch/sh/drivers/pci/pci-sh7780.c
··· 21 21 #include <asm/mmu.h> 22 22 #include <asm/sizes.h> 23 23 24 + #if defined(CONFIG_CPU_BIG_ENDIAN) 25 + # define PCICR_ENDIANNESS SH4_PCICR_BSWP 26 + #else 27 + # define PCICR_ENDIANNESS 0 28 + #endif 29 + 30 + 24 31 static struct resource sh7785_pci_resources[] = { 25 32 { 26 33 .name = "PCI IO", ··· 261 254 __raw_writel(PCIECR_ENBL, PCIECR); 262 255 263 256 /* Reset */ 264 - __raw_writel(SH4_PCICR_PREFIX | SH4_PCICR_PRST, 257 + __raw_writel(SH4_PCICR_PREFIX | SH4_PCICR_PRST | PCICR_ENDIANNESS, 265 258 chan->reg_base + SH4_PCICR); 266 259 267 260 /* ··· 297 290 * Now throw it in to register initialization mode and 298 291 * start the real work. 299 292 */ 300 - __raw_writel(SH4_PCICR_PREFIX, chan->reg_base + SH4_PCICR); 293 + __raw_writel(SH4_PCICR_PREFIX | PCICR_ENDIANNESS, 294 + chan->reg_base + SH4_PCICR); 301 295 302 296 memphys = __pa(memory_start); 303 297 memsize = roundup_pow_of_two(memory_end - memory_start); ··· 388 380 * Initialization mode complete, release the control register and 389 381 * enable round robin mode to stop device overruns/starvation. 390 382 */ 391 - __raw_writel(SH4_PCICR_PREFIX | SH4_PCICR_CFIN | SH4_PCICR_FTO, 383 + __raw_writel(SH4_PCICR_PREFIX | SH4_PCICR_CFIN | SH4_PCICR_FTO | 384 + PCICR_ENDIANNESS, 392 385 chan->reg_base + SH4_PCICR); 393 386 394 387 ret = register_pci_controller(chan);