All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/5] net: macb updates
@ 2013-12-11  0:07 Soren Brinkmann
  2013-12-11  0:07 ` [PATCH v2 1/5] net: macb: Migrate to dev_pm_ops Soren Brinkmann
                   ` (6 more replies)
  0 siblings, 7 replies; 16+ messages in thread
From: Soren Brinkmann @ 2013-12-11  0:07 UTC (permalink / raw)
  To: Nicolas Ferre, David Miller
  Cc: linux-kernel, netdev, Sören Brinkmann, Michal Simek

I'd really like to have Ethernet working for Zynq, so I want to at least
revive this discussion regarding this patchset. And the first four
patches should not even be too controversial.
I didn't change anything compared to my original RFC submission, except
for a typo in one of the commit messages.
Handling the tx_clk as optional clock input seems a little bit weird,
but it works on my Zynq platform and should be compatible with other
users of macb and their DT descriptions.

	Thanks,
	Sören

Soren Brinkmann (5):
  net: macb: Migrate to dev_pm_ops
  net: macb: Migrate to devm clock interface
  net: macb: Use devm_ioremap()
  net: macb: Use devm_request_irq()
  net: macb: Adjust tx_clk when link speed changes

 drivers/net/ethernet/cadence/macb.c | 126 +++++++++++++++++++++++++++---------
 drivers/net/ethernet/cadence/macb.h |   1 +
 2 files changed, 98 insertions(+), 29 deletions(-)

-- 
1.8.5.1


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

* [PATCH v2 1/5] net: macb: Migrate to dev_pm_ops
  2013-12-11  0:07 [PATCH v2 0/5] net: macb updates Soren Brinkmann
@ 2013-12-11  0:07 ` Soren Brinkmann
  2013-12-11  0:07 ` [PATCH v2 2/5] net: macb: Migrate to devm clock interface Soren Brinkmann
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 16+ messages in thread
From: Soren Brinkmann @ 2013-12-11  0:07 UTC (permalink / raw)
  To: Nicolas Ferre, David Miller
  Cc: linux-kernel, netdev, Sören Brinkmann, Michal Simek

Migrate the suspend/resume functions to use the dev_pm_ops PM interface.

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 drivers/net/ethernet/cadence/macb.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
index 92578690f6de..389ccf1362d5 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -1946,8 +1946,9 @@ static int __exit macb_remove(struct platform_device *pdev)
 }
 
 #ifdef CONFIG_PM
-static int macb_suspend(struct platform_device *pdev, pm_message_t state)
+static int macb_suspend(struct device *dev)
 {
+	struct platform_device *pdev = to_platform_device(dev);
 	struct net_device *netdev = platform_get_drvdata(pdev);
 	struct macb *bp = netdev_priv(netdev);
 
@@ -1960,8 +1961,9 @@ static int macb_suspend(struct platform_device *pdev, pm_message_t state)
 	return 0;
 }
 
-static int macb_resume(struct platform_device *pdev)
+static int macb_resume(struct device *dev)
 {
+	struct platform_device *pdev = to_platform_device(dev);
 	struct net_device *netdev = platform_get_drvdata(pdev);
 	struct macb *bp = netdev_priv(netdev);
 
@@ -1972,19 +1974,17 @@ static int macb_resume(struct platform_device *pdev)
 
 	return 0;
 }
-#else
-#define macb_suspend	NULL
-#define macb_resume	NULL
 #endif
 
+static SIMPLE_DEV_PM_OPS(macb_pm_ops, macb_suspend, macb_resume);
+
 static struct platform_driver macb_driver = {
 	.remove		= __exit_p(macb_remove),
-	.suspend	= macb_suspend,
-	.resume		= macb_resume,
 	.driver		= {
 		.name		= "macb",
 		.owner	= THIS_MODULE,
 		.of_match_table	= of_match_ptr(macb_dt_ids),
+		.pm	= &macb_pm_ops,
 	},
 };
 
-- 
1.8.5.1


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

* [PATCH v2 2/5] net: macb: Migrate to devm clock interface
  2013-12-11  0:07 [PATCH v2 0/5] net: macb updates Soren Brinkmann
  2013-12-11  0:07 ` [PATCH v2 1/5] net: macb: Migrate to dev_pm_ops Soren Brinkmann
@ 2013-12-11  0:07 ` Soren Brinkmann
  2013-12-11  0:07 ` [PATCH v2 3/5] net: macb: Use devm_ioremap() Soren Brinkmann
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 16+ messages in thread
From: Soren Brinkmann @ 2013-12-11  0:07 UTC (permalink / raw)
  To: Nicolas Ferre, David Miller
  Cc: linux-kernel, netdev, Sören Brinkmann, Michal Simek

Migrate to using the device managed interface for clocks and clean up
the associated error paths.

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
v2:
 - fix typo in commit message
---
 drivers/net/ethernet/cadence/macb.c | 32 ++++++++++++++++++++------------
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
index 389ccf1362d5..62aa136889a4 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -1790,19 +1790,31 @@ static int __init macb_probe(struct platform_device *pdev)
 	spin_lock_init(&bp->lock);
 	INIT_WORK(&bp->tx_error_task, macb_tx_error_task);
 
-	bp->pclk = clk_get(&pdev->dev, "pclk");
+	bp->pclk = devm_clk_get(&pdev->dev, "pclk");
 	if (IS_ERR(bp->pclk)) {
-		dev_err(&pdev->dev, "failed to get macb_clk\n");
+		err = PTR_ERR(bp->pclk);
+		dev_err(&pdev->dev, "failed to get macb_clk (%u)\n", err);
 		goto err_out_free_dev;
 	}
-	clk_prepare_enable(bp->pclk);
 
-	bp->hclk = clk_get(&pdev->dev, "hclk");
+	bp->hclk = devm_clk_get(&pdev->dev, "hclk");
 	if (IS_ERR(bp->hclk)) {
-		dev_err(&pdev->dev, "failed to get hclk\n");
-		goto err_out_put_pclk;
+		err = PTR_ERR(bp->hclk);
+		dev_err(&pdev->dev, "failed to get hclk (%u)\n", err);
+		goto err_out_free_dev;
+	}
+
+	err = clk_prepare_enable(bp->pclk);
+	if (err) {
+		dev_err(&pdev->dev, "failed to enable pclk (%u)\n", err);
+		goto err_out_free_dev;
+	}
+
+	err = clk_prepare_enable(bp->hclk);
+	if (err) {
+		dev_err(&pdev->dev, "failed to enable hclk (%u)\n", err);
+		goto err_out_disable_pclk;
 	}
-	clk_prepare_enable(bp->hclk);
 
 	bp->regs = ioremap(regs->start, resource_size(regs));
 	if (!bp->regs) {
@@ -1908,10 +1920,8 @@ err_out_iounmap:
 	iounmap(bp->regs);
 err_out_disable_clocks:
 	clk_disable_unprepare(bp->hclk);
-	clk_put(bp->hclk);
+err_out_disable_pclk:
 	clk_disable_unprepare(bp->pclk);
-err_out_put_pclk:
-	clk_put(bp->pclk);
 err_out_free_dev:
 	free_netdev(dev);
 err_out:
@@ -1936,9 +1946,7 @@ static int __exit macb_remove(struct platform_device *pdev)
 		free_irq(dev->irq, dev);
 		iounmap(bp->regs);
 		clk_disable_unprepare(bp->hclk);
-		clk_put(bp->hclk);
 		clk_disable_unprepare(bp->pclk);
-		clk_put(bp->pclk);
 		free_netdev(dev);
 	}
 
-- 
1.8.5.1


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

* [PATCH v2 3/5] net: macb: Use devm_ioremap()
  2013-12-11  0:07 [PATCH v2 0/5] net: macb updates Soren Brinkmann
  2013-12-11  0:07 ` [PATCH v2 1/5] net: macb: Migrate to dev_pm_ops Soren Brinkmann
  2013-12-11  0:07 ` [PATCH v2 2/5] net: macb: Migrate to devm clock interface Soren Brinkmann
@ 2013-12-11  0:07 ` Soren Brinkmann
  2013-12-11  0:07 ` [PATCH v2 4/5] net: macb: Use devm_request_irq() Soren Brinkmann
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 16+ messages in thread
From: Soren Brinkmann @ 2013-12-11  0:07 UTC (permalink / raw)
  To: Nicolas Ferre, David Miller
  Cc: linux-kernel, netdev, Sören Brinkmann, Michal Simek

Use the device managed version of ioremap to remap IO memory,
simplifying error paths.

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 drivers/net/ethernet/cadence/macb.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
index 62aa136889a4..436aecc31732 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -17,6 +17,7 @@
 #include <linux/circ_buf.h>
 #include <linux/slab.h>
 #include <linux/init.h>
+#include <linux/io.h>
 #include <linux/gpio.h>
 #include <linux/interrupt.h>
 #include <linux/netdevice.h>
@@ -1816,7 +1817,7 @@ static int __init macb_probe(struct platform_device *pdev)
 		goto err_out_disable_pclk;
 	}
 
-	bp->regs = ioremap(regs->start, resource_size(regs));
+	bp->regs = devm_ioremap(&pdev->dev, regs->start, resource_size(regs));
 	if (!bp->regs) {
 		dev_err(&pdev->dev, "failed to map registers, aborting.\n");
 		err = -ENOMEM;
@@ -1828,7 +1829,7 @@ static int __init macb_probe(struct platform_device *pdev)
 	if (err) {
 		dev_err(&pdev->dev, "Unable to request IRQ %d (error %d)\n",
 			dev->irq, err);
-		goto err_out_iounmap;
+		goto err_out_disable_clocks;
 	}
 
 	dev->netdev_ops = &macb_netdev_ops;
@@ -1916,8 +1917,6 @@ err_out_unregister_netdev:
 	unregister_netdev(dev);
 err_out_free_irq:
 	free_irq(dev->irq, dev);
-err_out_iounmap:
-	iounmap(bp->regs);
 err_out_disable_clocks:
 	clk_disable_unprepare(bp->hclk);
 err_out_disable_pclk:
@@ -1944,7 +1943,6 @@ static int __exit macb_remove(struct platform_device *pdev)
 		mdiobus_free(bp->mii_bus);
 		unregister_netdev(dev);
 		free_irq(dev->irq, dev);
-		iounmap(bp->regs);
 		clk_disable_unprepare(bp->hclk);
 		clk_disable_unprepare(bp->pclk);
 		free_netdev(dev);
-- 
1.8.5.1


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

* [PATCH v2 4/5] net: macb: Use devm_request_irq()
  2013-12-11  0:07 [PATCH v2 0/5] net: macb updates Soren Brinkmann
                   ` (2 preceding siblings ...)
  2013-12-11  0:07 ` [PATCH v2 3/5] net: macb: Use devm_ioremap() Soren Brinkmann
@ 2013-12-11  0:07 ` Soren Brinkmann
  2013-12-11  0:07 ` [PATCH v2 5/5] net: macb: Adjust tx_clk when link speed changes Soren Brinkmann
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 16+ messages in thread
From: Soren Brinkmann @ 2013-12-11  0:07 UTC (permalink / raw)
  To: Nicolas Ferre, David Miller
  Cc: linux-kernel, netdev, Sören Brinkmann, Michal Simek

Use the device managed interface to request the IRQ, simplifying error
paths.

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 drivers/net/ethernet/cadence/macb.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
index 436aecc31732..603844b1d483 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -1825,7 +1825,8 @@ static int __init macb_probe(struct platform_device *pdev)
 	}
 
 	dev->irq = platform_get_irq(pdev, 0);
-	err = request_irq(dev->irq, macb_interrupt, 0, dev->name, dev);
+	err = devm_request_irq(&pdev->dev, dev->irq, macb_interrupt, 0,
+			dev->name, dev);
 	if (err) {
 		dev_err(&pdev->dev, "Unable to request IRQ %d (error %d)\n",
 			dev->irq, err);
@@ -1892,7 +1893,7 @@ static int __init macb_probe(struct platform_device *pdev)
 	err = register_netdev(dev);
 	if (err) {
 		dev_err(&pdev->dev, "Cannot register net device, aborting.\n");
-		goto err_out_free_irq;
+		goto err_out_disable_clocks;
 	}
 
 	err = macb_mii_init(bp);
@@ -1915,8 +1916,6 @@ static int __init macb_probe(struct platform_device *pdev)
 
 err_out_unregister_netdev:
 	unregister_netdev(dev);
-err_out_free_irq:
-	free_irq(dev->irq, dev);
 err_out_disable_clocks:
 	clk_disable_unprepare(bp->hclk);
 err_out_disable_pclk:
@@ -1942,7 +1941,6 @@ static int __exit macb_remove(struct platform_device *pdev)
 		kfree(bp->mii_bus->irq);
 		mdiobus_free(bp->mii_bus);
 		unregister_netdev(dev);
-		free_irq(dev->irq, dev);
 		clk_disable_unprepare(bp->hclk);
 		clk_disable_unprepare(bp->pclk);
 		free_netdev(dev);
-- 
1.8.5.1


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

* [PATCH v2 5/5] net: macb: Adjust tx_clk when link speed changes
  2013-12-11  0:07 [PATCH v2 0/5] net: macb updates Soren Brinkmann
                   ` (3 preceding siblings ...)
  2013-12-11  0:07 ` [PATCH v2 4/5] net: macb: Use devm_request_irq() Soren Brinkmann
@ 2013-12-11  0:07 ` Soren Brinkmann
  2013-12-11  3:57 ` [PATCH v2 0/5] net: macb updates David Miller
  2013-12-12  7:00 ` Olof Johansson
  6 siblings, 0 replies; 16+ messages in thread
