linux/include/linux/mfd/abx500/ab8500-sysctrl.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (C) ST-Ericsson SA 2010
 * Author: Mattias Nilsson <[email protected]> for ST Ericsson.
 */
#ifndef __AB8500_SYSCTRL_H
#define __AB8500_SYSCTRL_H

#include <linux/bitops.h>

#ifdef CONFIG_AB8500_CORE

int ab8500_sysctrl_read(u16 reg, u8 *value);
int ab8500_sysctrl_write(u16 reg, u8 mask, u8 value);

#else

static inline int ab8500_sysctrl_read(u16 reg, u8 *value)
{}

static inline int ab8500_sysctrl_write(u16 reg, u8 mask, u8 value)
{}

#endif /* CONFIG_AB8500_CORE */

static inline int ab8500_sysctrl_set(u16 reg, u8 bits)
{}

static inline int ab8500_sysctrl_clear(u16 reg, u8 bits)
{}

/* Registers */
#define AB8500_TURNONSTATUS
#define AB8500_RESETSTATUS
#define AB8500_PONKEY1PRESSSTATUS
#define AB8500_SYSCLKREQSTATUS
#define AB8500_STW4500CTRL1
#define AB8500_STW4500CTRL2
#define AB8500_STW4500CTRL3
#define AB8500_MAINWDOGCTRL
#define AB8500_MAINWDOGTIMER
#define AB8500_LOWBAT
#define AB8500_BATTOK
#define AB8500_SYSCLKTIMER
#define AB8500_SMPSCLKCTRL
#define AB8500_SMPSCLKSEL1
#define AB8500_SMPSCLKSEL2
#define AB8500_SMPSCLKSEL3
#define AB8500_SYSULPCLKCONF
#define AB8500_SYSULPCLKCTRL1
#define AB8500_SYSCLKCTRL
#define AB8500_SYSCLKREQ1VALID
#define AB8500_SYSTEMCTRLSUP
#define AB8500_SYSCLKREQ1RFCLKBUF
#define AB8500_SYSCLKREQ2RFCLKBUF
#define AB8500_SYSCLKREQ3RFCLKBUF
#define AB8500_SYSCLKREQ4RFCLKBUF
#define AB8500_SYSCLKREQ5RFCLKBUF
#define AB8500_SYSCLKREQ6RFCLKBUF
#define AB8500_SYSCLKREQ7RFCLKBUF
#define AB8500_SYSCLKREQ8RFCLKBUF
#define AB8500_DITHERCLKCTRL
#define AB8500_SWATCTRL
#define AB8500_HIQCLKCTRL
#define AB8500_VSIMSYSCLKCTRL
#define AB9540_SYSCLK12BUFCTRL
#define AB9540_SYSCLK12CONFCTRL
#define AB9540_SYSCLK12BUFCTRL2
#define AB9540_SYSCLK12BUF1VALID
#define AB9540_SYSCLK12BUF2VALID
#define AB9540_SYSCLK12BUF3VALID
#define AB9540_SYSCLK12BUF4VALID

/* Bits */
#define AB8500_TURNONSTATUS_PORNVBAT
#define AB8500_TURNONSTATUS_PONKEY1DBF
#define AB8500_TURNONSTATUS_PONKEY2DBF
#define AB8500_TURNONSTATUS_RTCALARM
#define AB8500_TURNONSTATUS_MAINCHDET
#define AB8500_TURNONSTATUS_VBUSDET
#define AB8500_TURNONSTATUS_USBIDDETECT

#define AB8500_RESETSTATUS_RESETN4500NSTATUS
#define AB8500_RESETSTATUS_SWRESETN4500NSTATUS

#define AB8500_PONKEY1PRESSSTATUS_PONKEY1PRESSTIME_MASK
#define AB8500_PONKEY1PRESSSTATUS_PONKEY1PRESSTIME_SHIFT

#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ1STATUS
#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ2STATUS
#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ3STATUS
#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ4STATUS
#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ5STATUS
#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ6STATUS
#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ7STATUS
#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ8STATUS

#define AB8500_STW4500CTRL1_SWOFF
#define AB8500_STW4500CTRL1_SWRESET4500N
#define AB8500_STW4500CTRL1_THDB8500SWOFF

