netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] net: stmmac: dwc-qos: ACPI device support
@ 2019-12-16  6:14 Ajay Gupta
  2019-12-16  6:14 ` [PATCH v3 1/2] net: stmmac: dwc-qos: use generic device api Ajay Gupta
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ajay Gupta @ 2019-12-16  6:14 UTC (permalink / raw)
  To: davem; +Cc: netdev, treding, Ajay Gupta

From: Ajay Gupta <ajayg@nvidia.com>

Hi David

Version 3 of patches have fixes for comments from Jakub Kicinski.

------
Reposting the changes after rebasing since the merge window is open now
as per http://vger.kernel.org/~davem/net-next.html

These two changes are needed to enable ACPI based devices to use stmmac
driver. First patch is to use generic device api (device_*) instead of
device tree based api (of_*). Second patch avoids clock and reset accesses
for Tegra ACPI based devices. ACPI interface will be used to access clock
and reset for Tegra ACPI devices in later patches.

Thanks
Ajay

Ajay Gupta (2):
  net: stmmac: dwc-qos: use generic device api
  net: stmmac: dwc-qos: avoid clk and reset for acpi device

 .../stmicro/stmmac/dwmac-dwc-qos-eth.c        | 24 ++++++++++++-------
 1 file changed, 15 insertions(+), 9 deletions(-)

-- 
2.17.1


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

* [PATCH v3 1/2] net: stmmac: dwc-qos: use generic device api
  2019-12-16  6:14 [PATCH v3 0/2] net: stmmac: dwc-qos: ACPI device support Ajay Gupta
@ 2019-12-16  6:14 ` Ajay Gupta
  2019-12-16  6:14 ` [PATCH v3 2/2] net: stmmac: dwc-qos: avoid clk and reset for acpi device Ajay Gupta
  2019-12-17 21:55 ` [PATCH v3 0/2] net: stmmac: dwc-qos: ACPI device support David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Ajay Gupta @ 2019-12-16  6:14 UTC (permalink / raw)
  To: davem; +Cc: netdev, treding, Ajay Gupta

From: Ajay Gupta <ajayg@nvidia.com>

Use generic device api so that driver can work both with DT
or ACPI based devices.

Signed-off-by: Ajay Gupta <ajayg@nvidia.com>
---
Change from v2->v3: None

 .../stmicro/stmmac/dwmac-dwc-qos-eth.c        | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
