Skip to contentSkip to conversation

physmap: Add support for 64 bit resources on PPC44x

PATCH In review Stefan Roese 4 participants 6 messages Jan 18, 2007 – Jan 19, 2007 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 physmap: Add support for 64 bit resources on PPC44x

[PATCH] [MTD] physmap: Add support for 64 bit resources on PPC44x

This patch adds support for 64 bit resources and can be used on PPC440 platforms to pass the complete 64 bit address from the platform file to the physmap driver. This is first used on the AMCC Taishan 440GX evaluation board.

---
commit 428858620a600f991662969be6d6b3e3720da1ac
tree cf3c861fbdddd841401a1e66f441623f0b3fb83c
parent d637c5644df789f15dfe06550fab1dddb87083ca
author Stefan Roese <[email protected]> Thu, 18 Jan 2007 14:40:53 +0100 committer Stefan Roese <[email protected]> Thu, 18 Jan 2007 14:40:53 +0100

 drivers/mtd/maps/physmap.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
drivers/mtd/maps/physmap.c +0 -0
index d171776..23072e3 100644
@@ -116,7 +116,14 @@ static int physmap_flash_probe(struct platform_device 

*dev)
info->map.bankwidth = physmap_data->width; info->map.set_vpp = physmap_data->set_vpp;

