Skip to content

Commit 38075af

Browse files
committed
ice: use GNSS subsystem instead of TTY
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2111048 Upstream commit(s): commit c7ef822 Author: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com> Date: Wed Jan 18 16:58:36 2023 -0800 ice: use GNSS subsystem instead of TTY Previously support for GNSS was implemented as a TTY driver, it allowed to access GNSS receiver on /dev/ttyGNSS_<bus><func>. Use generic GNSS subsystem API instead of implementing own TTY driver. The receiver is accessible on /dev/gnss<id>. In case of multiple receivers in the OS, correct device can be found by enumerating either: - /sys/class/net/<eth port>/device/gnss/ - /sys/class/gnss/gnss<id>/device/ Using GNSS subsystem is superior to implementing own TTY driver, as the GNSS subsystem was designed solely for this purpose. It also implements TTY driver but in a common and defined way. From user perspective, there is no difference in communicating with a device, except new path to the device shall be used. The device will provide same information to the userspace as the old one, and can be used in the same way, i.e.: old # gpsmon /dev/ttyGNSS_2100_0 new # gpsmon /dev/gnss0 There is no other impact on userspace tools. User expecting onboard GNSS receiver support is required to enable CONFIG_GNSS=y/m in kernel config. Reviewed-by: Alexander Lobakin <alexandr.lobakin@intel.com> Signed-off-by: Karol Kolacinski <karol.kolacinski@intel.com> Signed-off-by: Michal Michalik <michal.michalik@intel.com> Signed-off-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com> Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel) Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Petr Oros <poros@redhat.com>
1 parent 233f786 commit 38075af

File tree

6 files changed

+158
-264
lines changed

6 files changed

+158
-264
lines changed

Documentation/networking/device_drivers/ethernet/intel/ice.rst

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -901,15 +901,17 @@ To enable/disable UDP Segmentation Offload, issue the following command::
901901

902902
# ethtool -K <ethX> tx-udp-segmentation [off|on]
903903

904+
904905
GNSS module
905906
-----------
906-
Allows user to read messages from the GNSS module and write supported commands.
907-
If the module is physically present, driver creates 2 TTYs for each supported
908-
device in /dev, ttyGNSS_<device>:<function>_0 and _1. First one (_0) is RW and
909-
the second one is RO.
910-
The protocol of write commands is dependent on the GNSS module as the driver
911-
writes raw bytes from the TTY to the GNSS i2c. Please refer to the module
912-
documentation for details.
907+
Requires kernel compiled with CONFIG_GNSS=y or CONFIG_GNSS=m.
908+
Allows user to read messages from the GNSS hardware module and write supported
909+
commands. If the module is physically present, a GNSS device is spawned:
910+
``/dev/gnss<id>``.
911+
The protocol of write command is dependent on the GNSS hardware module as the
912+
driver writes raw bytes by the GNSS object to the receiver through i2c. Please
913+
refer to the hardware GNSS module documentation for configuration details.
914+
913915

914916
Performance Optimization
915917
========================

drivers/net/ethernet/intel/Kconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,9 @@ config ICE_HWTS
337337
the PTP clock driver precise cross-timestamp ioctl
338338
(PTP_SYS_OFFSET_PRECISE).
339339

340+
config ICE_GNSS
341+
def_bool GNSS = y || GNSS = ICE
342+
340343
config FM10K
341344
tristate "Intel(R) FM10000 Ethernet Switch Host Interface Support"
342345
default n

drivers/net/ethernet/intel/ice/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ ice-$(CONFIG_PCI_IOV) += \
4242
ice_vf_vsi_vlan_ops.o \
4343
ice_vf_lib.o
4444
ice-$(CONFIG_PTP_1588_CLOCK) += ice_ptp.o ice_ptp_hw.o
45-
ice-$(CONFIG_TTY) += ice_gnss.o
4645
ice-$(CONFIG_DCB) += ice_dcb.o ice_dcb_nl.o ice_dcb_lib.o
4746
ice-$(CONFIG_RFS_ACCEL) += ice_arfs.o
4847
ice-$(CONFIG_XDP_SOCKETS) += ice_xsk.o
4948
ice-$(CONFIG_ICE_SWITCHDEV) += ice_eswitch.o
49+
ice-$(CONFIG_ICE_GNSS) += ice_gnss.o

drivers/net/ethernet/intel/ice/ice.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#include <linux/avf/virtchnl.h>
4040
#include <linux/cpu_rmap.h>
4141
#include <linux/dim.h>
42+
#include <linux/gnss.h>
4243
#include <net/pkt_cls.h>
4344
#include <net/tc_act/tc_mirred.h>
4445
#include <net/tc_act/tc_gact.h>
@@ -543,9 +544,8 @@ struct ice_pf {
543544
struct mutex adev_mutex; /* lock to protect aux device access */
544545
u32 msg_enable;
545546
struct ice_ptp ptp;
546-
struct tty_driver *ice_gnss_tty_driver;
547-
struct tty_port *gnss_tty_port[ICE_GNSS_TTY_MINOR_DEVICES];
548-
struct gnss_serial *gnss_serial[ICE_GNSS_TTY_MINOR_DEVICES];
547+
struct gnss_serial *gnss_serial;
548+
struct gnss_device *gnss_dev;
549549
u16 num_rdma_msix; /* Total MSIX vectors for RDMA driver */
550550
u16 rdma_base_vector;
551551

0 commit comments

Comments
 (0)