.. | .. |
---|
7 | 7 | #include "linux/ptp_clock_kernel.h" |
---|
8 | 8 | #include "linux/netdevice.h" |
---|
9 | 9 | |
---|
| 10 | +#define LAN7430_N_LED 4 |
---|
| 11 | +#define LAN7430_N_GPIO 4 /* multiplexed with PHY LEDs */ |
---|
| 12 | +#define LAN7431_N_GPIO 12 |
---|
| 13 | + |
---|
| 14 | +#define LAN743X_PTP_N_GPIO LAN7431_N_GPIO |
---|
| 15 | + |
---|
| 16 | +/* the number of periodic outputs is limited by number of |
---|
| 17 | + * PTP clock event channels |
---|
| 18 | + */ |
---|
| 19 | +#define LAN743X_PTP_N_EVENT_CHAN 2 |
---|
| 20 | +#define LAN743X_PTP_N_PEROUT LAN743X_PTP_N_EVENT_CHAN |
---|
| 21 | + |
---|
10 | 22 | struct lan743x_adapter; |
---|
11 | 23 | |
---|
12 | 24 | /* GPIO */ |
---|
.. | .. |
---|
40 | 52 | |
---|
41 | 53 | #define LAN743X_PTP_NUMBER_OF_TX_TIMESTAMPS (4) |
---|
42 | 54 | |
---|
43 | | -#define PTP_FLAG_PTP_CLOCK_REGISTERED BIT(1) |
---|
| 55 | +#define PTP_FLAG_PTP_CLOCK_REGISTERED BIT(1) |
---|
44 | 56 | #define PTP_FLAG_ISR_ENABLED BIT(2) |
---|
| 57 | + |
---|
| 58 | +struct lan743x_ptp_perout { |
---|
| 59 | + int event_ch; /* PTP event channel (0=channel A, 1=channel B) */ |
---|
| 60 | + int gpio_pin; /* GPIO pin where output appears */ |
---|
| 61 | +}; |
---|
45 | 62 | |
---|
46 | 63 | struct lan743x_ptp { |
---|
47 | 64 | int flags; |
---|
.. | .. |
---|
51 | 68 | |
---|
52 | 69 | struct ptp_clock *ptp_clock; |
---|
53 | 70 | struct ptp_clock_info ptp_clock_info; |
---|
54 | | - struct ptp_pin_desc pin_config[1]; |
---|
| 71 | + struct ptp_pin_desc pin_config[LAN743X_PTP_N_GPIO]; |
---|
55 | 72 | |
---|
56 | | -#define LAN743X_PTP_NUMBER_OF_EVENT_CHANNELS (2) |
---|
57 | 73 | unsigned long used_event_ch; |
---|
| 74 | + struct lan743x_ptp_perout perout[LAN743X_PTP_N_PEROUT]; |
---|
58 | 75 | |
---|
59 | | - int perout_event_ch; |
---|
60 | | - int perout_gpio_bit; |
---|
| 76 | + bool leds_multiplexed; |
---|
| 77 | + bool led_enabled[LAN7430_N_LED]; |
---|
61 | 78 | |
---|
62 | 79 | /* tx_ts_lock: used to prevent concurrent access to timestamp arrays */ |
---|
63 | 80 | spinlock_t tx_ts_lock; |
---|