13 #define DUMMY_DATA_VAL 0
14 #define TIMEOUT_CNT 100
18 #define NUM_GSBI_PINS 3
21 #define GSBI_PIN_IDX 0
22 #define FUNC_SEL_IDX 1
23 #define GPIO_DIR_IDX 2
24 #define PULL_CONF_IDX 3
33 #define GSBI_IDX_TO_GSBI(idx) (idx + 5)
37 #define MAX_PACKET_COUNT ((64 * KiB) - 1)
146 unsigned int bit_val = ((
readl_i(reg_addr) >> bit_num) & 0x01);
148 while (bit_val !=
val) {
153 bit_val = ((
readl_i(reg_addr) >> bit_num) & 0x01);
198 "err: unsupported GSBI SPI state : %d\n",
state);
214 unsigned int clk_idle_state;
215 unsigned int input_first_mode;
225 input_first_mode = 0;
233 input_first_mode = 0;
237 "err : unsupported spi mode : %d\n", mode);
242 val |= input_first_mode;
275 static void CS_change(
int port_num,
int cs_num,
int enable)
302 unsigned int func_sel;
303 unsigned int io_config;
304 unsigned int pull_config;
305 unsigned int drv_strength;
306 unsigned int gpio_en;
318 pull_config, drv_strength, gpio_en);
346 "QUP Clock Halt For GSBI%d failed!\n", ds->
slave.
bus);
391 "QUP Clock Enable For GSBI%d"
403 "HCLK Enable For GSBI%d failed!\n", ds->
slave.
bus);
620 const uint8_t *dout,
unsigned int out_bytes)
648 uint8_t *din,
unsigned int in_bytes)
676 size_t out_bytes,
void *din,
size_t in_bytes)
761 "(Supported buses 0,1 and 2) or chipselect\n",
bus);
static void write32(void *addr, uint32_t val)
#define printk(level,...)
#define BIOS_ERR
BIOS_ERR - System in incomplete state.
#define GPIO_IN_OUT_ADDR(x)
#define clrsetbits32_i(addr, clear, set)
const struct spi_ctrlr_buses spi_ctrlr_bus_map[]
const size_t spi_ctrlr_bus_map_count
#define GSBIn_HCLK_CTL_REG(n)
#define MNCNTR_MODE_DUAL_EDGE
#define GPIO_DRV_STR_10MA
#define GPIO_DRV_STR_11MA
static void gpio_tlmm_config(unsigned int gpio, unsigned int func, unsigned int dir, unsigned int pull, unsigned int drvstr, unsigned int enable)
#define GPIO_FUNC_DISABLE
#define QUP_CONFIG_MINI_CORE_MSK
#define QUP_CONFIG_MINI_CORE_SPI
#define PROTOCOL_CODE_MSK
#define QUP_CLK_BRANCH_DIS
#define GSBI5_QUP_SW_RESET_REG
#define QUP_STATE_PAUSE_STATE
#define GSBI6_QUP_OPERATIONAL_REG
#define GSBI_PRE_DIV_SEL_SHFT
#define GSBI5_SPI_ERROR_FLAGS_EN_REG
#define GSBI7_QUP_MX_OUTPUT_COUNT_REG
#define GSBI7_SPI_ERROR_FLAGS_REG
#define GSBI6_SPI_CONFIG_REG
#define GSBI6_GSBI_CTRL_REG_REG
#define GSBI5_SPI_CONFIG_REG
#define GSBI5_QUP_MX_OUTPUT_COUNT_REG
#define GSBI7_QUP_STATE_REG
#define GSBI5_QUP_OUTPUT_FIFOc_REG(c)
#define QUP_STATE_RUN_STATE
#define OUTPUT_BIT_SHIFT_MSK
#define GSBI7_QUP_ERROR_FLAGS_REG
#define GSBI5_QUP_ERROR_FLAGS_EN_REG
#define SPI_INPUT_FIRST_MODE
#define GSBI_CLK_BRANCH_ENA_MSK
#define GSBI5_GSBI_CTRL_REG_REG
#define GSBIn_RESET_REG(n)
#define GSBI6_QUP_ERROR_FLAGS_EN_REG
#define SPI_QUP_CONF_NO_INPUT
#define GSBIn_QUP_APPS_MD_REG(n)
#define GSBI7_QUP_OPERATIONAL_REG
#define GSBI6_QUP_APPS_CLK
#define GSBI6_QUP_ERROR_FLAGS_REG
#define GSBI6_QUP_SW_RESET_REG
#define GSBI5_QUP_ERROR_FLAGS_REG
#define GSBI5_QUP_MX_INPUT_COUNT_REG
#define GSBI6_QUP_MX_INPUT_COUNT_REG
#define GSBI7_QUP_ERROR_FLAGS_EN_REG
#define QUP_INPUT_FIFO_NOT_EMPTY
#define CLK_HALT_CFPB_STATEB_REG
#define GSBI5_QUP_APPS_CLK
#define SPI_QUP_CONF_OUTPUT_MSK
#define SPI_QUP_CONF_NO_OUTPUT
#define QUP_OUTPUT_FIFO_NOT_EMPTY
#define PROTOCOL_CODE_SPI
#define GSBI6_QUP_OUTPUT_FIFOc_REG(c)
#define QUP_CLK_BRANCH_ENA_MSK
#define OUTPUT_BLOCK_MODE
#define GSBIn_PLL_SRC_MSK
#define QUP_OUTPUT_FIFO_FULL
#define GSBI6_SPI_ERROR_FLAGS_EN_REG
#define GSBI6_QUP_CONFIG_REG
#define OUTPUT_BIT_SHIFT_EN
#define GSBI7_SPI_IO_CONTROL_REG
#define GSBI7_QUP_MX_INPUT_COUNT_REG
#define GSBI5_SPI_IO_CONTROL_REG
#define GSBI7_SPI_CONFIG_REG
#define GSBI7_GSBI_CTRL_REG_REG
#define GSBI5_QUP_STATE_REG
#define GSBI7_QUP_OUTPUT_FIFOc_REG(c)
#define GSBI7_QUP_CONFIG_REG
#define QUP_CLK_BRANCH_ENA
#define QUP_STATE_VALID_BIT
#define GSBIn_PLL_SRC_PLL8
#define QUP_STATE_RESET_STATE
#define SLAVE_OPERATION_MSK
#define GSBI6_SPI_IO_CONTROL_REG
#define GSBI7_QUP_APPS_CLK
#define GSBI6_QUP_INPUT_FIFOc_REG(c)
#define SPI_QUP_CONF_INPUT_ENA
#define SPI_IO_CONTROL_CLOCK_IDLE_HIGH
#define SPI_QUP_CONF_OUTPUT_ENA
#define GSBI7_SPI_ERROR_FLAGS_EN_REG
#define GSBI5_QUP_IO_MODES_REG
#define INPUT_BLOCK_MODE_MSK
#define GSBI_CLK_BRANCH_ENA
#define GSBIn_QUP_APPS_NS_REG(n)
#define GSBI5_QUP_CONFIG_REG
#define GSBIn_PRE_DIV_SEL_MSK
#define GSBI7_QUP_IO_MODES_REG
#define SPI_QUP_CONF_INPUT_MSK
#define GSBI5_SPI_ERROR_FLAGS_REG
#define GSBI6_QUP_MX_OUTPUT_COUNT_REG
#define GSBI6_QUP_STATE_REG
#define GSBI7_QUP_INPUT_FIFOc_REG(c)
#define GSBI6_QUP_IO_MODES_REG
#define GSBI5_QUP_OPERATIONAL_REG
#define GSBI7_QUP_SW_RESET_REG
#define OUTPUT_BLOCK_MODE_MSK
#define GSBI5_QUP_INPUT_FIFOc_REG(c)
#define GSBI6_SPI_ERROR_FLAGS_REG
static int check_bit_state(uint32_t reg_addr, int bit_num, int val, int us_delay)
static void spi_ctrlr_release_bus(const struct spi_slave *slave)
static int check_qup_clk_state(unsigned int core_num, int enable)
static int check_qup_state_valid(struct ipq_spi_slave *ds)
static unsigned int hclk_state[NUM_PORTS]
static void spi_set_mode(struct ipq_spi_slave *ds, unsigned int mode)
static unsigned int qup_apps_clk_state[NUM_PORTS]
static void spi_reset(struct ipq_spi_slave *ds)
static int gsbi_clock_init(struct ipq_spi_slave *ds)
static const struct gsbi_spi spi_reg[]
static int config_spi_state(struct ipq_spi_slave *ds, unsigned int state)
static struct ipq_spi_slave spi_slave_pool[2]
static void CS_change(int port_num, int cs_num, int enable)
static int spi_hw_init(struct ipq_spi_slave *ds)
static int spi_ctrlr_claim_bus(const struct spi_slave *slave)
static int spi_ctrlr_xfer(const struct spi_slave *slave, const void *dout, size_t out_bytes, void *din, size_t in_bytes)
static unsigned int cs_gpio_array[NUM_PORTS][NUM_CS]
static void gsbi_pin_config(unsigned int port_num, int cs_num)
static unsigned int gsbi_pin_conf[NUM_PORTS][NUM_GSBI_PINS][TLMM_ARGS]
static int spi_xfer_tx_packet(struct ipq_spi_slave *ds, const uint8_t *dout, unsigned int out_bytes)
static int spi_ctrlr_setup(const struct spi_slave *slave)
static int check_hclk_state(unsigned int core_num, int enable)
#define GSBI_IDX_TO_GSBI(idx)
static struct ipq_spi_slave * to_ipq_spi(const struct spi_slave *slave)
static int spi_xfer_rx_packet(struct ipq_spi_slave *ds, uint8_t *din, unsigned int in_bytes)
static struct spi_slave slave
void * qup_mx_output_count
void * qup_error_flags_en
void * qup_mx_input_count
const struct blsp_spi * regs
const struct spi_ctrlr * ctrlr
int(* setup)(const struct spi_slave *slave)
typedef void(X86APIP X86EMU_intrFuncs)(int num)