driverdev-devel.linuxdriverproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] staging: dt-bindings: wilc1000: add optional rtc_clk property
@ 2019-09-04 13:33 Eugen.Hristev
  2019-09-04 13:34 ` [PATCH 2/2] staging: wilc1000: look for rtc_clk clock Eugen.Hristev
  2019-09-05  6:09 ` [PATCH 1/2] staging: dt-bindings: wilc1000: add optional rtc_clk property Ajay.Kathat
  0 siblings, 2 replies; 6+ messages in thread
From: Eugen.Hristev @ 2019-09-04 13:33 UTC (permalink / raw)
  To: Adham.Abozaeid, Ajay.Kathat, linux-wireless, devel, linux-kernel
  Cc: Eugen.Hristev

From: Eugen Hristev <eugen.hristev@microchip.com>

Add bindings for optional rtc clock pin.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
---
 drivers/staging/wilc1000/microchip,wilc1000,sdio.txt | 8 +++++++-
 drivers/staging/wilc1000/microchip,wilc1000,spi.txt  | 8 ++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/microchip,wilc1000,sdio.txt b/drivers/staging/wilc1000/microchip,wilc1000,sdio.txt
index 4f7d1c2..da52359 100644
--- a/drivers/staging/wilc1000/microchip,wilc1000,sdio.txt
+++ b/drivers/staging/wilc1000/microchip,wilc1000,sdio.txt
@@ -10,7 +10,9 @@ Required properties:
 
 Optional:
 - bus-width	:	Number of data lines wired up the slot. Default 1 bit.
