Merge branch 'mvneta-multi-clk'
Jisheng Zhang says: ==================== net: mvneta: support more than one clk Some platforms may provide more than one clk for the mvneta IP, for example Marvell BG4CT provides "core" clk for the mac core, and "axi" clk for the AXI bus logic. This series tries to addess the "more than one clk" issue. Note: to support BG4CT, we have lots of refactor work to do, eg. BG4CT doesn't have mbus concept etc. Since v2: - Name the optional clock as "bus", which is a bit more flexible. Since v1: - Add Thomas Acks to patch1 and patch2. - make sure the headers are really sorted (some headers are still unsorted in v1). - disable axi clk before disabling core clk, Thank Thomas. - update dt binding as Thomas suggested. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
8e0c2ab262
|
@ -6,12 +6,17 @@ Required properties:
|
|||
- interrupts: interrupt for the device
|
||||
- phy: See ethernet.txt file in the same directory.
|
||||
- phy-mode: See ethernet.txt file in the same directory
|
||||
- clocks: a pointer to the reference clock for this device.
|
||||
- clocks: List of clocks for this device. At least one clock is
|
||||
mandatory for the core clock. If several clocks are given, then the
|
||||
clock-names property must be used to identify them.
|
||||
|
||||
Optional properties:
|
||||
- tx-csum-limit: maximum mtu supported by port that allow TX checksum.
|
||||
Value is presented in bytes. If not used, by default 1600B is set for
|
||||
"marvell,armada-370-neta" and 9800B for others.
|
||||
- clock-names: List of names corresponding to clocks property; shall be
|
||||
"core" for core clock and "bus" for the optional bus clock.
|
||||
|
||||
|
||||
Example:
|
||||
|
||||
|
|
|
@ -11,28 +11,28 @@
|
|||
* warranty of any kind, whether express or implied.
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/cpu.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/if_vlan.h>
|
||||
#include <linux/inetdevice.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/mbus.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/if_vlan.h>
|
||||
#include <net/ip.h>
|
||||
#include <net/ipv6.h>
|
||||
#include <linux/io.h>
|
||||
#include <net/tso.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/of_irq.h>
|
||||
#include <linux/of_mdio.h>
|
||||
#include <linux/of_net.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/phy.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/cpu.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <net/ip.h>
|
||||
#include <net/ipv6.h>
|
||||
#include <net/tso.h>
|
||||
|
||||
/* Registers */
|
||||
#define MVNETA_RXQ_CONFIG_REG(q) (0x1400 + ((q) << 2))
|
||||
|
@ -373,6 +373,8 @@ struct mvneta_port {
|
|||
|
||||
/* Core clock */
|
||||
struct clk *clk;
|
||||
/* AXI clock */
|
||||
struct clk *clk_bus;
|
||||
u8 mcast_count[256];
|
||||
u16 tx_ring_size;
|
||||
u16 rx_ring_size;
|
||||
|
@ -3604,7 +3606,9 @@ static int mvneta_probe(struct platform_device *pdev)
|
|||
|
||||
pp->indir[0] = rxq_def;
|
||||
|
||||
pp->clk = devm_clk_get(&pdev->dev, NULL);
|
||||
pp->clk = devm_clk_get(&pdev->dev, "core");
|
||||
if (IS_ERR(pp->clk))
|
||||
pp->clk = devm_clk_get(&pdev->dev, NULL);
|
||||
if (IS_ERR(pp->clk)) {
|
||||
err = PTR_ERR(pp->clk);
|
||||
goto err_put_phy_node;
|
||||
|
@ -3612,6 +3616,10 @@ static int mvneta_probe(struct platform_device *pdev)
|
|||
|
||||
clk_prepare_enable(pp->clk);
|
||||
|
||||
pp->clk_bus = devm_clk_get(&pdev->dev, "bus");
|
||||
if (!IS_ERR(pp->clk_bus))
|
||||
clk_prepare_enable(pp->clk_bus);
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
pp->base = devm_ioremap_resource(&pdev->dev, res);
|
||||
if (IS_ERR(pp->base)) {
|
||||
|
@ -3723,6 +3731,7 @@ static int mvneta_probe(struct platform_device *pdev)
|
|||
err_free_ports:
|
||||
free_percpu(pp->ports);
|
||||
err_clk:
|
||||
clk_disable_unprepare(pp->clk_bus);
|
||||
clk_disable_unprepare(pp->clk);
|
||||
err_put_phy_node:
|
||||
of_node_put(phy_node);
|
||||
|
@ -3740,6 +3749,7 @@ static int mvneta_remove(struct platform_device *pdev)
|
|||
struct mvneta_port *pp = netdev_priv(dev);
|
||||
|
||||
unregister_netdev(dev);
|
||||
clk_disable_unprepare(pp->clk_bus);
|
||||
clk_disable_unprepare(pp->clk);
|
||||
free_percpu(pp->ports);
|
||||
free_percpu(pp->stats);
|
||||
|
|
Loading…
Reference in New Issue