Skip to contentSkip to conversation

davinci: dm365: move macros local to dm365.c to that file

PATCH New Manjunath Hadli 2 participants 2 messages May 20, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 2/4 davinci: dm365: move macros local to dm365.c to that file

move the register base addresses and offsets used only by dm365 platform file from platform header dm365.h to dm365.c as they are used only in the c file.

---
 arch/arm/mach-davinci/dm365.c              |   20 ++++++++++++++++++--
 arch/arm/mach-davinci/include/mach/dm365.h |   12 ------------
 2 files changed, 18 insertions(+), 14 deletions(-)
arch/arm/mach-davinci/dm365.c +18 -2
index 02d2cc3..7e2464e 100644
@@ -39,8 +39,6 @@
 #include "clock.h"
 #include "mux.h"
 
-#define DM365_REF_FREQ		24000000	/* 24 MHz on the DM365 EVM */
-
 static struct pll_data pll1_data = {
 	.num		= 1,
 	.phys_base	= DAVINCI_PLL1_BASE,
@@ -53,6 +51,8 @@ static struct pll_data pll2_data = {
 	.flags		= PLL_HAS_POSTDIV | PLL_HAS_PREDIV,
 };
 
+#define DM365_REF_FREQ		24000000	/* 24 MHz on the DM365 EVM */
+
 static struct clk ref_clk = {
 	.name		= "ref_clk",
 	.rate		= DM365_REF_FREQ,
@@ -681,6 +681,10 @@ void __init dm365_init_spi0(unsigned chipselect_mask,
 	platform_device_register(&dm365_spi0_device);
 }
 
+#define DM365_EMAC_CNTRL_OFFSET		0x0000
+#define DM365_EMAC_CNTRL_MOD_OFFSET	0x3000
+#define DM365_EMAC_CNTRL_RAM_OFFSET	0x1000
+#define DM365_EMAC_CNTRL_RAM_SIZE	0x2000
 static struct emac_platform_data dm365_emac_pdata = {
 	.ctrl_reg_offset	= DM365_EMAC_CNTRL_OFFSET,
 	.ctrl_mod_reg_offset	= DM365_EMAC_CNTRL_MOD_OFFSET,
@@ -689,6 +693,8 @@ static struct emac_platform_data dm365_emac_pdata = {
 	.version		= EMAC_VERSION_2,
 };
 
+#define DM365_EMAC_BASE		0x01D07000
+
 static struct resource dm365_emac_resources[] = {
 	{
 		.start	= DM365_EMAC_BASE,
@@ -727,6 +733,8 @@ static struct platform_device dm365_emac_device = {
 	.resource	= dm365_emac_resources,
 };
 
+#define DM365_EMAC_MDIO_BASE	(DM365_EMAC_BASE + 0x4000)
+
 static struct resource dm365_mdio_resources[] = {
 	{
 		.start	= DM365_EMAC_MDIO_BASE,
@@ -922,6 +930,10 @@ static struct platform_device dm365_asp_device = {
 	.resource	= dm365_asp_resources,
 };
 
+#define DAVINCI_DM365_VC_BASE	0x01D0C000
+#define DAVINCI_DMA_VC_TX	2
+#define DAVINCI_DMA_VC_RX	3
+
 static struct resource dm365_vc_resources[] = {
 	{
 		.start	= DAVINCI_DM365_VC_BASE,
@@ -947,6 +959,8 @@ static struct platform_device dm365_vc_device = {
 	.resource	= dm365_vc_resources,
 };
 
+#define DM365_RTC_BASE		0x01C69000
+
 static struct resource dm365_rtc_resources[] = {
 	{
 		.start = DM365_RTC_BASE,
@@ -981,6 +995,8 @@ static struct map_desc dm365_io_desc[] = {
 	},
 };
 
+#define DM365_KEYSCAN_BASE	0x01C69400
+
 static struct resource dm365_ks_resources[] = {
 	{
 		/* registers */
arch/arm/mach-davinci/include/mach/dm365.h +0 -12
index 2563bf4..c3c69a6 100644
@@ -20,18 +20,6 @@
 #include <mach/keyscan.h>
 #include <media/davinci/vpfe_capture.h>
 
-#define DM365_EMAC_BASE			(0x01D07000)
-#define DM365_EMAC_MDIO_BASE		(DM365_EMAC_BASE + 0x4000)
-#define DM365_EMAC_CNTRL_OFFSET		(0x0000)
-#define DM365_EMAC_CNTRL_MOD_OFFSET	(0x3000)
-#define DM365_EMAC_CNTRL_RAM_OFFSET	(0x1000)
-#define DM365_EMAC_CNTRL_RAM_SIZE	(0x2000)
-
-/* Base of key scan register bank */
-#define DM365_KEYSCAN_BASE		(0x01C69400)
-
-#define DM365_RTC_BASE			(0x01C69000)
-
 #define DAVINCI_DM365_VC_BASE		(0x01D0C000)
 #define DAVINCI_DMA_VC_TX		2
 #define DAVINCI_DMA_VC_RX		3
Signature · 1 line
1.6.2.4
#1 lore raw

PATCH 2/4 davinci: dm365: move macros local to dm365.c to that file

Hello.

Quoted 24 lines · Manjunath Hadli

move the register base addresses and offsets used only by dm365 platform file from platform header dm365.h to dm365.c as they are used only in the c file.

---
 arch/arm/mach-davinci/dm365.c              |   20 ++++++++++++++++++--
 arch/arm/mach-davinci/include/mach/dm365.h |   12 ------------
 2 files changed, 18 insertions(+), 14 deletions(-)
arch/arm/mach-davinci/dm365.c +0 -2
index 02d2cc3..7e2464e 100644
@@ -39,8 +39,6 @@
 #include "clock.h"
 #include "mux.h"
 
-#define DM365_REF_FREQ		24000000	/* 24 MHz on the DM365 EVM */
-
 static struct pll_data pll1_data = {
 	.num		= 1,
 	.phys_base	= DAVINCI_PLL1_BASE,

arch/arm/mach-davinci/dm365.c static struct pll_data pll2_data = { · line 54

Quoted 4 lines
arch/arm/mach-davinci/dm365.c +1 -0
@@ -53,6 +51,8 @@ static struct pll_data pll2_data = {
 	.flags		= PLL_HAS_POSTDIV | PLL_HAS_PREDIV,
 };
 
+#define DM365_REF_FREQ		24000000	/* 24 MHz on the DM365 EVM */

Why move it?

Quoted 24 lines
arch/arm/mach-davinci/dm365.c +6 -0
 static struct clk ref_clk = {
 	.name		= "ref_clk",
 	.rate		= DM365_REF_FREQ,
@@ -681,6 +681,10 @@ void __init dm365_init_spi0(unsigned chipselect_mask,
 	platform_device_register(&dm365_spi0_device);
 }
 
+#define DM365_EMAC_CNTRL_OFFSET		0x0000
+#define DM365_EMAC_CNTRL_MOD_OFFSET	0x3000
+#define DM365_EMAC_CNTRL_RAM_OFFSET	0x1000
+#define DM365_EMAC_CNTRL_RAM_SIZE	0x2000
 static struct emac_platform_data dm365_emac_pdata = {
 	.ctrl_reg_offset	= DM365_EMAC_CNTRL_OFFSET,
 	.ctrl_mod_reg_offset	= DM365_EMAC_CNTRL_MOD_OFFSET,
@@ -689,6 +693,8 @@ static struct emac_platform_data dm365_emac_pdata = {
 	.version		= EMAC_VERSION_2,
 };
 
+#define DM365_EMAC_BASE		0x01D07000
+
 static struct resource dm365_emac_resources[] = {
 	{
 		.start	= DM365_EMAC_BASE,

arch/arm/mach-davinci/dm365.c static struct platform_device dm365_emac_device = { · line 737

Quoted 5 lines
arch/arm/mach-davinci/dm365.c +2 -0
@@ -727,6 +733,8 @@ static struct platform_device dm365_emac_device = {
 	.resource	= dm365_emac_resources,
 };
 
+#define DM365_EMAC_MDIO_BASE	(DM365_EMAC_BASE + 0x4000)
+

Could we still have base address #define's grouped together at the start of
file?

arch/arm/mach-davinci/dm365.c static struct platform_device dm365_asp_device = { · line 935

Quoted 10 lines
arch/arm/mach-davinci/dm365.c +3 -0
 static struct resource dm365_mdio_resources[] = {
 	{
 		.start	= DM365_EMAC_MDIO_BASE,
@@ -922,6 +930,10 @@ static struct platform_device dm365_asp_device = {
 	.resource	= dm365_asp_resources,
 };
 
+#define DAVINCI_DM365_VC_BASE	0x01D0C000
+#define DAVINCI_DMA_VC_TX	2
+#define DAVINCI_DMA_VC_RX	3

You've duplicated these...

Quoted 5 lines
arch/arm/mach-davinci/include/mach/dm365.h +0 -0
index 2563bf4..c3c69a6 100644
@@ -20,18 +20,6 @@

[...]

Quoted 3 lines

#define DAVINCI_DM365_VC_BASE (0x01D0C000)
#define DAVINCI_DMA_VC_TX 2
#define DAVINCI_DMA_VC_RX 3

... as you've forgotten to remove these.

WBR, Sergei