Commit dfd464d3 authored by Jean-Claude BAU's avatar Jean-Claude BAU

KConfig: Optimize TimingMode against bad configuration

KConfig has been improved adding new extra constraints when the timing
mode is changed. It has an impact on port configuration
(externalPortConfiguration & default bmc mode) and also on the
overwritten clock class.
parent 8759073d
......@@ -686,6 +686,7 @@ menu "PTP options"
config PTP_OPT_OVERWRITE_CLOCK_CLASS
boolean "Overwrite default clock-class"
depends on TIME_BC || TIME_FM
default FALSE
help
The clock class is automatically set depending of the timing mode.
......@@ -693,8 +694,10 @@ config PTP_OPT_OVERWRITE_CLOCK_CLASS
config PTP_OPT_CLOCK_CLASS
int "clock-class"
default 248
range 0 255
default 52 if TIME_FM
default 248
range 128 255 if TIME_BC
range 52 122 if TIME_FM
depends on PTP_OPT_OVERWRITE_CLOCK_CLASS
help
An attribute defining the TAI traceability, synchronization state and
......
This diff is collapsed.
......@@ -25,7 +25,8 @@ function print_header() {
echo -e "menu \"Port Timing Configuration\"" >$OUTPUT_FILE
echo -e "config PTP_OPT_EXT_PORT_CONFIG_ENABLED" >>$OUTPUT_FILE
echo -e "\tbool \"externalPortConfigurationEnabled\" " >>$OUTPUT_FILE
echo -e "\tdefault true" >>$OUTPUT_FILE
echo -e "\tdepends on TIME_BC" >>$OUTPUT_FILE
echo -e "\tdefault false" >>$OUTPUT_FILE
echo -e "\thelp" >>$OUTPUT_FILE
echo -e "\t This option is used by the high accuracy profile to force the port state." >>$OUTPUT_FILE
echo -e "\t When set, BMCA is disabled." >>$OUTPUT_FILE
......@@ -165,8 +166,8 @@ function print_instance_header() {
echo -e "\nchoice" >>$OUTPUT_FILE
echo -e " prompt \"BMCA mode\"" >>$OUTPUT_FILE
echo -e " depends on PTP_OPT_EXT_PORT_CONFIG_ENABLED!=y" >>$OUTPUT_FILE
echo -e " default PORT${1}_INST${2}_BMODE_MASTER_ONLY if TIME_BC" >>$OUTPUT_FILE
echo -e " default PORT${1}_INST${2}_BMODE_AUTO" >>$OUTPUT_FILE
echo -e " default PORT${1}_INST${2}_BMODE_MASTER_ONLY if TIME_GM || TIME_FM" >>$OUTPUT_FILE
echo -e " default PORT${1}_INST${2}_BMODE_AUTO if TIME_BC" >>$OUTPUT_FILE
echo -e " config PORT${1}_INST${2}_BMODE_MASTER_ONLY" >>$OUTPUT_FILE
echo -e " bool \"MasterOnly\"" >>$OUTPUT_FILE
echo -e " config PORT${1}_INST${2}_BMODE_AUTO" >>$OUTPUT_FILE
......
Subproject commit 3436fdc8ff87dbaa8f6efadea813bfb8eb3f185f
Subproject commit 01cd0a15d291bc74322141d90c1d0527027884f5
......@@ -398,21 +398,23 @@ declare -A globals
[[ "$PRE_FILE" != "" ]] && [[ -f $PRE_FILE ]] && decode_pre_file "$PRE_FILE"
# Use default value of clock class if not overwritten or empty string
if [ -v CONFIG_PTP_OPT_OVERWRITE_CLOCK_CLASS ] && [ -n "$CONFIG_PTP_OPT_CLOCK_CLASS" ]; then
globals[clock-class]="$CONFIG_PTP_OPT_CLOCK_CLASS"
else
if [ "$CONFIG_TIME_GM" = "y" ]; then
if [ "$CONFIG_TIME_GM" = "y" ]; then
globals[clock-class]=6
fi
if [ "$CONFIG_TIME_FM" = "y" ]; then
globals[clock-class]=52
fi
if [ "$CONFIG_TIME_BC" = "y" ]; then
globals[clock-class]=248
else
# Use default value of clock class if not overwritten or empty string
if [ -v CONFIG_PTP_OPT_OVERWRITE_CLOCK_CLASS ] && [ -n "$CONFIG_PTP_OPT_CLOCK_CLASS" ]; then
globals[clock-class]="$CONFIG_PTP_OPT_CLOCK_CLASS"
else
if [ "$CONFIG_TIME_FM" = "y" ]; then
globals[clock-class]=52
fi
if [ "$CONFIG_TIME_BC" = "y" ]; then
globals[clock-class]=248
fi
fi
fi
if [ -n "$CONFIG_PTP_OPT_CLOCK_ACCURACY" ]; then
globals[clock-accuracy]="$CONFIG_PTP_OPT_CLOCK_ACCURACY"
fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment