Convert Atari Falcon IDE driver to platform device
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): CAMuHMdUcUqWWGNngNV3EpEq5wSsf5qTVeZvTB9gX1e26Jrq1xA@mail.gmail.com
cover Convert Atari Falcon IDE driver to platform device
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).
Tested on ARAnyM with driver builtin.
Cheers,
Michael
RFC PATCH 1/2 m68k/atari: add platform device for Falcon IDE port
In reply to a message not in the archiveAutoloading 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.
Add Falcon IDE base address in Atari hardware address header.
--- arch/m68k/atari/config.c | 20 ++++++++++++++++++++ arch/m68k/include/asm/atarihw.h | 6 ++++++ 2 files changed, 26 insertions(+), 0 deletions(-)
arch/m68k/atari/config.c +20 -0
@@ -896,6 +896,21 @@ static void isp1160_delay(struct device *dev, int delay) };#endif +#if IS_ENABLED (CONFIG_PATA_FALCON ) +static const struct resource atari_falconide_rsrc[]__initconst = { + { + .flags =IORESOURCE_MEM , + .start =FALCON_IDE_BASE , + .end =FALCON_IDE_BASE +0x40 , + }, + { + .flags =IORESOURCE_IRQ , + .start =IRQ_MFP_FSCSI , + .end =IRQ_MFP_FSCSI , + }, +}; +#endif +int __init atari_platform_init (void ) {int rv =0 ;
@@ -939,6 +954,11 @@ int __init atari_platform_init(void) atari_scsi_tt_rsrc, ARRAY_SIZE(atari_scsi_tt_rsrc));#endif +#if IS_ENABLED (CONFIG_PATA_FALCON ) +if (ATARIHW_PRESENT (IDE )) +platform_device_register_simple ("pata_falcon" ,-1 , + atari_falconide_rsrc,ARRAY_SIZE (atari_falconide_rsrc)); +#endif return rv; }
arch/m68k/include/asm/atarihw.h +6 -0
@@ -813,6 +813,12 @@ struct MSTE_RTC {#define mste_rtc ((*(volatile struct MSTE_RTC *)MSTE_RTC_BAS))/* +** Falcon IDE interface +*/ + +#define FALCON_IDE_BASE 0xfff00000 + +/* ** EtherNAT add-on card for Falcon - combined ethernet and USB adapter */
Signature · 1 line
1.7.0.4
Re: [PATCH RFC 1/2] m68k/atari: add platform device for Falcon IDE port
Hello!
Quoted 19 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.
Add Falcon IDE base address in Atari hardware address header.
Signed-off-by Michael Schmitz <[email protected]>--- arch/m68k/atari/config.c | 20 ++++++++++++++++++++ arch/m68k/include/asm/atarihw.h | 6 ++++++ 2 files changed, 26 insertions(+), 0 deletions(-)arch/m68k/atari/config.c +0
-0
arch/m68k/atari/config.c static void isp1160_delay(struct device *dev, int delay) · line 904
Quoted 9 lines
arch/m68k/atari/config.c +6
-0@@ -896,6 +896,21 @@ static void isp1160_delay(struct device *dev, int delay) };#endif +#if IS_ENABLED(CONFIG_PATA_FALCON) +static const struct resource atari_falconide_rsrc[] __initconst = { + { + .flags = IORESOURCE_MEM, + .start = FALCON_IDE_BASE, + .end = FALCON_IDE_BASE+0x40,
You probably forgot to subtract 1 here...
arch/m68k/atari/config.c static void isp1160_delay(struct device *dev, int delay) · line 916
Quoted 12 lines
arch/m68k/atari/config.c +9
-0+ }, + { + .flags = IORESOURCE_IRQ, + .start = IRQ_MFP_FSCSI, + .end = IRQ_MFP_FSCSI, + }, +}; +#endif +int __init atari_platform_init (void ) {int rv =0 ;
[...]
MBR, Sergei
Re: [PATCH RFC 1/2] m68k/atari: add platform device for Falcon IDE port
Sergei,
Am 23.06.2019 um 21:06 schrieb Sergei Shtylyov:
Quoted 18 lines
Hello!
Quoted 14 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.
Add Falcon IDE base address in Atari hardware address header.
Signed-off-by Michael Schmitz <[email protected]>--- arch/m68k/atari/config.c | 20 ++++++++++++++++++++ arch/m68k/include/asm/atarihw.h | 6 ++++++ 2 files changed, 26 insertions(+), 0 deletions(-)
Quoted 16 lines
Quoted 5 lines
arch/m68k/atari/config.c +0
-0arch/m68k/atari/config.c static void isp1160_delay(struct device *dev, int · line 904
Quoted 9 lines
arch/m68k/atari/config.c +5
-0@@ -896,6 +896,21 @@ static void isp1160_delay(struct device *dev, int delay) };#endif +#if IS_ENABLED(CONFIG_PATA_FALCON) +static const struct resource atari_falconide_rsrc[] __initconst = { + { + .flags = IORESOURCE_MEM, + .start = FALCON_IDE_BASE, + .end = FALCON_IDE_BASE+0x40,You probably forgot to subtract 1 here...
Well spotted. That's inconsequential however, as there's no overlap with other IO adresses used in that region, and everything has been mapped into kernel space by early arch startup.
Will fix in the next iteration.
Cheers,
Michael
Quoted 16 lines
arch/m68k/atari/config.c static void isp1160_delay(struct device *dev, int delay) · line 916
Quoted 13 lines
arch/m68k/atari/config.c +9
-0+ }, + { + .flags = IORESOURCE_IRQ, + .start = IRQ_MFP_FSCSI, + .end = IRQ_MFP_FSCSI, + }, +}; +#endif +int __init atari_platform_init (void ) {int rv =0 ;[...]
MBR, Sergei
Geert Uytterhoeven
maintainerRe: [PATCH RFC 1/2] m68k/atari: add platform device for Falcon IDE port
In reply to Michael SchmitzHi 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.
Add Falcon IDE base address in Atari hardware address header.
Signed-off-by Michael Schmitz <[email protected]>
Thanks for your patch!
arch/m68k/atari/config.c static void isp1160_delay(struct device *dev, int delay) · line 899
Quoted 7 lines
arch/m68k/atari/config.c +1
-0@@ -896,6 +896,21 @@ static void isp1160_delay(struct device *dev, int delay) };#endif +#if IS_ENABLED (CONFIG_PATA_FALCON )
I wouldn't bother making this depend on a config symbol, as it is builtin hardware (EtherNEC/NAT isn't), and prevents compiling a module later.arch/m68k/amiga/platform.c has everything unconditional.
I know there's such a dependency for SCSI, perhaps it should be removed?
Quoted 34 lines
arch/m68k/atari/config.c +19
-0+static const struct resource atari_falconide_rsrc[]__initconst = { + { + .flags =IORESOURCE_MEM , + .start =FALCON_IDE_BASE , + .end =FALCON_IDE_BASE +0x40 , + }, + { + .flags =IORESOURCE_IRQ , + .start =IRQ_MFP_FSCSI , + .end =IRQ_MFP_FSCSI , + }, +}; +#endif +int __init atari_platform_init (void ) {int rv =0 ;@@ -939,6 +954,11 @@ int __init atari_platform_init(void) atari_scsi_tt_rsrc, ARRAY_SIZE(atari_scsi_tt_rsrc));#endif +#if IS_ENABLED (CONFIG_PATA_FALCON ) +if (ATARIHW_PRESENT (IDE )) +platform_device_register_simple ("pata_falcon" ,-1 , + atari_falconide_rsrc,ARRAY_SIZE (atari_falconide_rsrc)); +#endif return rv; }arch/m68k/include/asm/atarihw.h +0
-0
arch/m68k/include/asm/atarihw.h struct MSTE_RTC { · line 819
Quoted 7 lines
arch/m68k/include/asm/atarihw.h +4
-0@@ -813,6 +813,12 @@ struct MSTE_RTC {#define mste_rtc ((*(volatile struct MSTE_RTC *)MSTE_RTC_BAS))/* +** Falcon IDE interface +*/ + +#define FALCON_IDE_BASE 0xfff00000
Is it worth having this as a #define in a global header file? You still need a hardcoded region size in config.c.
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 RFC 1/2] m68k/atari: add platform device for Falcon IDE port
Hi Geert,
Quoted 6 lines · Geert Uytterhoeven
Hi Michael,
Quoted 3 lines · Michael Schmitz
Autoloading of Falcon IDE driver modules requires converting these drivers to platform drivers.
Quoted 7 lines
Quoted 6 lines
Add platform device for Falcon IDE interface in Atari platform setup code in preparation for this.
Add Falcon IDE base address in Atari hardware address header.
Signed-off-by Michael Schmitz <[email protected]>Thanks for your patch!
Thanks for your feedback!
Quoted 11 lines
arch/m68k/atari/config.c static void isp1160_delay(struct device *dev, int delay) · line 899
Quoted 8 lines
arch/m68k/atari/config.c +1
-0@@ -896,6 +896,21 @@ static void isp1160_delay(struct device *dev, int delay) };#endif +#if IS_ENABLED (CONFIG_PATA_FALCON )I wouldn't bother making this depend on a config symbol, as it is builtin hardware (EtherNEC/NAT isn't), and prevents compiling a module later.
Fair enough - not sure how much it saves in kernel size when this code isn't compiled (falconide does not depend on it, and that's my preferred choice due to interrupt support).
IDE is builtin hardware only for Falcon, not TT BTW. Building the kernel for TT, all of IDE support may well be omitted altogether.
Quoted 2 lines
arch/m68k/amiga/platform.chas everything unconditional.
I know there's such a dependency for SCSI, perhaps it should be removed?
SCSI isn't present on the Mega ST/e, so we would not need the SCSI platform device there. Not sure whether it's still possible to boot recent kernels on that hardware though.
I'll have to try the bloat-o-meter for these changes.
Quoted 37 lines
Quoted 37 lines
arch/m68k/atari/config.c +19
-0+static const struct resource atari_falconide_rsrc[]__initconst = { + { + .flags =IORESOURCE_MEM , + .start =FALCON_IDE_BASE , + .end =FALCON_IDE_BASE +0x40 , + }, + { + .flags =IORESOURCE_IRQ , + .start =IRQ_MFP_FSCSI , + .end =IRQ_MFP_FSCSI , + }, +}; +#endif +int __init atari_platform_init (void ) {int rv =0 ;@@ -939,6 +954,11 @@ int __init atari_platform_init(void) atari_scsi_tt_rsrc, ARRAY_SIZE(atari_scsi_tt_rsrc));#endif +#if IS_ENABLED (CONFIG_PATA_FALCON ) +if (ATARIHW_PRESENT (IDE )) +platform_device_register_simple ("pata_falcon" ,-1 , + atari_falconide_rsrc,ARRAY_SIZE (atari_falconide_rsrc)); +#endif return rv; }arch/m68k/include/asm/atarihw.h +0
-0@@ -813,6 +813,12 @@ struct MSTE_RTC {#define mste_rtc ((*(volatile struct MSTE_RTC *)MSTE_RTC_BAS))
Quoted 7 lines
arch/m68k/include/asm/atarihw.h struct MSTE_RTC { · line 819
Quoted 5 lines
arch/m68k/include/asm/atarihw.h +4
-0/* +** Falcon IDE interface +*/ + +#define FALCON_IDE_BASE 0xfff00000Is it worth having this as a #define in a global header file? You still need a hardcoded region size in
config.c.
Probably not.
I'm still incubating a hare-brained scheme to allow use of IDE interrupts in pata_falcon without the use of the old locking scheme, and might need to peek at the IDE interrupt status from the shared interrupt handler for that. But that's gone on the back burner, so I can move the #define into config.c instead.
Cheers,
Michael
Quoted 5 lines
Gr{oetje,eeting}s,
Geert
RFC PATCH 2/2 drivers/ata: convert pata_falcon to arch platform device
In reply to a message not in the archiveThe 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.
--- drivers/ata/pata_falcon.c | 39 +++++++++++++++++++++++++++------------ 1 files changed, 27 insertions(+), 12 deletions(-)
drivers/ata/pata_falcon.c +27 -12
@@ -120,23 +120,21 @@ 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 )) { +if (!devm_request_mem_region (&pdev->dev, res->start, +resource_size (res),DRV_NAME )) {pr_err (DRV_NAME ": resources busy\n" );return -EBUSY ; }
@@ -152,7 +150,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 +172,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