From patchwork Wed Dec 1 09:05:14 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Subhasish Ghosh X-Patchwork-Id: 370601 Received: from arroyo.ext.ti.com (arroyo.ext.ti.com [192.94.94.40]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oB18tfhf015442 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 1 Dec 2010 08:56:02 GMT Received: from dlep35.itg.ti.com ([157.170.170.118]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id oB18sANL010108 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 1 Dec 2010 02:54:13 -0600 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep35.itg.ti.com (8.13.7/8.13.7) with ESMTP id oB18s9Xw020982; Wed, 1 Dec 2010 02:54:10 -0600 (CST) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id CE31D80627; Wed, 1 Dec 2010 02:54:09 -0600 (CST) 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 6459780626 for ; Wed, 1 Dec 2010 02:54:03 -0600 (CST) Received: from white.ext.ti.com (localhost [127.0.0.1]) by dflp52.itg.ti.com (8.13.7/8.13.7) with ESMTP id oB18s317011740 for ; Wed, 1 Dec 2010 02:54:03 -0600 (CST) Received: from psmtp.com (na3sys009amx208.postini.com [74.125.149.48]) by white.ext.ti.com (8.13.7/8.13.7) with SMTP id oB18s2xJ003835 for ; Wed, 1 Dec 2010 02:54:02 -0600 Received: from source ([209.85.210.45]) by na3sys009amx208.postini.com ([74.125.148.10]) with SMTP; Wed, 01 Dec 2010 08:54:02 GMT Received: by pzk2 with SMTP id 2so1253280pzk.4 for ; Wed, 01 Dec 2010 00:54:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer; bh=1jBloGotZDEDAEhpbkXoTrZbdbEPCneXLewEX/OkSQA=; b=eIE5PnQh/20RzFH0uVpPh5z/y76S06c3Kq8COhAWBTzK+stE+3acOcwBgyX3q7RWMy muA/tcRYSCY6rTLKDLxIrlYiQgh4yAY2MumFhliyHEajUMUKJd9o6Pa3t/z/yPbdb7ix VxRUrvNZHQkaYES5vb57Mdqao2n+T3tSIBRx8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=RRSn2awEnNrw/Mi2PZ9WM65goC/wx/coa8jSHOeSux8vY2VQlnmqnNCvhw9gDta7sv IY0/OFqoWB7EPFSs8KcX6YwxyGzSMDLyGoQlAoZFe6XFCAsb3oyv3BvgrHCpZadxZtfx aAK7uyyi2R9KfH6s9v/Uo0wm2dzmVfdzurHrM= Received: by 10.142.207.8 with SMTP id e8mr8355807wfg.405.1291193641725; Wed, 01 Dec 2010 00:54:01 -0800 (PST) Received: from localhost ([122.167.113.84]) by mx.google.com with ESMTPS id e14sm10154429wfg.8.2010.12.01.00.53.59 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 01 Dec 2010 00:54:01 -0800 (PST) From: Subhasish Ghosh To: davinci-linux-open-source@linux.davincidsp.com Subject: [PATCH 1/2] da850-evm: Support for TI's PRU CAN Emulation. Date: Wed, 1 Dec 2010 14:35:14 +0530 Message-Id: <1291194315-4629-1-git-send-email-subhasish@mistralsolutions.com> X-Mailer: git-send-email 1.7.2.3 X-pstn-neptune: 0/0/0.00/0 X-pstn-levels: (S:47.40736/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: m-watkins@ti.com, Subhasish Ghosh 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.3 (demeter1.kernel.org [140.211.167.41]); Wed, 01 Dec 2010 08:56:02 +0000 (UTC) diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c index 63916b9..ebc8700 100644 --- a/arch/arm/mach-davinci/da850.c +++ b/arch/arm/mach-davinci/da850.c @@ -238,6 +238,12 @@ static struct clk tptc2_clk = { .flags = ALWAYS_ENABLED, }; +static struct clk pru_clk = { + .name = "pru_ck", + .parent = &pll0_sysclk2, + .lpsc = DA8XX_LPSC0_DMAX, +}; + static struct clk uart0_clk = { .name = "uart0", .parent = &pll0_sysclk2, @@ -373,6 +379,7 @@ static struct clk_lookup da850_clks[] = { CLK(NULL, "tpcc1", &tpcc1_clk), CLK(NULL, "tptc2", &tptc2_clk), CLK(NULL, "uart0", &uart0_clk), + CLK(NULL, "pru_ck", &pru_clk), CLK(NULL, "uart1", &uart1_clk), CLK(NULL, "uart2", &uart2_clk), CLK(NULL, "aintc", &aintc_clk), @@ -542,7 +549,12 @@ static const struct mux_config da850_pins[] = { MUX_CFG(DA850, EMA_CLK, 6, 0, 15, 1, false) MUX_CFG(DA850, EMA_WAIT_1, 6, 24, 15, 1, false) MUX_CFG(DA850, NEMA_CS_2, 7, 0, 15, 1, false) + /* PRU functions for soft CAN */ + MUX_CFG(DA850, PRU0_R31_0, 7, 28, 15, 0, false) + MUX_CFG(DA850, PRU1_R30_15, 12, 0, 15, 4, false) + MUX_CFG(DA850, PRU1_R31_18, 11, 20, 15, 0, false) /* GPIO function */ + MUX_CFG(DA850, GPIO2_0, 6, 28, 15, 8, false) MUX_CFG(DA850, GPIO2_6, 6, 4, 15, 8, false) MUX_CFG(DA850, GPIO2_8, 5, 28, 15, 8, false) MUX_CFG(DA850, GPIO2_15, 5, 0, 15, 8, false) diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c index 9eec630..9d1b110 100644 --- a/arch/arm/mach-davinci/devices-da8xx.c +++ b/arch/arm/mach-davinci/devices-da8xx.c @@ -85,6 +85,35 @@ struct platform_device da8xx_serial_device = { }, }; +/* Info specific to OMAPL138 */ +#define OMAPL138_PRU_MEM_BASE 0x01C30000 +#define OMAPL138_INT_PRU_CAN IRQ_DA8XX_EVTOUT0 +static struct resource omapl138_pru_can_resources[] = { + { + .start = OMAPL138_PRU_MEM_BASE, + .end = OMAPL138_PRU_MEM_BASE + 0xFFFF, + .flags = IORESOURCE_MEM, + }, + { + .start = OMAPL138_INT_PRU_CAN, + .end = OMAPL138_INT_PRU_CAN, + .flags = IORESOURCE_IRQ, + }, +}; + +/* Info specific to CAN conroller */ +static struct platform_device omapl138_pru_can_device = { + .name = "davinci_pru_can", + .id = -1, + .num_resources = ARRAY_SIZE(omapl138_pru_can_resources), + .resource = omapl138_pru_can_resources, +}; + +int __init da8xx_register_pru_can(void) +{ + return platform_device_register(&omapl138_pru_can_device); +} + static const s8 da8xx_queue_tc_mapping[][2] = { /* {event queue no, TC no} */ {0, 0}, diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h index 4247b3f..3e88676 100644 --- a/arch/arm/mach-davinci/include/mach/da8xx.h +++ b/arch/arm/mach-davinci/include/mach/da8xx.h @@ -74,6 +74,7 @@ int da8xx_register_watchdog(void); int da8xx_register_usb20(unsigned mA, unsigned potpgt); int da8xx_register_usb11(struct da8xx_ohci_root_hub *pdata); int da8xx_register_emac(void); +int da8xx_register_pru_can(void); int da8xx_register_lcdc(struct da8xx_lcdc_platform_data *pdata); int da8xx_register_mmcsd0(struct davinci_mmc_config *config); int da850_register_mmcsd1(struct davinci_mmc_config *config); @@ -122,6 +123,7 @@ extern const short da850_uart2_pins[]; extern const short da850_i2c0_pins[]; extern const short da850_i2c1_pins[]; extern const short da850_cpgmac_pins[]; +extern const short da850_pru_can_pins[]; extern const short da850_mcasp_pins[]; extern const short da850_lcdcntl_pins[]; extern const short da850_mmcsd0_pins[]; diff --git a/arch/arm/mach-davinci/include/mach/mux.h b/arch/arm/mach-davinci/include/mach/mux.h index de11aac..7c07863 100644 --- a/arch/arm/mach-davinci/include/mach/mux.h +++ b/arch/arm/mach-davinci/include/mach/mux.h @@ -906,8 +906,13 @@ enum davinci_da850_index { DA850_EMA_CLK, DA850_EMA_WAIT_1, DA850_NEMA_CS_2, + /* PRU I/O */ + DA850_PRU0_R31_0, + DA850_PRU1_R30_15, + DA850_PRU1_R31_18, /* GPIO function */ + DA850_GPIO2_0, DA850_GPIO2_6, DA850_GPIO2_8, DA850_GPIO2_15,