Convert Atari Falcon IDE driver to platform device
Subsystems (2)
v2 cover Convert Atari Falcon IDE driver to platform device
[Resend because linux-m68k was dropped from the recipient list ...]
As suggested by Geert, at least one of the drivers available for the Falcon IDE interface should be converted to a platform device driver (to enable module autoloading by the Debian installer).
Add platform device for Falcon IDE (patch 1), and rewrite the present libata driver to make use of that device (patch 2).
Changes from v1:
Incorporated review comments by Geert; corrected silly mismatch between platform device name and platform driver name that caused loading driver to fail locating the related resource; check return code of platform device register call.
Tested on ARAnyM with only the pata_falcon driver builtin.
Cheers,
Michael
PATCH RESEND v2 1/2 m68k/atari: add platform device for Falcon IDE port
Autoloading of Falcon IDE driver modules requires converting these drivers to platform drivers.
Add platform device for Falcon IDE interface in Atari platform setup code in preparation for this.
--
Changes from RFC
- fix region size (spotted by Szymon Bieganski <[email protected]>)
- define IDE interface address in atari/config.c, create platform device always (suggested by Geert Uytterhoeven <[email protected]>)
Changes from v1
- add error checking for Falcon IDE platform device register
--- arch/m68k/atari/config.c | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-)
arch/m68k/atari/config.c +27 -0
@@ -896,8 +896,28 @@ static void isp1160_delay(struct device *dev, int delay) };#endif +/* +* Falcon IDE interface +*/ + +#define FALCON_IDE_BASE 0xfff00000 + +static const struct resource atari_falconide_rsrc[]__initconst = { + { + .flags =IORESOURCE_MEM , + .start =FALCON_IDE_BASE , + .end =FALCON_IDE_BASE +0x39 , + }, + { + .flags =IORESOURCE_IRQ , + .start =IRQ_MFP_FSCSI , + .end =IRQ_MFP_FSCSI , + }, +}; +int __init atari_platform_init (void ) { +struct platform_device *pdev;int rv =0 ;if (!MACH_IS_ATARI )
@@ -939,6 +959,13 @@ int __init atari_platform_init(void) atari_scsi_tt_rsrc, ARRAY_SIZE(atari_scsi_tt_rsrc));#endif +if (ATARIHW_PRESENT (IDE )) { + pdev =platform_device_register_simple ("atari-falcon-ide" ,-1 , + atari_falconide_rsrc,ARRAY_SIZE (atari_falconide_rsrc)); +if (IS_ERR (pdev)) + rv =PTR_ERR (pdev); + } +return rv; }
Signature · 1 line
1.7.0.4
Re: [PATCH RESEND v2 1/2] m68k/atari: add platform device for Falcon IDE port
Hi Michael,
Quoted 9 lines · Michael Schmitz
Autoloading of Falcon IDE driver modules requires converting these drivers to platform drivers.
Add platform device for Falcon IDE interface in Atari platform setup code in preparation for this.
Signed-off-by Michael Schmitz <[email protected]>--
This should be a triple dash.
Quoted 10 lines
Changes from RFC
- fix region size (spotted by Szymon Bieganski <[email protected]>)
- define IDE interface address inatari/config.c, create platform device always (suggested by Geert Uytterhoeven <[email protected]>)Changes from v1
- add error checking for Falcon IDE platform device register
Thanks for the update!
Quoted 5 lines
arch/m68k/atari/config.c +0
-0@@ -939,6 +959,13 @@ int __init atari_platform_init(void) atari_scsi_tt_rsrc, ARRAY_SIZE(atari_scsi_tt_rsrc));#endif
arch/m68k/atari/config.c int __init atari_platform_init(void) · line 970
Quoted 10 lines
arch/m68k/atari/config.c +7
-0+if (ATARIHW_PRESENT (IDE )) { + pdev =platform_device_register_simple ("atari-falcon-ide" ,-1 , + atari_falconide_rsrc,ARRAY_SIZE (atari_falconide_rsrc)); +if (IS_ERR (pdev)) + rv =PTR_ERR (pdev); + } +return rv; }
This breaks both falconide and pata_falcon, as it marks the resource busy:
ide: Falcon IDE controller
falconide: resources busy
and
pata_falcon: Atari Falcon PATA controller
pata_falcon: resources busy
For pata_falcon, that regression can easily be fixed by merging both patches. For falconide, I think the sensible thing to do is just remove the driver. But before that, the defconfigs should be updated to use pata_falcon instead of falconide.
For the actual code changes:
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH RESEND v2 1/2] m68k/atari: add platform device for Falcon IDE port
Hi Geert,
thanks for your review!
Quoted 46 lines · Geert Uytterhoeven
Hi Michael,
Quoted 9 lines · Michael Schmitz
Autoloading of Falcon IDE driver modules requires converting these drivers to platform drivers.
Add platform device for Falcon IDE interface in Atari platform setup code in preparation for this.
Signed-off-by Michael Schmitz <[email protected]>--
This should be a triple dash.
Quoted 9 lines
Changes from RFC
- fix region size (spotted by Szymon Bieganski <[email protected]>)
- define IDE interface address inatari/config.c, create platform device always (suggested by Geert Uytterhoeven <[email protected]>)Changes from v1
- add error checking for Falcon IDE platform device register
Thanks for the update!
Quoted 5 lines
arch/m68k/atari/config.c +0
-0@@ -939,6 +959,13 @@ int __init atari_platform_init(void) atari_scsi_tt_rsrc, ARRAY_SIZE(atari_scsi_tt_rsrc));#endif arch/m68k/atari/config.c int __init atari_platform_init(void) · line 970
Quoted 10 lines
arch/m68k/atari/config.c +7
-0+if (ATARIHW_PRESENT (IDE )) { + pdev =platform_device_register_simple ("atari-falcon-ide" ,-1 , + atari_falconide_rsrc,ARRAY_SIZE (atari_falconide_rsrc)); +if (IS_ERR (pdev)) + rv =PTR_ERR (pdev); + } +return rv; }This breaks both falconide and
pata_falcon, as it marks the resource busy:ide: Falcon IDE controller
falconide: resources busy
Quoted 6 lines
and
pata_falcon: Atari Falcon PATA controller
pata_falcon: resources busyFor
pata_falcon, that regression can easily be fixed by merging both patches.
I obviously need to test this again, but from what I remember from my last testing, falconide still worked OK after applying both patches. That would have been without loading pata_falcon at all.
I'll rewrite falconide to use the same platform device as pata_falcon.
Cheers,
Michael
Quoted 11 lines
For falconide, I think the sensible thing to do is just remove the driver. But before that, the defconfigs should be updated to use
pata_falconinstead of falconide.For the actual code changes:
Reviewed-by Geert Uytterhoeven <[email protected]>Gr{oetje,eeting}s,
Geert
PATCH 1/1 ide: falconide: convert to platform driver
With the introduction of a platform device for the Atari Falcon IDE interface, the old Falcon IDE driver no longer loads (resource already claimed by the platform device).
Convert falconide driver to use the same platform device that is used by pata_falcon also.
Tested (as built-in driver) on my Atari Falcon.
--- drivers/ide/falconide.c | 45 ++++++++++++++++++++++++++++++++------------- 1 files changed, 32 insertions(+), 13 deletions(-)
drivers/ide/falconide.c +32 -13
@@ -15,6 +15,7 @@#include <linux/blkdev.h> #include <linux/ide.h> #include <linux/init.h> +#include <linux/platform_device.h> #include <asm/setup.h> #include <asm/atarihw.h>
@@ -23,6 +24,7 @@#include <asm/ide.h> #define DRV_NAME "falconide" +#define DRV_VERSION "0.1.0"/* * Base of the IDE interface
@@ -114,18 +116,18 @@ static void falconide_output_data(ide_drive_t *drive, struct ide_cmd *cmd, .chipset = ide_generic, }; -static void __init falconide_setup_ports (struct ide_hw *hw) +static void __init falconide_setup_ports (struct ide_hw *hw,unsigned long base) {int i;memset (hw,0 ,sizeof (*hw)); - hw->io_ports.data_addr =ATA_HD_BASE ; + hw->io_ports.data_addr = base;for (i =1 ; i <8 ; i++) - hw->io_ports_array[i] =ATA_HD_BASE +1 + i *4 ; + hw->io_ports_array[i] = base +1 + i *4 ; - hw->io_ports.ctl_addr =ATA_HD_BASE +ATA_HD_CONTROL ; + hw->io_ports.ctl_addr = base +ATA_HD_CONTROL ; hw->irq =IRQ_MFP_IDE ; }
@@ -134,23 +136,29 @@ static void __init falconide_setup_ports(struct ide_hw *hw)* Probe for a Falcon IDE interface */ -static int __init falconide_init (void ) +static int __init falconide_init (struct platform_device *pdev) { +struct resource *res;struct ide_host *host;struct ide_hw hw, *hws[] = { &hw }; +unsigned long base;int rc; -if (!MACH_IS_ATARI || !ATARIHW_PRESENT (IDE )) -return -ENODEV ; +dev_info (&pdev->dev,"Atari Falcon IDE controller\n" ); -printk (KERN_INFO "ide: Falcon IDE controller\n" ); + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (!res) +return -ENODEV ; -if (!request_mem_region (ATA_HD_BASE ,0x40 ,DRV_NAME )) { -printk (KERN_ERR "%s: resources busy\n" ,DRV_NAME ); +if (!devm_request_mem_region (&pdev->dev, res->start, +resource_size (res),DRV_NAME )) { +dev_err (&pdev->dev,"resources busy\n" );return -EBUSY ; } -falconide_setup_ports (&hw); + base = (unsigned long )res->start; + +falconide_setup_ports (&hw, base); host =ide_host_alloc (&falconide_port_info, hws,1 );if (host ==NULL ) {
@@ -169,10 +177,21 @@ static int __init falconide_init(void) err_free:ide_host_free (host); err: -release_mem_region (ATA_HD_BASE ,0x40 ); +release_mem_region (res->start,resource_size (res));return rc; } -module_init (falconide_init); +static struct platform_driver ide_falcon_driver = { + .driver = { + .name ="atari-falcon-ide" , + }, +}; + +module_platform_driver_probe (ide_falcon_driver, falconide_init); + +MODULE_AUTHOR ("Geert Uytterhoeven" ); +MODULE_DESCRIPTION ("low-level driver for Atari Falcon IDE" );MODULE_LICENSE ("GPL" ); +MODULE_ALIAS ("platform:atari-falcon-ide" ); +MODULE_VERSION (DRV_VERSION );
Signature · 1 line
1.7.0.4
Geert Uytterhoeven
maintainerRe: [PATCH] ide: falconide: convert to platform driver
Hi Michael,
Quoted 11 lines · Michael Schmitz
With the introduction of a platform device for the Atari Falcon IDE interface, the old Falcon IDE driver no longer loads (resource already claimed by the platform device).
Convert falconide driver to use the same platform device that is used by
pata_falconalso.Tested (as built-in driver) on my Atari Falcon.
Signed-off-by Michael Schmitz <[email protected]>CC Geert Uytterhoeven <[email protected]>
Thanks for your patch!
Quoted 11 lines
drivers/ide/falconide.c +1
-0@@ -15,6 +15,7 @@#include <linux/blkdev.h> #include <linux/ide.h> #include <linux/init.h> +#include <linux/platform_device.h> #include <asm/setup.h> #include <asm/atarihw.h>
drivers/ide/falconide.c line 27
Quoted 4 lines
drivers/ide/falconide.c +1
-0@@ -23,6 +24,7 @@#include <asm/ide.h> #define DRV_NAME "falconide" +#define DRV_VERSION "0.1.0"
Does anyone care about that version?
Will it ever be updated?
Quoted 5 lines
drivers/ide/falconide.c +0
-1@@ -169,10 +177,21 @@ static int __init falconide_init(void) err_free:ide_host_free (host); err: -release_mem_region (ATA_HD_BASE ,0x40 );
drivers/ide/falconide.c static int __init falconide_init(void) · line 188
Quoted 10 lines
drivers/ide/falconide.c +6
-1+release_mem_region (res->start,resource_size (res));return rc; } -module_init (falconide_init); +static struct platform_driver ide_falcon_driver = { + .driver = { + .name ="atari-falcon-ide" , + }, +};
Missing .remove() callback.
drivers/ide/falconide.c static int __init falconide_init(void) · line 197
Quoted 9 lines
drivers/ide/falconide.c +7
-0+ +module_platform_driver_probe (ide_falcon_driver, falconide_init); + +MODULE_AUTHOR ("Geert Uytterhoeven" ); +MODULE_DESCRIPTION ("low-level driver for Atari Falcon IDE" );MODULE_LICENSE ("GPL" ); +MODULE_ALIAS ("platform:atari-falcon-ide" ); +MODULE_VERSION (DRV_VERSION );
I'd drop the MODULE_VERSION().
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH] ide: falconide: convert to platform driver
Hi Geert,
thanks for the review!
Quoted 31 lines · Geert Uytterhoeven
Hi Michael,
Quoted 11 lines · Michael Schmitz
With the introduction of a platform device for the Atari Falcon IDE interface, the old Falcon IDE driver no longer loads (resource already claimed by the platform device).
Convert falconide driver to use the same platform device that is used by
pata_falconalso.Tested (as built-in driver) on my Atari Falcon.
Signed-off-by Michael Schmitz <[email protected]>CC Geert Uytterhoeven <[email protected]>Thanks for your patch!
Quoted 13 lines
drivers/ide/falconide.c +1
-0@@ -15,6 +15,7 @@#include <linux/blkdev.h> #include <linux/ide.h> #include <linux/init.h> +#include <linux/platform_device.h> #include <asm/setup.h> #include <asm/atarihw.h> @@ -23,6 +24,7 @@#include <asm/ide.h>
Quoted 4 lines
drivers/ide/falconide.c line 27
Quoted 2 lines
drivers/ide/falconide.c +1
-0#define DRV_NAME "falconide" +#define DRV_VERSION "0.1.0"Does anyone care about that version?
Not likely.
Quoted 1 line
Will it ever be updated?
You ask me? You're still listed as driver author!
I'll remove the version.
Quoted 2 lines
drivers/ide/falconide.c static int __init falconide_init(void)
Quoted 2 lines
drivers/ide/falconide.c +0
-0@@ -169,10 +177,21 @@ static int __init falconide_init(void)
Should I remove the __init here? Doesn't hurt in the built-in use case, what about use as a module?
Quoted 8 lines
Quoted 8 lines
drivers/ide/falconide.c +1
-1err_free:ide_host_free (host); err: -release_mem_region (ATA_HD_BASE ,0x40 ); +release_mem_region (res->start,resource_size (res));return rc; }
Quoted 8 lines
drivers/ide/falconide.c static int __init falconide_init(void) · line 188
Quoted 6 lines
drivers/ide/falconide.c +5
-1-module_init (falconide_init); +static struct platform_driver ide_falcon_driver = { + .driver = { + .name ="atari-falcon-ide" , + }, +};Missing .remove() callback.
Can't easily test driver remove, but I can certainly add a callback for that.
ide_unregister does the Right Thing (i.e. leaves the ST-DMA interrupt registered) so no reason why it shouldn't work.
Quoted 5 lines
Quoted 5 lines
drivers/ide/falconide.c +3
-0+ +module_platform_driver_probe (ide_falcon_driver, falconide_init); +
Quoted 7 lines
drivers/ide/falconide.c static int __init falconide_init(void) · line 197
Quoted 5 lines
drivers/ide/falconide.c +4
-0+MODULE_AUTHOR ("Geert Uytterhoeven" ); +MODULE_DESCRIPTION ("low-level driver for Atari Falcon IDE" );MODULE_LICENSE ("GPL" ); +MODULE_ALIAS ("platform:atari-falcon-ide" ); +MODULE_VERSION (DRV_VERSION );I'd drop the
MODULE_VERSION().
Done.
Shall I merge this one with part one of the old series so there's no chance of a bisection going wrong?
Cheers,
Michael
Quoted 11 lines
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Geert Uytterhoeven
maintainerRe: [PATCH] ide: falconide: convert to platform driver
Hi Michael,
Quoted 24 lines · Michael Schmitz
Quoted 15 lines · Geert Uytterhoeven
Quoted 13 lines · Michael Schmitz
With the introduction of a platform device for the Atari Falcon IDE interface, the old Falcon IDE driver no longer loads (resource already claimed by the platform device).
Convert falconide driver to use the same platform device that is used by
pata_falconalso.Tested (as built-in driver) on my Atari Falcon.
Signed-off-by Michael Schmitz <[email protected]>drivers/ide/falconide.c +0
-0Quoted 7 lines
drivers/ide/falconide.c line 27
Quoted 5 lines
drivers/ide/falconide.c +1
-0@@ -23,6 +24,7 @@#include <asm/ide.h> #define DRV_NAME "falconide" +#define DRV_VERSION "0.1.0"Does anyone care about that version?
Quoted 5 lines
Not likely.
Quoted 1 line
Will it ever be updated?
You ask me? You're still listed as driver author!
Yeah, I wrote a "it compiles, so it must work" driver in the IDE framework, based on a driver in an even older framework. I never ran it on hardware ;-)
Quoted 4 lines
Quoted 1 line
drivers/ide/falconide.c static int __init falconide_init(void)
Quoted 1 line
drivers/ide/falconide.c +0
-0@@ -169,10 +177,21 @@ static int __init falconide_init(void)Should I remove the
__inithere? Doesn't hurt in the built-in use case, what about use as a module?
Should be fine.
Quoted 18 lines
Quoted 9 lines
Quoted 9 lines
drivers/ide/falconide.c +1
-1err_free:ide_host_free (host); err: -release_mem_region (ATA_HD_BASE ,0x40 ); +release_mem_region (res->start,resource_size (res));return rc; }Quoted 8 lines
drivers/ide/falconide.c static int __init falconide_init(void) · line 188
Quoted 6 lines
drivers/ide/falconide.c +5
-1-module_init (falconide_init); +static struct platform_driver ide_falcon_driver = { + .driver = { + .name ="atari-falcon-ide" , + }, +};Missing .remove() callback.
Quoted 4 lines
Can't easily test driver remove, but I can certainly add a callback for that.
ide_unregisterdoes the Right Thing (i.e. leaves the ST-DMA interrupt registered) so no reason why it shouldn't work.
gayle.c uses ide_host_remove().
Quoted 12 lines
Quoted 11 lines
drivers/ide/falconide.c static int __init falconide_init(void) · line 197
Quoted 9 lines
drivers/ide/falconide.c +7
-0+ +module_platform_driver_probe (ide_falcon_driver, falconide_init); + +MODULE_AUTHOR ("Geert Uytterhoeven" ); +MODULE_DESCRIPTION ("low-level driver for Atari Falcon IDE" );MODULE_LICENSE ("GPL" ); +MODULE_ALIAS ("platform:atari-falcon-ide" ); +MODULE_VERSION (DRV_VERSION );I'd drop the
MODULE_VERSION().
Quoted 4 lines
Done.
Shall I merge this one with part one of the old series so there's no chance of a bisection going wrong?
Yes please.
Thanks!
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH] ide: falconide: convert to platform driver
Hi Geert,
Quoted 7 lines · Geert Uytterhoeven
Quoted 5 lines
Quoted 2 lines
Review static int __init falconide_init(void)
Quoted 2 lines
(quoted diff) +0
-0@@ -169,10 +177,21 @@ static int __init falconide_init(void)Should I remove the
__inithere? Doesn't hurt in the built-in use case, what about use as a module?Should be fine.
OK, I'll leave it.
Quoted 19 lines
Quoted 19 lines
Quoted 18 lines
Quoted 6 lines
drivers/ide/falconide.c +0
-1err_free:ide_host_free (host); err: -release_mem_region (ATA_HD_BASE ,0x40 );drivers/ide/falconide.c static int __init falconide_init(void) · line 188
Quoted 10 lines
drivers/ide/falconide.c +6
-1+release_mem_region (res->start,resource_size (res));return rc; } -module_init (falconide_init); +static struct platform_driver ide_falcon_driver = { + .driver = { + .name ="atari-falcon-ide" , + }, +};Missing .remove() callback.
Quoted 6 lines
Quoted 4 lines
Can't easily test driver remove, but I can certainly add a callback for that.
ide_unregisterdoes the Right Thing (i.e. leaves the ST-DMA interrupt registered) so no reason why it shouldn't work.
gayle.cuseside_host_remove().
I'm using that, too. But ide_host_remove() is not where free_irq() is called.
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
drivers/ide/falconide.c static int __init falconide_init(void) · line 197
Quoted 10 lines
drivers/ide/falconide.c +7
-0+ +module_platform_driver_probe (ide_falcon_driver, falconide_init); + +MODULE_AUTHOR ("Geert Uytterhoeven" ); +MODULE_DESCRIPTION ("low-level driver for Atari Falcon IDE" );MODULE_LICENSE ("GPL" ); +MODULE_ALIAS ("platform:atari-falcon-ide" ); +MODULE_VERSION (DRV_VERSION );I'd drop the
MODULE_VERSION().
Quoted 7 lines
Quoted 4 lines
Done.
Shall I merge this one with part one of the old series so there's no chance of a bisection going wrong?
Yes please.
Thanks!
Thanks, I'll send a new version shortly.
Cheers,
Michael
Re: [PATCH] ide: falconide: convert to platform driver
Hi Geert,
Quoted 8 lines · Geert Uytterhoeven
Quoted 5 lines
Quoted 2 lines
Shall I merge this one with part one of the old series so there's no chance of a bisection going wrong?
Yes please.
Thanks!Thanks, I'll send a new version shortly.
Just confirming - the changes to pata_falcon.c will remain as a separate patch which should be applied together with the patch that will introduce the new platform device, and rewrite the legacy driver to use it. That would require Bartlomiej and you to coordinate closely.
If that's too onerous, I can merge the lot and you just ack the m68k bits? Please let me know what you'd prefer.
Cheers,
Michael
Geert Uytterhoeven
maintainerRe: [PATCH] ide: falconide: convert to platform driver
Hi Michael,
Quoted 7 lines · Michael Schmitz
Quoted 7 lines · Geert Uytterhoeven
Quoted 5 lines
Quoted 2 lines
Shall I merge this one with part one of the old series so there's no chance of a bisection going wrong?
Yes please.
Thanks!
Quoted 7 lines
Quoted 1 line
Thanks, I'll send a new version shortly.
Just confirming - the changes to
pata_falcon.cwill remain as a separate patch which should be applied together with the patch that will introduce the new platform device, and rewrite the legacy driver to use it. That would require Bartlomiej and you to coordinate closely.
Bartlomiej already acked both patches, so they can go in through the m68k tree.
To avoid bisection regressions, both patches should be merged into a single patch...
Quoted 2 lines
If that's too onerous, I can merge the lot and you just ack the m68k bits? Please let me know what you'd prefer.
... and with the falconide.c conversion, all three patches should be merged into a single patch.
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH] ide: falconide: convert to platform driver
Hi Geert,
thanks for confirming, I'll send a merged version shortly.
Cheers,
Michael
Quoted 29 lines · Geert Uytterhoeven
Hi Michael,
Quoted 11 lines · Michael Schmitz
Quoted 6 lines · Geert Uytterhoeven
Quoted 4 lines
Quoted 2 lines
Shall I merge this one with part one of the old series so there's no chance of a bisection going wrong?
Yes please.
Thanks!Thanks, I'll send a new version shortly.
Just confirming - the changes to
pata_falcon.cwill remain as a separate patch which should be applied together with the patch that will introduce the new platform device, and rewrite the legacy driver to use it. That would require Bartlomiej and you to coordinate closely.Bartlomiej already acked both patches, so they can go in through the m68k tree.
To avoid bisection regressions, both patches should be merged into a single patch...
Quoted 2 lines
If that's too onerous, I can merge the lot and you just ack the m68k bits? Please let me know what you'd prefer.
... and with the
falconide.cconversion, all three patches should be merged into a single patch.Gr{oetje,eeting}s,
Geert
Re: [PATCH RESEND v2 1/2] m68k/atari: add platform device for Falcon IDE port
In reply to Michael SchmitzHi Geert,
Am 05.11.2019 um 10:09 schrieb Michael Schmitz:
Quoted 26 lines
Quoted 26 lines
Quoted 17 lines
arch/m68k/atari/config.c +7
-0@@ -939,6 +959,13 @@ int __init atari_platform_init(void) atari_scsi_tt_rsrc, ARRAY_SIZE(atari_scsi_tt_rsrc));#endif +if (ATARIHW_PRESENT (IDE )) { + pdev =platform_device_register_simple ("atari-falcon-ide" ,-1 , + atari_falconide_rsrc,ARRAY_SIZE (atari_falconide_rsrc)); +if (IS_ERR (pdev)) + rv =PTR_ERR (pdev); + } +return rv;Quoted 1 line
}
This breaks both falconide and
pata_falcon, as it marks the resource busy:ide: Falcon IDE controller
falconide: resources busyand
Quoted 8 lines
Quoted 5 lines
pata_falcon: Atari Falcon PATA controller
pata_falcon: resources busyFor
pata_falcon, that regression can easily be fixed by merging both patches.I obviously need to test this again, but from what I remember from my last testing, falconide still worked OK after applying both patches.
No idea what happened on that test, but booting a kernel with these patches applied on real hardware indeed does see the (builtin) driver fail to load.
Quoted 3 lines
That would have been without loading
pata_falconat all.I'll rewrite falconide to use the same platform device as
pata_falcon.
Just sent a patch for that in order to get some review - will combine with the two earlier patches once it's in acceptable shape.
Cheers,
Michael
PATCH RESEND v2 2/2 drivers/ata: convert pata_falcon to arch platform device
In reply to Michael SchmitzThe Atari platform device setup now provides a platform device for the Falcon IDE interface. Use this in place of the simple platform device set up in the old pata_falcon probe code.
--
Changes from v1
- drop obsolete ATA_HD_BASE define
- use dev_err() to report error obtaining platform resource
--- drivers/ata/pata_falcon.c | 42 ++++++++++++++++++++++++++++-------------- 1 files changed, 28 insertions(+), 14 deletions(-)
drivers/ata/pata_falcon.c +28 -14
@@ -33,7 +33,6 @@#define DRV_NAME "pata_falcon"#define DRV_VERSION "0.1.0" -#define ATA_HD_BASE 0xfff00000#define ATA_HD_CONTROL 0x39static struct scsi_host_template pata_falcon_sht = {
@@ -120,24 +119,22 @@ static int pata_falcon_set_mode(struct ata_link *link, .set_mode = pata_falcon_set_mode, }; -static int pata_falcon_init_one (void ) +static int __init pata_falcon_init_one (struct platform_device *pdev) { +struct resource *res;struct ata_host *host;struct ata_port *ap; -struct platform_device *pdev;void __iomem *base; -if (!MACH_IS_ATARI || !ATARIHW_PRESENT (IDE )) -return -ENODEV ; - -pr_info (DRV_NAME ": Atari Falcon PATA controller\n" ); +dev_info (&pdev->dev,": Atari Falcon PATA controller\n" ); - pdev =platform_device_register_simple (DRV_NAME ,0 ,NULL ,0 ); -if (IS_ERR (pdev)) -return PTR_ERR (pdev); + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (!res) +return -ENODEV ; -if (!devm_request_mem_region (&pdev->dev,ATA_HD_BASE ,0x40 ,DRV_NAME )) { -pr_err (DRV_NAME ": resources busy\n" ); +if (!devm_request_mem_region (&pdev->dev, res->start, +resource_size (res),DRV_NAME )) { +dev_err (&pdev->dev,"resources busy\n" );return -EBUSY ; }
@@ -152,7 +149,7 @@ static int pata_falcon_init_one(void) ap->flags |=ATA_FLAG_SLAVE_POSS |ATA_FLAG_NO_IORDY ; ap->flags |=ATA_FLAG_PIO_POLLING ; - base = (void __iomem *)ATA_HD_BASE ; + base = (void __iomem *)res->start; ap->ioaddr.data_addr = base; ap->ioaddr.error_addr = base +1 +1 *4 ; ap->ioaddr.feature_addr = base +1 +1 *4 ;
@@ -174,9 +171,26 @@ static int pata_falcon_init_one(void)return ata_host_activate (host,0 ,NULL ,0 , &pata_falcon_sht); } -module_init (pata_falcon_init_one); +static int __exit pata_falcon_remove_one(struct platform_device *pdev) +{ +struct ata_host *host =platform_get_drvdata (pdev); + +ata_host_detach (host); + +return 0 ; +} + +static struct platform_driver pata_falcon_driver = { + .remove =__exit_p (pata_falcon_remove_one), + .driver = { + .name ="atari-falcon-ide" , + }, +}; + +module_platform_driver_probe (pata_falcon_driver, pata_falcon_init_one);MODULE_AUTHOR ("Bartlomiej Zolnierkiewicz" );MODULE_DESCRIPTION ("low-level driver for Atari Falcon PATA" );MODULE_LICENSE ("GPL v2" ); +MODULE_ALIAS ("platform:atari-falcon-ide" );MODULE_VERSION (DRV_VERSION );
Signature · 1 line
1.7.0.4
Re: [PATCH RESEND v2 2/2] drivers/ata: convert pata_falcon to arch platform device
Hi Michael,
Quoted 7 lines · Michael Schmitz
The Atari platform device setup now provides a platform device for the Falcon IDE interface. Use this in place of the simple platform device set up in the old
pata_falconprobe code.Signed-off-by Michael Schmitz <[email protected]>--
Should be a triple dash.
Minor nit below.
Quoted 10 lines
drivers/ata/pata_falcon.c +2
-1@@ -120,24 +119,22 @@ static int pata_falcon_set_mode(struct ata_link *link, .set_mode = pata_falcon_set_mode, }; -static int pata_falcon_init_one (void ) +static int __init pata_falcon_init_one (struct platform_device *pdev) { +struct resource *res;
drivers/ata/pata_falcon.c static int pata_falcon_set_mode(struct ata_link *link, · line 129
Quoted 10 lines
drivers/ata/pata_falcon.c +1
-5struct ata_host *host;struct ata_port *ap; -struct platform_device *pdev;void __iomem *base; -if (!MACH_IS_ATARI || !ATARIHW_PRESENT (IDE )) -return -ENODEV ; - -pr_info (DRV_NAME ": Atari Falcon PATA controller\n" ); +dev_info (&pdev->dev,": Atari Falcon PATA controller\n" );
Please drop the ": ".
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Quoted 9 lines · Michael Schmitz
[Resend because linux-m68k was dropped from the recipient list ...]
As suggested by Geert, at least one of the drivers available for the Falcon IDE interface should be converted to a platform device driver (to enable module autoloading by the Debian installer).
Add platform device for Falcon IDE (patch 1), and rewrite the present libata driver to make use of that device (patch 2).
Quoted 8 lines
Changes from v1:
Incorporated review comments by Geert; corrected silly mismatch between platform device name and platform driver name that caused loading driver to fail locating the related resource; check return code of platform device register call.
Tested on ARAnyM with only the
pata_falcondriver builtin.
Who's going to pick this one up? I can do it, but it'd be nice to have m68k on patch 1 first.
Signature · 1 line
Jens Axboe
Geert Uytterhoeven
maintainerQuoted 17 lines · Jens Axboe
Quoted 16 lines · Michael Schmitz
[Resend because linux-m68k was dropped from the recipient list ...]
As suggested by Geert, at least one of the drivers available for the Falcon IDE interface should be converted to a platform device driver (to enable module autoloading by the Debian installer).
Add platform device for Falcon IDE (patch 1), and rewrite the present libata driver to make use of that device (patch 2).
Changes from v1:
Incorporated review comments by Geert; corrected silly mismatch between platform device name and platform driver name that caused loading driver to fail locating the related resource; check return code of platform device register call.
Quoted 4 lines
Quoted 1 line
Tested on ARAnyM with only the
pata_falcondriver builtin.Who's going to pick this one up? I can do it, but it'd be nice to have m68k on patch 1 first.
Sorry for the late reply. I'll have a closer look after ELC-E, and will apply to the m68k tree if it passes.
BTW, I believe v1 of both patches has been acked by Bartlomiej?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Hi Geert,
Am 27.10.2019 um 07:17 schrieb Geert Uytterhoeven:
Quoted 8 lines
Quoted 3 lines
Who's going to pick this one up? I can do it, but it'd be nice to have m68k on patch 1 first.
Sorry for the late reply. I'll have a closer look after ELC-E, and will apply to the m68k tree if it passes.
BTW, I believe v1 of both patches has been acked by Bartlomiej?
Correct - on July 3rd. I totally forgot about that, and didn't add his Acked-by in v2, sorry.
Message-IDs are <[email protected]> and <[email protected]> FWIW.
Cheers,
Michael
Quoted 13 lines
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Geert Uytterhoeven
maintainerHi Michael,
Quoted 5 lines · Michael Schmitz
Am 27.10.2019 um 07:17 schrieb Geert Uytterhoeven:
Quoted 4 lines
Quoted 3 lines
Who's going to pick this one up? I can do it, but it'd be nice to have m68k on patch 1 first.
Quoted 7 lines
Quoted 4 lines
Sorry for the late reply. I'll have a closer look after ELC-E, and will apply to the m68k tree if it passes.
BTW, I believe v1 of both patches has been acked by Bartlomiej?
Correct - on July 3rd. I totally forgot about that, and didn't add his Acked-by in v2, sorry.
OK.
I was about to queue the combined patch, until I realized the defconfigs default to falconide, which is broken by patch 1/2.
My proposed solution for that is:
1. Switch the defconfigs from falconide to pata_falcon,
2. Remove the legacy falconide driver.
Does that sound OK? Thanks!
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Michael Schmitz
NAKHi Geert,
Quoted 10 lines · Geert Uytterhoeven
Hi Michael,
Quoted 7 lines · Michael Schmitz
Am 27.10.2019 um 07:17 schrieb Geert Uytterhoeven:
Quoted 6 lines
Quoted 2 lines
Who's going to pick this one up? I can do it, but it'd be nice to have m68k on patch 1 first.
Sorry for the late reply. I'll have a closer look after ELC-E, and will apply to the m68k tree if it passes.
BTW, I believe v1 of both patches has been acked by Bartlomiej?
Quoted 8 lines
Quoted 2 lines
Correct - on July 3rd. I totally forgot about that, and didn't add his Acked-by in v2, sorry.
OK.
I was about to queue the combined patch, until I realized the defconfigs default to falconide, which is broken by patch 1/2.
My proposed solution for that is:
1. Switch the defconfigs from falconide topata_falcon,
Ack.
Quoted 1 line
2. Remove the legacy falconide driver.
Nack - I still use that one (because pata_falcon has no support for using interrupts with the Falcon IDE interface, and I'm unsure how much more kernel bloat libata will add). Need to check the impact of switching to pata_falcon first.
Cheers,
Michael
Quoted 7 lines
Does that sound OK? Thanks!
Gr{oetje,eeting}s,
Geert
Geert Uytterhoeven
maintainerHi Michael,
Quoted 18 lines · Michael Schmitz
Quoted 8 lines · Geert Uytterhoeven
Quoted 7 lines · Michael Schmitz
Am 27.10.2019 um 07:17 schrieb Geert Uytterhoeven:
Quoted 6 lines
Quoted 2 lines
Who's going to pick this one up? I can do it, but it'd be nice to have m68k on patch 1 first.
Sorry for the late reply. I'll have a closer look after ELC-E, and will apply to the m68k tree if it passes.
BTW, I believe v1 of both patches has been acked by Bartlomiej?
Quoted 8 lines
Quoted 2 lines
Correct - on July 3rd. I totally forgot about that, and didn't add his Acked-by in v2, sorry.
OK.
I was about to queue the combined patch, until I realized the defconfigs default to falconide, which is broken by patch 1/2.
My proposed solution for that is:
1. Switch the defconfigs from falconide topata_falcon,
Quoted 8 lines
Ack.
Quoted 1 line
2. Remove the legacy falconide driver.
Nack - I still use that one (because
pata_falconhas no support for using interrupts with the Falcon IDE interface, and I'm unsure how much more kernel bloat libata will add). Need to check the impact of switching topata_falconfirst.
Oh, I forgot about that.
So yes, in that case pata_falcon is not a viable alternative yet. However, that means we can only avoid regressions by converting falconide to the new platform device, too, and doing that together, atomically, with your 2 patches in this series.
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Hi!
Quoted 3 lines · Michael Schmitz
Quoted 1 line
2. Remove the legacy falconide driver.
Nack - I still use that one (because
pata_falconhas no support for using interrupts with the Falcon IDE interface, and I'm unsure how much more kernel bloat libata will add). Need to check the impact of switching topata_falconfirst.
I think we have to switch over to libata sooner or later as the old IDE stack has officially been deprecated now and will probably be removed at some point.
Adrian
Signature · 4 lines
.''`. John Paul Adrian Glaubitz : :' : Debian Developer - [email protected] `. `' Freie Universitaet Berlin - [email protected] `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
Hi Adrian,
fine - that'll be the time when I gladly hand over testing of 030 m68k stuff (at least on Atari) to someone else.
Any takers?
Cheers,
Michael
Quoted 11 lines · John Paul Adrian Glaubitz
Hi!
Quoted 2 lines · Michael Schmitz
Quoted 1 line
2. Remove the legacy falconide driver.
Nack - I still use that one (because
pata_falconhas no support for using interrupts with the Falcon IDE interface, and I'm unsure how much more kernel bloat libata will add). Need to check the impact of switching topata_falconfirst.I think we have to switch over to libata sooner or later as the old IDE stack has officially been deprecated now and will probably be removed at some point.
Adrian
Quoted 3 lines · Michael Schmitz
fine - that'll be the time when I gladly hand over testing of 030 m68k stuff (at least on Atari) to someone else.
Any takers?
I'm not sure I understand the reasoning. Does the pata_falcon driver not work on a real Atari?
Adrian
Signature · 4 lines
.''`. John Paul Adrian Glaubitz : :' : Debian Developer - [email protected] `. `' Freie Universitaet Berlin - [email protected] `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
Adrian,
Am 05.11.2019 um 10:42 schrieb John Paul Adrian Glaubitz:
Quoted 7 lines · Michael Schmitz
Quoted 3 lines
fine - that'll be the time when I gladly hand over testing of 030 m68k stuff (at least on Atari) to someone else.
Any takers?
I'm not sure I understand the reasoning. Does the
pata_falcondriver not work on a real Atari?
I honestly don't know. I never tried that. With only 14 MB of RAM, keeping code size to the absolute minimum is quite important to me.
Aside from the lack of interrupt support for the Falcon IDE adapter in pata_falcon: I recall some criticism regarding the size of libata a few years back, combined with suggestion to allow libata to be built in a more modular fashion so features not requried to support what is essentially a dumb PIO mode IDE interface could be excluded. Not sure what became of that.
I'd have to test both the impact of missing IDE interrupt support, and that of code size when using either the old IDE code or libata at some stage. Having a stable SCSI driver for the Falcon is one of the prerequisites to that. We've just had a lot of fun with some of the m68k SCSI drivers breaking in the 5.x kernel series, so I'd rather leave IDE alone for now, or someone else step in and sort that particular mess out.
Cheers,
Michael
Quoted 3 lines
Adrian
Hi Adrian,
Quoted 3 lines · Michael Schmitz
I'd have to test both the impact of missing IDE interrupt support, and that of code size when using either the old
Code size comparison (replacing legacy IDE by libata): Total: Before=2979865, After=3101692, chg +4.09%
120k increase is a little much for me to want to try with my current RAM size. I regularly get processes kicked off by the OOM reaper when doing a bit of IO loading as is.
Cheers,
Michael
PATCH v3 1/1 m68k/atari: convert legacy Falcon IDE driver to platform driver
In reply to Michael SchmitzAutoloading of Falcon IDE driver modules requires converting these drivers to platform drivers.
Add platform device for Falcon IDE interface in Atari platform setup code. Use this in the pata_falcon driver in place of the simple platform device set up on the fly.
Convert falconide driver to use the same platform device that is used by pata_falcon also. (With the introduction of a platform device for the Atari Falcon IDE interface, the old Falcon IDE driver no longer loads (resource already claimed by the platform device)).
Tested (as built-in driver) on my Atari Falcon.
---
Changes from RFC
- fix region size (spotted by Szymon Bieganski <[email protected]>)
- define IDE interface address in atari/config.c, create platform device always (suggested by Geert Uytterhoeven <[email protected]>)
Changes from v1
- drop obsolete ATA_HD_BASE define
- add error checking for Falcon IDE platform device register
- use dev_err() to report error obtaining platform resource im pata_falcon driver
Changes from v2
- rewrite legacy falconide driver to use new platform device to avoid problem with IDE resource already marked busy (reported by Geert Uytterhoeven <[email protected]>)
--- arch/m68k/atari/config.c | 27 ++++++++++++++++++++ drivers/ata/pata_falcon.c | 42 +++++++++++++++++++++---------- drivers/ide/falconide.c | 60 ++++++++++++++++++++++++++++++--------------- 3 files changed, 95 insertions(+), 34 deletions(-)
arch/m68k/atari/config.c +27 -0
@@ -869,8 +869,28 @@ static void isp1160_delay(struct device *dev, int delay) };#endif +/* +* Falcon IDE interface +*/ + +#define FALCON_IDE_BASE 0xfff00000 + +static const struct resource atari_falconide_rsrc[]__initconst = { + { + .flags =IORESOURCE_MEM , + .start =FALCON_IDE_BASE , + .end =FALCON_IDE_BASE +0x39 , + }, + { + .flags =IORESOURCE_IRQ , + .start =IRQ_MFP_FSCSI , + .end =IRQ_MFP_FSCSI , + }, +}; +int __init atari_platform_init (void ) { +struct platform_device *pdev;int rv =0 ;if (!MACH_IS_ATARI )
@@ -912,6 +932,13 @@ int __init atari_platform_init(void) atari_scsi_tt_rsrc, ARRAY_SIZE(atari_scsi_tt_rsrc));#endif +if (ATARIHW_PRESENT (IDE )) { + pdev =platform_device_register_simple ("atari-falcon-ide" ,-1 , + atari_falconide_rsrc,ARRAY_SIZE (atari_falconide_rsrc)); +if (IS_ERR (pdev)) + rv =PTR_ERR (pdev); + } +return rv; }
drivers/ata/pata_falcon.c +28 -14
75 lines not on this page · raw message
drivers/ide/falconide.c +40 -20
110 lines not on this page · raw message
Signature · 1 line
1.7.0.4
Re: [PATCH v3] m68k/atari: convert legacy Falcon IDE driver to platform driver
Quoted 12 lines · Michael Schmitz
Autoloading of Falcon IDE driver modules requires converting these drivers to platform drivers.
Add platform device for Falcon IDE interface in Atari platform setup code. Use this in the
pata_falcondriver in place of the simple platform device set up on the fly.Convert falconide driver to use the same platform device that is used by
pata_falconalso. (With the introduction of a platform device for the Atari Falcon IDE interface, the old Falcon IDE driver no longer loads (resource already claimed by the platform device)).
Quoted 5 lines
Tested (as built-in driver) on my Atari Falcon.
Signed-off-by Michael Schmitz <[email protected]>CC Geert Uytterhoeven <[email protected]>
Thanks, applied as "m68k/atari: Convert Falcon IDE drivers to platform drivers", and queued for v5.5.
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH v3] m68k/atari: convert legacy Falcon IDE driver to platform driver
Quoted 2 lines · Geert Uytterhoeven
Thanks, applied as "m68k/atari: Convert Falcon IDE drivers to platform drivers", and queued for v5.5.
Great. So this should finally resolve the issue that debian-installer won't load the ATA drivers on Aranym automatically during installation.
Adrian
Signature · 4 lines
.''`. John Paul Adrian Glaubitz : :' : Debian Developer - [email protected] `. `' Freie Universitaet Berlin - [email protected] `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913