net: can: c_can: Sync RAMINIT mechanism with upstream

This sync fixes the following
- Add DONE check to RAMINIT
- Add timeout as am43xx is known to sometimes not set DONE bit.
- Add START pulse mechanism for DRA7x.

Signed-off-by: Roger Quadros <rogerq@ti.com>
HACK: ARM: DRA7: clockdomain: Fix DCAN1 RAMINT

Disable HW_AUTO for L4CFG and WKUPAON clockdomains.
Without this the DCAN1 RAMINIT.DONE bit never gets set after the
RAMINIT start sequence.

Signed-off-by: Roger Quadros <rogerq@ti.com>
HACK: ARM: DRA7: clockdomain: fix DCAN2 RAMINIT

DCAN2 RAMINIT mechanism doesn't work when L4PER2 clock domain
is set to HW_AUTO sleep. Prevent it from auto sleeping.

Signed-off-by: Roger Quadros <rogerq@ti.com>
net: can: c_can: Disable pins when CAN interface is down

DRA7 CAN IP suffers from a problem which causes it to be prevented
from fully turning OFF (i.e. stuck in transition) if the module was
disabled while there was traffic on the CAN_RX line.

To work around this issue we select the SLEEP pin state by default
on probe and use the DEFAULT pin state on CAN up and back to the
SLEEP pin state on CAN down.

Signed-off-by: Roger Quadros <rogerq@ti.com>
net: can: c_can: fix power down/up and pinctrl in suspend/resume

If the can was never powred up, there is no point in calling power down/up
during suspend/resume. Use the can state flag to check if CAN is really
not stopped before attempting power down/up.

The pinctrl state is now managed in c_can_power_up/down() so no need
to call them again in suspend/resume.

Cc: Dave Gerlach <d-gerlach@ti.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
net: can: c_can: Add support for TI DRA7 DCAN

DRA7 SoC has 2 CAN IPs. Provide compatible IDs and RAMINIT
register data for both.

Signed-off-by: Roger Quadros <rogerq@ti.com>
net: can: c_can: Add support for TI am3352 DCAN

AM3352 SoC has 2 DCAN modules. Add compatible id and
raminit driver data for am3352 DCAN.

Signed-off-by: Roger Quadros <rogerq@ti.com>
ARM: dts: dra7: dcan update

Use specific compatible id and specify RAMINIT
register via syscon-raminit property.

Also rename can nodes from "d_can" to "can" to be compliant
with the ePAPR specs.

Signed-off-by: Roger Quadros <rogerq@ti.com>
ARM: dts: am4372: Add control module syscon node

Use syscon regmap to expose the Control module register space.
This register space is shared between many users e.g. DCAN, USB, display, etc.

Signed-off-by: Roger Quadros <rogerq@ti.com>
ARM: dts: am4372: dcan update

Use specific compatible id and specify RAMINIT
register via syscon-raminit property.

Signed-off-by: Roger Quadros <rogerq@ti.com>
ARM: dts: am33xx: Add control module syscon node

Use syscon regmap to expose the Control module register space.
This register space is shared between many users e.g. DCAN, USB, display, etc.

Signed-off-by: Roger Quadros <rogerq@ti.com>
ARM: dts: am33xx: dcan update

Use specific compatible id and specify RAMINIT
register via syscon-raminit property.

Also rename can nodes from "d_can" to "can" to be compliant
with the ePAPR specs.

Signed-off-by: Roger Quadros <rogerq@ti.com>
ARM: dra7-evm: Enable DCAN1

Set pinmux and enable DCAN1 node for dra7-evm.
WAKEUP0 pin doesn't have INPUT enable bit so we just disable
weak PULLs.

Signed-off-by: Roger Quadros <rogerq@ti.com>
ARM: dra72-evm: Enable DCAN1

Set pinmux and enable DCAN1 node for dra72-evm.
WAKEUP0 pin doesn't have INPUT enable bit so we just disable
weak PULLs.

Signed-off-by: Roger Quadros <rogerq@ti.com>
ARM: dts: am437x-gp-evm: Fix DCAN stuck in transition

The DCAN pins must not be put into safe mode before the DCAN
module is disabled. That causes it to be stuck in transition.

Get rid of the sleep pins for DCAN1 and DCAN2.

Cc: Dave Gerlach <d-gerlach@ti.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
ARM: dts: AM33xx: Add clock to DCAN nodes

The CAN driver expects a clock so provide it.

Signed-off-by: Roger Quadros <rogerq@ti.com>
ARM: dts: am335x-evm: Enable DCAN1

DCAN1 is routed to CAN port (J11) when profile 1 is selected.
As DCAN1 pins (i.e. uart0_ctsn and uart0_rtsn) are not used
in any other profile it doesn't harm to always have DCAN1
enabled.

Cc: Aparna Balasubramanian <aparnab@ti.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>