iommu/omap: Allocate archdata on the fly for DT-based devices
iommu/omap: Allocate archdata on the fly for DT-based devices

The OMAP IOMMU driver locates the IOMMU associated to a device using the
IOMMU name stored in the device archdata iommu field. That field is
expected to be populated by platform code and is left unset for DT-based
devices. This results in a crash when the IOMMU driver attaches a domain
to a device.

Fix this by allocating the archdata iommu structure when devices are
added and freeing when they are removed. Devices without an OF node, and
devices without an iommus property in their OF node are ignored. The
iommu name is initialized from the IOMMU device node name.

This should be simplified when removing non-DT support completely from
the IOMMU users as the IOMMU name won't be needed anymore, and the
IOMMU device pointer could then be stored in the archdata iommu field
directly.

Signed-off-by: Laurent Pinchart <3ded2f39a78f0d7044839546f95841842b4d7c96@ideasonboard.com>
[68636d6b0a4dfe1213ee9d7712e75a8cc339119f@ti.com: updated to use device name instead of OF name]
Signed-off-by: Suman Anna <68636d6b0a4dfe1213ee9d7712e75a8cc339119f@ti.com>
Signed-off-by: Joerg Roedel <4688a6871ff025801033b3c4b039d55a29f8f937@8bytes.org>

KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs