Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 135370
b: refs/heads/master
c: e84665c
h: refs/heads/master
v: v3
  • Loading branch information
Lennert Buytenhek authored and David S. Miller committed Mar 22, 2009
1 parent 588a5ce commit 4060b23
Show file tree
Hide file tree
Showing 18 changed files with 444 additions and 212 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 076d3e10a54caa2c148de5732c126c7a31381d48
refs/heads/master: e84665c9cb4db963393fafad6fefe5efdd7e4a09
5 changes: 4 additions & 1 deletion trunk/arch/arm/mach-kirkwood/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,14 +231,17 @@ static struct platform_device kirkwood_switch_device = {

void __init kirkwood_ge00_switch_init(struct dsa_platform_data *d, int irq)
{
int i;

if (irq != NO_IRQ) {
kirkwood_switch_resources[0].start = irq;
kirkwood_switch_resources[0].end = irq;
kirkwood_switch_device.num_resources = 1;
}

d->mii_bus = &kirkwood_ge00_shared.dev;
d->netdev = &kirkwood_ge00.dev;
for (i = 0; i < d->nr_chips; i++)
d->chip[i].mii_bus = &kirkwood_ge00_shared.dev;
kirkwood_switch_device.dev.platform_data = d;

platform_device_register(&kirkwood_switch_device);
Expand Down
13 changes: 9 additions & 4 deletions trunk/arch/arm/mach-kirkwood/rd88f6281-setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,19 @@ static struct mv643xx_eth_platform_data rd88f6281_ge00_data = {
.duplex = DUPLEX_FULL,
};

static struct dsa_platform_data rd88f6281_switch_data = {
static struct dsa_chip_data rd88f6281_switch_chip_data = {
.port_names[0] = "lan1",
.port_names[1] = "lan2",
.port_names[2] = "lan3",
.port_names[3] = "lan4",
.port_names[5] = "cpu",
};

static struct dsa_platform_data rd88f6281_switch_plat_data = {
.nr_chips = 1,
.chip = &rd88f6281_switch_chip_data,
};

static struct mv643xx_eth_platform_data rd88f6281_ge01_data = {
.phy_addr = MV643XX_ETH_PHY_ADDR(11),
};
Expand All @@ -105,12 +110,12 @@ static void __init rd88f6281_init(void)
kirkwood_ge00_init(&rd88f6281_ge00_data);
kirkwood_pcie_id(&dev, &rev);
if (rev == MV88F6281_REV_A0) {
rd88f6281_switch_data.sw_addr = 10;
rd88f6281_switch_chip_data.sw_addr = 10;
kirkwood_ge01_init(&rd88f6281_ge01_data);
} else {
rd88f6281_switch_data.port_names[4] = "wan";
rd88f6281_switch_chip_data.port_names[4] = "wan";
}
kirkwood_ge00_switch_init(&rd88f6281_switch_data, NO_IRQ);
kirkwood_ge00_switch_init(&rd88f6281_switch_plat_data, NO_IRQ);

kirkwood_rtc_init();
kirkwood_sata_init(&rd88f6281_sata_data);
Expand Down
5 changes: 4 additions & 1 deletion trunk/arch/arm/mach-orion5x/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,14 +219,17 @@ static struct platform_device orion5x_switch_device = {

void __init orion5x_eth_switch_init(struct dsa_platform_data *d, int irq)
{
int i;

if (irq != NO_IRQ) {
orion5x_switch_resources[0].start = irq;
orion5x_switch_resources[0].end = irq;
orion5x_switch_device.num_resources = 1;
}

d->mii_bus = &orion5x_eth_shared.dev;
d->netdev = &orion5x_eth.dev;
for (i = 0; i < d->nr_chips; i++)
d->chip[i].mii_bus = &orion5x_eth_shared.dev;
orion5x_switch_device.dev.platform_data = d;

platform_device_register(&orion5x_switch_device);
Expand Down
9 changes: 7 additions & 2 deletions trunk/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ static struct mv643xx_eth_platform_data rd88f5181l_fxo_eth_data = {
.duplex = DUPLEX_FULL,
};

static struct dsa_platform_data rd88f5181l_fxo_switch_data = {
static struct dsa_chip_data rd88f5181l_fxo_switch_chip_data = {
.port_names[0] = "lan2",
.port_names[1] = "lan1",
.port_names[2] = "wan",
Expand All @@ -103,6 +103,11 @@ static struct dsa_platform_data rd88f5181l_fxo_switch_data = {
.port_names[7] = "lan3",
};

static struct dsa_platform_data rd88f5181l_fxo_switch_plat_data = {
.nr_chips = 1,
.chip = &rd88f5181l_fxo_switch_chip_data,
};

static void __init rd88f5181l_fxo_init(void)
{
/*
Expand All @@ -117,7 +122,7 @@ static void __init rd88f5181l_fxo_init(void)
*/
orion5x_ehci0_init();
orion5x_eth_init(&rd88f5181l_fxo_eth_data);
orion5x_eth_switch_init(&rd88f5181l_fxo_switch_data, NO_IRQ);
orion5x_eth_switch_init(&rd88f5181l_fxo_switch_plat_data, NO_IRQ);
orion5x_uart0_init();

orion5x_setup_dev_boot_win(RD88F5181L_FXO_NOR_BOOT_BASE,
Expand Down
10 changes: 8 additions & 2 deletions trunk/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ static struct mv643xx_eth_platform_data rd88f5181l_ge_eth_data = {
.duplex = DUPLEX_FULL,
};

static struct dsa_platform_data rd88f5181l_ge_switch_data = {
static struct dsa_chip_data rd88f5181l_ge_switch_chip_data = {
.port_names[0] = "lan2",
.port_names[1] = "lan1",
.port_names[2] = "wan",
Expand All @@ -104,6 +104,11 @@ static struct dsa_platform_data rd88f5181l_ge_switch_data = {
.port_names[7] = "lan3",
};

static struct dsa_platform_data rd88f5181l_ge_switch_plat_data = {
.nr_chips = 1,
.chip = &rd88f5181l_ge_switch_chip_data,
};

static struct i2c_board_info __initdata rd88f5181l_ge_i2c_rtc = {
I2C_BOARD_INFO("ds1338", 0x68),
};
Expand All @@ -122,7 +127,8 @@ static void __init rd88f5181l_ge_init(void)
*/
orion5x_ehci0_init();
orion5x_eth_init(&rd88f5181l_ge_eth_data);
orion5x_eth_switch_init(&rd88f5181l_ge_switch_data, gpio_to_irq(8));
orion5x_eth_switch_init(&rd88f5181l_ge_switch_plat_data,
gpio_to_irq(8));
orion5x_i2c_init();
orion5x_uart0_init();

Expand Down
10 changes: 8 additions & 2 deletions trunk/arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static struct mv643xx_eth_platform_data rd88f6183ap_ge_eth_data = {
.duplex = DUPLEX_FULL,
};

static struct dsa_platform_data rd88f6183ap_ge_switch_data = {
static struct dsa_chip_data rd88f6183ap_ge_switch_chip_data = {
.port_names[0] = "lan1",
.port_names[1] = "lan2",
.port_names[2] = "lan3",
Expand All @@ -44,6 +44,11 @@ static struct dsa_platform_data rd88f6183ap_ge_switch_data = {
.port_names[5] = "cpu",
};

static struct dsa_platform_data rd88f6183ap_ge_switch_plat_data = {
.nr_chips = 1,
.chip = &rd88f6183ap_ge_switch_chip_data,
};

static struct mtd_partition rd88f6183ap_ge_partitions[] = {
{
.name = "kernel",
Expand Down Expand Up @@ -89,7 +94,8 @@ static void __init rd88f6183ap_ge_init(void)
*/
orion5x_ehci0_init();
orion5x_eth_init(&rd88f6183ap_ge_eth_data);
orion5x_eth_switch_init(&rd88f6183ap_ge_switch_data, gpio_to_irq(3));
orion5x_eth_switch_init(&rd88f6183ap_ge_switch_plat_data,
gpio_to_irq(3));
spi_register_board_info(rd88f6183ap_ge_spi_slave_info,
ARRAY_SIZE(rd88f6183ap_ge_spi_slave_info));
orion5x_spi_init();
Expand Down
9 changes: 7 additions & 2 deletions trunk/arch/arm/mach-orion5x/wrt350n-v2-setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ static struct mv643xx_eth_platform_data wrt350n_v2_eth_data = {
.duplex = DUPLEX_FULL,
};

static struct dsa_platform_data wrt350n_v2_switch_data = {
static struct dsa_chip_data wrt350n_v2_switch_chip_data = {
.port_names[0] = "lan2",
.port_names[1] = "lan1",
.port_names[2] = "wan",
Expand All @@ -115,6 +115,11 @@ static struct dsa_platform_data wrt350n_v2_switch_data = {
.port_names[7] = "lan4",
};

static struct dsa_platform_data wrt350n_v2_switch_plat_data = {
.nr_chips = 1,
.chip = &wrt350n_v2_switch_chip_data,
};

static void __init wrt350n_v2_init(void)
{
/*
Expand All @@ -129,7 +134,7 @@ static void __init wrt350n_v2_init(void)
*/
orion5x_ehci0_init();
orion5x_eth_init(&wrt350n_v2_eth_data);
orion5x_eth_switch_init(&wrt350n_v2_switch_data, NO_IRQ);
orion5x_eth_switch_init(&wrt350n_v2_switch_plat_data, NO_IRQ);
orion5x_uart0_init();

orion5x_setup_dev_boot_win(WRT350N_V2_NOR_BOOT_BASE,
Expand Down
42 changes: 33 additions & 9 deletions trunk/include/net/dsa.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* include/net/dsa.h - Driver for Distributed Switch Architecture switch chips
* Copyright (c) 2008 Marvell Semiconductor
* Copyright (c) 2008-2009 Marvell Semiconductor
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -11,23 +11,47 @@
#ifndef __LINUX_NET_DSA_H
#define __LINUX_NET_DSA_H

#define DSA_MAX_PORTS 12
#define DSA_MAX_SWITCHES 4
#define DSA_MAX_PORTS 12

struct dsa_chip_data {
/*
* How to access the switch configuration registers.
*/
struct device *mii_bus;
int sw_addr;

/*
* The names of the switch's ports. Use "cpu" to
* designate the switch port that the cpu is connected to,
* "dsa" to indicate that this port is a DSA link to
* another switch, NULL to indicate the port is unused,
* or any other string to indicate this is a physical port.
*/
char *port_names[DSA_MAX_PORTS];

/*
* An array (with nr_chips elements) of which element [a]
* indicates which port on this switch should be used to
* send packets to that are destined for switch a. Can be
* NULL if there is only one switch chip.
*/
s8 *rtable;
};

struct dsa_platform_data {
/*
* Reference to a Linux network interface that connects
* to the switch chip.
* to the root switch chip of the tree.
*/
struct device *netdev;

/*
* How to access the switch configuration registers, and
* the names of the switch ports (use "cpu" to designate
* the switch port that the cpu is connected to).
* Info structs describing each of the switch chips
* connected via this network interface.
*/
struct device *mii_bus;
int sw_addr;
char *port_names[DSA_MAX_PORTS];
int nr_chips;
struct dsa_chip_data *chip;
};

extern bool dsa_uses_dsa_tags(void *dsa_ptr);
Expand Down
Loading

0 comments on commit 4060b23

Please sign in to comment.