1414/* SLIMbus message types. Related to interpretation of message code. */
1515#define SLIM_MSG_MT_CORE 0x0
1616
17+ /* Clock pause Reconfiguration messages */
18+ #define SLIM_MSG_MC_BEGIN_RECONFIGURATION 0x40
19+ #define SLIM_MSG_MC_NEXT_PAUSE_CLOCK 0x4A
20+ #define SLIM_MSG_MC_RECONFIGURE_NOW 0x5F
21+
22+ /* Clock pause values per SLIMbus spec */
23+ #define SLIM_CLK_FAST 0
24+ #define SLIM_CLK_CONST_PHASE 1
25+ #define SLIM_CLK_UNSPECIFIED 2
26+
1727/* Destination type Values */
1828#define SLIM_MSG_DEST_LOGICALADDR 0
1929#define SLIM_MSG_DEST_ENUMADDR 1
@@ -80,6 +90,42 @@ struct slim_msg_txn {
8090#define DEFINE_SLIM_LDEST_TXN (name , mc , rl , la , msg ) \
8191 struct slim_msg_txn name = { rl, 0, mc, SLIM_MSG_DEST_LOGICALADDR, 0,\
8292 0, la, msg, }
93+
94+ #define DEFINE_SLIM_BCAST_TXN (name , mc , rl , la , msg ) \
95+ struct slim_msg_txn name = { rl, 0, mc, SLIM_MSG_DEST_BROADCAST, 0,\
96+ 0, la, msg, }
97+ /**
98+ * enum slim_clk_state: SLIMbus controller's clock state used internally for
99+ * maintaining current clock state.
100+ * @SLIM_CLK_ACTIVE: SLIMbus clock is active
101+ * @SLIM_CLK_ENTERING_PAUSE: SLIMbus clock pause sequence is being sent on the
102+ * bus. If this succeeds, state changes to SLIM_CLK_PAUSED. If the
103+ * transition fails, state changes back to SLIM_CLK_ACTIVE
104+ * @SLIM_CLK_PAUSED: SLIMbus controller clock has paused.
105+ */
106+ enum slim_clk_state {
107+ SLIM_CLK_ACTIVE ,
108+ SLIM_CLK_ENTERING_PAUSE ,
109+ SLIM_CLK_PAUSED ,
110+ };
111+
112+ /**
113+ * struct slim_sched: Framework uses this structure internally for scheduling.
114+ * @clk_state: Controller's clock state from enum slim_clk_state
115+ * @pause_comp: Signals completion of clock pause sequence. This is useful when
116+ * client tries to call SLIMbus transaction when controller is entering
117+ * clock pause.
118+ * @m_reconf: This mutex is held until current reconfiguration (data channel
119+ * scheduling, message bandwidth reservation) is done. Message APIs can
120+ * use the bus concurrently when this mutex is held since elemental access
121+ * messages can be sent on the bus when reconfiguration is in progress.
122+ */
123+ struct slim_sched {
124+ enum slim_clk_state clk_state ;
125+ struct completion pause_comp ;
126+ struct mutex m_reconf ;
127+ };
128+
83129/**
84130 * struct slim_controller - Controls every instance of SLIMbus
85131 * (similar to 'master' on SPI)
@@ -95,6 +141,7 @@ struct slim_msg_txn {
95141 * @devices: Slim device list
96142 * @tid_idr: tid id allocator
97143 * @txn_lock: Lock to protect table of transactions
144+ * @sched: scheduler structure used by the controller
98145 * @xfer_msg: Transfer a message on this controller (this can be a broadcast
99146 * control/status message like data channel setup, or a unicast message
100147 * like value element read/write.
@@ -105,6 +152,9 @@ struct slim_msg_txn {
105152 * address table and get_laddr can be used in that case so that controller
106153 * can do this assignment. Use case is when the master is on the remote
107154 * processor side, who is resposible for allocating laddr.
155+ * @wakeup: This function pointer implements controller-specific procedure
156+ * to wake it up from clock-pause. Framework will call this to bring
157+ * the controller out of clock pause.
108158 *
109159 * 'Manager device' is responsible for device management, bandwidth
110160 * allocation, channel setup, and port associations per channel.
@@ -139,12 +189,14 @@ struct slim_controller {
139189 struct list_head devices ;
140190 struct idr tid_idr ;
141191 spinlock_t txn_lock ;
192+ struct slim_sched sched ;
142193 int (* xfer_msg )(struct slim_controller * ctrl ,
143194 struct slim_msg_txn * tx );
144195 int (* set_laddr )(struct slim_controller * ctrl ,
145196 struct slim_eaddr * ea , u8 laddr );
146197 int (* get_laddr )(struct slim_controller * ctrl ,
147198 struct slim_eaddr * ea , u8 * laddr );
199+ int (* wakeup )(struct slim_controller * ctrl );
148200};
149201
150202int slim_device_report_present (struct slim_controller * ctrl ,
@@ -154,6 +206,7 @@ int slim_register_controller(struct slim_controller *ctrl);
154206int slim_unregister_controller (struct slim_controller * ctrl );
155207void slim_msg_response (struct slim_controller * ctrl , u8 * reply , u8 tid , u8 l );
156208int slim_do_transfer (struct slim_controller * ctrl , struct slim_msg_txn * txn );
209+ int slim_ctrl_clk_pause (struct slim_controller * ctrl , bool wakeup , u8 restart );
157210
158211static inline bool slim_tid_txn (u8 mt , u8 mc )
159212{
0 commit comments