#define AB8500_STW4500CTRL2_RESETNVAUX1VALID
#define AB8500_STW4500CTRL2_RESETNVAUX2VALID
#define AB8500_STW4500CTRL2_RESETNVAUX3VALID
#define AB8500_STW4500CTRL2_RESETNVMODVALID
#define AB8500_STW4500CTRL2_RESETNVEXTSUPPLY1VALID
#define AB8500_STW4500CTRL2_RESETNVEXTSUPPLY2VALID
#define AB8500_STW4500CTRL2_RESETNVEXTSUPPLY3VALID
#define AB8500_STW4500CTRL2_RESETNVSMPS1VALID

#define AB8500_STW4500CTRL3_CLK32KOUT2DIS
#define AB8500_STW4500CTRL3_RESETAUDN
#define AB8500_STW4500CTRL3_RESETDENCN
#define AB8500_STW4500CTRL3_THSDENA

#define AB8500_MAINWDOGCTRL_MAINWDOGENA
#define AB8500_MAINWDOGCTRL_MAINWDOGKICK
#define AB8500_MAINWDOGCTRL_WDEXPTURNONVALID

#define AB8500_MAINWDOGTIMER_MAINWDOGTIMER_MASK
#define AB8500_MAINWDOGTIMER_MAINWDOGTIMER_SHIFT

#define AB8500_LOWBAT_LOWBATENA
#define AB8500_LOWBAT_LOWBAT_MASK
#define AB8500_LOWBAT_LOWBAT_SHIFT

#define AB8500_BATTOK_BATTOKSEL0THF_MASK
#define AB8500_BATTOK_BATTOKSEL0THF_SHIFT
#define AB8500_BATTOK_BATTOKSEL1THF_MASK
#define AB8500_BATTOK_BATTOKSEL1THF_SHIFT

#define AB8500_SYSCLKTIMER_SYSCLKTIMER_MASK
#define AB8500_SYSCLKTIMER_SYSCLKTIMER_SHIFT
#define AB8500_SYSCLKTIMER_SYSCLKTIMERADJ_MASK
#define AB8500_SYSCLKTIMER_SYSCLKTIMERADJ_SHIFT

#define AB8500_SMPSCLKCTRL_SMPSCLKINTSEL_MASK
#define AB8500_SMPSCLKCTRL_SMPSCLKINTSEL_SHIFT
#define AB8500_SMPSCLKCTRL_3M2CLKINTENA

#define AB8500_SMPSCLKSEL1_VARMCLKSEL_MASK
#define AB8500_SMPSCLKSEL1_VARMCLKSEL_SHIFT
#define AB8500_SMPSCLKSEL1_VAPECLKSEL_MASK
#define AB8500_SMPSCLKSEL1_VAPECLKSEL_SHIFT

#define AB8500_SMPSCLKSEL2_VMODCLKSEL_MASK
#define AB8500_SMPSCLKSEL2_VMODCLKSEL_SHIFT
#define AB8500_SMPSCLKSEL2_VSMPS1CLKSEL_MASK
#define AB8500_SMPSCLKSEL2_VSMPS1CLKSEL_SHIFT

#define AB8500_SMPSCLKSEL3_VSMPS2CLKSEL_MASK
#define AB8500_SMPSCLKSEL3_VSMPS2CLKSEL_SHIFT
#define AB8500_SMPSCLKSEL3_VSMPS3CLKSEL_MASK
#define AB8500_SMPSCLKSEL3_VSMPS3CLKSEL_SHIFT

#define AB8500_SYSULPCLKCONF_ULPCLKCONF_MASK
#define AB8500_SYSULPCLKCONF_ULPCLKCONF_SHIFT
#define AB8500_SYSULPCLKCONF_CLK27MHZSTRE
#define AB8500_SYSULPCLKCONF_TVOUTCLKDELN
#define AB8500_SYSULPCLKCONF_TVOUTCLKINV
#define AB8500_SYSULPCLKCONF_ULPCLKSTRE
#define AB8500_SYSULPCLKCONF_CLK27MHZBUFENA
#define AB8500_SYSULPCLKCONF_CLK27MHZPDENA

#define AB8500_SYSULPCLKCTRL1_SYSULPCLKINTSEL_MASK
#define AB8500_SYSULPCLKCTRL1_SYSULPCLKINTSEL_SHIFT
#define AB8500_SYSULPCLKCTRL1_ULPCLKREQ
#define AB8500_SYSULPCLKCTRL1_4500SYSCLKREQ
#define AB8500_SYSULPCLKCTRL1_AUDIOCLKENA
#define AB8500_SYSULPCLKCTRL1_SYSCLKBUF2REQ
#define AB8500_SYSULPCLKCTRL1_SYSCLKBUF3REQ
#define AB8500_SYSULPCLKCTRL1_SYSCLKBUF4REQ

#define AB8500_SYSCLKCTRL_TVOUTPLLENA
#define AB8500_SYSCLKCTRL_TVOUTCLKENA
#define AB8500_SYSCLKCTRL_USBCLKENA

#define AB8500_SYSCLKREQ1VALID_SYSCLKREQ1VALID
#define AB8500_SYSCLKREQ1VALID_ULPCLKREQ1VALID
#define AB8500_SYSCLKREQ1VALID_USBSYSCLKREQ1VALID

#define AB8500_SYSTEMCTRLSUP_EXTSUP12LPNCLKSEL_MASK
#define AB8500_SYSTEMCTRLSUP_EXTSUP12LPNCLKSEL_SHIFT
#define AB8500_SYSTEMCTRLSUP_EXTSUP3LPNCLKSEL_MASK
#define AB8500_SYSTEMCTRLSUP_EXTSUP3LPNCLKSEL_SHIFT
#define AB8500_SYSTEMCTRLSUP_INTDB8500NOD

#define AB8500_SYSCLKREQ1RFCLKBUF_SYSCLKREQ1RFCLKBUF2
#define AB8500_SYSCLKREQ1RFCLKBUF_SYSCLKREQ1RFCLKBUF3
#define AB8500_SYSCLKREQ1RFCLKBUF_SYSCLKREQ1RFCLKBUF4

#define AB8500_SYSCLKREQ2RFCLKBUF_SYSCLKREQ2RFCLKBUF2
#define AB8500_SYSCLKREQ2RFCLKBUF_SYSCLKREQ2RFCLKBUF3
#define AB8500_SYSCLKREQ2RFCLKBUF_SYSCLKREQ2RFCLKBUF4

#define AB8500_SYSCLKREQ3RFCLKBUF_SYSCLKREQ3RFCLKBUF2
#define AB8500_SYSCLKREQ3RFCLKBUF_SYSCLKREQ3RFCLKBUF3
#define AB8500_SYSCLKREQ3RFCLKBUF_SYSCLKREQ3RFCLKBUF4

#define AB8500_SYSCLKREQ4RFCLKBUF_SYSCLKREQ4RFCLKBUF2
#define AB8500_SYSCLKREQ4RFCLKBUF_SYSCLKREQ4RFCLKBUF3
#define AB8500_SYSCLKREQ4RFCLKBUF_SYSCLKREQ4RFCLKBUF4

#define AB8500_SYSCLKREQ5RFCLKBUF_SYSCLKREQ5RFCLKBUF2
#define AB8500_SYSCLKREQ5RFCLKBUF_SYSCLKREQ5RFCLKBUF3
#define AB8500_SYSCLKREQ5RFCLKBUF_SYSCLKREQ5RFCLKBUF4

#define AB8500_SYSCLKREQ6RFCLKBUF_SYSCLKREQ6RFCLKBUF2
#define AB8500_SYSCLKREQ6RFCLKBUF_SYSCLKREQ6RFCLKBUF3
#define AB8500_SYSCLKREQ6RFCLKBUF_SYSCLKREQ6RFCLKBUF4

#define AB8500_SYSCLKREQ7RFCLKBUF_SYSCLKREQ7RFCLKBUF2
#define AB8500_SYSCLKREQ7RFCLKBUF_SYSCLKREQ7RFCLKBUF3
#define AB8500_SYSCLKREQ7RFCLKBUF_SYSCLKREQ7RFCLKBUF4

#define AB8500_SYSCLKREQ8RFCLKBUF_SYSCLKREQ8RFCLKBUF2
#define AB8500_SYSCLKREQ8RFCLKBUF_SYSCLKREQ8RFCLKBUF3
#define AB8500_SYSCLKREQ8RFCLKBUF_SYSCLKREQ8RFCLKBUF4

