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

ARM: ux500: use CLK_OF_DECLARE()

The ux500 DT support predates the CLK_OF_DECLARE macro and calls
directly into the clk driver from platform code.

Converting this to CLK_OF_DECLARE makes the code much nicer and
similar to how modern platforms do it today. It also removes the
last user of cpu_is_u8500_family() etc.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Arnd Bergmann and committed by
Linus Walleij
269f1aac 1e6cbc06

+6 -60
-1
MAINTAINERS
··· 1821 1821 T: git git://git.linaro.org/people/ulfh/clk.git 1822 1822 S: Maintained 1823 1823 F: drivers/clk/ux500/ 1824 - F: include/linux/platform_data/clk-ux500.h 1825 1824 1826 1825 ARM/VERSATILE EXPRESS PLATFORM 1827 1826 M: Liviu Dudau <liviu.dudau@arm.com>
-12
arch/arm/mach-ux500/cpu.c
··· 19 19 #include <linux/irq.h> 20 20 #include <linux/irqchip.h> 21 21 #include <linux/irqchip/arm-gic.h> 22 - #include <linux/platform_data/clk-ux500.h> 23 22 #include <linux/platform_data/arm-ux500-pm.h> 24 23 25 24 #include <asm/mach/map.h> ··· 65 66 prcmu_early_init(r.start, r.end-r.start); 66 67 ux500_pm_init(r.start, r.end-r.start); 67 68 ux500_l2x0_init(); 68 - 69 - /* 70 - * Init clocks here so that they are available for system timer 71 - * initialization. 72 - */ 73 - if (cpu_is_u8500_family()) 74 - u8500_clk_init(); 75 - else if (cpu_is_u9540()) 76 - u9540_clk_init(); 77 - else if (cpu_is_u8540()) 78 - u8540_clk_init(); 79 69 } 80 70 81 71 static const char * __init ux500_get_machine(void)
+2 -14
drivers/clk/ux500/u8500_of_clk.c
··· 11 11 #include <linux/of_address.h> 12 12 #include <linux/clk-provider.h> 13 13 #include <linux/mfd/dbx500-prcmu.h> 14 - #include <linux/platform_data/clk-ux500.h> 15 14 #include "clk.h" 16 15 17 16 #define PRCC_NUM_PERIPH_CLUSTERS 6 ··· 47 48 return PRCC_SHOW(clk_data, base, bit); 48 49 } 49 50 50 - static const struct of_device_id u8500_clk_of_match[] = { 51 - { .compatible = "stericsson,u8500-clks", }, 52 - { }, 53 - }; 54 - 55 51 /* CLKRST4 is missing making it hard to index things */ 56 52 enum clkrst_index { 57 53 CLKRST1_INDEX = 0, ··· 57 63 CLKRST_MAX, 58 64 }; 59 65 60 - void u8500_clk_init(void) 66 + static void u8500_clk_init(struct device_node *np) 61 67 { 62 68 struct prcmu_fw_version *fw_version; 63 - struct device_node *np = NULL; 64 69 struct device_node *child = NULL; 65 70 const char *sgaclk_parent = NULL; 66 71 struct clk *clk, *rtc_clk, *twd_clk; 67 72 u32 bases[CLKRST_MAX]; 68 73 int i; 69 74 70 - if (of_have_populated_dt()) 71 - np = of_find_matching_node(NULL, u8500_clk_of_match); 72 - if (!np) { 73 - pr_err("Either DT or U8500 Clock node not found\n"); 74 - return; 75 - } 76 75 for (i = 0; i < ARRAY_SIZE(bases); i++) { 77 76 struct resource r; 78 77 ··· 560 573 of_clk_add_provider(child, of_clk_src_simple_get, twd_clk); 561 574 } 562 575 } 576 + CLK_OF_DECLARE(u8500_clks, "stericsson,u8500-clks", u8500_clk_init);
+2 -14
drivers/clk/ux500/u8540_clk.c
··· 12 12 #include <linux/clkdev.h> 13 13 #include <linux/clk-provider.h> 14 14 #include <linux/mfd/dbx500-prcmu.h> 15 - #include <linux/platform_data/clk-ux500.h> 16 15 #include "clk.h" 17 - 18 - static const struct of_device_id u8540_clk_of_match[] = { 19 - { .compatible = "stericsson,u8540-clks", }, 20 - { } 21 - }; 22 16 23 17 /* CLKRST4 is missing making it hard to index things */ 24 18 enum clkrst_index { ··· 24 30 CLKRST_MAX, 25 31 }; 26 32 27 - void u8540_clk_init(void) 33 + static void u8540_clk_init(struct device_node *np) 28 34 { 29 35 struct clk *clk; 30 - struct device_node *np = NULL; 31 36 u32 bases[CLKRST_MAX]; 32 37 int i; 33 38 34 - if (of_have_populated_dt()) 35 - np = of_find_matching_node(NULL, u8540_clk_of_match); 36 - if (!np) { 37 - pr_err("Either DT or U8540 Clock node not found\n"); 38 - return; 39 - } 40 39 for (i = 0; i < ARRAY_SIZE(bases); i++) { 41 40 struct resource r; 42 41 ··· 594 607 bases[CLKRST6_INDEX], BIT(0), CLK_SET_RATE_GATE); 595 608 clk_register_clkdev(clk, NULL, "rng"); 596 609 } 610 + CLK_OF_DECLARE(u8540_clks, "stericsson,u8540-clks", u8540_clk_init);
+2 -2
drivers/clk/ux500/u9540_clk.c
··· 9 9 10 10 #include <linux/clk-provider.h> 11 11 #include <linux/mfd/dbx500-prcmu.h> 12 - #include <linux/platform_data/clk-ux500.h> 13 12 #include "clk.h" 14 13 15 - void u9540_clk_init(void) 14 + static void u9540_clk_init(struct device_node *np) 16 15 { 17 16 /* register clocks here */ 18 17 } 18 + CLK_OF_DECLARE(u9540_clks, "stericsson,u9540-clks", u9540_clk_init);
-17
include/linux/platform_data/clk-ux500.h
··· 1 - /* 2 - * Clock definitions for ux500 platforms 3 - * 4 - * Copyright (C) 2012 ST-Ericsson SA 5 - * Author: Ulf Hansson <ulf.hansson@linaro.org> 6 - * 7 - * License terms: GNU General Public License (GPL) version 2 8 - */ 9 - 10 - #ifndef __CLK_UX500_H 11 - #define __CLK_UX500_H 12 - 13 - void u8500_clk_init(void); 14 - void u9540_clk_init(void); 15 - void u8540_clk_init(void); 16 - 17 - #endif /* __CLK_UX500_H */