linux/drivers/net/can
Anssi Hannula 8ebd83bdb0 can: xilinx_can: fix power management handling
There are several issues with the suspend/resume handling code of the
driver:

- The device is attached and detached in the runtime_suspend() and
  runtime_resume() callbacks if the interface is running. However,
  during xcan_chip_start() the interface is considered running,
  causing the resume handler to incorrectly call netif_start_queue()
  at the beginning of xcan_chip_start(), and on xcan_chip_start() error
  return the suspend handler detaches the device leaving the user
  unable to bring-up the device anymore.

- The device is not brought properly up on system resume. A reset is
  done and the code tries to determine the bus state after that.
  However, after reset the device is always in Configuration mode
  (down), so the state checking code does not make sense and
  communication will also not work.

- The suspend callback tries to set the device to sleep mode (low-power
  mode which monitors the bus and brings the device back to normal mode
  on activity), but then immediately disables the clocks (possibly
  before the device reaches the sleep mode), which does not make sense
  to me. If a clean shutdown is wanted before disabling clocks, we can
  just bring it down completely instead of only sleep mode.

Reorganize the PM code so that only the clock logic remains in the
runtime PM callbacks and the system PM callbacks contain the device
bring-up/down logic. This makes calling the runtime PM callbacks during
e.g. xcan_chip_start() safe.

The system PM callbacks now simply call common code to start/stop the
HW if the interface was running, replacing the broken code from before.

xcan_chip_stop() is updated to use the common reset code so that it will
wait for the reset to complete. Reset also disables all interrupts so do
not do that separately.

Also, the device_may_wakeup() checks are removed as the driver does not
have wakeup support.

Tested on Zynq-7000 integrated CAN.

Signed-off-by: Anssi Hannula <anssi.hannula@bitwise.fi>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2018-07-23 14:34:46 +02:00
..
c_can can: c_can_pci: make c_can_pci_data const 2017-12-01 09:14:22 +01:00
cc770 drivers/net: Use octal not symbolic permissions 2018-03-26 12:07:49 -04:00
ifi_canfd can: ifi: Repair the error handling 2018-03-12 09:55:12 +01:00
m_can can: m_can: Move accessing of message ram to after clocks are enabled 2018-07-23 14:34:45 +02:00
mscan can: mpc5xxx_can: check of_iomap return before use 2018-07-23 14:34:45 +02:00
peak_canfd can: peak_canfd: fix firmware < v3.3.0: limit allocation to 32-bit DMA addr only 2018-07-23 14:34:45 +02:00
rcar scripts/spelling.txt: add regsiter -> register spelling mistake 2017-05-08 17:15:13 -07:00
sja1000 drivers/net: Use octal not symbolic permissions 2018-03-26 12:07:49 -04:00
softing drivers/net: Use octal not symbolic permissions 2018-03-26 12:07:49 -04:00
spi can: hi311x: Work around TX complete interrupt erratum 2018-05-10 18:25:30 +02:00
usb can: kvaser_usb: Increase correct stats counter in kvaser_usb_rx_can_msg() 2018-05-08 10:41:38 +02:00
at91_can.c drivers/net: Use octal not symbolic permissions 2018-03-26 12:07:49 -04:00
dev.c can: dev: increase bus-off message severity 2018-05-08 10:41:38 +02:00
flexcan.c can: flexcan: fix endianess detection 2018-05-08 10:41:38 +02:00
grcan.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
janz-ican3.c drivers/net: Use octal not symbolic permissions 2018-03-26 12:07:49 -04:00
Kconfig can: remove bfin_can driver 2018-03-26 15:57:02 +02:00
led.c
Makefile can: remove bfin_can driver 2018-03-26 15:57:02 +02:00
pch_can.c can: fix assignment of error location in CAN error messages 2015-11-23 09:37:34 +01:00
rx-offload.c can: rx-offload: can_rx_offload_add_timestamp: remove duplicate semicolon at return statement 2018-01-05 11:12:08 +01:00
slcan.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
sun4i_can.c can: sun4i: handle overrun in RX FIFO 2017-11-10 09:15:28 +01:00
ti_hecc.c can: ti_hecc: Fix napi poll return value for repoll 2017-12-01 11:20:52 +01:00
vcan.c drivers/net: Use octal not symbolic permissions 2018-03-26 12:07:49 -04:00
vxcan.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2018-01-09 10:37:00 -05:00
xilinx_can.c can: xilinx_can: fix power management handling 2018-07-23 14:34:46 +02:00