From: Palmer Dabbelt <palmer@sifive.com>
To: davem@davemloft.net
Cc: nicolas.ferre@microchip.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, Palmer Dabbelt <palmer@sifive.com>
Subject: [PATCH 1/2] net: macb: Fix compilation on systems without COMMON_CLK
Date: Sun, 23 Jun 2019 23:16:02 -0700 [thread overview]
Message-ID: <20190624061603.1704-2-palmer@sifive.com> (raw)
In-Reply-To: <20190624061603.1704-1-palmer@sifive.com>
The patch to add support for the FU540-C000 added a dependency on
COMMON_CLK, but didn't express that via Kconfig. This fixes the build
failure by adding CONFIG_MACB_FU540, which depends on COMMON_CLK and
conditionally enables the FU540-C000 support.
I've built this with a powerpc allyesconfig (which pointed out the bug)
and on RISC-V, manually checking to ensure the code was built. I
haven't even booted the resulting kernels.
Fixes: c218ad559020 ("macb: Add support for SiFive FU540-C000")
Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
---
drivers/net/ethernet/cadence/Kconfig | 11 +++++++++++
drivers/net/ethernet/cadence/macb_main.c | 12 ++++++++++++
2 files changed, 23 insertions(+)
diff --git a/drivers/net/ethernet/cadence/Kconfig b/drivers/net/ethernet/cadence/Kconfig
index 1766697c9c5a..74ee2bfd2369 100644
--- a/drivers/net/ethernet/cadence/Kconfig
+++ b/drivers/net/ethernet/cadence/Kconfig
@@ -40,6 +40,17 @@ config MACB_USE_HWSTAMP
---help---
Enable IEEE 1588 Precision Time Protocol (PTP) support for MACB.
+config MACB_FU540
+ bool "Enable support for the SiFive FU540 clock controller"
+ depends on MACB && COMMON_CLK
+ default y
+ ---help---
+ Enable support for the MACB/GEM clock controller on the SiFive
+ FU540-C000. This device is necessary for switching between 10/100
+ and gigabit modes on the FU540-C000 SoC, without which it is only
+ possible to bring up the Ethernet link in whatever mode the
+ bootloader probed.
+
config MACB_PCI
tristate "Cadence PCI MACB/GEM support"
depends on MACB && PCI && COMMON_CLK
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index c545c5b435d8..a903dfdd4183 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -41,6 +41,7 @@
#include <linux/pm_runtime.h>
#include "macb.h"
+#ifdef CONFIG_MACB_FU540
/* This structure is only used for MACB on SiFive FU540 devices */
struct sifive_fu540_macb_mgmt {
void __iomem *reg;
@@ -49,6 +50,7 @@ struct sifive_fu540_macb_mgmt {
};
static struct sifive_fu540_macb_mgmt *mgmt;
+#endif
#define MACB_RX_BUFFER_SIZE 128
#define RX_BUFFER_MULTIPLE 64 /* bytes */
@@ -3956,6 +3958,7 @@ static int at91ether_init(struct platform_device *pdev)
return 0;
}
+#ifdef CONFIG_MACB_FU540
static unsigned long fu540_macb_tx_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate)
{
@@ -4056,7 +4059,9 @@ static int fu540_c000_init(struct platform_device *pdev)
return macb_init(pdev);
}
+#endif
+#ifdef CONFIG_MACB_FU540
static const struct macb_config fu540_c000_config = {
.caps = MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_JUMBO |
MACB_CAPS_GEM_HAS_PTP,
@@ -4065,6 +4070,7 @@ static const struct macb_config fu540_c000_config = {
.init = fu540_c000_init,
.jumbo_max_len = 10240,
};
+#endif
static const struct macb_config at91sam9260_config = {
.caps = MACB_CAPS_USRIO_HAS_CLKEN | MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII,
@@ -4155,7 +4161,9 @@ static const struct of_device_id macb_dt_ids[] = {
{ .compatible = "cdns,emac", .data = &emac_config },
{ .compatible = "cdns,zynqmp-gem", .data = &zynqmp_config},
{ .compatible = "cdns,zynq-gem", .data = &zynq_config },
+#ifdef CONFIG_MACB_FU540
{ .compatible = "sifive,fu540-macb", .data = &fu540_c000_config },
+#endif
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, macb_dt_ids);
@@ -4363,7 +4371,9 @@ static int macb_probe(struct platform_device *pdev)
err_disable_clocks:
clk_disable_unprepare(tx_clk);
+#ifdef CONFIG_MACB_FU540
clk_unregister(tx_clk);
+#endif
clk_disable_unprepare(hclk);
clk_disable_unprepare(pclk);
clk_disable_unprepare(rx_clk);
@@ -4398,7 +4408,9 @@ static int macb_remove(struct platform_device *pdev)
pm_runtime_dont_use_autosuspend(&pdev->dev);
if (!pm_runtime_suspended(&pdev->dev)) {
clk_disable_unprepare(bp->tx_clk);
+#ifdef CONFIG_MACB_FU540
clk_unregister(bp->tx_clk);
+#endif
clk_disable_unprepare(bp->hclk);
clk_disable_unprepare(bp->pclk);
clk_disable_unprepare(bp->rx_clk);
--
2.21.0
next prev parent reply other threads:[~2019-06-24 6:19 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-24 6:16 Palmer Dabbelt
2019-06-24 6:16 ` Palmer Dabbelt [this message]
2019-06-24 9:40 ` [PATCH 1/2] " Nicolas.Ferre
2019-06-24 9:57 ` Palmer Dabbelt
2019-06-24 15:22 ` Nicolas.Ferre
2019-06-25 5:16 ` Harini Katakam
2019-06-24 6:16 ` [PATCH 2/2] net: macb: Kconfig: Rename Atmel to Cadence Palmer Dabbelt
2019-06-24 9:49 ` Nicolas.Ferre
2019-06-24 9:57 ` Palmer Dabbelt
2019-06-24 15:42 ` Nicolas.Ferre
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190624061603.1704-2-palmer@sifive.com \
--to=palmer@sifive.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nicolas.ferre@microchip.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®