Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 452503eb authored by Andrew Lunn's avatar Andrew Lunn Committed by Mike Turquette
Browse files

ARM: Orion: Eth: Add clk/clkdev support.



The t_clk is moved from the shared part of the ethernet driver into
the per port section. Each port can have its own gated clock, which it
needs to enable/disable, as oppossed to there being one clock shared
by all ports. In practice, only kirkwood supports this at the moment.

Signed-off-by: default avatarAndrew Lunn <andrew@lunn.ch>
Tested-by: default avatarJamie Lentin <jm@lentin.co.uk>
Signed-off-by: default avatarMike Turquette <mturquette@linaro.org>
parent 4574b886
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -102,8 +102,7 @@ void __init dove_ehci1_init(void)
void __init dove_ge00_init(struct mv643xx_eth_platform_data *eth_data)
{
	orion_ge00_init(eth_data,
			DOVE_GE00_PHYS_BASE, IRQ_DOVE_GE00_SUM,
			0, get_tclk());
			DOVE_GE00_PHYS_BASE, IRQ_DOVE_GE00_SUM, 0);
}

/*****************************************************************************
+7 −5
Original line number Diff line number Diff line
@@ -86,14 +86,14 @@ static struct clk __init *kirkwood_register_gate(const char *name, u8 bit_idx)

void __init kirkwood_clk_init(void)
{
	struct clk *runit;
	struct clk *runit, *ge0, *ge1;

	tclk = clk_register_fixed_rate(NULL, "tclk", NULL,
				       CLK_IS_ROOT, kirkwood_tclk);

	runit = kirkwood_register_gate("runit",  CGC_BIT_RUNIT);
	kirkwood_register_gate("ge0",    CGC_BIT_GE0);
	kirkwood_register_gate("ge1",    CGC_BIT_GE1);
	ge0 = kirkwood_register_gate("ge0",    CGC_BIT_GE0);
	ge1 = kirkwood_register_gate("ge1",    CGC_BIT_GE1);
	kirkwood_register_gate("sata0",  CGC_BIT_SATA0);
	kirkwood_register_gate("sata1",  CGC_BIT_SATA1);
	kirkwood_register_gate("usb0",   CGC_BIT_USB0);
@@ -110,6 +110,8 @@ void __init kirkwood_clk_init(void)
	/* clkdev entries, mapping clks to devices */
	orion_clkdev_add(NULL, "orion_spi.0", runit);
	orion_clkdev_add(NULL, "orion_spi.1", runit);
	orion_clkdev_add(NULL, MV643XX_ETH_NAME ".0", ge0);
	orion_clkdev_add(NULL, MV643XX_ETH_NAME ".1", ge1);
}

/*****************************************************************************
@@ -131,7 +133,7 @@ void __init kirkwood_ge00_init(struct mv643xx_eth_platform_data *eth_data)

	orion_ge00_init(eth_data,
			GE00_PHYS_BASE, IRQ_KIRKWOOD_GE00_SUM,
			IRQ_KIRKWOOD_GE00_ERR, kirkwood_tclk);
			IRQ_KIRKWOOD_GE00_ERR);
}


@@ -145,7 +147,7 @@ void __init kirkwood_ge01_init(struct mv643xx_eth_platform_data *eth_data)

	orion_ge01_init(eth_data,
			GE01_PHYS_BASE, IRQ_KIRKWOOD_GE01_SUM,
			IRQ_KIRKWOOD_GE01_ERR, kirkwood_tclk);
			IRQ_KIRKWOOD_GE01_ERR);
}


+4 −4
Original line number Diff line number Diff line
@@ -213,7 +213,7 @@ void __init mv78xx0_ge00_init(struct mv643xx_eth_platform_data *eth_data)
{
	orion_ge00_init(eth_data,
			GE00_PHYS_BASE, IRQ_MV78XX0_GE00_SUM,
			IRQ_MV78XX0_GE_ERR, get_tclk());
			IRQ_MV78XX0_GE_ERR);
}


@@ -224,7 +224,7 @@ void __init mv78xx0_ge01_init(struct mv643xx_eth_platform_data *eth_data)
{
	orion_ge01_init(eth_data,
			GE01_PHYS_BASE, IRQ_MV78XX0_GE01_SUM,
			NO_IRQ, get_tclk());
			NO_IRQ);
}


@@ -248,7 +248,7 @@ void __init mv78xx0_ge10_init(struct mv643xx_eth_platform_data *eth_data)

	orion_ge10_init(eth_data,
			GE10_PHYS_BASE, IRQ_MV78XX0_GE10_SUM,
			NO_IRQ, get_tclk());
			NO_IRQ);
}


@@ -272,7 +272,7 @@ void __init mv78xx0_ge11_init(struct mv643xx_eth_platform_data *eth_data)

	orion_ge11_init(eth_data,
			GE11_PHYS_BASE, IRQ_MV78XX0_GE11_SUM,
			NO_IRQ, get_tclk());
			NO_IRQ);
}

/*****************************************************************************
+1 −1
Original line number Diff line number Diff line
@@ -109,7 +109,7 @@ void __init orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data)
{
	orion_ge00_init(eth_data,
			ORION5X_ETH_PHYS_BASE, IRQ_ORION5X_ETH_SUM,
			IRQ_ORION5X_ETH_ERR, orion5x_tclk);
			IRQ_ORION5X_ETH_ERR);
}


+12 −14
Original line number Diff line number Diff line
@@ -43,6 +43,10 @@ void __init orion_clkdev_init(struct clk *tclk)
{
	orion_clkdev_add(NULL, "orion_spi.0", tclk);
	orion_clkdev_add(NULL, "orion_spi.1", tclk);
	orion_clkdev_add(NULL, MV643XX_ETH_NAME ".0", tclk);
	orion_clkdev_add(NULL, MV643XX_ETH_NAME ".1", tclk);
	orion_clkdev_add(NULL, MV643XX_ETH_NAME ".2", tclk);
	orion_clkdev_add(NULL, MV643XX_ETH_NAME ".3", tclk);
}

/* Fill in the resources structure and link it into the platform
@@ -225,13 +229,11 @@ void __init orion_rtc_init(unsigned long mapbase,
 ****************************************************************************/
