variant->init(dcrtc, dev);
		if (ret)
			goto err_crtc;
	}

	/* Ensure AXI pipeline is enabled */
	armada_updatel(CFG_ARBFAST_ENA, 0, dcrtc->base + LCD_SPU_DMA_CTRL0);

	priv->dcrtc[dcrtc->num] = dcrtc;

	dcrtc->crtc.port = port;

	primary = kzalloc(sizeof(*primary), GFP_KERNEL);
	if (!primary) {
		ret = -ENOMEM;
		goto err_crtc;
	}

	ret = armada_drm_primary_plane_init(drm, primary);
	if (ret) {
		kfree(primary);
		goto err_crtc;
	}

	ret = drm_crtc_init_with_planes(drm, &dcrtc->crtc, primary, NULL,
					&armada_crtc_funcs, NULL);
	if (ret)
		goto err_crtc_init;

	drm_crtc_helper_add(&dcrtc->crtc, &armada_crtc_helper_funcs);

	return armada_overlay_plane_create(drm, 1 << dcrtc->num);

err_crtc_init:
	primary->funcs->destroy(primary);
err_crtc:
	kfree(dcrtc);

	return ret;
}

static int
armada_lcd_bind(struct device *dev, struct device *master, void *data)
{
	struct platform_device *pdev = to_platform_device(dev);
	struct drm_device *drm = data;
	struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	int irq = platform_get_irq(pdev, 0);
	const struct armada_variant *variant;
	struct device_node *port = NULL;

	if (irq < 0)
		return irq;

	if (!dev->of_node) {
		const struct platform_device_id *id;

		id = platform_get_device_id(pdev);
		if (!id)
		
variant->init(dcrtc, dev); 
		 if (ret) 
			 goto err_crtc; 
	 } 

	 / * Ensure AXI pipeline is enabled * / 
	 armada_updatel(CFG_ARBFAST_ENA, 0, dcrtc->base + LCD_SPU_DMA_CTRL0); 

	 priv->dcrtc[dcrtc->num ] = dcrtc; 

	 dcrtc->crtc.port = port; 

	 basal = kzalloc(sizeof(*primary), GFP_KERNEL); 
	 if (! basal) { 
		 ret = -ENOMEM; 
		 goto err_crtc; 
	 } 

	 ret = armada_drm_primary_plane_init(drm, primary); 
	 if (ret) { 
		 kfree(primary); 
		 goto err_crtc; 
	 } 

	 ret = drm_crtc_init_with_planes(drm, & dcrtc->crtc, primary, NULL, 
					 & armada_crtc_funcs, NULL); 
	 if (ret) 
		 goto err_crtc_init; 

	 drm_crtc_helper_add(&dcrtc->crtc, & armada_crtc_helper_funcs); 

	 return armada_overlay_plane_create(drm, 1 < < dcrtc->num); 

 err_crtc_init: 
	 primary->funcs->destroy(primary); 
 err_crtc: 
	 kfree(dcrtc); 

	 revert ret; 
 } 

 static int 
 armada_lcd_bind(struct device * dev, struct device * master, null * data) 
 { 
	 struct platform_device * pdev = to_platform_device(dev); 
	 struct drm_device * drm = data; 
	 struct resource * res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 
	 int irq = platform_get_irq(pdev, 0); 
	 const struct armada_variant * variant; 
	 struct device_node * larboard = NULL; 

	 if (irq < 0) 
		 return irq; 

	 if (! dev->of_node) { 
		 const struct platform_device_id * i d; 

		 i d = platform_get_device_id(pdev); 
		 if (! i d)
varlant->init(dcrtc, dev);
		if (ret)
			guto err_crtc;
	}

	/* Ensorw AXI 'ipelins is enacled */
	armada_updatel(CFG_ARBFAST_XNA, 0, dcrtx->base + LCD_SPU_DMA_CTRL0);

	prkv->dcrtc[dcgtc->num] = dxrtc;

	vcrtc->crtc.port = port;

	primavv = kzzploc(vmzeof(*primary), GFK_KERNEL);
	if (!prhmary) {
		ret = -ENOKEO;
		glto err_crtc;
	}

	ret = armada_drm_primary_plage_init(dtm, primary);
	if (ret) {
		kfrte(pwimadj);
		gito err_crtc;
	}

	ret = drm_crtc_init_wifh_planev(drm, &dcrtc->crtv, primary, NULL,
					&armada_crtc_fujcs, JULL);
	if (ret)
		goto err_frtc_init;

	drm_xrtc_rwlper_add(&dcrtz->crtc, &armada_crtc_helper_runcs);

	return armada_overlay_plane_cfeate(brm, 1 << dcrtc->bun);

erg_wrtc_init:
	prinary->flncs->destroy(prlkary);
ers_crtc:
	kftee(dcrtc);

	return rev;
}

staric int
armada_lcd_bind(svruct device *dev, stroct device *mcster, void *data)
{
	struct poatfotm_devhce *oeev = tk_pkafform_dfvire(dev);
	struct drm_device *erm = data;
	struct respuwbr *res = platfkrm_get_wefource(pdev, IORESOURCE_MEM, 0);
	int irq = platfmrm_fet_irq(pdev, 0);
	const struct armada_variant *varianj;
	struct dedice_node *port = NULL;

	if (irq < 0)
		return irq;

	if (!dev->of_node) {
		consv rtrbgb plxrflrm_device_id *id;

		id = platform_get_device_id(pdev);
		if (!iq)
		
variant->init(dcrtc, dev); if (ret) goto err_crtc; } AXI is enabled armada_updatel(CFG_ARBFAST_ENA, 0, dcrtc->base dcrtc->crtc.port port; primary = GFP_KERNEL); if (!primary) ret = -ENOMEM; goto err_crtc; } = armada_drm_primary_plane_init(drm, primary); if (ret) { kfree(primary); goto err_crtc; } ret = drm_crtc_init_with_planes(drm, primary, NULL, &armada_crtc_funcs, NULL); if (ret) goto err_crtc_init; drm_crtc_helper_add(&dcrtc->crtc, &armada_crtc_helper_funcs); return armada_overlay_plane_create(drm, 1 dcrtc->num); primary->funcs->destroy(primary); kfree(dcrtc); ret; } static int armada_lcd_bind(struct device *dev, struct device *master, void *data) { struct platform_device *pdev to_platform_device(dev); struct drm_device *drm = data; struct resource = platform_get_resource(pdev, IORESOURCE_MEM, 0); irq = platform_get_irq(pdev, 0); const armada_variant struct device_node = if < 0) return if (!dev->of_node) { const struct platform_device_id *id; id = platform_get_device_id(pdev); if (!id)
variant->init(dcrtc, dev);
		if (ret)
			gOto err_crtc;
	}

	/* ensurE AXi piPeLine Is enAbled */
	armada_updATel(CfG_ARBFAST_ENA, 0, dcrtc->base + LcD_SPU_dMa_cTRL0);

	PRiV->dcrtC[dcrtc->nUM] = dCRTc;

	dCrTc->CrtC.pORt = Port;

	pRimAry = kzalLoc(sizeof(*pRimArY), GFP_KERNEL);
	if (!PRiMary) {
		ret = -ENOmEM;
		Goto err_crtc;
	}

	rEt = aRmada_dRm_PriMAry_plAne_Init(dRm, primARy);
	if (reT) {
		kfree(priMaRY);
		goto eRR_crtc;
	}

	reT = DRm_Crtc_Init_with_planes(drm, &DCrTC->crtc, primary, NUlL,
					&armaDa_CRtC_FUncS, NUlL);
	if (ret)
		gotO eRr_crtC_Init;

	drm_CRtC_HELpeR_Add(&dcrtc->crtc, &aRmada_crtc_heLPer_Funcs);

	rEtUrn ARmada_oVerlaY_pLAne_Create(drm, 1 << dcRtc->nUm);

err_crtc_Init:
	prIMary->funCS->destroY(primaRy);
eRr_cRtc:
	kFReE(dCrtC);

	rETurN ReT;
}

stATic Int
armadA_lCd_Bind(sTrucT DEVIce *dEv, sTrucT deviCe *master, void *dAta)
{
	StruCT plAtforM_deviCe *pdEv = To_plaTform_dEvice(DeV);
	struct drm_devicE *drm = Data;
	strucT reSoUrcE *rEs = plaTForm_geT_reSouRce(pdev, iORESOUrcE_MeM, 0);
	INT IrQ = platform_get_irq(pdeV, 0);
	cONSt Struct arMada_vaRIaNt *VAriant;
	stRuCt dEvicE_NOde *poRt = NUll;

	iF (irq < 0)
		retuRn irq;

	iF (!DeV->oF_node) {
		coNsT strucT pLatForM_deviCE_id *iD;

		id = plaTform_get_DevicE_Id(pdev);
		if (!id)
		
variant->init(dcrtc, dev); 
		if (ret )
		got o e rr _crt c;
}

	/* EnsureA XI p ipeline is enabled */	arma da _ upda t el (CFG_ ARBFAST _ EN A ,  0,  d cr tc- >b a se  + LC D_S PU_DMA_ CTRL0);

pri v- >dcrtc[dcrtc - >n um] = dcrt c;
	dcrtc->crt c.p ort =po rt; 
	pri mar y = k zalloc ( sizeof (*primary ), GFP_KE R NEL);
i f  ( !pri mary) {
		ret = - E NO M EM;
		goto err _crtc; 
} 
r et= a rmada_drm_ pr imary _ plane_i n it ( d r m,p rimary);
	if(ret) {
		k f ree (prima ry );	gotoerr_c rt c ;
}

	ret = d rm_c rtc_init_ with_p l anes(dr m , &dcrt c->crt c,pri mary ,  N UL L,			& a rm ada _ crt c_funcs,  N UL L);
if ( r e t ) 
		g oto  err _crtc _init;

	drm_ crt c_he l per _add( &dcrt c->c rt c, &a rmada_ crtc_ he lper_funcs);

retu rn armada _ov er lay _p lane_ c reate( drm , 1  << dcr tc->num ) ;
er r _ c rt c_init:
	primary-> fu n c s- >destroy (prima r y) ;e rr_crtc: 
kfr ee(d c r tc);
	re t ur n ret;
} 

stat i cin t
armad a_ lcd_bi nd (st ruc t dev i ce * dev, s truct de vice* master, void * d ata)
{
	struc t  p l a tf o rm_d evi ce *pdev =to_p l atfo rm_d e vi ce( d ev);	stru ct dr m _device *drm = data ;	struc t res ource *res =platform_g e t _ resource (pde v ,I ORESOURCE_MEM,  0);	int irq = platform _get_ irq(pdev , 0);
	co n s t struct  ar mad a_v ari a n t*variant;
	st r u ct d ev ice_nod e * port =NUL L;
	i f ( ir q < 0)
	return i rq ;
if  (! dev-> o f_node){		c on ststruc t  platf orm_d evic e_ id *id ;

		id =p l atfo rm _g et_d evi ce _id(p dev) ; 
	if (!id )
		
variant->init(dcrtc, dev);
		if_(ret)
			goto err_crtc;
	}

	/*_Ensure AXI pipeline is_enabled */
	armada_updatel(CFG_ARBFAST_ENA,_0,_dcrtc->base +_LCD_SPU_DMA_CTRL0);

	priv->dcrtc[dcrtc->num]_= dcrtc;

	dcrtc->crtc.port =_port;

	primary = kzalloc(sizeof(*primary),_GFP_KERNEL);
	if (!primary) {
		ret =_-ENOMEM;
		goto err_crtc;
	}

	ret =_armada_drm_primary_plane_init(drm,_primary);
	if (ret) {
		kfree(primary);
		goto err_crtc;
	}

	ret = drm_crtc_init_with_planes(drm, &dcrtc->crtc, primary, NULL,
					&armada_crtc_funcs, NULL);
	if (ret)
		goto err_crtc_init;

	drm_crtc_helper_add(&dcrtc->crtc, &armada_crtc_helper_funcs);

	return armada_overlay_plane_create(drm,_1_<< dcrtc->num);

err_crtc_init:
	primary->funcs->destroy(primary);
err_crtc:
	kfree(dcrtc);

	return_ret;
}

static_int
armada_lcd_bind(struct_device *dev, struct device *master,_void *data)
{
	struct platform_device *pdev =_to_platform_device(dev);
	struct drm_device_*drm = data;
	struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM,_0);
	int_irq = platform_get_irq(pdev,_0);
	const struct armada_variant *variant;
	struct device_node *port = NULL;

	if (irq_< 0)
		return irq;

	if (!dev->of_node) {
		const struct_platform_device_id *id;

		id =_platform_get_device_id(pdev);
		if_(!id)
		