Chaithrika U S <[email protected]> writes:
> Remove the usage of cpu_is_xxx() macros from the EMAC driver.
>
> Add a member to the platform data to indicate the version of the EMAC.
> Use this information instead of the cpu_is_xxx() macros.
>
> This patch is dependent on the previous sets of patches submitted for EMAC.
> The changes have been tested on TI DM644x and DM646x EVMs.
>
> Signed-off-by: Chaithrika U S <[email protected]>
Thanks, pushing today.
Kevin
> ---
> arch/arm/mach-davinci/dm644x.c | 1 +
> arch/arm/mach-davinci/dm646x.c | 1 +
> arch/arm/mach-davinci/include/mach/emac.h | 5 +++++
> drivers/net/davinci_emac.c | 15 +++++++--------
> 4 files changed, 14 insertions(+), 8 deletions(-)
>
> diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
> index 40782d3..6a08568 100644
> --- a/arch/arm/mach-davinci/dm644x.c
> +++ b/arch/arm/mach-davinci/dm644x.c
> @@ -453,6 +453,7 @@ void dm644x_init_emac(struct emac_platform_data *pdata)
> pdata->ctrl_ram_offset = DM644X_EMAC_CNTRL_RAM_OFFSET;
> pdata->mdio_reg_offset = DM644X_EMAC_MDIO_OFFSET;
> pdata->ctrl_ram_size = DM644X_EMAC_CNTRL_RAM_SIZE;
> + pdata->version = EMAC_VERSION_1;
> dm644x_emac_device.dev.platform_data = pdata;
> platform_device_register(&dm644x_emac_device);
> }
> diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c
> index 8f79604..0fa71a5 100644
> --- a/arch/arm/mach-davinci/dm646x.c
> +++ b/arch/arm/mach-davinci/dm646x.c
> @@ -394,6 +394,7 @@ void dm646x_init_emac(struct emac_platform_data *pdata)
> pdata->ctrl_ram_offset = DM646X_EMAC_CNTRL_RAM_OFFSET;
> pdata->mdio_reg_offset = DM646X_EMAC_MDIO_OFFSET;
> pdata->ctrl_ram_size = DM646X_EMAC_CNTRL_RAM_SIZE;
> + pdata->version = EMAC_VERSION_2;
> dm646x_emac_device.dev.platform_data = pdata;
> platform_device_register(&dm646x_emac_device);
> }
> diff --git a/arch/arm/mach-davinci/include/mach/emac.h
> b/arch/arm/mach-davinci/include/mach/emac.h
> index 14303ef..84d3372 100644
> --- a/arch/arm/mach-davinci/include/mach/emac.h
> +++ b/arch/arm/mach-davinci/include/mach/emac.h
> @@ -21,8 +21,13 @@ struct emac_platform_data {
> u32 phy_mask;
> u32 mdio_max_freq;
> u8 rmii_en;
> + u8 version;
> };
>
> +enum {
> + EMAC_VERSION_1, /* DM644x */
> + EMAC_VERSION_2, /* DM646x */
> +};
> void davinci_init_emac(struct emac_platform_data *pdata);
> #endif
>
> diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
> index ce7c4e8..8d83400 100644
> --- a/drivers/net/davinci_emac.c
> +++ b/drivers/net/davinci_emac.c
> @@ -65,9 +65,6 @@
> #include <asm/irq.h>
> #include <asm/page.h>
>
> -#include <mach/memory.h>
> -#include <mach/cpu.h>
> -#include <mach/hardware.h>
> #include <mach/emac.h>
>
>
> @@ -492,6 +489,7 @@ struct emac_priv {
> u32 rx_buf_size;
> u32 isr_count;
> u8 rmii_en;
> + u8 version;
> struct net_device_stats net_dev_stats;
> u32 mac_hash1;
> u32 mac_hash2;
> @@ -766,7 +764,7 @@ static void emac_update_phystatus(struct emac_priv *priv)
> mac_control &= ~(EMAC_MACCONTROL_FULLDUPLEXEN);
> }
>
> - if (priv->speed == SPEED_1000 && cpu_is_davinci_dm646x()) {
> + if (priv->speed == SPEED_1000 && (priv->version == EMAC_VERSION_2)) {
> mac_control = emac_read(EMAC_MACCONTROL);
> mac_control |= (EMAC_DM646X_MACCONTORL_GMIIEN |
> EMAC_DM646X_MACCONTORL_GIG |
> @@ -1012,7 +1010,7 @@ static void emac_dev_mcast_set(struct net_device *ndev)
> */
> static void emac_int_disable(struct emac_priv *priv)
> {
> - if (cpu_is_davinci_dm646x()) {
> + if (priv->version == EMAC_VERSION_2) {
> unsigned long flags;
>
> local_irq_save(flags);
> @@ -1040,7 +1038,7 @@ static void emac_int_disable(struct emac_priv *priv)
> */
> static void emac_int_enable(struct emac_priv *priv)
> {
> - if (cpu_is_davinci_dm646x()) {
> + if (priv->version == EMAC_VERSION_2) {
> emac_ctrl_write(EMAC_DM646X_CMRXINTEN, 0xff);
> emac_ctrl_write(EMAC_DM646X_CMTXINTEN, 0xff);
>
> @@ -2169,7 +2167,7 @@ static int emac_poll(struct napi_struct *napi, int
> budget)
>
> mask = EMAC_DM644X_MAC_IN_VECTOR_TX_INT_VEC;
>
> - if (cpu_is_davinci_dm646x())
> + if (priv->version == EMAC_VERSION_2)
> mask = EMAC_DM646X_MAC_IN_VECTOR_TX_INT_VEC;
>
> if (status & mask) {
> @@ -2180,7 +2178,7 @@ static int emac_poll(struct napi_struct *napi, int
> budget)
>
> mask = EMAC_DM644X_MAC_IN_VECTOR_RX_INT_VEC;
>
> - if (cpu_is_davinci_dm646x())
> + if (priv->version == EMAC_VERSION_2)
> mask = EMAC_DM646X_MAC_IN_VECTOR_RX_INT_VEC;
>
> if (status & mask) {
> @@ -2662,6 +2660,7 @@ static int __devinit davinci_emac_probe(struct
> platform_device *pdev)
> memcpy(priv->mac_addr, pdata->mac_addr, 6);
> priv->phy_mask = pdata->phy_mask;
> priv->rmii_en = pdata->rmii_en;
> + priv->version = pdata->version;
>
> /* Get EMAC platform data */
> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> --
> 1.5.6
>
> _______________________________________________
> Davinci-linux-open-source mailing list
> [email protected]
> http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source