void s3c_sdhci_set_platdata(void)
{
#if defined(CONFIG_S3C_DEV_HSMMC)
	s3c_sdhci0_set_platdata(&hsmmc0_platdata);
#endif
#if defined(CONFIG_S3C_DEV_HSMMC1)
	if (machine_is_aries())
		hsmmc1_platdata.built_in = 1;
	s3c_sdhci1_set_platdata(&hsmmc1_platdata);
#endif
#if defined(CONFIG_S3C_DEV_HSMMC2)
	if (machine_is_herring()) {
		hsmmc2_platdata.ext_cd = IRQ_EINT(28);
		hsmmc2_platdata.cfg_ext_cd = universal_sdhci2_cfg_ext_cd;
		hsmmc2_platdata.detect_ext_cd = universal_sdhci2_detect_ext_cd;
	}
        if (machine_is_aries()) {
		hsmmc2_platdata.ext_cd = IRQ_EINT(28);
		hsmmc2_platdata.cfg_ext_cd = universal_sdhci2_cfg_ext_cd;
		hsmmc2_platdata.detect_ext_cd = universal_sdhci2_detect_ext_cd;
	}

	s3c_sdhci2_set_platdata(&hsmmc2_platdata);
#endif
#if defined(CONFIG_S3C_DEV_HSMMC3)
	if (machine_is_herring())
		hsmmc3_platdata.built_in = 1;
	s3c_sdhci3_set_platdata(&hsmmc3_platdata);
        if (machine_is_aries())
		hsmmc3_platdata.built_in = 1;
	s3c_sdhci3_set_platdata(&hsmmc3_platdata);
#endif
};
void s3c_sdhci_set_platdata(void)
{
#if defined(CONFIG_S3C_DEV_HSMMC)
	if (machine_is_herring() || machine_is_aries() || machine_is_venturi()) { /* TODO: move to mach-herring.c */
		hsmmc0_platdata.cd_type = S3C_SDHCI_CD_PERMANENT;
	}
	s3c_sdhci0_set_platdata(&hsmmc0_platdata);
#endif
#if defined(CONFIG_S3C_DEV_HSMMC1)
	if (machine_is_aries()) {
		hsmmc1_platdata.cd_type = S3C_SDHCI_CD_EXTERNAL;
		hsmmc1_platdata.ext_cd_init = ext_cd_init_hsmmc1;
		hsmmc1_platdata.ext_cd_cleanup = ext_cd_cleanup_hsmmc1;
		hsmmc1_platdata.built_in = 1;
	}
	s3c_sdhci1_set_platdata(&hsmmc1_platdata);
#endif
#if defined(CONFIG_S3C_DEV_HSMMC2)
	if (machine_is_herring()) {
		if (herring_is_cdma_wimax_dev()) {
			hsmmc2_platdata.cd_type = S3C_SDHCI_CD_EXTERNAL;
			hsmmc2_platdata.ext_cd_init = ext_cd_init_hsmmc2;
			hsmmc2_platdata.ext_cd_cleanup = ext_cd_cleanup_hsmmc2;
			hsmmc2_platdata.built_in = 1;
			hsmmc2_platdata.must_maintain_clock = 1;
			hsmmc2_platdata.enable_intr_on_resume = 1;
		} else {
			hsmmc2_platdata.cd_type = S3C_SDHCI_CD_GPIO;
			hsmmc2_platdata.ext_cd_gpio = S5PV210_GPH3(4);
			hsmmc2_platdata.ext_cd_gpio_invert = true;
			universal_sdhci2_cfg_ext_cd();
		}
	}

	if (machine_is_aries() || machine_is_venturi()) {
		hsmmc2_platdata.cd_type = S3C_SDHCI_CD_GPIO;
		hsmmc2_platdata.ext_cd_gpio = S5PV210_GPH3(4);
		hsmmc2_platdata.ext_cd_gpio_invert = true;
		universal_sdhci2_cfg_ext_cd();
	}

	s3c_sdhci2_set_platdata(&hsmmc2_platdata);
#endif
#if defined(CONFIG_S3C_DEV_HSMMC3)
	if (machine_is_herring() || machine_is_aries() || machine_is_venturi()) {
		hsmmc3_platdata.cd_type = S3C_SDHCI_CD_EXTERNAL;
		hsmmc3_platdata.ext_cd_init = ext_cd_init_hsmmc3;
		hsmmc3_platdata.ext_cd_cleanup = ext_cd_cleanup_hsmmc3;
		hsmmc3_platdata.built_in = 1;
	}
	s3c_sdhci3_set_platdata(&hsmmc3_platdata);
#endif
};
static int __init herring_init_touchkey_led(void)
{
	int i;
	int ret = 0;

	if (!machine_is_herring() || system_rev < 0x10)
		return 0;

	for (i = 0; i < ARRAY_SIZE(led_gpios); i++) {
		ret = gpio_request(S5PV210_GPJ3(led_gpios[i]), "touchkey led");
		if (ret) {
			pr_err("Failed to request touchkey led gpio %d\n", i);
			goto err_req;
		}
		s3c_gpio_setpull(S5PV210_GPJ3(led_gpios[i]),
							S3C_GPIO_PULL_NONE);
	}

	herring_touchkey_led_onoff(1);

	register_early_suspend(&early_suspend);

	return 0;

err_req:
	while (--i >= 0)
		gpio_free(S5PV210_GPJ3(led_gpios[i]));
	return ret;
}
void s5pv210_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width)
{
    unsigned int gpio;

    switch (width) {
    /* Channel 2 supports 4 and 8-bit bus width */
    case 8:
        /* Set all the necessary GPIO function and pull up/down */
        for (gpio = S5PV210_GPG3(3); gpio <= S5PV210_GPG3(6); gpio++) {
            s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
            s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
            s3c_gpio_set_drvstrength(gpio, DRVSTR);
        }

    case 0:
    case 1:
    case 4:
        if (machine_is_herring() && herring_is_cdma_wimax_dev())
            break;
        /* Set all the necessary GPIO function and pull up/down */
        for (gpio = S5PV210_GPG2(0); gpio <= S5PV210_GPG2(6); gpio++) {
            if (gpio != S5PV210_GPG2(2)) {
                s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
                s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
            }
            s3c_gpio_set_drvstrength(gpio, DRVSTR);
        }
        break;
    default:
        printk(KERN_ERR "Wrong SD/MMC bus width : %d\n", width);
    }
}
void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
{
    unsigned int gpio;

    switch (width) {
    /* Channel 0 supports 4 and 8-bit bus width */
    case 8:
        /* Set all the necessary GPIO function and pull up/down */
        for (gpio = S5PV210_GPG1(3); gpio <= S5PV210_GPG1(6); gpio++) {
            s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
            s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
            s3c_gpio_set_drvstrength(gpio, DRVSTR);
        }

    case 0:
    case 1:
    case 4:
        /* Set all the necessary GPIO function and pull up/down */
        for (gpio = S5PV210_GPG0(0); gpio <= S5PV210_GPG0(6); gpio++) {
            if (gpio != S5PV210_GPG0(2)) {
                s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
                s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
            }
            s3c_gpio_set_drvstrength(gpio, DRVSTR);
        }
        break;
    default:
        printk(KERN_ERR "Wrong SD/MMC bus width : %d\n", width);
    }

    if (machine_is_herring() || machine_is_aries()) {
        s3c_gpio_cfgpin(S5PV210_GPJ2(7), S3C_GPIO_OUTPUT);
        s3c_gpio_setpull(S5PV210_GPJ2(7), S3C_GPIO_PULL_NONE);
        gpio_set_value(S5PV210_GPJ2(7), 1);
    }

    if (machine_is_herring()) { // This is not done for aries in the original kernel
        gpio_direction_output(S5PV210_GPJ2(7), 1);
        s3c_gpio_setpull(S5PV210_GPJ2(7), S3C_GPIO_PULL_NONE);
    }
}
void s5pv210_setup_sdhci_cfg_card(struct platform_device *dev,
				    void __iomem *r,
				    struct mmc_ios *ios,
				    struct mmc_card *card)
{
	u32 ctrl2;
	u32 ctrl3;

