diff mbox

[6/9] ARM: davinci: da830-evm: use aemif platform driver

Message ID 20180625152920.11549-7-brgl@bgdev.pl (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Bartosz Golaszewski June 25, 2018, 3:29 p.m. UTC
From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

We now support board files in the aemif driver. Register a platform
device instead of using the handcrafted API in da830-evm.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 arch/arm/mach-davinci/board-da830-evm.c | 56 +++++++++++++++++++------
 1 file changed, 44 insertions(+), 12 deletions(-)

Comments

David Lechner June 25, 2018, 4:20 p.m. UTC | #1
On 06/25/2018 10:29 AM, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> We now support board files in the aemif driver. Register a platform
> device instead of using the handcrafted API in da830-evm.
> 
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> ---
>   arch/arm/mach-davinci/board-da830-evm.c | 56 +++++++++++++++++++------
>   1 file changed, 44 insertions(+), 12 deletions(-)
> 
> diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c
> index b2470141dba3..666db3cee08a 100644
> --- a/arch/arm/mach-davinci/board-da830-evm.c
> +++ b/arch/arm/mach-davinci/board-da830-evm.c
> @@ -28,6 +28,7 @@
>   #include <linux/platform_data/mtd-davinci-aemif.h>
>   #include <linux/platform_data/spi-davinci.h>
>   #include <linux/platform_data/usb-davinci.h>
> +#include <linux/platform_data/ti-aemif.h>
>   #include <linux/regulator/machine.h>
>   
>   #include <asm/mach-types.h>
> @@ -333,14 +334,48 @@ static struct resource da830_evm_nand_resources[] = {
>   	},
>   };
>   
> -static struct platform_device da830_evm_nand_device = {
> -	.name		= "davinci_nand",
> -	.id		= 1,
> -	.dev		= {
> -		.platform_data	= &da830_evm_nand_pdata,
> +static struct platform_device da830_evm_aemif_devices[] = {
> +	{
> +		.name		= "davinci_nand",
> +		.id		= 1,

Actually, now that I've thought about it some more. It probably
makes more sense to make all of the "davinci_nand" devices in this
series use id = -1 since there is only one per board. It looks like
da850 is the only one that has a lookup for "davinic_nand.0" already.

I think that we are going to have to add clock lookups for the
"davinci_nand" devices as well. Although the driver doesn't do
clk_get() explicitly, I think some function it calls does get a
clock. I remember that we had to add a clock-ranges property to
device tree to get the davinci_nand driver working, which is why
I think we are going to need a clock lookup for these devices
as well.

> +		.dev		= {
> +			.platform_data	= &da830_evm_nand_pdata,
> +		},
> +		.num_resources	= ARRAY_SIZE(da830_evm_nand_resources),
> +		.resource	= da830_evm_nand_resources,
> +	},
> +};
> +
--
To unsubscribe from this list: send the line "unsubscribe linux-clk" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Bartosz Golaszewski June 25, 2018, 4:23 p.m. UTC | #2
2018-06-25 18:20 GMT+02:00 David Lechner <david@lechnology.com>:
> On 06/25/2018 10:29 AM, Bartosz Golaszewski wrote:
>>
>> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>>
>> We now support board files in the aemif driver. Register a platform
>> device instead of using the handcrafted API in da830-evm.
>>
>> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>> ---
>>   arch/arm/mach-davinci/board-da830-evm.c | 56 +++++++++++++++++++------
>>   1 file changed, 44 insertions(+), 12 deletions(-)
>>
>> diff --git a/arch/arm/mach-davinci/board-da830-evm.c
>> b/arch/arm/mach-davinci/board-da830-evm.c
>> index b2470141dba3..666db3cee08a 100644
>> --- a/arch/arm/mach-davinci/board-da830-evm.c
>> +++ b/arch/arm/mach-davinci/board-da830-evm.c
>> @@ -28,6 +28,7 @@
>>   #include <linux/platform_data/mtd-davinci-aemif.h>
>>   #include <linux/platform_data/spi-davinci.h>
>>   #include <linux/platform_data/usb-davinci.h>
>> +#include <linux/platform_data/ti-aemif.h>
>>   #include <linux/regulator/machine.h>
>>     #include <asm/mach-types.h>
>> @@ -333,14 +334,48 @@ static struct resource da830_evm_nand_resources[] =
>> {
>>         },
>>   };
>>   -static struct platform_device da830_evm_nand_device = {
>> -       .name           = "davinci_nand",
>> -       .id             = 1,
>> -       .dev            = {
>> -               .platform_data  = &da830_evm_nand_pdata,
>> +static struct platform_device da830_evm_aemif_devices[] = {
>> +       {
>> +               .name           = "davinci_nand",
>> +               .id             = 1,
>
>
> Actually, now that I've thought about it some more. It probably
> makes more sense to make all of the "davinci_nand" devices in this
> series use id = -1 since there is only one per board. It looks like
> da850 is the only one that has a lookup for "davinic_nand.0" already.
>
> I think that we are going to have to add clock lookups for the
> "davinci_nand" devices as well. Although the driver doesn't do
> clk_get() explicitly, I think some function it calls does get a
> clock. I remember that we had to add a clock-ranges property to
> device tree to get the davinci_nand driver working, which is why
> I think we are going to need a clock lookup for these devices
> as well.
>

Seems like ever since commit a8e3923ab571 ("mtd: rawnand: davinci:
don't acquire and enable clock") we no longer need to worry about the
clock entries for nand.

Thanks,
Bart
--
To unsubscribe from this list: send the line "unsubscribe linux-clk" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Lechner June 25, 2018, 4:29 p.m. UTC | #3
On 06/25/2018 11:23 AM, Bartosz Golaszewski wrote:
> 2018-06-25 18:20 GMT+02:00 David Lechner <david@lechnology.com>:
>> On 06/25/2018 10:29 AM, Bartosz Golaszewski wrote:
>>>
>>> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>>>
>>> We now support board files in the aemif driver. Register a platform
>>> device instead of using the handcrafted API in da830-evm.
>>>
>>> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>>> ---
>>>    arch/arm/mach-davinci/board-da830-evm.c | 56 +++++++++++++++++++------
>>>    1 file changed, 44 insertions(+), 12 deletions(-)
>>>
>>> diff --git a/arch/arm/mach-davinci/board-da830-evm.c
>>> b/arch/arm/mach-davinci/board-da830-evm.c
>>> index b2470141dba3..666db3cee08a 100644
>>> --- a/arch/arm/mach-davinci/board-da830-evm.c
>>> +++ b/arch/arm/mach-davinci/board-da830-evm.c
>>> @@ -28,6 +28,7 @@
>>>    #include <linux/platform_data/mtd-davinci-aemif.h>
>>>    #include <linux/platform_data/spi-davinci.h>
>>>    #include <linux/platform_data/usb-davinci.h>
>>> +#include <linux/platform_data/ti-aemif.h>
>>>    #include <linux/regulator/machine.h>
>>>      #include <asm/mach-types.h>
>>> @@ -333,14 +334,48 @@ static struct resource da830_evm_nand_resources[] =
>>> {
>>>          },
>>>    };
>>>    -static struct platform_device da830_evm_nand_device = {
>>> -       .name           = "davinci_nand",
>>> -       .id             = 1,
>>> -       .dev            = {
>>> -               .platform_data  = &da830_evm_nand_pdata,
>>> +static struct platform_device da830_evm_aemif_devices[] = {
>>> +       {
>>> +               .name           = "davinci_nand",
>>> +               .id             = 1,
>>
>>
>> Actually, now that I've thought about it some more. It probably
>> makes more sense to make all of the "davinci_nand" devices in this
>> series use id = -1 since there is only one per board. It looks like
>> da850 is the only one that has a lookup for "davinic_nand.0" already.
>>
>> I think that we are going to have to add clock lookups for the
>> "davinci_nand" devices as well. Although the driver doesn't do
>> clk_get() explicitly, I think some function it calls does get a
>> clock. I remember that we had to add a clock-ranges property to
>> device tree to get the davinci_nand driver working, which is why
>> I think we are going to need a clock lookup for these devices
>> as well.
>>
> 
> Seems like ever since commit a8e3923ab571 ("mtd: rawnand: davinci:
> don't acquire and enable clock") we no longer need to worry about the
> clock entries for nand.
> 
> Thanks,
> Bart
> 

Sounds good. If you end up touching the da850 clock lookups, you can
probably drop the "davinci_nand.0" entry there.

--
To unsubscribe from this list: send the line "unsubscribe linux-clk" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c
index b2470141dba3..666db3cee08a 100644
--- a/arch/arm/mach-davinci/board-da830-evm.c
+++ b/arch/arm/mach-davinci/board-da830-evm.c
@@ -28,6 +28,7 @@ 
 #include <linux/platform_data/mtd-davinci-aemif.h>
 #include <linux/platform_data/spi-davinci.h>
 #include <linux/platform_data/usb-davinci.h>
+#include <linux/platform_data/ti-aemif.h>
 #include <linux/regulator/machine.h>
 
 #include <asm/mach-types.h>
@@ -333,14 +334,48 @@  static struct resource da830_evm_nand_resources[] = {
 	},
 };
 
-static struct platform_device da830_evm_nand_device = {
-	.name		= "davinci_nand",
-	.id		= 1,
-	.dev		= {
-		.platform_data	= &da830_evm_nand_pdata,
+static struct platform_device da830_evm_aemif_devices[] = {
+	{
+		.name		= "davinci_nand",
+		.id		= 1,
+		.dev		= {
+			.platform_data	= &da830_evm_nand_pdata,
+		},
+		.num_resources	= ARRAY_SIZE(da830_evm_nand_resources),
+		.resource	= da830_evm_nand_resources,
+	},
+};
+
+static struct resource da830_evm_aemif_resource[] = {
+	{
+		.start	= DA8XX_AEMIF_CTL_BASE,
+		.end	= DA8XX_AEMIF_CTL_BASE + SZ_32K - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+};
+
+static struct aemif_abus_data da830_evm_aemif_abus_data[] = {
+	{
+		.cs	= 3,
 	},
-	.num_resources	= ARRAY_SIZE(da830_evm_nand_resources),
-	.resource	= da830_evm_nand_resources,
+};
+
+static struct aemif_platform_data da830_evm_aemif_pdata = {
+	.abus_data		= da830_evm_aemif_abus_data,
+	.num_abus_data		= ARRAY_SIZE(da830_evm_aemif_abus_data),
+	.sub_devices		= da830_evm_aemif_devices,
+	.num_sub_devices	= ARRAY_SIZE(da830_evm_aemif_devices),
+	.cs_offset		= 2,
+};
+
+static struct platform_device da830_evm_aemif_device = {
+	.name		= "ti-aemif",
+	.dev = {
+		.platform_data = &da830_evm_aemif_pdata,
+	},
+	.resource	= da830_evm_aemif_resource,
+	.num_resources	= ARRAY_SIZE(da830_evm_aemif_resource),
+	.id		= -1,
 };
 
 /*
@@ -371,12 +406,9 @@  static inline void da830_evm_init_nand(int mux_mode)
 	if (ret)
 		pr_warn("%s: emif25 mux setup failed: %d\n", __func__, ret);
 
-	ret = platform_device_register(&da830_evm_nand_device);
+	ret = platform_device_register(&da830_evm_aemif_device);
 	if (ret)
-		pr_warn("%s: NAND device not registered\n", __func__);
-
-	if (davinci_aemif_setup(&da830_evm_nand_device))
-		pr_warn("%s: Cannot configure AEMIF\n", __func__);
+		pr_warn("%s: AEMIF device not registered\n", __func__);
 
 	gpio_direction_output(mux_mode, 1);
 }