mtd: fsmc_nand: pass the ale and cmd resource via resource
Do not use the platform_data to pass resource and be smart in the drivers. Just pass it via resource Switch to devm_request_and_ioremap at the sametime Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-By: Vipin Kumar <vipin.kumar@st.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
This commit is contained in:
parent
fc05d5a30d
commit
6d7b42a447
9 changed files with 49 additions and 66 deletions
|
@ -3,9 +3,7 @@
|
||||||
Required properties:
|
Required properties:
|
||||||
- compatible : "st,spear600-fsmc-nand"
|
- compatible : "st,spear600-fsmc-nand"
|
||||||
- reg : Address range of the mtd chip
|
- reg : Address range of the mtd chip
|
||||||
- reg-names: Should contain the reg names "fsmc_regs" and "nand_data"
|
- reg-names: Should contain the reg names "fsmc_regs", "nand_data", "nand_addr" and "nand_cmd"
|
||||||
- st,ale-off : Chip specific offset to ALE
|
|
||||||
- st,cle-off : Chip specific offset to CLE
|
|
||||||
|
|
||||||
Optional properties:
|
Optional properties:
|
||||||
- bank-width : Width (in bytes) of the device. If not present, the width
|
- bank-width : Width (in bytes) of the device. If not present, the width
|
||||||
|
@ -19,10 +17,10 @@ Example:
|
||||||
#address-cells = <1>;
|
#address-cells = <1>;
|
||||||
#size-cells = <1>;
|
#size-cells = <1>;
|
||||||
reg = <0xd1800000 0x1000 /* FSMC Register */
|
reg = <0xd1800000 0x1000 /* FSMC Register */
|
||||||
0xd2000000 0x4000>; /* NAND Base */
|
0xd2000000 0x0010 /* NAND Base DATA */
|
||||||
reg-names = "fsmc_regs", "nand_data";
|
0xd2020000 0x0010 /* NAND Base ADDR */
|
||||||
st,ale-off = <0x20000>;
|
0xd2010000 0x0010>; /* NAND Base CMD */
|
||||||
st,cle-off = <0x10000>;
|
reg-names = "fsmc_regs", "nand_data", "nand_addr", "nand_cmd";
|
||||||
|
|
||||||
bank-width = <1>;
|
bank-width = <1>;
|
||||||
nand-skip-bbtscan;
|
nand-skip-bbtscan;
|
||||||
|
|
|
@ -104,15 +104,15 @@
|
||||||
compatible = "st,spear600-fsmc-nand";
|
compatible = "st,spear600-fsmc-nand";
|
||||||
#address-cells = <1>;
|
#address-cells = <1>;
|
||||||
#size-cells = <1>;
|
#size-cells = <1>;
|
||||||
reg = <0xb0000000 0x1000 /* FSMC Register */
|
reg = <0xb0000000 0x1000 /* FSMC Register*/
|
||||||
0xb0800000 0x0010>; /* NAND Base */
|
0xb0800000 0x0010 /* NAND Base DATA */
|
||||||
reg-names = "fsmc_regs", "nand_data";
|
0xb0820000 0x0010 /* NAND Base ADDR */
|
||||||
|
0xb0810000 0x0010>; /* NAND Base CMD */
|
||||||
|
reg-names = "fsmc_regs", "nand_data", "nand_addr", "nand_cmd";
|
||||||
interrupts = <0 20 0x4
|
interrupts = <0 20 0x4
|
||||||
0 21 0x4
|
0 21 0x4
|
||||||
0 22 0x4
|
0 22 0x4
|
||||||
0 23 0x4>;
|
0 23 0x4>;
|
||||||
st,ale-off = <0x20000>;
|
|
||||||
st,cle-off = <0x10000>;
|
|
||||||
status = "disabled";
|
status = "disabled";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -38,10 +38,10 @@
|
||||||
#address-cells = <1>;
|
#address-cells = <1>;
|
||||||
#size-cells = <1>;
|
#size-cells = <1>;
|
||||||
reg = <0x94000000 0x1000 /* FSMC Register */
|
reg = <0x94000000 0x1000 /* FSMC Register */
|
||||||
0x80000000 0x0010>; /* NAND Base */
|
0x80000000 0x0010 /* NAND Base DATA */
|
||||||
reg-names = "fsmc_regs", "nand_data";
|
0x80020000 0x0010 /* NAND Base ADDR */
|
||||||
st,ale-off = <0x20000>;
|
0x80010000 0x0010>; /* NAND Base CMD */
|
||||||
st,cle-off = <0x10000>;
|
reg-names = "fsmc_regs", "nand_data", "nand_addr", "nand_cmd";
|
||||||
status = "disabled";
|
status = "disabled";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -32,10 +32,10 @@
|
||||||
#address-cells = <1>;
|
#address-cells = <1>;
|
||||||
#size-cells = <1>;
|
#size-cells = <1>;
|
||||||
reg = <0x44000000 0x1000 /* FSMC Register */
|
reg = <0x44000000 0x1000 /* FSMC Register */
|
||||||
0x40000000 0x0010>; /* NAND Base */
|
0x40000000 0x0010 /* NAND Base DATA */
|
||||||
reg-names = "fsmc_regs", "nand_data";
|
0x40020000 0x0010 /* NAND Base ADDR */
|
||||||
st,ale-off = <0x10000>;
|
0x40010000 0x0010>; /* NAND Base CMD */
|
||||||
st,cle-off = <0x20000>;
|
reg-names = "fsmc_regs", "nand_data", "nand_addr", "nand_cmd";
|
||||||
status = "disabled";
|
status = "disabled";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -38,10 +38,10 @@
|
||||||
#address-cells = <1>;
|
#address-cells = <1>;
|
||||||
#size-cells = <1>;
|
#size-cells = <1>;
|
||||||
reg = <0x4c000000 0x1000 /* FSMC Register */
|
reg = <0x4c000000 0x1000 /* FSMC Register */
|
||||||
0x50000000 0x0010>; /* NAND Base */
|
0x50000000 0x0010 /* NAND Base DATA */
|
||||||
reg-names = "fsmc_regs", "nand_data";
|
0x50020000 0x0010 /* NAND Base ADDR */
|
||||||
st,ale-off = <0x20000>;
|
0x50010000 0x0010>; /* NAND Base CMD */
|
||||||
st,cle-off = <0x10000>;
|
reg-names = "fsmc_regs", "nand_data", "nand_addr", "nand_cmd";
|
||||||
status = "disabled";
|
status = "disabled";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -67,10 +67,10 @@
|
||||||
#address-cells = <1>;
|
#address-cells = <1>;
|
||||||
#size-cells = <1>;
|
#size-cells = <1>;
|
||||||
reg = <0xd1800000 0x1000 /* FSMC Register */
|
reg = <0xd1800000 0x1000 /* FSMC Register */
|
||||||
0xd2000000 0x4000>; /* NAND Base */
|
0xd2000000 0x0010 /* NAND Base DATA */
|
||||||
reg-names = "fsmc_regs", "nand_data";
|
0xd2020000 0x0010 /* NAND Base ADDR */
|
||||||
st,ale-off = <0x20000>;
|
0xd2010000 0x0010>; /* NAND Base CMD */
|
||||||
st,cle-off = <0x10000>;
|
reg-names = "fsmc_regs", "nand_data", "nand_addr", "nand_cmd";
|
||||||
status = "disabled";
|
status = "disabled";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -251,6 +251,18 @@ static struct resource rtc_resources[] = {
|
||||||
* but these are not yet used by the driver.
|
* but these are not yet used by the driver.
|
||||||
*/
|
*/
|
||||||
static struct resource fsmc_resources[] = {
|
static struct resource fsmc_resources[] = {
|
||||||
|
{
|
||||||
|
.name = "nand_addr",
|
||||||
|
.start = U300_NAND_CS0_PHYS_BASE + PLAT_NAND_ALE,
|
||||||
|
.end = U300_NAND_CS0_PHYS_BASE + PLAT_NAND_ALE + SZ_16K - 1,
|
||||||
|
.flags = IORESOURCE_MEM,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "nand_cmd",
|
||||||
|
.start = U300_NAND_CS0_PHYS_BASE + PLAT_NAND_CLE,
|
||||||
|
.end = U300_NAND_CS0_PHYS_BASE + PLAT_NAND_CLE + SZ_16K - 1,
|
||||||
|
.flags = IORESOURCE_MEM,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
.name = "nand_data",
|
.name = "nand_data",
|
||||||
.start = U300_NAND_CS0_PHYS_BASE,
|
.start = U300_NAND_CS0_PHYS_BASE,
|
||||||
|
@ -1496,8 +1508,6 @@ static struct fsmc_nand_platform_data nand_platform_data = {
|
||||||
.nr_partitions = ARRAY_SIZE(u300_partitions),
|
.nr_partitions = ARRAY_SIZE(u300_partitions),
|
||||||
.options = NAND_SKIP_BBTSCAN,
|
.options = NAND_SKIP_BBTSCAN,
|
||||||
.width = FSMC_NAND_BW8,
|
.width = FSMC_NAND_BW8,
|
||||||
.ale_off = PLAT_NAND_ALE,
|
|
||||||
.cle_off = PLAT_NAND_CLE,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct platform_device nand_device = {
|
static struct platform_device nand_device = {
|
||||||
|
|
|
@ -876,8 +876,6 @@ static int __devinit fsmc_nand_probe_config_dt(struct platform_device *pdev,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
of_property_read_u32(np, "st,ale-off", &pdata->ale_off);
|
|
||||||
of_property_read_u32(np, "st,cle-off", &pdata->cle_off);
|
|
||||||
if (of_get_property(np, "nand-skip-bbtscan", NULL))
|
if (of_get_property(np, "nand-skip-bbtscan", NULL))
|
||||||
pdata->options = NAND_SKIP_BBTSCAN;
|
pdata->options = NAND_SKIP_BBTSCAN;
|
||||||
|
|
||||||
|
@ -935,41 +933,28 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
|
||||||
if (!res)
|
if (!res)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (!devm_request_mem_region(&pdev->dev, res->start, resource_size(res),
|
host->data_va = devm_request_and_ioremap(&pdev->dev, res);
|
||||||
pdev->name)) {
|
|
||||||
dev_err(&pdev->dev, "Failed to get memory data resourse\n");
|
|
||||||
return -ENOENT;
|
|
||||||
}
|
|
||||||
|
|
||||||
host->data_pa = (dma_addr_t)res->start;
|
|
||||||
host->data_va = devm_ioremap(&pdev->dev, res->start,
|
|
||||||
resource_size(res));
|
|
||||||
if (!host->data_va) {
|
if (!host->data_va) {
|
||||||
dev_err(&pdev->dev, "data ioremap failed\n");
|
dev_err(&pdev->dev, "data ioremap failed\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
host->data_pa = (dma_addr_t)res->start;
|
||||||
|
|
||||||
if (!devm_request_mem_region(&pdev->dev, res->start + pdata->ale_off,
|
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "nand_addr");
|
||||||
resource_size(res), pdev->name)) {
|
if (!res)
|
||||||
dev_err(&pdev->dev, "Failed to get memory ale resourse\n");
|
return -EINVAL;
|
||||||
return -ENOENT;
|
|
||||||
}
|
|
||||||
|
|
||||||
host->addr_va = devm_ioremap(&pdev->dev, res->start + pdata->ale_off,
|
host->addr_va = devm_request_and_ioremap(&pdev->dev, res);
|
||||||
resource_size(res));
|
|
||||||
if (!host->addr_va) {
|
if (!host->addr_va) {
|
||||||
dev_err(&pdev->dev, "ale ioremap failed\n");
|
dev_err(&pdev->dev, "ale ioremap failed\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!devm_request_mem_region(&pdev->dev, res->start + pdata->cle_off,
|
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "nand_cmd");
|
||||||
resource_size(res), pdev->name)) {
|
if (!res)
|
||||||
dev_err(&pdev->dev, "Failed to get memory cle resourse\n");
|
return -EINVAL;
|
||||||
return -ENOENT;
|
|
||||||
}
|
|
||||||
|
|
||||||
host->cmd_va = devm_ioremap(&pdev->dev, res->start + pdata->cle_off,
|
host->cmd_va = devm_request_and_ioremap(&pdev->dev, res);
|
||||||
resource_size(res));
|
|
||||||
if (!host->cmd_va) {
|
if (!host->cmd_va) {
|
||||||
dev_err(&pdev->dev, "ale ioremap failed\n");
|
dev_err(&pdev->dev, "ale ioremap failed\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
@ -979,14 +964,7 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
|
||||||
if (!res)
|
if (!res)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (!devm_request_mem_region(&pdev->dev, res->start, resource_size(res),
|
host->regs_va = devm_request_and_ioremap(&pdev->dev, res);
|
||||||
pdev->name)) {
|
|
||||||
dev_err(&pdev->dev, "Failed to get memory regs resourse\n");
|
|
||||||
return -ENOENT;
|
|
||||||
}
|
|
||||||
|
|
||||||
host->regs_va = devm_ioremap(&pdev->dev, res->start,
|
|
||||||
resource_size(res));
|
|
||||||
if (!host->regs_va) {
|
if (!host->regs_va) {
|
||||||
dev_err(&pdev->dev, "regs ioremap failed\n");
|
dev_err(&pdev->dev, "regs ioremap failed\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
|
@ -155,9 +155,6 @@ struct fsmc_nand_platform_data {
|
||||||
unsigned int width;
|
unsigned int width;
|
||||||
unsigned int bank;
|
unsigned int bank;
|
||||||
|
|
||||||
/* CLE, ALE offsets */
|
|
||||||
unsigned int cle_off;
|
|
||||||
unsigned int ale_off;
|
|
||||||
enum access_mode mode;
|
enum access_mode mode;
|
||||||
|
|
||||||
void (*select_bank)(uint32_t bank, uint32_t busw);
|
void (*select_bank)(uint32_t bank, uint32_t busw);
|
||||||
|
|
Loading…
Add table
Reference in a new issue