diff mbox series

[U-Boot,v2,3/4] mmc: omap_hsmmc: make it possible to compile out ADMA support

Message ID 1519378819-19867-4-git-send-email-jjhiblot@ti.com
State Accepted
Commit 27a4b3bc4c165695cac65e92a5cb2537367a2392
Delegated to: Jaehoon Chung
Headers show
Series mmc: omap_hsmmc: Reduce the footprint of the driver and fix am335x clock | expand

Commit Message

Jean-Jacques Hiblot Feb. 23, 2018, 9:40 a.m. UTC
Some platforms don't have ADMA controllers. For those platforms, compiling
it out reduces the size of the binary by about 600 bytes.
Leaving the support in doesn't break things as the driver checks at runtime
if the ADMA2 controller is present.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>

---

Changes in v2:
- Use a Kconfig option to compile out the ADMA support instead of relying
  on the platform architecture

 drivers/mmc/Kconfig      |  9 +++++++++
 drivers/mmc/omap_hsmmc.c | 12 ++++++------
 2 files changed, 15 insertions(+), 6 deletions(-)

Comments

Tom Rini Feb. 23, 2018, 12:21 p.m. UTC | #1
On Fri, Feb 23, 2018 at 10:40:18AM +0100, Jean-Jacques Hiblot wrote:
> Some platforms don't have ADMA controllers. For those platforms, compiling
> it out reduces the size of the binary by about 600 bytes.
> Leaving the support in doesn't break things as the driver checks at runtime
> if the ADMA2 controller is present.
> 
> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
> 
> ---
> 
> Changes in v2:
> - Use a Kconfig option to compile out the ADMA support instead of relying
>   on the platform architecture
> 
>  drivers/mmc/Kconfig      |  9 +++++++++
>  drivers/mmc/omap_hsmmc.c | 12 ++++++------
>  2 files changed, 15 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
> index f2d8256..88a1359 100644
> --- a/drivers/mmc/Kconfig
> +++ b/drivers/mmc/Kconfig
> @@ -239,6 +239,15 @@ config MMC_OMAP_HS
>  
>  	  If unsure, say N.
>  
> +config MMC_OMAP_HS_ADMA
> +	bool "ADMA support for OMAP HS MMC"
> +	depends on MMC_OMAP_HS && !OMAP34XX
> +	default y if !AM33XX

Is this logic really the right restrictions?  Does it work on some
AM33XX platforms (AM43xx?) and just never OMAP34XX?  Thanks!
Jean-Jacques Hiblot Feb. 23, 2018, 12:47 p.m. UTC | #2
On 23/02/2018 13:21, Tom Rini wrote:
> On Fri, Feb 23, 2018 at 10:40:18AM +0100, Jean-Jacques Hiblot wrote:
>> Some platforms don't have ADMA controllers. For those platforms, compiling
>> it out reduces the size of the binary by about 600 bytes.
>> Leaving the support in doesn't break things as the driver checks at runtime
>> if the ADMA2 controller is present.
>>
>> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
>>
>> ---
>>
>> Changes in v2:
>> - Use a Kconfig option to compile out the ADMA support instead of relying
>>    on the platform architecture
>>
>>   drivers/mmc/Kconfig      |  9 +++++++++
>>   drivers/mmc/omap_hsmmc.c | 12 ++++++------
>>   2 files changed, 15 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
>> index f2d8256..88a1359 100644
>> --- a/drivers/mmc/Kconfig
>> +++ b/drivers/mmc/Kconfig
>> @@ -239,6 +239,15 @@ config MMC_OMAP_HS
>>   
>>   	  If unsure, say N.
>>   
>> +config MMC_OMAP_HS_ADMA
>> +	bool "ADMA support for OMAP HS MMC"
>> +	depends on MMC_OMAP_HS && !OMAP34XX
>> +	default y if !AM33XX
> Is this logic really the right restrictions?  Does it work on some
> AM33XX platforms (AM43xx?) and just never OMAP34XX?  Thanks!
Starting with platform am33xx there is a way to check if the ADMA 
controller is present or not by reading a register. This register is not 
available in OMAP34XX.
That being said I don't think that ADMA is available on any variant of 
am33xx.