#define AB8500_DITHERCLKCTRL_VARMDITHERENA
#define AB8500_DITHERCLKCTRL_VSMPS3DITHERENA
#define AB8500_DITHERCLKCTRL_VSMPS1DITHERENA
#define AB8500_DITHERCLKCTRL_VSMPS2DITHERENA
#define AB8500_DITHERCLKCTRL_VMODDITHERENA
#define AB8500_DITHERCLKCTRL_VAPEDITHERENA
#define AB8500_DITHERCLKCTRL_DITHERDEL_MASK
#define AB8500_DITHERCLKCTRL_DITHERDEL_SHIFT

#define AB8500_SWATCTRL_UPDATERF
#define AB8500_SWATCTRL_SWATENABLE
#define AB8500_SWATCTRL_RFOFFTIMER_MASK
#define AB8500_SWATCTRL_RFOFFTIMER_SHIFT
#define AB8500_SWATCTRL_SWATBIT5

#define AB8500_HIQCLKCTRL_SYSCLKREQ1HIQENAVALID
#define AB8500_HIQCLKCTRL_SYSCLKREQ2HIQENAVALID
#define AB8500_HIQCLKCTRL_SYSCLKREQ3HIQENAVALID
#define AB8500_HIQCLKCTRL_SYSCLKREQ4HIQENAVALID
#define AB8500_HIQCLKCTRL_SYSCLKREQ5HIQENAVALID
#define AB8500_HIQCLKCTRL_SYSCLKREQ6HIQENAVALID
#define AB8500_HIQCLKCTRL_SYSCLKREQ7HIQENAVALID
#define AB8500_HIQCLKCTRL_SYSCLKREQ8HIQENAVALID

#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ1VALID
#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ2VALID
#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ3VALID
#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ4VALID
#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ5VALID
#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ6VALID
#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ7VALID
#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ8VALID

#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF1ENA
#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF2ENA
#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF3ENA
#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF4ENA
#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUFENA_MASK
#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF1STRE
#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF2STRE
#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF3STRE
#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUF4STRE
#define AB9540_SYSCLK12BUFCTRL_SYSCLK12BUFSTRE_MASK

#define AB9540_SYSCLK12CONFCTRL_PLL26TO38ENA
#define AB9540_SYSCLK12CONFCTRL_SYSCLK12USBMUXSEL
#define AB9540_SYSCLK12CONFCTRL_INT384MHZMUXSEL0
#define AB9540_SYSCLK12CONFCTRL_INT384MHZMUXSEL1
#define AB9540_SYSCLK12CONFCTRL_SYSCLK12BUFMUX
#define AB9540_SYSCLK12CONFCTRL_SYSCLK12PLLMUX
#define AB9540_SYSCLK12CONFCTRL_SYSCLK2MUXVALID

#define AB9540_SYSCLK12BUFCTRL2_SYSCLK12BUF1PDENA
#define AB9540_SYSCLK12BUFCTRL2_SYSCLK12BUF2PDENA
#define AB9540_SYSCLK12BUFCTRL2_SYSCLK12BUF3PDENA
#define AB9540_SYSCLK12BUFCTRL2_SYSCLK12BUF4PDENA

#define AB9540_SYSCLK12BUF1VALID_SYSCLK12BUF1VALID_MASK
#define AB9540_SYSCLK12BUF1VALID_SYSCLK12BUF1VALID_SHIFT

#define AB9540_SYSCLK12BUF2VALID_SYSCLK12BUF2VALID_MASK
#define AB9540_SYSCLK12BUF2VALID_SYSCLK12BUF2VALID_SHIFT

#define AB9540_SYSCLK12BUF3VALID_SYSCLK12BUF3VALID_MASK
#define AB9540_SYSCLK12BUF3VALID_SYSCLK12BUF3VALID_SHIFT

#define AB9540_SYSCLK12BUF4VALID_SYSCLK12BUF4VALID_MASK
#define AB9540_SYSCLK12BUF4VALID_SYSCLK12BUF4VALID_SHIFT

#define AB8500_ENABLE_WD
#define AB8500_KICK_WD
#define AB8500_WD_RESTART_ON_EXPIRE

#endif /* __AB8500_SYSCTRL_H */