|
@@ -762,3 +762,105 @@ static mfp_cfg_t viper_pin_config[] __initdata = {
|
|
|
|
|
|
/* PC/104 Interrupt */
|
|
|
GPIO1_GPIO | WAKEUP_ON_EDGE_RISE, /* VIPER_CPLD_GPIO */
|
|
|
+};
|
|
|
+
|
|
|
+static unsigned long viper_tpm;
|
|
|
+
|
|
|
+static int __init viper_tpm_setup(char *str)
|
|
|
+{
|
|
|
+ return strict_strtoul(str, 10, &viper_tpm) >= 0;
|
|
|
+}
|
|
|
+
|
|
|
+__setup("tpm=", viper_tpm_setup);
|
|
|
+
|
|
|
+static void __init viper_tpm_init(void)
|
|
|
+{
|
|
|
+ struct platform_device *tpm_device;
|
|
|
+ struct i2c_gpio_platform_data i2c_tpm_data = {
|
|
|
+ .sda_pin = VIPER_TPM_I2C_SDA_GPIO,
|
|
|
+ .scl_pin = VIPER_TPM_I2C_SCL_GPIO,
|
|
|
+ .udelay = 10,
|
|
|
+ .timeout = HZ,
|
|
|
+ };
|
|
|
+ char *errstr;
|
|
|
+
|
|
|
+ /* Allocate TPM i2c bus if requested */
|
|
|
+ if (!viper_tpm)
|
|
|
+ return;
|
|
|
+
|
|
|
+ tpm_device = platform_device_alloc("i2c-gpio", 2);
|
|
|
+ if (tpm_device) {
|
|
|
+ if (!platform_device_add_data(tpm_device,
|
|
|
+ &i2c_tpm_data,
|
|
|
+ sizeof(i2c_tpm_data))) {
|
|
|
+ if (platform_device_add(tpm_device)) {
|
|
|
+ errstr = "register TPM i2c bus";
|
|
|
+ goto error_free_tpm;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ errstr = "allocate TPM i2c bus data";
|
|
|
+ goto error_free_tpm;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ errstr = "allocate TPM i2c device";
|
|
|
+ goto error_tpm;
|
|
|
+ }
|
|
|
+
|
|
|
+ return;
|
|
|
+
|
|
|
+error_free_tpm:
|
|
|
+ kfree(tpm_device);
|
|
|
+error_tpm:
|
|
|
+ pr_err("viper: Couldn't %s, giving up\n", errstr);
|
|
|
+}
|
|
|
+
|
|
|
+static void __init viper_init_vcore_gpios(void)
|
|
|
+{
|
|
|
+ if (gpio_request(VIPER_PSU_DATA_GPIO, "PSU data"))
|
|
|
+ goto err_request_data;
|
|
|
+
|
|
|
+ if (gpio_request(VIPER_PSU_CLK_GPIO, "PSU clock"))
|
|
|
+ goto err_request_clk;
|
|
|
+
|
|
|
+ if (gpio_request(VIPER_PSU_nCS_LD_GPIO, "PSU cs"))
|
|
|
+ goto err_request_cs;
|
|
|
+
|
|
|
+ if (gpio_direction_output(VIPER_PSU_DATA_GPIO, 0) ||
|
|
|
+ gpio_direction_output(VIPER_PSU_CLK_GPIO, 0) ||
|
|
|
+ gpio_direction_output(VIPER_PSU_nCS_LD_GPIO, 0))
|
|
|
+ goto err_dir;
|
|
|
+
|
|
|
+ /* c/should assume redboot set the correct level ??? */
|
|
|
+ viper_set_core_cpu_voltage(get_clk_frequency_khz(0), 1);
|
|
|
+
|
|
|
+ return;
|
|
|
+
|
|
|
+err_dir:
|
|
|
+ gpio_free(VIPER_PSU_nCS_LD_GPIO);
|
|
|
+err_request_cs:
|
|
|
+ gpio_free(VIPER_PSU_CLK_GPIO);
|
|
|
+err_request_clk:
|
|
|
+ gpio_free(VIPER_PSU_DATA_GPIO);
|
|
|
+err_request_data:
|
|
|
+ pr_err("viper: Failed to setup vcore control GPIOs\n");
|
|
|
+}
|
|
|
+
|
|
|
+static void __init viper_init_serial_gpio(void)
|
|
|
+{
|
|
|
+ if (gpio_request(VIPER_UART_SHDN_GPIO, "UARTs shutdown"))
|
|
|
+ goto err_request;
|
|
|
+
|
|
|
+ if (gpio_direction_output(VIPER_UART_SHDN_GPIO, 0))
|
|
|
+ goto err_dir;
|
|
|
+
|
|
|
+ return;
|
|
|
+
|
|
|
+err_dir:
|
|
|
+ gpio_free(VIPER_UART_SHDN_GPIO);
|
|
|
+err_request:
|
|
|
+ pr_err("viper: Failed to setup UART shutdown GPIO\n");
|
|
|
+}
|
|
|
+
|
|
|
+#ifdef CONFIG_CPU_FREQ
|
|
|
+static int viper_cpufreq_notifier(struct notifier_block *nb,
|
|
|
+ unsigned long val, void *data)
|