Convert the coefficients to struct marvell_tai_param. Signed-off-by: Russell King (Oracle) --- drivers/net/dsa/mv88e6xxx/ptp.c | 40 +++++++++++---------------------- 1 file changed, 13 insertions(+), 27 deletions(-) diff --git a/drivers/net/dsa/mv88e6xxx/ptp.c b/drivers/net/dsa/mv88e6xxx/ptp.c index 87a45dc6b811..acd17380e7ea 100644 --- a/drivers/net/dsa/mv88e6xxx/ptp.c +++ b/drivers/net/dsa/mv88e6xxx/ptp.c @@ -16,13 +16,6 @@ #include "hwtstamp.h" #include "ptp.h" -struct mv88e6xxx_cc_coeffs { - u32 cc_shift; - u32 cc_mult; - u32 cc_mult_num; - u32 cc_mult_dem; -}; - /* Family MV88E6250: * Raw timestamps are in units of 10-ns clock periods. * @@ -31,11 +24,11 @@ struct mv88e6xxx_cc_coeffs { * clkadj = scaled_ppm * 2^7 / 5^5 */ #define MV88E6XXX_CC_10NS_SHIFT 28 -static const struct mv88e6xxx_cc_coeffs mv88e6xxx_cc_10ns_coeffs = { +static const struct marvell_tai_param mv88e6xxx_cc_10ns_coeffs = { .cc_shift = MV88E6XXX_CC_10NS_SHIFT, .cc_mult = 10 << MV88E6XXX_CC_10NS_SHIFT, .cc_mult_num = 1 << 7, - .cc_mult_dem = 3125ULL, + .cc_mult_den = 3125ULL, }; /* Other families except MV88E6393X in internal clock mode: @@ -46,11 +39,11 @@ static const struct mv88e6xxx_cc_coeffs mv88e6xxx_cc_10ns_coeffs = { * clkadj = scaled_ppm * 2^9 / 5^6 */ #define MV88E6XXX_CC_8NS_SHIFT 28 -static const struct mv88e6xxx_cc_coeffs mv88e6xxx_cc_8ns_coeffs = { +static const struct marvell_tai_param mv88e6xxx_cc_8ns_coeffs = { .cc_shift = MV88E6XXX_CC_8NS_SHIFT, .cc_mult = 8 << MV88E6XXX_CC_8NS_SHIFT, .cc_mult_num = 1 << 9, - .cc_mult_dem = 15625ULL + .cc_mult_den = 15625ULL }; /* Family MV88E6393X using internal clock: @@ -61,11 +54,11 @@ static const struct mv88e6xxx_cc_coeffs mv88e6xxx_cc_8ns_coeffs = { * clkadj = scaled_ppm * 2^8 / 5^6 */ #define MV88E6XXX_CC_4NS_SHIFT 28 -static const struct mv88e6xxx_cc_coeffs mv88e6xxx_cc_4ns_coeffs = { +static const struct marvell_tai_param mv88e6xxx_cc_4ns_coeffs = { .cc_shift = MV88E6XXX_CC_4NS_SHIFT, .cc_mult = 4 << MV88E6XXX_CC_4NS_SHIFT, .cc_mult_num = 1 << 8, - .cc_mult_dem = 15625ULL + .cc_mult_den = 15625ULL }; static int mv88e6xxx_tai_read(struct mv88e6xxx_chip *chip, int addr, @@ -242,8 +235,8 @@ static int mv88e6352_ptp_pin_setup(struct mv88e6xxx_chip *chip, int pin, return mv88e6352_set_gpio_func(chip, pin, func, true); } -static const struct mv88e6xxx_cc_coeffs * -mv88e6xxx_cc_coeff_get(struct mv88e6xxx_chip *chip) +static const struct marvell_tai_param * +mv88e6xxx_tai_param_get(struct mv88e6xxx_chip *chip) { u16 period_ps; int err; @@ -386,15 +379,14 @@ static int mv88e6xxx_set_ptp_cpu_port(struct mv88e6xxx_chip *chip) int mv88e6xxx_ptp_setup(struct mv88e6xxx_chip *chip) { const struct mv88e6xxx_ptp_ops *ptp_ops = chip->info->ops->ptp_ops; - const struct mv88e6xxx_cc_coeffs *cc_coeffs; - struct marvell_tai_param tai_param; + const struct marvell_tai_param *tai_param; struct marvell_tai_pins pins; int i, err; /* Set up the cycle counter */ - cc_coeffs = mv88e6xxx_cc_coeff_get(chip); - if (IS_ERR(cc_coeffs)) - return PTR_ERR(cc_coeffs); + tai_param = mv88e6xxx_tai_param_get(chip); + if (IS_ERR(tai_param)) + return PTR_ERR(tai_param); err = mv88e6xxx_set_ptp_cpu_port(chip); if (err) @@ -402,12 +394,6 @@ int mv88e6xxx_ptp_setup(struct mv88e6xxx_chip *chip) mv88e6xxx_reg_unlock(chip); - memset(&tai_param, 0, sizeof(tai_param)); - tai_param.cc_mult_num = cc_coeffs->cc_mult_num; - tai_param.cc_mult_den = cc_coeffs->cc_mult_dem; - tai_param.cc_mult = cc_coeffs->cc_mult; - tai_param.cc_shift = cc_coeffs->cc_shift; - memset(&pins, 0, sizeof(pins)); pins.n_ext_ts = ptp_ops->n_ext_ts; pins.n_pins = mv88e6xxx_num_gpio(chip); @@ -422,7 +408,7 @@ int mv88e6xxx_ptp_setup(struct mv88e6xxx_chip *chip) ppd->func = PTP_PF_NONE; } - err = marvell_tai_probe(&chip->tai, &mv88e6xxx_tai_ops, &tai_param, + err = marvell_tai_probe(&chip->tai, &mv88e6xxx_tai_ops, tai_param, &pins, dev_name(chip->dev), chip->dev); mv88e6xxx_reg_lock(chip); -- 2.47.3