Commit 7a9978a1 authored by Sergei Shtylyov's avatar Sergei Shtylyov Committed by Kevin Hilman

DaVinci: move IDE platform device to its proper place

The IDE platform device is registered in three different places (2 board files
for DM644x and in dm646x.c for DM646x) while both the IDE base address and the
IDE IRQ are the same for both SoCs -- therefore,  the proper place for the IDE
platform seems to be in devices.c. Merge the IDE platform data and registration
code and create davinci_init_ide() in place of dm646x_init_ide()...
Signed-off-by: default avatarSergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: default avatarKevin Hilman <khilman@deeprootsystems.com>
parent 280faffb
...@@ -41,8 +41,6 @@ ...@@ -41,8 +41,6 @@
#define DM644X_EVM_PHY_MASK (0x2) #define DM644X_EVM_PHY_MASK (0x2)
#define DM644X_EVM_MDIO_FREQUENCY (2200000) /* PHY bus frequency */ #define DM644X_EVM_MDIO_FREQUENCY (2200000) /* PHY bus frequency */
#define DAVINCI_CFC_ATA_BASE 0x01C66000
#define LXT971_PHY_ID (0x001378e2) #define LXT971_PHY_ID (0x001378e2)
#define LXT971_PHY_MASK (0xfffffff0) #define LXT971_PHY_MASK (0xfffffff0)
...@@ -252,32 +250,6 @@ static struct platform_device rtc_dev = { ...@@ -252,32 +250,6 @@ static struct platform_device rtc_dev = {
.id = -1, .id = -1,
}; };
static struct resource ide_resources[] = {
{
.start = DAVINCI_CFC_ATA_BASE,
.end = DAVINCI_CFC_ATA_BASE + 0x7ff,
.flags = IORESOURCE_MEM,
},
{
.start = IRQ_IDE,
.end = IRQ_IDE,
.flags = IORESOURCE_IRQ,
},
};
static u64 ide_dma_mask = DMA_BIT_MASK(32);
static struct platform_device ide_dev = {
.name = "palm_bk3710",
.id = -1,
.resource = ide_resources,
.num_resources = ARRAY_SIZE(ide_resources),
.dev = {
.dma_mask = &ide_dma_mask,
.coherent_dma_mask = DMA_BIT_MASK(32),
},
};
static struct snd_platform_data dm644x_evm_snd_data; static struct snd_platform_data dm644x_evm_snd_data;
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/
...@@ -698,10 +670,7 @@ static __init void davinci_evm_init(void) ...@@ -698,10 +670,7 @@ static __init void davinci_evm_init(void)
pr_warning("WARNING: both IDE and Flash are " pr_warning("WARNING: both IDE and Flash are "
"enabled, but they share AEMIF pins.\n" "enabled, but they share AEMIF pins.\n"
"\tDisable IDE for NAND/NOR support.\n"); "\tDisable IDE for NAND/NOR support.\n");
davinci_cfg_reg(DM644X_HPIEN_DISABLE); davinci_init_ide();
davinci_cfg_reg(DM644X_ATAEN);
davinci_cfg_reg(DM644X_HDIREN);
platform_device_register(&ide_dev);
} else if (HAS_NAND || HAS_NOR) { } else if (HAS_NAND || HAS_NOR) {
davinci_cfg_reg(DM644X_HPIEN_DISABLE); davinci_cfg_reg(DM644X_HPIEN_DISABLE);
davinci_cfg_reg(DM644X_ATAEN_DISABLE); davinci_cfg_reg(DM644X_ATAEN_DISABLE);
......
...@@ -733,7 +733,7 @@ static __init void evm_init(void) ...@@ -733,7 +733,7 @@ static __init void evm_init(void)
platform_device_register(&davinci_nand_device); platform_device_register(&davinci_nand_device);
if (HAS_ATA) if (HAS_ATA)
dm646x_init_ide(); davinci_init_ide();
soc_info->emac_pdata->phy_mask = DM646X_EVM_PHY_MASK; soc_info->emac_pdata->phy_mask = DM646X_EVM_PHY_MASK;
soc_info->emac_pdata->mdio_max_freq = DM646X_EVM_MDIO_FREQUENCY; soc_info->emac_pdata->mdio_max_freq = DM646X_EVM_MDIO_FREQUENCY;
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <mach/dm644x.h> #include <mach/dm644x.h>
#include <mach/common.h>
#include <mach/i2c.h> #include <mach/i2c.h>
#include <mach/serial.h> #include <mach/serial.h>
#include <mach/mux.h> #include <mach/mux.h>
...@@ -41,8 +42,6 @@ ...@@ -41,8 +42,6 @@
#define NEUROS_OSD2_PHY_MASK 0x2 #define NEUROS_OSD2_PHY_MASK 0x2
#define NEUROS_OSD2_MDIO_FREQUENCY 2200000 /* PHY bus frequency */ #define NEUROS_OSD2_MDIO_FREQUENCY 2200000 /* PHY bus frequency */
#define DAVINCI_CFC_ATA_BASE 0x01C66000
#define LXT971_PHY_ID 0x001378e2 #define LXT971_PHY_ID 0x001378e2
#define LXT971_PHY_MASK 0xfffffff0 #define LXT971_PHY_MASK 0xfffffff0
...@@ -127,32 +126,6 @@ static struct platform_device davinci_fb_device = { ...@@ -127,32 +126,6 @@ static struct platform_device davinci_fb_device = {
.num_resources = 0, .num_resources = 0,
}; };
static struct resource ide_resources[] = {
{
.start = DAVINCI_CFC_ATA_BASE,
.end = DAVINCI_CFC_ATA_BASE + 0x7ff,
.flags = IORESOURCE_MEM,
},
{
.start = IRQ_IDE,
.end = IRQ_IDE,
.flags = IORESOURCE_IRQ,
},
};
static u64 ide_dma_mask = DMA_BIT_MASK(32);
static struct platform_device ide_dev = {
.name = "palm_bk3710",
.id = -1,
.resource = ide_resources,
.num_resources = ARRAY_SIZE(ide_resources),
.dev = {
.dma_mask = &ide_dma_mask,
.coherent_dma_mask = DMA_BIT_MASK(32),
},
};
static struct snd_platform_data dm644x_ntosd2_snd_data; static struct snd_platform_data dm644x_ntosd2_snd_data;
static struct gpio_led ntosd2_leds[] = { static struct gpio_led ntosd2_leds[] = {
...@@ -256,10 +229,7 @@ static __init void davinci_ntosd2_init(void) ...@@ -256,10 +229,7 @@ static __init void davinci_ntosd2_init(void)
pr_warning("WARNING: both IDE and Flash are " pr_warning("WARNING: both IDE and Flash are "
"enabled, but they share AEMIF pins.\n" "enabled, but they share AEMIF pins.\n"
"\tDisable IDE for NAND/NOR support.\n"); "\tDisable IDE for NAND/NOR support.\n");
davinci_cfg_reg(DM644X_HPIEN_DISABLE); davinci_init_ide();
davinci_cfg_reg(DM644X_ATAEN);
davinci_cfg_reg(DM644X_HDIREN);
platform_device_register(&ide_dev);
} else if (HAS_NAND) { } else if (HAS_NAND) {
davinci_cfg_reg(DM644X_HPIEN_DISABLE); davinci_cfg_reg(DM644X_HPIEN_DISABLE);
davinci_cfg_reg(DM644X_ATAEN_DISABLE); davinci_cfg_reg(DM644X_ATAEN_DISABLE);
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "clock.h" #include "clock.h"
#define DAVINCI_I2C_BASE 0x01C21000 #define DAVINCI_I2C_BASE 0x01C21000
#define DAVINCI_ATA_BASE 0x01C66000
#define DAVINCI_MMCSD0_BASE 0x01E10000 #define DAVINCI_MMCSD0_BASE 0x01E10000
#define DM355_MMCSD0_BASE 0x01E11000 #define DM355_MMCSD0_BASE 0x01E11000
#define DM355_MMCSD1_BASE 0x01E00000 #define DM355_MMCSD1_BASE 0x01E00000
...@@ -60,6 +61,49 @@ void __init davinci_init_i2c(struct davinci_i2c_platform_data *pdata) ...@@ -60,6 +61,49 @@ void __init davinci_init_i2c(struct davinci_i2c_platform_data *pdata)
(void) platform_device_register(&davinci_i2c_device); (void) platform_device_register(&davinci_i2c_device);
} }
static struct resource ide_resources[] = {
{
.start = DAVINCI_ATA_BASE,
.end = DAVINCI_ATA_BASE + 0x7ff,
.flags = IORESOURCE_MEM,
},
{
.start = IRQ_IDE,
.end = IRQ_IDE,
.flags = IORESOURCE_IRQ,
},
};
static u64 ide_dma_mask = DMA_BIT_MASK(32);
static struct platform_device ide_device = {
.name = "palm_bk3710",
.id = -1,
.resource = ide_resources,
.num_resources = ARRAY_SIZE(ide_resources),
.dev = {
.dma_mask = &ide_dma_mask,
.coherent_dma_mask = DMA_BIT_MASK(32),
},
};
void __init davinci_init_ide(void)
{
if (cpu_is_davinci_dm644x()) {
davinci_cfg_reg(DM644X_HPIEN_DISABLE);
davinci_cfg_reg(DM644X_ATAEN);
davinci_cfg_reg(DM644X_HDIREN);
} else if (cpu_is_davinci_dm646x()) {
/* IRQ_DM646X_IDE is the same as IRQ_IDE */
davinci_cfg_reg(DM646X_ATAEN);
} else {
WARN_ON(1);
return;
}
platform_device_register(&ide_device);
}
#if defined(CONFIG_MMC_DAVINCI) || defined(CONFIG_MMC_DAVINCI_MODULE) #if defined(CONFIG_MMC_DAVINCI) || defined(CONFIG_MMC_DAVINCI_MODULE)
static u64 mmcsd0_dma_mask = DMA_BIT_MASK(32); static u64 mmcsd0_dma_mask = DMA_BIT_MASK(32);
......
...@@ -596,32 +596,6 @@ static struct platform_device dm646x_edma_device = { ...@@ -596,32 +596,6 @@ static struct platform_device dm646x_edma_device = {
.resource = edma_resources, .resource = edma_resources,
}; };
static struct resource ide_resources[] = {
{
.start = DM646X_ATA_REG_BASE,
.end = DM646X_ATA_REG_BASE + 0x7ff,
.flags = IORESOURCE_MEM,
},
{
.start = IRQ_DM646X_IDE,
.end = IRQ_DM646X_IDE,
.flags = IORESOURCE_IRQ,
},
};
static u64 ide_dma_mask = DMA_BIT_MASK(32);
static struct platform_device ide_dev = {
.name = "palm_bk3710",
.id = -1,
.resource = ide_resources,
.num_resources = ARRAY_SIZE(ide_resources),
.dev = {
.dma_mask = &ide_dma_mask,
.coherent_dma_mask = DMA_BIT_MASK(32),
},
};
static struct resource dm646x_mcasp0_resources[] = { static struct resource dm646x_mcasp0_resources[] = {
{ {
.name = "mcasp0", .name = "mcasp0",
...@@ -867,12 +841,6 @@ static struct davinci_soc_info davinci_soc_info_dm646x = { ...@@ -867,12 +841,6 @@ static struct davinci_soc_info davinci_soc_info_dm646x = {
.sram_len = SZ_32K, .sram_len = SZ_32K,
}; };
void __init dm646x_init_ide(void)
{
davinci_cfg_reg(DM646X_ATAEN);
platform_device_register(&ide_dev);
}
void __init dm646x_init_mcasp0(struct snd_platform_data *pdata) void __init dm646x_init_mcasp0(struct snd_platform_data *pdata)
{ {
dm646x_mcasp0_device.dev.platform_data = pdata; dm646x_mcasp0_device.dev.platform_data = pdata;
......
...@@ -70,6 +70,7 @@ struct davinci_soc_info { ...@@ -70,6 +70,7 @@ struct davinci_soc_info {
extern struct davinci_soc_info davinci_soc_info; extern struct davinci_soc_info davinci_soc_info;
extern void davinci_common_init(struct davinci_soc_info *soc_info); extern void davinci_common_init(struct davinci_soc_info *soc_info);
extern void davinci_init_ide(void);
/* standard place to map on-chip SRAMs; they *may* support DMA */ /* standard place to map on-chip SRAMs; they *may* support DMA */
#define SRAM_VIRT 0xfffe0000 #define SRAM_VIRT 0xfffe0000
......
...@@ -25,13 +25,10 @@ ...@@ -25,13 +25,10 @@
#define DM646X_EMAC_MDIO_OFFSET (0x4000) #define DM646X_EMAC_MDIO_OFFSET (0x4000)
#define DM646X_EMAC_CNTRL_RAM_SIZE (0x2000) #define DM646X_EMAC_CNTRL_RAM_SIZE (0x2000)
#define DM646X_ATA_REG_BASE (0x01C66000)
#define DM646X_ASYNC_EMIF_CONTROL_BASE 0x20008000 #define DM646X_ASYNC_EMIF_CONTROL_BASE 0x20008000
#define DM646X_ASYNC_EMIF_CS2_SPACE_BASE 0x42000000 #define DM646X_ASYNC_EMIF_CS2_SPACE_BASE 0x42000000
void __init dm646x_init(void); void __init dm646x_init(void);
void __init dm646x_init_ide(void);
void __init dm646x_init_mcasp0(struct snd_platform_data *pdata); void __init dm646x_init_mcasp0(struct snd_platform_data *pdata);
void __init dm646x_init_mcasp1(struct snd_platform_data *pdata); void __init dm646x_init_mcasp1(struct snd_platform_data *pdata);
void __init dm646x_board_setup_refclk(struct clk *clk); void __init dm646x_board_setup_refclk(struct clk *clk);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment