Преглед изворни кода

[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 година
родитељ
комит
8dc23d9b83
2 измењених фајлова са 24 додато и 0 уклоњено
  1. 12
    0
      src/drivers/net/smsc95xx.c
  2. 12
    0
      src/drivers/net/smsc95xx.h

+ 12
- 0
src/drivers/net/smsc95xx.c Прегледај датотеку

@@ -687,6 +687,7 @@ static int smsc95xx_dump_statistics ( struct smsc95xx_device *smsc95xx ) {
687 687
  */
688 688
 static int smsc95xx_reset ( struct smsc95xx_device *smsc95xx ) {
689 689
 	uint32_t hw_cfg;
690
+	uint32_t led_gpio_cfg;
690 691
 	int rc;
691 692
 
692 693
 	/* Reset device */
@@ -706,6 +707,17 @@ static int smsc95xx_reset ( struct smsc95xx_device *smsc95xx ) {
706 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 721
 	return 0;
710 722
 }
711 723
 

+ 12
- 0
src/drivers/net/smsc95xx.h Прегледај датотеку

@@ -43,6 +43,18 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
43 43
 #define SMSC95XX_HW_CFG_BIR		0x00001000UL	/**< Bulk IN use NAK */
44 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 58
 /** EEPROM command register */
47 59
 #define SMSC95XX_E2P_CMD 0x030
48 60
 #define SMSC95XX_E2P_CMD_EPC_BSY	0x80000000UL	/**< EPC busy */

Loading…
Откажи
Сачувај