struct mv643xx_eth_shared_platform_data mv78xx0_ge01_shared_data = {
.t_clk = 0,
.dram = &mv78xx0_mbus_dram_info,
+ .shared_smi = &mv78xx0_ge00_shared,
};
static struct resource mv78xx0_ge01_shared_resources[] = {
void __init mv78xx0_ge01_init(struct mv643xx_eth_platform_data *eth_data)
{
eth_data->shared = &mv78xx0_ge01_shared;
- eth_data->shared_smi = &mv78xx0_ge00_shared;
mv78xx0_ge01.dev.platform_data = eth_data;
platform_device_register(&mv78xx0_ge01_shared);
struct mv643xx_eth_shared_platform_data mv78xx0_ge10_shared_data = {
.t_clk = 0,
.dram = &mv78xx0_mbus_dram_info,
+ .shared_smi = &mv78xx0_ge00_shared,
};
static struct resource mv78xx0_ge10_shared_resources[] = {
void __init mv78xx0_ge10_init(struct mv643xx_eth_platform_data *eth_data)
{
eth_data->shared = &mv78xx0_ge10_shared;
- eth_data->shared_smi = &mv78xx0_ge00_shared;
mv78xx0_ge10.dev.platform_data = eth_data;
platform_device_register(&mv78xx0_ge10_shared);
struct mv643xx_eth_shared_platform_data mv78xx0_ge11_shared_data = {
.t_clk = 0,
.dram = &mv78xx0_mbus_dram_info,
+ .shared_smi = &mv78xx0_ge00_shared,
};
static struct resource mv78xx0_ge11_shared_resources[] = {
void __init mv78xx0_ge11_init(struct mv643xx_eth_platform_data *eth_data)
{
eth_data->shared = &mv78xx0_ge11_shared;
- eth_data->shared_smi = &mv78xx0_ge00_shared;
mv78xx0_ge11.dev.platform_data = eth_data;
platform_device_register(&mv78xx0_ge11_shared);
*/
void __iomem *base;
+ /*
+ * Points at the right SMI instance to use.
+ */
+ struct mv643xx_eth_shared_private *smi;
+
/*
* Protects access to SMI_REG, which is shared between ports.
*/
struct net_device *dev;
- struct mv643xx_eth_shared_private *shared_smi;
int phy_addr;
spinlock_t lock;
static int smi_reg_read(struct mv643xx_eth_private *mp,
unsigned int addr, unsigned int reg)
{
- struct mv643xx_eth_shared_private *msp = mp->shared_smi;
+ struct mv643xx_eth_shared_private *msp = mp->shared->smi;
void __iomem *smi_reg = msp->base + SMI_REG;
int ret;
static int smi_reg_write(struct mv643xx_eth_private *mp, unsigned int addr,
unsigned int reg, unsigned int value)
{
- struct mv643xx_eth_shared_private *msp = mp->shared_smi;
+ struct mv643xx_eth_shared_private *msp = mp->shared->smi;
void __iomem *smi_reg = msp->base + SMI_REG;
mutex_lock(&msp->phy_lock);
if (msp->base == NULL)
goto out_free;
+ msp->smi = msp;
+ if (pd != NULL && pd->shared_smi != NULL)
+ msp->smi = platform_get_drvdata(pd->shared_smi);
+
mutex_init(&msp->phy_lock);
msp->err_interrupt = NO_IRQ;
uc_addr_get(mp, dev->dev_addr);
if (pd->phy_addr == -1) {
- mp->shared_smi = NULL;
mp->phy_addr = -1;
} else {
- mp->shared_smi = mp->shared;
- if (pd->shared_smi != NULL)
- mp->shared_smi = platform_get_drvdata(pd->shared_smi);
-
if (pd->force_phy_addr || pd->phy_addr) {
mp->phy_addr = pd->phy_addr & 0x3f;
phy_addr_set(mp, mp->phy_addr);
struct mv643xx_eth_shared_platform_data {
struct mbus_dram_target_info *dram;
+ struct platform_device *shared_smi;
unsigned int t_clk;
};
/*
* Whether a PHY is present, and if yes, at which address.
*/
- struct platform_device *shared_smi;
int force_phy_addr;
int phy_addr;