From patchwork Tue Dec 28 11:26:23 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inki Dae X-Patchwork-Id: 436001 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oBSBNZgG014223 for ; Tue, 28 Dec 2010 11:26:23 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753221Ab0L1L0W (ORCPT ); Tue, 28 Dec 2010 06:26:22 -0500 Received: from mailout3.samsung.com ([203.254.224.33]:30695 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753084Ab0L1L0W (ORCPT ); Tue, 28 Dec 2010 06:26:22 -0500 Received: from epmmp2 (mailout3.samsung.com [203.254.224.33]) by mailout3.samsung.com (Oracle Communications Messaging Exchange Server 7u4-19.01 64bit (built Sep 7 2010)) with ESMTP id <0LE400HB3YFW7M00@mailout3.samsung.com> for linux-fbdev@vger.kernel.org; Tue, 28 Dec 2010 20:26:20 +0900 (KST) Received: from TNRNDGASPAPP1.tn.corp.samsungelectronics.net ([165.213.149.150]) by mmp2.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0LE400H84YFXE9@mmp2.samsung.com> for linux-fbdev@vger.kernel.org; Tue, 28 Dec 2010 20:26:21 +0900 (KST) Received: from localhost.localdomain ([10.89.10.123]) by TNRNDGASPAPP1.tn.corp.samsungelectronics.net with Microsoft SMTPSVC(6.0.3790.4675); Tue, 28 Dec 2010 20:26:20 +0900 Date: Tue, 28 Dec 2010 20:26:23 +0900 From: Inki Dae Subject: [PATCH 3/5] S5PC110: add machine specific MIPI-DSI setup code. To: linux-fbdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: kyungmin.park@samsung.com, lethal@linux-sh.org, akpm@linux-foundation.org, Inki Dae Message-id: <1293535583-24789-1-git-send-email-inki.dae@samsung.com> X-Mailer: git-send-email 1.7.0.4 Content-transfer-encoding: 7BIT X-OriginalArrivalTime: 28 Dec 2010 11:26:20.0541 (UTC) FILETIME=[0D11A2D0:01CBA682] Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Tue, 28 Dec 2010 11:26:23 +0000 (UTC) diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig index 862f239..76da541 100644 --- a/arch/arm/mach-s5pv210/Kconfig +++ b/arch/arm/mach-s5pv210/Kconfig @@ -53,6 +53,11 @@ config S5PV210_SETUP_SDHCI_GPIO help Common setup code for SDHCI gpio. +config S5P_SETUP_MIPI_DSI + bool + help + Common setup code for MIPI-DSI + menu "S5PC110 Machines" config MACH_AQUILA @@ -92,6 +97,7 @@ config MACH_GONI select S5PV210_SETUP_I2C2 select S5PV210_SETUP_KEYPAD select S5PV210_SETUP_SDHCI + select S5P_SETUP_MIPI_DSI help Machine support for Samsung GONI board S5PC110(MCP) is one of package option of S5PV210 diff --git a/arch/arm/mach-s5pv210/Makefile b/arch/arm/mach-s5pv210/Makefile index ff1a0db..638747c 100644 --- a/arch/arm/mach-s5pv210/Makefile +++ b/arch/arm/mach-s5pv210/Makefile @@ -37,3 +37,4 @@ obj-$(CONFIG_S5PV210_SETUP_IDE) += setup-ide.o obj-$(CONFIG_S5PV210_SETUP_KEYPAD) += setup-keypad.o obj-$(CONFIG_S5PV210_SETUP_SDHCI) += setup-sdhci.o obj-$(CONFIG_S5PV210_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o +obj-$(CONFIG_S5P_SETUP_MIPI_DSI) += setup-mipi.o \ No newline at end of file diff --git a/arch/arm/mach-s5pv210/setup-mipi.c b/arch/arm/mach-s5pv210/setup-mipi.c new file mode 100644 index 0000000..2cc8cd1 --- /dev/null +++ b/arch/arm/mach-s5pv210/setup-mipi.c @@ -0,0 +1,76 @@ +/* linux/arch/arm/plat-s5p/setup-mipi.c + * + * Samsung MIPI-DSI DPHY driver. + * + * Author: InKi Dae + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +static int s5p_mipi_enable_d_phy(struct dsim_device *dsim, unsigned int enable) +{ + unsigned int reg; + + reg = readl(S5P_MIPI_CONTROL) & ~(1 << 0); + reg |= (enable << 0); + writel(reg, S5P_MIPI_CONTROL); + + return 0; +} + +static int s5p_mipi_enable_dsi_master(struct dsim_device *dsim, + unsigned int enable) +{ + unsigned int reg; + + reg = readl(S5P_MIPI_CONTROL) & ~(1 << 2); + reg |= (enable << 2); + writel(reg, S5P_MIPI_CONTROL); + + return 0; +} + +int s5p_mipi_part_reset(struct dsim_device *dsim) +{ + writel(S5P_MIPI_M_RESETN, S5P_MIPI_PHY_CON0); + + return 0; +} + +int s5p_mipi_init_d_phy(struct dsim_device *dsim) +{ + /** + * DPHY and Master block must be enabled at the system initialization + * step before data access from/to DPHY begins. + */ + s5p_mipi_enable_d_phy(dsim, 1); + + s5p_mipi_enable_dsi_master(dsim, 1); + + return 0; +}