diff mbox series

staging: wilc1000: look for rtc_clk clock in spi mode

Message ID 20190916193701.20755-1-adham.abozaeid@microchip.com (mailing list archive)
State Not Applicable
Delegated to: Johannes Berg
Headers show
Series staging: wilc1000: look for rtc_clk clock in spi mode | expand

Commit Message

Adham Abozaeid Sept. 16, 2019, 7:37 p.m. UTC
From: Adham Abozaeid <adham.abozaeid@microchip.com>

If rtc_clk is provided from DT, use it and enable it.
This is optional.
The signal may be hardcoded and no need to be requested,
but if DT provides it, use it.

Signed-off-by: Adham Abozaeid <adham.abozaeid@microchip.com>
---
 drivers/staging/wilc1000/wilc_spi.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Adham Abozaeid Sept. 17, 2019, 1:03 a.m. UTC | #1
On 9/16/19 5:49 PM, kbuild test robot wrote:
>
> [auto build test ERROR on linus/master]
> [cannot apply to v5.3 next-20190916]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
This patch applies for staging-testing, not linus/master.

Thanks,
Adham
Claudiu Beznea Sept. 17, 2019, 7:11 a.m. UTC | #2
This is already present in staging-next (see [1] and [2])

[1] https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/commit/drivers/staging/wilc1000?h=staging-next&id=8692b047e86cff448af1564a8bdda770d2deb567
[2] https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/commit/drivers/staging/wilc1000?h=staging-next&id=ae8779e1983d6361620f1f6d3f76064edee733c0

On 16.09.2019 22:37, Adham.Abozaeid@microchip.com wrote:
> External E-Mail
> 
> 
> From: Adham Abozaeid <adham.abozaeid@microchip.com>
> 
> If rtc_clk is provided from DT, use it and enable it.
> This is optional.
> The signal may be hardcoded and no need to be requested,
> but if DT provides it, use it.
> 
> Signed-off-by: Adham Abozaeid <adham.abozaeid@microchip.com>
> ---
>  drivers/staging/wilc1000/wilc_spi.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c
> index 3c1ae9e9f9aa..166455a969bf 100644
> --- a/drivers/staging/wilc1000/wilc_spi.c
> +++ b/drivers/staging/wilc1000/wilc_spi.c
> @@ -4,6 +4,7 @@
>   * All rights reserved.
>   */
>  
> +#include <linux/clk.h>
>  #include <linux/spi/spi.h>
>  
>  #include "wilc_wfi_netdevice.h"
> @@ -132,6 +133,12 @@ static int wilc_bus_probe(struct spi_device *spi)
>  	wilc->bus_data = spi_priv;
>  	wilc->gpio_irq = gpio;
>  
> +	wilc->rtc_clk = devm_clk_get(&spi->dev, "rtc_clk");
> +	if (PTR_ERR_OR_ZERO(wilc->rtc_clk) == -EPROBE_DEFER)
> +		return -EPROBE_DEFER;
> +	else if (!IS_ERR(wilc->rtc_clk))
> +		clk_prepare_enable(wilc->rtc_clk);
> +
>  	return 0;
>  }
>  
> @@ -142,6 +149,10 @@ static int wilc_bus_remove(struct spi_device *spi)
>  	/* free the GPIO in module remove */
>  	if (wilc->gpio_irq)
>  		gpiod_put(wilc->gpio_irq);
> +
> +	if (!IS_ERR(wilc->rtc_clk))
> +		clk_disable_unprepare(wilc->rtc_clk);
> +
>  	wilc_netdev_cleanup(wilc);
>  	return 0;
>  }
>
Claudiu Beznea Sept. 17, 2019, 7:20 a.m. UTC | #3
Now I see that your patch is for SPI interface, so, it may be necessary.

Sorry for the noise.

