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

MIPS: Loongson1: Remove several redundant RTC-related macros

Move the RTC-related macros to regs-rtc.h.

Signed-off-by: Yang Ling <gnaygnil@gmail.com>
Cc: keguang.zhang@gmail.com
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/14642/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

Yang Ling and committed by
Ralf Baechle
e31e4505 3ae34beb

+38 -19
+4 -3
arch/mips/include/asm/mach-loongson32/loongson1.h
··· 3 3 * 4 4 * Register mappings for Loongson 1 5 5 * 6 - * This program is free software; you can redistribute it and/or modify it 7 - * under the terms of the GNU General Public License as published by the 8 - * Free Software Foundation; either version 2 of the License, or (at your 6 + * This program is free software; you can redistribute it and/or modify it 7 + * under the terms of the GNU General Public License as published by the 8 + * Free Software Foundation; either version 2 of the License, or (at your 9 9 * option) any later version. 10 10 */ 11 11 ··· 52 52 #include <regs-clk.h> 53 53 #include <regs-mux.h> 54 54 #include <regs-pwm.h> 55 + #include <regs-rtc.h> 55 56 #include <regs-wdt.h> 56 57 57 58 #endif /* __ASM_MACH_LOONGSON32_LOONGSON1_H */
+23
arch/mips/include/asm/mach-loongson32/regs-rtc.h
··· 1 + /* 2 + * Copyright (c) 2016 Yang Ling <gnaygnil@gmail.com> 3 + * 4 + * Loongson 1 RTC timer Register Definitions. 5 + * 6 + * This program is free software; you can redistribute it and/or modify it 7 + * under the terms of the GNU General Public License as published by the 8 + * Free Software Foundation; either version 2 of the License, or (at your 9 + * option) any later version. 10 + */ 11 + 12 + #ifndef __ASM_MACH_LOONGSON32_REGS_RTC_H 13 + #define __ASM_MACH_LOONGSON32_REGS_RTC_H 14 + 15 + #define LS1X_RTC_REG(x) \ 16 + ((void __iomem *)KSEG1ADDR(LS1X_RTC_BASE + (x))) 17 + 18 + #define LS1X_RTC_CTRL LS1X_RTC_REG(0x40) 19 + 20 + #define RTC_EXTCLK_OK (BIT(5) | BIT(8)) 21 + #define RTC_EXTCLK_EN BIT(8) 22 + 23 + #endif /* __ASM_MACH_LOONGSON32_REGS_RTC_H */
+11 -16
arch/mips/loongson32/common/platform.c
··· 1 1 /* 2 2 * Copyright (c) 2011-2016 Zhang, Keguang <keguang.zhang@gmail.com> 3 3 * 4 - * This program is free software; you can redistribute it and/or modify it 5 - * under the terms of the GNU General Public License as published by the 6 - * Free Software Foundation; either version 2 of the License, or (at your 4 + * This program is free software; you can redistribute it and/or modify it 5 + * under the terms of the GNU General Public License as published by the 6 + * Free Software Foundation; either version 2 of the License, or (at your 7 7 * option) any later version. 8 8 */ 9 9 ··· 22 22 #include <cpufreq.h> 23 23 #include <dma.h> 24 24 #include <nand.h> 25 - 26 - #define LS1X_RTC_CTRL ((void __iomem *)KSEG1ADDR(LS1X_RTC_BASE + 0x40)) 27 - #define RTC_EXTCLK_OK (BIT(5) | BIT(8)) 28 - #define RTC_EXTCLK_EN BIT(8) 29 25 30 26 /* 8250/16550 compatible UART */ 31 27 #define LS1X_UART(_id) \ ··· 64 68 65 69 for (p = pdev->dev.platform_data; p->flags != 0; ++p) 66 70 p->uartclk = clk_get_rate(clk); 67 - } 68 - 69 - void __init ls1x_rtc_set_extclk(struct platform_device *pdev) 70 - { 71 - u32 val; 72 - 73 - val = __raw_readl(LS1X_RTC_CTRL); 74 - if (!(val & RTC_EXTCLK_OK)) 75 - __raw_writel(val | RTC_EXTCLK_EN, LS1X_RTC_CTRL); 76 71 } 77 72 78 73 /* CPUFreq */ ··· 344 357 }; 345 358 346 359 /* Real Time Clock */ 360 + void __init ls1x_rtc_set_extclk(struct platform_device *pdev) 361 + { 362 + u32 val = __raw_readl(LS1X_RTC_CTRL); 363 + 364 + if (!(val & RTC_EXTCLK_OK)) 365 + __raw_writel(val | RTC_EXTCLK_EN, LS1X_RTC_CTRL); 366 + } 367 + 347 368 struct platform_device ls1x_rtc_pdev = { 348 369 .name = "ls1x-rtc", 349 370 .id = -1,