	ctrl2 = readl(r + S3C_SDHCI_CONTROL2);
	ctrl2 &= S3C_SDHCI_CTRL2_SELBASECLK_MASK;
	ctrl2 |= (S3C64XX_SDHCI_CTRL2_ENSTAASYNCCLR |
		  S3C64XX_SDHCI_CTRL2_ENCMDCNFMSK |
		  S3C_SDHCI_CTRL2_DFCNT_NONE |
		  S3C_SDHCI_CTRL2_ENCLKOUTHOLD);

	if (ios->clock <= (400 * 1000)) {
		ctrl2 &= ~(S3C_SDHCI_CTRL2_ENFBCLKTX |
			   S3C_SDHCI_CTRL2_ENFBCLKRX);
		ctrl3 = 0;
	} else {
		u32 range_start;
		u32 range_end;

		ctrl2 |= S3C_SDHCI_CTRL2_ENFBCLKTX |
			 S3C_SDHCI_CTRL2_ENFBCLKRX;

		if (card->type == MMC_TYPE_MMC)  /* MMC */
			range_start = 20 * 1000 * 1000;
		//else    /* SD, SDIO */
		//	range_start = 25 * 1000 * 1000;

		range_end = 37 * 1000 * 1000;

		if ((ios->clock > range_start) && (ios->clock < range_end))
			ctrl3 = S3C_SDHCI_CTRL3_FCSELTX_BASIC |
				S3C_SDHCI_CTRL3_FCSELRX_BASIC;
		else if (machine_is_herring() && herring_is_cdma_wimax_dev() &&
								dev->id == 2) {
			ctrl3 = S3C_SDHCI_CTRL3_FCSELTX_BASIC;
			//if(card->type & MMC_TYPE_SDIO)
				ctrl3 |= S3C_SDHCI_CTRL3_FCSELRX_BASIC;
			//else
			//	ctrl3 |= S3C_SDHCI_CTRL3_FCSELRX_INVERT;
		} else
			ctrl3 = S3C_SDHCI_CTRL3_FCSELTX_BASIC |
				S3C_SDHCI_CTRL3_FCSELRX_INVERT;
	}


