[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5b66da7c-f533-4092-9918-1612d9c84cb3@lunn.ch>
Date: Wed, 3 Apr 2024 23:11:49 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Alexander Duyck <alexander.duyck@...il.com>
Cc: netdev@...r.kernel.org, Alexander Duyck <alexanderduyck@...com>,
kuba@...nel.org, davem@...emloft.net, pabeni@...hat.com
Subject: Re: [net-next PATCH 11/15] eth: fbnic: Enable Ethernet link setup
> +/* MAC PCS registers */
> +#define FBNIC_CSR_START_PCS 0x10000 /* CSR section delimiter */
> +#define FBNIC_PCS_CONTROL1_0 0x10000 /* 0x40000 */
> +#define FBNIC_PCS_CONTROL1_RESET CSR_BIT(15)
> +#define FBNIC_PCS_CONTROL1_LOOPBACK CSR_BIT(14)
> +#define FBNIC_PCS_CONTROL1_SPEED_SELECT_ALWAYS CSR_BIT(13)
> +#define FBNIC_PCS_CONTROL1_SPEED_ALWAYS CSR_BIT(6)
> +#define FBNIC_PCS_VENDOR_VL_INTVL_0 0x10202 /* 0x40808 */
> +#define FBNIC_PCS_VL0_0_CHAN_0 0x10208 /* 0x40820 */
> +#define FBNIC_PCS_VL0_1_CHAN_0 0x10209 /* 0x40824 */
> +#define FBNIC_PCS_VL1_0_CHAN_0 0x1020a /* 0x40828 */
> +#define FBNIC_PCS_VL1_1_CHAN_0 0x1020b /* 0x4082c */
> +#define FBNIC_PCS_VL2_0_CHAN_0 0x1020c /* 0x40830 */
> +#define FBNIC_PCS_VL2_1_CHAN_0 0x1020d /* 0x40834 */
> +#define FBNIC_PCS_VL3_0_CHAN_0 0x1020e /* 0x40838 */
> +#define FBNIC_PCS_VL3_1_CHAN_0 0x1020f /* 0x4083c */
Is this a licences PCS? Synopsys DesignWare?
> +static void fbnic_set_led_state_asic(struct fbnic_dev *fbd, int state)
> +{
> + struct fbnic_net *fbn = netdev_priv(fbd->netdev);
> + u32 led_csr = FBNIC_MAC_ENET_LED_DEFAULT;
> +
> + switch (state) {
> + case FBNIC_LED_OFF:
> + led_csr |= FBNIC_MAC_ENET_LED_AMBER |
> + FBNIC_MAC_ENET_LED_ACTIVITY_ON;
> + break;
> + case FBNIC_LED_ON:
> + led_csr |= FBNIC_MAC_ENET_LED_BLUE |
> + FBNIC_MAC_ENET_LED_ACTIVITY_ON;
> + break;
> + case FBNIC_LED_RESTORE:
> + led_csr |= FBNIC_MAC_ENET_LED_ACTIVITY_DEFAULT;
> +
> + /* Don't set LEDs on if link isn't up */
> + if (fbd->link_state != FBNIC_LINK_UP)
> + break;
> + /* Don't set LEDs for supported autoneg modes */
> + if ((fbn->link_mode & FBNIC_LINK_AUTO) &&
> + (fbn->link_mode & FBNIC_LINK_MODE_MASK) != FBNIC_LINK_50R2)
> + break;
> +
> + /* Set LEDs based on link speed
> + * 100G Blue,
> + * 50G Blue & Amber
> + * 25G Amber
> + */
> + switch (fbn->link_mode & FBNIC_LINK_MODE_MASK) {
> + case FBNIC_LINK_100R2:
> + led_csr |= FBNIC_MAC_ENET_LED_BLUE;
> + break;
> + case FBNIC_LINK_50R1:
> + case FBNIC_LINK_50R2:
> + led_csr |= FBNIC_MAC_ENET_LED_BLUE;
> + fallthrough;
> + case FBNIC_LINK_25R1:
> + led_csr |= FBNIC_MAC_ENET_LED_AMBER;
> + break;
> + }
> + break;
> + default:
> + return;
> + }
> +
> + wr32(FBNIC_MAC_ENET_LED, led_csr);
> +}
Seems like you should be using /sys/class/leds and the netdev trigger.
Andrew
Powered by blists - more mailing lists