index dd9967aeda22..f87306b3cdae 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
@@ -40,7 +40,7 @@ struct tegra_eqos {
 static int dwc_eth_dwmac_config_dt(struct platform_device *pdev,
 				   struct plat_stmmacenet_data *plat_dat)
 {
-	struct device_node *np = pdev->dev.of_node;
+	struct device *dev = &pdev->dev;
 	u32 burst_map = 0;
 	u32 bit_index = 0;
 	u32 a_index = 0;
@@ -52,9 +52,10 @@ static int dwc_eth_dwmac_config_dt(struct platform_device *pdev,
 			return -ENOMEM;
 	}
 
-	plat_dat->axi->axi_lpi_en = of_property_read_bool(np, "snps,en-lpi");
-	if (of_property_read_u32(np, "snps,write-requests",
-				 &plat_dat->axi->axi_wr_osr_lmt)) {
+	plat_dat->axi->axi_lpi_en = device_property_read_bool(dev,
+							      "snps,en-lpi");
+	if (device_property_read_u32(dev, "snps,write-requests",
+				     &plat_dat->axi->axi_wr_osr_lmt)) {
 		/**
 		 * Since the register has a reset value of 1, if property
 		 * is missing, default to 1.
@@ -68,8 +69,8 @@ static int dwc_eth_dwmac_config_dt(struct platform_device *pdev,
 		plat_dat->axi->axi_wr_osr_lmt--;
 	}
 
-	if (of_property_read_u32(np, "snps,read-requests",
-				 &plat_dat->axi->axi_rd_osr_lmt)) {
+	if (device_property_read_u32(dev, "snps,read-requests",
+				     &plat_dat->axi->axi_rd_osr_lmt)) {
 		/**
 		 * Since the register has a reset value of 1, if property
 		 * is missing, default to 1.
@@ -82,7 +83,7 @@ static int dwc_eth_dwmac_config_dt(struct platform_device *pdev,
 		 */
 		plat_dat->axi->axi_rd_osr_lmt--;
 	}
-	of_property_read_u32(np, "snps,burst-map", &burst_map);
+	device_property_read_u32(dev, "snps,burst-map", &burst_map);
 
 	/* converts burst-map bitmask to burst array */
 	for (bit_index = 0; bit_index < 7; bit_index++) {
@@ -421,7 +422,7 @@ static int dwc_eth_dwmac_probe(struct platform_device *pdev)
 	void *priv;
 	int ret;
 
-	data = of_device_get_match_data(&pdev->dev);
+	data = device_get_match_data(&pdev->dev);
 
 	memset(&stmmac_res, 0, sizeof(struct stmmac_resources));
 
@@ -478,7 +479,7 @@ static int dwc_eth_dwmac_remove(struct platform_device *pdev)
 	const struct dwc_eth_dwmac_data *data;
 	int err;
 
-	data = of_device_get_match_data(&pdev->dev);
+	data = device_get_match_data(&pdev->dev);
 
 	err = stmmac_dvr_remove(&pdev->dev);
 	if (err < 0)
-- 
2.17.1


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

* [PATCH v3 2/2] net: stmmac: dwc-qos: avoid clk and reset for acpi device
  2019-12-16  6:14 [PATCH v3 0/2] net: stmmac: dwc-qos: ACPI device support Ajay Gupta
  2019-12-16  6:14 ` [PATCH v3 1/2] net: stmmac: dwc-qos: use generic device api Ajay Gupta
@ 2019-12-16  6:14 ` Ajay Gupta
  2019-12-17 21:55 ` [PATCH v3 0/2] net: stmmac: dwc-qos: ACPI device support David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Ajay Gupta @ 2019-12-16  6:14 UTC (permalink / raw)
  To: davem; +Cc: netdev, treding, Ajay Gupta

From: Ajay Gupta <ajayg@nvidia.com>

There are no clocks, resets or gpios referenced by Tegra ACPI
device so don't access clocks, resets or gpios interface with
ACPI device.

Clocks, resets and GPIOs for ACPI devices will be handled via
ACPI interface.

Signed-off-by: Ajay Gupta <ajayg@nvidia.com>
---
Change from v2->v3: Fix comments from Jakub.

 drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
index f87306b3cdae..2342d497348e 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
@@ -271,6 +271,7 @@ static void *tegra_eqos_probe(struct platform_device *pdev,
 			      struct plat_stmmacenet_data *data,
 			      struct stmmac_resources *res)
 {
+	struct device *dev = &pdev->dev;
 	struct tegra_eqos *eqos;
 	int err;
 
@@ -283,6 +284,9 @@ static void *tegra_eqos_probe(struct platform_device *pdev,
 	eqos->dev = &pdev->dev;
 	eqos->regs = res->addr;
 
+	if (!is_of_node(dev->fwnode))
+		goto bypass_clk_reset_gpio;
+
 	eqos->clk_master = devm_clk_get(&pdev->dev, "master_bus");
 	if (IS_ERR(eqos->clk_master)) {
 		err = PTR_ERR(eqos->clk_master);
@@ -355,6 +359,7 @@ static void *tegra_eqos_probe(struct platform_device *pdev,
 
 	usleep_range(2000, 4000);
 
+bypass_clk_reset_gpio:
 	data->fix_mac_speed = tegra_eqos_fix_speed;
 	data->init = tegra_eqos_init;
 	data->bsp_priv = eqos;
-- 
2.17.1


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

* Re: [PATCH v3 0/2] net: stmmac: dwc-qos: ACPI device support
  2019-12-16  6:14 [PATCH v3 0/2] net: stmmac: dwc-qos: ACPI device support Ajay Gupta
  2019-12-16  6:14 ` [PATCH v3 1/2] net: stmmac: dwc-qos: use generic device api Ajay Gupta
  2019-12-16  6:14 ` [PATCH v3 2/2] net: stmmac: dwc-qos: avoid clk and reset for acpi device Ajay Gupta
@ 2019-12-17 21:55 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2019-12-17 21:55 UTC (permalink / raw)
  To: ajaykuee; +Cc: netdev, treding, ajayg

From: Ajay Gupta <ajaykuee@gmail.com>
Date: Sun, 15 Dec 2019 22:14:50 -0800

> These two changes are needed to enable ACPI based devices to use stmmac
> driver. First patch is to use generic device api (device_*) instead of
> device tree based api (of_*). Second patch avoids clock and reset accesses
> for Tegra ACPI based devices. ACPI interface will be used to access clock
> and reset for Tegra ACPI devices in later patches.

Series applied, thank you.

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

end of thread, other threads:[~2019-12-17 21:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-16  6:14 [PATCH v3 0/2] net: stmmac: dwc-qos: ACPI device support Ajay Gupta
2019-12-16  6:14 ` [PATCH v3 1/2] net: stmmac: dwc-qos: use generic device api Ajay Gupta
2019-12-16  6:14 ` [PATCH v3 2/2] net: stmmac: dwc-qos: avoid clk and reset for acpi device Ajay Gupta
2019-12-17 21:55 ` [PATCH v3 0/2] net: stmmac: dwc-qos: ACPI device support David Miller

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).