summaryrefslogtreecommitdiffstats
path: root/drivers/soc/mediatek/mtk-pmic-wrap.c
AgeCommit message (Collapse)AuthorFilesLines
2022-08-25soc: mediatek: Let PMIC Wrapper and SCPSYS depend on OFJean Delvare1-1/+1
With the following configuration options: CONFIG_OF is not set CONFIG_MTK_PMIC_WRAP=y CONFIG_MTK_SCPSYS=y we get the following build warnings: CC drivers/soc/mediatek/mtk-pmic-wrap.o drivers/soc/mediatek/mtk-pmic-wrap.c:2138:34: warning: ‘of_pwrap_match_tbl’ defined but not used [-Wunused-const-variable=] drivers/soc/mediatek/mtk-pmic-wrap.c:1953:34: warning: ‘of_slave_match_tbl’ defined but not used [-Wunused-const-variable=] CC drivers/soc/mediatek/mtk-scpsys.o drivers/soc/mediatek/mtk-scpsys.c:1084:34: warning: ‘of_scpsys_match_tbl’ defined but not used [-Wunused-const-variable=] Looking at the code, both drivers can only bind to OF-defined device nodes, so these drivers are useless without OF and should therefore depend on it. Also drop of_match_ptr() from both drivers. We already know what it will resolve to, so we might as well save cpp some work. Developers or QA teams who wish to test-build the code can still do so by enabling CONFIG_OF, which is available on all architectures and has no dependencies. Signed-off-by: Jean Delvare <jdelvare@suse.de> Reported-by: kernel test robot <lkp@intel.com> Link: https://lore.kernel.org/all/202207240252.ZY5hSCNB-lkp@intel.com/ Cc: Matthias Brugger <matthias.bgg@gmail.com> Cc: Chenglin Xu <chenglin.xu@mediatek.com> Link: https://lore.kernel.org/r/20220730144833.0a0d9825@endymion.delvare Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2022-06-07soc: mediatek: pwrap: Compress of_device_id entries to one lineAngeloGioacchino Del Regno1-66/+25
Compress each entry of the of_device_id tables in this driver to one line instead of three, as they fit just fine in a single line. Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://lore.kernel.org/r/20220517104712.24579-6-angelogioacchino.delregno@collabora.com Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2022-06-07soc: mediatek: pwrap: Move IO pointers to new structureAngeloGioacchino Del Regno1-29/+32
In the PMIC Wrapper driver each PMIC has its own regmap configuration and its own pwrap_{read/write}() callbacks, but it's just about either a 32 bits vs 16 bits register, and only one of them uses 32bits regs: this means that the same ops are assigned over and over again to all of the supported PMICs. It is therefore possible to avoid reassigning the same things over and over, reducing the amount of lines, without any impact on human readability of this driver: add a pwrap_slv_regops structure and move the callbacks and regmap_config pointer in there instead. This allows to assign just one pointer to that shared data in the per-pmic struct pwrap_slv_type. Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://lore.kernel.org/r/20220517104712.24579-5-angelogioacchino.delregno@collabora.com Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2022-06-07soc: mediatek: pwrap: Check return value of platform_get_irq()AngeloGioacchino Del Regno1-0/+5
Check for the return value of platform_get_irq(): if no interrupt is specified, it wouldn't make sense to call devm_request_irq(). Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://lore.kernel.org/r/20220517104712.24579-4-angelogioacchino.delregno@collabora.com Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2022-06-07soc: mediatek: pwrap: Switch to devm_platform_ioremap_resource_byname()AngeloGioacchino Del Regno1-6/+2
In order to simplify ioremapping resources, instead of calling platform_get_resource_byname() and then devm_ioremap_resource(), simply call devm_platform_ioremap_resource_byname(). Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Reviewed-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Tested-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Link: https://lore.kernel.org/r/20220517104712.24579-3-angelogioacchino.delregno@collabora.com Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2022-06-07soc: mediatek: pwrap: Use readx_poll_timeout() instead of custom functionAngeloGioacchino Del Regno1-27/+33
Function pwrap_wait_for_state() is a function that polls an address through a helper function, but this is the very same operation that the readx_poll_timeout macro means to do. Convert all instances of calling pwrap_wait_for_state() to instead use the read_poll_timeout macro. Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Reviewed-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Tested-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Link: https://lore.kernel.org/r/20220517104712.24579-2-angelogioacchino.delregno@collabora.com Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2022-03-01soc: mediatek: pwrap: add pwrap driver for MT8186 SoCJohnson Wang1-0/+71
MT8186 are highly integrated SoC and use PMIC_MT6366 for power management. This patch adds pwrap master driver to access PMIC_MT6366. Acked-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Johnson Wang <johnson.wang@mediatek.com> Link: https://lore.kernel.org/r/20220207083034.15327-2-johnson.wang@mediatek.com Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2021-06-03soc: mediatek: pwrap: add pwrap driver for MT8195 SoCHenry Chen1-0/+35
MT8195 are highly integrated SoC and use PMIC_MT6359 for power management. This patch adds pwrap master driver to access PMIC_MT6359. Signed-off-by: Henry Chen <henryc.chen@mediatek.com> Link: https://lore.kernel.org/r/20210602112050.12338-3-james.lo@mediatek.com Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2021-03-30soc: mediatek: pwrap: add pwrap driver for MT6873/8192 SoCsHsin-Hsiung Wang1-0/+29
MT6873/8192 are highly integrated SoCs and use PMIC_MT6359 for power management. This patch adds pwrap master driver to access PMIC_MT6359. Signed-off-by: Hsin-Hsiung Wang <hsin-hsiung.wang@mediatek.com> Link: https://lore.kernel.org/r/1615563286-22126-5-git-send-email-hsin-hsiung.wang@mediatek.com Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2021-03-30soc: mediatek: pwrap: add arbiter capabilityHsin-Hsiung Wang1-13/+51
Add arbiter capability for pwrap driver. The arbiter capability uses new design to judge the priority and latency for multi-channel. The design with arbiter support cannot change the watchdog timer. This patch is preparing for adding mt6873/8192 pwrap support. Signed-off-by: Hsin-Hsiung Wang <hsin-hsiung.wang@mediatek.com> Link: https://lore.kernel.org/r/1615563286-22126-3-git-send-email-hsin-hsiung.wang@mediatek.com Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2021-03-30soc: mediatek: pwrap: use BIT() macroHsin-Hsiung Wang1-2/+2
Use a better BIT() marco for the bit definition. No functional changes, cleanup only. Signed-off-by: Hsin-Hsiung Wang <hsin-hsiung.wang@mediatek.com> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> Link: https://lore.kernel.org/r/1615563286-22126-2-git-send-email-hsin-hsiung.wang@mediatek.com Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2020-02-17soc: mediatek: pwrap: add support for MT6359 PMICArgus Lin1-0/+71
MT6359 is a new power management IC and it is used for MT6779 SoCs. To define mt6359_regs for pmic register mapping and pmic_mt6359 for accessing register. Signed-off-by: Argus Lin <argus.lin@mediatek.com> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2020-02-17soc: mediatek: pwrap: add pwrap driver for MT6779 SoCsArgus Lin1-0/+57
MT6779 is a highly integrated SoCs, it uses PMIC_MT6359 for power management. This patch adds pwrap master driver to access PMIC_MT6359. Signed-off-by: Argus Lin <argus.lin@mediatek.com> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174Thomas Gleixner1-9/+1
Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 as published by the free software foundation this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 655 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Richard Fontana <rfontana@redhat.com> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070034.575739538@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-12soc: mediatek: pwrap: Zero initialize rdata in pwrap_init_cipherNathan Chancellor1-1/+1
When building with -Wsometimes-uninitialized, Clang warns: drivers/soc/mediatek/mtk-pmic-wrap.c:1358:6: error: variable 'rdata' is used uninitialized whenever '||' condition is true [-Werror,-Wsometimes-uninitialized] If pwrap_write returns non-zero, pwrap_read will not be called to initialize rdata, meaning that we will use some random uninitialized stack value in our print statement. Zero initialize rdata in case this happens. Link: https://github.com/ClangBuiltLinux/linux/issues/401 Signed-off-by: Nathan Chancellor <natechancellor@gmail.com> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2019-04-12soc: mediatek: pwrap: add support for MT8516 pwrapFabien Parent1-0/+106
Add the code to support the pwrap IP on the MediaTek MT8516 SoC. Signed-off-by: Fabien Parent <fparent@baylibre.com> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2019-04-12soc: mediatek: pwrap: add missing check on rstcFabien Parent1-1/+2
The variable rstc is set only when the SoC PWRAP have the PWRAP_CAP_RESET capability. Check whether rstc is set before using it to avoid errors. Signed-off-by: Fabien Parent <fparent@baylibre.com> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2018-09-25soc: mediatek: pwrap: add mt6357 driver for mt6765 SoCsArgus Lin1-0/+29
MT6357 is a new power management IC and it is used for mt6765 SoCs. To define mt6357_regs for pmic register mapping and pmic_mt6357 for accessing register. Signed-off-by: Argus Lin <argus.lin@mediatek.com> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2018-09-25soc: mediatek: pwrap: add pwrap driver for mt6765 SoCsArgus Lin1-0/+49
mt6765 is a highly integrated SoCs, it uses mt6357 for power management. This patch adds pwrap driver to access mt6357. Pwrap of mt6765 support dynamic priority meichanism, sequence monitor and starvation mechanism to make transaction more reliable. Signed-off-by: Argus Lin <argus.lin@mediatek.com> [mb: change has_bridge to capabilities] Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2018-09-25soc: mediatek: pwrap: use true and false for boolean valuesGustavo A. R. Silva1-1/+1
Return statements in functions returning bool should use true or false instead of an integer value. This issue was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Acked-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2018-09-25soc: mediatek: add mt8183 pwrap supportHsin-Hsiung Wang1-4/+191
MT6358 is a new power management IC and it is used for mt8183 SoCs. To define mt6358_regs for pmic register mapping and pmic_mt6358 for accessing register. Adding one more interrupt and wdt source. Signed-off-by: Hsin-Hsiung Wang <hsin-hsiung.wang@mediatek.com> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2018-09-25soc: mediatek: pwrap: use group of bits for pwrap capabilityHsin-Hsiung Wang1-15/+25
Use group of bits for pwrap capability instead of elements of structure. This patch is preparing for adding mt8183 pwrap support. Signed-off-by: Hsin-Hsiung Wang <hsin-hsiung.wang@mediatek.com> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2018-09-25soc: mediatek: pwrap: order SoCs and PMICs ascendingMatthias Brugger1-104/+104
Order SoC and PMIC numbers ascending to make the code more readable. Signed-off-by: Hsin-Hsiung Wang <hsin-hsiung.wang@mediatek.com> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2018-07-16soc: mediatek: pwrap: add mt6351 driver for mt6797 SoCsArgus Lin1-0/+29
MT6351 is a new power management IC and it is used for mt6797 SoCs. To define mt6351_regs for pmic register mapping and pmic_mt6351 for accessing register. Signed-off-by: Argus Lin <argus.lin@mediatek.com> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2018-07-16soc: mediatek: pwrap: add pwrap driver for mt6797 SoCsArgus Lin1-0/+50
mt6797 is a highly integrated SoCs, it uses mt6351 for power management. This patch adds pwrap driver to access mt6351. Pwrap of mt6797 support dynamic priority meichanism, sequence monitor and starvation mechanism to make transaction more reliable. A big change from V4 to V5 is we remove INT1 interrupt declaration since it is only for debug purpose. The PWRAP_RDDMY, RESET and DCM can use legacy setting, it is backwards compatible. The new caps flag declaration is not needed, just remove it. Signed-off-by: Argus Lin <argus.lin@mediatek.com> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2018-07-16soc: mediatek: pwrap: fix cipher init setting errorArgus Lin1-2/+0
PWRAP_DEW_CIPHER_LOAD and PWRAP_DEW_CIPHER_START only exist at PMIC_mt6397 datasheet. We fix it before merge PMIC_mt6351 driver. Fixes: 5ae48040aa47 ("soc: mediatek: PMIC wrap: add mt6323 slave support") Signed-off-by: Argus Lin <argus.lin@mediatek.com> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2018-04-17soc: mediatek: use of_device_get_match_data()Ryder Lee1-10/+3
The usage of of_device_get_match_data() reduce the code size a bit. Also, the only way to call pwrap_probe() is to match an entry in of_pwrap_match_tbl[], so of_id cannot be NULL. Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2017-10-21soc: mediatek: pwrap: fix fatal compiler errorMatthias Brugger1-0/+1
When adding the MT6380 compatible, the sentinel for of_device_id was deleted, which leades to the following compiler error: FATAL: drivers/soc/mediatek/mtk-pmic-wrap: struct of_device_id is not terminated with a NULL entry! Fix this by adding the sentinel again. Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2017-10-21soc: mediatek: pwrap: fix compiler errorsMatthias Brugger1-1/+1
When compiling using sparse, we got the following error: drivers/soc/mediatek/mtk-pmic-wrap.c:686:25: error: dubious one-bit signed bitfield Changing the data type to unsigned fixes this. Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2017-10-20soc: mediatek: pwrap: add support for MT7622 SoCChenglin Xu1-0/+170
Add the registers, callbacks and data structures required to make the PMIC wrapper work on MT7622. Signed-off-by: Chenglin Xu <chenglin.xu@mediatek.com> Signed-off-by: Chen Zhong <chen.zhong@mediatek.com> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2017-10-20soc: mediatek: pwrap: add common way for setup CS timing extenstionSean Wang1-22/+37
Multiple platforms would always use their own way handling CS timing extension on the bus which leads to a little bit code duplication. Therefore, the patch groups the similar logic to handle CS timing extension into the common function which allows the following SoCs have more reusability for configing CS timing. Signed-off-by: Chenglin Xu <chenglin.xu@mediatek.com> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2017-10-20soc: mediatek: pwrap: add MediaTek MT6380 as one slave of pwrapSean Wang1-3/+21
Add MediaTek MT6380 regulator becoming one of PMIC wrapper slave and also add extra new regmap_config of 32-bit mode for MT6380 since old regmap_config of 16-bit mode can't be fit into the need. Signed-off-by: Chenglin Xu <chenglin.xu@mediatek.com> Signed-off-by: Chen Zhong <chen.zhong@mediatek.com> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2017-10-20soc: mediatek: pwrap: refactor pwrap_init for the various PMIC typesSean Wang1-40/+90
pwrap initialization is highly associated with the base SoC and the target PMICs, so slight refactorization is made here for allowing pwrap_init to run on those PMICs with different capability from the previous MediaTek PMICs and the determination for the enablement of the pwrap capability depending on PMIC type. Apart from this, the patch makes the driver more extensible especially when more PMICs join into the pwrap driver. Signed-off-by: Chenglin Xu <chenglin.xu@mediatek.com> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2017-10-20soc: mediatek: pwrap: add pwrap_write32 for writing in 32-bit modeSean Wang1-16/+54
Some regulators such as MediaTek MT6380 also has to be written in 32-bit mode. So the patch adds pwrap_write32, rename old pwrap_write into pwrap_write16 and one additional function pointer is introduced for increasing flexibility allowing the determination which mode is used by the pwrap slave detection through device tree. Signed-off-by: Chenglin Xu <chenglin.xu@mediatek.com> Signed-off-by: Chen Zhong <chen.zhong@mediatek.com> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2017-10-20soc: mediatek: pwrap: add pwrap_read32 for reading in 32-bit modeSean Wang1-1/+54
Some regulators such as MediaTek MT6380 has to be read in 32-bit mode. So the patch adds pwrap_read32, rename old pwrap_read into pwrap_read16 and one function pointer is introduced for increasing flexibility allowing the determination which mode is used by the pwrap slave detection through device tree. Signed-off-by: Chenglin Xu <chenglin.xu@mediatek.com> Signed-off-by: Chen Zhong <chen.zhong@mediatek.com> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2017-10-10soc: mediatek: pwrap: fixup warnings from coding styleSean Wang1-7/+13
fixup those warnings such as lines over 80 words and parenthesis alignment which would be complained by checkpatch.pl. Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2017-08-18Merge tag 'v4.13-next-soc' of https://github.com/mbgg/linux-mediatek into ↵Arnd Bergmann1-3/+3
next/drivers Pull "arm: mediatek: soc updates for v4.14" from Matthias Brugger: - add mt7623a smp support - scpsys: reduce code duplication - scpsys: add mt7622 support - pmic wrapper: make of_device_ids constant * tag 'v4.13-next-soc' of https://github.com/mbgg/linux-mediatek: soc: mediatek: add SCPSYS power domain driver for MediaTek MT7622 SoC soc: mediatek: add header files required for MT7622 SCPSYS dt-binding soc: mediatek: reduce code duplication of scpsys_probe across all SoCs dt-bindings: soc: update the binding document for SCPSYS on MediaTek MT7622 SoC soc: mtk-pmic-wrap: make of_device_ids const. ARM: mediatek: add MT7623a smp bringup code
2017-08-16soc: Convert to using %pOF instead of full_nameRob Herring1-2/+2
Now that we have a custom printf format specifier, convert users of full_name to use %pOF instead. This is preparation to remove storing of the full path string for each node. Signed-off-by: Rob Herring <robh@kernel.org> Acked-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Acked-by: Matthias Brugger <matthias.bgg@gmail.com> Acked-by: Simon Horman <horms+renesas@verge.net.au> Cc: Scott Wood <oss@buserror.net> Cc: Qiang Zhao <qiang.zhao@nxp.com> Cc: Magnus Damm <magnus.damm@gmail.com> Cc: Kukjin Kim <kgene@kernel.org> Cc: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2017-08-02soc: mtk-pmic-wrap: make of_device_ids const.Arvind Yadav1-3/+3
of_device_ids are not supposed to change at runtime. All functions working with of_device_ids provided by <linux/of.h> work with const of_device_ids. So mark the non-const structs as const. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Acked-by: Chen Zhong <chen.zhong@mediatek.com> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2017-05-15soc: mediatek: PMIC wrap: Fix possible NULL derefrence.shailendra.v@samsung.com1-0/+5
of_match_device could return NULL, and so can cause a NULL pointer dereference later. Signed-off-by: Shailendra Verma <shailendra.v@samsung.com> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2017-05-15soc: mediatek: PMIC wrap: Fix error handlingChristophe Jaillet1-3/+6
According to error handling in this function, it is likely that going to 'err_out2' was expected here. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2016-08-22soc: mediatek: PMIC wrap: Extend the waiting time to 10ms.Henry Chen1-1/+1
Read data fails sometimes because of a timeout that PMIC cannot transfer data to PMIC wrap on time, extend the waiting time to 10ms to reduce the failed rate. Signed-off-by: Henry Chen <henryc.chen@mediatek.com> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2016-05-19soc: mtk-pmic-wrap: avoid integer overflow warningArnd Bergmann1-3/+3
On ARM64, the mtk-pmic-wrap driver causes a harmless warning: mtk-pmic-wrap.c:1062:16: warning: large integer implicitly truncated to unsigned type [-Woverflow] mtk-pmic-wrap.c:1074:16: warning: large integer implicitly truncated to unsigned type [-Woverflow] mtk-pmic-wrap.c:1086:16: warning: large integer implicitly truncated to unsigned type [-Woverflow] .int_en_all = ~(BIT(31) | BIT(1)), The problem is that the result of the BIT() macro is an 'unsigned long', so taking the bitwise NOT operation of that results in an integer with the upper 32 bits all set and that cannot be assigned to a 'u32' variable without loss of information. This is harmless because we were never interested in the upper bits here anyway, so we can shut up the warning by adding a simple cast to 'u32'. Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2016-04-20soc: mediatek: PMIC wrap: add MT2701/7623 supportJohn Crispin1-0/+154
Add the registers, callbacks and data structures required to make the wrapper work on MT2701 and MT7623. Signed-off-by: John Crispin <blogic@openwrt.org> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2016-04-20soc: mediatek: PMIC wrap: add mt6323 slave supportJohn Crispin1-0/+43
Add support for MT6323 slaves. This PMIC can be found on MT2701 and MT7623 EVB. The only function that we need to touch is pwrap_init_cipher(). Signed-off-by: John Crispin <blogic@openwrt.org> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2016-04-20soc: mediatek: PMIC wrap: add a slave specific structJohn Crispin1-47/+112
This patch adds a new struct pwrap_slv_type that we use to store the slave specific data. The patch adds 2 new helper functions to access the dew registers. The slave type is looked up via the wrappers child node. Signed-off-by: John Crispin <blogic@openwrt.org> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2016-04-20soc: mediatek: PMIC wrap: remove pwrap_is_mt8135() and pwrap_is_mt8173()John Crispin1-16/+12
With more SoCs being added the list of helper functions like these would grow. To mitigate this problem we remove the existing helpers and change the code to test against the pmic type stored inside the pmic specific datastructure that our context structure points at. There is one usage of pwrap_is_mt8135() that is ambiguous as the test should not be dependent on mt8135, but rather on the existence of a bridge. Add a new element to pmic_wrapper_type to indicate if a bridge is present and use this where appropriate. Signed-off-by: John Crispin <blogic@openwrt.org> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2016-04-20soc: mediatek: PMIC wrap: move wdt_src into the pmic_wrapper_type structJohn Crispin1-4/+5
Different SoCs will use different bitmask for the wdt_src. This patch defines the bitmask in the pmic_wrapper_type struct. This allows us to support new SoCs with a different bitmask to the one currently used. Signed-off-by: John Crispin <blogic@openwrt.org> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2016-04-20soc: mediatek: PMIC wrap: SPI_WRITE needs a different bitmask for MT2701/7623John Crispin1-4/+7
Different SoCs will use different bitmask for the SPI_WRITE command. This patch defines the bitmask in the pmic_wrapper_type struct. This allows us to support new SoCs with a different bitmask to the one currently used. Signed-off-by: John Crispin <blogic@openwrt.org> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
2016-04-20soc: mediatek: PMIC wrap: WRAP_INT_EN needs a different bitmask for MT2701/7623John Crispin1-1/+4
MT2701 and MT7623 use a different bitmask for PWRAP_INT_EN. Signed-off-by: John Crispin <blogic@openwrt.org> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>