From: Soren Brinkmann @ 2013-12-11  0:07 UTC (permalink / raw)
  To: Nicolas Ferre, David Miller
  Cc: linux-kernel, netdev, Sören Brinkmann, Michal Simek

Adjust the ethernet clock according to the negotiated link speed.

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
---
 drivers/net/ethernet/cadence/macb.c | 64 +++++++++++++++++++++++++++++++++++++
 drivers/net/ethernet/cadence/macb.h |  1 +
 2 files changed, 65 insertions(+)

diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
index 603844b1d483..419529a9309d 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -204,6 +204,47 @@ static int macb_mdio_reset(struct mii_bus *bus)
 	return 0;
 }
 
+/**
+ * macb_set_tx_clk() - Set a clock to a new frequency
+ * @clk		Pointer to the clock to change
+ * @rate	New frequency in Hz
+ * @dev		Pointer to the struct net_device
+ */
+static void macb_set_tx_clk(struct clk *clk, int speed, struct net_device *dev)
+{
+	long ferr, rate, rate_rounded;
+
+	switch (speed) {
+	case SPEED_10:
+		rate = 2500000;
+		break;
+	case SPEED_100:
+		rate = 25000000;
+		break;
+	case SPEED_1000:
+		rate = 125000000;
+		break;
+	default:
+		break;
+	}
+
+	rate_rounded = clk_round_rate(clk, rate);
+	if (rate_rounded < 0)
+		return;
+
+	/* RGMII allows 50 ppm frequency error. Test and warn if this limit
+	 * is not satisfied.
+	 */
+	ferr = abs(rate_rounded - rate);
+	ferr = DIV_ROUND_UP(ferr, rate / 100000);
+	if (ferr > 5)
+		netdev_warn(dev, "unable to generate target frequency: %ld Hz\n",
+				rate);
+
+	if (clk_set_rate(clk, rate_rounded))
+		netdev_err(dev, "adjusting tx_clk failed.\n");
+}
+
 static void macb_handle_link_change(struct net_device *dev)
 {
 	struct macb *bp = netdev_priv(dev);
@@ -251,6 +292,9 @@ static void macb_handle_link_change(struct net_device *dev)
 
 	spin_unlock_irqrestore(&bp->lock, flags);
 
+	if (!IS_ERR(bp->tx_clk))
+		macb_set_tx_clk(bp->tx_clk, phydev->speed, dev);
+
 	if (status_change) {
 		if (phydev->link) {
 			netif_carrier_on(dev);
@@ -1805,6 +1849,8 @@ static int __init macb_probe(struct platform_device *pdev)
 		goto err_out_free_dev;
 	}
 
+	bp->tx_clk = devm_clk_get(&pdev->dev, "tx_clk");
+
 	err = clk_prepare_enable(bp->pclk);
 	if (err) {
 		dev_err(&pdev->dev, "failed to enable pclk (%u)\n", err);
@@ -1817,6 +1863,15 @@ static int __init macb_probe(struct platform_device *pdev)
 		goto err_out_disable_pclk;
 	}
 
+	if (!IS_ERR(bp->tx_clk)) {
+		err = clk_prepare_enable(bp->tx_clk);
+		if (err) {
+			dev_err(&pdev->dev, "failed to enable tx_clk (%u)\n",
+					err);
+			goto err_out_disable_hclk;
+		}
+	}
+
 	bp->regs = devm_ioremap(&pdev->dev, regs->start, resource_size(regs));
 	if (!bp->regs) {
 		dev_err(&pdev->dev, "failed to map registers, aborting.\n");
@@ -1917,6 +1972,9 @@ static int __init macb_probe(struct platform_device *pdev)
 err_out_unregister_netdev:
 	unregister_netdev(dev);
 err_out_disable_clocks:
+	if (!IS_ERR(bp->tx_clk))
+		clk_disable_unprepare(bp->tx_clk);
+err_out_disable_hclk:
 	clk_disable_unprepare(bp->hclk);
 err_out_disable_pclk:
 	clk_disable_unprepare(bp->pclk);
@@ -1941,6 +1999,8 @@ static int __exit macb_remove(struct platform_device *pdev)
 		kfree(bp->mii_bus->irq);
 		mdiobus_free(bp->mii_bus);
 		unregister_netdev(dev);
+		if (!IS_ERR(bp->tx_clk))
+			clk_disable_unprepare(bp->tx_clk);
 		clk_disable_unprepare(bp->hclk);
 		clk_disable_unprepare(bp->pclk);
 		free_netdev(dev);
@@ -1959,6 +2019,8 @@ static int macb_suspend(struct device *dev)
 	netif_carrier_off(netdev);
 	netif_device_detach(netdev);
 
+	if (!IS_ERR(bp->tx_clk))
+		clk_disable_unprepare(bp->tx_clk);
 	clk_disable_unprepare(bp->hclk);
 	clk_disable_unprepare(bp->pclk);
 
@@ -1973,6 +2035,8 @@ static int macb_resume(struct device *dev)
 
 	clk_prepare_enable(bp->pclk);
 	clk_prepare_enable(bp->hclk);
+	if (!IS_ERR(bp->tx_clk))
+		clk_prepare_enable(bp->tx_clk);
 
 	netif_device_attach(netdev);
 
diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
index f4076155bed7..51c02442160a 100644
--- a/drivers/net/ethernet/cadence/macb.h
+++ b/drivers/net/ethernet/cadence/macb.h
@@ -572,6 +572,7 @@ struct macb {
 	struct platform_device	*pdev;
 	struct clk		*pclk;
 	struct clk		*hclk;
+	struct clk		*tx_clk;
 	struct net_device	*dev;
 	struct napi_struct	napi;
 	struct work_struct	tx_error_task;
-- 
1.8.5.1


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

* Re: [PATCH v2 0/5] net: macb updates
  2013-12-11  0:07 [PATCH v2 0/5] net: macb updates Soren Brinkmann
                   ` (4 preceding siblings ...)
  2013-12-11  0:07 ` [PATCH v2 5/5] net: macb: Adjust tx_clk when link speed changes Soren Brinkmann
@ 2013-12-11  3:57 ` David Miller
  2013-12-12  7:00 ` Olof Johansson
  6 siblings, 0 replies; 16+ messages in thread
From: David Miller @ 2013-12-11  3:57 UTC (permalink / raw)
  To: soren.brinkmann; +Cc: nicolas.ferre, linux-kernel, netdev, michal.simek

From: Soren Brinkmann <soren.brinkmann@xilinx.com>
Date: Tue, 10 Dec 2013 16:07:18 -0800

> I'd really like to have Ethernet working for Zynq, so I want to at least
> revive this discussion regarding this patchset. And the first four
> patches should not even be too controversial.
> I didn't change anything compared to my original RFC submission, except
> for a typo in one of the commit messages.
> Handling the tx_clk as optional clock input seems a little bit weird,
> but it works on my Zynq platform and should be compatible with other
> users of macb and their DT descriptions.

Series applied to net-next, thanks.

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

* Re: [PATCH v2 0/5] net: macb updates
  2013-12-11  0:07 [PATCH v2 0/5] net: macb updates Soren Brinkmann
                   ` (5 preceding siblings ...)
  2013-12-11  3:57 ` [PATCH v2 0/5] net: macb updates David Miller
@ 2013-12-12  7:00 ` Olof Johansson
  2013-12-12 14:28     ` Nicolas Ferre
  6 siblings, 1 reply; 16+ messages in thread
From: Olof Johansson @ 2013-12-12  7:00 UTC (permalink / raw)
  To: Soren Brinkmann
  Cc: Nicolas Ferre, David Miller, linux-kernel, Network Development,
	Michal Simek

Hi Soren,

On Tue, Dec 10, 2013 at 4:07 PM, Soren Brinkmann
<soren.brinkmann@xilinx.com> wrote:

> Soren Brinkmann (5):
>   net: macb: Adjust tx_clk when link speed changes

This patch causes build issues on some at91 platforms, namely
at91sam9263 that lacks programmable clocks. So it doesn't implement
clk_set_rate() and clk_round_rate().

I don't know if there's any reasonable config option to check for
(that wouldn't add at91-specific stuff to the driver which we don't
want). So I suspect the best way would be to implement dummy versions
for at91 when CONFIG_AT91_PROGRAMMABLE_CLOCKS isn't set.

Nicolas, you OK with that? It'd be something like the below
(copy-paste, whitespace damage, just RFC):

diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c
index 6b2630a..17c52a7 100644
--- a/arch/arm/mach-at91/clock.c
+++ b/arch/arm/mach-at91/clock.c
@@ -459,6 +459,22 @@ static void __init init_programmable_clock(struct clk *clk)
        clk->rate_hz = parent->rate_hz / pmc_prescaler_divider(pckr);
 }

+#else  /* CONFIG_AT91_PROGRAMMABLE_CLOCKS */
+
+int clk_set_rate(struct clk *clk, unsigned long rate)
+{
+       if (rate == clk_get_rate(clk))
+               return 0;
+
+       return -EINVAL;
+}
+
+long clk_round_rate(struct clk *clk, unsigned long rate)
+{
+       /* There's really nothing sane to return here. */
+       return clk_get_rate(clk);
+}
+
 #endif /* CONFIG_AT91_PROGRAMMABLE_CLOCKS */

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

* Re: [PATCH v2 0/5] net: macb updates
  2013-12-12  7:00 ` Olof Johansson
@ 2013-12-12 14:28     ` Nicolas Ferre
  0 siblings, 0 replies; 16+ messages in thread
From: Nicolas Ferre @ 2013-12-12 14:28 UTC (permalink / raw)
  To: Olof Johansson, Soren Brinkmann, linux-arm-kernel,
	Jean-Christophe PLAGNIOL-VILLARD, boris brezillon
  Cc: David Miller, linux-kernel, Network Development, Michal Simek

On 12/12/2013 08:00, Olof Johansson :
> Hi Soren,
>
> On Tue, Dec 10, 2013 at 4:07 PM, Soren Brinkmann
> <soren.brinkmann@xilinx.com> wrote:
>
>> Soren Brinkmann (5):
>>    net: macb: Adjust tx_clk when link speed changes
>
> This patch causes build issues on some at91 platforms, namely
> at91sam9263 that lacks programmable clocks. So it doesn't implement
> clk_set_rate() and clk_round_rate().
>
> I don't know if there's any reasonable config option to check for
> (that wouldn't add at91-specific stuff to the driver which we don't
> want). So I suspect the best way would be to implement dummy versions
> for at91 when CONFIG_AT91_PROGRAMMABLE_CLOCKS isn't set.
>
> Nicolas, you OK with that? It'd be something like the below
> (copy-paste, whitespace damage, just RFC):

Well, in fact I am thinking about simply removing this 
AT91_PROGRAMMABLE_CLOCKS option out of the AT91 Kconfig.

After all, when not specified, it only removes a few lines of code... 
and that's it! For a so little benefit, I suspect it is sensible to 
remove this option.
I continue to discuss with AT91 active developers and write a patch soon.

Thanks for the heads-up on this issue Olof.

Bye,


> diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c
> index 6b2630a..17c52a7 100644
> --- a/arch/arm/mach-at91/clock.c
> +++ b/arch/arm/mach-at91/clock.c
> @@ -459,6 +459,22 @@ static void __init init_programmable_clock(struct clk *clk)
>          clk->rate_hz = parent->rate_hz / pmc_prescaler_divider(pckr);
>   }
>
> +#else  /* CONFIG_AT91_PROGRAMMABLE_CLOCKS */
> +
> +int clk_set_rate(struct clk *clk, unsigned long rate)
> +{
> +       if (rate == clk_get_rate(clk))
> +               return 0;
> +
> +       return -EINVAL;
> +}
> +
> +long clk_round_rate(struct clk *clk, unsigned long rate)
> +{
> +       /* There's really nothing sane to return here. */
> +       return clk_get_rate(clk);
> +}
> +
>   #endif /* CONFIG_AT91_PROGRAMMABLE_CLOCKS */
>


-- 
Nicolas Ferre

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

* [PATCH v2 0/5] net: macb updates
@ 2013-12-12 14:28     ` Nicolas Ferre
  0 siblings, 0 replies; 16+ messages in thread
From: Nicolas Ferre @ 2013-12-12 14:28 UTC (permalink / raw)
  To: linux-arm-kernel

On 12/12/2013 08:00, Olof Johansson :
> Hi Soren,
>
> On Tue, Dec 10, 2013 at 4:07 PM, Soren Brinkmann
> <soren.brinkmann@xilinx.com> wrote:
>
>> Soren Brinkmann (5):
>>    net: macb: Adjust tx_clk when link speed changes
>
> This patch causes build issues on some at91 platforms, namely
> at91sam9263 that lacks programmable clocks. So it doesn't implement
> clk_set_rate() and clk_round_rate().
>
> I don't know if there's any reasonable config option to check for
> (that wouldn't add at91-specific stuff to the driver which we don't
> want). So I suspect the best way would be to implement dummy versions
> for at91 when CONFIG_AT91_PROGRAMMABLE_CLOCKS isn't set.
>
> Nicolas, you OK with that? It'd be something like the below
> (copy-paste, whitespace damage, just RFC):

Well, in fact I am thinking about simply removing this 
AT91_PROGRAMMABLE_CLOCKS option out of the AT91 Kconfig.

After all, when not specified, it only removes a few lines of code... 
and that's it! For a so little benefit, I suspect it is sensible to 
remove this option.
I continue to discuss with AT91 active developers and write a patch soon.

Thanks for the heads-up on this issue Olof.

Bye,


> diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c
> index 6b2630a..17c52a7 100644
> --- a/arch/arm/mach-at91/clock.c
> +++ b/arch/arm/mach-at91/clock.c
> @@ -459,6 +459,22 @@ static void __init init_programmable_clock(struct clk *clk)
>          clk->rate_hz = parent->rate_hz / pmc_prescaler_divider(pckr);
>   }
>
> +#else  /* CONFIG_AT91_PROGRAMMABLE_CLOCKS */
> +
> +int clk_set_rate(struct clk *clk, unsigned long rate)
> +{
> +       if (rate == clk_get_rate(clk))
> +               return 0;
> +
> +       return -EINVAL;
> +}
> +
> +long clk_round_rate(struct clk *clk, unsigned long rate)
> +{
> +       /* There's really nothing sane to return here. */
> +       return clk_get_rate(clk);
> +}
> +
>   #endif /* CONFIG_AT91_PROGRAMMABLE_CLOCKS */
>


-- 
Nicolas Ferre

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

* [PATCH] ARM: at91: remove AT91_PROGRAMMABLE_CLOCKS configuration option
  2013-12-12 14:28     ` Nicolas Ferre
@ 2013-12-12 16:00       ` Nicolas Ferre
  -1 siblings, 0 replies; 16+ messages in thread
From: Nicolas Ferre @ 2013-12-12 16:00 UTC (permalink / raw)
  To: Olof Johansson, khilman, Jean-Christophe PLAGNIOL-VILLARD
  Cc: Boris BREZILLON, Ludovic Desroches, linux-arm-kernel,
	linux-kernel, netdev, Nicolas Ferre

This AT91 specific Kconfig option removed the code that dealt with
programmable clocks. Each AT91 SoC embeds programmable clocks and
there is little gain to remove this code in case that such a clock
is not used.
If this option is not selected, it causes certain drivers to fail
to build. We simply remove this option instead of adding code just
to build a workaround.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
Olof, Kevin,

This patch goes on top of the AT91 "cleanup" branch.

Bye,


 arch/arm/configs/at91_dt_defconfig          | 1 -
 arch/arm/configs/at91rm9200_defconfig       | 1 -
 arch/arm/configs/at91sam9260_9g20_defconfig | 1 -
 arch/arm/configs/at91sam9261_9g10_defconfig | 1 -
 arch/arm/configs/at91sam9g45_defconfig      | 1 -
 arch/arm/configs/at91sam9rl_defconfig       | 1 -
 arch/arm/configs/sama5_defconfig            | 1 -
 arch/arm/mach-at91/Kconfig                  | 6 ------
 arch/arm/mach-at91/clock.c                  | 6 ------
 arch/arm/mach-at91/pm.c                     | 3 ---
 drivers/clk/at91/Makefile                   | 3 +--
 drivers/clk/at91/pmc.c                      | 2 --
 drivers/clk/at91/pmc.h                      | 2 --
 sound/soc/atmel/Kconfig                     | 2 +-
 14 files changed, 2 insertions(+), 29 deletions(-)

diff --git a/arch/arm/configs/at91_dt_defconfig b/arch/arm/configs/at91_dt_defconfig
index 690e89273230..0b4e9b5210d8 100644
--- a/arch/arm/configs/at91_dt_defconfig
+++ b/arch/arm/configs/at91_dt_defconfig
@@ -22,7 +22,6 @@ CONFIG_SOC_AT91SAM9X5=y
 CONFIG_SOC_AT91SAM9N12=y
 CONFIG_MACH_AT91RM9200_DT=y
 CONFIG_MACH_AT91SAM9_DT=y
-CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
 CONFIG_AT91_TIMER_HZ=128
 CONFIG_AEABI=y
 # CONFIG_OABI_COMPAT is not set
diff --git a/arch/arm/configs/at91rm9200_defconfig b/arch/arm/configs/at91rm9200_defconfig
index 75502c4d222c..bf057719dab0 100644
--- a/arch/arm/configs/at91rm9200_defconfig
+++ b/arch/arm/configs/at91rm9200_defconfig
@@ -31,7 +31,6 @@ CONFIG_MACH_YL9200=y
 CONFIG_MACH_CPUAT91=y
 CONFIG_MACH_ECO920=y
 CONFIG_MTD_AT91_DATAFLASH_CARD=y
-CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
 CONFIG_AT91_TIMER_HZ=100
 # CONFIG_ARM_THUMB is not set
 CONFIG_PCCARD=y
diff --git a/arch/arm/configs/at91sam9260_9g20_defconfig b/arch/arm/configs/at91sam9260_9g20_defconfig
index 69b6928d3d9d..955dc480f3ee 100644
--- a/arch/arm/configs/at91sam9260_9g20_defconfig
+++ b/arch/arm/configs/at91sam9260_9g20_defconfig
@@ -28,7 +28,6 @@ CONFIG_MACH_PCONTROL_G20=y
 CONFIG_MACH_GSIA18S=y
 CONFIG_MACH_SNAPPER_9260=y
 CONFIG_MACH_AT91SAM9_DT=y
-CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
 CONFIG_AT91_SLOW_CLOCK=y
 # CONFIG_ARM_THUMB is not set
 CONFIG_AEABI=y
diff --git a/arch/arm/configs/at91sam9261_9g10_defconfig b/arch/arm/configs/at91sam9261_9g10_defconfig
index 9d35cd81c611..f80e993b04ce 100644
--- a/arch/arm/configs/at91sam9261_9g10_defconfig
+++ b/arch/arm/configs/at91sam9261_9g10_defconfig
@@ -18,7 +18,6 @@ CONFIG_ARCH_AT91=y
 CONFIG_ARCH_AT91SAM9261=y
 CONFIG_MACH_AT91SAM9261EK=y
 CONFIG_MACH_AT91SAM9G10EK=y
-CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
 # CONFIG_ARM_THUMB is not set
 CONFIG_AEABI=y
 # CONFIG_OABI_COMPAT is not set
diff --git a/arch/arm/configs/at91sam9g45_defconfig b/arch/arm/configs/at91sam9g45_defconfig
index 08166cd4e7d6..e181a50fd65a 100644
--- a/arch/arm/configs/at91sam9g45_defconfig
+++ b/arch/arm/configs/at91sam9g45_defconfig
@@ -18,7 +18,6 @@ CONFIG_ARCH_AT91=y
 CONFIG_ARCH_AT91SAM9G45=y
 CONFIG_MACH_AT91SAM9M10G45EK=y
 CONFIG_MACH_AT91SAM9_DT=y
-CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
 CONFIG_AT91_SLOW_CLOCK=y
 CONFIG_AEABI=y
 # CONFIG_OABI_COMPAT is not set
diff --git a/arch/arm/configs/at91sam9rl_defconfig b/arch/arm/configs/at91sam9rl_defconfig
index 7cf87856d63c..7b6f131cecd6 100644
--- a/arch/arm/configs/at91sam9rl_defconfig
+++ b/arch/arm/configs/at91sam9rl_defconfig
@@ -13,7 +13,6 @@ CONFIG_MODULE_UNLOAD=y
 CONFIG_ARCH_AT91=y
 CONFIG_ARCH_AT91SAM9RL=y
 CONFIG_MACH_AT91SAM9RLEK=y
-CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
 # CONFIG_ARM_THUMB is not set
 CONFIG_ZBOOT_ROM_TEXT=0x0
 CONFIG_ZBOOT_ROM_BSS=0x0
diff --git a/arch/arm/configs/sama5_defconfig b/arch/arm/configs/sama5_defconfig
index f6e78f83c3c3..dc3881e07630 100644
--- a/arch/arm/configs/sama5_defconfig
+++ b/arch/arm/configs/sama5_defconfig
@@ -20,7 +20,6 @@ CONFIG_ARCH_AT91=y
 CONFIG_SOC_SAM_V7=y
 CONFIG_SOC_SAMA5D3=y
 CONFIG_MACH_SAMA5_DT=y
-CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
 CONFIG_AEABI=y
 # CONFIG_OABI_COMPAT is not set
 CONFIG_UACCESS_WITH_MEMCPY=y
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index aac7814db4f9..f1bf952da747 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -214,12 +214,6 @@ config MACH_SAMA5_DT
 
 comment "AT91 Feature Selections"
 
-config AT91_PROGRAMMABLE_CLOCKS
-	bool "Programmable Clocks"
-	help
-	  Select this if you need to program one or more of the PCK0..PCK3
-	  programmable clock outputs.
-
 config AT91_SLOW_CLOCK
 	bool "Suspend-to-RAM disables main oscillator"
 	depends on SUSPEND
diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c
index 72b257944733..034529d801b2 100644
--- a/arch/arm/mach-at91/clock.c
+++ b/arch/arm/mach-at91/clock.c
@@ -330,8 +330,6 @@ EXPORT_SYMBOL(clk_get_rate);
 
 /*------------------------------------------------------------------------*/
 
-#ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS
-
 /*
  * For now, only the programmable clocks support reparenting (MCK could
  * do this too, with care) or rate changing (the PLLs could do this too,
@@ -459,8 +457,6 @@ static void __init init_programmable_clock(struct clk *clk)
 	clk->rate_hz = parent->rate_hz / pmc_prescaler_divider(pckr);
 }
 
-#endif	/* CONFIG_AT91_PROGRAMMABLE_CLOCKS */
-
 /*------------------------------------------------------------------------*/
 
 #ifdef CONFIG_DEBUG_FS
@@ -577,12 +573,10 @@ int __init clk_register(struct clk *clk)
 		clk->parent = &mck;
 		clk->mode = pmc_sys_mode;
 	}
-#ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS
 	else if (clk_is_programmable(clk)) {
 		clk->mode = pmc_sys_mode;
 		init_programmable_clock(clk);
 	}
-#endif
 
 	at91_clk_add(clk);
 
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index d43b79f56e94..590b52dea9f7 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -155,9 +155,6 @@ static int at91_pm_verify_clocks(void)
 		}
 	}
 
-	if (!IS_ENABLED(CONFIG_AT91_PROGRAMMABLE_CLOCKS))
-		return 1;
-
 	/* PCK0..PCK3 must be disabled, or configured to use clk32k */
 	for (i = 0; i < 4; i++) {
 		u32 css;
diff --git a/drivers/clk/at91/Makefile b/drivers/clk/at91/Makefile
index 0e92b716f934..46c1d3d0d66b 100644
--- a/drivers/clk/at91/Makefile
+++ b/drivers/clk/at91/Makefile
@@ -4,9 +4,8 @@
 
 obj-y += pmc.o
 obj-y += clk-main.o clk-pll.o clk-plldiv.o clk-master.o
-obj-y += clk-system.o clk-peripheral.o
+obj-y += clk-system.o clk-peripheral.o clk-programmable.o
 
-obj-$(CONFIG_AT91_PROGRAMMABLE_CLOCKS)	+= clk-programmable.o
 obj-$(CONFIG_HAVE_AT91_UTMI)		+= clk-utmi.o
 obj-$(CONFIG_HAVE_AT91_USB_CLK)		+= clk-usb.o
 obj-$(CONFIG_HAVE_AT91_SMD)		+= clk-smd.o
diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c
index 7b9db603b936..11fceff8d9f1 100644
--- a/drivers/clk/at91/pmc.c
+++ b/drivers/clk/at91/pmc.c
@@ -279,7 +279,6 @@ static const struct of_device_id pmc_clk_ids[] __initdata = {
 		.data = of_at91sam9x5_clk_periph_setup,
 	},
 	/* Programmable clocks */
-#if defined(CONFIG_AT91_PROGRAMMABLE_CLOCKS)
 	{
 		.compatible = "atmel,at91rm9200-clk-programmable",
 		.data = of_at91rm9200_clk_prog_setup,
@@ -292,7 +291,6 @@ static const struct of_device_id pmc_clk_ids[] __initdata = {
 		.compatible = "atmel,at91sam9x5-clk-programmable",
 		.data = of_at91sam9x5_clk_prog_setup,
 	},
-#endif
 	/* UTMI clock */
 #if defined(CONFIG_HAVE_AT91_UTMI)
 	{
diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h
index ba8d14233f80..441350983ccb 100644
--- a/drivers/clk/at91/pmc.h
+++ b/drivers/clk/at91/pmc.h
@@ -85,14 +85,12 @@ extern void __init of_at91rm9200_clk_periph_setup(struct device_node *np,
 extern void __init of_at91sam9x5_clk_periph_setup(struct device_node *np,
 						  struct at91_pmc *pmc);
 
-#if defined(CONFIG_AT91_PROGRAMMABLE_CLOCKS)
 extern void __init of_at91rm9200_clk_prog_setup(struct device_node *np,
 						struct at91_pmc *pmc);
 extern void __init of_at91sam9g45_clk_prog_setup(struct device_node *np,
 						 struct at91_pmc *pmc);
 extern void __init of_at91sam9x5_clk_prog_setup(struct device_node *np,
 						struct at91_pmc *pmc);
-#endif
 
 #if defined(CONFIG_HAVE_AT91_UTMI)
 extern void __init of_at91sam9x5_clk_utmi_setup(struct device_node *np,
diff --git a/sound/soc/atmel/Kconfig b/sound/soc/atmel/Kconfig
index e48d38a1b95c..e634eb78ed03 100644
--- a/sound/soc/atmel/Kconfig
+++ b/sound/soc/atmel/Kconfig
@@ -25,7 +25,7 @@ config SND_ATMEL_SOC_SSC
 
 config SND_AT91_SOC_SAM9G20_WM8731
 	tristate "SoC Audio support for WM8731-based At91sam9g20 evaluation board"
-	depends on ARCH_AT91 && ATMEL_SSC && SND_ATMEL_SOC && AT91_PROGRAMMABLE_CLOCKS
+	depends on ARCH_AT91 && ATMEL_SSC && SND_ATMEL_SOC
 	select SND_ATMEL_SOC_PDC
 	select SND_ATMEL_SOC_SSC
 	select SND_SOC_WM8731
-- 
1.8.2.2


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

* [PATCH] ARM: at91: remove AT91_PROGRAMMABLE_CLOCKS configuration option
@ 2013-12-12 16:00       ` Nicolas Ferre
  0 siblings, 0 replies; 16+ messages in thread
From: Nicolas Ferre @ 2013-12-12 16:00 UTC (permalink / raw)
  To: linux-arm-kernel

This AT91 specific Kconfig option removed the code that dealt with
programmable clocks. Each AT91 SoC embeds programmable clocks and
there is little gain to remove this code in case that such a clock
is not used.
If this option is not selected, it causes certain drivers to fail
to build. We simply remove this option instead of adding code just
to build a workaround.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
Olof, Kevin,

This patch goes on top of the AT91 "cleanup" branch.

Bye,


 arch/arm/configs/at91_dt_defconfig          | 1 -
 arch/arm/configs/at91rm9200_defconfig       | 1 -
 arch/arm/configs/at91sam9260_9g20_defconfig | 1 -
 arch/arm/configs/at91sam9261_9g10_defconfig | 1 -
 arch/arm/configs/at91sam9g45_defconfig      | 1 -
 arch/arm/configs/at91sam9rl_defconfig       | 1 -
 arch/arm/configs/sama5_defconfig            | 1 -
 arch/arm/mach-at91/Kconfig                  | 6 ------
 arch/arm/mach-at91/clock.c                  | 6 ------
 arch/arm/mach-at91/pm.c                     | 3 ---
 drivers/clk/at91/Makefile                   | 3 +--
 drivers/clk/at91/pmc.c                      | 2 --
 drivers/clk/at91/pmc.h                      | 2 --
 sound/soc/atmel/Kconfig                     | 2 +-
 14 files changed, 2 insertions(+), 29 deletions(-)

diff --git a/arch/arm/configs/at91_dt_defconfig b/arch/arm/configs/at91_dt_defconfig
index 690e89273230..0b4e9b5210d8 100644
--- a/arch/arm/configs/at91_dt_defconfig
+++ b/arch/arm/configs/at91_dt_defconfig
@@ -22,7 +22,6 @@ CONFIG_SOC_AT91SAM9X5=y
 CONFIG_SOC_AT91SAM9N12=y
 CONFIG_MACH_AT91RM9200_DT=y
 CONFIG_MACH_AT91SAM9_DT=y
-CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
 CONFIG_AT91_TIMER_HZ=128
 CONFIG_AEABI=y
 # CONFIG_OABI_COMPAT is not set
diff --git a/arch/arm/configs/at91rm9200_defconfig b/arch/arm/configs/at91rm9200_defconfig
index 75502c4d222c..bf057719dab0 100644
--- a/arch/arm/configs/at91rm9200_defconfig
+++ b/arch/arm/configs/at91rm9200_defconfig
@@ -31,7 +31,6 @@ CONFIG_MACH_YL9200=y
 CONFIG_MACH_CPUAT91=y
 CONFIG_MACH_ECO920=y
 CONFIG_MTD_AT91_DATAFLASH_CARD=y
-CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
 CONFIG_AT91_TIMER_HZ=100
 # CONFIG_ARM_THUMB is not set
 CONFIG_PCCARD=y
diff --git a/arch/arm/configs/at91sam9260_9g20_defconfig b/arch/arm/configs/at91sam9260_9g20_defconfig
index 69b6928d3d9d..955dc480f3ee 100644
--- a/arch/arm/configs/at91sam9260_9g20_defconfig
+++ b/arch/arm/configs/at91sam9260_9g20_defconfig
@@ -28,7 +28,6 @@ CONFIG_MACH_PCONTROL_G20=y
 CONFIG_MACH_GSIA18S=y
 CONFIG_MACH_SNAPPER_9260=y
 CONFIG_MACH_AT91SAM9_DT=y
-CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
 CONFIG_AT91_SLOW_CLOCK=y
 # CONFIG_ARM_THUMB is not set
 CONFIG_AEABI=y
diff --git a/arch/arm/configs/at91sam9261_9g10_defconfig b/arch/arm/configs/at91sam9261_9g10_defconfig
index 9d35cd81c611..f80e993b04ce 100644
--- a/arch/arm/configs/at91sam9261_9g10_defconfig
+++ b/arch/arm/configs/at91sam9261_9g10_defconfig
@@ -18,7 +18,6 @@ CONFIG_ARCH_AT91=y
 CONFIG_ARCH_AT91SAM9261=y
 CONFIG_MACH_AT91SAM9261EK=y
 CONFIG_MACH_AT91SAM9G10EK=y
-CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
 # CONFIG_ARM_THUMB is not set
 CONFIG_AEABI=y
 # CONFIG_OABI_COMPAT is not set
diff --git a/arch/arm/configs/at91sam9g45_defconfig b/arch/arm/configs/at91sam9g45_defconfig
index 08166cd4e7d6..e181a50fd65a 100644
--- a/arch/arm/configs/at91sam9g45_defconfig
+++ b/arch/arm/configs/at91sam9g45_defconfig
@@ -18,7 +18,6 @@ CONFIG_ARCH_AT91=y
 CONFIG_ARCH_AT91SAM9G45=y
 CONFIG_MACH_AT91SAM9M10G45EK=y
 CONFIG_MACH_AT91SAM9_DT=y
-CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
 CONFIG_AT91_SLOW_CLOCK=y
 CONFIG_AEABI=y
 # CONFIG_OABI_COMPAT is not set
diff --git a/arch/arm/configs/at91sam9rl_defconfig b/arch/arm/configs/at91sam9rl_defconfig
index 7cf87856d63c..7b6f131cecd6 100644
--- a/arch/arm/configs/at91sam9rl_defconfig
+++ b/arch/arm/configs/at91sam9rl_defconfig
@@ -13,7 +13,6 @@ CONFIG_MODULE_UNLOAD=y
 CONFIG_ARCH_AT91=y
 CONFIG_ARCH_AT91SAM9RL=y
 CONFIG_MACH_AT91SAM9RLEK=y
-CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
 # CONFIG_ARM_THUMB is not set
 CONFIG_ZBOOT_ROM_TEXT=0x0
 CONFIG_ZBOOT_ROM_BSS=0x0
diff --git a/arch/arm/configs/sama5_defconfig b/arch/arm/configs/sama5_defconfig
index f6e78f83c3c3..dc3881e07630 100644
--- a/arch/arm/configs/sama5_defconfig
+++ b/arch/arm/configs/sama5_defconfig
@@ -20,7 +20,6 @@ CONFIG_ARCH_AT91=y
 CONFIG_SOC_SAM_V7=y
 CONFIG_SOC_SAMA5D3=y
 CONFIG_MACH_SAMA5_DT=y
-CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
 CONFIG_AEABI=y
 # CONFIG_OABI_COMPAT is not set
 CONFIG_UACCESS_WITH_MEMCPY=y
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index aac7814db4f9..f1bf952da747 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -214,12 +214,6 @@ config MACH_SAMA5_DT
 
 comment "AT91 Feature Selections"
 
-config AT91_PROGRAMMABLE_CLOCKS
-	bool "Programmable Clocks"
-	help
-	  Select this if you need to program one or more of the PCK0..PCK3
-	  programmable clock outputs.
-
 config AT91_SLOW_CLOCK
 	bool "Suspend-to-RAM disables main oscillator"
 	depends on SUSPEND
diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c
index 72b257944733..034529d801b2 100644
--- a/arch/arm/mach-at91/clock.c
+++ b/arch/arm/mach-at91/clock.c
@@ -330,8 +330,6 @@ EXPORT_SYMBOL(clk_get_rate);
 
 /*------------------------------------------------------------------------*/
 
-#ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS
-
 /*
  * For now, only the programmable clocks support reparenting (MCK could
  * do this too, with care) or rate changing (the PLLs could do this too,
@@ -459,8 +457,6 @@ static void __init init_programmable_clock(struct clk *clk)
 	clk->rate_hz = parent->rate_hz / pmc_prescaler_divider(pckr);
 }
 
-#endif	/* CONFIG_AT91_PROGRAMMABLE_CLOCKS */
-
 /*------------------------------------------------------------------------*/
 
 #ifdef CONFIG_DEBUG_FS
@@ -577,12 +573,10 @@ int __init clk_register(struct clk *clk)
 		clk->parent = &mck;
 		clk->mode = pmc_sys_mode;
 	}
-#ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS
 	else if (clk_is_programmable(clk)) {
 		clk->mode = pmc_sys_mode;
 		init_programmable_clock(clk);
 	}
-#endif
 
 	at91_clk_add(clk);
 
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index d43b79f56e94..590b52dea9f7 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -155,9 +155,6 @@ static int at91_pm_verify_clocks(void)
 		}
 	}
 
-	if (!IS_ENABLED(CONFIG_AT91_PROGRAMMABLE_CLOCKS))
-		return 1;
-
 	/* PCK0..PCK3 must be disabled, or configured to use clk32k */
 	for (i = 0; i < 4; i++) {
 		u32 css;
diff --git a/drivers/clk/at91/Makefile b/drivers/clk/at91/Makefile
index 0e92b716f934..46c1d3d0d66b 100644
--- a/drivers/clk/at91/Makefile
+++ b/drivers/clk/at91/Makefile
@@ -4,9 +4,8 @@
 
 obj-y += pmc.o
 obj-y += clk-main.o clk-pll.o clk-plldiv.o clk-master.o
-obj-y += clk-system.o clk-peripheral.o
+obj-y += clk-system.o clk-peripheral.o clk-programmable.o
 
-obj-$(CONFIG_AT91_PROGRAMMABLE_CLOCKS)	+= clk-programmable.o
 obj-$(CONFIG_HAVE_AT91_UTMI)		+= clk-utmi.o
 obj-$(CONFIG_HAVE_AT91_USB_CLK)		+= clk-usb.o
 obj-$(CONFIG_HAVE_AT91_SMD)		+= clk-smd.o
diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c
index 7b9db603b936..11fceff8d9f1 100644
--- a/drivers/clk/at91/pmc.c
+++ b/drivers/clk/at91/pmc.c
@@ -279,7 +279,6 @@ static const struct of_device_id pmc_clk_ids[] __initdata = {
 		.data = of_at91sam9x5_clk_periph_setup,
 	},
 	/* Programmable clocks */
-#if defined(CONFIG_AT91_PROGRAMMABLE_CLOCKS)
 	{
 		.compatible = "atmel,at91rm9200-clk-programmable",
 		.data = of_at91rm9200_clk_prog_setup,
@@ -292,7 +291,6 @@ static const struct of_device_id pmc_clk_ids[] __initdata = {
 		.compatible = "atmel,at91sam9x5-clk-programmable",
 		.data = of_at91sam9x5_clk_prog_setup,
 	},
-#endif
 	/* UTMI clock */
 #if defined(CONFIG_HAVE_AT91_UTMI)
 	{
diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h
index ba8d14233f80..441350983ccb 100644
--- a/drivers/clk/at91/pmc.h
+++ b/drivers/clk/at91/pmc.h
@@ -85,14 +85,12 @@ extern void __init of_at91rm9200_clk_periph_setup(struct device_node *np,
 extern void __init of_at91sam9x5_clk_periph_setup(struct device_node *np,
 						  struct at91_pmc *pmc);
 
-#if defined(CONFIG_AT91_PROGRAMMABLE_CLOCKS)
 extern void __init of_at91rm9200_clk_prog_setup(struct device_node *np,
 						struct at91_pmc *pmc);
 extern void __init of_at91sam9g45_clk_prog_setup(struct device_node *np,
 						 struct at91_pmc *pmc);
 extern void __init of_at91sam9x5_clk_prog_setup(struct device_node *np,
 						struct at91_pmc *pmc);
-#endif
 
 #if defined(CONFIG_HAVE_AT91_UTMI)
 extern void __init of_at91sam9x5_clk_utmi_setup(struct device_node *np,
diff --git a/sound/soc/atmel/Kconfig b/sound/soc/atmel/Kconfig
index e48d38a1b95c..e634eb78ed03 100644
--- a/sound/soc/atmel/Kconfig
+++ b/sound/soc/atmel/Kconfig
@@ -25,7 +25,7 @@ config SND_ATMEL_SOC_SSC
 
 config SND_AT91_SOC_SAM9G20_WM8731
 	tristate "SoC Audio support for WM8731-based At91sam9g20 evaluation board"
-	depends on ARCH_AT91 && ATMEL_SSC && SND_ATMEL_SOC && AT91_PROGRAMMABLE_CLOCKS
+	depends on ARCH_AT91 && ATMEL_SSC && SND_ATMEL_SOC
 	select SND_ATMEL_SOC_PDC
 	select SND_ATMEL_SOC_SSC
 	select SND_SOC_WM8731
-- 
1.8.2.2

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

* Re: [PATCH] ARM: at91: remove AT91_PROGRAMMABLE_CLOCKS configuration option
  2013-12-12 16:00       ` Nicolas Ferre
@ 2013-12-12 18:38         ` Kevin Hilman
  -1 siblings, 0 replies; 16+ messages in thread
From: Kevin Hilman @ 2013-12-12 18:38 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Olof Johansson, Jean-Christophe PLAGNIOL-VILLARD,
	Boris BREZILLON, Ludovic Desroches, linux-arm-kernel,
	linux-kernel, netdev

Nicolas Ferre <nicolas.ferre@atmel.com> writes:

> This AT91 specific Kconfig option removed the code that dealt with
> programmable clocks. Each AT91 SoC embeds programmable clocks and
> there is little gain to remove this code in case that such a clock
> is not used.
> If this option is not selected, it causes certain drivers to fail
> to build. We simply remove this option instead of adding code just
> to build a workaround.
>
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---
> Olof, Kevin,
>
> This patch goes on top of the AT91 "cleanup" branch.
>

Applied to next/cleanup.

Thanks,

Kevin

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

* [PATCH] ARM: at91: remove AT91_PROGRAMMABLE_CLOCKS configuration option
@ 2013-12-12 18:38         ` Kevin Hilman
  0 siblings, 0 replies; 16+ messages in thread
From: Kevin Hilman @ 2013-12-12 18:38 UTC (permalink / raw)
  To: linux-arm-kernel

Nicolas Ferre <nicolas.ferre@atmel.com> writes:

> This AT91 specific Kconfig option removed the code that dealt with
> programmable clocks. Each AT91 SoC embeds programmable clocks and
> there is little gain to remove this code in case that such a clock
> is not used.
> If this option is not selected, it causes certain drivers to fail
> to build. We simply remove this option instead of adding code just
> to build a workaround.
>
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---
> Olof, Kevin,
>
> This patch goes on top of the AT91 "cleanup" branch.
>

Applied to next/cleanup.

Thanks,

Kevin

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

* Re: [PATCH] ARM: at91: remove AT91_PROGRAMMABLE_CLOCKS configuration option
  2013-12-12 16:00       ` Nicolas Ferre
@ 2013-12-13 15:18         ` Jean-Christophe PLAGNIOL-VILLARD
  -1 siblings, 0 replies; 16+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-12-13 15:18 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: Olof Johansson, khilman, Boris BREZILLON, Ludovic Desroches,
	linux-arm-kernel, linux-kernel, netdev

On 17:00 Thu 12 Dec     , Nicolas Ferre wrote:
> This AT91 specific Kconfig option removed the code that dealt with
> programmable clocks. Each AT91 SoC embeds programmable clocks and
> there is little gain to remove this code in case that such a clock
> is not used.
> If this option is not selected, it causes certain drivers to fail
> to build. We simply remove this option instead of adding code just
> to build a workaround.
> 
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

Best Regards,
J.
> ---
> Olof, Kevin,
> 
> This patch goes on top of the AT91 "cleanup" branch.
> 
> Bye,
> 
> 
>  arch/arm/configs/at91_dt_defconfig          | 1 -
>  arch/arm/configs/at91rm9200_defconfig       | 1 -
>  arch/arm/configs/at91sam9260_9g20_defconfig | 1 -
>  arch/arm/configs/at91sam9261_9g10_defconfig | 1 -
>  arch/arm/configs/at91sam9g45_defconfig      | 1 -
>  arch/arm/configs/at91sam9rl_defconfig       | 1 -
>  arch/arm/configs/sama5_defconfig            | 1 -
>  arch/arm/mach-at91/Kconfig                  | 6 ------
>  arch/arm/mach-at91/clock.c                  | 6 ------
>  arch/arm/mach-at91/pm.c                     | 3 ---
>  drivers/clk/at91/Makefile                   | 3 +--
>  drivers/clk/at91/pmc.c                      | 2 --
>  drivers/clk/at91/pmc.h                      | 2 --
>  sound/soc/atmel/Kconfig                     | 2 +-
>  14 files changed, 2 insertions(+), 29 deletions(-)
> 
> diff --git a/arch/arm/configs/at91_dt_defconfig b/arch/arm/configs/at91_dt_defconfig
> index 690e89273230..0b4e9b5210d8 100644
> --- a/arch/arm/configs/at91_dt_defconfig
> +++ b/arch/arm/configs/at91_dt_defconfig
> @@ -22,7 +22,6 @@ CONFIG_SOC_AT91SAM9X5=y
>  CONFIG_SOC_AT91SAM9N12=y
>  CONFIG_MACH_AT91RM9200_DT=y
>  CONFIG_MACH_AT91SAM9_DT=y
> -CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
>  CONFIG_AT91_TIMER_HZ=128
>  CONFIG_AEABI=y
>  # CONFIG_OABI_COMPAT is not set
> diff --git a/arch/arm/configs/at91rm9200_defconfig b/arch/arm/configs/at91rm9200_defconfig
> index 75502c4d222c..bf057719dab0 100644
> --- a/arch/arm/configs/at91rm9200_defconfig
> +++ b/arch/arm/configs/at91rm9200_defconfig
> @@ -31,7 +31,6 @@ CONFIG_MACH_YL9200=y
>  CONFIG_MACH_CPUAT91=y
>  CONFIG_MACH_ECO920=y
>  CONFIG_MTD_AT91_DATAFLASH_CARD=y
> -CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
>  CONFIG_AT91_TIMER_HZ=100
>  # CONFIG_ARM_THUMB is not set
>  CONFIG_PCCARD=y
> diff --git a/arch/arm/configs/at91sam9260_9g20_defconfig b/arch/arm/configs/at91sam9260_9g20_defconfig
> index 69b6928d3d9d..955dc480f3ee 100644
> --- a/arch/arm/configs/at91sam9260_9g20_defconfig
> +++ b/arch/arm/configs/at91sam9260_9g20_defconfig
> @@ -28,7 +28,6 @@ CONFIG_MACH_PCONTROL_G20=y
>  CONFIG_MACH_GSIA18S=y
>  CONFIG_MACH_SNAPPER_9260=y
>  CONFIG_MACH_AT91SAM9_DT=y
> -CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
>  CONFIG_AT91_SLOW_CLOCK=y
>  # CONFIG_ARM_THUMB is not set
>  CONFIG_AEABI=y
> diff --git a/arch/arm/configs/at91sam9261_9g10_defconfig b/arch/arm/configs/at91sam9261_9g10_defconfig
> index 9d35cd81c611..f80e993b04ce 100644
> --- a/arch/arm/configs/at91sam9261_9g10_defconfig
> +++ b/arch/arm/configs/at91sam9261_9g10_defconfig
> @@ -18,7 +18,6 @@ CONFIG_ARCH_AT91=y
>  CONFIG_ARCH_AT91SAM9261=y
>  CONFIG_MACH_AT91SAM9261EK=y
>  CONFIG_MACH_AT91SAM9G10EK=y
> -CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
>  # CONFIG_ARM_THUMB is not set
>  CONFIG_AEABI=y
>  # CONFIG_OABI_COMPAT is not set
> diff --git a/arch/arm/configs/at91sam9g45_defconfig b/arch/arm/configs/at91sam9g45_defconfig
> index 08166cd4e7d6..e181a50fd65a 100644
> --- a/arch/arm/configs/at91sam9g45_defconfig
> +++ b/arch/arm/configs/at91sam9g45_defconfig
> @@ -18,7 +18,6 @@ CONFIG_ARCH_AT91=y
>  CONFIG_ARCH_AT91SAM9G45=y
>  CONFIG_MACH_AT91SAM9M10G45EK=y
>  CONFIG_MACH_AT91SAM9_DT=y
> -CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
>  CONFIG_AT91_SLOW_CLOCK=y
>  CONFIG_AEABI=y
>  # CONFIG_OABI_COMPAT is not set
> diff --git a/arch/arm/configs/at91sam9rl_defconfig b/arch/arm/configs/at91sam9rl_defconfig
> index 7cf87856d63c..7b6f131cecd6 100644
> --- a/arch/arm/configs/at91sam9rl_defconfig
> +++ b/arch/arm/configs/at91sam9rl_defconfig
> @@ -13,7 +13,6 @@ CONFIG_MODULE_UNLOAD=y
>  CONFIG_ARCH_AT91=y
>  CONFIG_ARCH_AT91SAM9RL=y
>  CONFIG_MACH_AT91SAM9RLEK=y
> -CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
>  # CONFIG_ARM_THUMB is not set
>  CONFIG_ZBOOT_ROM_TEXT=0x0
>  CONFIG_ZBOOT_ROM_BSS=0x0
> diff --git a/arch/arm/configs/sama5_defconfig b/arch/arm/configs/sama5_defconfig
> index f6e78f83c3c3..dc3881e07630 100644
> --- a/arch/arm/configs/sama5_defconfig
> +++ b/arch/arm/configs/sama5_defconfig
> @@ -20,7 +20,6 @@ CONFIG_ARCH_AT91=y
>  CONFIG_SOC_SAM_V7=y
>  CONFIG_SOC_SAMA5D3=y
>  CONFIG_MACH_SAMA5_DT=y
> -CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
>  CONFIG_AEABI=y
>  # CONFIG_OABI_COMPAT is not set
>  CONFIG_UACCESS_WITH_MEMCPY=y
> diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
> index aac7814db4f9..f1bf952da747 100644
> --- a/arch/arm/mach-at91/Kconfig
> +++ b/arch/arm/mach-at91/Kconfig
> @@ -214,12 +214,6 @@ config MACH_SAMA5_DT
>  
>  comment "AT91 Feature Selections"
>  
> -config AT91_PROGRAMMABLE_CLOCKS
> -	bool "Programmable Clocks"
> -	help
> -	  Select this if you need to program one or more of the PCK0..PCK3
> -	  programmable clock outputs.
> -
>  config AT91_SLOW_CLOCK
>  	bool "Suspend-to-RAM disables main oscillator"
>  	depends on SUSPEND
> diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c
> index 72b257944733..034529d801b2 100644
> --- a/arch/arm/mach-at91/clock.c
> +++ b/arch/arm/mach-at91/clock.c
> @@ -330,8 +330,6 @@ EXPORT_SYMBOL(clk_get_rate);
>  
>  /*------------------------------------------------------------------------*/
>  
> -#ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS
> -
>  /*
>   * For now, only the programmable clocks support reparenting (MCK could
>   * do this too, with care) or rate changing (the PLLs could do this too,
> @@ -459,8 +457,6 @@ static void __init init_programmable_clock(struct clk *clk)
>  	clk->rate_hz = parent->rate_hz / pmc_prescaler_divider(pckr);
>  }
>  
> -#endif	/* CONFIG_AT91_PROGRAMMABLE_CLOCKS */
> -
>  /*------------------------------------------------------------------------*/
>  
>  #ifdef CONFIG_DEBUG_FS
> @@ -577,12 +573,10 @@ int __init clk_register(struct clk *clk)
>  		clk->parent = &mck;
>  		clk->mode = pmc_sys_mode;
>  	}
> -#ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS
>  	else if (clk_is_programmable(clk)) {
>  		clk->mode = pmc_sys_mode;
>  		init_programmable_clock(clk);
>  	}
> -#endif
>  
>  	at91_clk_add(clk);
>  
> diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
> index d43b79f56e94..590b52dea9f7 100644
> --- a/arch/arm/mach-at91/pm.c
> +++ b/arch/arm/mach-at91/pm.c
> @@ -155,9 +155,6 @@ static int at91_pm_verify_clocks(void)
>  		}
>  	}
>  
> -	if (!IS_ENABLED(CONFIG_AT91_PROGRAMMABLE_CLOCKS))
> -		return 1;
> -
>  	/* PCK0..PCK3 must be disabled, or configured to use clk32k */
>  	for (i = 0; i < 4; i++) {
>  		u32 css;
> diff --git a/drivers/clk/at91/Makefile b/drivers/clk/at91/Makefile
> index 0e92b716f934..46c1d3d0d66b 100644
> --- a/drivers/clk/at91/Makefile
> +++ b/drivers/clk/at91/Makefile
> @@ -4,9 +4,8 @@
>  
>  obj-y += pmc.o
>  obj-y += clk-main.o clk-pll.o clk-plldiv.o clk-master.o
> -obj-y += clk-system.o clk-peripheral.o
> +obj-y += clk-system.o clk-peripheral.o clk-programmable.o
>  
> -obj-$(CONFIG_AT91_PROGRAMMABLE_CLOCKS)	+= clk-programmable.o
>  obj-$(CONFIG_HAVE_AT91_UTMI)		+= clk-utmi.o
>  obj-$(CONFIG_HAVE_AT91_USB_CLK)		+= clk-usb.o
>  obj-$(CONFIG_HAVE_AT91_SMD)		+= clk-smd.o
> diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c
> index 7b9db603b936..11fceff8d9f1 100644
> --- a/drivers/clk/at91/pmc.c
> +++ b/drivers/clk/at91/pmc.c
> @@ -279,7 +279,6 @@ static const struct of_device_id pmc_clk_ids[] __initdata = {
>  		.data = of_at91sam9x5_clk_periph_setup,
>  	},
>  	/* Programmable clocks */
> -#if defined(CONFIG_AT91_PROGRAMMABLE_CLOCKS)
>  	{
>  		.compatible = "atmel,at91rm9200-clk-programmable",
>  		.data = of_at91rm9200_clk_prog_setup,
> @@ -292,7 +291,6 @@ static const struct of_device_id pmc_clk_ids[] __initdata = {
>  		.compatible = "atmel,at91sam9x5-clk-programmable",
>  		.data = of_at91sam9x5_clk_prog_setup,
>  	},
> -#endif
>  	/* UTMI clock */
>  #if defined(CONFIG_HAVE_AT91_UTMI)
>  	{
> diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h
> index ba8d14233f80..441350983ccb 100644
> --- a/drivers/clk/at91/pmc.h
> +++ b/drivers/clk/at91/pmc.h
> @@ -85,14 +85,12 @@ extern void __init of_at91rm9200_clk_periph_setup(struct device_node *np,
>  extern void __init of_at91sam9x5_clk_periph_setup(struct device_node *np,
>  						  struct at91_pmc *pmc);
>  
> -#if defined(CONFIG_AT91_PROGRAMMABLE_CLOCKS)
>  extern void __init of_at91rm9200_clk_prog_setup(struct device_node *np,
>  						struct at91_pmc *pmc);
>  extern void __init of_at91sam9g45_clk_prog_setup(struct device_node *np,
>  						 struct at91_pmc *pmc);
>  extern void __init of_at91sam9x5_clk_prog_setup(struct device_node *np,
>  						struct at91_pmc *pmc);
> -#endif
>  
>  #if defined(CONFIG_HAVE_AT91_UTMI)
>  extern void __init of_at91sam9x5_clk_utmi_setup(struct device_node *np,
> diff --git a/sound/soc/atmel/Kconfig b/sound/soc/atmel/Kconfig
> index e48d38a1b95c..e634eb78ed03 100644
> --- a/sound/soc/atmel/Kconfig
> +++ b/sound/soc/atmel/Kconfig
> @@ -25,7 +25,7 @@ config SND_ATMEL_SOC_SSC
>  
>  config SND_AT91_SOC_SAM9G20_WM8731
>  	tristate "SoC Audio support for WM8731-based At91sam9g20 evaluation board"
> -	depends on ARCH_AT91 && ATMEL_SSC && SND_ATMEL_SOC && AT91_PROGRAMMABLE_CLOCKS
> +	depends on ARCH_AT91 && ATMEL_SSC && SND_ATMEL_SOC
>  	select SND_ATMEL_SOC_PDC
>  	select SND_ATMEL_SOC_SSC
>  	select SND_SOC_WM8731
> -- 
> 1.8.2.2
> 

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

* [PATCH] ARM: at91: remove AT91_PROGRAMMABLE_CLOCKS configuration option
@ 2013-12-13 15:18         ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 16+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-12-13 15:18 UTC (permalink / raw)
  To: linux-arm-kernel

On 17:00 Thu 12 Dec     , Nicolas Ferre wrote:
> This AT91 specific Kconfig option removed the code that dealt with
> programmable clocks. Each AT91 SoC embeds programmable clocks and
> there is little gain to remove this code in case that such a clock
> is not used.
> If this option is not selected, it causes certain drivers to fail
> to build. We simply remove this option instead of adding code just
> to build a workaround.
> 
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

Best Regards,
J.
> ---
> Olof, Kevin,
> 
> This patch goes on top of the AT91 "cleanup" branch.
> 
> Bye,
> 
> 
>  arch/arm/configs/at91_dt_defconfig          | 1 -
>  arch/arm/configs/at91rm9200_defconfig       | 1 -
>  arch/arm/configs/at91sam9260_9g20_defconfig | 1 -
>  arch/arm/configs/at91sam9261_9g10_defconfig | 1 -
>  arch/arm/configs/at91sam9g45_defconfig      | 1 -
>  arch/arm/configs/at91sam9rl_defconfig       | 1 -
>  arch/arm/configs/sama5_defconfig            | 1 -
>  arch/arm/mach-at91/Kconfig                  | 6 ------
>  arch/arm/mach-at91/clock.c                  | 6 ------
>  arch/arm/mach-at91/pm.c                     | 3 ---
>  drivers/clk/at91/Makefile                   | 3 +--
>  drivers/clk/at91/pmc.c                      | 2 --
>  drivers/clk/at91/pmc.h                      | 2 --
>  sound/soc/atmel/Kconfig                     | 2 +-
>  14 files changed, 2 insertions(+), 29 deletions(-)
> 
> diff --git a/arch/arm/configs/at91_dt_defconfig b/arch/arm/configs/at91_dt_defconfig
> index 690e89273230..0b4e9b5210d8 100644
> --- a/arch/arm/configs/at91_dt_defconfig
> +++ b/arch/arm/configs/at91_dt_defconfig
> @@ -22,7 +22,6 @@ CONFIG_SOC_AT91SAM9X5=y
>  CONFIG_SOC_AT91SAM9N12=y
>  CONFIG_MACH_AT91RM9200_DT=y
>  CONFIG_MACH_AT91SAM9_DT=y
> -CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
>  CONFIG_AT91_TIMER_HZ=128
>  CONFIG_AEABI=y
>  # CONFIG_OABI_COMPAT is not set
> diff --git a/arch/arm/configs/at91rm9200_defconfig b/arch/arm/configs/at91rm9200_defconfig
> index 75502c4d222c..bf057719dab0 100644
> --- a/arch/arm/configs/at91rm9200_defconfig
> +++ b/arch/arm/configs/at91rm9200_defconfig
> @@ -31,7 +31,6 @@ CONFIG_MACH_YL9200=y
>  CONFIG_MACH_CPUAT91=y
>  CONFIG_MACH_ECO920=y
>  CONFIG_MTD_AT91_DATAFLASH_CARD=y
> -CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
>  CONFIG_AT91_TIMER_HZ=100
>  # CONFIG_ARM_THUMB is not set
>  CONFIG_PCCARD=y
> diff --git a/arch/arm/configs/at91sam9260_9g20_defconfig b/arch/arm/configs/at91sam9260_9g20_defconfig
> index 69b6928d3d9d..955dc480f3ee 100644
> --- a/arch/arm/configs/at91sam9260_9g20_defconfig
> +++ b/arch/arm/configs/at91sam9260_9g20_defconfig
> @@ -28,7 +28,6 @@ CONFIG_MACH_PCONTROL_G20=y
>  CONFIG_MACH_GSIA18S=y
>  CONFIG_MACH_SNAPPER_9260=y
>  CONFIG_MACH_AT91SAM9_DT=y
> -CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
>  CONFIG_AT91_SLOW_CLOCK=y
>  # CONFIG_ARM_THUMB is not set
>  CONFIG_AEABI=y
> diff --git a/arch/arm/configs/at91sam9261_9g10_defconfig b/arch/arm/configs/at91sam9261_9g10_defconfig
> index 9d35cd81c611..f80e993b04ce 100644
> --- a/arch/arm/configs/at91sam9261_9g10_defconfig
> +++ b/arch/arm/configs/at91sam9261_9g10_defconfig
> @@ -18,7 +18,6 @@ CONFIG_ARCH_AT91=y
>  CONFIG_ARCH_AT91SAM9261=y
>  CONFIG_MACH_AT91SAM9261EK=y
>  CONFIG_MACH_AT91SAM9G10EK=y
> -CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
>  # CONFIG_ARM_THUMB is not set
>  CONFIG_AEABI=y
>  # CONFIG_OABI_COMPAT is not set
> diff --git a/arch/arm/configs/at91sam9g45_defconfig b/arch/arm/configs/at91sam9g45_defconfig
> index 08166cd4e7d6..e181a50fd65a 100644
> --- a/arch/arm/configs/at91sam9g45_defconfig
> +++ b/arch/arm/configs/at91sam9g45_defconfig
> @@ -18,7 +18,6 @@ CONFIG_ARCH_AT91=y
>  CONFIG_ARCH_AT91SAM9G45=y
>  CONFIG_MACH_AT91SAM9M10G45EK=y
>  CONFIG_MACH_AT91SAM9_DT=y
> -CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
>  CONFIG_AT91_SLOW_CLOCK=y
>  CONFIG_AEABI=y
>  # CONFIG_OABI_COMPAT is not set
> diff --git a/arch/arm/configs/at91sam9rl_defconfig b/arch/arm/configs/at91sam9rl_defconfig
> index 7cf87856d63c..7b6f131cecd6 100644
> --- a/arch/arm/configs/at91sam9rl_defconfig
> +++ b/arch/arm/configs/at91sam9rl_defconfig
> @@ -13,7 +13,6 @@ CONFIG_MODULE_UNLOAD=y
>  CONFIG_ARCH_AT91=y
>  CONFIG_ARCH_AT91SAM9RL=y
>  CONFIG_MACH_AT91SAM9RLEK=y
> -CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
>  # CONFIG_ARM_THUMB is not set
>  CONFIG_ZBOOT_ROM_TEXT=0x0
>  CONFIG_ZBOOT_ROM_BSS=0x0
> diff --git a/arch/arm/configs/sama5_defconfig b/arch/arm/configs/sama5_defconfig
> index f6e78f83c3c3..dc3881e07630 100644
> --- a/arch/arm/configs/sama5_defconfig
> +++ b/arch/arm/configs/sama5_defconfig
> @@ -20,7 +20,6 @@ CONFIG_ARCH_AT91=y
>  CONFIG_SOC_SAM_V7=y
>  CONFIG_SOC_SAMA5D3=y
>  CONFIG_MACH_SAMA5_DT=y
> -CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
>  CONFIG_AEABI=y
>  # CONFIG_OABI_COMPAT is not set
>  CONFIG_UACCESS_WITH_MEMCPY=y
> diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
> index aac7814db4f9..f1bf952da747 100644
> --- a/arch/arm/mach-at91/Kconfig
> +++ b/arch/arm/mach-at91/Kconfig
> @@ -214,12 +214,6 @@ config MACH_SAMA5_DT
>  
>  comment "AT91 Feature Selections"
>  
> -config AT91_PROGRAMMABLE_CLOCKS
> -	bool "Programmable Clocks"
> -	help
> -	  Select this if you need to program one or more of the PCK0..PCK3
> -	  programmable clock outputs.
> -
>  config AT91_SLOW_CLOCK
>  	bool "Suspend-to-RAM disables main oscillator"
>  	depends on SUSPEND
> diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c
> index 72b257944733..034529d801b2 100644
> --- a/arch/arm/mach-at91/clock.c
> +++ b/arch/arm/mach-at91/clock.c
> @@ -330,8 +330,6 @@ EXPORT_SYMBOL(clk_get_rate);
>  
>  /*------------------------------------------------------------------------*/
>  
> -#ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS
> -
>  /*
>   * For now, only the programmable clocks support reparenting (MCK could
>   * do this too, with care) or rate changing (the PLLs could do this too,
> @@ -459,8 +457,6 @@ static void __init init_programmable_clock(struct clk *clk)
>  	clk->rate_hz = parent->rate_hz / pmc_prescaler_divider(pckr);
>  }
>  
> -#endif	/* CONFIG_AT91_PROGRAMMABLE_CLOCKS */
> -
>  /*------------------------------------------------------------------------*/
>  
>  #ifdef CONFIG_DEBUG_FS
> @@ -577,12 +573,10 @@ int __init clk_register(struct clk *clk)
>  		clk->parent = &mck;
>  		clk->mode = pmc_sys_mode;
>  	}
> -#ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS
>  	else if (clk_is_programmable(clk)) {
>  		clk->mode = pmc_sys_mode;
>  		init_programmable_clock(clk);
>  	}
> -#endif
>  
>  	at91_clk_add(clk);
>  
> diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
> index d43b79f56e94..590b52dea9f7 100644
> --- a/arch/arm/mach-at91/pm.c
> +++ b/arch/arm/mach-at91/pm.c
> @@ -155,9 +155,6 @@ static int at91_pm_verify_clocks(void)
>  		}
>  	}
>  
> -	if (!IS_ENABLED(CONFIG_AT91_PROGRAMMABLE_CLOCKS))
> -		return 1;
> -
>  	/* PCK0..PCK3 must be disabled, or configured to use clk32k */
>  	for (i = 0; i < 4; i++) {
>  		u32 css;
> diff --git a/drivers/clk/at91/Makefile b/drivers/clk/at91/Makefile
> index 0e92b716f934..46c1d3d0d66b 100644
> --- a/drivers/clk/at91/Makefile
> +++ b/drivers/clk/at91/Makefile
> @@ -4,9 +4,8 @@
>  
>  obj-y += pmc.o
>  obj-y += clk-main.o clk-pll.o clk-plldiv.o clk-master.o
> -obj-y += clk-system.o clk-peripheral.o
> +obj-y += clk-system.o clk-peripheral.o clk-programmable.o
>  
> -obj-$(CONFIG_AT91_PROGRAMMABLE_CLOCKS)	+= clk-programmable.o
>  obj-$(CONFIG_HAVE_AT91_UTMI)		+= clk-utmi.o
>  obj-$(CONFIG_HAVE_AT91_USB_CLK)		+= clk-usb.o
>  obj-$(CONFIG_HAVE_AT91_SMD)		+= clk-smd.o
> diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c
> index 7b9db603b936..11fceff8d9f1 100644
> --- a/drivers/clk/at91/pmc.c
> +++ b/drivers/clk/at91/pmc.c
> @@ -279,7 +279,6 @@ static const struct of_device_id pmc_clk_ids[] __initdata = {
>  		.data = of_at91sam9x5_clk_periph_setup,
>  	},
>  	/* Programmable clocks */
> -#if defined(CONFIG_AT91_PROGRAMMABLE_CLOCKS)
>  	{
>  		.compatible = "atmel,at91rm9200-clk-programmable",
>  		.data = of_at91rm9200_clk_prog_setup,
> @@ -292,7 +291,6 @@ static const struct of_device_id pmc_clk_ids[] __initdata = {
>  		.compatible = "atmel,at91sam9x5-clk-programmable",
>  		.data = of_at91sam9x5_clk_prog_setup,
>  	},
> -#endif
>  	/* UTMI clock */
>  #if defined(CONFIG_HAVE_AT91_UTMI)
>  	{
> diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h
> index ba8d14233f80..441350983ccb 100644
> --- a/drivers/clk/at91/pmc.h
> +++ b/drivers/clk/at91/pmc.h
> @@ -85,14 +85,12 @@ extern void __init of_at91rm9200_clk_periph_setup(struct device_node *np,
>  extern void __init of_at91sam9x5_clk_periph_setup(struct device_node *np,
>  						  struct at91_pmc *pmc);
>  
> -#if defined(CONFIG_AT91_PROGRAMMABLE_CLOCKS)
>  extern void __init of_at91rm9200_clk_prog_setup(struct device_node *np,
>  						struct at91_pmc *pmc);
>  extern void __init of_at91sam9g45_clk_prog_setup(struct device_node *np,
>  						 struct at91_pmc *pmc);
>  extern void __init of_at91sam9x5_clk_prog_setup(struct device_node *np,
>  						struct at91_pmc *pmc);
> -#endif
>  
>  #if defined(CONFIG_HAVE_AT91_UTMI)
>  extern void __init of_at91sam9x5_clk_utmi_setup(struct device_node *np,
> diff --git a/sound/soc/atmel/Kconfig b/sound/soc/atmel/Kconfig
> index e48d38a1b95c..e634eb78ed03 100644
> --- a/sound/soc/atmel/Kconfig
> +++ b/sound/soc/atmel/Kconfig
> @@ -25,7 +25,7 @@ config SND_ATMEL_SOC_SSC
>  
>  config SND_AT91_SOC_SAM9G20_WM8731
>  	tristate "SoC Audio support for WM8731-based At91sam9g20 evaluation board"
> -	depends on ARCH_AT91 && ATMEL_SSC && SND_ATMEL_SOC && AT91_PROGRAMMABLE_CLOCKS
> +	depends on ARCH_AT91 && ATMEL_SSC && SND_ATMEL_SOC
>  	select SND_ATMEL_SOC_PDC
>  	select SND_ATMEL_SOC_SSC
>  	select SND_SOC_WM8731
> -- 
> 1.8.2.2
> 

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

end of thread, other threads:[~2013-12-13 15:25 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-11  0:07 [PATCH v2 0/5] net: macb updates Soren Brinkmann
2013-12-11  0:07 ` [PATCH v2 1/5] net: macb: Migrate to dev_pm_ops Soren Brinkmann
2013-12-11  0:07 ` [PATCH v2 2/5] net: macb: Migrate to devm clock interface Soren Brinkmann
2013-12-11  0:07 ` [PATCH v2 3/5] net: macb: Use devm_ioremap() Soren Brinkmann
2013-12-11  0:07 ` [PATCH v2 4/5] net: macb: Use devm_request_irq() Soren Brinkmann
2013-12-11  0:07 ` [PATCH v2 5/5] net: macb: Adjust tx_clk when link speed changes Soren Brinkmann
2013-12-11  3:57 ` [PATCH v2 0/5] net: macb updates David Miller
2013-12-12  7:00 ` Olof Johansson
2013-12-12 14:28   ` Nicolas Ferre
2013-12-12 14:28     ` Nicolas Ferre
2013-12-12 16:00     ` [PATCH] ARM: at91: remove AT91_PROGRAMMABLE_CLOCKS configuration option Nicolas Ferre
2013-12-12 16:00       ` Nicolas Ferre
2013-12-12 18:38       ` Kevin Hilman
2013-12-12 18:38         ` Kevin Hilman
2013-12-13 15:18       ` Jean-Christophe PLAGNIOL-VILLARD
2013-12-13 15:18         ` Jean-Christophe PLAGNIOL-VILLARD

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.