i2c: axxia: Fix NULL pointer dereference by ISR

Fix bug where the interrupt handler would dereference a NULL pointer if an
interrupt was received without an ongoing transfer. This error could be
triggered by another party messing with the I2C controller registers.

Unable to handle kernel NULL pointer dereference at virtual address 00000002
pgd = c0403000
[00000002] *pgd=80000000404003, *pmd=00000000
Internal error: Oops: 205 [#1] PREEMPT SMP ARM
Modules linked in: ncp(O)
CPU: 13 PID: 749 Comm: irq/53-20100860 Tainted: G O 3.10.17-rt11-lsi-preempt-rt_8.8.1.14 #1
task: ee928000 ti: ee490000 task.ti: ee490000
PC is at axxia_i2c_isr+0xe0/0x1b4
LR is at irq_forced_thread_fn+0x20/0x64
pc : [<c07a4c2c>]    lr : [<c0489550>]    psr: 40000013
sp : ee491f00  ip : 00000000  fp : c0489530
r10: c0489530  r9 : ee475fc0  r8 : c0a60f80
r7 : 00000001  r6 : c0a72f40  r5 : 00000000  r4 : eeb72e10
r3 : 00000000  r2 : 00000001  r1 : eeb72e10  r0 : 00000035
Flags: nZcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
Control: 30c5387d  Table: 2e180500  DAC: 55555555
Process irq/53-20100860 (pid: 749, stack limit = 0xee490240)
Stack: (0xee491f00 to 0xee492000)
1f00: ee475fc0 c0a60f80 00000000 c0489550 ee475fe0 ee490000 00000000 c048984c
1f20: 00000001 c0a72ff8 ee475fc0 00000000 c0489530 ee490020 00000000 c0489640
1f40: c04896fc ef04dd78 00000000 ee475fc0 c04896fc 00000000 00000000 00000000
1f60: 00000000 c044fe68 eebc6fc0 00000000 ee491f9c ee475fc0 00000000 00000000
1f80: ee491f80 ee491f80 00000000 00000000 ee491f90 ee491f90 ee491fac ef04dd78
1fa0: c044fdc4 00000000 00000000 c041af98 00000000 00000000 00000000 00000000
1fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
1fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
[<c07a4c2c>] (axxia_i2c_isr+0xe0/0x1b4) from [<c0489550>] (irq_forced_thread_fn+0x20/0x64)
[<c0489550>] (irq_forced_thread_fn+0x20/0x64) from [<c048984c>] (irq_thread+0x150/0x1b0)
[<c048984c>] (irq_thread+0x150/0x1b0) from [<c044fe68>] (kthread+0xa4/0xa8)
[<c044fe68>] (kthread+0xa4/0xa8) from [<c041af98>] (ret_from_fork+0x14/0x3c)
Code: e5832048 e2840f66 ebf2ce98 e59431a8 (e1d320b2)
---[ end trace 0000000000000002 ]---

Signed-off-by: Anders Berg <anders.berg@lsi.com>
ARM: dts: axxia: Add missing I2C-0 device

Add device node for I2C-0 controller that connects the system FPGA. The device
node is needed to enable user-space access to this device.

Signed-off-by: Anders Berg <anders.berg@lsi.com>
ARM: dts: axxia: Fix typo in compatible string

The compatible string for the ADT7467 device contained a typo which would
result in the device not being activated.

Signed-off-by: Anders Berg <anders.berg@lsi.com>
Merge branch 'aberg-i2c-with-rte' into standard/lsi/base
Merge branch 'standard/lsi/base' into standard/preempt-rt/lsi/base
i2c: axxia: Minor cosmetic cleanup

Signed-off-by: Anders Berg <anders.berg@avagotech.com>
i2c: axxia: Fall back to polling mode when no IRQ

If the device tree does not specify an interrupt property, the device falls
back to polling the controller status. This is needed to support simulator
models without interrupt capabilities.

Signed-off-by: Anders Berg <anders.berg@avagotech.com>
misc: lsi-smmon: Bug when probing with IRQ pending

We must not call the ncr_write function to unmask interrupts with
the memory controller interrupt enabled, as this could cause the ISR to
be invoked before ncr_write has released the lock used to serialize
register accesses.

To avoid this, temporarily disable the IRQ line while unmasking the
interrupt sources in the controller.

Signed-off-by: Anders Berg <anders.berg@avagotech.com>
misc: lsi-smmon: Add parameter panic_on_fatal

Added module parameter panic_on_fatal which when set will cause the driver
to call panic() when an uncorrectable ECC error is detected.

Signed-off-by: Anders Berg <anders.berg@avagotech.com>
ARM: dts: axxia: Added memory controllers

Signed-off-by: Anders Berg <anders.berg@avagotech.com>
Merge branch 'standard/lsi/base' into standard/preempt-rt/lsi/base
arch/arm/mach-axxia: Enable Secondary Cores when in Hyp Mode

The Axxia boot loader leaves secondary cores in reset; Linux is expected
to enable them.  This change makes that happen.

Signed-off-by: John Jacques <john.jacques@lsi.com>
arch/arm/mach-axxia: Remove Unused Device Tree

The version of emulation that used this device tree is no longer
supported.

Signed-off-by: John Jacques <john.jacques@lsi.com>
arch/arm/mach-axxia: Device Trees for New 5500 Variants

Add device trees for two new 5500 variants, 5512 and 5508.

Signed-off-by: John Jacques <john.jacques@lsi.com>
Merge branch 'standard/lsi/base' into standard/preempt-rt/lsi/base