From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753360AbbCSBlZ (ORCPT ); Wed, 18 Mar 2015 21:41:25 -0400 Received: from mail-by2on0135.outbound.protection.outlook.com ([207.46.100.135]:53802 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750799AbbCSBlT (ORCPT ); Wed, 18 Mar 2015 21:41:19 -0400 From: "Jianwei.Wang@freescale.com" To: Stefan Agner CC: Scott Wood , "airlied@linux.ie" , "jbarnes@virtuousgeek.org" , "dri-devel@lists.freedesktop.org" , Xiubo Li , Huan Wang , "linux-kernel@vger.kernel.org" , "Jason.Jin@freescale.com" , "linux-arm-kernel@lists.infradead.org" Subject: RE: [PATCH 1/3] drm/layerscape: Add fsl dcu DRM driver Thread-Topic: [PATCH 1/3] drm/layerscape: Add fsl dcu DRM driver Thread-Index: AQHQXXLMHb2T5TMNDEuHfaMSI6grRp0i4xuAgAApi9A= Date: Thu, 19 Mar 2015 01:41:14 +0000 Message-ID: References: <1426239859-29254-1-git-send-email-b52261@freescale.com> In-Reply-To: Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [199.59.231.64] authentication-results: agner.ch; dkim=none (message not signed) header.d=none; x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM2PR0301MB0878;UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM2PR0301MB1182; x-forefront-antispam-report: BMV:1;SFV:NSPM;SFS:(10019020)(6009001)(13464003)(377454003)(377424004)(51704005)(33656002)(99286002)(40100003)(46102003)(110136001)(106116001)(86362001)(122556002)(19580395003)(19580405001)(102836002)(575784001)(2900100001)(77156002)(1720100001)(2950100001)(15975445007)(5890100001)(66066001)(62966003)(2656002)(92566002)(54356999)(76576001)(50986999)(74316001)(87936001)(579004)(559001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM2PR0301MB0878;H:DM2PR0301MB1229.namprd03.prod.outlook.com;FPR:;SPF:None;MLV:sfv;LANG:en; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(601004)(5002010)(5005006);SRVR:DM2PR0301MB0878;BCL:0;PCL:0;RULEID:;SRVR:DM2PR0301MB0878; x-forefront-prvs: 052017CAF1 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Mar 2015 01:41:14.1120 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR0301MB0878 X-OriginatorOrg: freescale.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by nfs id t2J1fY5B013788 Hi Stefan, Thank you for your comment. I'll correct this next time. > -----Original Message----- > From: Stefan Agner [mailto:stefan@agner.ch] > Sent: Thursday, March 19, 2015 6:58 AM > To: Wang Jianwei-B52261 > Cc: Wood Scott-B07421; airlied@linux.ie; jbarnes@virtuousgeek.org; dri- > devel@lists.freedesktop.org; Xiubo Li; Wang Huan-B18965; linux- > kernel@vger.kernel.org; Jin Zhengxiong-R64188; linux-arm- > kernel@lists.infradead.org > Subject: Re: [PATCH 1/3] drm/layerscape: Add fsl dcu DRM driver > > Hi Jianwei, > > Normally, for the second and higher iteration of a patchset, developers > add the version to the subject (e.g. PATCH v2). You can use the --reroll- > count option when creating the patches with git format-patch. > > On 2015-03-13 10:44, Jianwei Wang wrote: > > This patch add support for Two Dimensional Animation and Compositing > > Engine (2D-ACE) on Freescale SoCs. > > > > 2D-ACE is a Freescale display controller. It provide an hardware > > cursor. > > > > This is a simplified version, only a primary plane, a fb created for > > fbdev, a crtc, a connector for TFT LCD panel, an encoder, and the > > encoder is not in use. > > > > Signed-off-by: Alison Wang > > Signed-off-by: Xiubo Li > > Signed-off-by: Jianwei Wang > > --- > > > > Changed in v2: > > - Add atomic support > > - Modify bindings file > > - Rename node for compatibility > > - Move platform related code out for compatibility > > > > Added in v1: > > - Add support for DCU display controller on the Freescale LS102x SoCs. > > - Create a primary plane, a fb created for fbdev, a crtc, a connector > > for TFT LCD panel, an encoder. > > > > arch/arm/mach-imx/mach-ls1021a.c | 36 ++++ > > drivers/gpu/drm/Kconfig | 2 + > > drivers/gpu/drm/Makefile | 1 + > > drivers/gpu/drm/fsl/Kconfig | 17 ++ > > drivers/gpu/drm/fsl/Makefile | 8 + > > drivers/gpu/drm/fsl/fsl_dcu_drm_connector.c | 203 > > ++++++++++++++++++++ drivers/gpu/drm/fsl/fsl_dcu_drm_connector.h | 28 > +++ > > drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.c | 164 ++++++++++++++++ > > drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.h | 26 +++ > > drivers/gpu/drm/fsl/fsl_dcu_drm_drv.c | 288 > ++++++++++++++++++++++++++++ > > drivers/gpu/drm/fsl/fsl_dcu_drm_drv.h | 168 ++++++++++++++++ > > drivers/gpu/drm/fsl/fsl_dcu_drm_fbdev.c | 26 +++ > > drivers/gpu/drm/fsl/fsl_dcu_drm_kms.c | 42 ++++ > > drivers/gpu/drm/fsl/fsl_dcu_drm_kms.h | 17 ++ > > drivers/gpu/drm/fsl/fsl_dcu_drm_plane.c | 187 ++++++++++++++++++ > > drivers/gpu/drm/fsl/fsl_dcu_drm_plane.h | 23 +++ > > include/linux/fsl/dcu.h | 22 +++ > > 17 files changed, 1258 insertions(+) > > create mode 100644 drivers/gpu/drm/fsl/Kconfig create mode 100644 > > drivers/gpu/drm/fsl/Makefile create mode 100644 > > drivers/gpu/drm/fsl/fsl_dcu_drm_connector.c > > create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_connector.h > > create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.c > > create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_crtc.h > > create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_drv.c > > create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_drv.h > > create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_fbdev.c > > create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_kms.c > > create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_kms.h > > create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_plane.c > > create mode 100644 drivers/gpu/drm/fsl/fsl_dcu_drm_plane.h > > create mode 100644 include/linux/fsl/dcu.h > > > > diff --git a/arch/arm/mach-imx/mach-ls1021a.c > > b/arch/arm/mach-imx/mach-ls1021a.c > > index b89c858..4fb346d 100644 > > --- a/arch/arm/mach-imx/mach-ls1021a.c > > +++ b/arch/arm/mach-imx/mach-ls1021a.c > > @@ -8,9 +8,44 @@ > > */ > > > > #include > > +#include > > +#include > > +#include > > +#include > > > > #include "common.h" > > > > +void dcu_pixclk_disable(void) > > +{ > > + struct regmap *scfg_regmap; > > + > > + scfg_regmap = syscon_regmap_lookup_by_compatible("fsl,ls1021a-scfg"); > > + if (IS_ERR(scfg_regmap)) { > > + pr_err("No syscfg phandle specified\n"); > > + return; > > + } > > + > > + regmap_write(scfg_regmap, SCFG_PIXCLKCR, PXCK_DISABLE); } > > + > > +void dcu_pixclk_enable(void) > > +{ > > + struct regmap *scfg_regmap; > > + > > + scfg_regmap = syscon_regmap_lookup_by_compatible("fsl,ls1021a-scfg"); > > + if (IS_ERR(scfg_regmap)) { > > + pr_err("No syscfg phandle specified\n"); > > + return; > > + } > > + > > + regmap_write(scfg_regmap, SCFG_PIXCLKCR, PXCK_ENABLE); } > > + > > +static void __init ls1021a_init_machine(void) { > > + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); > > + dcu_pixclk_enable(); > > +} > > This change should be in a separate patch. However, I'm not convinced that > the current code is the right solution. You should try to avoid calling > from the driver directly into arch code. > > I don't have access to the reference manual, hence I can't lookup that > module. But this register looks just like a clock gate... > > On Vybrid, the Pixelclock is enabled through CCM_CSCDR3 and friends, and > the CCM module makes use of the common clock framework. In the end, the > clock is assigned to the nodes (e.g. DCU node in this case) and requested > during runtime. The framework makes sure the clock and the relevant gates > get enabled. See: > http://lxr.free-electrons.com/source/arch/arm/mach-imx/clk- > vf610.c?v=3.12#L241 > > -- > Stefan > > > static const char * const ls1021a_dt_compat[] __initconst = { > > "fsl,ls1021a", > > NULL, > > @@ -18,5 +53,6 @@ static const char * const ls1021a_dt_compat[] > > __initconst = { > > > > DT_MACHINE_START(LS1021A, "Freescale LS1021A") > > .smp = smp_ops(ls1021a_smp_ops), > > + .init_machine = ls1021a_init_machine, > > .dt_compat = ls1021a_dt_compat, > > MACHINE_END > > diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index > > 151a050..a6957aa 100644 > > --- a/drivers/gpu/drm/Kconfig > > +++ b/drivers/gpu/drm/Kconfig > > @@ -199,6 +199,8 @@ source "drivers/gpu/drm/bochs/Kconfig" > > > > source "drivers/gpu/drm/msm/Kconfig" > > > > +source "drivers/gpu/drm/fsl/Kconfig" > > + > > source "drivers/gpu/drm/tegra/Kconfig" > > > > source "drivers/gpu/drm/panel/Kconfig" > > diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index > > 2c239b9..ab5b9ef 100644 > > --- a/drivers/gpu/drm/Makefile > > +++ b/drivers/gpu/drm/Makefile > > @@ -56,6 +56,7 @@ obj-$(CONFIG_DRM_UDL) += udl/ > > obj-$(CONFIG_DRM_AST) += ast/ > > obj-$(CONFIG_DRM_ARMADA) += armada/ > > obj-$(CONFIG_DRM_ATMEL_HLCDC) += atmel-hlcdc/ > > +obj-$(CONFIG_DRM_FSL_DCU) += fsl/ > > obj-$(CONFIG_DRM_RCAR_DU) += rcar-du/ > > obj-$(CONFIG_DRM_SHMOBILE) +=shmobile/ > > obj-$(CONFIG_DRM_OMAP) += omapdrm/ > > diff --git a/drivers/gpu/drm/fsl/Kconfig b/drivers/gpu/drm/fsl/Kconfig > > new file mode 100644 index 0000000..e4f8df0 > > --- /dev/null > > +++ b/drivers/gpu/drm/fsl/Kconfig > > @@ -0,0 +1,17 @@ > > +config DRM_FSL_DCU > > + tristate "DRM Support for Freescale DCU" > > + depends on DRM && OF && ARM > > + select DRM_KMS_HELPER > > + select DRM_KMS_CMA_HELPER > > + select VIDEOMODE_HELPERS > > + select BACKLIGHT_CLASS_DEVICE > > + select BACKLIGHT_LCD_SUPPORT > > + select REGMAP_MMIO > > + select DRM_KMS_FB_HELPER > > + select FB_SYS_FILLRECT > > + select FB_SYS_COPYAREA > > + select FB_SYS_IMAGEBLIT > > + select FB_SYS_FOPS > > + help > > + Choose this option if you have an Freescale DCU chipset. > > + If M is selected the module will be called fsl-dcu-drm. > > diff --git a/drivers/gpu/drm/fsl/Makefile > > b/drivers/gpu/drm/fsl/Makefile new file mode 100644 index > > 0000000..5f74aee > > --- /dev/null > > +++ b/drivers/gpu/drm/fsl/Makefile > > @@ -0,0 +1,8 @@ > > +fsl-dcu-drm-y := fsl_dcu_drm_drv.o \ > > + fsl_dcu_drm_kms.o \ > > + fsl_dcu_drm_connector.o \ > > + fsl_dcu_drm_plane.o \ > > + fsl_dcu_drm_crtc.o \ > > + fsl_dcu_drm_fbdev.o \ > > + > > +obj-$(CONFIG_DRM_FSL_DCU) += fsl-dcu-drm.o > > diff --git a/drivers/gpu/drm/fsl/fsl_dcu_drm_connector.c > > b/drivers/gpu/drm/fsl/fsl_dcu_drm_connector.c > > new file mode 100644 > > index 0000000..178d647 > > --- /dev/null > > +++ b/drivers/gpu/drm/fsl/fsl_dcu_drm_connector.c > > @@ -0,0 +1,203 @@ > > +/* > > + * Copyright 2015 Freescale Semiconductor, Inc. > > + * > > + * Freescale DCU drm device driver > > + * > > + * 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. > > + */ > > + > > +#include > > + > > +#include > > +#include > > +#include