diff mbox series

[RESEND,v2,1/2] m68k/atari: add platform device for Falcon IDE port

Message ID 1569470064-3977-2-git-send-email-schmitzmic@gmail.com
State Not Applicable
Delegated to: David Miller
Headers show
Series Convert Atari Falcon IDE driver to platform device | expand

Commit Message

Michael Schmitz Sept. 26, 2019, 3:54 a.m. UTC
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 <schmitzmic@gmail.com>

--

Changes from RFC

- fix region size (spotted by Szymon Bieganski <S.Bieganski@chello.nl>)
- define IDE interface address in atari/config.c, create platform device
  always (suggested by Geert Uytterhoeven <geert@linux-m68k.org>)

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(-)

Comments

Geert Uytterhoeven Nov. 4, 2019, 10:56 a.m. UTC | #1
Hi Michael,

On Thu, Sep 26, 2019 at 5:54 AM Michael Schmitz <schmitzmic@gmail.com> wrote:
> 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 <schmitzmic@gmail.com>
>
> --

This should be a triple dash.

>
> Changes from RFC
>
> - fix region size (spotted by Szymon Bieganski <S.Bieganski@chello.nl>)
> - define IDE interface address in atari/config.c, create platform device
>   always (suggested by Geert Uytterhoeven <geert@linux-m68k.org>)
>
> Changes from v1
>
> - add error checking for Falcon IDE platform device register

Thanks for the update!

> --- a/arch/m68k/atari/config.c
> +++ b/arch/m68k/atari/config.c
> @@ -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;
>  }

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:
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>

Gr{oetje,eeting}s,

                        Geert
Michael Schmitz Nov. 4, 2019, 9:09 p.m. UTC | #2
Hi Geert,

thanks for your review!

On 4/11/19 11:56 PM, Geert Uytterhoeven wrote:
> Hi Michael,
>
> On Thu, Sep 26, 2019 at 5:54 AM Michael Schmitz <schmitzmic@gmail.com> wrote:
>> 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 <schmitzmic@gmail.com>
>>
>> --
> This should be a triple dash.
>
>> Changes from RFC
>>
>> - fix region size (spotted by Szymon Bieganski <S.Bieganski@chello.nl>)
>> - define IDE interface address in atari/config.c, create platform device
>>    always (suggested by Geert Uytterhoeven <geert@linux-m68k.org>)
>>
>> Changes from v1
>>
>> - add error checking for Falcon IDE platform device register
> Thanks for the update!
>
>> --- a/arch/m68k/atari/config.c
>> +++ b/arch/m68k/atari/config.c
>> @@ -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;
>>   }
> 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.

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

> 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:
> Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
>
> Gr{oetje,eeting}s,
>
>                          Geert
>
Michael Schmitz Nov. 5, 2019, 6:43 a.m. UTC | #3
Hi Geert,

Am 05.11.2019 um 10:09 schrieb Michael Schmitz:
>>> --- a/arch/m68k/atari/config.c
>>> +++ b/arch/m68k/atari/config.c
>>> @@ -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;
>>>   }
>> 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.
>
> 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.

> That would have been without loading pata_falcon at 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
diff mbox series

Patch

diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c
index ca8469e..d6e9363 100644
--- a/arch/m68k/atari/config.c
+++ b/arch/m68k/atari/config.c
@@ -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;
 }