162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci/* Copyright (C) 2021-2022, Intel Corporation. */ 362306a36Sopenharmony_ci 462306a36Sopenharmony_ci#ifndef _ICE_GNSS_H_ 562306a36Sopenharmony_ci#define _ICE_GNSS_H_ 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci#define ICE_E810T_GNSS_I2C_BUS 0x2 862306a36Sopenharmony_ci#define ICE_GNSS_POLL_DATA_DELAY_TIME (HZ / 50) /* poll every 20 ms */ 962306a36Sopenharmony_ci#define ICE_GNSS_TIMER_DELAY_TIME (HZ / 10) /* 0.1 second per message */ 1062306a36Sopenharmony_ci#define ICE_GNSS_TTY_WRITE_BUF 250 1162306a36Sopenharmony_ci#define ICE_MAX_I2C_DATA_SIZE FIELD_MAX(ICE_AQC_I2C_DATA_SIZE_M) 1262306a36Sopenharmony_ci#define ICE_MAX_I2C_WRITE_BYTES 4 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ci/* u-blox ZED-F9T specific definitions */ 1562306a36Sopenharmony_ci#define ICE_GNSS_UBX_I2C_BUS_ADDR 0x42 1662306a36Sopenharmony_ci/* Data length register is big endian */ 1762306a36Sopenharmony_ci#define ICE_GNSS_UBX_DATA_LEN_H 0xFD 1862306a36Sopenharmony_ci#define ICE_GNSS_UBX_DATA_LEN_WIDTH 2 1962306a36Sopenharmony_ci#define ICE_GNSS_UBX_EMPTY_DATA 0xFF 2062306a36Sopenharmony_ci/* For u-blox writes are performed without address so the first byte to write is 2162306a36Sopenharmony_ci * passed as I2C addr parameter. 2262306a36Sopenharmony_ci */ 2362306a36Sopenharmony_ci#define ICE_GNSS_UBX_WRITE_BYTES (ICE_MAX_I2C_WRITE_BYTES + 1) 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ci/** 2662306a36Sopenharmony_ci * struct gnss_serial - data used to initialize GNSS TTY port 2762306a36Sopenharmony_ci * @back: back pointer to PF 2862306a36Sopenharmony_ci * @kworker: kwork thread for handling periodic work 2962306a36Sopenharmony_ci * @read_work: read_work function for handling GNSS reads 3062306a36Sopenharmony_ci */ 3162306a36Sopenharmony_cistruct gnss_serial { 3262306a36Sopenharmony_ci struct ice_pf *back; 3362306a36Sopenharmony_ci struct kthread_worker *kworker; 3462306a36Sopenharmony_ci struct kthread_delayed_work read_work; 3562306a36Sopenharmony_ci}; 3662306a36Sopenharmony_ci 3762306a36Sopenharmony_ci#if IS_ENABLED(CONFIG_GNSS) 3862306a36Sopenharmony_civoid ice_gnss_init(struct ice_pf *pf); 3962306a36Sopenharmony_civoid ice_gnss_exit(struct ice_pf *pf); 4062306a36Sopenharmony_cibool ice_gnss_is_gps_present(struct ice_hw *hw); 4162306a36Sopenharmony_ci#else 4262306a36Sopenharmony_cistatic inline void ice_gnss_init(struct ice_pf *pf) { } 4362306a36Sopenharmony_cistatic inline void ice_gnss_exit(struct ice_pf *pf) { } 4462306a36Sopenharmony_cistatic inline bool ice_gnss_is_gps_present(struct ice_hw *hw) 4562306a36Sopenharmony_ci{ 4662306a36Sopenharmony_ci return false; 4762306a36Sopenharmony_ci} 4862306a36Sopenharmony_ci#endif /* IS_ENABLED(CONFIG_GNSS) */ 4962306a36Sopenharmony_ci#endif /* _ICE_GNSS_H_ */ 50