On 17.09.2019 10:11, Claudiu.Beznea@microchip.com wrote:
> This is already present in staging-next (see [1] and [2])
> 
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/commit/drivers/staging/wilc1000?h=staging-next&id=8692b047e86cff448af1564a8bdda770d2deb567
> [2] https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/commit/drivers/staging/wilc1000?h=staging-next&id=ae8779e1983d6361620f1f6d3f76064edee733c0
> 
> On 16.09.2019 22:37, Adham.Abozaeid@microchip.com wrote:
>> External E-Mail
>>
>>
>> From: Adham Abozaeid <adham.abozaeid@microchip.com>
>>
>> If rtc_clk is provided from DT, use it and enable it.
>> This is optional.
>> The signal may be hardcoded and no need to be requested,
>> but if DT provides it, use it.
>>
>> Signed-off-by: Adham Abozaeid <adham.abozaeid@microchip.com>
>> ---
>>  drivers/staging/wilc1000/wilc_spi.c | 11 +++++++++++
>>  1 file changed, 11 insertions(+)
>>
>> diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c
>> index 3c1ae9e9f9aa..166455a969bf 100644
>> --- a/drivers/staging/wilc1000/wilc_spi.c
>> +++ b/drivers/staging/wilc1000/wilc_spi.c
>> @@ -4,6 +4,7 @@
>>   * All rights reserved.
>>   */
>>  
>> +#include <linux/clk.h>
>>  #include <linux/spi/spi.h>
>>  
>>  #include "wilc_wfi_netdevice.h"
>> @@ -132,6 +133,12 @@ static int wilc_bus_probe(struct spi_device *spi)
>>  	wilc->bus_data = spi_priv;
>>  	wilc->gpio_irq = gpio;
>>  
>> +	wilc->rtc_clk = devm_clk_get(&spi->dev, "rtc_clk");
>> +	if (PTR_ERR_OR_ZERO(wilc->rtc_clk) == -EPROBE_DEFER)
>> +		return -EPROBE_DEFER;
>> +	else if (!IS_ERR(wilc->rtc_clk))
>> +		clk_prepare_enable(wilc->rtc_clk);
>> +
>>  	return 0;
>>  }
>>  
>> @@ -142,6 +149,10 @@ static int wilc_bus_remove(struct spi_device *spi)
>>  	/* free the GPIO in module remove */
>>  	if (wilc->gpio_irq)
>>  		gpiod_put(wilc->gpio_irq);
>> +
>> +	if (!IS_ERR(wilc->rtc_clk))
>> +		clk_disable_unprepare(wilc->rtc_clk);
>> +
>>  	wilc_netdev_cleanup(wilc);
>>  	return 0;
>>  }
>>
Chen, Rong A Sept. 18, 2019, 1:41 a.m. UTC | #4
Hi Adham,

On 9/17/19 9:03 AM, Adham.Abozaeid@microchip.com wrote:
>
> On 9/16/19 5:49 PM, kbuild test robot wrote:
>> [auto build test ERROR on linus/master]
>> [cannot apply to v5.3 next-20190916]
>> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
> This patch applies for staging-testing, not linus/master.
>
>

Thanks for clarification, we'll take a look. BTW 0day-CI introduced 
'--base' option to record base tree info in format-patch.
could you kindly add it to help robot to base on the right tree? please 
see https://stackoverflow.com/a/37406982

Best Regards,
Rong Chen
diff mbox series

Patch

diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c
index 3c1ae9e9f9aa..166455a969bf 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -4,6 +4,7 @@ 
  * All rights reserved.
  */
 
+#include <linux/clk.h>
 #include <linux/spi/spi.h>
 
 #include "wilc_wfi_netdevice.h"
@@ -132,6 +133,12 @@  static int wilc_bus_probe(struct spi_device *spi)
 	wilc->bus_data = spi_priv;
 	wilc->gpio_irq = gpio;
 
+	wilc->rtc_clk = devm_clk_get(&spi->dev, "rtc_clk");
+	if (PTR_ERR_OR_ZERO(wilc->rtc_clk) == -EPROBE_DEFER)
+		return -EPROBE_DEFER;
+	else if (!IS_ERR(wilc->rtc_clk))
+		clk_prepare_enable(wilc->rtc_clk);
+
 	return 0;
 }
 
@@ -142,6 +149,10 @@  static int wilc_bus_remove(struct spi_device *spi)
 	/* free the GPIO in module remove */
 	if (wilc->gpio_irq)
 		gpiod_put(wilc->gpio_irq);
+
+	if (!IS_ERR(wilc->rtc_clk))
+		clk_disable_unprepare(wilc->rtc_clk);
+
 	wilc_netdev_cleanup(wilc);
 	return 0;
 }