	writel(ctrl2, r + S3C_SDHCI_CONTROL2);
	writel(ctrl3, r + S3C_SDHCI_CONTROL3);
}
Beispiel #7
0
int __init s5pv210_init(void)
{
	printk(KERN_INFO "S5PV210: Initializing architecture\n");

	/* set idle function */
	pm_idle = s5pv210_idle;

	/* set sw_reset function */
	if (!machine_is_herring())
		s5p_reset_hook = s5pv210_sw_reset;

	return device_register(&s5pv210_dev);
}
Beispiel #8
0
static int __init herring_init_vibrator(void)
{
	int ret = 0;

#ifdef CONFIG_MACH_HERRING
	if (!machine_is_herring())
		return 0;
#endif
	hrtimer_init(&vibdata.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
	vibdata.timer.function = herring_vibrator_timer_func;
	INIT_WORK(&vibdata.work, herring_vibrator_work);

	ret = gpio_request(GPIO_VIBTONE_EN1, "vibrator-en");
	if (ret < 0)
		return ret;

	s3c_gpio_cfgpin(GPIO_VIBTONE_PWM, GPD0_TOUT_1);

	vibdata.pwm_dev = pwm_request(1, "vibrator-pwm");
	if (IS_ERR(vibdata.pwm_dev)) {
		ret = PTR_ERR(vibdata.pwm_dev);
		goto err_pwm_req;
	}

	wake_lock_init(&vibdata.wklock, WAKE_LOCK_SUSPEND, "vibrator");
	mutex_init(&vibdata.lock);

	ret = timed_output_dev_register(&to_dev);
	if (ret < 0)
		goto err_to_dev_reg;

	if (misc_register(&pwm_duty_device))
		printk("%s misc_register(%s) failed\n", __FUNCTION__, pwm_duty_device.name);
	else {
		if (sysfs_create_group(&pwm_duty_device.this_device->kobj, &pwm_duty_group))
			dev_err("failed to create sysfs group for device %s\n", pwm_duty_device.name);
	}
	
	return 0;

err_to_dev_reg:
	mutex_destroy(&vibdata.lock);
	wake_lock_destroy(&vibdata.wklock);
	pwm_free(vibdata.pwm_dev);
err_pwm_req:
	gpio_free(GPIO_VIBTONE_EN1);
	return ret;
}
static int __init herring_init_vibrator(void)
{
	int ret = 0;

#ifdef CONFIG_MACH_HERRING
	if (!machine_is_herring())
		return 0;
#endif
	hrtimer_init(&vibdata.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
	vibdata.timer.function = herring_vibrator_timer_func;
	INIT_WORK(&vibdata.work, herring_vibrator_work);

	ret = gpio_request(GPIO_VIBTONE_EN1, "vibrator-en");
	if (ret < 0)
		return ret;

	s3c_gpio_cfgpin(GPIO_VIBTONE_PWM, GPD0_TOUT_1);

	vibdata.pwm_dev = pwm_request(1, "vibrator-pwm");
	if (IS_ERR(vibdata.pwm_dev)) {
		ret = PTR_ERR(vibdata.pwm_dev);
		goto err_pwm_req;
	}

	wake_lock_init(&vibdata.wklock, WAKE_LOCK_SUSPEND, "vibrator");
	mutex_init(&vibdata.lock);

	ret = timed_output_dev_register(&to_dev);
	if (ret < 0)
		goto err_to_dev_reg;

	return 0;

err_to_dev_reg:
	mutex_destroy(&vibdata.lock);
	wake_lock_destroy(&vibdata.wklock);
	pwm_free(vibdata.pwm_dev);
err_pwm_req:
	gpio_free(GPIO_VIBTONE_EN1);
	return ret;
}
static int __init herring_init_touchkey_led(void)
{
	int i;
	int ret = 0;
	u32 gpio;

	if (!machine_is_herring() || !herring_is_tft_dev())
		return 0;

	for (i = 0; i < ARRAY_SIZE(led_gpios); i++) {
		gpio = S5PV210_GPJ3(led_gpios[i]);
		ret = gpio_request(gpio, "touchkey led");
		if (ret) {
			pr_err("Failed to request touchkey led gpio %d\n", i);
			goto err_req;
		}
		s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
		s3c_gpio_slp_cfgpin(gpio, S3C_GPIO_SLP_PREV);
		s3c_gpio_slp_setpull_updown(gpio, S3C_GPIO_PULL_NONE);
	}

	herring_touchkey_led_onoff(1);

	register_early_suspend(&early_suspend);

#ifdef CONFIG_GENERIC_BLN
	register_bln_implementation(&herring_touchkey_bln);
#endif

#ifdef CONFIG_BLD
	register_bld_implementation(&herring_touchkey_bld);
#endif

	return 0;

err_req:
	while (--i >= 0)
		gpio_free(S5PV210_GPJ3(led_gpios[i]));
	return ret;
}