JJ
>
Tom Rini Feb. 23, 2018, 12:57 p.m. UTC | #3
On Fri, Feb 23, 2018 at 01:47:36PM +0100, Jean-Jacques Hiblot wrote:
> 
> 
> On 23/02/2018 13:21, Tom Rini wrote:
> >On Fri, Feb 23, 2018 at 10:40:18AM +0100, Jean-Jacques Hiblot wrote:
> >>Some platforms don't have ADMA controllers. For those platforms, compiling
> >>it out reduces the size of the binary by about 600 bytes.
> >>Leaving the support in doesn't break things as the driver checks at runtime
> >>if the ADMA2 controller is present.
> >>
> >>Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
> >>
> >>---
> >>
> >>Changes in v2:
> >>- Use a Kconfig option to compile out the ADMA support instead of relying
> >>   on the platform architecture
> >>
> >>  drivers/mmc/Kconfig      |  9 +++++++++
> >>  drivers/mmc/omap_hsmmc.c | 12 ++++++------
> >>  2 files changed, 15 insertions(+), 6 deletions(-)
> >>
> >>diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
> >>index f2d8256..88a1359 100644
> >>--- a/drivers/mmc/Kconfig
> >>+++ b/drivers/mmc/Kconfig
> >>@@ -239,6 +239,15 @@ config MMC_OMAP_HS
> >>  	  If unsure, say N.
> >>+config MMC_OMAP_HS_ADMA
> >>+	bool "ADMA support for OMAP HS MMC"
> >>+	depends on MMC_OMAP_HS && !OMAP34XX
> >>+	default y if !AM33XX
> >Is this logic really the right restrictions?  Does it work on some
> >AM33XX platforms (AM43xx?) and just never OMAP34XX?  Thanks!
> Starting with platform am33xx there is a way to check if the ADMA controller
> is present or not by reading a register. This register is not available in
> OMAP34XX.
> That being said I don't think that ADMA is available on any variant of
> am33xx.

OK, thanks!

Reviewed-by: Tom Rini <trini@konsulko.com>
Jaehoon Chung Feb. 26, 2018, 1:54 a.m. UTC | #4
On 02/23/2018 09:57 PM, Tom Rini wrote:
> On Fri, Feb 23, 2018 at 01:47:36PM +0100, Jean-Jacques Hiblot wrote:
>>
>>
>> On 23/02/2018 13:21, Tom Rini wrote:
>>> On Fri, Feb 23, 2018 at 10:40:18AM +0100, Jean-Jacques Hiblot wrote:
>>>> Some platforms don't have ADMA controllers. For those platforms, compiling
>>>> it out reduces the size of the binary by about 600 bytes.
>>>> Leaving the support in doesn't break things as the driver checks at runtime
>>>> if the ADMA2 controller is present.
>>>>
>>>> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
>>>>
>>>> ---
>>>>
>>>> Changes in v2:
>>>> - Use a Kconfig option to compile out the ADMA support instead of relying
>>>>   on the platform architecture
>>>>
>>>>  drivers/mmc/Kconfig      |  9 +++++++++
>>>>  drivers/mmc/omap_hsmmc.c | 12 ++++++------
>>>>  2 files changed, 15 insertions(+), 6 deletions(-)
>>>>
>>>> diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
>>>> index f2d8256..88a1359 100644
>>>> --- a/drivers/mmc/Kconfig
>>>> +++ b/drivers/mmc/Kconfig
>>>> @@ -239,6 +239,15 @@ config MMC_OMAP_HS
>>>>  	  If unsure, say N.
>>>> +config MMC_OMAP_HS_ADMA
>>>> +	bool "ADMA support for OMAP HS MMC"
>>>> +	depends on MMC_OMAP_HS && !OMAP34XX
>>>> +	default y if !AM33XX
>>> Is this logic really the right restrictions?  Does it work on some
>>> AM33XX platforms (AM43xx?) and just never OMAP34XX?  Thanks!
>> Starting with platform am33xx there is a way to check if the ADMA controller
>> is present or not by reading a register. This register is not available in
>> OMAP34XX.
>> That being said I don't think that ADMA is available on any variant of
>> am33xx.
> 
> OK, thanks!
> 
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot-mmc. Thanks!

Best Regards,
Jaehoon Chung

>
diff mbox series

Patch

diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
index f2d8256..88a1359 100644
--- a/drivers/mmc/Kconfig
+++ b/drivers/mmc/Kconfig
@@ -239,6 +239,15 @@  config MMC_OMAP_HS
 
 	  If unsure, say N.
 
+config MMC_OMAP_HS_ADMA
+	bool "ADMA support for OMAP HS MMC"
+	depends on MMC_OMAP_HS && !OMAP34XX
+	default y if !AM33XX
+	help
+	  This enables support for the ADMA2 controller (SDA3.00 Part A2 DMA
+	  controller). If supported by the hardware, selecting this option will
+	  increase performances.
+
 config MMC_OMAP36XX_PINS
 	bool "Enable MMC1 on OMAP36xx/37xx"
 	depends on OMAP34XX && MMC_OMAP_HS
diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c
index 8b57edc..3d2836d 100644
--- a/drivers/mmc/omap_hsmmc.c
+++ b/drivers/mmc/omap_hsmmc.c
@@ -93,7 +93,7 @@  struct omap_hsmmc_data {
 	enum bus_mode mode;
 #endif
 	u8 controller_flags;
-#ifndef CONFIG_OMAP34XX
+#ifdef CONFIG_MMC_OMAP_HS_ADMA
 	struct omap_hsmmc_adma_desc *adma_desc_table;
 	uint desc_slot;
 #endif
@@ -117,7 +117,7 @@  struct omap_mmc_of_data {
 	u8 controller_flags;
 };
 
-#ifndef CONFIG_OMAP34XX
+#ifdef CONFIG_MMC_OMAP_HS_ADMA
 struct omap_hsmmc_adma_desc {
 	u8 attr;
 	u8 reserved;
@@ -741,7 +741,7 @@  static int omap_hsmmc_init_setup(struct mmc *mmc)
 			return -ETIMEDOUT;
 		}
 	}
-#ifndef CONFIG_OMAP34XX
+#ifdef CONFIG_MMC_OMAP_HS_ADMA
 	reg_val = readl(&mmc_base->hl_hwinfo);
 	if (reg_val & MADMA_EN)
 		priv->controller_flags |= OMAP_HSMMC_USE_ADMA;
@@ -834,7 +834,7 @@  static void mmc_reset_controller_fsm(struct hsmmc *mmc_base, u32 bit)
 	}
 }
 
-#ifndef CONFIG_OMAP34XX
+#ifdef CONFIG_MMC_OMAP_HS_ADMA
 static void omap_hsmmc_adma_desc(struct mmc *mmc, char *buf, u16 len, bool end)
 {
 	struct omap_hsmmc_data *priv = omap_hsmmc_get_data(mmc);
@@ -1037,7 +1037,7 @@  static int omap_hsmmc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd,
 		else
 			flags |= (DP_DATA | DDIR_WRITE);
 
-#ifndef CONFIG_OMAP34XX
+#ifdef CONFIG_MMC_OMAP_HS_ADMA
 		if ((priv->controller_flags & OMAP_HSMMC_USE_ADMA) &&
 		    !mmc_is_tuning_cmd(cmd->cmdidx)) {
 			omap_hsmmc_prepare_data(mmc, data);
@@ -1082,7 +1082,7 @@  static int omap_hsmmc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd,
 		}
 	}
 
-#ifndef CONFIG_OMAP34XX
+#ifdef CONFIG_MMC_OMAP_HS_ADMA
 	if ((priv->controller_flags & OMAP_HSMMC_USE_ADMA) && data &&
 	    !mmc_is_tuning_cmd(cmd->cmdidx)) {
 		u32 sz_mb, timeout;