From patchwork Fri Dec 31 12:18:10 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Subhasish Ghosh X-Patchwork-Id: 442221 Received: from comal.ext.ti.com (comal.ext.ti.com [198.47.26.152]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oBVC5Fin002294 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 31 Dec 2010 12:05:39 GMT Received: from dlep34.itg.ti.com ([157.170.170.115]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id oBVC5E6r029880 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 31 Dec 2010 06:05:14 -0600 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep34.itg.ti.com (8.13.7/8.13.7) with ESMTP id oBVC5CoN000725 for ; Fri, 31 Dec 2010 06:05:13 -0600 (CST) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id BE6B78066C for ; Fri, 31 Dec 2010 06:05:08 -0600 (CST) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp53.itg.ti.com (dflp53.itg.ti.com [128.247.5.6]) by linux.omap.com (Postfix) with ESMTP id 4D88D80626 for ; Fri, 31 Dec 2010 06:05:03 -0600 (CST) Received: from medina.ext.ti.com (localhost [127.0.0.1]) by dflp53.itg.ti.com (8.13.8/8.13.8) with ESMTP id oBVC53CI015821 for ; Fri, 31 Dec 2010 06:05:03 -0600 (CST) Received: from psmtp.com (na3sys009amx165.postini.com [74.125.149.91]) by medina.ext.ti.com (8.13.7/8.13.7) with SMTP id oBVC52Gp003374 for ; Fri, 31 Dec 2010 06:05:02 -0600 Received: from source ([209.85.210.45]) by na3sys009amx165.postini.com ([74.125.148.10]) with SMTP; Fri, 31 Dec 2010 07:05:02 EST Received: by pzk2 with SMTP id 2so3032828pzk.4 for ; Fri, 31 Dec 2010 04:05:02 -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=Y1l+iF3bi4jBbPOkig4i4RoT7tqh8Kxx87xKU+3c8N0=; b=X1CnG/84syrjntpw2gWNbWaAarjlbqOFdXGTjh1j35bphKMP/ZHe8/TFJf4AUlI9Cv bmEVQ8YRqcr0k9V6DgUk29aPDqstC5g/wasQkbeITH0u4h4ToPCz+uZjStLwDkUJU0k9 pWOHLlbKr96Dv0wp/NtGDQ0UeCCbz5KTRshEU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=lp8H5r4Bj3RNN2QMLjGLXvjG2uFsG7MloqDqQKD/7L12dDVVR6XmGZ11NfPGVxC6ec /i78rTSetprsXSwNLvYCM/9P4i0E7MUg9FpCckORh4dYhqeFJXcIFCzP5lMexZ7ATvq5 FeYuGmgIetcEvnYEFacyzLEJVwr0gu7C0Zt18= Received: by 10.142.72.17 with SMTP id u17mr3718584wfa.300.1293797102056; Fri, 31 Dec 2010 04:05:02 -0800 (PST) Received: from localhost ([59.97.0.30]) by mx.google.com with ESMTPS id f5sm23969126wfg.14.2010.12.31.04.04.58 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 31 Dec 2010 04:05:01 -0800 (PST) From: Subhasish Ghosh To: davinci-linux-open-source@linux.davincidsp.com Subject: [RFC: PATCH 1/5] da850: Support for TI's PRU SoftUART Emulation Date: Fri, 31 Dec 2010 17:48:10 +0530 Message-Id: <1293797894-15964-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:28.11397/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, sshtylyov@mvista.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+patchwork-davinci=patchwork.kernel.org@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces+patchwork-davinci=patchwork.kernel.org@linux.davincidsp.com X-Greylist: Sender succeeded STARTTLS authentication, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Fri, 31 Dec 2010 12:05:39 +0000 (UTC) diff --git a/arch/arm/mach-davinci/Makefile b/arch/arm/mach-davinci/Makefile index 0b87a1c..6eb4f28 100644 --- a/arch/arm/mach-davinci/Makefile +++ b/arch/arm/mach-davinci/Makefile @@ -5,7 +5,7 @@ # Common objects obj-y := time.o clock.o serial.o io.o psc.o \ - gpio.o dma.o usb.o common.o sram.o aemif.o + gpio.o dma.o usb.o common.o sram.o aemif.o pru.o obj-$(CONFIG_DAVINCI_MUX) += mux.o diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c index 78b5ae2..4e34784 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 = "pruss", + .parent = &pll0_sysclk2, + .lpsc = DA8XX_LPSC0_DMAX, +}; + static struct clk uart0_clk = { .name = "uart0", .parent = &pll0_sysclk2, @@ -318,6 +324,14 @@ static struct clk mcasp_clk = { .flags = DA850_CLK_ASYNC3, }; +static struct clk mcasp_pru_clk = { + .name = "mcasp_pru", + .parent = &pll0_sysclk2, + .lpsc = DA8XX_LPSC1_McASP0, + .gpsc = 1, + .flags = DA850_CLK_ASYNC3, +}; + static struct clk lcdc_clk = { .name = "lcdc", .parent = &pll0_sysclk2, @@ -373,6 +387,7 @@ static struct clk_lookup da850_clks[] = { CLK(NULL, "tpcc1", &tpcc1_clk), CLK(NULL, "tptc2", &tptc2_clk), CLK(NULL, "uart0", &uart0_clk), + CLK(NULL, "pruss", &pru_clk), CLK(NULL, "uart1", &uart1_clk), CLK(NULL, "uart2", &uart2_clk), CLK(NULL, "aintc", &aintc_clk), @@ -381,6 +396,7 @@ static struct clk_lookup da850_clks[] = { CLK(NULL, "emif3", &emif3_clk), CLK(NULL, "arm", &arm_clk), CLK(NULL, "rmii", &rmii_clk), + CLK(NULL, "mcasp_pru", &mcasp_pru_clk), CLK("davinci_emac.1", NULL, &emac_clk), CLK("davinci-mcasp.0", NULL, &mcasp_clk), CLK("da8xx_lcdc.0", NULL, &lcdc_clk), diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c index 9eec630..12583cf 100644 --- a/arch/arm/mach-davinci/devices-da8xx.c +++ b/arch/arm/mach-davinci/devices-da8xx.c @@ -85,7 +85,90 @@ struct platform_device da8xx_serial_device = { }, }; -static const s8 da8xx_queue_tc_mapping[][2] = { + +#define OMAPL138_PRU_MEM_BASE 0x01C30000 + +#define OMAPL138_INT_PRU_SUART_1 IRQ_DA8XX_EVTOUT0 +#define OMAPL138_INT_PRU_SUART_2 IRQ_DA8XX_EVTOUT1 +#define OMAPL138_INT_PRU_SUART_3 IRQ_DA8XX_EVTOUT2 +#define OMAPL138_INT_PRU_SUART_4 IRQ_DA8XX_EVTOUT3 +#define OMAPL138_INT_PRU_SUART_5 IRQ_DA8XX_EVTOUT4 +#define OMAPL138_INT_PRU_SUART_6 IRQ_DA8XX_EVTOUT5 +#define OMAPL138_INT_PRU_SUART_7 IRQ_DA8XX_EVTOUT6 +#define OMAPL138_INT_PRU_SUART_8 IRQ_DA8XX_EVTOUT7 + +static struct resource omapl138_pru_suart_resources[] = { + { + .name = "omapl_pru_suart", + .start = OMAPL138_PRU_MEM_BASE, + .end = OMAPL138_PRU_MEM_BASE + 0xFFFF, + .flags = IORESOURCE_MEM, + }, + { + .start = DAVINCI_DA8XX_MCASP0_REG_BASE, + .end = DAVINCI_DA8XX_MCASP0_REG_BASE + (SZ_1K * 12) - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = DA8XX_SHARED_RAM_BASE, + .end = DA8XX_SHARED_RAM_BASE + (SZ_1K * 8) - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = OMAPL138_INT_PRU_SUART_1, + .end = OMAPL138_INT_PRU_SUART_1, + .flags = IORESOURCE_IRQ, + }, + { + .start = OMAPL138_INT_PRU_SUART_2, + .end = OMAPL138_INT_PRU_SUART_2, + .flags = IORESOURCE_IRQ, + }, + { + .start = OMAPL138_INT_PRU_SUART_3, + .end = OMAPL138_INT_PRU_SUART_3, + .flags = IORESOURCE_IRQ, + }, + { + .start = OMAPL138_INT_PRU_SUART_4, + .end = OMAPL138_INT_PRU_SUART_4, + .flags = IORESOURCE_IRQ, + }, + { + .start = OMAPL138_INT_PRU_SUART_5, + .end = OMAPL138_INT_PRU_SUART_5, + .flags = IORESOURCE_IRQ, + }, + { + .start = OMAPL138_INT_PRU_SUART_6, + .end = OMAPL138_INT_PRU_SUART_6, + .flags = IORESOURCE_IRQ, + }, + { + .start = OMAPL138_INT_PRU_SUART_7, + .end = OMAPL138_INT_PRU_SUART_7, + .flags = IORESOURCE_IRQ, + }, + { + .start = OMAPL138_INT_PRU_SUART_8, + .end = OMAPL138_INT_PRU_SUART_8, + .flags = IORESOURCE_IRQ, + }, +}; + +struct platform_device omapl_pru_suart_device = { + .name = "davinci_pru_suart", + .id = -1, + .num_resources = ARRAY_SIZE(omapl138_pru_suart_resources), + .resource = omapl138_pru_suart_resources, +}; + +int __init da8xx_register_pru_suart(void) +{ + return platform_device_register(&omapl_pru_suart_device); +} + +static const s8 da8xx_queue_tc_mapping[][2] = { /* {event queue no, TC no} */ {0, 0}, {1, 1}, diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h index e7f9520..d1d1eed 100644 --- a/arch/arm/mach-davinci/include/mach/da8xx.h +++ b/arch/arm/mach-davinci/include/mach/da8xx.h @@ -81,6 +81,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_suart(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); diff --git a/arch/arm/mach-davinci/include/mach/memory.h b/arch/arm/mach-davinci/include/mach/memory.h index 22eb97c..d3e48d9 100644 --- a/arch/arm/mach-davinci/include/mach/memory.h +++ b/arch/arm/mach-davinci/include/mach/memory.h @@ -22,6 +22,7 @@ **************************************************************************/ #define DAVINCI_DDR_BASE 0x80000000 #define DA8XX_DDR_BASE 0xc0000000 +#define DA8XX_SHARED_RAM_BASE 0x80000000 #if defined(CONFIG_ARCH_DAVINCI_DA8XX) && defined(CONFIG_ARCH_DAVINCI_DMx) #error Cannot enable DaVinci and DA8XX platforms concurrently