mirror of
https://github.com/Qortal/Brooklyn.git
synced 2025-02-01 07:42:18 +00:00
7d3018da4c
* NVME, SATA NAND Security added * Qortal Core exception fetcher is now redone. * Update DT overlays for firmware * Fix for bvb clockj settings * Fix for no audio for sissy desktop porn watchers -_- ( thanks crowetic for watching gay porn and reporting me that bug asshat ) * Normalize the fetch() stream while doing a peer to peer handshake for nodes * Fix for RNG token editing error while performing a SHA256 encryption * Now under voltage errors will blink red led constantly for 5 minutes then go solid. * Improve kernel thread scaling for Qortal 2.0 core * HDMI circuit is now enabled at power up instead. * Added KMS * Added line replication instead of interpolation for VC4 GPU resulting in slightly better frame rates * Fix for long and doubles * Backplane clock is now set at standard rate * Capped HVEC clocks * Add support for Creative Cinema webcam for donkers who like sharing dick pics. *looks at crowetic* * More scanline XGA modes for people who have weird ass monitors of all sorts. * TX/RX flow control support is now 100% stable. No lags over 1Gbps ethernet. ( Hello Qortal 3.0 ) * Using flush cache instead of fetch for QC 2.0 resulting in performance gains * VC4 clock is now enforced for desktop oriented images. * Ondemand governor now waits for 2 seconds instead of 0.5ms to scale down to the lowest safest clock freq preventing lags to the core. * Timeout of OC set at 35ms from 90ms resulting in way better clocks and sync for Qortal 2.0 core
184 lines
4.7 KiB
C
184 lines
4.7 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/* Copyright (c) 2019, Vladimir Oltean <olteanv@gmail.com>
|
|
*/
|
|
#ifndef _SJA1105_PTP_H
|
|
#define _SJA1105_PTP_H
|
|
|
|
#include <linux/timer.h>
|
|
|
|
#if IS_ENABLED(CONFIG_NET_DSA_SJA1105_PTP)
|
|
|
|
/* Calculate the first base_time in the future that satisfies this
|
|
* relationship:
|
|
*
|
|
* future_base_time = base_time + N x cycle_time >= now, or
|
|
*
|
|
* now - base_time
|
|
* N >= ---------------
|
|
* cycle_time
|
|
*
|
|
* Because N is an integer, the ceiling value of the above "a / b" ratio
|
|
* is in fact precisely the floor value of "(a + b - 1) / b", which is
|
|
* easier to calculate only having integer division tools.
|
|
*/
|
|
static inline s64 future_base_time(s64 base_time, s64 cycle_time, s64 now)
|
|
{
|
|
s64 a, b, n;
|
|
|
|
if (base_time >= now)
|
|
return base_time;
|
|
|
|
a = now - base_time;
|
|
b = cycle_time;
|
|
n = div_s64(a + b - 1, b);
|
|
|
|
return base_time + n * cycle_time;
|
|
}
|
|
|
|
/* This is not a preprocessor macro because the "ns" argument may or may not be
|
|
* s64 at caller side. This ensures it is properly type-cast before div_s64.
|
|
*/
|
|
static inline s64 ns_to_sja1105_delta(s64 ns)
|
|
{
|
|
return div_s64(ns, 200);
|
|
}
|
|
|
|
static inline s64 sja1105_delta_to_ns(s64 delta)
|
|
{
|
|
return delta * 200;
|
|
}
|
|
|
|
struct sja1105_ptp_cmd {
|
|
u64 startptpcp; /* start toggling PTP_CLK pin */
|
|
u64 stopptpcp; /* stop toggling PTP_CLK pin */
|
|
u64 ptpstrtsch; /* start schedule */
|
|
u64 ptpstopsch; /* stop schedule */
|
|
u64 resptp; /* reset */
|
|
u64 corrclk4ts; /* use the corrected clock for timestamps */
|
|
u64 ptpclkadd; /* enum sja1105_ptp_clk_mode */
|
|
};
|
|
|
|
struct sja1105_ptp_data {
|
|
struct timer_list extts_timer;
|
|
/* Used only on SJA1105 to reconstruct partial timestamps */
|
|
struct sk_buff_head skb_rxtstamp_queue;
|
|
struct ptp_clock_info caps;
|
|
struct ptp_clock *clock;
|
|
struct sja1105_ptp_cmd cmd;
|
|
/* Serializes all operations on the PTP hardware clock */
|
|
struct mutex lock;
|
|
bool extts_enabled;
|
|
u64 ptpsyncts;
|
|
};
|
|
|
|
int sja1105_ptp_clock_register(struct dsa_switch *ds);
|
|
|
|
void sja1105_ptp_clock_unregister(struct dsa_switch *ds);
|
|
|
|
void sja1105et_ptp_cmd_packing(u8 *buf, struct sja1105_ptp_cmd *cmd,
|
|
enum packing_op op);
|
|
|
|
void sja1105pqrs_ptp_cmd_packing(u8 *buf, struct sja1105_ptp_cmd *cmd,
|
|
enum packing_op op);
|
|
|
|
int sja1105_get_ts_info(struct dsa_switch *ds, int port,
|
|
struct ethtool_ts_info *ts);
|
|
|
|
void sja1105_ptp_txtstamp_skb(struct dsa_switch *ds, int slot,
|
|
struct sk_buff *clone);
|
|
|
|
bool sja1105_port_rxtstamp(struct dsa_switch *ds, int port,
|
|
struct sk_buff *skb, unsigned int type);
|
|
|
|
void sja1105_port_txtstamp(struct dsa_switch *ds, int port,
|
|
struct sk_buff *skb);
|
|
|
|
int sja1105_hwtstamp_get(struct dsa_switch *ds, int port, struct ifreq *ifr);
|
|
|
|
int sja1105_hwtstamp_set(struct dsa_switch *ds, int port, struct ifreq *ifr);
|
|
|
|
int __sja1105_ptp_gettimex(struct dsa_switch *ds, u64 *ns,
|
|
struct ptp_system_timestamp *sts);
|
|
|
|
int __sja1105_ptp_settime(struct dsa_switch *ds, u64 ns,
|
|
struct ptp_system_timestamp *ptp_sts);
|
|
|
|
int __sja1105_ptp_adjtime(struct dsa_switch *ds, s64 delta);
|
|
|
|
int sja1105_ptp_commit(struct dsa_switch *ds, struct sja1105_ptp_cmd *cmd,
|
|
sja1105_spi_rw_mode_t rw);
|
|
|
|
bool sja1105_rxtstamp(struct dsa_switch *ds, int port, struct sk_buff *skb);
|
|
bool sja1110_rxtstamp(struct dsa_switch *ds, int port, struct sk_buff *skb);
|
|
void sja1110_txtstamp(struct dsa_switch *ds, int port, struct sk_buff *skb);
|
|
|
|
#else
|
|
|
|
struct sja1105_ptp_cmd;
|
|
|
|
/* Structures cannot be empty in C. Bah!
|
|
* Keep the mutex as the only element, which is a bit more difficult to
|
|
* refactor out of sja1105_main.c anyway.
|
|
*/
|
|
struct sja1105_ptp_data {
|
|
struct mutex lock;
|
|
};
|
|
|
|
static inline int sja1105_ptp_clock_register(struct dsa_switch *ds)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline void sja1105_ptp_clock_unregister(struct dsa_switch *ds) { }
|
|
|
|
static inline void sja1105_ptp_txtstamp_skb(struct dsa_switch *ds, int slot,
|
|
struct sk_buff *clone)
|
|
{
|
|
}
|
|
|
|
static inline int __sja1105_ptp_gettimex(struct dsa_switch *ds, u64 *ns,
|
|
struct ptp_system_timestamp *sts)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline int __sja1105_ptp_settime(struct dsa_switch *ds, u64 ns,
|
|
struct ptp_system_timestamp *ptp_sts)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline int __sja1105_ptp_adjtime(struct dsa_switch *ds, s64 delta)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline int sja1105_ptp_commit(struct dsa_switch *ds,
|
|
struct sja1105_ptp_cmd *cmd,
|
|
sja1105_spi_rw_mode_t rw)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
#define sja1105et_ptp_cmd_packing NULL
|
|
|
|
#define sja1105pqrs_ptp_cmd_packing NULL
|
|
|
|
#define sja1105_get_ts_info NULL
|
|
|
|
#define sja1105_port_rxtstamp NULL
|
|
|
|
#define sja1105_port_txtstamp NULL
|
|
|
|
#define sja1105_hwtstamp_get NULL
|
|
|
|
#define sja1105_hwtstamp_set NULL
|
|
|
|
#define sja1105_rxtstamp NULL
|
|
#define sja1110_rxtstamp NULL
|
|
#define sja1110_txtstamp NULL
|
|
|
|
#endif /* IS_ENABLED(CONFIG_NET_DSA_SJA1105_PTP) */
|
|
|
|
#endif /* _SJA1105_PTP_H */
|