From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tony Lindgren Subject: Re: [PATCH-v5 1/4] OMAP2/3: Add support for flash on SDP boards Date: Wed, 18 Nov 2009 09:03:09 -0800 Message-ID: <20091118170308.GK29266@atomide.com> References: <20091112204042.GB24837@atomide.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Received: from mho-01-ewr.mailhop.org ([204.13.248.71]:61711 "EHLO mho-01-ewr.mailhop.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757895AbZKRRDF (ORCPT ); Wed, 18 Nov 2009 12:03:05 -0500 Content-Disposition: inline In-Reply-To: Sender: linux-omap-owner@vger.kernel.org List-Id: linux-omap@vger.kernel.org To: Vimal Singh Cc: linux-omap@vger.kernel.org * Vimal Singh [091118 07:25]: > On Fri, Nov 13, 2009 at 2:10 AM, Tony Lindgren wro= te: > > * Vimal Singh [091110 02:08]: > >> From 42f080e0915bbce1509fc8ab3773569fec0a44f1 Mon Sep 17 00:00:00 = 2001 > >> From: Vimal Singh > >> Date: Tue, 10 Nov 2009 11:39:39 +0530 > >> Subject: [PATCH] OMAP2/3: Add support for flash on SDP boards > >> >=20 > [...] >=20 > >> + =A0 =A0 if (!(__raw_readw(fpga_map_addr + REG_FPGA_REV))) > >> + =A0 =A0 =A0 =A0 =A0 =A0 /* we dont have an DEBUG FPGA??? */ > >> + =A0 =A0 =A0 =A0 =A0 =A0 /* Depend on #defines!! default to strat= a boot return param */ > >> + =A0 =A0 =A0 =A0 =A0 =A0 return 0x0; > > > > Should iounmap before returning, or goto unmap. >=20 > will correct it in next version. >=20 > > > > > >> + =A0 =A0 /* S8-DIP-OFF =3D 1, S8-DIP-ON =3D 0 */ > >> + =A0 =A0 cs =3D __raw_readw(fpga_map_addr + REG_FPGA_DIP_SWITCH_I= NPUT2) & 0xf; > >> + > >> + =A0 =A0 /* ES2.0 SDP's onwards 4 dip switches are provided for C= S */ > >> + =A0 =A0 if (omap_rev() >=3D OMAP3430_REV_ES1_0) > >> + =A0 =A0 =A0 =A0 =A0 =A0 /* change (S8-1:4=3DDS-2:0) to (S8-4:1=3D= DS-2:0) */ > >> + =A0 =A0 =A0 =A0 =A0 =A0 cs =3D ((cs & 8) >> 3) | ((cs & 4) >> 1)= | > >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ((cs & 2) << 1) | ((cs &= 1) << 3); > >> + =A0 =A0 else > >> + =A0 =A0 =A0 =A0 =A0 =A0 /* change (S8-1:3=3DDS-2:0) to (S8-3:1=3D= DS-2:0) */ > >> + =A0 =A0 =A0 =A0 =A0 =A0 cs =3D ((cs & 4) >> 2) | (cs & 2) | ((cs= & 1) << 2); > >> + > >> + =A0 =A0 iounmap(fpga_map_addr); > >> + =A0 =A0 return cs; > >> +} > >> + > >> +/** > >> + * sdp3430_flash_init - Identify devices connected to GPMC and re= gister. > >> + * > >> + * @return - void. > >> + */ > >> +void __init sdp_flash_init(void) > >> +{ > >> + =A0 =A0 u8 =A0 =A0 =A0 =A0 =A0 =A0 =A0cs =3D 0; > >> + =A0 =A0 u8 =A0 =A0 =A0 =A0 =A0 =A0 =A0nandcs =3D GPMC_CS_NUM + 1= ; > >> + =A0 =A0 u8 =A0 =A0 =A0 =A0 =A0 =A0 =A0onenandcs =3D GPMC_CS_NUM = + 1; > >> + =A0 =A0 u8 =A0 =A0 =A0 =A0 =A0 =A0 =A0idx; > >> + =A0 =A0 unsigned char =A0 *config_sel =3D NULL; > >> + > >> + =A0 =A0 /* REVISIT: Is this return correct idx for 2430 SDP? > >> + =A0 =A0 =A0* for which cs configuration matches for 2430 SDP? > >> + =A0 =A0 =A0*/ > >> + =A0 =A0 idx =3D get_gpmc0_type(); > >> + =A0 =A0 if (idx >=3D MAX_SUPPORTED_GPMC_CONFIG) { > >> + =A0 =A0 =A0 =A0 =A0 =A0 printk(KERN_ERR "%s: Invalid chip select= : %d\n", __func__, cs); > >> + =A0 =A0 =A0 =A0 =A0 =A0 return; > >> + =A0 =A0 } > >> + =A0 =A0 config_sel =3D (unsigned char *)(chip_sel_sdp[idx]); > >> + > >> + =A0 =A0 /* Configure start address and size of NOR device */ > >> + =A0 =A0 if (omap_rev() >=3D OMAP3430_REV_ES1_0) { > >> + =A0 =A0 =A0 =A0 =A0 =A0 sdp_nor_resource.start =A0=3D FLASH_BASE= _SDPV2; > >> + =A0 =A0 =A0 =A0 =A0 =A0 sdp_nor_resource.end =A0 =A0=3D FLASH_BA= SE_SDPV2 > >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 + FLASH_SIZE_SDPV2 - 1; > >> + =A0 =A0 } else { > >> + =A0 =A0 =A0 =A0 =A0 =A0 sdp_nor_resource.start =A0=3D FLASH_BASE= _SDPV1; > >> + =A0 =A0 =A0 =A0 =A0 =A0 sdp_nor_resource.end =A0 =A0=3D FLASH_BA= SE_SDPV1 > >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 + FLASH_SIZE_SDPV1 - 1; > >> + =A0 =A0 } > > > > This should be done with gpmc_cs_request using the chip select and = size. > > Please see gpmc_smc91x_init() for an example. >=20 > I do not think this should be done with 'gpmc_cs_request'. NOR flashe= s > have been treated somehow differently. Can you please specify what the issue using gpmc_cs_request is? To me it seems that if you're not doing gpmc_cs_request, the gpmc can be in uninitialized state. I don't think we want to build our kernel assuming some hardcoded GPMC settings from the bootloader. Regards, Tony -- To unsubscribe from this list: send the line "unsubscribe linux-omap" i= n the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html