diff mbox

[2/2] da850-evm: Board file modifications TI's PRU CAN.

Message ID 1291194315-4629-2-git-send-email-subhasish@mistralsolutions.com (mailing list archive)
State Changes Requested
Headers show

Commit Message

Subhasish Ghosh Dec. 1, 2010, 9:05 a.m. UTC
None
diff mbox

Patch

diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index f89b0b7..3563a46 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -43,6 +43,7 @@ 
 
 #define DA850_MMCSD_CD_PIN		GPIO_TO_PIN(4, 0)
 #define DA850_MMCSD_WP_PIN		GPIO_TO_PIN(4, 1)
+#define DA850_PRU_CAN_TRX_PIN  GPIO_TO_PIN(2, 0)
 
 #define DA850_MII_MDIO_CLKEN_PIN	GPIO_TO_PIN(2, 6)
 
@@ -188,6 +189,41 @@  static struct platform_device *da850_evm_devices[] __initdata = {
 	&da850_evm_norflash_device,
 };
 
+const short da850_pru_can_pins[] = {
+	DA850_PRU0_R31_0, DA850_PRU1_R30_15, DA850_PRU1_R31_18,
+	-1
+};
+
+static int __init da850_evm_setup_pru_can(void)
+{
+	int ret;
+
+	if (!machine_is_davinci_da850_evm())
+		return 0;
+
+	ret = davinci_cfg_reg_list(da850_pru_can_pins);
+	if (ret)
+		pr_warning("da850_evm_init: da850_pru_can_pins mux setup"
+					"failed:%d\n", ret);
+
+	ret = davinci_cfg_reg(DA850_GPIO2_0);
+	if (ret)
+		pr_warning("da850_evm_init:GPIO(2,0) mux setup "
+					"failed\n");
+
+	/* value = 0 to enable the CAN transceiver */
+	ret = gpio_request_one(DA850_PRU_CAN_TRX_PIN, GPIOF_OUT_INIT_LOW, "pru_can_en");
+	if (ret)
+		pr_warning("Cannot setup GPIO %d\n", DA850_PRU_CAN_TRX_PIN);
+
+	ret = da8xx_register_pru_can();
+	if (ret)
+		pr_warning("da850_evm_init: pru can registration failed:"
+				"%d\n", ret);
+	return ret;
+}
+device_initcall(da850_evm_setup_pru_can);
+
 #define DA8XX_AEMIF_CE2CFG_OFFSET	0x10
 #define DA8XX_AEMIF_ASIZE_16BIT		0x1