#ifndef _PKEYS_HELPER_H #define _PKEYS_HELPER_H #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #define NR_PKEYS 16 #define PKRU_BITS_PER_PKEY 2 #ifndef DEBUG_LEVEL #define DEBUG_LEVEL 0 #endif #define DPRINT_IN_SIGNAL_BUF_SIZE 4096 extern int dprint_in_signal; extern char dprint_in_signal_buffer[DPRINT_IN_SIGNAL_BUF_SIZE]; static inline void sigsafe_printf(const char *format, ...) { va_list ap; va_start(ap, format); if (!dprint_in_signal) { vprintf(format, ap); } else { int len = vsnprintf(dprint_in_signal_buffer, DPRINT_IN_SIGNAL_BUF_SIZE, format, ap); /* * len is amount that would have been printed, * but actual write is truncated at BUF_SIZE. */ if (len > DPRINT_IN_SIGNAL_BUF_SIZE) len = DPRINT_IN_SIGNAL_BUF_SIZE; write(1, dprint_in_signal_buffer, len); } va_end(ap); } #define dprintf_level(level, args...) do { \ if (level <= DEBUG_LEVEL) \ sigsafe_printf(args); \ fflush(NULL); \ } while (0) #define dprintf0(args...) dprintf_level(0, args) #define dprintf1(args...) dprintf_level(1, args) #define dprintf2(args...) dprintf_level(2, args) #define dprintf3(args...) dprintf_level(3, args) #define dprintf4(args...) dprintf_level(4, args) extern unsigned int shadow_pkru; static inline unsigned int __rdpkru(void) { unsigned int eax, edx; unsigned int ecx = 0; unsigned int pkru; asm volatile(".byte 0x0f,0x01,0xee\n\t" : "=a" (eax), "=d" (edx) : "c" (ecx)); pkru = eax; return pkru; } static inline unsigned int _rdpkru(int line) { unsigned int pkru = __rdpkru(); dprintf4("rdpkru(line=%d) pkru: %x shadow: %x\n", line, pkru, shadow_pkru); assert(pkru == shadow_pkru); return pkru; } #define rdpkru() _rdpkru(__LINE__) static inline void __wrpkru(unsigned int pkru) { unsigned int eax = pkru; unsigned int ecx = 0; unsigned int edx = 0; dprintf4("%s() changing %08x to %08x\n", __func__, __rdpkru(), pkru); asm volatile(".byte 0x0f,0x01,0xef\n\t" : : "a" (eax), "c" (ecx), "d" (edx)); assert(pkru == __rdpkru()); } static inline void wrpkru(unsigned int pkru) { dprintf4("%s() changing %08x to %08x\n", __func__, __rdpkru(), pkru); /* will do the shadow check for us: */ rdpkru(); __wrpkru(pkru); shadow_pkru = pkru; dprintf4("%s(%08x) pkru: %08x\n", __func__, pkru, __rdpkru()); } /* * These are technically racy. since something could * change PKRU between the read and the write. */ static inline void __pkey_access_allow(int pkey, int do_allow) { unsigned int pkru = rdpkru(); int bit = pkey * 2; if (do_allow) pkru &= (1<295070e9aa015abb9b92cccfbb1e43954e938133 (patch) treed0a08e7ce280bc877e22424437dbe59fa1857d9a /include/soc/fsl/qe parent1001354ca34179f3db924eb66672442a173147dc (diff)
regulator: stw481x-vmmc: fix ages old enable error
The regulator has never been properly enabled, it has been dormant all the time. It's strange that MMC was working at all, but it likely worked by the signals going through the levelshifter and reaching the card anyways. Fixes: 3615a34ea1a6 ("regulator: add STw481x VMMC driver") Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
Diffstat (limited to 'include/soc/fsl/qe')