Skip to contentSkip to conversation

staging: dt-bindings: wilc1000: add optional rtc_clk property

PATCH Superseded [email protected] 4 participants 6 messages Sep 4, 2019 – Sep 5, 2019 Staging

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#1 lore raw

PATCH 2/2 staging: wilc1000: look for rtc_clk clock

In reply to [email protected]

From: Eugen Hristev <[email protected]>

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.

---
 drivers/staging/wilc1000/wilc_sdio.c          | 14 ++++++++++++++
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  1 +
 2 files changed, 15 insertions(+)
drivers/staging/wilc1000/wilc_sdio.c +14 -0
index 4c1c81f..41b69fd 100644
@@ -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 {
drivers/staging/wilc1000/wilc_wfi_netdevice.h +1 -0
index 1e74a08..d8f3ebe 100644
@@ -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;
Signature · 1 line
2.7.4
#0 lore raw

PATCH 1/2 staging: dt-bindings: wilc1000: add optional rtc_clk property

From: Eugen Hristev <[email protected]>

Add bindings for optional rtc clock pin.

---
 drivers/staging/wilc1000/microchip,wilc1000,sdio.txt | 8 +++++++-
 drivers/staging/wilc1000/microchip,wilc1000,spi.txt  | 8 ++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)
drivers/staging/wilc1000/microchip,wilc1000,sdio.txt +7 -1
index 4f7d1c2..da52359 100644
@@ -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>;
drivers/staging/wilc1000/microchip,wilc1000,spi.txt +8 -0
index 87db87b..3423693 100644
@@ -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";
 		};
 };
Signature · 1 line
2.7.4
Acked-by on v1 1/2
#3 lore raw

Hi Eugen,

Quoted 5 lines · On 04-Sep-19 7:03 PM, Eugen Hristev - M18282 wrote:

From: Eugen Hristev <[email protected]>

Add bindings for optional rtc clock pin.

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

Regards,
Ajay

Quoted 58 lines
---
 drivers/staging/wilc1000/microchip,wilc1000,sdio.txt | 8 +++++++-
 drivers/staging/wilc1000/microchip,wilc1000,spi.txt  | 8 ++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)
drivers/staging/wilc1000/microchip,wilc1000,sdio.txt +7 -1
index 4f7d1c2..da52359 100644
@@ -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>;
drivers/staging/wilc1000/microchip,wilc1000,spi.txt +8 -0
index 87db87b..3423693 100644
@@ -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";
 		};
 };
#4 lore raw
Quoted 5 lines · On Thu, Sep 05, 2019 at 06:09:43AM +0000, [email protected] wrote:

Hi Eugen,

Quoted 2 lines · On 04-Sep-19 7:03 PM, Eugen Hristev - M18282 wrote:

From: Eugen Hristev <[email protected]>

Quoted 8 lines
Quoted 3 lines

Add bindings for optional rtc clock pin.

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

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

maintainer
#2 lore raw

Re: [PATCH 2/2] staging: wilc1000: look for rtc_clk clock

In reply to [email protected]
Quoted 7 lines · On Wed, Sep 04, 2019 at 01:34:01PM +0000, [email protected] wrote:

From: Eugen Hristev <[email protected]>

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.

Quoted 6 lines
---
 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

#5 lore raw
In reply to Greg KH

Hi Greg,

Quoted 10 lines · Greg KH
Quoted 9 lines · On Thu, Sep 05, 2019 at 06:09:43AM +0000, [email protected] wrote:

Hi Eugen,

Quoted 5 lines · On 04-Sep-19 7:03 PM, Eugen Hristev - M18282 wrote:

From: Eugen Hristev <[email protected]>

Add bindings for optional rtc clock pin.

Quoted 9 lines
Quoted 4 lines

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

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/[email protected]/

Regards,
Ajay