static __init void ge_complete(
	struct mv643xx_eth_shared_platform_data *orion_ge_shared_data,
	int tclk,
	struct resource *orion_ge_resource, unsigned long irq,
	struct platform_device *orion_ge_shared,
	struct mv643xx_eth_platform_data *eth_data,
	struct platform_device *orion_ge)
{
	orion_ge_shared_data->t_clk = tclk;
	orion_ge_resource->start = irq;
	orion_ge_resource->end = irq;
	eth_data->shared = orion_ge_shared;
@@ -282,12 +284,11 @@ static struct platform_device orion_ge00 = {
void __init orion_ge00_init(struct mv643xx_eth_platform_data *eth_data,
			    unsigned long mapbase,
			    unsigned long irq,
			    unsigned long irq_err,
			    int tclk)
			    unsigned long irq_err)
{
	fill_resources(&orion_ge00_shared, orion_ge00_shared_resources,
		       mapbase + 0x2000, SZ_16K - 1, irq_err);
	ge_complete(&orion_ge00_shared_data, tclk,
	ge_complete(&orion_ge00_shared_data,
		    orion_ge00_resources, irq, &orion_ge00_shared,
		    eth_data, &orion_ge00);
}
@@ -335,12 +336,11 @@ static struct platform_device orion_ge01 = {
void __init orion_ge01_init(struct mv643xx_eth_platform_data *eth_data,
			    unsigned long mapbase,
			    unsigned long irq,
			    unsigned long irq_err,
			    int tclk)
			    unsigned long irq_err)
{
	fill_resources(&orion_ge01_shared, orion_ge01_shared_resources,
		       mapbase + 0x2000, SZ_16K - 1, irq_err);
	ge_complete(&orion_ge01_shared_data, tclk,
	ge_complete(&orion_ge01_shared_data,
		    orion_ge01_resources, irq, &orion_ge01_shared,
		    eth_data, &orion_ge01);
}
@@ -388,12 +388,11 @@ static struct platform_device orion_ge10 = {
void __init orion_ge10_init(struct mv643xx_eth_platform_data *eth_data,
			    unsigned long mapbase,
			    unsigned long irq,
			    unsigned long irq_err,
			    int tclk)
			    unsigned long irq_err)
{
	fill_resources(&orion_ge10_shared, orion_ge10_shared_resources,
		       mapbase + 0x2000, SZ_16K - 1, irq_err);
	ge_complete(&orion_ge10_shared_data, tclk,
	ge_complete(&orion_ge10_shared_data,
		    orion_ge10_resources, irq, &orion_ge10_shared,
		    eth_data, &orion_ge10);
}
@@ -441,12 +440,11 @@ static struct platform_device orion_ge11 = {
void __init orion_ge11_init(struct mv643xx_eth_platform_data *eth_data,
			    unsigned long mapbase,
			    unsigned long irq,
			    unsigned long irq_err,
			    int tclk)
			    unsigned long irq_err)
{
	fill_resources(&orion_ge11_shared, orion_ge11_shared_resources,
		       mapbase + 0x2000, SZ_16K - 1, irq_err);
	ge_complete(&orion_ge11_shared_data, tclk,
	ge_complete(&orion_ge11_shared_data,
		    orion_ge11_resources, irq, &orion_ge11_shared,
		    eth_data, &orion_ge11);
}
Loading