/* * <:copyright-BRCM:2018:DUAL/GPL:standard * * Copyright (c) 2018 Broadcom * All Rights Reserved * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as published by * the Free Software Foundation (the "GPL"). * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * * A copy of the GPL is available at http://www.broadcom.com/licenses/GPLv2.php, or by * writing to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * * :> */ // BCMFORMAT: notabs reindent:uncrustify:bcm_minimal_i4.cfg #include "boardparms.h" #ifdef _CFE_ #include "lib_types.h" #include "lib_printf.h" #include "lib_string.h" #include "bcm_map.h" #define printk printf #else // Linux #include #include #include #include #endif static void bcm_ethsw_set_led_reg(volatile uint32_t* ledctrl) { uint32_t value; value = *ledctrl; /* turn off all the leds */ value |= ETHSW_LED_CTRL_ALL_SPEED_MASK; /* broadcom reference design alway use LED_SPD0 for 1g link and LED_SPD1 for 100m link */ value &= ~(ETHSW_LED_CTRL_SPEED_MASK << ETHSW_LED_CTRL_1000M_SHIFT); value |= (ETHSW_LED_CTRL_SPD0_ON << ETHSW_LED_CTRL_1000M_SHIFT)|(ETHSW_LED_CTRL_SPD1_OFF << ETHSW_LED_CTRL_1000M_SHIFT); value &= ~(ETHSW_LED_CTRL_SPEED_MASK<led_ctrl[i].led_encoding; #else ledctrl = ÐSW_REG->led_ctrl[i]; #endif bcm_ethsw_set_led_reg(ledctrl); } /* WAN led */ #if defined(_BCM94908_) || defined(CONFIG_BCM94908) || defined(_BCM963158_) || defined(CONFIG_BCM963158) ledctrl = ÐSW_REG->led_wan_ctrl.led_encoding; #else ledctrl = ÐSW_REG->led_wan_ctrl; #endif bcm_ethsw_set_led_reg(ledctrl); /* aggregate LED setting */ if (BpGetAggregateLnkLedGpio(&lnkLed) == BP_SUCCESS && BpGetAggregateActLedGpio(&actLed) == BP_SUCCESS ) { #if defined(_BCM94908_) || defined(CONFIG_BCM94908) || defined(_BCM963158_) || defined(CONFIG_BCM963158) /* link led polarity is reversed from hw. Suppose to be active low but it is active high. change the polarity in led ctrl registr and also enable all 5 GPHY ports */ ETHSW_REG->aggregate_led_ctrl |= (ETHSW_AGGREGATE_LED_CTRL_LNK_POL_SEL_MASK|0x1f); #endif } return; }