Esempio n. 1
0
gsbi_return_t gsbi_init(gsbi_id_t gsbi_id, gsbi_protocol_t protocol)
{
	unsigned i = 0;
	unsigned qup_apps_ini[] = {
		GSBI_APPS_NS_OFFSET,            0xf80b43,
		GSBI_APPS_NS_OFFSET,            0xfc095b,
		GSBI_APPS_NS_OFFSET,            0xfc015b,
		GSBI_APPS_NS_OFFSET,            0xfc005b,
		GSBI_APPS_NS_OFFSET,            0xA05,
		GSBI_APPS_NS_OFFSET,            0x185,
		GSBI_APPS_MD_OFFSET,            0x100fb,
		GSBI_APPS_NS_OFFSET,            0xA05,
		GSBI_APPS_NS_OFFSET,            0xfc015b,
		GSBI_APPS_NS_OFFSET,            0xfc015b,
		GSBI_APPS_NS_OFFSET,            0xfc095b,
		GSBI_APPS_NS_OFFSET,            0xfc0b5b,
		GSBI_APPS_MAX_OFFSET,           0x0
	};

	gsbi_return_t ret = GSBI_SUCCESS;

	writel(0, GSBI_RESET(gsbi_id));

	switch (gsbi_id) {
	case GSBI_ID_4: {
			/* Configure GPIOs 13 - SCL, 12 - SDA, 2mA gpio_en */
			gpio_tlmm_config_set(12, GPIO_FUNC_I2C,
					     GPIO_NO_PULL, GPIO_2MA, 1);
			gpio_tlmm_config_set(13, GPIO_FUNC_I2C,
					     GPIO_NO_PULL, GPIO_2MA, 1);
		}
		break;
	case GSBI_ID_1: {
			/* Configure GPIOs 54 - SCL, 53 - SDA, 2mA gpio_en */
			gpio_tlmm_config_set(54, GPIO_FUNC_I2C,
					     GPIO_NO_PULL, GPIO_2MA, 1);
			gpio_tlmm_config_set(53, GPIO_FUNC_I2C,
					     GPIO_NO_PULL, GPIO_2MA, 1);
		}
		break;
	default: {
		ret = GSBI_UNSUPPORTED;
		goto bail_out;
		}
	}

	/*Select i2c protocol*/
	writel((2 << 4), GSBI_CTL(gsbi_id));

	//TODO: Make use of clock API when available instead of the hardcoding.
	/* Clock set to 24Mhz */
	for (i = 0; GSBI_APPS_MAX_OFFSET != qup_apps_ini[i]; i += 2)
		writel(qup_apps_ini[i+1],
		       QUP_APPS_ADDR(gsbi_id, qup_apps_ini[i]));

	writel(((1 << 6)|(1 << 4)), GSBI_HCLK_CTL(gsbi_id));

bail_out:
	return ret;
}
Esempio n. 2
0
int blsp_i2c_init_board(blsp_qup_id_t id)
{
	switch (id) {
	case BLSP_QUP_ID_0:
	case BLSP_QUP_ID_1:
	case BLSP_QUP_ID_2:
	case BLSP_QUP_ID_3:
#if defined(IPQ40XX_I2C0_PINGROUP_1) || defined(IPQ40XX_I2C0_PINGROUP_2)
		gpio_tlmm_config_set(SDA_GPIO, GPIO_FUNC_SDA,
				     GPIO_NO_PULL, GPIO_2MA, 1);
		gpio_tlmm_config_set(SCL_GPIO, GPIO_FUNC_SCL,
				     GPIO_NO_PULL, GPIO_2MA, 1);
#endif /* Pin Group 1 or 2 */

#if defined(IPQ40XX_I2C1_PINGROUP_1)
		gpio_tlmm_config_set(SDA_GPIO_I2C1, GPIO_I2C1_FUNC_SDA,
				     GPIO_NO_PULL, GPIO_2MA, 1);
		gpio_tlmm_config_set(SCL_GPIO_I2C1, GPIO_I2C1_FUNC_SCL,
				     GPIO_NO_PULL, GPIO_2MA, 1);
#endif
		break;
	default:
		return 1;
	}

	return 0;
}
Esempio n. 3
0
static int read_gpio(gpio_t gpio_num)
{
	gpio_tlmm_config_set(gpio_num, GPIO_FUNC_DISABLE,
			     GPIO_NO_PULL, GPIO_2MA, GPIO_DISABLE);
	udelay(10); /* Should be enough to settle. */
	return gpio_get(gpio_num);
}
Esempio n. 4
0
void board_i2s_gpio_config(void)
{
	unsigned i;
	unsigned char gpio_config_arr[] = {I2S_SYNC, I2S_CLK, I2S_DOUT};

	for (i = 0; i < ARRAY_SIZE(gpio_config_arr); i++) {
		gpio_tlmm_config_set(gpio_config_arr[i], GPIO_I2S_FUNC_VAL,
				GPIO_NO_PULL, GPIO_16MA, 1);
	}
}
Esempio n. 5
0
void board_dac_gpio_config(void)
{
	gpio_tlmm_config_set(DAC_SDMODE, FUNC_SEL_GPIO, GPIO_NO_PULL,
			GPIO_16MA, 1);
}