Revert "msm: devices-msm8x60: port 2D unit bus scale and clock setting from 8960"

This reverts commit 009694dc575cf466811ded3f71b49df0347bf51b.
msm: devices-msm8x60: port 2D unit bus scale and clock setting from 8960
msm: devices-msm8x60: enable gpu 3D slumber
msm: msm_bus: Explicitly clear client requests before removal

Clients can potentially leave non-zero requests before
unregistering. Such requests persist and cause instability
and severe power and performance impact.

Protect the system against such clients by explicitly
clearing the client requests before unregistration.

Change-Id: I6a905b097de41af168b5f5048b682ba995b581c2
CRs-Fixed: 407057
Signed-off-by: Gagan Mac <gmac@codeaurora.org>
msm: msm_bus: Fix bus driver compilation in absence of RPM configs

If RPM config flags are absent, the bus driver fails to compile.
Fix this by adding stubs for RPM dependant functions.

Change-Id: I94fa0fd4626fec94dd10a12083cbb477fa70e3a7
Signed-off-by: Gagan Mac <gmac@codeaurora.org>
msm: msm_bus: Enable bus driver to get pdata from device tree

This patch enables the bus driver to get platform data using
NoC definitions from device tree.

Change-Id: I6cde254de3cbfe580e2d254615008710f09cfefc
Signed-off-by: Gagan Mac <gmac@codeaurora.org>
msm: msm_bus: Change initcall to subsys for bus devices

This change is required to enable early initialization of fabric
devices using device tree.
In the absence of this change, or if module_init/arch_init
are used, client registration is attempted before the
NoCs or fabrics are initialized. The registration fails
as the path cannot be calculated as the topology is built
after all the NoCs/Fabrics are initialized.

Change-Id: I79603af5d36e9afe1be25e4267cb01ba6a3c1d07
Signed-off-by: Gagan Mac <gmac@codeaurora.org>
msm: msm_bus: Fix memory leak during RPM transaction

This is a serious bug that eventually cripples the system due to
lost memory.

CRs-Fixed: 442381
Change-Id: If4d33b35475a33b1602a1d923031345b47af963e
Signed-off-by: Michael Bohan <mbohan@codeaurora.org>
msm: msm_bus: Correct bypass mode settings for BIMC masters

If a master is in fixed or bypass mode, it's bandwidth registers
should not be touched. Currently, the bus driver attempts to
configure bandwidth registers during init. This patch fixes
this error.

Change-Id: I49b2104f1c429ac5ea3fb4e8f692cb3dd363c3be
CRs-Fixed: 439869
Signed-off-by: Gagan Mac <gmac@codeaurora.org>
msm: bus: Don't call container_of on a NULL pointer

Calling container_of on a NULL pointer results in a
non-NULL value, causing downstream error handling to fail.

Change-Id: Ifa4b4003bb02e9f640f91b5190a8025d7ad2dd1d
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
msm: msm_bus: Avoid touching ports owned by RPM

Add a check during init to not touch ports which are owned by
RPM. Doing this can cause crashes due to access violation
if XPU is active.

Change-Id: Ic38280c130f84af3895c4372f1182e4089c043cc
Signed-off-by: Gagan Mac <gmac@codeaurora.org>
msm: msm_bus: Add NULL pointer check

This patch protects the bus driver against clients who try to
update requests without registering the client.

Change-Id: Ie740844218dbabe5fca098798c461590aba42e97
CRs-Fixed: 459651
Signed-off-by: Gagan Mac <gmac@codeaurora.org>
msm: msm_bus: Fix Priority-Level register access on BIMC

The BIMC register access for AREQPRIORITY and PRIORITYLVL
registers was incorrect during setting QoS priority.
Fix this by writing to the correct location.

Change-Id: I80817d27a35832f41903da7684aed5c132af9045
Signed-off-by: Gagan Mac <gmac@codeaurora.org>
msm: msm_bus: Fix the 64-bit division during interleaving

When interleaving flag is enabled, the bandwidth is divided
between ports. There was an error in the division as the
macro was not correctly updated with the right order of using
bandwidth and port number when 64-bit division function
was used by the bus driver.
Correcting this for fixing the token allocation issues
observed.

CRs-Fixed: 472791
Change-Id: Ie7c7f9557006cbb946eaa9eff4b50771cc60525e
Signed-off-by: Gagan Mac <gmac@codeaurora.org>
msm: msm_bus: Fix the type error affecting sum of abs

On legacy chipsets, uint16 was being used to write bandwidth
values to the Fabric registers. However, NoCs support 64-bit integers.
The issue surfaces only when sum of active ab values exceeds the max
ib value in the system, as then the sum of ab values don't impact the
clock anymore. This is exactly what was observed in H-flip video usecase.

This patch fixex the bandwidth sum type due to which clocks were not
updated in those cases where requested ab values are higher than the ib
values.

Change-Id: I701ddb7e7b2d66dd14ef74bc38f3748ac40b76ec
CRs-Fixed: 480365
Signed-off-by: Gagan Mac <gmac@codeaurora.org>
msm: msm_bus: Add NULL pointer checks.

Bus driver is crashing due to a NULL pointer
access sent by the client. A few NULL pointer
checks have been added to protect the driver
from invalid/NULL client handle.

CRs-Fixed: 458264
Change-Id: I822ad312ba1a0c0939d97eb92ea53094d408a836
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
msm: msm_bus: Fix division by Zero error in kernel

Avoid the error by checking for zero slave ports before
dividing bandwidth.

CRs-Fixed: 495496
Change-Id: I8e9b1e61ba3b47ed270d2f8cf60ed975b5c49889
Signed-off-by: Gagan Mac <gmac@codeaurora.org>

Conflicts:

	arch/arm/mach-msm/msm_bus/msm_bus_arb.c

Signed-off-by: Ajay Dudani <adudani@codeaurora.org>
msm: msm_bus: send correct value to bw division function

While calculating bw for existing client request
sometimes it can go to negative if client unregisters
or send request with lesser ab/ib values. Bus driver
will divide bandwidth if interleaving enabled.

Added a macro wrapper to handle negative bw values
since the division utility function can't handle
negative values

CRs-Fixed: 521940
Change-Id: Ic3a216b8efb535593fe02ad3228d71808d2e0f98
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
Signed-off-by: Ajay Dudani <adudani@codeaurora.org>
msm: msm_bus: Fix the type error causing bandwidth overflow

On legacy chipsets, long int was being used to store
return value after calculating interleaved bw. However,
NoCs support 64-bit integers ab/ib values. problme occurs
if client request for higher bw and if difference of ab
value exceeds the range of 32 bit integer, the Value
overflows and turns negative, which leads to wrong bw calculation.

This patch fixes this integer overflow by correcting argument
type to store bw.

CRs-Fixed: 537213
Change-Id: I8c6c79ba245a988c2c54ccaca3f3eaf5cb857ce5
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
Signed-off-by: Ajay Dudani <adudani@codeaurora.org>