// for TSP i2c operation (switch gpio or hw i2c func)
void i2c1_pin_changed(int gpio)
{
    unsigned long i2c1_g_mfps[] = {
        GPIO087_GPIO_87 | MFP_PULL_FLOAT,		/* SCL */
        GPIO088_GPIO_88 | MFP_PULL_FLOAT,		/* SDA */
    };

    unsigned long i2c1_hw_mfps[] = {
        GPIO087_CI2C_SCL_2,		/* SCL */
        GPIO088_CI2C_SDA_2,		/* SDA */
    };

    usleep_range(5000, 8000);

    if(gpio)
    {
        mfp_config(ARRAY_AND_SIZE(i2c1_g_mfps));
        gpio_direction_input(MFP_PIN_GPIO87);
        gpio_direction_input(MFP_PIN_GPIO88);
    }
    else
        mfp_config(ARRAY_AND_SIZE(i2c1_hw_mfps));

    usleep_range(5000, 8000);

    return;
}
static int  switch_mclk_gpio_mfp(int pinid) {

	unsigned int val;

	unsigned long mclk_mfps[] = {
		GPIO077_CAM_MCLK | MFP_LPM_DRIVE_LOW,
	};

	unsigned long gpio_mfps[] = {
		GPIO077_GPIO_77
	};

	switch_mclk_gpio = mfp_to_gpio(GPIO077_GPIO_77);

	if (pinid == MCLK_PIN) {
		mfp_config(ARRAY_AND_SIZE(mclk_mfps));
		val = mfp_read(switch_mclk_gpio);
		printk("--------MCLK pin Switchs TO mclk,  MFP Setting is :0x%x---------", val);
	} if (pinid == GPIO_PIN) {
		mfp_config(ARRAY_AND_SIZE(gpio_mfps));
		val = mfp_read(switch_mclk_gpio);
		printk("--------MCLK pin Switchs TO gpio,  MFP Setting is :0x%x---------", val);

		if (switch_mclk_gpio && gpio_request(switch_mclk_gpio, "switch_mclk_gpio77")) {
			printk(KERN_ERR "------switch_mclk_gpio_mfp-------Request GPIO failed,"
					"gpio: %d\n", switch_mclk_gpio);
			switch_mclk_gpio = 0;
			return -1;
		}
		gpio_direction_output(switch_mclk_gpio, 0);
		gpio_free(switch_mclk_gpio);
	}
	return 0;
}
static void mmp3_8787_set_power(unsigned int on)
{
	static struct regulator *vbat_fem;
	static int f_enabled = 0;
	/* VBAT_FEM 3.3v */
	if (on && (!f_enabled)) {
		vbat_fem = regulator_get(NULL, "VBAT_FEM");
		if (IS_ERR(vbat_fem)) {
			vbat_fem = NULL;
			pr_err("get VBAT_FEM failed %s.\n", __func__);
		} else {
			regulator_set_voltage(vbat_fem, 3300000, 3300000);
			regulator_enable(vbat_fem);
			f_enabled = 1;
			mfp_config(ARRAY_AND_SIZE(wifi_pin_config_on));
		}
	}

	if (f_enabled && (!on)) {
		if (vbat_fem) {
			mfp_config(ARRAY_AND_SIZE(wifi_pin_config_off));
			regulator_disable(vbat_fem);
			regulator_put(vbat_fem);
			vbat_fem = NULL;
		}
		f_enabled = 0;
	}
}
void mmp_pins_init(void)
{
	if (system_rev <= LT02_R0_0)
		mfp_config(ARRAY_AND_SIZE(lt02_r0_0_pins));
	else if (system_rev <= LT02_R0_2)
		mfp_config(ARRAY_AND_SIZE(lt02_r0_1_pins));
	else
		mfp_config(ARRAY_AND_SIZE(lt02_r0_3_pins));
}
static int  switch_i2c_gpio_mfp(int pinid) {

	unsigned int val,val1;

	unsigned long i2c_mfps[] = {
		GPIO079_CAM_SCL | MFP_LPM_FLOAT,
		GPIO080_CAM_SDA | MFP_LPM_FLOAT,
	};

	unsigned long gpio_mfps[] = {
		GPIO079_GPIO_79,
		GPIO080_GPIO_80,
	};

	switch_i2c_gpioa = mfp_to_gpio(GPIO079_GPIO_79);
	switch_i2c_gpiob = mfp_to_gpio(GPIO080_GPIO_80);

	if (pinid == I2C_PIN) {
			mfp_config(ARRAY_AND_SIZE(i2c_mfps));
			val = mfp_read(switch_i2c_gpioa);
			val1 = mfp_read(switch_i2c_gpiob);
			printk("--------Pins Switchs TO I2C,  MFP  Setting is GPIO079 :0x%x, GPIO080 :0x%x---------", val, val1);
	} 

	if (pinid == GPIO_PIN) {
		mfp_config(ARRAY_AND_SIZE(gpio_mfps));
		val = mfp_read(switch_i2c_gpioa);
		val1 = mfp_read(switch_i2c_gpiob);
		printk("--------Pins Switchs TO GPIO,  MFP  Setting is GPIO079 :0x%x, GPIO080 :0x%x---------", val, val1);

		if (switch_i2c_gpioa && gpio_request(switch_i2c_gpioa, "switch_mclk_gpio79")) {
			printk(KERN_ERR "------switch_i2c_gpio_mfp-------Request GPIO failed,"
					"gpio: %d\n", switch_i2c_gpioa);
			switch_i2c_gpioa = 0;
			return -1;
		}

		if (switch_i2c_gpiob && gpio_request(switch_i2c_gpiob, "switch_mclk_gpio80")) {
			printk(KERN_ERR "------switch_i2c_gpio_mfp-------Request GPIO failed,"
					"gpio: %d\n", switch_i2c_gpiob);
			switch_i2c_gpiob = 0;
			return -1;
		}
			
		gpio_direction_output(switch_i2c_gpioa, 0);
		gpio_direction_output(switch_i2c_gpiob, 0);

		gpio_free(switch_i2c_gpioa);
		gpio_free(switch_i2c_gpiob);

	}

	return 0;

}
예제 #6
0
int board_early_init_f(void)
{
	u32 mfp_cfg[] = {
		/* AP UART*/
		GPIO047_UART1_RXD,
		GPIO048_UART1_TXD,

		/* KeyPad */
		GPIO000_KP_MKIN0,
		GPIO001_KP_MKOUT0,
		GPIO002_KP_MKIN1,
		GPIO003_KP_MKOUT1,
		GPIO004_KP_MKIN2,
		GPIO005_KP_MKOUT2,
		GPIO006_KP_MKIN3,

		/* LCD BL PWM */
		GPIO032_GPIO_32,
		/* LCD RESET */
		GPIO004_GPIO_4,

		/* I2C */
		GPIO053_CI2C_SCL,
		GPIO054_CI2C_SDA,
		GPIO087_CI2C_SCL_2,
		GPIO088_CI2C_SDA_2,

		MFP_EOC		/*End of configureation*/
	};

	mfp_config(mfp_cfg);
	pxa_amp_init();
	return 0;
}
예제 #7
0
파일: ttc_dkb.c 프로젝트: 250bpm/linux
static void __init ttc_dkb_init(void)
{
	mfp_config(ARRAY_AND_SIZE(ttc_dkb_pin_config));

	/* on-chip devices */
	pxa910_add_uart(1);

	/* off-chip devices */
	pxa910_add_twsi(0, NULL, ARRAY_AND_SIZE(ttc_dkb_i2c_info));
	platform_add_devices(ARRAY_AND_SIZE(ttc_dkb_devices));

#ifdef CONFIG_USB_MV_UDC
	pxa168_device_u2o.dev.platform_data = &ttc_usb_pdata;
	platform_device_register(&pxa168_device_u2o);
#endif

#ifdef CONFIG_USB_EHCI_MV_U2O
	pxa168_device_u2oehci.dev.platform_data = &ttc_usb_pdata;
	platform_device_register(&pxa168_device_u2oehci);
#endif

#ifdef CONFIG_USB_MV_OTG
	pxa168_device_u2ootg.dev.platform_data = &ttc_usb_pdata;
	platform_device_register(&pxa168_device_u2ootg);
#endif
}
예제 #8
0
파일: ttc_dkb.c 프로젝트: 0-T-0/ps4-linux
static void __init ttc_dkb_init(void)
{
	mfp_config(ARRAY_AND_SIZE(ttc_dkb_pin_config));

	/* on-chip devices */
	pxa910_add_uart(1);
#if IS_ENABLED(CONFIG_MTD_NAND_PXA3xx)
	pxa910_add_nand(&dkb_nand_info);
#endif

	/* off-chip devices */
	pxa910_add_twsi(0, NULL, ARRAY_AND_SIZE(ttc_dkb_i2c_info));
	platform_device_add_data(&pxa910_device_gpio, &pxa910_gpio_pdata,
				 sizeof(struct pxa_gpio_platform_data));
	platform_add_devices(ARRAY_AND_SIZE(ttc_dkb_devices));

#if IS_ENABLED(CONFIG_USB_MV_UDC)
	pxa168_device_u2o.dev.platform_data = &ttc_usb_pdata;
	platform_device_register(&pxa168_device_u2o);
#endif

#if IS_ENABLED(CONFIG_USB_EHCI_MV_U2O)
	pxa168_device_u2oehci.dev.platform_data = &ttc_usb_pdata;
	platform_device_register(&pxa168_device_u2oehci);
#endif

#if IS_ENABLED(CONFIG_USB_MV_OTG)
	pxa168_device_u2ootg.dev.platform_data = &ttc_usb_pdata;
	platform_device_register(&pxa168_device_u2ootg);
#endif

#if IS_ENABLED(CONFIG_MMP_DISP)
	add_disp();
#endif
}
예제 #9
0
static void __init avengers_lite_init(void)
{
	mfp_config(ARRAY_AND_SIZE(avengers_lite_pin_config_V16F));

	/* on-chip devices */
	pxa168_add_uart(2);
}
static void __init gplugd_init(void)
{
	mfp_config(ARRAY_AND_SIZE(gplugd_pin_config));

	platform_device_register(&pxa168_device_gpio); //bytim-tian

	select_disp_freq();

	/* on-chip devices */
	pxa168_add_uart(3);
	pxa168_add_ssp(1);
	pxa168_add_twsi(0, NULL, ARRAY_AND_SIZE(gplugd_i2c_board_info));

	pxa168_add_eth(&gplugd_eth_platform_data);
	pxa168_add_sdh(1, &gplugd_sdh_platdata);  //bytim-tian
	pxa168_add_sdh(2, &gplugd_sdh_platdata);  //bytim-tian
	
	pxa168_add_usb_host(&platdata_usb_host);  //bytim-tian
	pxa168_add_usb_otg(&platdata_usb_otg);	  //bytim-tian
	pxa168_add_usb_otg_gadget(&platdata_usb_otggadget);   //bytim-tian
	pxa168_add_usb_otg_ehci(&platdata_usb_otgehci);	   //bytim-tian

	pxa168_add_ssp(2);                        //bytim-tian
	pxa168_add_spi(2, &pxa_ssp_master_info);  //bytim-tian
	spi_register_board_info(gplugD_spi_board_info, ARRAY_SIZE(gplugD_spi_board_info));
}
예제 #11
0
static void __init avengers_lite_init(void)
{
	mfp_config(ARRAY_AND_SIZE(avengers_lite_pin_config_V16F));

	/* on-chip devices */
	pxa168_add_uart(2);
	platform_device_register(&pxa168_device_gpio);
}
예제 #12
0
static void sdh_mfp_config(void)
{
	int ret = 0;

	ret = aspenite_pinmux_switch(SW_CARD);
	if (0 == ret)
		mfp_config(ARRAY_AND_SIZE(aspenite_sdh_pins));
}
void __init goya_input_init(void)
{
	mfp_config(ARRAY_AND_SIZE(goya_input_pin_config_bring));

	goya_input_keyboard_init();
	goya_input_tsp_init();
	goya_input_vibrator_init();
}
예제 #14
0
static void __init ttc_dkb_init(void)
{
	mfp_config(ARRAY_AND_SIZE(ttc_dkb_pin_config));

	/* on-chip devices */
	pxa910_add_uart(1);

	/* off-chip devices */
	platform_add_devices(ARRAY_AND_SIZE(ttc_dkb_devices));
}
static void __init brownstone_init(void)
{
	mfp_config(ARRAY_AND_SIZE(brownstone_pin_config));
	check_board_version();

	/* on-chip devices */
	mmp2_add_uart(1);
	mmp2_add_uart(3);
	mmp2_add_twsi(1, NULL, ARRAY_AND_SIZE(brownstone_twsi1_info));
}
static void __init teton_bga_init(void)
{
	mfp_config(ARRAY_AND_SIZE(teton_bga_pin_config));

	/* on-chip devices */
	pxa168_add_uart(1);
	pxa168_add_keypad(&teton_bga_keypad_info);
	pxa168_add_twsi(0, NULL, ARRAY_AND_SIZE(teton_bga_i2c_info));
	platform_device_register(&pxa168_device_gpio);
}
예제 #17
0
static void __init jasper_init(void)
{
	mfp_config(ARRAY_AND_SIZE(jasper_pin_config));

	/* on-chip devices */
	mmp2_add_uart(1);
	mmp2_add_uart(3);
	mmp2_add_twsi(1, NULL, ARRAY_AND_SIZE(jasper_twsi1_info));

	regulator_has_full_constraints();
}
static void __init yellowstone_init_mmc(void)
{
#ifdef CONFIG_SD8XXX_RFKILL
	int WIB_PDn = mfp_to_gpio(GPIO57_GPIO);
	int WIB_RESETn = mfp_to_gpio(GPIO58_GPIO);
	add_sd8x_rfkill_device(WIB_PDn, WIB_RESETn,\
			&mmp3_sdh_platdata_mmc1.pmmc, mmp3_8787_set_power);
#endif

	mfp_config(ARRAY_AND_SIZE(mmc3_pin_config));
	mmp3_add_sdh(2, &mmp3_sdh_platdata_mmc2); /* eMMC */

	mfp_config(ARRAY_AND_SIZE(mmc1_pin_config));
	if (cpu_is_mmp3_b0())
		mmp3_sdh_platdata_mmc0.quirks = SDHCI_QUIRK_INVERTED_WRITE_PROTECT;
	mmp3_add_sdh(0, &mmp3_sdh_platdata_mmc0); /* SD/MMC */

	mfp_config(ARRAY_AND_SIZE(mmc2_pin_config));
	mmp3_add_sdh(1, &mmp3_sdh_platdata_mmc1); /* SDIO for WIFI card */
}
static void __init tavorevb_init(void)
{
	mfp_config(ARRAY_AND_SIZE(tavorevb_pin_config));

	/*                 */
	pxa910_add_uart(1);
	platform_device_register(&pxa910_device_gpio);

	/*                  */
	platform_device_register(&smc91x_device);
}
예제 #20
0
파일: flint.c 프로젝트: CSCLOG/beaglebone
static void __init flint_init(void)
{
	mfp_config(ARRAY_AND_SIZE(flint_pin_config));

	/* on-chip devices */
	mmp2_add_uart(1);
	mmp2_add_uart(2);

	/* off-chip devices */
	platform_device_register(&smc91x_device);
}
예제 #21
0
static int lead_lcd_power(struct pxa910fb_info *fbi, unsigned int spi_gpio_cs, unsigned int spi_gpio_reset, int on)
{
    int err = 0;

    mfp_config(ARRAY_AND_SIZE(tpo_lcd_gpio_pin_config));
    lcd_panel_gpio_spi_init();

    if (on)
    {
        if (spi_gpio_reset != -1) {
            err = gpio_request(spi_gpio_reset, "TPO_LCD_SPI_RESET");
            if (err) {
                printk("failed to request GPIO for TPO LCD RESET\n");
                return 1;
            }
            gpio_direction_output(spi_gpio_reset, 0);
            msleep(100);
            gpio_set_value(spi_gpio_reset, 1);
            msleep(100);
            gpio_free(spi_gpio_reset);
        }
        lcd_lead_init();
        lcd_power_on(1, 50);

    }
    else
    {
        //lcd_panel_gpio_spi_init();
        //lcd_panel_sleep();
        lcd_power_on(0, 0);
        err = gpio_request(spi_gpio_reset, "TPO_LCD_SPI_RESET");
        if (err) {
            printk("failed to request LCD RESET gpio\n");
            return 1;
        }
        gpio_set_value(spi_gpio_reset, 0);
        gpio_free(spi_gpio_reset);


    }

//out:

    gpio_direction_output(cs_gpio, 0);
    gpio_direction_output(clk_gpio, 0);
    gpio_direction_output(d_gpio, 0);
    gpio_free(d_gpio_in);
    gpio_free(cs_gpio);
    gpio_free(clk_gpio);
    gpio_free(d_gpio);

    return 0;
}
예제 #22
0
int board_early_init_f(void)
{
	u32 mfp_cfg[] = {
		/* Enable Console on UART1 */
		MFP107_UART1_RXD,
		MFP108_UART1_TXD,
		MFP_EOC		/*End of configureation*/
	};
	/* configure MFP's */
	mfp_config(mfp_cfg);
	return 0;
}
/* sensor init */
static int sensor_power_onoff(int on, int unused)
{
	/*
	 * on, 1, power on
	 * on, 0, power off
	 */
	int ret = 0;
	if(on) {
		mfp_config(ARRAY_AND_SIZE(aspenite_cam_pins));
	}
	return ret;
}
예제 #24
0
static void __init jasper_init(void)
{
	mfp_config(ARRAY_AND_SIZE(jasper_pin_config));

	/* on-chip devices */
	mmp2_add_uart(1);
	mmp2_add_uart(3);
	mmp2_add_twsi(1, NULL, ARRAY_AND_SIZE(jasper_twsi1_info));
	mmp2_add_sdhost(0, &mmp2_sdh_platdata_mmc0); /* SD/MMC */

	regulator_has_full_constraints();
}
예제 #25
0
static void __init common_init(void)
{
	mfp_config(ARRAY_AND_SIZE(common_pin_config));

	/* on-chip devices */
	pxa168_add_uart(1);
	pxa168_add_twsi(1, NULL, ARRAY_AND_SIZE(aspenite_i2c_info));
	pxa168_add_ssp(1);
	pxa168_add_nand(&aspenite_nand_info);

	/* off-chip devices */
	platform_device_register(&smc91x_device);
}
예제 #26
0
파일: gplugd.c 프로젝트: AMouri/linux
static void __init gplugd_init(void)
{
	mfp_config(ARRAY_AND_SIZE(gplugd_pin_config));

	select_disp_freq();

	/* on-chip devices */
	pxa168_add_uart(3);
	pxa168_add_ssp(0);
	pxa168_add_twsi(0, NULL, ARRAY_AND_SIZE(gplugd_i2c_board_info));

	pxa168_add_eth(&gplugd_eth_platform_data);
}
예제 #27
0
파일: tavorevb.c 프로젝트: 0-T-0/ps4-linux
static void __init tavorevb_init(void)
{
	mfp_config(ARRAY_AND_SIZE(tavorevb_pin_config));

	/* on-chip devices */
	pxa910_add_uart(1);
	platform_device_add_data(&pxa910_device_gpio, &pxa910_gpio_pdata,
				 sizeof(struct pxa_gpio_platform_data));
	platform_device_register(&pxa910_device_gpio);

	/* off-chip devices */
	platform_device_register(&smc91x_device);
}
예제 #28
0
static int ak7343_write(struct i2c_client *client,
			unsigned long reg, unsigned long val)
{
	int ret = 0;
	unsigned long mfp_pin[2];
	unsigned long i2c0_mfps[] = {
		GPIO053_GPIO_53,		/* SCL */
		GPIO054_GPIO_54,		/* SDA */
	};
	unsigned long scl, sda;
	scl = MFP_PIN_GPIO53;
	sda = MFP_PIN_GPIO54;
	i2c_lock_adapter(client->adapter);
	if (gpio_request(scl, "SCL")) {
		pr_err("Failed to request GPIO for SCL pin!\n");
		ret = -1;
		goto out0;
	}
	if (gpio_request(sda, "SDA")) {
		pr_err("Failed to request GPIO for SDA pin!\n");
		ret = -1;
		goto out1;
	};
	mfp_pin[0] = mfp_read(MFP_PIN_GPIO53);
	mfp_pin[1] = mfp_read(MFP_PIN_GPIO54);
	mfp_config(i2c0_mfps, ARRAY_SIZE(i2c0_mfps));
	i2c_start(scl, sda);
	if (i2c_sendbyte(scl, sda,  (client->addr<<1) | 0) < 0) {
		ret = -1;
		goto out2;
	}
	if (i2c_sendbyte(scl, sda, (u8)reg) < 0) {
		ret = -1;
		goto out2;
	}
	if (i2c_sendbyte(scl, sda, (u8)val) < 0) {
		ret = -1;
		goto out2;
	}
out2:
	i2c_stop(scl, sda);
	mfp_write(MFP_PIN_GPIO53, mfp_pin[0]);
	mfp_write(MFP_PIN_GPIO54, mfp_pin[1]);
	gpio_free(sda);

out1:
	gpio_free(scl);
out0:
	i2c_unlock_adapter(client->adapter);
	return ret;
}
// for TSP i2c operation (switch gpio or hw i2c func)
void i2c1_pin_changed(int gpio)
{
	unsigned long i2c1_g_mfps[] = {
		GPIO087_GPIO_87,		/* SCL */
		GPIO088_GPIO_88,		/* SDA */
	};

	unsigned long i2c1_hw_mfps[] = {
		GPIO087_CI2C_SCL_2,		/* SCL */
		GPIO088_CI2C_SDA_2,		/* SDA */
	};

        usleep_range(5000, 8000);

	if(gpio)
		mfp_config(ARRAY_AND_SIZE(i2c1_g_mfps));
	else
		mfp_config(ARRAY_AND_SIZE(i2c1_hw_mfps));

        usleep_range(5000, 8000);

	return;
}
예제 #30
0
파일: flint.c 프로젝트: 0-T-0/ps4-linux
static void __init flint_init(void)
{
	mfp_config(ARRAY_AND_SIZE(flint_pin_config));

	/* on-chip devices */
	mmp2_add_uart(1);
	mmp2_add_uart(2);
	platform_device_add_data(&mmp2_device_gpio, &mmp2_gpio_pdata,
				 sizeof(struct pxa_gpio_platform_data));
	platform_device_register(&mmp2_device_gpio);

	/* off-chip devices */
	platform_device_register(&smc91x_device);
}