18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *  FUJITSU Extended Socket Network Device driver
48c2ecf20Sopenharmony_ci *  Copyright (c) 2015 FUJITSU LIMITED
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#ifndef FJES_H_
88c2ecf20Sopenharmony_ci#define FJES_H_
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#include <linux/acpi.h>
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#include "fjes_hw.h"
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#define FJES_ACPI_SYMBOL	"Extended Socket"
158c2ecf20Sopenharmony_ci#define FJES_MAX_QUEUES		1
168c2ecf20Sopenharmony_ci#define FJES_TX_RETRY_INTERVAL	(20 * HZ)
178c2ecf20Sopenharmony_ci#define FJES_TX_RETRY_TIMEOUT	(100)
188c2ecf20Sopenharmony_ci#define FJES_TX_TX_STALL_TIMEOUT	(FJES_TX_RETRY_INTERVAL / 2)
198c2ecf20Sopenharmony_ci#define FJES_OPEN_ZONE_UPDATE_WAIT	(300) /* msec */
208c2ecf20Sopenharmony_ci#define FJES_IRQ_WATCH_DELAY	(HZ)
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci/* board specific private data structure */
238c2ecf20Sopenharmony_cistruct fjes_adapter {
248c2ecf20Sopenharmony_ci	struct net_device *netdev;
258c2ecf20Sopenharmony_ci	struct platform_device *plat_dev;
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci	struct napi_struct napi;
288c2ecf20Sopenharmony_ci	struct rtnl_link_stats64 stats64;
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci	unsigned int tx_retry_count;
318c2ecf20Sopenharmony_ci	unsigned long tx_start_jiffies;
328c2ecf20Sopenharmony_ci	unsigned long rx_last_jiffies;
338c2ecf20Sopenharmony_ci	bool unset_rx_last;
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci	struct work_struct force_close_task;
368c2ecf20Sopenharmony_ci	bool force_reset;
378c2ecf20Sopenharmony_ci	bool open_guard;
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci	bool irq_registered;
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci	struct workqueue_struct *txrx_wq;
428c2ecf20Sopenharmony_ci	struct workqueue_struct *control_wq;
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci	struct work_struct tx_stall_task;
458c2ecf20Sopenharmony_ci	struct work_struct raise_intr_rxdata_task;
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci	struct work_struct unshare_watch_task;
488c2ecf20Sopenharmony_ci	unsigned long unshare_watch_bitmask;
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci	struct delayed_work interrupt_watch_task;
518c2ecf20Sopenharmony_ci	bool interrupt_watch_enable;
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci	struct fjes_hw hw;
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci#ifdef CONFIG_DEBUG_FS
568c2ecf20Sopenharmony_ci	struct dentry *dbg_adapter;
578c2ecf20Sopenharmony_ci#endif
588c2ecf20Sopenharmony_ci};
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ciextern char fjes_driver_name[];
618c2ecf20Sopenharmony_ciextern char fjes_driver_version[];
628c2ecf20Sopenharmony_ciextern const u32 fjes_support_mtu[];
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_civoid fjes_set_ethtool_ops(struct net_device *);
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci#ifdef CONFIG_DEBUG_FS
678c2ecf20Sopenharmony_civoid fjes_dbg_adapter_init(struct fjes_adapter *adapter);
688c2ecf20Sopenharmony_civoid fjes_dbg_adapter_exit(struct fjes_adapter *adapter);
698c2ecf20Sopenharmony_civoid fjes_dbg_init(void);
708c2ecf20Sopenharmony_civoid fjes_dbg_exit(void);
718c2ecf20Sopenharmony_ci#else
728c2ecf20Sopenharmony_cistatic inline void fjes_dbg_adapter_init(struct fjes_adapter *adapter) {}
738c2ecf20Sopenharmony_cistatic inline void fjes_dbg_adapter_exit(struct fjes_adapter *adapter) {}
748c2ecf20Sopenharmony_cistatic inline void fjes_dbg_init(void) {}
758c2ecf20Sopenharmony_cistatic inline void fjes_dbg_exit(void) {}
768c2ecf20Sopenharmony_ci#endif /* CONFIG_DEBUG_FS */
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ci#endif /* FJES_H_ */
79