+#ifdef CONFIG_44x
+ if (sizeof(dev->resource->start) == 4)
+ info->map.virt = ioremap(info->map.phys, info->map.size);
+ else
+ info->map.virt = ioremap64(dev->resource->start, info->map.size);
+#else
info->map.virt = ioremap(info->map.phys, info->map.size);
+#endif
if (info->map.virt == NULL) {
dev_err(&dev->dev, "Failed to ioremap flash region\n"); err = EIO;

#1 lore raw

Hello.

Quoted 6 lines · Stefan Roese

[PATCH] [MTD] physmap: Add support for 64 bit resources on PPC44x

This patch adds support for 64 bit resources and can be used on PPC440 platforms to pass the complete 64 bit address from the platform file to the physmap driver. This is first used on the AMCC Taishan 440GX evaluation board.

Is this board support in arch/ppc/ or arch/powerpc/?

Quoted 17 lines

---
commit 428858620a600f991662969be6d6b3e3720da1ac
tree cf3c861fbdddd841401a1e66f441623f0b3fb83c
parent d637c5644df789f15dfe06550fab1dddb87083ca
author Stefan Roese <[email protected]> Thu, 18 Jan 2007 14:40:53 +0100 committer Stefan Roese <[email protected]> Thu, 18 Jan 2007 14:40:53 +0100

 drivers/mtd/maps/physmap.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
drivers/mtd/maps/physmap.c +0 -0
index d171776..23072e3 100644

drivers/mtd/maps/physmap.c static int physmap_flash_probe(struct platform_device · line 116

Quoted 1 line
drivers/mtd/maps/physmap.c +0 -0
@@ -116,7 +116,14 @@ static int physmap_flash_probe(struct platform_device 
 *dev)

And what do you assign to info->map.phys, a meaninglessly truncated 64-bit
address?
I think that 'phys' field's type should be changed to a more appropriate
one, like resource_size_t, instead...

drivers/mtd/maps/physmap.c static int physmap_flash_probe(struct platform_device · line 120

Quoted 4 lines
drivers/mtd/maps/physmap.c +1 -0
 	info->map.bankwidth = physmap_data->width;
 	info->map.set_vpp = physmap_data->set_vpp;
 
+#ifdef CONFIG_44x

Don't think we need this #ifdef at all.

drivers/mtd/maps/physmap.c static int physmap_flash_probe(struct platform_device · line 122

Quoted 2 lines
drivers/mtd/maps/physmap.c +2 -0
+	if (sizeof(dev->resource->start) == 4)
+		info->map.virt = ioremap(info->map.phys, info->map.size);

This line is meaningless duplication of the existing one (below #else).

drivers/mtd/maps/physmap.c static int physmap_flash_probe(struct platform_device · line 124

Quoted 2 lines
drivers/mtd/maps/physmap.c +2 -0
+	else
+		info->map.virt = ioremap64(dev->resource->start, info->map.size);

I see -- this is arch/ppc/... :-)
Wait, ioremap() takes phys_addr_t which should be 64-bit in your case. Is
there the need to call ioremap64()?

Quoted 6 lines
drivers/mtd/maps/physmap.c +2 -0
+#else
 	info->map.virt = ioremap(info->map.phys, info->map.size);
+#endif
 	if (info->map.virt == NULL) {
 		dev_err(&dev->dev, "Failed to ioremap flash region\n");

err = EIO;

WBR, Sergei

#2 lore raw

Hi Sergei,

Quoted 6 lines · Sergei Shtylyov
Quoted 4 lines

This patch adds support for 64 bit resources and can be used on PPC440 platforms to pass the complete 64 bit address from the platform file to the physmap driver. This is first used on the AMCC Taishan 440GX evaluation board.

Is this board support in arch/ppc/ or arch/powerpc/?

Not yet in the kernel.org repository. It's right now in the denx repository but I plan to sent the board support patches to the lists, even if I know, that it most likely won't get included right now, because of the ppc->powerpc merge.

And yes, it's still an "arch->ppc" port.

Quoted 20 lines
Quoted 17 lines

---
commit 428858620a600f991662969be6d6b3e3720da1ac
tree cf3c861fbdddd841401a1e66f441623f0b3fb83c
parent d637c5644df789f15dfe06550fab1dddb87083ca
author Stefan Roese <[email protected]> Thu, 18 Jan 2007 14:40:53 +0100 committer Stefan Roese <[email protected]> Thu, 18 Jan 2007 14:40:53 +0100

 drivers/mtd/maps/physmap.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
drivers/mtd/maps/physmap.c +0 -0
index d171776..23072e3 100644

drivers/mtd/maps/physmap.c static int physmap_flash_probe(struct · line 116

Quoted 1 line
drivers/mtd/maps/physmap.c +0 -0
@@ -116,7 +116,14 @@ static int physmap_flash_probe(struct
 platform_device *dev)
    And what do you assign to info->map.phys, a meaninglessly truncated
Quoted 3 lines

64-bit address?
I think that 'phys' field's type should be changed to a more
appropriate one, like resource_size_t, instead...

Yes, this makes sense.

Quoted 12 lines

drivers/mtd/maps/physmap.c static int physmap_flash_probe(struct · line 120

Quoted 4 lines
drivers/mtd/maps/physmap.c +1 -0
 	info->map.bankwidth = physmap_data->width;
 	info->map.set_vpp = physmap_data->set_vpp;
 
+#ifdef CONFIG_44x

Don't think we need this #ifdef at all.

drivers/mtd/maps/physmap.c static int physmap_flash_probe(struct · line 122

Quoted 2 lines
drivers/mtd/maps/physmap.c +2 -0
+	if (sizeof(dev->resource->start) == 4)
+		info->map.virt = ioremap(info->map.phys, info->map.size);

This line is meaningless duplication of the existing one (below #else).

Quoted 6 lines

drivers/mtd/maps/physmap.c static int physmap_flash_probe(struct · line 124

Quoted 2 lines
drivers/mtd/maps/physmap.c +2 -0
+	else
+		info->map.virt = ioremap64(dev->resource->start, info->map.size);

I see -- this is arch/ppc/... :-)
Wait, ioremap() takes phys_addr_t which should be 64-bit in your case.
Is there the need to call ioremap64()?

Yes, but ioremap() first call fixup_bigphys_addr() and this unfortunately corrupts my addresses.

I know this patch is far from perfect, so any suggestions are very welcome.

Thanks.

Best regards,
Stefan

#3 lore raw
In reply to Stefan Roese

drivers/mtd/maps/physmap.c static int physmap_flash_probe(struct platform_device · line 121

Quoted 9 lines · Stefan Roese
drivers/mtd/maps/physmap.c +2 -0
@@ -116,7 +116,14 @@ static int physmap_flash_probe(struct platform_device 
 *dev)
 	info->map.bankwidth = physmap_data->width;
 	info->map.set_vpp = physmap_data->set_vpp;
 
+#ifdef CONFIG_44x
+	if (sizeof(dev->resource->start) == 4)

CONFIG_RESOURCES_64BIT

drivers/mtd/maps/physmap.c static int physmap_flash_probe(struct platform_device · line 127

Quoted 6 lines
drivers/mtd/maps/physmap.c +5 -0
+		info->map.virt = ioremap(info->map.phys, info->map.size);
+	else
+		info->map.virt = ioremap64(dev->resource->start, info->map.size);
+#else
 	info->map.virt = ioremap(info->map.phys, info->map.size);
+#endif

Ugh. Do you have crap like this everywhere ioremap() is called?

Why can't you fix ioremap() to take >= 4G addresses instead?

#4 lore raw
Quoted 1 line · Lennert Buytenhek

Why can't you fix ioremap() to take >= 4G addresses instead?

That might be something worth looking at. We could fix it to not do the big address fixup if CONFIG_RESOURCES_64BIT is enabled.

4xx is in a bit of disrepair and needs some attention. It also needs to get merged to arch/powerpc, which is a bit larger change. I'm hoping to have some time soon to focus on things like this.

josh

#5 lore raw

Hi Josh,

Quoted 5 lines · Josh Boyer
Quoted 1 line · Lennert Buytenhek

Why can't you fix ioremap() to take >= 4G addresses instead?

That might be something worth looking at. We could fix it to not do the big address fixup if CONFIG_RESOURCES_64BIT is enabled.

Yes, good idea. I'll send a patch to the ppc list.

The only change needed now is 64bit support in the 'phys' field's. I'll send another path for this.

So please drop this patch completely.

Best regards,
Stefan