davinci: Platform support for OMAP-L137/AM17x NOR flash driver
Subsystems (4)
PATCH 2/2 davinci: Platform support for OMAP-L137/AM17x NOR flash driver
From: David Griego <[email protected]>
Adds platform support for OMAP-L137/AM17x NOR flash driver.
Also, configures chip select 3 to control NOR flash's upper address lines.
--- arch/arm/mach-davinci/Kconfig | 8 + arch/arm/mach-davinci/board-da830-evm.c | 224 +++++++++++++++++++++++++++++++ 2 files changed, 232 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/Kconfig +8 -0
@@ -142,6 +142,14 @@ config DA830_UI_NAND help Say Y here to use the NAND flash. Do not forget to setup the switch correctly. + +config DA830_UI_NOR + bool "NOR flash" + help + Configure this option to specify the that AEMIF CE2/CE3 will be used to + communicate to the NOR flash. Do not forget to setup the switch SW1 + on UI card correctly. + endchoice config MACH_DAVINCI_DA850_EVM
arch/arm/mach-davinci/board-da830-evm.c +224 -0
242 lines not on this page · raw message
Signature · 1 line
1.5.6
Hello.
Quoted 1 line · Savinay Dharmappa
From: David Griego <[email protected]>
And that's after I have told you this code is not authored by David, but by
Aleksey Makarov... :-(
Quoted 8 lines
Adds platform support for OMAP-L137/AM17x NOR flash driver.
Also, configures chip select 3 to control NOR flash's upper address lines.
Signed-off-by Aleksey Makarov <[email protected]>Signed-off-by Sergei Shtylyov <[email protected]>Signed-off-by Savinay Dharmappa <[email protected]>
Moreover, I'm seeing that you've done some incorrect changes to the
previously correct code. NAK.
[...]
Quoted 5 lines
config
MACH_DAVINCI_DA850_EVMarch/arm/mach-davinci/board-da830-evm.c +0
-0
[...]
Quoted 1 line
arch/arm/mach-davinci/board-da830-evm.c +0
-0@@ -429,6 +431,226 @@ static inline void da830_evm_init_nand(int mux_mode)
[...]
arch/arm/mach-davinci/board-da830-evm.c static inline void da830_evm_init_nand(int mux_mode) · line 486
Quoted 9 lines
arch/arm/mach-davinci/board-da830-evm.c +9
-0+static void da830_evm_nor_done (void *data) +{ +clk_disable (da830_evm_nor.clk); +clk_put (da830_evm_nor.clk); +iounmap (da830_evm_nor.latch.addr); +release_mem_region (DA8XX_AEMIF_CS3_BASE ,PAGE_SIZE ); +iounmap (da830_evm_nor.aemif.addr); +release_mem_region (DA8XX_AEMIF_CTL_BASE ,SZ_32K ); +}
Why you've changed this function which was useful also for the error cleanup
before?
Quoted 7 lines
arch/arm/mach-davinci/board-da830-evm.c +7
-0+static int da830_evm_nor_init (void *data,int cs) +{ +/* Turn on AEMIF clocks */ + da830_evm_nor.clk =clk_get (NULL ,"aemif" ); +if (IS_ERR (da830_evm_nor.clk)) { +pr_err ("%s: could not get AEMIF clock\n" , __func__); + da830_evm_nor.clk =NULL ;
arch/arm/mach-davinci/board-da830-evm.c static inline void da830_evm_init_nand(int mux_mode) · line 504
Quoted 10 lines
arch/arm/mach-davinci/board-da830-evm.c +10
-0+return -ENODEV ; + } +clk_enable (da830_evm_nor.clk); + + da830_evm_nor.aemif.res =request_mem_region (DA8XX_AEMIF_CTL_BASE , +SZ_32K ,"AEMIF control" ); +if (da830_evm_nor.aemif.res ==NULL ) { +pr_err ("%s: could not request AEMIF control region\n" , + __func__); + goto err_aemif_region;
I wonder why you used goto's at all. Anyway, the error cleanup code is
completely broken now.
Quoted 28 lines
arch/arm/mach-davinci/board-da830-evm.c +28
-0+ } + + da830_evm_nor.aemif.addr =ioremap_nocache (DA8XX_AEMIF_CTL_BASE , +SZ_32K ); +if (da830_evm_nor.aemif.addr ==NULL ) { +pr_err ("%s: could not remap AEMIF control region\n" , __func__); + goto err_aemif_ioremap; + } + +/* Setup AEMIF -- timings, etc. */ + +/* Set maximum wait cycles */ +davinci_aemif_setup_timing (&da830_evm_norflash_timing, + da830_evm_nor.aemif.addr, cs); + +davinci_aemif_setup_timing (&da830_evm_norflash_timing, + da830_evm_nor.aemif.addr, cs +1 ); + +/* Setup the window to access the latch */ + da830_evm_nor.latch.res = +request_mem_region (DA8XX_AEMIF_CS3_BASE ,PAGE_SIZE , +"DA830 UI NOR address latch" ); +if (da830_evm_nor.latch.res ==NULL ) { +pr_err ("%s: could not request address latch region\n" , + __func__); + goto err_latch_region; + } +
arch/arm/mach-davinci/board-da830-evm.c static inline void da830_evm_init_nand(int mux_mode) · line 542
Quoted 10 lines
arch/arm/mach-davinci/board-da830-evm.c +10
-0+ da830_evm_nor.latch.addr = +ioremap_nocache (DA8XX_AEMIF_CS3_BASE ,PAGE_SIZE ); +if (da830_evm_nor.latch.addr ==NULL ) { +pr_err ("%s: could not remap address latch region\n" , __func__); + goto err_latch_ioremap; + } +return 0 ; + +err_aemif_region: +release_mem_region (DA8XX_AEMIF_CTL_BASE ,SZ_32K );
Why release what you've just failed to request?!
arch/arm/mach-davinci/board-da830-evm.c static inline void da830_evm_init_nand(int mux_mode) · line 543
Quoted 1 line
arch/arm/mach-davinci/board-da830-evm.c +1
-0+ da830_evm_nor.aemif.res =NULL ;
Useless assignment.
arch/arm/mach-davinci/board-da830-evm.c
Quoted 1 line
arch/arm/mach-davinci/board-da830-evm.c +1
-0+return -EBUSY ;
And you're not calling clk_disable().
arch/arm/mach-davinci/board-da830-evm.c static inline void da830_evm_init_nand(int mux_mode) · line 547
Quoted 2 lines
arch/arm/mach-davinci/board-da830-evm.c +2
-0+err_aemif_ioremap: +iounmap (da830_evm_nor.aemif.addr);
Why unmap what you've just failed to map?! da830_evm_nor.aemif.addr is NULL.
arch/arm/mach-davinci/board-da830-evm.c static inline void da830_evm_init_nand(int mux_mode) · line 548
Quoted 1 line
arch/arm/mach-davinci/board-da830-evm.c +1
-0+ da830_evm_nor.aemif.addr =NULL ;
Useless assignment.
arch/arm/mach-davinci/board-da830-evm.c
Quoted 1 line
arch/arm/mach-davinci/board-da830-evm.c +1
-0+return -ENOMEM ;
You're not calling release_mem_region() and clk_disable().
arch/arm/mach-davinci/board-da830-evm.c static inline void da830_evm_init_nand(int mux_mode) · line 552
Quoted 2 lines
arch/arm/mach-davinci/board-da830-evm.c +2
-0+err_latch_region: +release_mem_region (DA8XX_AEMIF_CS3_BASE ,PAGE_SIZE );
Why release what you've just failed to request?!
arch/arm/mach-davinci/board-da830-evm.c static inline void da830_evm_init_nand(int mux_mode) · line 553
Quoted 1 line
arch/arm/mach-davinci/board-da830-evm.c +1
-0+ da830_evm_nor.latch.res =NULL ;
Useless assginment.
arch/arm/mach-davinci/board-da830-evm.c
Quoted 1 line
arch/arm/mach-davinci/board-da830-evm.c +1
-0+return -EBUSY ;
You're not calling iounmap() and release_mem_region() for the NOR flash
region and also not calling clk_disable().
arch/arm/mach-davinci/board-da830-evm.c static inline void da830_evm_init_nand(int mux_mode) · line 557
Quoted 3 lines
arch/arm/mach-davinci/board-da830-evm.c +3
-0+ +err_latch_ioremap: +iounmap (da830_evm_nor.latch.addr);
Why unmap what you've just failed to map?! da830_evm_nor.latch.addr is NULL.
arch/arm/mach-davinci/board-da830-evm.c static inline void da830_evm_init_nand(int mux_mode) · line 558
Quoted 1 line
arch/arm/mach-davinci/board-da830-evm.c +1
-0+ da830_evm_nor.latch.addr =NULL ;
Useless assginment.
arch/arm/mach-davinci/board-da830-evm.c
Quoted 1 line
arch/arm/mach-davinci/board-da830-evm.c +1
-0+return -ENOMEM ;
You're not release_mem_region() for the latch region, not calling iounmap()
and release_mem_region() for the NOR flash region and also not calling clk_disable().
Quoted 1 line
+}
[...]
Your changes made me doubt that you actually understood the code well enough
before doing them...
WBR, Sergei
Hi Sergei,
Quoted 4 lines · Sergei Shtylyov
Quoted 4 lines
arch/arm/mach-davinci/board-da830-evm.c +4
-0+static void da830_evm_nor_done (void *data) +{ +clk_disable (da830_evm_nor.clk); +clk_put (da830_evm_nor.clk);
Quoted 8 lines
arch/arm/mach-davinci/board-da830-evm.c static inline void da830_evm_init_nand(int mux_mode) · line 486
Quoted 5 lines
arch/arm/mach-davinci/board-da830-evm.c +5
-0+iounmap (da830_evm_nor.latch.addr); +release_mem_region (DA8XX_AEMIF_CS3_BASE ,PAGE_SIZE ); +iounmap (da830_evm_nor.aemif.addr); +release_mem_region (DA8XX_AEMIF_CTL_BASE ,SZ_32K ); +}Why you've changed this function which was useful also for the error cleanup
before?
The issues down below aside, I think goto based error handling is clearer to follow. Any objections to using goto based error handing per-se?
Thanks,
Sekhar
Quoted 127 lines
Quoted 8 lines
arch/arm/mach-davinci/board-da830-evm.c +7
-0+static int da830_evm_nor_init (void *data,int cs) +{ +/* Turn on AEMIF clocks */ + da830_evm_nor.clk =clk_get (NULL ,"aemif" ); +if (IS_ERR (da830_evm_nor.clk)) { +pr_err ("%s: could not get AEMIF clock\n" , __func__); + da830_evm_nor.clk =NULL ;arch/arm/mach-davinci/board-da830-evm.c static inline void da830_evm_init_nand(int mux_mode) · line 504
Quoted 10 lines
arch/arm/mach-davinci/board-da830-evm.c +10
-0+return -ENODEV ; + } +clk_enable (da830_evm_nor.clk); + + da830_evm_nor.aemif.res =request_mem_region (DA8XX_AEMIF_CTL_BASE , +SZ_32K ,"AEMIF control" ); +if (da830_evm_nor.aemif.res ==NULL ) { +pr_err ("%s: could not request AEMIF control region\n" , + __func__); + goto err_aemif_region;I wonder why you used goto's at all. Anyway, the error cleanup code is
completely broken now.Quoted 28 lines
arch/arm/mach-davinci/board-da830-evm.c +28
-0+ } + + da830_evm_nor.aemif.addr =ioremap_nocache (DA8XX_AEMIF_CTL_BASE , +SZ_32K ); +if (da830_evm_nor.aemif.addr ==NULL ) { +pr_err ("%s: could not remap AEMIF control region\n" , __func__); + goto err_aemif_ioremap; + } + +/* Setup AEMIF -- timings, etc. */ + +/* Set maximum wait cycles */ +davinci_aemif_setup_timing (&da830_evm_norflash_timing, + da830_evm_nor.aemif.addr, cs); + +davinci_aemif_setup_timing (&da830_evm_norflash_timing, + da830_evm_nor.aemif.addr, cs +1 ); + +/* Setup the window to access the latch */ + da830_evm_nor.latch.res = +request_mem_region (DA8XX_AEMIF_CS3_BASE ,PAGE_SIZE , +"DA830 UI NOR address latch" ); +if (da830_evm_nor.latch.res ==NULL ) { +pr_err ("%s: could not request address latch region\n" , + __func__); + goto err_latch_region; + } +arch/arm/mach-davinci/board-da830-evm.c static inline void da830_evm_init_nand(int mux_mode) · line 542
Quoted 10 lines
arch/arm/mach-davinci/board-da830-evm.c +10
-0+ da830_evm_nor.latch.addr = +ioremap_nocache (DA8XX_AEMIF_CS3_BASE ,PAGE_SIZE ); +if (da830_evm_nor.latch.addr ==NULL ) { +pr_err ("%s: could not remap address latch region\n" , __func__); + goto err_latch_ioremap; + } +return 0 ; + +err_aemif_region: +release_mem_region (DA8XX_AEMIF_CTL_BASE ,SZ_32K );Why release what you've just failed to request?!
Quoted 1 line
+ da830_evm_nor.aemif.res = NULL;
Useless assignment.
Quoted 1 line
+ return
-EBUSY;And you're not calling
clk_disable().arch/arm/mach-davinci/board-da830-evm.c static inline void da830_evm_init_nand(int mux_mode) · line 547
Quoted 2 lines
arch/arm/mach-davinci/board-da830-evm.c +2
-0+err_aemif_ioremap: +iounmap (da830_evm_nor.aemif.addr);Why unmap what you've just failed to map?! da830_evm_nor.aemif.addr is NULL.
Quoted 1 line
+ da830_evm_nor.aemif.addr = NULL;
Useless assignment.
Quoted 1 line
+ return
-ENOMEM;You're not calling
release_mem_region()andclk_disable().arch/arm/mach-davinci/board-da830-evm.c static inline void da830_evm_init_nand(int mux_mode) · line 552
Quoted 2 lines
arch/arm/mach-davinci/board-da830-evm.c +2
-0+err_latch_region: +release_mem_region (DA8XX_AEMIF_CS3_BASE ,PAGE_SIZE );Why release what you've just failed to request?!
Quoted 1 line
+ da830_evm_nor.latch.res = NULL;
Useless assginment.
Quoted 1 line
+ return
-EBUSY;You're not calling
iounmap()andrelease_mem_region()for the NOR flash
region and also not callingclk_disable().arch/arm/mach-davinci/board-da830-evm.c static inline void da830_evm_init_nand(int mux_mode) · line 557
Quoted 3 lines
arch/arm/mach-davinci/board-da830-evm.c +3
-0+ +err_latch_ioremap: +iounmap (da830_evm_nor.latch.addr);Why unmap what you've just failed to map?! da830_evm_nor.latch.addr is NULL.
Quoted 1 line
+ da830_evm_nor.latch.addr = NULL;
Useless assginment.
Quoted 1 line
+ return
-ENOMEM;You're not
release_mem_region()for the latch region, not callingiounmap()
andrelease_mem_region()for the NOR flash region and also not callingclk_disable().Quoted 1 line
+}
[...]
Your changes made me doubt that you actually understood the code well enough
before doing them...WBR, Sergei
_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
Quoted 17 lines · Sekhar
Hi Sergei,
Quoted 4 lines · Sergei Shtylyov
Quoted 4 lines
arch/arm/mach-davinci/board-da830-evm.c +4
-0+static void da830_evm_nor_done (void *data) +{ + clk_disable(da830_evm_nor.clk); + clk_put(da830_evm_nor.clk);Quoted 8 lines
Quoted 5 lines
+
iounmap(da830_evm_nor.latch.addr);
+release_mem_region(DA8XX_AEMIF_CS3_BASE, PAGE_SIZE);
+iounmap(da830_evm_nor.aemif.addr);
+release_mem_region(DA8XX_AEMIF_CTL_BASE, SZ_32K); +}Why you've changed this function which was useful also for the error cleanup before?
Quoted 3 lines
The issues down below aside, I think goto based error handling is clearer to follow. Any objections to using goto based error handing per-se?
What you're saying just doesn't make sense in this context. Whatever way of error handling is chosen, it first needs to be correct which is absolutely not the case here.
~Vitaly
Quoted 18 lines · Vitaly Wool
Quoted 17 lines · Sekhar
Hi Sergei,
Quoted 12 lines · Sergei Shtylyov
arch/arm/mach-davinci/board-da830-evm.c static inline void da830_evm_init_nand(int mux_mode) · line 486
Quoted 9 lines
arch/arm/mach-davinci/board-da830-evm.c +9
-0+static void da830_evm_nor_done (void *data) +{ +clk_disable (da830_evm_nor.clk); +clk_put (da830_evm_nor.clk); +iounmap (da830_evm_nor.latch.addr); +release_mem_region (DA8XX_AEMIF_CS3_BASE ,PAGE_SIZE ); +iounmap (da830_evm_nor.aemif.addr); +release_mem_region (DA8XX_AEMIF_CTL_BASE ,SZ_32K ); +}Why you've changed this function which was useful also for the error cleanup
before?
Quoted 7 lines
Quoted 3 lines
The issues down below aside, I think goto based error handling is clearer to follow. Any objections to using goto based error handing per-se?
What you're saying just doesn't make sense in this context. Whatever way of error handling is chosen, it first needs to be correct which is absolutely not the case here.
Yes, agreed. It needs to be correct first.
Thanks,
Sekhar
Hello.
Quoted 13 lines · Sekhar
Quoted 4 lines
Quoted 4 lines
arch/arm/mach-davinci/board-da830-evm.c +4
-0+static void da830_evm_nor_done (void *data) +{ +clk_disable (da830_evm_nor.clk); +clk_put (da830_evm_nor.clk);Quoted 8 lines
arch/arm/mach-davinci/board-da830-evm.c static inline void da830_evm_init_nand(int mux_mode) · line 486
Quoted 5 lines
arch/arm/mach-davinci/board-da830-evm.c +5
-0+iounmap (da830_evm_nor.latch.addr); +release_mem_region (DA8XX_AEMIF_CS3_BASE ,PAGE_SIZE ); +iounmap (da830_evm_nor.aemif.addr); +release_mem_region (DA8XX_AEMIF_CTL_BASE ,SZ_32K ); +}Why you've changed this function which was useful also for the error cleanup
before?
Quoted 3 lines
The issues down below aside, I think goto based error handling is clearer to follow. Any objections to using goto based error handing per-se?
I think the code was more compact with the old error handling. And anyway,
I'm not feeling happy when TI is changing MV's code.
Quoted 2 lines
Thanks,
Sekhar
WBR, Sergei
Quoted 2 lines · Sergei Shtylyov
I think the code was more compact with the old error handling. And anyway, I'm not feeling happy when TI is changing MV's code.
Leaving the inter-vendor relations aside, I'd say, anyone can modify any GPL code. The thing is, this person can not just inherit Signed-off-by from the previous version, and this is what happened I guess.
~Vitaly