OMAP-GPMC cleanup for generic timing
Subsystems (6)
v8 cover OMAP-GPMC cleanup for generic timing
Hi,
This series prepares gpmc for generic timing. v7 of this series was named "OMAP-GPMC: generic time calc, prepare for driver". generic timing routine has been removed from this series. generic timing will be posted as a new separate series shortly.
This rearrangement has been done so that generic timing series will happen on top of another cleanup series required for common arm zImage. Both will follow shortly. Intention is to make easy path for common arm zImage cleanup.
This series contains minor cleanups that were low hanging fruits came across upon implementing generic timing routine.
This series is same as v7, except that last 4 patches in v7 has been removed from this series (those 4 patches were for generic timing)
This series is available
@ git://gitorious.org/x0148406-public/linux-kernel.git gpmc-prep-v8
and is based on
linux-next (next-20121005)Regards
Afzal
v8:
Remove generic timing conversion patches
v7:
1. Use picoseconds throughout generic timing routine to prevent rounding error.
2. Documentation on gpmc timings
3. Remove redundant rounding of nand timings (a new patch)
v6:
1. Generic timing calculation, move existing users of custom calculation to use the new generic one
2. Set OneNAND part to async mode before gpmc configuration
3. Move extra delay time user handling to proper patch (3/10 -> 2/10)
4. Modify nand init for OMAP3EVM too as support got added
v5:
Use flags for sync_read/write, hv, vhf
v4:
Reorganize OneNAND set_sync/async functions in a better way
v3:
1. Refactor OneNAND set_sync/async functions to separate out timing and configurations
2. Handle bool type timings too
3. Swap patches 2 & 3 due to dependency of OneNAND change on newly added bool type timings
v2:
1. Make use of timing api for setting clock activation time, and remove direct writing to register for clock activation.
2. Move ensuring that async mode in OneNAND has been setup from set_sync to setup function, improve commit message
Afzal Mohammed (5):
ARM: OMAP2+: nand: unify init functions
ARM: OMAP2+: nand: remove redundant rounding
ARM: OMAP2+: gpmc: handle additional timings
ARM: OMAP2+: onenand: refactor for clarity
ARM: OMAP2+: gpmc: remove cs# in sync clk div calc
Jon Hunter (1):
ARM: OMAP2+: GPMC: Remove unused OneNAND get_freq() platform function
arch/arm/mach-omap2/board-devkit8000.c | 8 +- arch/arm/mach-omap2/board-flash.c | 45 ++--- arch/arm/mach-omap2/board-flash.h | 6 +- arch/arm/mach-omap2/board-igep0020.c | 2 +- arch/arm/mach-omap2/board-ldp.c | 4 +- arch/arm/mach-omap2/board-omap3beagle.c | 8 +- arch/arm/mach-omap2/board-omap3evm.c | 8 +- arch/arm/mach-omap2/board-omap3touchbook.c | 8 +- arch/arm/mach-omap2/board-overo.c | 7 +- arch/arm/mach-omap2/board-zoom.c | 5 +- arch/arm/mach-omap2/common-board-devices.c | 45 ----- arch/arm/mach-omap2/common-board-devices.h | 1 - arch/arm/mach-omap2/gpmc-nand.c | 30 ++- arch/arm/mach-omap2/gpmc-onenand.c | 232 ++++++++++++------------ arch/arm/mach-omap2/gpmc.c | 52 +++++- arch/arm/mach-omap2/usb-tusb6010.c | 3 +- arch/arm/plat-omap/include/plat/gpmc.h | 21 ++- include/linux/platform_data/mtd-onenand-omap2.h | 8 - 18 files changed, 262 insertions(+), 231 deletions(-)
Signature · 1 line
1.7.12
PATCH v8 1/6 ARM: OMAP2+: nand: unify init functions
Helper function for updating nand platform data has been added the capability to take timing structure arguement. Usage of omap_nand_flash_init() has been replaced by modifed one, omap_nand_flash_init was doing things similar to board_nand_init except that NAND CS# were being acquired based on bootloader setting. As CS# is hardwired for a given board, acquiring gpmc CS# has been removed, and updated with the value on board.
NAND CS# used in beagle board & omap3evm was found to be CS0. Thomas Weber <[email protected]> reported that value of devkit8000 to be CS0. Overo board was found to be using CS0 based on u-boot, while google grep says omap3touchbook too has CS0.
--- arch/arm/mach-omap2/board-devkit8000.c | 8 ++++-- arch/arm/mach-omap2/board-flash.c | 45 +++++++++++++++--------------- arch/arm/mach-omap2/board-flash.h | 6 ++-- arch/arm/mach-omap2/board-igep0020.c | 2 +- arch/arm/mach-omap2/board-ldp.c | 4 +-- arch/arm/mach-omap2/board-omap3beagle.c | 8 ++++-- arch/arm/mach-omap2/board-omap3evm.c | 8 ++++-- arch/arm/mach-omap2/board-omap3touchbook.c | 8 ++++-- arch/arm/mach-omap2/board-overo.c | 7 +++-- arch/arm/mach-omap2/board-zoom.c | 5 ++-- arch/arm/mach-omap2/common-board-devices.c | 45 ------------------------------ arch/arm/mach-omap2/common-board-devices.h | 1 - 12 files changed, 62 insertions(+), 85 deletions(-)
arch/arm/mach-omap2/board-devkit8000.c +6 -2
@@ -55,8 +55,11 @@#include "sdram-micron-mt46h32m32lf-6.h" #include "mux.h" #include "hsmmc.h" +#include "board-flash.h" #include "common-board-devices.h" +#define NAND_CS 0 +#define OMAP_DM9000_GPIO_IRQ 25#define OMAP3_DEVKIT_TS_GPIO 27
@@ -621,8 +624,9 @@ static void __init devkit8000_init(void)usb_musb_init (NULL );usbhs_init (&usbhs_bdata); -omap_nand_flash_init (NAND_BUSWIDTH_16 , devkit8000_nand_partitions, -ARRAY_SIZE (devkit8000_nand_partitions)); +board_nand_init (devkit8000_nand_partitions, +ARRAY_SIZE (devkit8000_nand_partitions),NAND_CS , +NAND_BUSWIDTH_16 ,NULL );omap_twl4030_audio_init ("omap3beagle" );/* Ensure SDRC pins are mux'd for self-refresh */
arch/arm/mach-omap2/board-flash.c +23 -22
69 lines not on this page · raw message
arch/arm/mach-omap2/board-flash.h +4 -2
@@ -40,12 +40,14 @@ static inline void board_flash_init(struct flash_partitions part[],#if defined(CONFIG_MTD_NAND_OMAP2 ) || \ defined(CONFIG_MTD_NAND_OMAP2_MODULE )extern void board_nand_init (struct mtd_partition *nand_parts, -u8 nr_parts,u8 cs,int nand_type); +u8 nr_parts,u8 cs,int nand_type,struct gpmc_timings *gpmc_t); +extern struct gpmc_timings nand_default_timings[];#else static inline void board_nand_init (struct mtd_partition *nand_parts, -u8 nr_parts,u8 cs,int nand_type) +u8 nr_parts,u8 cs,int nand_type,struct gpmc_timings *gpmc_t) { } +#define nand_default_timings NULL#endif #if defined(CONFIG_MTD_ONENAND_OMAP2) || \
arch/arm/mach-omap2/board-igep0020.c +1 -1
@@ -175,7 +175,7 @@ static void __init igep_flash_init(void)pr_info ("IGEP: initializing NAND memory device\n" );board_nand_init (igep_flash_partitions,ARRAY_SIZE (igep_flash_partitions), -0 ,NAND_BUSWIDTH_16 ); +0 ,NAND_BUSWIDTH_16 , nand_default_timings); }else if (mux ==IGEP_SYSBOOT_ONENAND ) {pr_info ("IGEP: initializing OneNAND memory device\n" ); board_onenand_init(igep_flash_partitions,
arch/arm/mach-omap2/board-ldp.c +2 -2
@@ -420,8 +420,8 @@ static void __init omap_ldp_init(void)omap_serial_init ();omap_sdrc_init (NULL ,NULL );usb_musb_init (NULL ); -board_nand_init (ldp_nand_partitions, -ARRAY_SIZE (ldp_nand_partitions),ZOOM_NAND_CS ,0 ); +board_nand_init (ldp_nand_partitions,ARRAY_SIZE (ldp_nand_partitions), +ZOOM_NAND_CS ,0 , nand_default_timings);omap_hsmmc_init (mmc);ldp_display_init ();
arch/arm/mach-omap2/board-omap3beagle.c +6 -2
@@ -49,8 +49,11 @@#include "mux.h" #include "hsmmc.h" #include "pm.h" +#include "board-flash.h" #include "common-board-devices.h" +#define NAND_CS 0 +/* * OMAP3 Beagle revision * Run time detection of Beagle revision is done by reading GPIO.
@@ -512,8 +515,9 @@ static void __init omap3_beagle_init(void)usb_musb_init (NULL );usbhs_init (&usbhs_bdata); -omap_nand_flash_init (NAND_BUSWIDTH_16 , omap3beagle_nand_partitions, -ARRAY_SIZE (omap3beagle_nand_partitions)); +board_nand_init (omap3beagle_nand_partitions, +ARRAY_SIZE (omap3beagle_nand_partitions),NAND_CS , +NAND_BUSWIDTH_16 ,NULL );omap_twl4030_audio_init ("omap3beagle" );/* Ensure msecure is mux'd to be able to set the RTC. */
arch/arm/mach-omap2/board-omap3evm.c +6 -2
@@ -56,6 +56,9 @@#include "sdram-micron-mt46h32m32lf-6.h" #include "hsmmc.h" #include "common-board-devices.h" +#include "board-flash.h" + +#define NAND_CS 0#define OMAP3_EVM_TS_GPIO 175#define OMAP3_EVM_EHCI_VBUS 22
@@ -732,8 +735,9 @@ static void __init omap3_evm_init(void) }usb_musb_init (&musb_board_data);usbhs_init (&usbhs_bdata); -omap_nand_flash_init (NAND_BUSWIDTH_16 , omap3evm_nand_partitions, -ARRAY_SIZE (omap3evm_nand_partitions)); +board_nand_init (omap3evm_nand_partitions, +ARRAY_SIZE (omap3evm_nand_partitions),NAND_CS , +NAND_BUSWIDTH_16 ,NULL );omap_ads7846_init (1 ,OMAP3_EVM_TS_GPIO ,310 ,NULL );omap3evm_init_smsc911x ();
arch/arm/mach-omap2/board-omap3touchbook.c +6 -2
@@ -50,6 +50,7 @@#include "mux.h" #include "hsmmc.h" +#include "board-flash.h" #include "common-board-devices.h" #include <asm/setup.h>
@@ -59,6 +60,8 @@#define TB_BL_PWM_TIMER 9#define TB_KILL_POWER_GPIO 168 +#define NAND_CS 0 +static unsigned long touchbook_revision;static struct mtd_partition omap3touchbook_nand_partitions[] = {
@@ -365,8 +368,9 @@ static void __init omap3_touchbook_init(void)omap_ads7846_init (4 ,OMAP3_TS_GPIO ,310 , &ads7846_pdata);usb_musb_init (NULL );usbhs_init (&usbhs_bdata); -omap_nand_flash_init (NAND_BUSWIDTH_16 , omap3touchbook_nand_partitions, -ARRAY_SIZE (omap3touchbook_nand_partitions)); +board_nand_init (omap3touchbook_nand_partitions, +ARRAY_SIZE (omap3touchbook_nand_partitions),NAND_CS , +NAND_BUSWIDTH_16 ,NULL );/* Ensure SDRC pins are mux'd for self-refresh */ omap_mux_init_signal ("sdrc_cke0" ,OMAP_PIN_OUTPUT );
arch/arm/mach-omap2/board-overo.c +5 -2
@@ -55,8 +55,11 @@#include "mux.h" #include "sdram-micron-mt46h32m32lf-6.h" #include "hsmmc.h" +#include "board-flash.h" #include "common-board-devices.h" +#define NAND_CS 0 +#define OVERO_GPIO_BT_XGATE 15#define OVERO_GPIO_W2W_NRESET 16#define OVERO_GPIO_PENDOWN 114
@@ -495,8 +498,8 @@ static void __init overo_init(void)omap_serial_init ();omap_sdrc_init (mt46h32m32lf6_sdrc_params, mt46h32m32lf6_sdrc_params); -omap_nand_flash_init (0 , overo_nand_partitions, -ARRAY_SIZE (overo_nand_partitions)); +board_nand_init (overo_nand_partitions, +ARRAY_SIZE (overo_nand_partitions),NAND_CS ,0 ,NULL );usb_musb_init (NULL );usbhs_init (&usbhs_bdata);overo_spi_init ();
arch/arm/mach-omap2/board-zoom.c +3 -2
@@ -113,8 +113,9 @@ static void __init omap_zoom_init(void)usbhs_init (&usbhs_bdata); } -board_nand_init (zoom_nand_partitions,ARRAY_SIZE (zoom_nand_partitions), -ZOOM_NAND_CS ,NAND_BUSWIDTH_16 ); +board_nand_init (zoom_nand_partitions, +ARRAY_SIZE (zoom_nand_partitions),ZOOM_NAND_CS , +NAND_BUSWIDTH_16 , nand_default_timings);zoom_debugboard_init ();zoom_peripherals_init ();
arch/arm/mach-omap2/common-board-devices.c +0 -45
48 lines not on this page · raw message
arch/arm/mach-omap2/common-board-devices.h +0 -1
@@ -10,6 +10,5 @@ struct ads7846_platform_data;void omap_ads7846_init (int bus_num,int gpio_pendown,int gpio_debounce,struct ads7846_platform_data *board_pdata); -void omap_nand_flash_init (int opts,struct mtd_partition *parts,int n_parts);#endif /* __OMAP_COMMON_BOARD_DEVICES__ */
Signature · 1 line
1.7.12
PATCH v8 1/6 ARM: OMAP2+: nand: unify init functions
+ Jon and Paul
Quoted 383 lines · Afzal
Helper function for updating nand platform data has been added the capability to take timing structure arguement. Usage of
omap_nand_flash_init()has been replaced by modifed one,omap_nand_flash_initwas doing things similar toboard_nand_initexcept that NAND CS# were being acquired based on bootloader setting. As CS# is hardwired for a given board, acquiring gpmc CS# has been removed, and updated with the value on board.NAND CS# used in beagle board & omap3evm was found to be CS0. Thomas Weber <[email protected]> reported that value of devkit8000 to be CS0. Overo board was found to be using CS0 based on u-boot, while google grep says omap3touchbook too has CS0.
Signed-off-by Afzal Mohammed <[email protected]>Reviewed-by Jon Hunter <[email protected]>Acked-by Igor Grinberg <[email protected]>--- arch/arm/mach-omap2/board-devkit8000.c | 8 ++++-- arch/arm/mach-omap2/board-flash.c | 45 +++++++++++++++--------------- arch/arm/mach-omap2/board-flash.h | 6 ++-- arch/arm/mach-omap2/board-igep0020.c | 2 +- arch/arm/mach-omap2/board-ldp.c | 4 +-- arch/arm/mach-omap2/board-omap3beagle.c | 8 ++++-- arch/arm/mach-omap2/board-omap3evm.c | 8 ++++-- arch/arm/mach-omap2/board-omap3touchbook.c | 8 ++++-- arch/arm/mach-omap2/board-overo.c | 7 +++-- arch/arm/mach-omap2/board-zoom.c | 5 ++-- arch/arm/mach-omap2/common-board-devices.c | 45 ------------------------------ arch/arm/mach-omap2/common-board-devices.h | 1 - 12 files changed, 62 insertions(+), 85 deletions(-)arch/arm/mach-omap2/board-devkit8000.c +6
-2@@ -55,8 +55,11 @@#include "sdram-micron-mt46h32m32lf-6.h" #include "mux.h" #include "hsmmc.h" +#include "board-flash.h" #include "common-board-devices.h" +#define NAND_CS 0 +#define OMAP_DM9000_GPIO_IRQ 25#define OMAP3_DEVKIT_TS_GPIO 27@@ -621,8 +624,9 @@ static void __init devkit8000_init(void)usb_musb_init (NULL );usbhs_init (&usbhs_bdata); -omap_nand_flash_init (NAND_BUSWIDTH_16 , devkit8000_nand_partitions, -ARRAY_SIZE (devkit8000_nand_partitions)); +board_nand_init (devkit8000_nand_partitions, +ARRAY_SIZE (devkit8000_nand_partitions),NAND_CS , +NAND_BUSWIDTH_16 ,NULL );omap_twl4030_audio_init ("omap3beagle" );/* Ensure SDRC pins are mux'd for self-refresh */ arch/arm/mach-omap2/board-flash.c +23
-22@@ -104,41 +104,41 @@ __init board_onenand_init(struct mtd_partition *onenand_parts,defined (CONFIG_MTD_NAND_OMAP2_MODULE)/* Note that all values in this struct are in nanoseconds */ -static struct gpmc_timings nand_timings = { +struct gpmc_timings nand_default_timings[1] = { + { + .sync_clk =0 , - .sync_clk =0 , + .cs_on =0 , + .cs_rd_off =36 , + .cs_wr_off =36 , - .cs_on =0 , - .cs_rd_off =36 , - .cs_wr_off =36 , + .adv_on =6 , + .adv_rd_off =24 , + .adv_wr_off =36 , - .adv_on =6 , - .adv_rd_off =24 , - .adv_wr_off =36 , + .we_off =30 , + .oe_off =48 , - .we_off =30 , - .oe_off =48 , + .access =54 , + .rd_cycle =72 , + .wr_cycle =72 , - .access =54 , - .rd_cycle =72 , - .wr_cycle =72 , - - .wr_access =30 , - .wr_data_mux_bus =0 , + .wr_access =30 , + .wr_data_mux_bus =0 , + }, }; -static struct omap_nand_platform_data board_nand_data = { - .gpmc_t = &nand_timings, -}; +static struct omap_nand_platform_data board_nand_data;void -__init board_nand_init (struct mtd_partition *nand_parts, -u8 nr_parts,u8 cs,int nand_type) +__init board_nand_init (struct mtd_partition *nand_parts,u8 nr_parts,u8 cs, +int nand_type,struct gpmc_timings *gpmc_t) { board_nand_data.cs = cs; board_nand_data.parts = nand_parts; board_nand_data.nr_parts = nr_parts; board_nand_data.devsize = nand_type; + board_nand_data.gpmc_t = gpmc_t; board_nand_data.ecc_opt =OMAP_ECC_HAMMING_CODE_DEFAULT ;gpmc_nand_init (&board_nand_data);@@ -238,5 +238,6 @@ void __init board_flash_init(struct flash_partitions partition_info[],pr_err ("NAND: Unable to find configuration in GPMC\n" ); else board_nand_init(partition_info[2].parts, - partition_info[2].nr_parts, nandcs, nand_type); + partition_info[2].nr_parts, nandcs, +nand_type ,nand_default_timings ); }arch/arm/mach-omap2/board-flash.h +4
-2@@ -40,12 +40,14 @@ static inline void board_flash_init(struct flash_partitions part[],#if defined(CONFIG_MTD_NAND_OMAP2 ) || \ defined(CONFIG_MTD_NAND_OMAP2_MODULE )extern void board_nand_init (struct mtd_partition *nand_parts, -u8 nr_parts,u8 cs,int nand_type); +u8 nr_parts,u8 cs,int nand_type,struct gpmc_timings *gpmc_t); +extern struct gpmc_timings nand_default_timings[];#else static inline void board_nand_init (struct mtd_partition *nand_parts, -u8 nr_parts,u8 cs,int nand_type) +u8 nr_parts,u8 cs,int nand_type,struct gpmc_timings *gpmc_t) { } +#define nand_default_timings NULL#endif #if defined(CONFIG_MTD_ONENAND_OMAP2) || \arch/arm/mach-omap2/board-igep0020.c +1
-1@@ -175,7 +175,7 @@ static void __init igep_flash_init(void)pr_info ("IGEP: initializing NAND memory device\n" );board_nand_init (igep_flash_partitions,ARRAY_SIZE (igep_flash_partitions), -0 ,NAND_BUSWIDTH_16 ); +0 ,NAND_BUSWIDTH_16 , nand_default_timings); }else if (mux ==IGEP_SYSBOOT_ONENAND ) {pr_info ("IGEP: initializing OneNAND memory device\n" ); board_onenand_init(igep_flash_partitions,arch/arm/mach-omap2/board-ldp.c +2
-2@@ -420,8 +420,8 @@ static void __init omap_ldp_init(void)omap_serial_init ();omap_sdrc_init (NULL ,NULL );usb_musb_init (NULL ); -board_nand_init (ldp_nand_partitions, -ARRAY_SIZE (ldp_nand_partitions),ZOOM_NAND_CS ,0 ); +board_nand_init (ldp_nand_partitions,ARRAY_SIZE (ldp_nand_partitions), +ZOOM_NAND_CS ,0 , nand_default_timings);omap_hsmmc_init (mmc);ldp_display_init ();arch/arm/mach-omap2/board-omap3beagle.c +6
-2@@ -49,8 +49,11 @@#include "mux.h" #include "hsmmc.h" #include "pm.h" +#include "board-flash.h" #include "common-board-devices.h" +#define NAND_CS 0 +/* * OMAP3 Beagle revision * Run time detection of Beagle revision is done by reading GPIO. @@ -512,8 +515,9 @@ static void __init omap3_beagle_init(void)usb_musb_init (NULL );usbhs_init (&usbhs_bdata); -omap_nand_flash_init (NAND_BUSWIDTH_16 , omap3beagle_nand_partitions, -ARRAY_SIZE (omap3beagle_nand_partitions)); +board_nand_init (omap3beagle_nand_partitions, +ARRAY_SIZE (omap3beagle_nand_partitions),NAND_CS , +NAND_BUSWIDTH_16 ,NULL );omap_twl4030_audio_init ("omap3beagle" );/* Ensure msecure is mux'd to be able to set the RTC. */ arch/arm/mach-omap2/board-omap3evm.c +6
-2@@ -56,6 +56,9 @@#include "sdram-micron-mt46h32m32lf-6.h" #include "hsmmc.h" #include "common-board-devices.h" +#include "board-flash.h" + +#define NAND_CS 0#define OMAP3_EVM_TS_GPIO 175#define OMAP3_EVM_EHCI_VBUS 22@@ -732,8 +735,9 @@ static void __init omap3_evm_init(void) }usb_musb_init (&musb_board_data);usbhs_init (&usbhs_bdata); -omap_nand_flash_init (NAND_BUSWIDTH_16 , omap3evm_nand_partitions, -ARRAY_SIZE (omap3evm_nand_partitions)); +board_nand_init (omap3evm_nand_partitions, +ARRAY_SIZE (omap3evm_nand_partitions),NAND_CS , +NAND_BUSWIDTH_16 ,NULL );omap_ads7846_init (1 ,OMAP3_EVM_TS_GPIO ,310 ,NULL );omap3evm_init_smsc911x ();arch/arm/mach-omap2/board-omap3touchbook.c +6
-2@@ -50,6 +50,7 @@#include "mux.h" #include "hsmmc.h" +#include "board-flash.h" #include "common-board-devices.h" #include <asm/setup.h> @@ -59,6 +60,8 @@#define TB_BL_PWM_TIMER 9#define TB_KILL_POWER_GPIO 168 +#define NAND_CS 0 +static unsigned long touchbook_revision;static struct mtd_partition omap3touchbook_nand_partitions[] = {@@ -365,8 +368,9 @@ static void __init omap3_touchbook_init(void)omap_ads7846_init (4 ,OMAP3_TS_GPIO ,310 , &ads7846_pdata);usb_musb_init (NULL );usbhs_init (&usbhs_bdata); -omap_nand_flash_init (NAND_BUSWIDTH_16 , omap3touchbook_nand_partitions, -ARRAY_SIZE (omap3touchbook_nand_partitions)); +board_nand_init (omap3touchbook_nand_partitions, +ARRAY_SIZE (omap3touchbook_nand_partitions),NAND_CS , +NAND_BUSWIDTH_16 ,NULL );/* Ensure SDRC pins are mux'd for self-refresh */ omap_mux_init_signal ("sdrc_cke0" ,OMAP_PIN_OUTPUT );arch/arm/mach-omap2/board-overo.c +5
-2@@ -55,8 +55,11 @@#include "mux.h" #include "sdram-micron-mt46h32m32lf-6.h" #include "hsmmc.h" +#include "board-flash.h" #include "common-board-devices.h" +#define NAND_CS 0 +#define OVERO_GPIO_BT_XGATE 15#define OVERO_GPIO_W2W_NRESET 16#define OVERO_GPIO_PENDOWN 114@@ -495,8 +498,8 @@ static void __init overo_init(void)omap_serial_init ();omap_sdrc_init (mt46h32m32lf6_sdrc_params, mt46h32m32lf6_sdrc_params); -omap_nand_flash_init (0 , overo_nand_partitions, -ARRAY_SIZE (overo_nand_partitions)); +board_nand_init (overo_nand_partitions, +ARRAY_SIZE (overo_nand_partitions),NAND_CS ,0 ,NULL );usb_musb_init (NULL );usbhs_init (&usbhs_bdata);overo_spi_init ();arch/arm/mach-omap2/board-zoom.c +3
-2@@ -113,8 +113,9 @@ static void __init omap_zoom_init(void)usbhs_init (&usbhs_bdata); } -board_nand_init (zoom_nand_partitions,ARRAY_SIZE (zoom_nand_partitions), -ZOOM_NAND_CS ,NAND_BUSWIDTH_16 ); +board_nand_init (zoom_nand_partitions, +ARRAY_SIZE (zoom_nand_partitions),ZOOM_NAND_CS , +NAND_BUSWIDTH_16 , nand_default_timings);zoom_debugboard_init ();zoom_peripherals_init ();arch/arm/mach-omap2/common-board-devices.c +0
-45@@ -96,48 +96,3 @@ void __init omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce, { }#endif - -#if defined(CONFIG_MTD_NAND_OMAP2 ) || defined(CONFIG_MTD_NAND_OMAP2_MODULE ) -static struct omap_nand_platform_data nand_data; - -void __init omap_nand_flash_init (int options,struct mtd_partition *parts, -int nr_parts) -{ -u8 cs =0 ; -u8 nandcs =GPMC_CS_NUM +1 ; - -/* find out the chip-select on which NAND exists */ -while (cs <GPMC_CS_NUM ) { -u32 ret =0 ; - ret =gpmc_cs_read_reg (cs,GPMC_CS_CONFIG1 ); - -if ((ret &0xC00 ) ==0x800 ) { -printk (KERN_INFO "Found NAND on CS%d\n" , cs); -if (nandcs >GPMC_CS_NUM ) - nandcs = cs; - } - cs++; - } - -if (nandcs >GPMC_CS_NUM ) { -pr_info ("NAND: Unable to find configuration in GPMC\n" ); -return ; - } - -if (nandcs <GPMC_CS_NUM ) { - nand_data.cs = nandcs; - nand_data.parts = parts; - nand_data.nr_parts = nr_parts; - nand_data.devsize = options; - -printk (KERN_INFO "Registering NAND on CS%d\n" , nandcs); -if (gpmc_nand_init (&nand_data) <0 ) -printk (KERN_ERR "Unable to register NAND device\n" ); - } -} -#else -void __init omap_nand_flash_init (int options,struct mtd_partition *parts, -int nr_parts) -{ -} -#endif arch/arm/mach-omap2/common-board-devices.h +0
-1@@ -10,6 +10,5 @@ struct ads7846_platform_data;void omap_ads7846_init (int bus_num,int gpio_pendown,int gpio_debounce,struct ads7846_platform_data *board_pdata); -void omap_nand_flash_init (int opts,struct mtd_partition *parts,int n_parts);#endif /* __OMAP_COMMON_BOARD_DEVICES__ */ Signature · 1 line
1.7.12
PATCH v8 2/6 ARM: OMAP2+: nand: remove redundant rounding
In reply to Afzal Mohammedgpmc_cs_set_timings() calculate ticks to be programmed by rounding time in ns to next tick value. Hence remove redundant rounding of nanosecond timing.
--- arch/arm/mach-omap2/gpmc-nand.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-)
arch/arm/mach-omap2/gpmc-nand.c +13 -17
@@ -50,31 +50,27 @@ static int omap2_nand_gpmc_retime(struct omap_nand_platform_data *gpmc_nand_datamemset (&t,0 ,sizeof (t)); t.sync_clk = gpmc_nand_data->gpmc_t->sync_clk; - t.cs_on =gpmc_round_ns_to_ticks (gpmc_nand_data->gpmc_t->cs_on); - t.adv_on =gpmc_round_ns_to_ticks (gpmc_nand_data->gpmc_t->adv_on); + t.cs_on = gpmc_nand_data->gpmc_t->cs_on; + t.adv_on = gpmc_nand_data->gpmc_t->adv_on;/* Read */ - t.adv_rd_off =gpmc_round_ns_to_ticks ( - gpmc_nand_data->gpmc_t->adv_rd_off); + t.adv_rd_off = gpmc_nand_data->gpmc_t->adv_rd_off; t.oe_on = t.adv_on; - t.access =gpmc_round_ns_to_ticks (gpmc_nand_data->gpmc_t->access); - t.oe_off =gpmc_round_ns_to_ticks (gpmc_nand_data->gpmc_t->oe_off); - t.cs_rd_off =gpmc_round_ns_to_ticks (gpmc_nand_data->gpmc_t->cs_rd_off); - t.rd_cycle =gpmc_round_ns_to_ticks (gpmc_nand_data->gpmc_t->rd_cycle); + t.access = gpmc_nand_data->gpmc_t->access; + t.oe_off = gpmc_nand_data->gpmc_t->oe_off; + t.cs_rd_off = gpmc_nand_data->gpmc_t->cs_rd_off; + t.rd_cycle = gpmc_nand_data->gpmc_t->rd_cycle;/* Write */ - t.adv_wr_off =gpmc_round_ns_to_ticks ( - gpmc_nand_data->gpmc_t->adv_wr_off); + t.adv_wr_off = gpmc_nand_data->gpmc_t->adv_wr_off; t.we_on = t.oe_on;if (cpu_is_omap34xx ()) { - t.wr_data_mux_bus =gpmc_round_ns_to_ticks ( - gpmc_nand_data->gpmc_t->wr_data_mux_bus); - t.wr_access =gpmc_round_ns_to_ticks ( - gpmc_nand_data->gpmc_t->wr_access); + t.wr_data_mux_bus = gpmc_nand_data->gpmc_t->wr_data_mux_bus; + t.wr_access = gpmc_nand_data->gpmc_t->wr_access; } - t.we_off =gpmc_round_ns_to_ticks (gpmc_nand_data->gpmc_t->we_off); - t.cs_wr_off =gpmc_round_ns_to_ticks (gpmc_nand_data->gpmc_t->cs_wr_off); - t.wr_cycle =gpmc_round_ns_to_ticks (gpmc_nand_data->gpmc_t->wr_cycle); + t.we_off = gpmc_nand_data->gpmc_t->we_off; + t.cs_wr_off = gpmc_nand_data->gpmc_t->cs_wr_off; + t.wr_cycle = gpmc_nand_data->gpmc_t->wr_cycle;/* Configure GPMC */ if (gpmc_nand_data->devsize ==NAND_BUSWIDTH_16 )
Signature · 1 line
1.7.12
PATCH v8 3/6 ARM: OMAP2+: gpmc: handle additional timings
In reply to Afzal MohammedConfigure busturnaround, cycle2cycledelay, waitmonitoringtime, clkactivationtime in gpmc_cs_set_timings(). This is done so that boards can configure these parameters of gpmc in Kernel instead of relying on bootloader. Also configure bool type timings like extradelay.
This needed change to the existing users that were configuring clk activation time and extra delay by directly writing to registers. Thanks to Tony for making me aware of users of clk activation and being kind enough to test the modified one.
--- arch/arm/mach-omap2/gpmc-onenand.c | 28 +++++--------------- arch/arm/mach-omap2/gpmc.c | 48 ++++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/usb-tusb6010.c | 3 ++- arch/arm/plat-omap/include/plat/gpmc.h | 19 ++++++++++++++ 4 files changed, 75 insertions(+), 23 deletions(-)
arch/arm/mach-omap2/gpmc-onenand.c +6 -22
@@ -284,27 +284,10 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg, sync_read, sync_write, hf, vhf);if (div ==1 ) { - reg =gpmc_cs_read_reg (cs,GPMC_CS_CONFIG2 ); - reg |= (1 <<7 ); -gpmc_cs_write_reg (cs,GPMC_CS_CONFIG2 , reg); - reg =gpmc_cs_read_reg (cs,GPMC_CS_CONFIG3 ); - reg |= (1 <<7 ); -gpmc_cs_write_reg (cs,GPMC_CS_CONFIG3 , reg); - reg =gpmc_cs_read_reg (cs,GPMC_CS_CONFIG4 ); - reg |= (1 <<7 ); - reg |= (1 <<23 ); -gpmc_cs_write_reg (cs,GPMC_CS_CONFIG4 , reg); - }else { - reg =gpmc_cs_read_reg (cs,GPMC_CS_CONFIG2 ); - reg &= ~(1 <<7 ); -gpmc_cs_write_reg (cs,GPMC_CS_CONFIG2 , reg); - reg =gpmc_cs_read_reg (cs,GPMC_CS_CONFIG3 ); - reg &= ~(1 <<7 ); -gpmc_cs_write_reg (cs,GPMC_CS_CONFIG3 , reg); - reg =gpmc_cs_read_reg (cs,GPMC_CS_CONFIG4 ); - reg &= ~(1 <<7 ); - reg &= ~(1 <<23 ); -gpmc_cs_write_reg (cs,GPMC_CS_CONFIG4 , reg); + t.bool_timings.cs_extra_delay = true; + t.bool_timings.adv_extra_delay = true; + t.bool_timings.oe_extra_delay = true; + t.bool_timings.we_extra_delay = true; }/* Set synchronous read timings */
@@ -329,6 +312,8 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg, t.rd_cycle =gpmc_ticks_to_ns (fclk_offset + (latency +1 ) * div + ticks_cez); + t.clk_activation = fclk_offset_ns; +/* Write */ if (sync_write) { t.adv_wr_off = t.adv_rd_off;
@@ -362,7 +347,6 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg, (sync_read ?GPMC_CONFIG1_READTYPE_SYNC :0 ) | (sync_write ?GPMC_CONFIG1_WRITEMULTIPLE_SUPP :0 ) | (sync_write ?GPMC_CONFIG1_WRITETYPE_SYNC :0 ) | -GPMC_CONFIG1_CLKACTIVATIONTIME (fclk_offset) | GPMC_CONFIG1_PAGE_LEN(2) | (cpu_is_omap34xx() ? 0 : (GPMC_CONFIG1_WAIT_READ_MON |
arch/arm/mach-omap2/gpmc.c +48 -0
72 lines not on this page · raw message
arch/arm/mach-omap2/usb-tusb6010.c +2 -1
@@ -174,6 +174,8 @@ static int tusb_set_sync_mode(unsigned sysclk_ps, unsigned fclk_ps) tmp = t.cs_wr_off *1000 +7000 /* t_scsn_rdy_z */ ; t.wr_cycle =next_clk (t.cs_wr_off, tmp, fclk_ps); + t.clk_activation =gpmc_ticks_to_ns (1 ); +return gpmc_cs_set_timings (sync_cs, &t); }
@@ -283,7 +285,6 @@ tusb6010_setup_interface(struct musb_hdrc_platform_data *data, | GPMC_CONFIG1_READTYPE_SYNC |GPMC_CONFIG1_WRITEMULTIPLE_SUPP |GPMC_CONFIG1_WRITETYPE_SYNC - |GPMC_CONFIG1_CLKACTIVATIONTIME (1 ) |GPMC_CONFIG1_PAGE_LEN (2 ) |GPMC_CONFIG1_WAIT_READ_MON |GPMC_CONFIG1_WAIT_WRITE_MON
arch/arm/plat-omap/include/plat/gpmc.h +19 -0
@@ -96,6 +96,17 @@ enum omap_ecc { OMAP_ECC_BCH8_CODE_HW, /* 8-bit BCH ecc code */ }; +/* bool type time settings */ +struct gpmc_bool_timings { +bool cycle2cyclediffcsen; +bool cycle2cyclesamecsen; +bool we_extra_delay; +bool oe_extra_delay; +bool adv_extra_delay; +bool cs_extra_delay; +bool time_para_granularity; +}; +/* * Note that all values in this struct are in nanoseconds except sync_clk * (which is in picoseconds), while the register values are in gpmc_fck cycles.
@@ -128,9 +139,17 @@ struct gpmc_timings {u16 rd_cycle;/* Total read cycle time */ u16 wr_cycle;/* Total write cycle time */ +u16 bus_turnaround; +u16 cycle2cycle_delay; + +u16 wait_monitoring; +u16 clk_activation; +/* The following are only on OMAP3430 */ u16 wr_access;/* WRACCESSTIME */ u16 wr_data_mux_bus;/* WRDATAONADMUXBUS */ + +struct gpmc_bool_timings bool_timings; };struct gpmc_nand_regs {
Signature · 1 line
1.7.12
PATCH v8 4/6 ARM: OMAP2+: onenand: refactor for clarity
In reply to Afzal MohammedRefactor set_async_mode & set_sync_mode functions to separate out timing calculation & actual configuration (GPMC & OneNAND side).
Thanks to Jon for his suggestions.
--- arch/arm/mach-omap2/gpmc-onenand.c | 174 +++++++++++++++++++++++-------------- 1 file changed, 109 insertions(+), 65 deletions(-)
arch/arm/mach-omap2/gpmc-onenand.c +109 -65
@@ -16,6 +16,7 @@#include <linux/mtd/onenand_regs.h> #include <linux/io.h> #include <linux/platform_data/mtd-onenand-omap2.h> +#include <linux/err.h> #include <asm/mach/flash.h>
@@ -25,6 +26,14 @@#define ONENAND_IO_SIZE SZ_128K +#define ONENAND_FLAG_SYNCREAD (1 << 0) +#define ONENAND_FLAG_SYNCWRITE (1 << 1) +#define ONENAND_FLAG_HF (1 << 2) +#define ONENAND_FLAG_VHF (1 << 3) + +static unsigned onenand_flags; +static unsigned latency; +static struct omap_onenand_platform_data *gpmc_onenand_data;static struct resource gpmc_onenand_resource = {
@@ -38,11 +47,9 @@ static struct platform_device gpmc_onenand_device = { .resource = &gpmc_onenand_resource, }; -static int omap2_onenand_set_async_mode (int cs,void __iomem *onenand_base) +static struct gpmc_timings omap2_onenand_calc_async_timings (void ) {struct gpmc_timings t; -u32 reg; -int err;const int t_cer =15 ;const int t_avdp =12 ;
@@ -55,11 +62,6 @@ static int omap2_onenand_set_async_mode(int cs, void __iomem *onenand_base)const int t_wpl =40 ;const int t_wph =30 ; -/* Ensure sync read and sync write are disabled */ - reg =readw (onenand_base +ONENAND_REG_SYS_CFG1 ); - reg &= ~ONENAND_SYS_CFG1_SYNC_READ & ~ONENAND_SYS_CFG1_SYNC_WRITE ; -writew (reg, onenand_base +ONENAND_REG_SYS_CFG1 ); -memset (&t,0 ,sizeof (t)); t.sync_clk =0 ; t.cs_on =0 ;
@@ -86,25 +88,30 @@ static int omap2_onenand_set_async_mode(int cs, void __iomem *onenand_base) t.cs_wr_off = t.we_off +gpmc_round_ns_to_ticks (t_wph); t.wr_cycle = t.cs_wr_off +gpmc_round_ns_to_ticks (t_cez); +return t; +} + +static int gpmc_set_async_mode (int cs,struct gpmc_timings *t) +{/* Configure GPMC for asynchronous read */ gpmc_cs_write_reg (cs,GPMC_CS_CONFIG1 ,GPMC_CONFIG1_DEVICESIZE_16 |GPMC_CONFIG1_MUXADDDATA ); - err =gpmc_cs_set_timings (cs, &t); -if (err) -return err; +return gpmc_cs_set_timings (cs, t); +} + +static void omap2_onenand_set_async_mode (void __iomem *onenand_base) +{ +u32 reg;/* Ensure sync read and sync write are disabled */ reg =readw (onenand_base +ONENAND_REG_SYS_CFG1 ); reg &= ~ONENAND_SYS_CFG1_SYNC_READ & ~ONENAND_SYS_CFG1_SYNC_WRITE ;writew (reg, onenand_base +ONENAND_REG_SYS_CFG1 ); - -return 0 ; } -static void set_onenand_cfg (void __iomem *onenand_base,int latency, -int sync_read,int sync_write,int hf,int vhf) +static void set_onenand_cfg (void __iomem *onenand_base) {u32 reg;
@@ -112,19 +119,19 @@ static void set_onenand_cfg(void __iomem *onenand_base, int latency, reg &= ~((0x7 <<ONENAND_SYS_CFG1_BRL_SHIFT ) | (0x7 <<9 )); reg |= (latency <<ONENAND_SYS_CFG1_BRL_SHIFT ) |ONENAND_SYS_CFG1_BL_16 ; -if (sync_read) +if (onenand_flags &ONENAND_FLAG_SYNCREAD ) reg |=ONENAND_SYS_CFG1_SYNC_READ ;else reg &= ~ONENAND_SYS_CFG1_SYNC_READ ; -if (sync_write) +if (onenand_flags &ONENAND_FLAG_SYNCWRITE ) reg |=ONENAND_SYS_CFG1_SYNC_WRITE ;else reg &= ~ONENAND_SYS_CFG1_SYNC_WRITE ; -if (hf) +if (onenand_flags &ONENAND_FLAG_HF ) reg |=ONENAND_SYS_CFG1_HF ;else reg &= ~ONENAND_SYS_CFG1_HF ; -if (vhf) +if (onenand_flags &ONENAND_FLAG_VHF ) reg |=ONENAND_SYS_CFG1_VHF ;else reg &= ~ONENAND_SYS_CFG1_VHF ;
@@ -172,9 +179,9 @@ static int omap2_onenand_get_freq(struct omap_onenand_platform_data *cfg,return freq; } -static int omap2_onenand_set_sync_mode (struct omap_onenand_platform_data *cfg, -void __iomem *onenand_base, -int *freq_ptr) +static struct gpmc_timings +omap2_onenand_calc_sync_timings (struct omap_onenand_platform_data *cfg, +int freq,bool clk_dep) {struct gpmc_timings t;const int t_cer =15 ;
@@ -184,29 +191,14 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,const int t_wpl =40 ;const int t_wph =30 ;int min_gpmc_clk_period, t_ces, t_avds, t_avdh, t_ach, t_aavdh, t_rdyo; -int div, fclk_offset_ns, fclk_offset, gpmc_clk_ns, latency; -int first_time =0 , hf =0 , vhf =0 , sync_read =0 , sync_write =0 ; -int err, ticks_cez; -int cs = cfg->cs, freq = *freq_ptr; -u32 reg; -bool clk_dep = false; - -if (cfg->flags &ONENAND_SYNC_READ ) { - sync_read =1 ; - }else if (cfg->flags &ONENAND_SYNC_READWRITE ) { - sync_read =1 ; - sync_write =1 ; - }else -return omap2_onenand_set_async_mode (cs, onenand_base); +int div, fclk_offset_ns, fclk_offset, gpmc_clk_ns; +int ticks_cez; +int cs = cfg->cs; -if (!freq) { -/* Very first call freq is not known */ - err =omap2_onenand_set_async_mode (cs, onenand_base); -if (err) -return err; - freq =omap2_onenand_get_freq (cfg, onenand_base, &clk_dep); - first_time =1 ; - } +if (cfg->flags &ONENAND_SYNC_READ ) + onenand_flags =ONENAND_FLAG_SYNCREAD ; +else if (cfg->flags &ONENAND_SYNC_READWRITE ) + onenand_flags =ONENAND_FLAG_SYNCREAD |ONENAND_FLAG_SYNCWRITE ;switch (freq) {case 104 :
@@ -244,19 +236,23 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg, t_ach =9 ; t_aavdh =7 ; t_rdyo =15 ; - sync_write =0 ; + onenand_flags &= ~ONENAND_FLAG_SYNCWRITE ;break ; } div =gpmc_cs_calc_divider (cs, min_gpmc_clk_period); gpmc_clk_ns =gpmc_ticks_to_ns (div);if (gpmc_clk_ns <15 )/* >66Mhz */ - hf =1 ; + onenand_flags |=ONENAND_FLAG_HF ; +else + onenand_flags &= ~ONENAND_FLAG_HF ;if (gpmc_clk_ns <12 )/* >83Mhz */ - vhf =1 ; -if (vhf) + onenand_flags |=ONENAND_FLAG_VHF ; +else + onenand_flags &= ~ONENAND_FLAG_VHF ; +if (onenand_flags &ONENAND_FLAG_VHF ) latency =8 ; -else if (hf) +else if (onenand_flags &ONENAND_FLAG_HF ) latency =6 ;else if (gpmc_clk_ns >=25 )/* 40 MHz*/ latency =3 ;
@@ -279,9 +275,8 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg, } } -if (first_time) -set_onenand_cfg (onenand_base, latency, - sync_read, sync_write, hf, vhf); +/* Set synchronous read timings */ +memset (&t,0 ,sizeof (t));if (div ==1 ) { t.bool_timings.cs_extra_delay = true;
@@ -290,8 +285,6 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg, t.bool_timings.we_extra_delay = true; } -/* Set synchronous read timings */ -memset (&t,0 ,sizeof (t)); t.sync_clk = min_gpmc_clk_period; t.cs_on =0 ; t.adv_on =0 ;
@@ -315,7 +308,7 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg, t.clk_activation = fclk_offset_ns;/* Write */ -if (sync_write) { +if (onenand_flags &ONENAND_FLAG_SYNCWRITE ) { t.adv_wr_off = t.adv_rd_off; t.we_on =0 ; t.we_off = t.cs_rd_off;
@@ -340,6 +333,14 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg, } } +return t; +} + +static int gpmc_set_sync_mode (int cs,struct gpmc_timings *t) +{ +unsigned sync_read = onenand_flags &ONENAND_FLAG_SYNCREAD ; +unsigned sync_write = onenand_flags &ONENAND_FLAG_SYNCWRITE ; +/* Configure GPMC for synchronous read */ gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, GPMC_CONFIG1_WRAPBURST_SUPP |
@@ -355,11 +356,47 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,GPMC_CONFIG1_DEVICETYPE_NOR | GPMC_CONFIG1_MUXADDDATA); - err =gpmc_cs_set_timings (cs, &t); -if (err) -return err; +return gpmc_cs_set_timings (cs, t); +} + +static int omap2_onenand_setup_async (void __iomem *onenand_base) +{ +struct gpmc_timings t; +int ret; + +omap2_onenand_set_async_mode (onenand_base); + + t =omap2_onenand_calc_async_timings (); + + ret =gpmc_set_async_mode (gpmc_onenand_data->cs, &t); +if (IS_ERR_VALUE (ret)) +return ret; + +omap2_onenand_set_async_mode (onenand_base); + +return 0 ; +} + +static int omap2_onenand_setup_sync (void __iomem *onenand_base,int *freq_ptr) +{ +int ret, freq = *freq_ptr; +struct gpmc_timings t; +bool clk_dep = false; + +if (!freq) { +/* Very first call freq is not known */ + freq =omap2_onenand_get_freq (gpmc_onenand_data, + onenand_base, &clk_dep); +set_onenand_cfg (onenand_base); + } + + t =omap2_onenand_calc_sync_timings (gpmc_onenand_data, freq, clk_dep); -set_onenand_cfg (onenand_base, latency, sync_read, sync_write, hf, vhf); + ret =gpmc_set_sync_mode (gpmc_onenand_data->cs, &t); +if (IS_ERR_VALUE (ret)) +return ret; + +set_onenand_cfg (onenand_base); *freq_ptr = freq;
@@ -369,15 +406,22 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,static int gpmc_onenand_setup (void __iomem *onenand_base,int *freq_ptr) {struct device *dev = &gpmc_onenand_device.dev; +unsigned l =ONENAND_SYNC_READ |ONENAND_SYNC_READWRITE ; +int ret; -/* Set sync timings in GPMC */ -if (omap2_onenand_set_sync_mode (gpmc_onenand_data, onenand_base, - freq_ptr) <0 ) { -dev_err (dev,"Unable to set synchronous mode\n" ); -return -EINVAL ; + ret =omap2_onenand_setup_async (onenand_base); +if (ret) { +dev_err (dev,"unable to set to async mode\n" ); +return ret; } -return 0 ; +if (!(gpmc_onenand_data->flags & l)) +return 0 ; + + ret =omap2_onenand_setup_sync (onenand_base, freq_ptr); +if (ret) +dev_err (dev,"unable to set to sync mode\n" ); +return ret; }void __init gpmc_onenand_init (struct omap_onenand_platform_data *_onenand_data)
Signature · 1 line
1.7.12
PATCH v8 5/6 ARM: OMAP2+: GPMC: Remove unused OneNAND get_freq() platform function
In reply to Afzal MohammedFrom: Jon Hunter <[email protected]>
A platform function pointer for getting the frequency of a OneNAND device was added so that a platform could specify a custom function for returning the frequency and not just rely on the OneNAND version to determine the frequency. However, this platform function pointer is not currently being used and I am not sure if it ever has.
OneNAND devices are not so common these days and as far as I know not being used with new devices. Therefore, it is most likely that this get_freq() function pointer will not be used and so remove it.
Given that the get_freq() function pointer is not used, neither is the clk_dep variable and so all references to it can also be removed.
--- arch/arm/mach-omap2/gpmc-onenand.c | 39 ++++--------------------- include/linux/platform_data/mtd-onenand-omap2.h | 8 ----- 2 files changed, 5 insertions(+), 42 deletions(-)
arch/arm/mach-omap2/gpmc-onenand.c +5 -34
@@ -139,21 +139,10 @@ static void set_onenand_cfg(void __iomem *onenand_base) }static int omap2_onenand_get_freq (struct omap_onenand_platform_data *cfg, -void __iomem *onenand_base,bool *clk_dep) +void __iomem *onenand_base) {u16 ver =readw (onenand_base +ONENAND_REG_VERSION_ID ); -int freq =0 ; - -if (cfg->get_freq) { -struct onenand_freq_info fi; - - fi.maf_id =readw (onenand_base +ONENAND_REG_MANUFACTURER_ID ); - fi.dev_id =readw (onenand_base +ONENAND_REG_DEVICE_ID ); - fi.ver_id = ver; - freq = cfg->get_freq (&fi, clk_dep); -if (freq) -return freq; - } +int freq;switch ((ver >>4 ) &0xf ) {case 0 :
@@ -181,7 +170,7 @@ static int omap2_onenand_get_freq(struct omap_onenand_platform_data *cfg,static struct gpmc_timings omap2_onenand_calc_sync_timings (struct omap_onenand_platform_data *cfg, -int freq,bool clk_dep) +int freq) {struct gpmc_timings t;const int t_cer =15 ;
@@ -259,22 +248,6 @@ omap2_onenand_calc_sync_timings(struct omap_onenand_platform_data *cfg,else latency =4 ; -if (clk_dep) { -if (gpmc_clk_ns <12 ) {/* >83Mhz */ - t_ces =3 ; - t_avds =4 ; - }else if (gpmc_clk_ns <15 ) {/* >66Mhz */ - t_ces =5 ; - t_avds =4 ; - }else if (gpmc_clk_ns <25 ) {/* >40Mhz */ - t_ces =6 ; - t_avds =5 ; - }else { - t_ces =7 ; - t_avds =7 ; - } - } -/* Set synchronous read timings */ memset (&t,0 ,sizeof (t));
@@ -381,16 +354,14 @@ static int omap2_onenand_setup_sync(void __iomem *onenand_base, int *freq_ptr) {int ret, freq = *freq_ptr;struct gpmc_timings t; -bool clk_dep = false;if (!freq) {/* Very first call freq is not known */ - freq =omap2_onenand_get_freq (gpmc_onenand_data, - onenand_base, &clk_dep); + freq =omap2_onenand_get_freq (gpmc_onenand_data, onenand_base);set_onenand_cfg (onenand_base); } - t =omap2_onenand_calc_sync_timings (gpmc_onenand_data, freq, clk_dep); + t =omap2_onenand_calc_sync_timings (gpmc_onenand_data, freq); ret =gpmc_set_sync_mode (gpmc_onenand_data->cs, &t);if (IS_ERR_VALUE (ret))
include/linux/platform_data/mtd-onenand-omap2.h +0 -8
@@ -15,20 +15,12 @@#define ONENAND_SYNC_READ (1 << 0)#define ONENAND_SYNC_READWRITE (1 << 1) -struct onenand_freq_info { -u16 maf_id; -u16 dev_id; -u16 ver_id; -}; -struct omap_onenand_platform_data {int cs;int gpio_irq;struct mtd_partition *parts;int nr_parts;int (*onenand_setup)(void __iomem *,int *freq_ptr); -int (*get_freq)(const struct onenand_freq_info *freq_info, -bool *clk_dep);int dma_channel;u8 flags;u8 regulator_can_sleep;
Signature · 1 line
1.7.12
PATCH v8 6/6 ARM: OMAP2+: gpmc: remove cs# in sync clk div calc
In reply to Afzal MohammedDivider value for a certain sync clk is determined solely based on gpmc fclk. CS# does not have any role here, thus remove presence of CS# in clock divider calculation API.
--- arch/arm/mach-omap2/gpmc-onenand.c | 3 +-- arch/arm/mach-omap2/gpmc.c | 4 ++-- arch/arm/plat-omap/include/plat/gpmc.h | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-)
arch/arm/mach-omap2/gpmc-onenand.c +1 -2
@@ -182,7 +182,6 @@ omap2_onenand_calc_sync_timings(struct omap_onenand_platform_data *cfg,int min_gpmc_clk_period, t_ces, t_avds, t_avdh, t_ach, t_aavdh, t_rdyo;int div, fclk_offset_ns, fclk_offset, gpmc_clk_ns;int ticks_cez; -int cs = cfg->cs;if (cfg->flags &ONENAND_SYNC_READ ) onenand_flags =ONENAND_FLAG_SYNCREAD ;
@@ -229,7 +228,7 @@ omap2_onenand_calc_sync_timings(struct omap_onenand_platform_data *cfg,break ; } - div =gpmc_cs_calc_divider (cs, min_gpmc_clk_period); + div =gpmc_calc_divider (min_gpmc_clk_period); gpmc_clk_ns =gpmc_ticks_to_ns (div);if (gpmc_clk_ns <15 )/* >66Mhz */ onenand_flags |=ONENAND_FLAG_HF ;
arch/arm/mach-omap2/gpmc.c +2 -2
@@ -328,7 +328,7 @@ static int set_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit, return -1#endif -int gpmc_cs_calc_divider (int cs,unsigned int sync_clk) +int gpmc_calc_divider (unsigned int sync_clk) {int div;u32 l;
@@ -348,7 +348,7 @@ int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t)int div;u32 l; - div =gpmc_cs_calc_divider (cs, t->sync_clk); + div =gpmc_calc_divider (t->sync_clk);if (div <0 )return div;
arch/arm/plat-omap/include/plat/gpmc.h +1 -1
@@ -179,7 +179,7 @@ extern unsigned long gpmc_get_fclk_period(void);extern void gpmc_cs_write_reg (int cs,int idx,u32 val);extern u32 gpmc_cs_read_reg (int cs,int idx); -extern int gpmc_cs_calc_divider (int cs,unsigned int sync_clk); +extern int gpmc_calc_divider (unsigned int sync_clk);extern int gpmc_cs_set_timings (int cs,const struct gpmc_timings *t);extern int gpmc_cs_request (int cs,unsigned long size,unsigned long *base);extern void gpmc_cs_free (int cs);
Signature · 1 line
1.7.12
v8 cover OMAP-GPMC cleanup for generic timing
In reply to Afzal Mohammed+ Jon and Paul
Quoted 93 lines · Afzal
Hi,
This series prepares gpmc for generic timing. v7 of this series was named "OMAP-GPMC: generic time calc, prepare for driver". generic timing routine has been removed from this series. generic timing will be posted as a new separate series shortly.
This rearrangement has been done so that generic timing series will happen on top of another cleanup series required for common arm zImage. Both will follow shortly. Intention is to make easy path for common arm zImage cleanup.
This series contains minor cleanups that were low hanging fruits came across upon implementing generic timing routine.
This series is same as v7, except that last 4 patches in v7 has been removed from this series (those 4 patches were for generic timing)
This series is available
@ git://gitorious.org/x0148406-public/linux-kernel.git gpmc-prep-v8 and is based on linux-next (next-20121005)Regards
Afzalv8:
Remove generic timing conversion patchesv7:
1. Use picoseconds throughout generic timing routine to prevent rounding error.
2. Documentation on gpmc timings
3. Remove redundant rounding of nand timings (a new patch)v6:
1. Generic timing calculation, move existing users of custom calculation to use the new generic one
2. Set OneNAND part to async mode before gpmc configuration
3. Move extra delay time user handling to proper patch (3/10 -> 2/10)
4. Modify nand init for OMAP3EVM too as support got added
v5:
Use flags for sync_read/write, hv, vhf
v4:
Reorganize OneNAND set_sync/async functions in a better way
v3:
1. Refactor OneNAND set_sync/async functions to separate out timing and configurations
2. Handle bool type timings too
3. Swap patches 2 & 3 due to dependency of OneNAND change on newly added bool type timings
v2:
1. Make use of timing api for setting clock activation time, and remove direct writing to register for clock activation.
2. Move ensuring that async mode in OneNAND has been setup fromset_syncto setup function, improve commit messageAfzal Mohammed (5):
ARM: OMAP2+: nand: unify init functions
ARM: OMAP2+: nand: remove redundant rounding
ARM: OMAP2+: gpmc: handle additional timings
ARM: OMAP2+: onenand: refactor for clarity
ARM: OMAP2+: gpmc: remove cs# in sync clk div calcJon Hunter (1):
ARM: OMAP2+: GPMC: Remove unused OneNANDget_freq()platform functionarch/arm/mach-omap2/board-devkit8000.c | 8 +- arch/arm/mach-omap2/board-flash.c | 45 ++--- arch/arm/mach-omap2/board-flash.h | 6 +- arch/arm/mach-omap2/board-igep0020.c | 2 +- arch/arm/mach-omap2/board-ldp.c | 4 +- arch/arm/mach-omap2/board-omap3beagle.c | 8 +- arch/arm/mach-omap2/board-omap3evm.c | 8 +- arch/arm/mach-omap2/board-omap3touchbook.c | 8 +- arch/arm/mach-omap2/board-overo.c | 7 +- arch/arm/mach-omap2/board-zoom.c | 5 +- arch/arm/mach-omap2/common-board-devices.c | 45 ----- arch/arm/mach-omap2/common-board-devices.h | 1 - arch/arm/mach-omap2/gpmc-nand.c | 30 ++- arch/arm/mach-omap2/gpmc-onenand.c | 232 ++++++++++++------------ arch/arm/mach-omap2/gpmc.c | 52 +++++- arch/arm/mach-omap2/usb-tusb6010.c | 3 +- arch/arm/plat-omap/include/plat/gpmc.h | 21 ++- include/linux/platform_data/mtd-onenand-omap2.h | 8 - 18 files changed, 262 insertions(+), 231 deletions(-)Signature · 1 line
1.7.12