-
+- rtc_clk	:	Clock connected on the rtc clock line. Must be assigned
+			a frequency with assigned-clocks property, and must be
+			connected to a clock provider.
 
 Examples:
 mmc1: mmc@fc000000 {
@@ -24,6 +26,10 @@ mmc1: mmc@fc000000 {
 		wilc_sdio@0 {
 			compatible = "microchip,wilc1000-sdio";
 			irq-gpios = <&pioC 27 0>;
+			clocks = <&pck1>;
+			clock-names = "rtc_clk";
+			assigned-clocks = <&pck1>;
+			assigned-clock-rates = <32768>;
 			status = "okay";
 			reg = <0>;
 			bus-width = <4>;
diff --git a/drivers/staging/wilc1000/microchip,wilc1000,spi.txt b/drivers/staging/wilc1000/microchip,wilc1000,spi.txt
index 87db87b..3423693 100644
--- a/drivers/staging/wilc1000/microchip,wilc1000,spi.txt
+++ b/drivers/staging/wilc1000/microchip,wilc1000,spi.txt
@@ -9,6 +9,10 @@ Required properties:
 - reg			: Chip select address of device
 - irq-gpios		: Connect to a host IRQ
 
+Optional:
+- rtc_clk	:	Clock connected on the rtc clock line. Must be assigned
+			a frequency with assigned-clocks property, and must be
+			connected to a clock provider.
 
 Examples:
 
@@ -21,6 +25,10 @@ spi1: spi@fc018000 {
 			spi-max-frequency = <48000000>;
 			reg = <0>;
 			irq-gpios = <&pioC 27 0>;
+			clocks = <&pck1>;
+			clock-names = "rtc_clk";
+			assigned-clocks = <&pck1>;
+			assigned-clock-rates = <32768>;
 			status = "okay";
 		};
 };
-- 
2.7.4

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] staging: wilc1000: look for rtc_clk clock
  2019-09-04 13:33 [PATCH 1/2] staging: dt-bindings: wilc1000: add optional rtc_clk property Eugen.Hristev
@ 2019-09-04 13:34 ` Eugen.Hristev
  2019-09-05  7:38   ` Greg KH
  2019-09-05  6:09 ` [PATCH 1/2] staging: dt-bindings: wilc1000: add optional rtc_clk property Ajay.Kathat
  1 sibling, 1 reply; 6+ messages in thread
From: Eugen.Hristev @ 2019-09-04 13:34 UTC (permalink / raw)
  To: Adham.Abozaeid, Ajay.Kathat, linux-wireless, devel, linux-kernel
  Cc: Eugen.Hristev

From: Eugen Hristev <eugen.hristev@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: Eugen Hristev <eugen.hristev@microchip.com>
---
 drivers/staging/wilc1000/wilc_sdio.c          | 14 ++++++++++++++
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  1 +
 2 files changed, 15 insertions(+)

diff --git a/drivers/staging/wilc1000/wilc_sdio.c b/drivers/staging/wilc1000/wilc_sdio.c
index 4c1c81f..41b69fd 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -4,6 +4,7 @@
  * All rights reserved.
  */
 
+#include <linux/clk.h>
 #include <linux/mmc/sdio_func.h>
 #include <linux/mmc/host.h>
 
@@ -151,6 +152,12 @@ static int wilc_sdio_probe(struct sdio_func *func,
 	wilc->dev = &func->dev;
 	wilc->gpio_irq = gpio;
 
+	wilc->rtc_clk = devm_clk_get(&func->card->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);
+
 	dev_info(&func->dev, "Driver Initializing success\n");
 	return 0;
 }
@@ -162,6 +169,10 @@ static void wilc_sdio_remove(struct sdio_func *func)
 	/* 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);
 }
 
@@ -193,6 +204,9 @@ static int wilc_sdio_suspend(struct device *dev)
 	dev_info(dev, "sdio suspend\n");
 	chip_wakeup(wilc);
 
+	if (!IS_ERR(wilc->rtc_clk))
+		clk_disable_unprepare(wilc->rtc_clk);
+
 	if (!wilc->suspend_event) {
 		wilc_chip_sleep_manually(wilc);
 	} else {
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 1e74a08..d8f3ebe 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -217,6 +217,7 @@ struct wilc {
 	int io_type;
 	s8 mac_status;
 	struct gpio_desc *gpio_irq;
+	struct clk *rtc_clk;
 	bool initialized;
 	int dev_irq_num;
 	int close;
-- 
2.7.4

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] staging: dt-bindings: wilc1000: add optional rtc_clk property
  2019-09-04 13:33 [PATCH 1/2] staging: dt-bindings: wilc1000: add optional rtc_clk property Eugen.Hristev
  2019-09-04 13:34 ` [PATCH 2/2] staging: wilc1000: look for rtc_clk clock Eugen.Hristev
@ 2019-09-05  6:09 ` Ajay.Kathat
  2019-09-05  7:37   ` Greg KH
  1 sibling, 1 reply; 6+ messages in thread
From: Ajay.Kathat @ 2019-09-05  6:09 UTC (permalink / raw)
  To: Eugen.Hristev, Adham.Abozaeid, linux-wireless, devel, linux-kernel

Hi Eugen,

On 04-Sep-19 7:03 PM, Eugen Hristev - M18282 wrote:
> From: Eugen Hristev <eugen.hristev@microchip.com>
> 
> Add bindings for optional rtc clock pin.
> 
> Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>

Thanks for sending the patch series. The changes in this series looks
good to me.

Acked-by: Ajay Singh <ajay.kathat@microchip.com>


Regards,
Ajay

> ---
>  drivers/staging/wilc1000/microchip,wilc1000,sdio.txt | 8 +++++++-
>  drivers/staging/wilc1000/microchip,wilc1000,spi.txt  | 8 ++++++++
>  2 files changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/wilc1000/microchip,wilc1000,sdio.txt b/drivers/staging/wilc1000/microchip,wilc1000,sdio.txt
> index 4f7d1c2..da52359 100644
> --- a/drivers/staging/wilc1000/microchip,wilc1000,sdio.txt
> +++ b/drivers/staging/wilc1000/microchip,wilc1000,sdio.txt
> @@ -10,7 +10,9 @@ Required properties:
>  
>  Optional:
>  - bus-width	:	Number of data lines wired up the slot. Default 1 bit.
> -
> +- rtc_clk	:	Clock connected on the rtc clock line. Must be assigned
> +			a frequency with assigned-clocks property, and must be
> +			connected to a clock provider.
>  
>  Examples:
>  mmc1: mmc@fc000000 {
> @@ -24,6 +26,10 @@ mmc1: mmc@fc000000 {
>  		wilc_sdio@0 {
>  			compatible = "microchip,wilc1000-sdio";
>  			irq-gpios = <&pioC 27 0>;
> +			clocks = <&pck1>;
> +			clock-names = "rtc_clk";
> +			assigned-clocks = <&pck1>;
> +			assigned-clock-rates = <32768>;
>  			status = "okay";
>  			reg = <0>;
>  			bus-width = <4>;
> diff --git a/drivers/staging/wilc1000/microchip,wilc1000,spi.txt b/drivers/staging/wilc1000/microchip,wilc1000,spi.txt
> index 87db87b..3423693 100644
> --- a/drivers/staging/wilc1000/microchip,wilc1000,spi.txt
> +++ b/drivers/staging/wilc1000/microchip,wilc1000,spi.txt
> @@ -9,6 +9,10 @@ Required properties:
>  - reg			: Chip select address of device
>  - irq-gpios		: Connect to a host IRQ
>  
> +Optional:
> +- rtc_clk	:	Clock connected on the rtc clock line. Must be assigned
> +			a frequency with assigned-clocks property, and must be
> +			connected to a clock provider.
>  
>  Examples:
>  
> @@ -21,6 +25,10 @@ spi1: spi@fc018000 {
>  			spi-max-frequency = <48000000>;
>  			reg = <0>;
>  			irq-gpios = <&pioC 27 0>;
> +			clocks = <&pck1>;
> +			clock-names = "rtc_clk";
> +			assigned-clocks = <&pck1>;
> +			assigned-clock-rates = <32768>;
>  			status = "okay";
>  		};
>  };
> 
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] staging: dt-bindings: wilc1000: add optional rtc_clk property
  2019-09-05  6:09 ` [PATCH 1/2] staging: dt-bindings: wilc1000: add optional rtc_clk property Ajay.Kathat
@ 2019-09-05  7:37   ` Greg KH
  2019-09-05 11:34     ` Ajay.Kathat
  0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2019-09-05  7:37 UTC (permalink / raw)
  To: Ajay.Kathat
  Cc: devel, Eugen.Hristev, linux-wireless, linux-kernel, Adham.Abozaeid

On Thu, Sep 05, 2019 at 06:09:43AM +0000, Ajay.Kathat@microchip.com wrote:
> Hi Eugen,
> 
> On 04-Sep-19 7:03 PM, Eugen Hristev - M18282 wrote:
> > From: Eugen Hristev <eugen.hristev@microchip.com>
> > 
> > Add bindings for optional rtc clock pin.
> > 
> > Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
> 
> Thanks for sending the patch series. The changes in this series looks
> good to me.
> 
> Acked-by: Ajay Singh <ajay.kathat@microchip.com>

This is good, but, you are adding new features to the driver, when it is
still in the staging directory.  What's the plan on getting it out of
here?  What is left to do?

thanks,

greg k-h
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] staging: wilc1000: look for rtc_clk clock
  2019-09-04 13:34 ` [PATCH 2/2] staging: wilc1000: look for rtc_clk clock Eugen.Hristev
@ 2019-09-05  7:38   ` Greg KH
  0 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2019-09-05  7:38 UTC (permalink / raw)
  To: Eugen.Hristev
  Cc: devel, Ajay.Kathat, linux-wireless, linux-kernel, Adham.Abozaeid

On Wed, Sep 04, 2019 at 01:34:01PM +0000, Eugen.Hristev@microchip.com wrote:
> From: Eugen Hristev <eugen.hristev@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: Eugen Hristev <eugen.hristev@microchip.com>
> Acked-by: Ajay Singh <ajay.kathat@microchip.com>
> ---
>  drivers/staging/wilc1000/wilc_sdio.c          | 14 ++++++++++++++
>  drivers/staging/wilc1000/wilc_wfi_netdevice.h |  1 +
>  2 files changed, 15 insertions(+)

This patch does not apply to my tree at all.

Please redo it against staging-next and resend the series, with Ajay's
ack added to it.

thanks,

greg k-h
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] staging: dt-bindings: wilc1000: add optional rtc_clk property
  2019-09-05  7:37   ` Greg KH
@ 2019-09-05 11:34     ` Ajay.Kathat
  0 siblings, 0 replies; 6+ messages in thread
From: Ajay.Kathat @ 2019-09-05 11:34 UTC (permalink / raw)
  To: greg; +Cc: devel, Eugen.Hristev, linux-wireless, linux-kernel, Adham.Abozaeid

Hi Greg,

On 05-Sep-19 1:07 PM, Greg KH wrote:
> On Thu, Sep 05, 2019 at 06:09:43AM +0000, Ajay.Kathat@microchip.com wrote:
>> Hi Eugen,
>>
>> On 04-Sep-19 7:03 PM, Eugen Hristev - M18282 wrote:
>>> From: Eugen Hristev <eugen.hristev@microchip.com>
>>>
>>> Add bindings for optional rtc clock pin.
>>>
>>> Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
>>
>> Thanks for sending the patch series. The changes in this series looks
>> good to me.
>>
>> Acked-by: Ajay Singh <ajay.kathat@microchip.com>
> 
> This is good, but, you are adding new features to the driver, when it is
> still in the staging directory.  What's the plan on getting it out of
> here?  What is left to do?
> 

The plan is to get this driver reviewed and identify if there are any
more TODO items. Waiting for the review to complete.

During the last review [1], we have received comment to simplify the
packing of WID commands by avoiding the translation layer. We had done
some improvements in this but still, there are few items under discussion.
But I am not sure if this is a blocker for mainline or can be addressed
later.
At this time, I don't know if there are any more TODO for this driver.
Currently also working on testing and fixing bugs.

[1].
https://lore.kernel.org/linux-wireless/1562896697-8002-1-git-send-email-ajay.kathat@microchip.com/

Regards,
Ajay
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-09-05 11:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-04 13:33 [PATCH 1/2] staging: dt-bindings: wilc1000: add optional rtc_clk property Eugen.Hristev
2019-09-04 13:34 ` [PATCH 2/2] staging: wilc1000: look for rtc_clk clock Eugen.Hristev
2019-09-05  7:38   ` Greg KH
2019-09-05  6:09 ` [PATCH 1/2] staging: dt-bindings: wilc1000: add optional rtc_clk property Ajay.Kathat
2019-09-05  7:37   ` Greg KH
2019-09-05 11:34     ` Ajay.Kathat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).