Browse Source

[smsc95xx] Enable LEDs

The LED pins are configured by default as GPIO inputs.  While it is
conceivable that a board might actually use these pins as GPIOs, no
such board is known to exist.

The Linux smsc95xx driver configures these pins unconditionally as LED
outputs.  Assume that it is safe to do likewise.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 9 years ago
parent
commit
8dc23d9b83
2 changed files with 24 additions and 0 deletions
  1. 12
    0
      src/drivers/net/smsc95xx.c
  2. 12
    0
      src/drivers/net/smsc95xx.h

+ 12
- 0
src/drivers/net/smsc95xx.c View File

687
  */
687
  */
688
 static int smsc95xx_reset ( struct smsc95xx_device *smsc95xx ) {
688
 static int smsc95xx_reset ( struct smsc95xx_device *smsc95xx ) {
689
 	uint32_t hw_cfg;
689
 	uint32_t hw_cfg;
690
+	uint32_t led_gpio_cfg;
690
 	int rc;
691
 	int rc;
691
 
692
 
692
 	/* Reset device */
693
 	/* Reset device */
706
 		return -ETIMEDOUT;
707
 		return -ETIMEDOUT;
707
 	}
708
 	}
708
 
709
 
710
+	/* Configure LEDs */
711
+	led_gpio_cfg = ( SMSC95XX_LED_GPIO_CFG_GPCTL2_NSPD_LED |
712
+			 SMSC95XX_LED_GPIO_CFG_GPCTL1_NLNKA_LED |
713
+			 SMSC95XX_LED_GPIO_CFG_GPCTL0_NFDX_LED );
714
+	if ( ( rc = smsc95xx_writel ( smsc95xx, SMSC95XX_LED_GPIO_CFG,
715
+				      led_gpio_cfg ) ) != 0 ) {
716
+		DBGC ( smsc95xx, "SMSC95XX %p could not configure LEDs: %s\n",
717
+		       smsc95xx, strerror ( rc ) );
718
+		/* Ignore error and continue */
719
+	}
720
+
709
 	return 0;
721
 	return 0;
710
 }
722
 }
711
 
723
 

+ 12
- 0
src/drivers/net/smsc95xx.h View File

43
 #define SMSC95XX_HW_CFG_BIR		0x00001000UL	/**< Bulk IN use NAK */
43
 #define SMSC95XX_HW_CFG_BIR		0x00001000UL	/**< Bulk IN use NAK */
44
 #define SMSC95XX_HW_CFG_LRST		0x00000008UL	/**< Soft lite reset */
44
 #define SMSC95XX_HW_CFG_LRST		0x00000008UL	/**< Soft lite reset */
45
 
45
 
46
+/** LED GPIO configuration register */
47
+#define SMSC95XX_LED_GPIO_CFG 0x024
48
+#define SMSC95XX_LED_GPIO_CFG_GPCTL2(x)	( (x) << 24 )	/**< GPIO 2 control */
49
+#define SMSC95XX_LED_GPIO_CFG_GPCTL2_NSPD_LED \
50
+	SMSC95XX_LED_GPIO_CFG_GPCTL2 ( 1 )		/**< Link speed LED */
51
+#define SMSC95XX_LED_GPIO_CFG_GPCTL1(x)	( (x) << 20 )	/**< GPIO 1 control */
52
+#define SMSC95XX_LED_GPIO_CFG_GPCTL1_NLNKA_LED \
53
+	SMSC95XX_LED_GPIO_CFG_GPCTL1 ( 1 )		/**< Activity LED */
54
+#define SMSC95XX_LED_GPIO_CFG_GPCTL0(x)	( (x) << 16 )	/**< GPIO 0 control */
55
+#define SMSC95XX_LED_GPIO_CFG_GPCTL0_NFDX_LED \
56
+	SMSC95XX_LED_GPIO_CFG_GPCTL0 ( 1 )		/**< Full-duplex LED */
57
+
46
 /** EEPROM command register */
58
 /** EEPROM command register */
47
 #define SMSC95XX_E2P_CMD 0x030
59
 #define SMSC95XX_E2P_CMD 0x030
48
 #define SMSC95XX_E2P_CMD_EPC_BSY	0x80000000UL	/**< EPC busy */
60
 #define SMSC95XX_E2P_CMD_EPC_BSY	0x80000000UL	/**< EPC busy */

Loading…
Cancel
Save