Commit d51626ce authored by Bartosz Golaszewski's avatar Bartosz Golaszewski Committed by Sekhar Nori

ARM: davinci: da850-evm: use aemif platform driver in legacy mode

We now support board files in the aemif driver. Register a platform
device instead of using the handcrafted API in da850-evm.
Signed-off-by: default avatarBartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: default avatarSekhar Nori <nsekhar@ti.com>
parent 92eb4908
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <linux/platform_data/gpio-davinci.h> #include <linux/platform_data/gpio-davinci.h>
#include <linux/platform_data/mtd-davinci.h> #include <linux/platform_data/mtd-davinci.h>
#include <linux/platform_data/mtd-davinci-aemif.h> #include <linux/platform_data/mtd-davinci-aemif.h>
#include <linux/platform_data/ti-aemif.h>
#include <linux/platform_data/spi-davinci.h> #include <linux/platform_data/spi-davinci.h>
#include <linux/platform_data/uio_pruss.h> #include <linux/platform_data/uio_pruss.h>
#include <linux/regulator/machine.h> #include <linux/regulator/machine.h>
...@@ -185,16 +186,6 @@ static struct resource da850_evm_norflash_resource[] = { ...@@ -185,16 +186,6 @@ static struct resource da850_evm_norflash_resource[] = {
}, },
}; };
static struct platform_device da850_evm_norflash_device = {
.name = "physmap-flash",
.id = 0,
.dev = {
.platform_data = &da850_evm_norflash_data,
},
.num_resources = 1,
.resource = da850_evm_norflash_resource,
};
/* DA850/OMAP-L138 EVM includes a 512 MByte large-page NAND flash /* DA850/OMAP-L138 EVM includes a 512 MByte large-page NAND flash
* (128K blocks). It may be used instead of the (default) SPI flash * (128K blocks). It may be used instead of the (default) SPI flash
* to boot, using TI's tools to install the secondary boot loader * to boot, using TI's tools to install the secondary boot loader
...@@ -266,7 +257,22 @@ static struct resource da850_evm_nandflash_resource[] = { ...@@ -266,7 +257,22 @@ static struct resource da850_evm_nandflash_resource[] = {
}, },
}; };
static struct platform_device da850_evm_nandflash_device = { static struct resource da850_evm_aemif_resource[] = {
{
.start = DA8XX_AEMIF_CTL_BASE,
.end = DA8XX_AEMIF_CTL_BASE + SZ_32K,
.flags = IORESOURCE_MEM,
}
};
static struct aemif_abus_data da850_evm_aemif_abus_data[] = {
{
.cs = 3,
}
};
static struct platform_device da850_evm_aemif_devices[] = {
{
.name = "davinci_nand", .name = "davinci_nand",
.id = 1, .id = 1,
.dev = { .dev = {
...@@ -274,29 +280,35 @@ static struct platform_device da850_evm_nandflash_device = { ...@@ -274,29 +280,35 @@ static struct platform_device da850_evm_nandflash_device = {
}, },
.num_resources = ARRAY_SIZE(da850_evm_nandflash_resource), .num_resources = ARRAY_SIZE(da850_evm_nandflash_resource),
.resource = da850_evm_nandflash_resource, .resource = da850_evm_nandflash_resource,
},
{
.name = "physmap-flash",
.id = 0,
.dev = {
.platform_data = &da850_evm_norflash_data,
},
.num_resources = 1,
.resource = da850_evm_norflash_resource,
}
}; };
static struct platform_device *da850_evm_devices[] = { static struct aemif_platform_data da850_evm_aemif_pdata = {
&da850_evm_nandflash_device, .cs_offset = 2,
&da850_evm_norflash_device, .abus_data = da850_evm_aemif_abus_data,
.num_abus_data = ARRAY_SIZE(da850_evm_aemif_abus_data),
.sub_devices = da850_evm_aemif_devices,
.num_sub_devices = ARRAY_SIZE(da850_evm_aemif_devices),
}; };
#define DA8XX_AEMIF_CE2CFG_OFFSET 0x10 static struct platform_device da850_evm_aemif_device = {
#define DA8XX_AEMIF_ASIZE_16BIT 0x1 .name = "ti-aemif",
.id = -1,
static void __init da850_evm_init_nor(void) .dev = {
{ .platform_data = &da850_evm_aemif_pdata,
void __iomem *aemif_addr; },
.resource = da850_evm_aemif_resource,
aemif_addr = ioremap(DA8XX_AEMIF_CTL_BASE, SZ_32K); .num_resources = ARRAY_SIZE(da850_evm_aemif_resource),
};
/* Configure data bus width of CS2 to 16 bit */
writel(readl(aemif_addr + DA8XX_AEMIF_CE2CFG_OFFSET) |
DA8XX_AEMIF_ASIZE_16BIT,
aemif_addr + DA8XX_AEMIF_CE2CFG_OFFSET);
iounmap(aemif_addr);
}
static const short da850_evm_nand_pins[] = { static const short da850_evm_nand_pins[] = {
DA850_EMA_D_0, DA850_EMA_D_1, DA850_EMA_D_2, DA850_EMA_D_3, DA850_EMA_D_0, DA850_EMA_D_1, DA850_EMA_D_2, DA850_EMA_D_3,
...@@ -339,13 +351,10 @@ static inline void da850_evm_setup_nor_nand(void) ...@@ -339,13 +351,10 @@ static inline void da850_evm_setup_nor_nand(void)
pr_warn("%s: NOR mux setup failed: %d\n", pr_warn("%s: NOR mux setup failed: %d\n",
__func__, ret); __func__, ret);
da850_evm_init_nor(); ret = platform_device_register(&da850_evm_aemif_device);
if (ret)
platform_add_devices(da850_evm_devices, pr_warn("%s: registering aemif failed: %d\n",
ARRAY_SIZE(da850_evm_devices)); __func__, ret);
if (davinci_aemif_setup(&da850_evm_nandflash_device))
pr_warn("%s: Cannot configure AEMIF.\n", __func__);
} }
} }
......
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