Commit Graph

22 Commits

Author SHA1 Message Date
Justin Chadwell b7f6525db6 Enable -Wshadow always
Variable shadowing is, according to the C standard, permitted and valid
behaviour. However, allowing a local variable to take the same name as a
global one can cause confusion and can make refactoring and bug hunting
more difficult.

This patch moves -Wshadow from WARNING2 into the general warning group
so it is always used. It also fixes all warnings that this introduces
by simply renaming the local variable to a new name

Change-Id: I6b71bdce6580c6e58b5e0b41e4704ab0aa38576e
Signed-off-by: Justin Chadwell <justin.chadwell@arm.com>
2019-11-19 08:53:16 -06:00
Antonio Nino Diaz 09d40e0e08 Sanitise includes across codebase
Enforce full include path for includes. Deprecate old paths.

The following folders inside include/lib have been left unchanged:

- include/lib/cpus/${ARCH}
- include/lib/el3_runtime/${ARCH}

The reason for this change is that having a global namespace for
includes isn't a good idea. It defeats one of the advantages of having
folders and it introduces problems that are sometimes subtle (because
you may not know the header you are actually including if there are two
of them).

For example, this patch had to be created because two headers were
called the same way: e0ea0928d5 ("Fix gpio includes of mt8173 platform
to avoid collision."). More recently, this patch has had similar
problems: 46f9b2c3a2 ("drivers: add tzc380 support").

This problem was introduced in commit 4ecca33988 ("Move include and
source files to logical locations"). At that time, there weren't too
many headers so it wasn't a real issue. However, time has shown that
this creates problems.

Platforms that want to preserve the way they include headers may add the
removed paths to PLAT_INCLUDES, but this is discouraged.

Change-Id: I39dc53ed98f9e297a5966e723d1936d6ccf2fc8f
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2019-01-04 10:43:17 +00:00
Antonio Nino Diaz c3cf06f1a3 Standardise header guards across codebase
All identifiers, regardless of use, that start with two underscores are
reserved. This means they can't be used in header guards.

The style that this project is now to use the full name of the file in
capital letters followed by 'H'. For example, for a file called
"uart_example.h", the header guard is UART_EXAMPLE_H.

The exceptions are files that are imported from other projects:

- CryptoCell driver
- dt-bindings folders
- zlib headers

Change-Id: I50561bf6c88b491ec440d0c8385c74650f3c106e
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-11-08 10:20:19 +00:00
dp-arm 82cb2c1ad9 Use SPDX license identifiers
To make software license auditing simpler, use SPDX[0] license
identifiers instead of duplicating the license text in every file.

NOTE: Files that have been imported by FreeBSD have not been modified.

[0]: https://spdx.org/

Change-Id: I80a00e1f641b8cc075ca5a95b10607ed9ed8761a
Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
2017-05-03 09:39:28 +01:00
Koan-Sin Tan 201d535ff6 Remove use of all deprecated APIs
Now it's possbile to build BL31 for MT8173 with ERROR_DEPRECATED=1.

Signed-off-by: Koan-Sin Tan <koansin.tan@gmail.com>
2017-01-24 10:50:14 +08:00
Paul Kocialkowski 03be4806fd mt8173: Correct SPM MCDI firmware length
The actual length of the firmware is 1001 32 bit words.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
2017-01-14 17:11:12 +01:00
Fan Chen 8c9130c6c2 mt8173: Fix timing issue of mfg mtcmos power off
In mt8173, there are totally 10 non-cpu mtcmos, so we cannot tell
if SPM finished the power control flow by 10 status bits of PASR_PDP_3.
So, extend PASR_PDP_3 status bits from 10 to 20 so that we can
make sure if the control action has been done precisely.

Change-Id: Ifd4faaa4173c6e0543aa8471149adb9fe7fadedc
Signed-off-by: Fan Chen <fan.chen@mediatek.com>
2016-04-14 14:10:04 +08:00
yt.lee 3454fdea07 mt8173: fix spm driver build errors
To fix build errors in following build conditions,
DEBUG=1 LOG_LEVEL<40
DEBUG=0 LOG_LEVEL>=40

Change-Id: Ib34aed07b2ae0abd8a3a46948adc9fbeaae715aa
Signed-off-by: yt.lee <yt.lee@mediatek.com>
2016-04-07 18:38:03 +08:00
Jimmy Huang a1e0c01f97 mt8173: Protect BL31 memory from non-secure access
BL31 usually handles confidential stuff, its memory must not be
read/write accessible from non-secure world. This patch protects
the BL31 memory range from non-secure read/write access.

Change-Id: I442fb92b667bb2f9a62d471a90508b1ba4489911
Signed-off-by: Jimmy Huang <jimmy.huang@mediatek.com>
2016-04-01 13:10:41 +08:00
Jimmy Huang b99d961c7d mt8173: support big core PLL control in system suspend flow
This patch adds big core ARMPLL control in system suspend flow.

Change-Id: I27a45dbbb360f17ff0b524a125630358ee2277e2
Signed-off-by: Louis Yu <louis.yu@mediatek.com>
Signed-off-by: Jimmy Huang <jimmy.huang@mediatek.com>
2016-03-09 15:40:32 +08:00
Fan Chen bb99828dee mt8173: Fix long latency issue of mtcmos contorl
We found sometimes mtcmos operation is too long in spm (>1ms),
so update a new version to fix it.
I verified with 5 hours power_LoadTest, every mtcmos control
can finish in 500us (average is 100~200us).

Change-Id: I47b712bf9898870f4abcecbea47e01b9786231d4
Signed-off-by: Fan Chen <fan.chen@mediatek.com>
2016-01-26 13:55:15 +08:00
Weiyi Lu 44c4908790 mt8173: Improve performance by handling more interrupts during idle
1. Set more wakeup source
2. Update PCM code for control logic

Change-Id: I2ad06bd85bd1c75a22c838eab4cf5566c443b89a
Signed-off-by: Weiyi Lu <weiyi.lu@mediatek.com>
2016-01-26 13:55:14 +08:00
Jimmy Huang 1a1ff8b962 mt8173: Implement subsystem power control logic in ARM TF
1. Add SiP calls for subsystem power on/off and check support
2. Add subsystem power control related initialization in
   bl31_plat_setup.c
3. Add subsystem power on/off and power ack waiting functions
4. Update PCM code for subsystem physical power control logic

Change-Id: Ia0ebb1964c8f9758159bcf17c1813d76ef52cf64
Signed-off-by: yt.lee <yt.lee@mediatek.com>
2016-01-26 13:55:13 +08:00
Jimmy Huang 8e53ec53b6 mt8173: support big/Little cluster power off for CPU idle(C2 state)
1. add power control for both big and Little cluster in MCDI
2. fix incorrect PCM_HOTPLUG_VALID_MASK in spm_hotplug.c
3. check the power status of cpus in cluster before setting the cputop
   power control

Change-Id: Ifa85306a8bc218098667247904d281494c2f7bfe
Signed-off-by: Weiyi Lu <weiyi.lu@mediatek.com>
2016-01-26 13:55:12 +08:00
Jimmy Huang 3c454d52e1 mt8173: Move SPM related PLL settings to ARM TF
Move SPM related PLL settings to spm_boot_init in ARM TF SPM driver

Change-Id: I414b896caae072570c8de33a25e06db4ae011f57
Signed-off-by: yt.lee <yt.lee@mediatek.com>
2016-01-26 13:55:11 +08:00
Jimmy Huang cc04b843ba mt8173: Fix USB remote wake up problem
This patch updates SPM driver settings and PCM code to fix USB remote
wake up problem.

Change-Id: I07a81cc64b1d226d111380580d09ae25879f4285
Signed-off-by: yt.lee <yt.lee@mediatek.com>
2016-01-26 13:55:10 +08:00
Soren Brinkmann 65cd299f52 Remove direct usage of __attribute__((foo))
Migrate all direct usage of __attribute__ to usage of their
corresponding macros from cdefs.h.
e.g.:
 - __attribute__((unused)) -> __unused

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
2016-01-14 10:55:17 -08:00
danh-arm 895a7fb459 Merge pull request #393 from mtk09422/misc-updates
mt8173: Update SPM and fix watchdog setting
2015-09-30 11:13:33 +01:00
yt.lee 0ad1a9b329 mt8173: update spm suspend pcm codes
1. update suspend pcm code (add dummy apb read before mcusys power down)

BRANCH=none
BUG=none
TEST=verified

Change-Id: I2802cf8665fc1c8fe2304fd7d5f3eab9948b0b78
Signed-off-by: yt.lee <yt.lee@mediatek.com>
2015-09-14 14:35:15 +08:00
Vikram Kanigiri c3ec0b9ea4 Use unified bakery locks API in Mediatek port
This patch update Mediatek port to use the `DEFINE_BAKERY_LOCK` macro instead of
specifying the exact data structure to use for a bakery lock and the input
linker section that it should be allocated to.

Change-Id: I2116dbe27010bb46d7cc64fafef55c7240c4c721
2015-09-11 16:20:01 +01:00
kenny liang 64faa0e5bb mt8173: update spm wake_src setting
1. SEJ should not be one of the wake up sources

BUG=chrome-os-partner:38426
TEST=powerd_dbus_suspend

Change-Id: If8f3f19a885e66d7c10b472c2e3182a5affa4773
Signed-off-by: kenny liang <kenny.liang@mediatek.com>
2015-08-18 16:28:04 +08:00
CC Ma 7d116dccab Initial platform port for MediaTek mt8173
- Boot up 4 cores.
- Add a generic UART driver.
- Add generic CPU helper functions
- Supoort suspend
- Add system_off & system_reset implementation
- Add crash console reporting implementation
- Add get_sys_suspend_power_state() for PSCI 1.0 SYSTEM_SUSPEND
- Add Mediatek SIP runtime service
- Add delay timer platform implementation

Change-Id: I44138249f115ee10b9cbd26fdbc2dd3af04d825f
Signed-off-by: CC Ma <cc.ma@mediatek.com>
Signed-off-by: Jimmy Huang <jimmy.huang@mediatek.com>
2015-08-11 14:45:33 +08:00