From patchwork Fri Apr 22 12:08:29 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Subhasish Ghosh X-Patchwork-Id: 727351 Received: from bear.ext.ti.com (bear.ext.ti.com [192.94.94.41]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3MBrO84020665 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 22 Apr 2011 11:53:45 GMT Received: from dlep36.itg.ti.com ([157.170.170.91]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id p3MBqCkQ015070 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 22 Apr 2011 06:52:12 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep36.itg.ti.com (8.13.8/8.13.8) with ESMTP id p3MBqBQX029895; Fri, 22 Apr 2011 06:52:11 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 44DF18062F; Fri, 22 Apr 2011 06:52:11 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp52.itg.ti.com (dflp52.itg.ti.com [128.247.22.96]) by linux.omap.com (Postfix) with ESMTP id 8D1DC80626 for ; Fri, 22 Apr 2011 06:50:03 -0500 (CDT) Received: from neches.ext.ti.com (localhost [127.0.0.1]) by dflp52.itg.ti.com (8.13.7/8.13.7) with ESMTP id p3MBo3Lt003773 for ; Fri, 22 Apr 2011 06:50:03 -0500 (CDT) Received: from psmtp.com (na3sys009amx168.postini.com [74.125.149.94]) by neches.ext.ti.com (8.13.7/8.13.7) with SMTP id p3MBo2xA018562 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 22 Apr 2011 06:50:02 -0500 Received: from mail-pw0-f45.google.com ([209.85.160.45]) (using TLSv1) by na3sys009amx168.postini.com ([74.125.148.10]) with SMTP; Fri, 22 Apr 2011 11:50:03 GMT Received: by mail-pw0-f45.google.com with SMTP id 6so398439pwj.4 for ; Fri, 22 Apr 2011 04:50:02 -0700 (PDT) Received: by 10.142.135.4 with SMTP id i4mr639816wfd.99.1303473002056; Fri, 22 Apr 2011 04:50:02 -0700 (PDT) Received: from localhost ([122.166.13.232]) by mx.google.com with ESMTPS id o1sm3825769wfl.9.2011.04.22.04.49.58 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 22 Apr 2011 04:50:01 -0700 (PDT) From: Subhasish Ghosh To: davinci-linux-open-source@linux.davincidsp.com Subject: [PATCH v4 11/11] da850: pruss CAN board specific additions. Date: Fri, 22 Apr 2011 17:38:29 +0530 Message-Id: <1303474109-6212-12-git-send-email-subhasish@mistralsolutions.com> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1303474109-6212-1-git-send-email-subhasish@mistralsolutions.com> References: <1303474109-6212-1-git-send-email-subhasish@mistralsolutions.com> X-pstn-neptune: 0/0/0.00/0 X-pstn-levels: (S:99.90000/99.90000 CV:99.9000 FC:95.5390 LC:95.5390 R:95.9108 P:95.9108 M:97.0282 C:98.6951 ) X-pstn-settings: 2 (0.5000:0.0750) s cv GT3 gt2 gt1 r p m c X-pstn-addresses: from [db-null] Cc: sachi@mistralsolutions.com, Russell King , Subhasish Ghosh , open list , m-watkins@ti.com, linux-arm-kernel@lists.infradead.org X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: davinci-linux-open-source-bounces@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com X-Greylist: Sender succeeded STARTTLS authentication, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 22 Apr 2011 11:53:45 +0000 (UTC) This patch adds the pruss CAN pinmux and registers the device with the pruss mfd driver. Signed-off-by: Subhasish Ghosh --- arch/arm/mach-davinci/board-da850-evm.c | 46 +++++++++++++++++++++++++++++++ 1 files changed, 46 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c index e7fdf31..e1ff18c 100644 --- a/arch/arm/mach-davinci/board-da850-evm.c +++ b/arch/arm/mach-davinci/board-da850-evm.c @@ -48,6 +48,7 @@ #define DA850_MMCSD_CD_PIN GPIO_TO_PIN(4, 0) #define DA850_MMCSD_WP_PIN GPIO_TO_PIN(4, 1) +#define DA850_PRUSS_CAN_TRX_PIN GPIO_TO_PIN(2, 0) #define DA850_MII_MDIO_CLKEN_PIN GPIO_TO_PIN(2, 6) @@ -1117,6 +1118,43 @@ static __init int da850_evm_init_cpufreq(void) static __init int da850_evm_init_cpufreq(void) { return 0; } #endif +static const short da850_evm_pruss_can_pins[] = { + DA850_PRUSS_PRU0_R31_0, DA850_PRUSS_PRU1_R30_15, + DA850_PRUSS_PRU1_R31_18, DA850_GPIO2_0, + -1 +}; + +static int __init da850_evm_pruss_can_setup(void) +{ + int ret, val = 0; + void __iomem *cfg_chip3_reg; + + ret = davinci_cfg_reg_list(da850_evm_pruss_can_pins); + if (ret) + pr_warning("%s: da850_evm_pruss_can_pins mux setup " + "failed:%d\n", __func__, ret); + cfg_chip3_reg = DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG); + val = __raw_readl(cfg_chip3_reg); + val |= BIT(3); + __raw_writel(val, cfg_chip3_reg); + + /* value = 0 to enable the CAN transceiver */ + ret = gpio_request_one(DA850_PRUSS_CAN_TRX_PIN, + GPIOF_OUT_INIT_LOW, "pruss_can_en"); + if (ret) { + pr_warning("Cannot setup GPIO %d\n", DA850_PRUSS_CAN_TRX_PIN); + gpio_free(DA850_PRUSS_CAN_TRX_PIN); + } + + return ret; +} + +static struct da850_evm_pruss_can_data can_data = { + .version = 1, + .setup = da850_evm_pruss_can_setup, +}; + + static const short da850_evm_pruss_suart_pins[] = { DA850_AHCLKX, DA850_ACLKX, DA850_AFSX, DA850_AHCLKR, DA850_ACLKR, DA850_AFSR, @@ -1161,6 +1199,14 @@ static struct mfd_cell cell[] = { .resources = da850_evm_pruss_suart_resource, }, { + .id = 1, + .name = "da8xx_pruss_can", + .platform_data = &can_data, + .data_size = sizeof(can_data), + .num_resources = 0, + .resources = NULL, + }, + { .name = NULL, }, };