X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=arch%2Fmips%2Fpmc-sierra%2Fyosemite%2Fpy-console.c;h=757e605693ff7bbac17ace1d032dbf19107aaf86;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=22c336f9a59652ea004d48d37470b12e4c6ead59;hpb=87fc8d1bb10cd459024a742c6a10961fefcef18f;p=linux-2.6.git diff --git a/arch/mips/pmc-sierra/yosemite/py-console.c b/arch/mips/pmc-sierra/yosemite/py-console.c index 22c336f9a..757e60569 100644 --- a/arch/mips/pmc-sierra/yosemite/py-console.c +++ b/arch/mips/pmc-sierra/yosemite/py-console.c @@ -48,11 +48,12 @@ struct yo_uartregs { #define iu_iir u3.iir #define iu_fcr u3.fcr -extern unsigned long uart_base; +#define ssnop() __asm__ __volatile__("sll $0, $0, 1\n"); +#define ssnop_4() do { ssnop(); ssnop(); ssnop(); ssnop(); } while (0) #define IO_BASE_64 0x9000000000000000ULL -static unsigned char readb_outer_space(unsigned long phys) +static unsigned char readb_outer_space(unsigned long long phys) { unsigned long long vaddr = IO_BASE_64 | phys; unsigned char res; @@ -60,29 +61,23 @@ static unsigned char readb_outer_space(unsigned long phys) sr = read_c0_status(); write_c0_status((sr | ST0_KX) & ~ ST0_IE); - __asm__("sll $0, $0, 2\n"); - __asm__("sll $0, $0, 2\n"); - __asm__("sll $0, $0, 2\n"); - __asm__("sll $0, $0, 2\n"); + ssnop_4(); __asm__ __volatile__ ( " .set mips3 \n" - " ld %0, (%0) \n" + " ld %0, %1 \n" " lbu %0, (%0) \n" " .set mips0 \n" : "=r" (res) - : "0" (&vaddr)); + : "m" (vaddr)); write_c0_status(sr); - __asm__("sll $0, $0, 2\n"); - __asm__("sll $0, $0, 2\n"); - __asm__("sll $0, $0, 2\n"); - __asm__("sll $0, $0, 2\n"); + ssnop_4(); return res; } -static void writeb_outer_space(unsigned long phys, unsigned char c) +static void writeb_outer_space(unsigned long long phys, unsigned char c) { unsigned long long vaddr = IO_BASE_64 | phys; unsigned long tmp; @@ -90,35 +85,24 @@ static void writeb_outer_space(unsigned long phys, unsigned char c) sr = read_c0_status(); write_c0_status((sr | ST0_KX) & ~ ST0_IE); - __asm__("sll $0, $0, 2\n"); - __asm__("sll $0, $0, 2\n"); - __asm__("sll $0, $0, 2\n"); - __asm__("sll $0, $0, 2\n"); + ssnop_4(); __asm__ __volatile__ ( " .set mips3 \n" - " ld %0, (%1) \n" + " ld %0, %1 \n" " sb %2, (%0) \n" " .set mips0 \n" - : "=r" (tmp) - : "r" (&vaddr), "r" (c)); + : "=&r" (tmp) + : "m" (vaddr), "r" (c)); write_c0_status(sr); - __asm__("sll $0, $0, 2\n"); - __asm__("sll $0, $0, 2\n"); - __asm__("sll $0, $0, 2\n"); - __asm__("sll $0, $0, 2\n"); -} - -static inline struct yo_uartregs *console_uart(void) -{ - return (struct yo_uartregs *) (uart_base + 8); + ssnop_4(); } void prom_putchar(char c) { - unsigned long lsr = 0xfd000008UL + offsetof(struct yo_uartregs, iu_lsr); - unsigned long thr = 0xfd000008UL + offsetof(struct yo_uartregs, iu_thr); + unsigned long lsr = 0xfd000008ULL + offsetof(struct yo_uartregs, iu_lsr); + unsigned long thr = 0xfd000008ULL + offsetof(struct yo_uartregs, iu_thr); while ((readb_outer_space(lsr) & 0x20) == 0); writeb_outer_space(thr, c);