Commit 7b96109f authored by Sriramakrishnan's avatar Sriramakrishnan Committed by Kevin Hilman

TI Davinci EMAC : add platform specific interrupt enable/disable logic.

On certain SOCs, the EMAC controller is interfaced with a wrapper logic
for handling interrupts. This  patch implements a platform
specific hook to cater to platforms that require custom interrupt
handling logic
Signed-off-by: default avatarSriramakrishnan <srk@ti.com>
Acked-by: default avatarChaithrika U S <chaithrika@ti.com>
Acked-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarKevin Hilman <khilman@deeprootsystems.com>
parent 5a310760
...@@ -487,6 +487,9 @@ struct emac_priv { ...@@ -487,6 +487,9 @@ struct emac_priv {
struct mii_bus *mii_bus; struct mii_bus *mii_bus;
struct phy_device *phydev; struct phy_device *phydev;
spinlock_t lock; spinlock_t lock;
/*platform specific members*/
void (*int_enable) (void);
void (*int_disable) (void);
}; };
/* clock frequency for EMAC */ /* clock frequency for EMAC */
...@@ -1001,6 +1004,8 @@ static void emac_int_disable(struct emac_priv *priv) ...@@ -1001,6 +1004,8 @@ static void emac_int_disable(struct emac_priv *priv)
emac_ctrl_write(EMAC_DM646X_CMRXINTEN, 0x0); emac_ctrl_write(EMAC_DM646X_CMRXINTEN, 0x0);
emac_ctrl_write(EMAC_DM646X_CMTXINTEN, 0x0); emac_ctrl_write(EMAC_DM646X_CMTXINTEN, 0x0);
/* NOTE: Rx Threshold and Misc interrupts are not disabled */ /* NOTE: Rx Threshold and Misc interrupts are not disabled */
if (priv->int_disable)
priv->int_disable();
local_irq_restore(flags); local_irq_restore(flags);
...@@ -1020,6 +1025,9 @@ static void emac_int_disable(struct emac_priv *priv) ...@@ -1020,6 +1025,9 @@ static void emac_int_disable(struct emac_priv *priv)
static void emac_int_enable(struct emac_priv *priv) static void emac_int_enable(struct emac_priv *priv)
{ {
if (priv->version == EMAC_VERSION_2) { if (priv->version == EMAC_VERSION_2) {
if (priv->int_enable)
priv->int_enable();
emac_ctrl_write(EMAC_DM646X_CMRXINTEN, 0xff); emac_ctrl_write(EMAC_DM646X_CMRXINTEN, 0xff);
emac_ctrl_write(EMAC_DM646X_CMTXINTEN, 0xff); emac_ctrl_write(EMAC_DM646X_CMTXINTEN, 0xff);
...@@ -2659,6 +2667,9 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev) ...@@ -2659,6 +2667,9 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev)
priv->phy_mask = pdata->phy_mask; priv->phy_mask = pdata->phy_mask;
priv->rmii_en = pdata->rmii_en; priv->rmii_en = pdata->rmii_en;
priv->version = pdata->version; priv->version = pdata->version;
priv->int_enable = pdata->interrupt_enable;
priv->int_disable = pdata->interrupt_disable;
emac_dev = &ndev->dev; emac_dev = &ndev->dev;
/* Get EMAC platform data */ /* Get EMAC platform data */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
......
...@@ -25,6 +25,8 @@ struct emac_platform_data { ...@@ -25,6 +25,8 @@ struct emac_platform_data {
u32 mdio_max_freq; u32 mdio_max_freq;
u8 rmii_en; u8 rmii_en;
u8 version; u8 version;
void (*interrupt_enable) (void);
void (*interrupt_disable) (void);
}; };
enum { enum {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment