Skip to contentSkip to conversation

ARM: davinci: convert to common clock framework

PATCH Superseded David Lechner 2 participants 13 messages Dec 2, 2017 – Dec 8, 2017

Subsystems (3)

v1 of 11 Superseded Latest is v11 →

lore
Share & tools
lore
#0 lore raw

cover ARM: davinci: convert to common clock framework

This series takes the first steps towards moving mach-davinci to the common clock framework.

Basically, this series does some cleanup and rearranging to get things ready for the conversion. Then in "ARM: davinci: convert to common clock framework" we actually make the conversion. This is done by just creating a thin layer around the existing mach clock code.

There is certainly more to be done to make full use of the common clock framework, but this seems like the smallest logical set of patches to get CONFIG_COMMON_CLK switched on. Otherwise, I think we would end up with a series of 20+ patches that would be harder to review.

I have tested this on LEGO MINDSTORMS EV3 (TI AM1808), so I am confident that I haven't broken anything (too badly) in da850. But, I don't have other hardware to test.

David Lechner (6):
ARM: davinci: clean up map_io functions
ARM: davinci: move davinci_clk_init() to init_time
ARM: davinci: don't use static clk_lookup
ARM: davinci: make davinci_clk_reset() static
ARM: davinci: convert to common clock framework
ARM: davinci: remove clock debugfs

 arch/arm/Kconfig                            |   2 +-
 arch/arm/mach-davinci/board-da830-evm.c     |   9 +-
 arch/arm/mach-davinci/board-da850-evm.c     |   9 +-
 arch/arm/mach-davinci/board-dm355-evm.c     |   9 +-
 arch/arm/mach-davinci/board-dm355-leopard.c |   9 +-
 arch/arm/mach-davinci/board-dm365-evm.c     |   9 +-
 arch/arm/mach-davinci/board-dm644x-evm.c    |  10 +-
 arch/arm/mach-davinci/board-dm646x-evm.c    |  18 +-
 arch/arm/mach-davinci/board-mityomapl138.c  |   9 +-
 arch/arm/mach-davinci/board-neuros-osd2.c   |   9 +-
 arch/arm/mach-davinci/board-omapl138-hawk.c |   9 +-
 arch/arm/mach-davinci/board-sffsdr.c        |   9 +-
 arch/arm/mach-davinci/clock.c               | 299 +++++++++-------------------
 arch/arm/mach-davinci/clock.h               |  48 +++--
 arch/arm/mach-davinci/da830.c               | 217 ++++++++++----------
 arch/arm/mach-davinci/da850.c               | 292 +++++++++++++--------------
 arch/arm/mach-davinci/da8xx-dt.c            |   4 +-
 arch/arm/mach-davinci/davinci.h             |  12 +-
 arch/arm/mach-davinci/devices-da8xx.c       |   9 +-
 arch/arm/mach-davinci/dm355.c               | 184 ++++++++---------
 arch/arm/mach-davinci/dm365.c               | 242 +++++++++++-----------
 arch/arm/mach-davinci/dm644x.c              | 164 +++++++--------
 arch/arm/mach-davinci/dm646x.c              | 180 +++++++++--------
 arch/arm/mach-davinci/include/mach/clock.h  |   3 -
 arch/arm/mach-davinci/include/mach/common.h |   1 -
 arch/arm/mach-davinci/include/mach/da8xx.h  |   7 +-
 arch/arm/mach-davinci/time.c                |   1 -
 arch/arm/mach-davinci/usb-da8xx.c           |  57 +++---
 28 files changed, 841 insertions(+), 990 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/6 ARM: davinci: clean up map_io functions

This cleans up the map_io functions in the board init files for mach-davinci.

Most of the boards had a wrapper function around <board>_init(). This wrapper is removed and the function is used directly. Additionally, the <board>_init() functions are renamed to <board>_map_io() to match the field name.

---
 arch/arm/mach-davinci/board-da830-evm.c     |  7 +------
 arch/arm/mach-davinci/board-da850-evm.c     |  7 +------
 arch/arm/mach-davinci/board-dm355-evm.c     |  7 +------
 arch/arm/mach-davinci/board-dm355-leopard.c |  7 +------
 arch/arm/mach-davinci/board-dm365-evm.c     |  7 +------
 arch/arm/mach-davinci/board-dm644x-evm.c    |  8 +-------
 arch/arm/mach-davinci/board-dm646x-evm.c    | 14 ++------------
 arch/arm/mach-davinci/board-mityomapl138.c  |  7 +------
 arch/arm/mach-davinci/board-neuros-osd2.c   |  7 +------
 arch/arm/mach-davinci/board-omapl138-hawk.c |  7 +------
 arch/arm/mach-davinci/board-sffsdr.c        |  7 +------
 arch/arm/mach-davinci/da830.c               |  2 +-
 arch/arm/mach-davinci/da850.c               |  2 +-
 arch/arm/mach-davinci/da8xx-dt.c            |  2 +-
 arch/arm/mach-davinci/davinci.h             |  8 ++++----
 arch/arm/mach-davinci/dm355.c               |  2 +-
 arch/arm/mach-davinci/dm365.c               |  2 +-
 arch/arm/mach-davinci/dm644x.c              |  2 +-
 arch/arm/mach-davinci/dm646x.c              |  8 +++++++-
 arch/arm/mach-davinci/include/mach/da8xx.h  |  4 ++--
 20 files changed, 31 insertions(+), 86 deletions(-)
arch/arm/mach-davinci/board-da830-evm.c +1 -6
index f673cd7..db656d4 100644
@@ -629,14 +629,9 @@ static int __init da830_evm_console_init(void)
 console_initcall(da830_evm_console_init);
 #endif
 
-static void __init da830_evm_map_io(void)
-{
-	da830_init();
-}
-
 MACHINE_START(DAVINCI_DA830_EVM, "DaVinci DA830/OMAP-L137/AM17x EVM")
 	.atag_offset	= 0x100,
-	.map_io		= da830_evm_map_io,
+	.map_io		= da830_map_io,
 	.init_irq	= cp_intc_init,
 	.init_time	= davinci_timer_init,
 	.init_machine	= da830_evm_init,
arch/arm/mach-davinci/board-da850-evm.c +1 -6
index cbde003..7333ade 100644
@@ -1472,14 +1472,9 @@ static int __init da850_evm_console_init(void)
 console_initcall(da850_evm_console_init);
 #endif
 
-static void __init da850_evm_map_io(void)
-{
-	da850_init();
-}
-
 MACHINE_START(DAVINCI_DA850_EVM, "DaVinci DA850/OMAP-L138/AM18x EVM")
 	.atag_offset	= 0x100,
-	.map_io		= da850_evm_map_io,
+	.map_io		= da850_map_io,
 	.init_irq	= cp_intc_init,
 	.init_time	= davinci_timer_init,
 	.init_machine	= da850_evm_init,
arch/arm/mach-davinci/board-dm355-evm.c +1 -6
index 62e7bc3..da462e7 100644
@@ -314,11 +314,6 @@ static struct platform_device *davinci_evm_devices[] __initdata = {
 	&davinci_nand_device,
 };
 
