1*4882a593Smuzhiyun========================= 2*4882a593SmuzhiyunMellanox watchdog drivers 3*4882a593Smuzhiyun========================= 4*4882a593Smuzhiyun 5*4882a593Smuzhiyunfor x86 based system switches 6*4882a593Smuzhiyun============================= 7*4882a593Smuzhiyun 8*4882a593SmuzhiyunThis driver provides watchdog functionality for various Mellanox 9*4882a593SmuzhiyunEthernet and Infiniband switch systems. 10*4882a593Smuzhiyun 11*4882a593SmuzhiyunMellanox watchdog device is implemented in a programmable logic device. 12*4882a593Smuzhiyun 13*4882a593SmuzhiyunThere are 2 types of HW watchdog implementations. 14*4882a593Smuzhiyun 15*4882a593SmuzhiyunType 1: 16*4882a593Smuzhiyun Actual HW timeout can be defined as a power of 2 msec. 17*4882a593Smuzhiyun e.g. timeout 20 sec will be rounded up to 32768 msec. 18*4882a593Smuzhiyun The maximum timeout period is 32 sec (32768 msec.), 19*4882a593Smuzhiyun Get time-left isn't supported 20*4882a593Smuzhiyun 21*4882a593SmuzhiyunType 2: 22*4882a593Smuzhiyun Actual HW timeout is defined in sec. and it's the same as 23*4882a593Smuzhiyun a user-defined timeout. 24*4882a593Smuzhiyun Maximum timeout is 255 sec. 25*4882a593Smuzhiyun Get time-left is supported. 26*4882a593Smuzhiyun 27*4882a593SmuzhiyunType 3: 28*4882a593Smuzhiyun Same as Type 2 with extended maximum timeout period. 29*4882a593Smuzhiyun Maximum timeout is 65535 sec. 30*4882a593Smuzhiyun 31*4882a593SmuzhiyunType 1 HW watchdog implementation exist in old systems and 32*4882a593Smuzhiyunall new systems have type 2 HW watchdog. 33*4882a593SmuzhiyunTwo types of HW implementation have also different register map. 34*4882a593Smuzhiyun 35*4882a593SmuzhiyunType 3 HW watchdog implementation can exist on all Mellanox systems 36*4882a593Smuzhiyunwith new programmer logic device. 37*4882a593SmuzhiyunIt's differentiated by WD capability bit. 38*4882a593SmuzhiyunOld systems still have only one main watchdog. 39*4882a593Smuzhiyun 40*4882a593SmuzhiyunMellanox system can have 2 watchdogs: main and auxiliary. 41*4882a593SmuzhiyunMain and auxiliary watchdog devices can be enabled together 42*4882a593Smuzhiyunon the same system. 43*4882a593SmuzhiyunThere are several actions that can be defined in the watchdog: 44*4882a593Smuzhiyunsystem reset, start fans on full speed and increase register counter. 45*4882a593SmuzhiyunThe last 2 actions are performed without a system reset. 46*4882a593SmuzhiyunActions without reset are provided for auxiliary watchdog device, 47*4882a593Smuzhiyunwhich is optional. 48*4882a593SmuzhiyunWatchdog can be started during a probe, in this case it will be 49*4882a593Smuzhiyunpinged by watchdog core before watchdog device will be opened by 50*4882a593Smuzhiyunuser space application. 51*4882a593SmuzhiyunWatchdog can be initialised in nowayout way, i.e. oncse started 52*4882a593Smuzhiyunit can't be stopped. 53*4882a593Smuzhiyun 54*4882a593SmuzhiyunThis mlx-wdt driver supports both HW watchdog implementations. 55*4882a593Smuzhiyun 56*4882a593SmuzhiyunWatchdog driver is probed from the common mlx_platform driver. 57*4882a593SmuzhiyunMlx_platform driver provides an appropriate set of registers for 58*4882a593SmuzhiyunMellanox watchdog device, identity name (mlx-wdt-main or mlx-wdt-aux), 59*4882a593Smuzhiyuninitial timeout, performed action in expiration and configuration flags. 60*4882a593Smuzhiyunwatchdog configuration flags: nowayout and start_at_boot, hw watchdog 61*4882a593Smuzhiyunversion - type1 or type2. 62*4882a593SmuzhiyunThe driver checks during initialization if the previous system reset 63*4882a593Smuzhiyunwas done by the watchdog. If yes, it makes a notification about this event. 64*4882a593Smuzhiyun 65*4882a593SmuzhiyunAccess to HW registers is performed through a generic regmap interface. 66*4882a593SmuzhiyunProgrammable logic device registers have little-endian order. 67