aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bnx2x/bnx2x_main.c
diff options
context:
space:
mode:
authorYaniv Rosner <yanivr@broadcom.com>2011-06-13 21:34:27 -0400
committerDavid S. Miller <davem@conan.davemloft.net>2011-06-15 10:56:57 -0400
commit0d40f0d425ec632956547bd8efd8965e5945e1dc (patch)
treeb2e2f76c427c8a6f130b82d1942fd3e57e82a6a5 /drivers/net/bnx2x/bnx2x_main.c
parent6c3218c6f7e5be6d785486797d48203d54cfd893 (diff)
bnx2x: Adjust BCM84833 to BCM578xx
Signed-off-by: Yaniv Rosner <yanivr@broadcom.com> Signed-off-by: Vladislav Zolotarov <vladz@broadcom.com> Signed-off-by: Eilon Greenstein <eilong@broadcom.com> Signed-off-by: David S. Miller <davem@conan.davemloft.net>
Diffstat (limited to 'drivers/net/bnx2x/bnx2x_main.c')
-rw-r--r--drivers/net/bnx2x/bnx2x_main.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/drivers/net/bnx2x/bnx2x_main.c b/drivers/net/bnx2x/bnx2x_main.c
index 0dddba9532c1..29c67029c756 100644
--- a/drivers/net/bnx2x/bnx2x_main.c
+++ b/drivers/net/bnx2x/bnx2x_main.c
@@ -1955,6 +1955,53 @@ int bnx2x_set_gpio(struct bnx2x *bp, int gpio_num, u32 mode, u8 port)
1955 return 0; 1955 return 0;
1956} 1956}
1957 1957
1958int bnx2x_set_mult_gpio(struct bnx2x *bp, u8 pins, u32 mode)
1959{
1960 u32 gpio_reg = 0;
1961 int rc = 0;
1962
1963 /* Any port swapping should be handled by caller. */
1964
1965 bnx2x_acquire_hw_lock(bp, HW_LOCK_RESOURCE_GPIO);
1966 /* read GPIO and mask except the float bits */
1967 gpio_reg = REG_RD(bp, MISC_REG_GPIO);
1968 gpio_reg &= ~(pins << MISC_REGISTERS_GPIO_FLOAT_POS);
1969 gpio_reg &= ~(pins << MISC_REGISTERS_GPIO_CLR_POS);
1970 gpio_reg &= ~(pins << MISC_REGISTERS_GPIO_SET_POS);
1971
1972 switch (mode) {
1973 case MISC_REGISTERS_GPIO_OUTPUT_LOW:
1974 DP(NETIF_MSG_LINK, "Set GPIO 0x%x -> output low\n", pins);
1975 /* set CLR */
1976 gpio_reg |= (pins << MISC_REGISTERS_GPIO_CLR_POS);
1977 break;
1978
1979 case MISC_REGISTERS_GPIO_OUTPUT_HIGH:
1980 DP(NETIF_MSG_LINK, "Set GPIO 0x%x -> output high\n", pins);
1981 /* set SET */
1982 gpio_reg |= (pins << MISC_REGISTERS_GPIO_SET_POS);
1983 break;
1984
1985 case MISC_REGISTERS_GPIO_INPUT_HI_Z:
1986 DP(NETIF_MSG_LINK, "Set GPIO 0x%x -> input\n", pins);
1987 /* set FLOAT */
1988 gpio_reg |= (pins << MISC_REGISTERS_GPIO_FLOAT_POS);
1989 break;
1990
1991 default:
1992 BNX2X_ERR("Invalid GPIO mode assignment %d\n", mode);
1993 rc = -EINVAL;
1994 break;
1995 }
1996
1997 if (rc == 0)
1998 REG_WR(bp, MISC_REG_GPIO, gpio_reg);
1999
2000 bnx2x_release_hw_lock(bp, HW_LOCK_RESOURCE_GPIO);
2001
2002 return rc;
2003}
2004
1958int bnx2x_set_gpio_int(struct bnx2x *bp, int gpio_num, u32 mode, u8 port) 2005int bnx2x_set_gpio_int(struct bnx2x *bp, int gpio_num, u32 mode, u8 port)
1959{ 2006{
1960 /* The GPIO should be swapped if swap register is set and active */ 2007 /* The GPIO should be swapped if swap register is set and active */