-static void __init dm355_evm_map_io(void)
-{
-	dm355_init();
-}
-
 static int dm355evm_mmc_get_cd(int module)
 {
 	if (!gpio_is_valid(dm355evm_mmc_gpios))
@@ -414,7 +409,7 @@ static __init void dm355_evm_init(void)
 
 MACHINE_START(DAVINCI_DM355_EVM, "DaVinci DM355 EVM")
 	.atag_offset  = 0x100,
-	.map_io	      = dm355_evm_map_io,
+	.map_io		= dm355_map_io,
 	.init_irq     = davinci_irq_init,
 	.init_time	= davinci_timer_init,
 	.init_machine = dm355_evm_init,
arch/arm/mach-davinci/board-dm355-leopard.c +1 -6
index be99724..21fd713 100644
@@ -174,11 +174,6 @@ static struct platform_device *davinci_leopard_devices[] __initdata = {
 	&davinci_nand_device,
 };
 
-static void __init dm355_leopard_map_io(void)
-{
-	dm355_init();
-}
-
 static int dm355leopard_mmc_get_cd(int module)
 {
 	if (!gpio_is_valid(leopard_mmc_gpio))
@@ -269,7 +264,7 @@ static __init void dm355_leopard_init(void)
 
 MACHINE_START(DM355_LEOPARD, "DaVinci DM355 leopard")
 	.atag_offset  = 0x100,
-	.map_io	      = dm355_leopard_map_io,
+	.map_io		= dm355_map_io,
 	.init_irq     = davinci_irq_init,
 	.init_time	= davinci_timer_init,
 	.init_machine = dm355_leopard_init,
arch/arm/mach-davinci/board-dm365-evm.c +1 -6
index e75741f..4ec759b 100644
@@ -714,11 +714,6 @@ static void __init evm_init_cpld(void)
 	/* REVISIT export switches: NTSC/PAL (SW5.6), EXTRA1 (SW5.2), etc */
 }
 
-static void __init dm365_evm_map_io(void)
-{
-	dm365_init();
-}
-
 static struct spi_eeprom at25640 = {
 	.byte_len	= SZ_64K / 8,
 	.name		= "at25640",
@@ -772,7 +767,7 @@ static __init void dm365_evm_init(void)
 
 MACHINE_START(DAVINCI_DM365_EVM, "DaVinci DM365 EVM")
 	.atag_offset	= 0x100,
-	.map_io		= dm365_evm_map_io,
+	.map_io		= dm365_map_io,
 	.init_irq	= davinci_irq_init,
 	.init_time	= davinci_timer_init,
 	.init_machine	= dm365_evm_init,
arch/arm/mach-davinci/board-dm644x-evm.c +1 -7
index b07c9b1..8f6e9ea 100644
@@ -725,12 +725,6 @@ static struct platform_device *davinci_evm_devices[] __initdata = {
 	&rtc_dev,
 };
 
-static void __init
-davinci_evm_map_io(void)
-{
-	dm644x_init();
-}
-
 static int davinci_phy_fixup(struct phy_device *phydev)
 {
 	unsigned int control;
@@ -815,7 +809,7 @@ static __init void davinci_evm_init(void)
 MACHINE_START(DAVINCI_EVM, "DaVinci DM644x EVM")
 	/* Maintainer: MontaVista Software <[email protected]> */
 	.atag_offset  = 0x100,
-	.map_io	      = davinci_evm_map_io,
+	.map_io		= dm644x_map_io,
 	.init_irq     = davinci_irq_init,
 	.init_time	= davinci_timer_init,
 	.init_machine = davinci_evm_init,
arch/arm/mach-davinci/board-dm646x-evm.c +2 -12
index cb0a41e..f0e2762 100644
@@ -716,16 +716,6 @@ static void __init evm_init_i2c(void)
 }
 #endif
 
-#define DM6467T_EVM_REF_FREQ		33000000
-
-static void __init davinci_map_io(void)
-{
-	dm646x_init();
-
-	if (machine_is_davinci_dm6467tevm())
-		davinci_set_refclk_rate(DM6467T_EVM_REF_FREQ);
-}
-
 #define DM646X_EVM_PHY_ID		"davinci_mdio-0:01"
 /*
  * The following EDMA channels/slots are not being used by drivers (for
@@ -795,7 +785,7 @@ static __init void evm_init(void)
 
 MACHINE_START(DAVINCI_DM6467_EVM, "DaVinci DM646x EVM")
 	.atag_offset  = 0x100,
-	.map_io       = davinci_map_io,
+	.map_io		= dm646x_map_io,
 	.init_irq     = davinci_irq_init,
 	.init_time	= davinci_timer_init,
 	.init_machine = evm_init,
@@ -806,7 +796,7 @@ MACHINE_END
 
 MACHINE_START(DAVINCI_DM6467TEVM, "DaVinci DM6467T EVM")
 	.atag_offset  = 0x100,
-	.map_io       = davinci_map_io,
+	.map_io		= dm646x_map_io,
 	.init_irq     = davinci_irq_init,
 	.init_time	= davinci_timer_init,
 	.init_machine = evm_init,
arch/arm/mach-davinci/board-mityomapl138.c +1 -6
index b73ce7b..9ea2628 100644
@@ -561,14 +561,9 @@ static int __init mityomapl138_console_init(void)
 console_initcall(mityomapl138_console_init);
 #endif
 
-static void __init mityomapl138_map_io(void)
-{
-	da850_init();
-}
-
 MACHINE_START(MITYOMAPL138, "MityDSP-L138/MityARM-1808")
 	.atag_offset	= 0x100,
-	.map_io		= mityomapl138_map_io,
+	.map_io		= da850_map_io,
 	.init_irq	= cp_intc_init,
 	.init_time	= davinci_timer_init,
 	.init_machine	= mityomapl138_init,
arch/arm/mach-davinci/board-neuros-osd2.c +1 -6
index 0c02aaa..6f4e7dc 100644
@@ -154,11 +154,6 @@ static struct platform_device *davinci_ntosd2_devices[] __initdata = {
 	&ntosd2_leds_dev,
 };
 
-static void __init davinci_ntosd2_map_io(void)
-{
-	dm644x_init();
-}
-
 static struct davinci_mmc_config davinci_ntosd2_mmc_config = {
 	.wires		= 4,
 };
@@ -225,7 +220,7 @@ static __init void davinci_ntosd2_init(void)
 MACHINE_START(NEUROS_OSD2, "Neuros OSD2")
 	/* Maintainer: Neuros Technologies <[email protected]> */
 	.atag_offset	= 0x100,
-	.map_io		 = davinci_ntosd2_map_io,
+	.map_io		= dm644x_map_io,
 	.init_irq	= davinci_irq_init,
 	.init_time	= davinci_timer_init,
 	.init_machine = davinci_ntosd2_init,
arch/arm/mach-davinci/board-omapl138-hawk.c +1 -6
index a3e7807..0fdb7b7 100644
@@ -325,14 +325,9 @@ static int __init omapl138_hawk_console_init(void)
 console_initcall(omapl138_hawk_console_init);
 #endif
 
-static void __init omapl138_hawk_map_io(void)
-{
-	da850_init();
-}
-
 MACHINE_START(OMAPL138_HAWKBOARD, "AM18x/OMAP-L138 Hawkboard")
 	.atag_offset	= 0x100,
-	.map_io		= omapl138_hawk_map_io,
+	.map_io		= da850_map_io,
 	.init_irq	= cp_intc_init,
 	.init_time	= davinci_timer_init,
 	.init_machine	= omapl138_hawk_init,
arch/arm/mach-davinci/board-sffsdr.c +1 -6
index d85accf..3c1059a 100644
@@ -125,11 +125,6 @@ static struct platform_device *davinci_sffsdr_devices[] __initdata = {
 	&davinci_sffsdr_nandflash_device,
 };
 
-static void __init davinci_sffsdr_map_io(void)
-{
-	dm644x_init();
-}
-
 static __init void davinci_sffsdr_init(void)
 {
 	struct davinci_soc_info *soc_info = &davinci_soc_info;
@@ -148,7 +143,7 @@ static __init void davinci_sffsdr_init(void)
 
 MACHINE_START(SFFSDR, "Lyrtech SFFSDR")
 	.atag_offset  = 0x100,
-	.map_io	      = davinci_sffsdr_map_io,
+	.map_io		= dm644x_map_io,
 	.init_irq     = davinci_irq_init,
 	.init_time	= davinci_timer_init,
 	.init_machine = davinci_sffsdr_init,
arch/arm/mach-davinci/da830.c +1 -1
index bd88470..2e249f0 100644
@@ -1214,7 +1214,7 @@ static struct davinci_soc_info davinci_soc_info_da830 = {
 	.emac_pdata		= &da8xx_emac_pdata,
 };
 
-void __init da830_init(void)
+void __init da830_map_io(void)
 {
 	davinci_common_init(&davinci_soc_info_da830);
 
arch/arm/mach-davinci/da850.c +1 -1
index 07d6f0e..056b148 100644
@@ -1369,7 +1369,7 @@ static struct davinci_soc_info davinci_soc_info_da850 = {
 	.sram_len		= SZ_128K,
 };
 
-void __init da850_init(void)
+void __init da850_map_io(void)
 {
 	unsigned int v;
 
arch/arm/mach-davinci/da8xx-dt.c +1 -1
index f06db67..92c7c34 100644
@@ -95,7 +95,7 @@ static const char *const da850_boards_compat[] __initconst = {
 };
 
 DT_MACHINE_START(DA850_DT, "Generic DA850/OMAP-L138/AM18x")
-	.map_io		= da850_init,
+	.map_io		= da850_map_io,
 	.init_time	= davinci_timer_init,
 	.init_machine	= da850_init_machine,
 	.dt_compat	= da850_boards_compat,
arch/arm/mach-davinci/davinci.h +4 -4
index c62b90c..d550717 100644
@@ -82,7 +82,7 @@ int davinci_gpio_register(struct resource *res, int size, void *pdata);
 int davinci_init_wdt(void);
 
 /* DM355 function declarations */
-void dm355_init(void);
+void dm355_map_io(void);
 void dm355_init_spi0(unsigned chipselect_mask,
 		const struct spi_board_info *info, unsigned len);
 void dm355_init_asp1(u32 evt_enable);
@@ -90,7 +90,7 @@ int dm355_init_video(struct vpfe_config *, struct vpbe_config *);
 int dm355_gpio_register(void);
 
 /* DM365 function declarations */
-void dm365_init(void);
+void dm365_map_io(void);
 void dm365_init_asp(void);
 void dm365_init_vc(void);
 void dm365_init_ks(struct davinci_ks_platform_data *pdata);
@@ -101,13 +101,13 @@ int dm365_init_video(struct vpfe_config *, struct vpbe_config *);
 int dm365_gpio_register(void);
 
 /* DM644x function declarations */
-void dm644x_init(void);
+void dm644x_map_io(void);
 void dm644x_init_asp(void);
 int dm644x_init_video(struct vpfe_config *, struct vpbe_config *);
 int dm644x_gpio_register(void);
 
 /* DM646x function declarations */
-void dm646x_init(void);
+void dm646x_map_io(void);
 void dm646x_init_mcasp0(struct snd_platform_data *pdata);
 void dm646x_init_mcasp1(struct snd_platform_data *pdata);
 int dm646x_init_edma(struct edma_rsv_info *rsv);
arch/arm/mach-davinci/dm355.c +1 -1
index bd50367..88c3c80 100644
@@ -1039,7 +1039,7 @@ void __init dm355_init_asp1(u32 evt_enable)
 	platform_device_register(&dm355_asp1_device);
 }
 
-void __init dm355_init(void)
+void __init dm355_map_io(void)
 {
 	davinci_common_init(&davinci_soc_info_dm355);
 	davinci_map_sysmod();
arch/arm/mach-davinci/dm365.c +1 -1
index 8be04ec..f979180 100644
@@ -1162,7 +1162,7 @@ void __init dm365_init_rtc(void)
 	platform_device_register(&dm365_rtc_device);
 }
 
-void __init dm365_init(void)
+void __init dm365_map_io(void)
 {
 	davinci_common_init(&davinci_soc_info_dm365);
 	davinci_map_sysmod();
arch/arm/mach-davinci/dm644x.c +1 -1
index b437c37..80048c0 100644
@@ -927,7 +927,7 @@ void __init dm644x_init_asp(void)
 	platform_device_register(&dm644x_asp_device);
 }
 
-void __init dm644x_init(void)
+void __init dm644x_map_io(void)
 {
 	davinci_common_init(&davinci_soc_info_dm644x);
 	davinci_map_sysmod();
arch/arm/mach-davinci/dm646x.c +7 -1
index da21353..b3be5c8 100644
@@ -17,6 +17,7 @@
 #include <linux/platform_data/edma.h>
 #include <linux/platform_data/gpio-davinci.h>
 
+#include <asm/mach-types.h>
 #include <asm/mach/map.h>
 
 #include <mach/cputype.h>
@@ -952,11 +953,16 @@ int __init dm646x_init_edma(struct edma_rsv_info *rsv)
 	return IS_ERR(edma_pdev) ? PTR_ERR(edma_pdev) : 0;
 }
 
-void __init dm646x_init(void)
+#define DM6467T_EVM_REF_FREQ		33000000
+
+void __init dm646x_map_io(void)
 {
 	davinci_common_init(&davinci_soc_info_dm646x);
 	davinci_map_sysmod();
 	davinci_clk_init(davinci_soc_info_dm646x.cpu_clks);
+
+	if (machine_is_davinci_dm6467tevm())
+		davinci_set_refclk_rate(DM6467T_EVM_REF_FREQ);
 }
 
 static int __init dm646x_init_devices(void)
arch/arm/mach-davinci/include/mach/da8xx.h +2 -2
index 93ff156..c760c1b 100644
@@ -86,8 +86,8 @@ extern unsigned int da850_max_speed;
 #define DA8XX_SHARED_RAM_BASE	0x80000000
 #define DA8XX_ARM_RAM_BASE	0xffff0000
 
-void da830_init(void);
-void da850_init(void);
+void da830_map_io(void);
+void da850_map_io(void);
 
 int da830_register_edma(struct edma_rsv_info *rsv);
 int da850_register_edma(struct edma_rsv_info *rsv[2]);
Signature · 1 line
2.7.4
#2 lore raw

Re: [PATCH v1 1/6] ARM: davinci: clean up map_io functions

Quoted 15 lines · David Lechner

This cleans up the map_io functions in the board init files for mach-davinci.

Most of the boards had a wrapper function around <board>_init(). This wrapper is removed and the function is used directly. Additionally, the <board>_init() functions are renamed to <board>_map_io() to match the field name.

arch/arm/mach-davinci/board-dm646x-evm.c +0 -0
index cb0a41e..f0e2762 100644

arch/arm/mach-davinci/board-dm646x-evm.c static void __init evm_init_i2c(void) · line 723

Quoted 8 lines
arch/arm/mach-davinci/board-dm646x-evm.c +0 -5
@@ -716,16 +716,6 @@ static void __init evm_init_i2c(void)
 }
 #endif
 
-#define DM6467T_EVM_REF_FREQ		33000000
-
-static void __init davinci_map_io(void)
-{
-	dm646x_init();

The call to dm646x_init() is dropped here, but I don't see it added back, at least in this patch.

Quoted 18 lines
arch/arm/mach-davinci/dm646x.c +2 -1
index da21353..b3be5c8 100644
@@ -17,6 +17,7 @@
 #include <linux/platform_data/edma.h>
 #include <linux/platform_data/gpio-davinci.h>
 
+#include <asm/mach-types.h>
 #include <asm/mach/map.h>
 
 #include <mach/cputype.h>
@@ -952,11 +953,16 @@ int __init dm646x_init_edma(struct edma_rsv_info *rsv)
 	return IS_ERR(edma_pdev) ? PTR_ERR(edma_pdev) : 0;
 }
 
-void __init dm646x_init(void)
+#define DM6467T_EVM_REF_FREQ		33000000

arch/arm/mach-davinci/dm646x.c int __init dm646x_init_edma(struct edma_rsv_info *rsv) · line 966

Quoted 10 lines
arch/arm/mach-davinci/dm646x.c +5 -0
+
+void __init dm646x_map_io(void)
 {
 	davinci_common_init(&davinci_soc_info_dm646x);
 	davinci_map_sysmod();
 	davinci_clk_init(davinci_soc_info_dm646x.cpu_clks);
+
+	if (machine_is_davinci_dm6467tevm())
+		davinci_set_refclk_rate(DM6467T_EVM_REF_FREQ);
 }

I think we should leave the DM646x case out of this since there are additional issues like introducing these EVM specific defines in a file meant for SoC.

Is this clean-up a must for you to implement rest of the series (haven't looked at other patches yet).

Thanks,
Sekhar

#3 lore raw

Re: [PATCH v1 1/6] ARM: davinci: clean up map_io functions

Quoted 19 lines · Sekhar Nori
Quoted 18 lines · David Lechner

This cleans up the map_io functions in the board init files for mach-davinci.

Most of the boards had a wrapper function around <board>_init(). This wrapper is removed and the function is used directly. Additionally, the <board>_init() functions are renamed to <board>_map_io() to match the field name.

arch/arm/mach-davinci/board-dm646x-evm.c +0 -0
index cb0a41e..f0e2762 100644
@@ -716,16 +716,6 @@ static void __init evm_init_i2c(void)
  }
  #endif
 
Quoted 8 lines

arch/arm/mach-davinci/board-dm646x-evm.c static void __init evm_init_i2c(void) · line 723

Quoted 5 lines
arch/arm/mach-davinci/board-dm646x-evm.c +0 -5
-#define DM6467T_EVM_REF_FREQ		33000000
-
-static void __init davinci_map_io(void)
-{
-	dm646x_init();

The call to dm646x_init() is dropped here, but I don't see it added back, at least in this patch.

dm646x_init() is renamed to dm646x_map_io(), which is used directly in MACHINE_START().

Quoted 17 lines
Quoted 17 lines
arch/arm/mach-davinci/dm646x.c +1 -0
index da21353..b3be5c8 100644
@@ -17,6 +17,7 @@
  #include <linux/platform_data/edma.h>
  #include <linux/platform_data/gpio-davinci.h>
 
+#include <asm/mach-types.h>
  #include <asm/mach/map.h>
 
  #include <mach/cputype.h>
@@ -952,11 +953,16 @@ int __init dm646x_init_edma(struct edma_rsv_info *rsv)
  	return IS_ERR(edma_pdev) ? PTR_ERR(edma_pdev) : 0;
  }
 
Quoted 16 lines

arch/arm/mach-davinci/dm646x.c int __init dm646x_init_edma(struct edma_rsv_info *rsv) · line 966

Quoted 12 lines
arch/arm/mach-davinci/dm646x.c +6 -1
-void __init dm646x_init(void)
+#define DM6467T_EVM_REF_FREQ		33000000
+
+void __init dm646x_map_io(void)
  {
  	davinci_common_init(&davinci_soc_info_dm646x);
  	davinci_map_sysmod();
  	davinci_clk_init(davinci_soc_info_dm646x.cpu_clks);
+
+	if (machine_is_davinci_dm6467tevm())
+		davinci_set_refclk_rate(DM6467T_EVM_REF_FREQ);
  }

I think we should leave the DM646x case out of this since there are additional issues like introducing these EVM specific defines in a file meant for SoC.

I agree with the sentiment. This quirk gets moved around several times in this series just to keep things working for a git bisect even if it is not the ideal place for it to be.

Currently, all boards use a common reference frequency from the common SoC files instead of the board file. I have not done so in this version of the series, but I could rework it so that this happens, which would remove the need for this quirk altogether. But even then, it would probably get shuffled around a bit before being eliminated.

Quoted 3 lines

Is this clean-up a must for you to implement rest of the series (haven't looked at other patches yet).

Technically, no it is not required. But I must say that it has been a good help to me to keep things straight in my head.

#4 lore raw

Re: [PATCH v1 1/6] ARM: davinci: clean up map_io functions

Quoted 29 lines · David Lechner
Quoted 11 lines · Sekhar Nori
Quoted 9 lines · David Lechner

This cleans up the map_io functions in the board init files for mach-davinci.

Most of the boards had a wrapper function around <board>_init(). This wrapper is removed and the function is used directly. Additionally, the <board>_init() functions are renamed to <board>_map_io() to match the field name.

Quoted 16 lines

arch/arm/mach-davinci/board-dm646x-evm.c static void __init evm_init_i2c(void)

Quoted 13 lines
arch/arm/mach-davinci/board-dm646x-evm.c +0 -0
index cb0a41e..f0e2762 100644
@@ -716,16 +716,6 @@ static void __init evm_init_i2c(void)
 ? }

? #endif
? -#define DM6467T_EVM_REF_FREQ??????? 33000000

arch/arm/mach-davinci/board-dm646x-evm.c +0 -4
-
-static void __init davinci_map_io(void)
-{
-??? dm646x_init();

The call to dm646x_init() is dropped here, but I don't see it added back, at least in this patch.

Quoted 2 lines

dm646x_init() is renamed to dm646x_map_io(), which is used directly in MACHINE_START().

Ah, I missed that. But I think its a symptom of too many things going on in the patch. How about splitting the patch to:

a) Remove trivial <board>_map_io() wrappers and use <soc>_init() directly to initialize .map_io

b) Rename <soc>_init() to <soc>_map_io

Quoted 38 lines
Quoted 25 lines
Quoted 25 lines
arch/arm/mach-davinci/dm646x.c +0 -0
index da21353..b3be5c8 100644
@@ -17,6 +17,7 @@

? #include <linux/platform_data/edma.h>
? #include <linux/platform_data/gpio-davinci.h>
? +#include <asm/mach-types.h>
? #include <asm/mach/map.h>
? ? #include <mach/cputype.h>

arch/arm/mach-davinci/dm646x.c +3 -0
@@ -952,11 +953,16 @@ int __init dm646x_init_edma(struct
 edma_rsv_info *rsv)
 ????? return IS_ERR(edma_pdev) ? PTR_ERR(edma_pdev) : 0;
 ? }
 ? -void __init dm646x_init(void)
+#define DM6467T_EVM_REF_FREQ??????? 33000000
+
+void __init dm646x_map_io(void)
 ? {
 ????? davinci_common_init(&davinci_soc_info_dm646x);
 ????? davinci_map_sysmod();
 ????? davinci_clk_init(davinci_soc_info_dm646x.cpu_clks);
Quoted 8 lines

arch/arm/mach-davinci/dm646x.c int __init dm646x_init_edma(struct · line 967

Quoted 4 lines
arch/arm/mach-davinci/dm646x.c +3 -0
+
+??? if (machine_is_davinci_dm6467tevm())
+??????? davinci_set_refclk_rate(DM6467T_EVM_REF_FREQ);
 ? }

I think we should leave the DM646x case out of this since there are additional issues like introducing these EVM specific defines in a file meant for SoC.

I agree with the sentiment. This quirk gets moved around several times in this series just to keep things working for a git bisect even if it is not the ideal place for it to be.

Quoted 5 lines

Currently, all boards use a common reference frequency from the common SoC files instead of the board file. I have not done so in this version of the series, but I could rework it so that this happens, which would remove the need for this quirk altogether. But even then, it would probably get shuffled around a bit before being eliminated.

We should avoid shuffling and modifying the same code repeatedly if we can. I think, it will be easier to read if patch 2 and 1 are interchanged.

There is a lot going on and I wasn't sure how that will look so I tried it briefly and pushed a branch.

Do have a look, but this seems better to me.

https://git.kernel.org/pub/scm/linux/kernel/git/nsekhar/linux-davinci.git/log/?h=for-davidl

Thanks,
Sekhar

#5 lore raw

Re: [PATCH v1 1/6] ARM: davinci: clean up map_io functions

Quoted 88 lines · Sekhar Nori
Quoted 29 lines · David Lechner
Quoted 11 lines · Sekhar Nori
Quoted 9 lines · David Lechner

This cleans up the map_io functions in the board init files for mach-davinci.

Most of the boards had a wrapper function around <board>_init(). This wrapper is removed and the function is used directly. Additionally, the <board>_init() functions are renamed to <board>_map_io() to match the field name.

Quoted 16 lines

arch/arm/mach-davinci/board-dm646x-evm.c static void __init evm_init_i2c(void) · line 722

Quoted 13 lines
arch/arm/mach-davinci/board-dm646x-evm.c +0 -4
index cb0a41e..f0e2762 100644
@@ -716,16 +716,6 @@ static void __init evm_init_i2c(void)
 ? }
 ? #endif
 ? -#define DM6467T_EVM_REF_FREQ??????? 33000000
-
-static void __init davinci_map_io(void)
-{
-??? dm646x_init();

The call to dm646x_init() is dropped here, but I don't see it added back, at least in this patch.

Quoted 2 lines

dm646x_init() is renamed to dm646x_map_io(), which is used directly in MACHINE_START().

Ah, I missed that. But I think its a symptom of too many things going on in the patch. How about splitting the patch to:

a) Remove trivial <board>_map_io() wrappers and use <soc>_init() directly to initialize .map_io

b) Rename <soc>_init() to <soc>_map_io

Quoted 38 lines
Quoted 25 lines
Quoted 25 lines
arch/arm/mach-davinci/dm646x.c +3 -0
index da21353..b3be5c8 100644
@@ -17,6 +17,7 @@
 ? #include <linux/platform_data/edma.h>
 ? #include <linux/platform_data/gpio-davinci.h>
 ? +#include <asm/mach-types.h>
 ? #include <asm/mach/map.h>
 ? ? #include <mach/cputype.h>
@@ -952,11 +953,16 @@ int __init dm646x_init_edma(struct
 edma_rsv_info *rsv)
 ????? return IS_ERR(edma_pdev) ? PTR_ERR(edma_pdev) : 0;
 ? }
 ? -void __init dm646x_init(void)
+#define DM6467T_EVM_REF_FREQ??????? 33000000
+
+void __init dm646x_map_io(void)
 ? {
 ????? davinci_common_init(&davinci_soc_info_dm646x);
 ????? davinci_map_sysmod();
 ????? davinci_clk_init(davinci_soc_info_dm646x.cpu_clks);
Quoted 8 lines

arch/arm/mach-davinci/dm646x.c int __init dm646x_init_edma(struct · line 967

Quoted 4 lines
arch/arm/mach-davinci/dm646x.c +3 -0
+
+??? if (machine_is_davinci_dm6467tevm())
+??????? davinci_set_refclk_rate(DM6467T_EVM_REF_FREQ);
 ? }

I think we should leave the DM646x case out of this since there are additional issues like introducing these EVM specific defines in a file meant for SoC.

I agree with the sentiment. This quirk gets moved around several times in this series just to keep things working for a git bisect even if it is not the ideal place for it to be.

Quoted 5 lines

Currently, all boards use a common reference frequency from the common SoC files instead of the board file. I have not done so in this version of the series, but I could rework it so that this happens, which would remove the need for this quirk altogether. But even then, it would probably get shuffled around a bit before being eliminated.

We should avoid shuffling and modifying the same code repeatedly if we can. I think, it will be easier to read if patch 2 and 1 are interchanged.

Quoted 7 lines

There is a lot going on and I wasn't sure how that will look so I tried it briefly and pushed a branch.

Do have a look, but this seems better to me.

https://git.kernel.org/pub/scm/linux/kernel/git/nsekhar/linux-davinci.git/log/?h=for-davidl

Thank you for the suggestion. I think it will be better as well. I'll respin the series and we'll see how it works.

#6 lore raw

Re: [PATCH v1 1/6] ARM: davinci: clean up map_io functions

In reply to David Lechner

arch/arm/mach-davinci/board-dm355-leopard.c static __init void dm355_leopard_init(void) · line 270

Quoted 12 lines · David Lechner

static int dm355leopard_mmc_get_cd(int module)
{

arch/arm/mach-davinci/board-dm355-leopard.c +1 -1
 	if (!gpio_is_valid(leopard_mmc_gpio))
@@ -269,7 +264,7 @@ static __init void dm355_leopard_init(void)
 
 MACHINE_START(DM355_LEOPARD, "DaVinci DM355 leopard")
 	.atag_offset  = 0x100,
-	.map_io	      = dm355_leopard_map_io,
+	.map_io		= dm355_map_io,
 	.init_irq     = davinci_irq_init,
 	.init_time	= davinci_timer_init,
 	.init_machine = dm355_leopard_init,

It seems like spaces were used in original code for indentation. Can you please introduce a patch to fix that first since you are now touching this part of the code?

Thanks,
Sekhar

#7 lore raw

Re: [PATCH v1 1/6] ARM: davinci: clean up map_io functions

Quoted 6 lines · Sekhar Nori
Quoted 5 lines · David Lechner
  static int dm355leopard_mmc_get_cd(int module)
  {
  	if (!gpio_is_valid(leopard_mmc_gpio))
(quoted diff) +0 -0
@@ -269,7 +264,7 @@ static __init void dm355_leopard_init(void)
 
Quoted 11 lines

arch/arm/mach-davinci/board-dm355-leopard.c static __init void dm355_leopard_init(void) · line 270

Quoted 7 lines
arch/arm/mach-davinci/board-dm355-leopard.c +1 -1
  MACHINE_START(DM355_LEOPARD, "DaVinci DM355 leopard")
  	.atag_offset  = 0x100,
-	.map_io	      = dm355_leopard_map_io,
+	.map_io		= dm355_map_io,
  	.init_irq     = davinci_irq_init,
  	.init_time	= davinci_timer_init,
  	.init_machine = dm355_leopard_init,

It seems like spaces were used in original code for indentation. Can you please introduce a patch to fix that first since you are now touching this part of the code?

Many of the board files have mixed spaces and tabs here. I went with tabs since the newest commits used tabs. But, yes, I can clean this up.

#8 lore raw

PATCH 2/6 ARM: davinci: move davinci_clk_init() to init_time

In reply to David Lechner

This moves the call of davinci_clk_init() from map_io to init_time for all boards.

This is the proper place to init clocks. This is also done in preparation for moving to the common clock framework.

---
 arch/arm/mach-davinci/da830.c  | 2 --
 arch/arm/mach-davinci/da850.c  | 2 --
 arch/arm/mach-davinci/dm355.c  | 1 -
 arch/arm/mach-davinci/dm365.c  | 1 -
 arch/arm/mach-davinci/dm644x.c | 1 -
 arch/arm/mach-davinci/dm646x.c | 7 -------
 arch/arm/mach-davinci/time.c   | 7 +++++++
 7 files changed, 7 insertions(+), 14 deletions(-)
arch/arm/mach-davinci/da830.c +0 -2
index 2e249f0..f28eda1 100644
@@ -1220,6 +1220,4 @@ void __init da830_map_io(void)
 
 	da8xx_syscfg0_base = ioremap(DA8XX_SYSCFG0_BASE, SZ_4K);
 	WARN(!da8xx_syscfg0_base, "Unable to map syscfg0 module");
-
-	davinci_clk_init(davinci_soc_info_da830.cpu_clks);
 }
arch/arm/mach-davinci/da850.c +0 -2
index 056b148..28d8ec2 100644
@@ -1392,6 +1392,4 @@ void __init da850_map_io(void)
 	v = __raw_readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG));
 	v &= ~CFGCHIP3_PLL1_MASTER_LOCK;
 	__raw_writel(v, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG));
-
-	davinci_clk_init(davinci_soc_info_da850.cpu_clks);
 }
arch/arm/mach-davinci/dm355.c +0 -1
index 88c3c80..164ff27 100644
@@ -1043,7 +1043,6 @@ void __init dm355_map_io(void)
 {
 	davinci_common_init(&davinci_soc_info_dm355);
 	davinci_map_sysmod();
-	davinci_clk_init(davinci_soc_info_dm355.cpu_clks);
 }
 
 int __init dm355_init_video(struct vpfe_config *vpfe_cfg,
arch/arm/mach-davinci/dm365.c +0 -1
index f979180..6076085 100644
@@ -1166,7 +1166,6 @@ void __init dm365_map_io(void)
 {
 	davinci_common_init(&davinci_soc_info_dm365);
 	davinci_map_sysmod();
-	davinci_clk_init(davinci_soc_info_dm365.cpu_clks);
 }
 
 static struct resource dm365_vpss_resources[] = {
arch/arm/mach-davinci/dm644x.c +0 -1
index 80048c0..c5b1cf3 100644
@@ -931,7 +931,6 @@ void __init dm644x_map_io(void)
 {
 	davinci_common_init(&davinci_soc_info_dm644x);
 	davinci_map_sysmod();
-	davinci_clk_init(davinci_soc_info_dm644x.cpu_clks);
 }
 
 int __init dm644x_init_video(struct vpfe_config *vpfe_cfg,
arch/arm/mach-davinci/dm646x.c +0 -7
index b3be5c8..a844f7b 100644
@@ -17,7 +17,6 @@
 #include <linux/platform_data/edma.h>
 #include <linux/platform_data/gpio-davinci.h>
 
-#include <asm/mach-types.h>
 #include <asm/mach/map.h>
 
 #include <mach/cputype.h>
@@ -953,16 +952,10 @@ int __init dm646x_init_edma(struct edma_rsv_info *rsv)
 	return IS_ERR(edma_pdev) ? PTR_ERR(edma_pdev) : 0;
 }
 
-#define DM6467T_EVM_REF_FREQ		33000000
-
 void __init dm646x_map_io(void)
 {
 	davinci_common_init(&davinci_soc_info_dm646x);
 	davinci_map_sysmod();
-	davinci_clk_init(davinci_soc_info_dm646x.cpu_clks);
-
-	if (machine_is_davinci_dm6467tevm())
-		davinci_set_refclk_rate(DM6467T_EVM_REF_FREQ);
 }
 
 static int __init dm646x_init_devices(void)
arch/arm/mach-davinci/time.c +7 -0
index 034f865..6ba156e 100644
@@ -20,6 +20,7 @@
 #include <linux/platform_device.h>
 #include <linux/sched_clock.h>
 
+#include <asm/mach-types.h>
 #include <asm/mach/irq.h>
 #include <asm/mach/time.h>
 
@@ -341,6 +342,7 @@ static struct clock_event_device clockevent_davinci = {
 	.set_state_oneshot	= davinci_set_oneshot,
 };
 
+#define DM6467T_EVM_REF_FREQ		33000000
 
 void __init davinci_timer_init(void)
 {
@@ -350,6 +352,11 @@ void __init davinci_timer_init(void)
 	unsigned int clocksource_id;
 	int i;
 
+	davinci_clk_init(soc_info->cpu_clks);
+
+	if (machine_is_davinci_dm6467tevm())
+		davinci_set_refclk_rate(DM6467T_EVM_REF_FREQ);
+
 	clockevent_id = soc_info->timer_info->clockevent_id;
 	clocksource_id = soc_info->timer_info->clocksource_id;
 
Signature · 1 line
2.7.4
#9 lore raw

PATCH 3/6 ARM: davinci: don't use static clk_lookup

In reply to David Lechner

In preparation of moving to the common clock framework, usage of static struct clk_lookup is removed. The common clock framework uses an opaque struct clk, so we won't be able to use static tables as was previously done.

Each CPU family is given a new CPU-specific init_time function that registers the clocks individually via function calls instead of using a clk_lookup table.

---
 arch/arm/mach-davinci/board-da830-evm.c     |   2 +-
 arch/arm/mach-davinci/board-da850-evm.c     |   2 +-
 arch/arm/mach-davinci/board-dm355-evm.c     |   2 +-
 arch/arm/mach-davinci/board-dm355-leopard.c |   2 +-
 arch/arm/mach-davinci/board-dm365-evm.c     |   2 +-
 arch/arm/mach-davinci/board-dm644x-evm.c    |   2 +-
 arch/arm/mach-davinci/board-dm646x-evm.c    |   4 +-
 arch/arm/mach-davinci/board-mityomapl138.c  |   2 +-
 arch/arm/mach-davinci/board-neuros-osd2.c   |   2 +-
 arch/arm/mach-davinci/board-omapl138-hawk.c |   2 +-
 arch/arm/mach-davinci/board-sffsdr.c        |   2 +-
 arch/arm/mach-davinci/clock.c               |  75 +++++++--------
 arch/arm/mach-davinci/clock.h               |   9 +-
 arch/arm/mach-davinci/da830.c               | 115 ++++++++++++-----------
 arch/arm/mach-davinci/da850.c               | 137 ++++++++++++++--------------
 arch/arm/mach-davinci/da8xx-dt.c            |   2 +-
 arch/arm/mach-davinci/davinci.h             |   4 +
 arch/arm/mach-davinci/devices-da8xx.c       |   5 +-
 arch/arm/mach-davinci/dm355.c               |  97 ++++++++++----------
 arch/arm/mach-davinci/dm365.c               | 127 +++++++++++++-------------
 arch/arm/mach-davinci/dm644x.c              |  89 +++++++++---------
 arch/arm/mach-davinci/dm646x.c              |  99 +++++++++++---------
 arch/arm/mach-davinci/include/mach/common.h |   1 -
 arch/arm/mach-davinci/include/mach/da8xx.h  |   3 +
 arch/arm/mach-davinci/time.c                |   8 --
 arch/arm/mach-davinci/usb-da8xx.c           |  15 +--
 26 files changed, 407 insertions(+), 403 deletions(-)
arch/arm/mach-davinci/board-da830-evm.c +1 -1
index db656d4..524049a 100644
@@ -633,7 +633,7 @@ MACHINE_START(DAVINCI_DA830_EVM, "DaVinci DA830/OMAP-L137/AM17x EVM")
 	.atag_offset	= 0x100,
 	.map_io		= da830_map_io,
 	.init_irq	= cp_intc_init,
-	.init_time	= davinci_timer_init,
+	.init_time	= da830_init_time,
 	.init_machine	= da830_evm_init,
 	.init_late	= davinci_init_late,
 	.dma_zone_size	= SZ_128M,
arch/arm/mach-davinci/board-da850-evm.c +1 -1
index 7333ade..f766823 100644
@@ -1476,7 +1476,7 @@ MACHINE_START(DAVINCI_DA850_EVM, "DaVinci DA850/OMAP-L138/AM18x EVM")
 	.atag_offset	= 0x100,
 	.map_io		= da850_map_io,
 	.init_irq	= cp_intc_init,
-	.init_time	= davinci_timer_init,
+	.init_time	= da850_init_time,
 	.init_machine	= da850_evm_init,
 	.init_late	= davinci_init_late,
 	.dma_zone_size	= SZ_128M,
arch/arm/mach-davinci/board-dm355-evm.c +1 -1
index da462e7..ef27f55 100644
@@ -411,7 +411,7 @@ MACHINE_START(DAVINCI_DM355_EVM, "DaVinci DM355 EVM")
 	.atag_offset  = 0x100,
 	.map_io		= dm355_map_io,
 	.init_irq     = davinci_irq_init,
-	.init_time	= davinci_timer_init,
+	.init_time	= dm355_init_time,
 	.init_machine = dm355_evm_init,
 	.init_late	= davinci_init_late,
 	.dma_zone_size	= SZ_128M,
arch/arm/mach-davinci/board-dm355-leopard.c +1 -1
index 21fd713..e705a6e 100644
@@ -266,7 +266,7 @@ MACHINE_START(DM355_LEOPARD, "DaVinci DM355 leopard")
 	.atag_offset  = 0x100,
 	.map_io		= dm355_map_io,
 	.init_irq     = davinci_irq_init,
-	.init_time	= davinci_timer_init,
+	.init_time	= dm355_init_time,
 	.init_machine = dm355_leopard_init,
 	.init_late	= davinci_init_late,
 	.dma_zone_size	= SZ_128M,
arch/arm/mach-davinci/board-dm365-evm.c +1 -1
index 4ec759b..4232c09 100644
@@ -769,7 +769,7 @@ MACHINE_START(DAVINCI_DM365_EVM, "DaVinci DM365 EVM")
 	.atag_offset	= 0x100,
 	.map_io		= dm365_map_io,
 	.init_irq	= davinci_irq_init,
-	.init_time	= davinci_timer_init,
+	.init_time	= dm365_init_time,
 	.init_machine	= dm365_evm_init,
 	.init_late	= davinci_init_late,
 	.dma_zone_size	= SZ_128M,
arch/arm/mach-davinci/board-dm644x-evm.c +1 -1
index 8f6e9ea..2f6c0c4 100644
@@ -811,7 +811,7 @@ MACHINE_START(DAVINCI_EVM, "DaVinci DM644x EVM")
 	.atag_offset  = 0x100,
 	.map_io		= dm644x_map_io,
 	.init_irq     = davinci_irq_init,
-	.init_time	= davinci_timer_init,
+	.init_time	= dm644x_init_time,
 	.init_machine = davinci_evm_init,
 	.init_late	= davinci_init_late,
 	.dma_zone_size	= SZ_128M,
arch/arm/mach-davinci/board-dm646x-evm.c +2 -2
index f0e2762..de28f75 100644
@@ -787,7 +787,7 @@ MACHINE_START(DAVINCI_DM6467_EVM, "DaVinci DM646x EVM")
 	.atag_offset  = 0x100,
 	.map_io		= dm646x_map_io,
 	.init_irq     = davinci_irq_init,
-	.init_time	= davinci_timer_init,
+	.init_time	= dm646x_init_time,
 	.init_machine = evm_init,
 	.init_late	= davinci_init_late,
 	.dma_zone_size	= SZ_128M,
@@ -798,7 +798,7 @@ MACHINE_START(DAVINCI_DM6467TEVM, "DaVinci DM6467T EVM")
 	.atag_offset  = 0x100,
 	.map_io		= dm646x_map_io,
 	.init_irq     = davinci_irq_init,
-	.init_time	= davinci_timer_init,
+	.init_time	= dm646x_init_time,
 	.init_machine = evm_init,
 	.init_late	= davinci_init_late,
 	.dma_zone_size	= SZ_128M,
arch/arm/mach-davinci/board-mityomapl138.c +1 -1
index 9ea2628..d178932 100644
@@ -565,7 +565,7 @@ MACHINE_START(MITYOMAPL138, "MityDSP-L138/MityARM-1808")
 	.atag_offset	= 0x100,
 	.map_io		= da850_map_io,
 	.init_irq	= cp_intc_init,
-	.init_time	= davinci_timer_init,
+	.init_time	= da850_init_time,
 	.init_machine	= mityomapl138_init,
 	.init_late	= davinci_init_late,
 	.dma_zone_size	= SZ_128M,
arch/arm/mach-davinci/board-neuros-osd2.c +1 -1
index 6f4e7dc..bd01108 100644
@@ -222,7 +222,7 @@ MACHINE_START(NEUROS_OSD2, "Neuros OSD2")
 	.atag_offset	= 0x100,
 	.map_io		= dm644x_map_io,
 	.init_irq	= davinci_irq_init,
-	.init_time	= davinci_timer_init,
+	.init_time	= dm644x_init_time,
 	.init_machine = davinci_ntosd2_init,
 	.init_late	= davinci_init_late,
 	.dma_zone_size	= SZ_128M,
arch/arm/mach-davinci/board-omapl138-hawk.c +1 -1
index 0fdb7b7..c1af201 100644
@@ -329,7 +329,7 @@ MACHINE_START(OMAPL138_HAWKBOARD, "AM18x/OMAP-L138 Hawkboard")
 	.atag_offset	= 0x100,
 	.map_io		= da850_map_io,
 	.init_irq	= cp_intc_init,
-	.init_time	= davinci_timer_init,
+	.init_time	= da850_init_time,
 	.init_machine	= omapl138_hawk_init,
 	.init_late	= davinci_init_late,
 	.dma_zone_size	= SZ_128M,
arch/arm/mach-davinci/board-sffsdr.c +1 -1
index 3c1059a..8e659e1 100644
@@ -145,7 +145,7 @@ MACHINE_START(SFFSDR, "Lyrtech SFFSDR")
 	.atag_offset  = 0x100,
 	.map_io		= dm644x_map_io,
 	.init_irq     = davinci_irq_init,
-	.init_time	= davinci_timer_init,
+	.init_time	= dm644x_init_time,
 	.init_machine = davinci_sffsdr_init,
 	.init_late	= davinci_init_late,
 	.dma_zone_size	= SZ_128M,
arch/arm/mach-davinci/clock.c +32 -43

94 lines not on this page · raw message

arch/arm/mach-davinci/clock.h +1 -8
index fa2b837..e4afaa9 100644
@@ -118,14 +118,7 @@ struct clk {
 #define PSC_FORCE		BIT(6) /* Force module state transtition */
 #define PSC_LRST		BIT(8) /* Use local reset on enable/disable */
 
-#define CLK(dev, con, ck) 	\
-	{			\
-		.dev_id = dev,	\
-		.con_id = con,	\
-		.clk = ck,	\
-	}			\
-
-int davinci_clk_init(struct clk_lookup *clocks);
+void davinci_clk_init(struct clk *clk, const char *con_id, const char *dev_id);
 int davinci_set_pllrate(struct pll_data *pll, unsigned int prediv,
 				unsigned int mult, unsigned int postdiv);
 int davinci_set_sysclk_rate(struct clk *clk, unsigned long rate);
arch/arm/mach-davinci/da830.c +60 -55

130 lines not on this page · raw message

arch/arm/mach-davinci/da850.c +71 -66

152 lines not on this page · raw message

arch/arm/mach-davinci/da8xx-dt.c +1 -1
index 92c7c34..1a09215 100644
@@ -96,7 +96,7 @@ static const char *const da850_boards_compat[] __initconst = {
 
 DT_MACHINE_START(DA850_DT, "Generic DA850/OMAP-L138/AM18x")
 	.map_io		= da850_map_io,
-	.init_time	= davinci_timer_init,
+	.init_time	= da850_init_time,
 	.init_machine	= da850_init_machine,
 	.dt_compat	= da850_boards_compat,
 	.init_late	= davinci_init_late,
arch/arm/mach-davinci/davinci.h +4 -0
index d550717..ce67a65 100644
@@ -83,6 +83,7 @@ int davinci_init_wdt(void);
 
 /* DM355 function declarations */
 void dm355_map_io(void);
+void dm355_init_time(void);
 void dm355_init_spi0(unsigned chipselect_mask,
 		const struct spi_board_info *info, unsigned len);
 void dm355_init_asp1(u32 evt_enable);
@@ -91,6 +92,7 @@ int dm355_gpio_register(void);
 
 /* DM365 function declarations */
 void dm365_map_io(void);
+void dm365_init_time(void);
 void dm365_init_asp(void);
 void dm365_init_vc(void);
 void dm365_init_ks(struct davinci_ks_platform_data *pdata);
@@ -102,12 +104,14 @@ int dm365_gpio_register(void);
 
 /* DM644x function declarations */
 void dm644x_map_io(void);
+void dm644x_init_time(void);
 void dm644x_init_asp(void);
 int dm644x_init_video(struct vpfe_config *, struct vpbe_config *);
 int dm644x_gpio_register(void);
 
 /* DM646x function declarations */
 void dm646x_map_io(void);
+void dm646x_init_time(void);
 void dm646x_init_mcasp0(struct snd_platform_data *pdata);
 void dm646x_init_mcasp1(struct snd_platform_data *pdata);
 int dm646x_init_edma(struct edma_rsv_info *rsv);
arch/arm/mach-davinci/devices-da8xx.c +1 -4
index 22440c0..cc497f4 100644
@@ -1059,9 +1059,6 @@ static struct clk sata_refclk = {
 	.set_rate	= davinci_simple_set_rate,
 };
 
-static struct clk_lookup sata_refclk_lookup =
-		CLK("ahci_da850", "refclk", &sata_refclk);
-
 int __init da850_register_sata_refclk(int rate)
 {
 	int ret;
@@ -1071,7 +1068,7 @@ int __init da850_register_sata_refclk(int rate)
 	if (ret)
 		return ret;
 
-	clkdev_add(&sata_refclk_lookup);
+	clk_register_clkdev(&sata_refclk, "refclk", "ahci_da850");
 
 	return 0;
 }
arch/arm/mach-davinci/dm355.c +51 -46

115 lines not on this page · raw message

arch/arm/mach-davinci/dm365.c +66 -61

145 lines not on this page · raw message

arch/arm/mach-davinci/dm644x.c +47 -42

107 lines not on this page · raw message

arch/arm/mach-davinci/dm646x.c +55 -44

123 lines not on this page · raw message

arch/arm/mach-davinci/include/mach/common.h +0 -1
index 037aa66..9b85d5d 100644
@@ -53,7 +53,6 @@ struct davinci_soc_info {
 	u32				jtag_id_reg;
 	struct davinci_id		*ids;
 	unsigned long			ids_num;
-	struct clk_lookup		*cpu_clks;
 	u32				*psc_bases;
 	unsigned long			psc_bases_num;
 	u32				pinmux_base;
arch/arm/mach-davinci/include/mach/da8xx.h +3 -0
index c760c1b..90b00d0 100644
@@ -87,7 +87,10 @@ extern unsigned int da850_max_speed;
 #define DA8XX_ARM_RAM_BASE	0xffff0000
 
 void da830_map_io(void);
+void da830_init_time(void);
+
 void da850_map_io(void);
+void da850_init_time(void);
 
 int da830_register_edma(struct edma_rsv_info *rsv);
 int da850_register_edma(struct edma_rsv_info *rsv[2]);
arch/arm/mach-davinci/time.c +0 -8
index 6ba156e..65b28e6 100644
@@ -20,7 +20,6 @@
 #include <linux/platform_device.h>
 #include <linux/sched_clock.h>
 
-#include <asm/mach-types.h>
 #include <asm/mach/irq.h>
 #include <asm/mach/time.h>
 
@@ -342,8 +341,6 @@ static struct clock_event_device clockevent_davinci = {
 	.set_state_oneshot	= davinci_set_oneshot,
 };
 
-#define DM6467T_EVM_REF_FREQ		33000000
-
 void __init davinci_timer_init(void)
 {
 	struct clk *timer_clk;
@@ -352,11 +349,6 @@ void __init davinci_timer_init(void)
 	unsigned int clocksource_id;
 	int i;
 
-	davinci_clk_init(soc_info->cpu_clks);
-
-	if (machine_is_davinci_dm6467tevm())
-		davinci_set_refclk_rate(DM6467T_EVM_REF_FREQ);
-
 	clockevent_id = soc_info->timer_info->clockevent_id;
 	clocksource_id = soc_info->timer_info->clocksource_id;
 
arch/arm/mach-davinci/usb-da8xx.c +3 -12
index 9a6af0b..2630efa9e 100644
@@ -132,9 +132,6 @@ static struct clk usb_refclkin = {
 	.set_rate	= davinci_simple_set_rate,
 };
 
-static struct clk_lookup usb_refclkin_lookup =
-	CLK(NULL, "usb_refclkin", &usb_refclkin);
-
 /**
  * da8xx_register_usb_refclkin - register USB_REFCLKIN clock
  *
@@ -153,7 +150,7 @@ int __init da8xx_register_usb_refclkin(int rate)
 	if (ret)
 		return ret;
 
-	clkdev_add(&usb_refclkin_lookup);
+	clk_register_clkdev(&usb_refclkin, "usb_refclkin", NULL);
 
 	return 0;
 }
@@ -261,9 +258,6 @@ static struct clk usb20_phy_clk = {
 	.set_parent	= usb20_phy_clk_set_parent,
 };
 
-static struct clk_lookup usb20_phy_clk_lookup =
-	CLK("da8xx-usb-phy", "usb20_phy", &usb20_phy_clk);
-
 /**
  * da8xx_register_usb20_phy_clk - register USB0PHYCLKMUX clock
  *
@@ -290,7 +284,7 @@ int __init da8xx_register_usb20_phy_clk(bool use_usb_refclkin)
 	usb20_phy_clk.parent = parent;
 	ret = clk_register(&usb20_phy_clk);
 	if (!ret)
-		clkdev_add(&usb20_phy_clk_lookup);
+		clk_register_clkdev(&usb20_phy_clk, "usb20_phy", "da8xx-usb-phy");
 
 	clk_put(parent);
 
@@ -323,9 +317,6 @@ static struct clk usb11_phy_clk = {
 	.set_parent	= usb11_phy_clk_set_parent,
 };
 
-static struct clk_lookup usb11_phy_clk_lookup =
-	CLK("da8xx-usb-phy", "usb11_phy", &usb11_phy_clk);
-
 /**
  * da8xx_register_usb11_phy_clk - register USB1PHYCLKMUX clock
  *
@@ -347,7 +338,7 @@ int __init da8xx_register_usb11_phy_clk(bool use_usb_refclkin)
 	usb11_phy_clk.parent = parent;
 	ret = clk_register(&usb11_phy_clk);
 	if (!ret)
-		clkdev_add(&usb11_phy_clk_lookup);
+		clk_register_clkdev(&usb11_phy_clk, "usb11_phy", "da8xx-usb-phy");
 
 	clk_put(parent);
 
Signature · 1 line
2.7.4
#10 lore raw

PATCH 4/6 ARM: davinci: make davinci_clk_reset() static

In reply to David Lechner

This makes davinci_clk_reset() static. It is not used anywhere else.

---
 arch/arm/mach-davinci/clock.c | 3 +--
 arch/arm/mach-davinci/clock.h | 1 -
 2 files changed, 1 insertion(+), 3 deletions(-)
arch/arm/mach-davinci/clock.c +1 -2
index 5f0a31d..c149b24 100644
@@ -59,7 +59,7 @@ void davinci_clk_disable(struct clk *clk)
 		davinci_clk_disable(clk->parent);
 }
 
-int davinci_clk_reset(struct clk *clk, bool reset)
+static int davinci_clk_reset(struct clk *clk, bool reset)
 {
 	unsigned long flags;
 
@@ -73,7 +73,6 @@ int davinci_clk_reset(struct clk *clk, bool reset)
 
 	return 0;
 }
-EXPORT_SYMBOL(davinci_clk_reset);
 
 int davinci_clk_reset_assert(struct clk *clk)
 {
arch/arm/mach-davinci/clock.h +0 -1
index e4afaa9..bf60cdf 100644
@@ -124,7 +124,6 @@ int davinci_set_pllrate(struct pll_data *pll, unsigned int prediv,
 int davinci_set_sysclk_rate(struct clk *clk, unsigned long rate);
 int davinci_set_refclk_rate(unsigned long rate);
 int davinci_simple_set_rate(struct clk *clk, unsigned long rate);
-int davinci_clk_reset(struct clk *clk, bool reset);
 void davinci_clk_enable(struct clk *clk);
 void davinci_clk_disable(struct clk *clk);
 
Signature · 1 line
2.7.4
#11 lore raw

PATCH 5/6 ARM: davinci: convert to common clock framework

In reply to David Lechner

This converts the clocks in mach-davinci to the common clock framework.

Most of the patch just involves renaming struct clk to struct davinci_clk. There is also a struct clk_hw added to provide the bridge between the existing clock implementation and the common clock framework.

In clock.c:
* The clk_get_parent and clk_set_parent callbacks are dropped because all clocks currently (effectively) have a single parent, in which case the common clock framework does not want you to implement these functions yourself.
* clk_unregister() is dropped because it is not used anywhere in mach-davinci.
* EXPORT_SYMBOL() is removed from functions not used outside of mach-davinci.

---
 arch/arm/Kconfig                           |   2 +-
 arch/arm/mach-davinci/clock.c              | 162 ++++++++++++-----------------
 arch/arm/mach-davinci/clock.h              |  40 ++++---
 arch/arm/mach-davinci/da830.c              | 100 +++++++++---------
 arch/arm/mach-davinci/da850.c              | 153 +++++++++++++--------------
 arch/arm/mach-davinci/devices-da8xx.c      |   6 +-
 arch/arm/mach-davinci/dm355.c              |  84 +++++++--------
 arch/arm/mach-davinci/dm365.c              | 112 ++++++++++----------
 arch/arm/mach-davinci/dm644x.c             |  72 ++++++-------
 arch/arm/mach-davinci/dm646x.c             |  78 +++++++-------
 arch/arm/mach-davinci/include/mach/clock.h |   3 -
 arch/arm/mach-davinci/usb-da8xx.c          |  48 +++++----
 12 files changed, 425 insertions(+), 435 deletions(-)
arch/arm/Kconfig +1 -1
index 7888c98..1bd667d 100644
@@ -611,7 +611,7 @@ config ARCH_S3C24XX
 config ARCH_DAVINCI
 	bool "TI DaVinci"
 	select ARCH_HAS_HOLES_MEMORYMODEL
-	select CLKDEV_LOOKUP
+	select COMMON_CLK
 	select CPU_ARM926T
 	select GENERIC_ALLOCATOR
 	select GENERIC_CLOCKEVENTS
arch/arm/mach-davinci/clock.c +68 -94

344 lines not on this page · raw message

arch/arm/mach-davinci/clock.h +26 -14
index bf60cdf..aea4f14 100644
@@ -68,6 +68,7 @@
 #ifndef __ASSEMBLER__
 
 #include <linux/list.h>
+#include <linux/clk-provider.h>
 #include <linux/clkdev.h>
 
 #define PLLSTAT_GOSTAT	BIT(0)
@@ -84,7 +85,8 @@ struct pll_data {
 #define PLL_HAS_PREDIV          0x01
 #define PLL_HAS_POSTDIV         0x02
 
-struct clk {
+struct davinci_clk {
+	struct clk_hw		hw;
 	struct list_head	node;
 	struct module		*owner;
 	const char		*name;
@@ -95,18 +97,18 @@ struct clk {
 	u8			gpsc;
 	u8			domain;
 	u32			flags;
-	struct clk              *parent;
+	struct davinci_clk	*parent;
 	struct list_head	children; 	/* list of children */
 	struct list_head	childnode;	/* parent's child list node */
 	struct pll_data         *pll_data;
 	u32                     div_reg;
-	unsigned long (*recalc) (struct clk *);
-	int (*set_rate) (struct clk *clk, unsigned long rate);
-	int (*round_rate) (struct clk *clk, unsigned long rate);
-	int (*reset) (struct clk *clk, bool reset);
-	void (*clk_enable) (struct clk *clk);
-	void (*clk_disable) (struct clk *clk);
-	int (*set_parent) (struct clk *clk, struct clk *parent);
+	unsigned long (*recalc)(struct davinci_clk *clk);
+	int (*set_rate)(struct davinci_clk *clk, unsigned long rate);
+	int (*round_rate)(struct davinci_clk *clk, unsigned long rate);
+	int (*reset)(struct davinci_clk *clk, bool reset);
+	void (*clk_enable)(struct davinci_clk *clk);
+	void (*clk_disable)(struct davinci_clk *clk);
+	int (*set_parent)(struct davinci_clk *clk, struct davinci_clk *parent);
 };
 
 /* Clock flags: SoC-specific flags start at BIT(16) */
@@ -118,18 +120,28 @@ struct clk {
 #define PSC_FORCE		BIT(6) /* Force module state transtition */
 #define PSC_LRST		BIT(8) /* Use local reset on enable/disable */
 
-void davinci_clk_init(struct clk *clk, const char *con_id, const char *dev_id);
+void davinci_clk_init(struct davinci_clk *clk, const char *con_id,
+		      const char *dev_id);
 int davinci_set_pllrate(struct pll_data *pll, unsigned int prediv,
 				unsigned int mult, unsigned int postdiv);
-int davinci_set_sysclk_rate(struct clk *clk, unsigned long rate);
+int davinci_set_sysclk_rate(struct davinci_clk *clk, unsigned long rate);
 int davinci_set_refclk_rate(unsigned long rate);
-int davinci_simple_set_rate(struct clk *clk, unsigned long rate);
-void davinci_clk_enable(struct clk *clk);
-void davinci_clk_disable(struct clk *clk);
+int davinci_simple_set_rate(struct davinci_clk *clk, unsigned long rate);
+void davinci_clk_enable(struct davinci_clk *clk);
+void davinci_clk_disable(struct davinci_clk *clk);
+int davinci_clk_register(struct davinci_clk *clk);
 
 extern struct platform_device davinci_wdt_device;
 extern void davinci_watchdog_reset(struct platform_device *);
 
+static inline struct davinci_clk *to_davinci_clk(struct clk_hw *hw)
+{
+	if (IS_ERR_OR_NULL(hw))
+		return (struct davinci_clk *)hw;
+
+	return container_of(hw, struct davinci_clk, hw);
+}
+
 #endif
 
 #endif
arch/arm/mach-davinci/da830.c +50 -50

386 lines not on this page · raw message

arch/arm/mach-davinci/da850.c +77 -76

547 lines not on this page · raw message

arch/arm/mach-davinci/devices-da8xx.c +3 -3
index cc497f4..8d6deee 100644
@@ -1054,7 +1054,7 @@ int __init da8xx_register_spi_bus(int instance, unsigned num_chipselect)
 }
 
 #ifdef CONFIG_ARCH_DAVINCI_DA850
-static struct clk sata_refclk = {
+static struct davinci_clk sata_refclk = {
 	.name		= "sata_refclk",
 	.set_rate	= davinci_simple_set_rate,
 };
@@ -1064,11 +1064,11 @@ int __init da850_register_sata_refclk(int rate)
 	int ret;
 
 	sata_refclk.rate = rate;
-	ret = clk_register(&sata_refclk);
+	ret = davinci_clk_register(&sata_refclk);
 	if (ret)
 		return ret;
 
-	clk_register_clkdev(&sata_refclk, "refclk", "ahci_da850");
+	clk_register_clkdev(sata_refclk.hw.clk, "refclk", "ahci_da850");
 
 	return 0;
 }
arch/arm/mach-davinci/dm355.c +42 -42

306 lines not on this page · raw message

arch/arm/mach-davinci/dm365.c +56 -56

416 lines not on this page · raw message

arch/arm/mach-davinci/dm644x.c +36 -36

266 lines not on this page · raw message

arch/arm/mach-davinci/dm646x.c +39 -39

297 lines not on this page · raw message

arch/arm/mach-davinci/include/mach/clock.h +0 -3
index 3e8af6a..42ed4f2 100644
@@ -15,9 +15,6 @@
 
 struct clk;
 
-extern int clk_register(struct clk *clk);
-extern void clk_unregister(struct clk *clk);
-
 int davinci_clk_reset_assert(struct clk *c);
 int davinci_clk_reset_deassert(struct clk *c);
 
arch/arm/mach-davinci/usb-da8xx.c +27 -21

134 lines not on this page · raw message

Signature · 1 line
2.7.4
#12 lore raw

PATCH 6/6 ARM: davinci: remove clock debugfs

In reply to David Lechner

This removed the debugfs entry for mach-davinci clocks. The clocks now use the common clock framework, which provides debugfs already, so this code is redundant.

---
 arch/arm/mach-davinci/clock.c | 79 -------------------------------------------
 1 file changed, 79 deletions(-)
arch/arm/mach-davinci/clock.c +0 -79
index 0e63d93..347902e 100644
@@ -626,82 +626,3 @@ void __init davinci_clk_init(struct davinci_clk *clk, const char *con_id,
 	if (clk->flags & ALWAYS_ENABLED)
 		clk_prepare_enable(clk->hw.clk);
 }
-
-#ifdef CONFIG_DEBUG_FS
-
-#include <linux/debugfs.h>
-#include <linux/seq_file.h>
-
-#define CLKNAME_MAX	10		/* longest clock name */
-#define NEST_DELTA	2
-#define NEST_MAX	4
-
-static void
-dump_clock(struct seq_file *s, unsigned nest, struct davinci_clk *parent)
-{
-	char		*state;
-	char		buf[CLKNAME_MAX + NEST_DELTA * NEST_MAX];
-	struct davinci_clk *clk;
-	unsigned	i;
-
-	if (parent->flags & CLK_PLL)
-		state = "pll";
-	else if (parent->flags & CLK_PSC)
-		state = "psc";
-	else
-		state = "";
-
-	/* <nest spaces> name <pad to end> */
-	memset(buf, ' ', sizeof(buf) - 1);
-	buf[sizeof(buf) - 1] = 0;
-	i = strlen(parent->name);
-	memcpy(buf + nest, parent->name,
-			min(i, (unsigned)(sizeof(buf) - 1 - nest)));
-
-	seq_printf(s, "%s users=%2d %-3s %9ld Hz\n",
-		   buf, parent->usecount, state, parent->rate);
-	/* REVISIT show device associations too */
-
-	/* cost is now small, but not linear... */
-	list_for_each_entry(clk, &parent->children, childnode) {
-		dump_clock(s, nest + NEST_DELTA, clk);
-	}
-}
-
-static int davinci_ck_show(struct seq_file *m, void *v)
-{
-	struct davinci_clk *clk;
-
-	/*
-	 * Show clock tree; We trust nonzero usecounts equate to PSC enables...
-	 */
-	mutex_lock(&clocks_mutex);
-	list_for_each_entry(clk, &clocks, node)
-		if (!clk->parent)
-			dump_clock(m, 0, clk);
-	mutex_unlock(&clocks_mutex);
-
-	return 0;
-}
-
-static int davinci_ck_open(struct inode *inode, struct file *file)
-{
-	return single_open(file, davinci_ck_show, NULL);
-}
-
-static const struct file_operations davinci_ck_operations = {
-	.open		= davinci_ck_open,
-	.read		= seq_read,
-	.llseek		= seq_lseek,
-	.release	= single_release,
-};
-
-static int __init davinci_clk_debugfs_init(void)
-{
-	debugfs_create_file("davinci_clocks", S_IFREG | S_IRUGO, NULL, NULL,
-						&davinci_ck_operations);
-	return 0;
-
-}
-device_initcall(davinci_clk_debugfs_init);
-#endif /* CONFIG_DEBUG_FS */
Signature · 1 line
2.7.4