IDE code cleanup
cover IDE code cleanup
This series tries to remove all SoC-specific and board-specific code from cmd_ide. Whenever an existing hook is present, it is used instead, when no appropriate hook is present, one is created (either as a hook call or by using the weak alias technique). The aim of this series is to prepare for DM conversion, where most of the cmd_ide code will create a new universal IDE driver, and all hooks and overrides will be provided in its platform data.
note: this series has not been tested on the actual hardware
Pavel Herrmann (10):
remove CONFIG_SC3 from cmd_ide.c
split mpc8xx hooks from cmd_ide.c
split IVM power hooks from cmd_ide.c
change all versions of input_data() and output_data() to global weak
aliases
split CPC45 board-specific IDE functions from cmd_ide.c make ide_led() a weak alias
move CPC45 ide_led to the same file as other IDE hooks split AU1X00 specific code from cmd_ide.c
split PCS440EP specific code from cmd_ide.c
remove unnecessary includes from cmd_ide.c
arch/mips/cpu/mips32/au1x00/Makefile | 2 +- arch/mips/cpu/mips32/au1x00/au1x00_ide.c | 33 +++ arch/powerpc/lib/Makefile | 1 + arch/powerpc/lib/ide.c | 207 +++++++++++++ arch/powerpc/lib/ide.h | 31 ++ board/cpc45/Makefile | 2 +- board/cpc45/cpc45.c | 15 - board/cpc45/ide.c | 145 +++++++++ board/esd/cpci750/ide.c | 1 - board/ivm/ivm.c | 46 +++ board/linkstation/ide.c | 1 - board/pcs440ep/pcs440ep.c | 57 +++- common/cmd_ide.c | 484 +++++-------------------------- include/configs/CPC45.h | 1 + include/configs/ICU862.h | 1 + include/configs/IVML24.h | 2 + include/configs/IVMS8.h | 2 + include/configs/KUP4K.h | 1 + include/configs/KUP4X.h | 1 + include/configs/MBX.h | 1 + include/configs/NETTA.h | 1 + include/configs/NSCU.h | 1 + include/configs/R360MPI.h | 1 + include/configs/RPXClassic.h | 1 + include/configs/RPXlite.h | 1 + include/configs/RPXlite_DW.h | 1 + include/configs/RRvision.h | 1 + include/configs/SPD823TS.h | 2 + include/configs/TK885D.h | 1 + include/configs/TQM823L.h | 1 + include/configs/TQM823M.h | 1 + include/configs/TQM850L.h | 1 + include/configs/TQM850M.h | 1 + include/configs/TQM855L.h | 1 + include/configs/TQM855M.h | 1 + include/configs/TQM860L.h | 1 + include/configs/TQM860M.h | 1 + include/configs/TQM862L.h | 1 + include/configs/TQM862M.h | 1 + include/configs/TQM866M.h | 1 + include/configs/TQM885D.h | 1 + include/configs/atc.h | 1 + include/configs/c2mon.h | 1 + include/configs/lwmon.h | 1 + include/configs/quantum.h | 1 + include/configs/svm_sc8xx.h | 2 + include/configs/uc100.h | 1 + include/configs/virtlab2.h | 1 + include/ide.h | 19 ++ 49 files changed, 650 insertions(+), 433 deletions(-) create mode 100644 arch/mips/cpu/mips32/au1x00/au1x00_ide.c create mode 100644 arch/powerpc/lib/ide.c create mode 100644 arch/powerpc/lib/ide.h create mode 100644 board/cpc45/ide.c
Signature · 1 line
1.7.12
PATCH 1/10 remove CONFIG_SC3 from cmd_ide.c
There is no difference in codepath with CONFIG_SC3 enabled, so just remove it
--- common/cmd_ide.c | 7 ------- 1 file changed, 7 deletions(-)
common/cmd_ide.c +0 -7
@@ -400,9 +400,6 @@ void ide_init(void)unsigned char c;int i, bus; -#if defined(CONFIG_SC3 ) -unsigned int ata_reset_time =ATA_RESET_TIME ; -#endif #ifdef CONFIG_IDE_8xx_PCCARDextern int pcmcia_on (void );extern int ide_devices_found;/* Initialized in check_ide_device() */
@@ -502,11 +499,7 @@ void ide_init(void) c =ide_inb (dev,ATA_STATUS ); i++; -#if defined(CONFIG_SC3 ) -if (i > (ata_reset_time *100 )) { -#else if (i > (ATA_RESET_TIME *100 )) { -#endif puts ("** Timeout **\n" );/* LED's off */ ide_led ((LED_IDE1 |LED_IDE2 ),0 );
Signature · 1 line
1.7.12
PATCH 1/10 remove CONFIG_SC3 from cmd_ide.c
Quoted 3 lines · Pavel Herrmann
There is no difference in codepath with
CONFIG_SC3enabled, so just remove itSigned-off-by Pavel Herrmann <[email protected]>
This, and the rest of the series (with v2 for 2, 4, 7 and 8) has been applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20121017/9ed9996c/attachment.pgp>
PATCH 2/10 split mpc8xx hooks from cmd_ide.c
In reply to Pavel Herrmannmove most of mpc8xx hooks from cmd_ide.c into ide_preinit() and newly created ide_init_postreset() (invoked after calling ide_reset after ide_preinit), some cleanup to make checkpatch happy, enable IDE init hooks in configs of affected boards.
Confusingly, these hooks are used by more than just mpc8xx-based boards, and therefore are placed in arch/ppc/lib/
note: checkpatch still emits warnings about using volatile
--- arch/powerpc/lib/Makefile | 1 + arch/powerpc/lib/ide.c | 207 +++++++++++++++++++++++++++++++++++++++++++ arch/powerpc/lib/ide.h | 31 +++++++ common/cmd_ide.c | 190 ++------------------------------------- include/configs/CPC45.h | 1 + include/configs/ICU862.h | 1 + include/configs/IVML24.h | 2 + include/configs/IVMS8.h | 2 + include/configs/KUP4K.h | 1 + include/configs/KUP4X.h | 1 + include/configs/MBX.h | 1 + include/configs/NETTA.h | 1 + include/configs/NSCU.h | 1 + include/configs/R360MPI.h | 1 + include/configs/RPXClassic.h | 1 + include/configs/RPXlite.h | 1 + include/configs/RPXlite_DW.h | 1 + include/configs/RRvision.h | 1 + include/configs/SPD823TS.h | 2 + include/configs/TK885D.h | 1 + include/configs/TQM823L.h | 1 + include/configs/TQM823M.h | 1 + include/configs/TQM850L.h | 1 + include/configs/TQM850M.h | 1 + include/configs/TQM855L.h | 1 + include/configs/TQM855M.h | 1 + include/configs/TQM860L.h | 1 + include/configs/TQM860M.h | 1 + include/configs/TQM862L.h | 1 + include/configs/TQM862M.h | 1 + include/configs/TQM866M.h | 1 + include/configs/TQM885D.h | 1 + include/configs/atc.h | 1 + include/configs/c2mon.h | 1 + include/configs/lwmon.h | 1 + include/configs/quantum.h | 1 + include/configs/svm_sc8xx.h | 2 + include/configs/uc100.h | 1 + include/configs/virtlab2.h | 1 + include/ide.h | 8 ++ 40 files changed, 293 insertions(+), 183 deletions(-) create mode 100644 arch/powerpc/lib/ide.c create mode 100644 arch/powerpc/lib/ide.h
arch/powerpc/lib/Makefile +1 -0
@@ -50,6 +50,7 @@ COBJS-y += cache.o COBJS-y += extable.o COBJS-y += interrupts.o COBJS-$(CONFIG_CMD_KGDB) += kgdb.o +COBJS-${CONFIG_CMD_IDE} += ide.o COBJS-y += time.o # Workaround for local bus unaligned access problems
arch/powerpc/lib/ide.c new file +207 -0
207 lines not on this page · raw message
arch/powerpc/lib/ide.h new file +31 -0
@@ -0,0 +1,31 @@ +/* +* (C) Copyright 2012 +* Pavel Herrmann <[email protected]> +* +* See file CREDITS for list of people who contributed to this +* project. +* +* 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. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#ifndef _MPC8XX_IDE_H_ +#define _MPC8XX_IDE_H_ 1 + +#ifdef CONFIG_IDE_8xx_PCCARD +int pcmcia_on (void ); +extern int ide_devices_found; +#endif +#endif
common/cmd_ide.c +7 -183
243 lines not on this page · raw message
include/configs/CPC45.h +1 -0
@@ -480,6 +480,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/ICU862.h +1 -0
@@ -349,6 +349,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/IVML24.h +2 -0
@@ -318,6 +318,8 @@* IDE/ATA stuff *----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ +#define CONFIG_IDE_INIT_POSTRESET 1/* Use postreset IDE hook */ #define CONFIG_IDE_8xx_DIRECT 1/* PCMCIA interface required */ #define CONFIG_IDE_RESET 1/* reset for ide supported */
include/configs/IVMS8.h +2 -0
@@ -312,6 +312,8 @@* IDE/ATA stuff *----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ +#define CONFIG_IDE_INIT_POSTRESET 1/* Use postreset IDE hook */ #define CONFIG_IDE_8xx_DIRECT 1/* PCMCIA interface required */ #define CONFIG_IDE_RESET 1/* reset for ide supported */
include/configs/KUP4K.h +1 -0
@@ -353,6 +353,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/KUP4X.h +1 -0
@@ -366,6 +366,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/MBX.h +1 -0
@@ -276,6 +276,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/NETTA.h +1 -0
@@ -629,6 +629,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/NSCU.h +1 -0
@@ -318,6 +318,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/R360MPI.h +1 -0
@@ -329,6 +329,7 @@*/ #if 1 +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/RPXClassic.h +1 -0
@@ -314,6 +314,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/RPXlite.h +1 -0
@@ -249,6 +249,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/RPXlite_DW.h +1 -0
@@ -335,6 +335,7 @@* IDE/ATA stuff (Supports IDE harddisk on PCMCIA Adapter) *----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/RRvision.h +1 -0
@@ -329,6 +329,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/SPD823TS.h +2 -0
@@ -303,6 +303,8 @@* IDE/ATA stuff *----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ +#define CONFIG_IDE_INIT_POSTRESET 1/* Use postreset IDE hook */ #define CONFIG_IDE_8xx_DIRECT 1/* PCMCIA interface required */ #define CONFIG_IDE_LED 1/* LED for ide supported */ #define CONFIG_IDE_RESET 1/* reset for ide supported */
include/configs/TK885D.h +1 -0
@@ -343,6 +343,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/TQM823L.h +1 -0
@@ -335,6 +335,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/TQM823M.h +1 -0
@@ -331,6 +331,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/TQM850L.h +1 -0
@@ -320,6 +320,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/TQM850M.h +1 -0
@@ -322,6 +322,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/TQM855L.h +1 -0
@@ -324,6 +324,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/TQM855M.h +1 -0
@@ -359,6 +359,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/TQM860L.h +1 -0
@@ -323,6 +323,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/TQM860M.h +1 -0
@@ -324,6 +324,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/TQM862L.h +1 -0
@@ -327,6 +327,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/TQM862M.h +1 -0
@@ -328,6 +328,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/TQM866M.h +1 -0
@@ -356,6 +356,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/TQM885D.h +1 -0
@@ -341,6 +341,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/atc.h +1 -0
@@ -482,6 +482,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/c2mon.h +1 -0
@@ -302,6 +302,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/lwmon.h +1 -0
@@ -495,6 +495,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/quantum.h +1 -0
@@ -317,6 +317,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/svm_sc8xx.h +2 -0
@@ -359,6 +359,8 @@#undef CONFIG_IDE_8xx_PCCARD/* Use IDE with PC Card Adapter */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ +#define CONFIG_IDE_INIT_POSTRESET 1/* Use postreset IDE hook */ #define CONFIG_IDE_8xx_DIRECT 1/* Direct IDE not supported */ #undef CONFIG_IDE_LED/* LED for ide not supported */ #undef CONFIG_IDE_RESET/* reset for ide not supported */
include/configs/uc100.h +1 -0
@@ -331,6 +331,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/virtlab2.h +1 -0
@@ -329,6 +329,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/ide.h +8 -0
@@ -54,6 +54,14 @@ void ide_init(void);ulong ide_read (int device,lbaint_t blknr,ulong blkcnt,void *buffer);ulong ide_write (int device,lbaint_t blknr,ulong blkcnt,const void *buffer); +#ifdef CONFIG_IDE_PREINIT +int ide_preinit (void ); +#endif + +#ifdef CONFIG_IDE_INIT_POSTRESET +int ide_init_postreset (void ); +#endif +#if defined(CONFIG_OF_IDE_FIXUP )int ide_device_present (int dev);#endif
Signature · 1 line
1.7.12
PATCH 2/10 split mpc8xx hooks from cmd_ide.c
Dear Pavel Herrmann,
Quoted 8 lines
move most of mpc8xx hooks from
cmd_ide.cintoide_preinit()and newly createdide_init_postreset()(invoked after callingide_resetafteride_preinit), some cleanup to make checkpatch happy, enable IDE init hooks in configs of affected boards.
Confusingly, these hooks are used by more than just mpc8xx-based boards, and therefore are placed inarch/ppc/lib/note: checkpatch still emits warnings about using volatile
[...]
Review
Quoted 2 lines
(quoted diff) +2
-0+ +
Too many spaces -- one space too much.
Quoted 28 lines
arch/powerpc/lib/ide.c new file +28
-0+int ide_preinit (void ) +{ +int i; +/* Initialize PIO timing tables */ +for (i =0 ; i <=IDE_MAX_PIO_MODE ; ++i) { + pio_config_clk[i].t_setup = +PCMCIA_MK_CLKS (pio_config_ns[i].t_setup, gd->bus_clk); + pio_config_clk[i].t_length = +PCMCIA_MK_CLKS (pio_config_ns[i].t_length, gd->bus_clk); + pio_config_clk[i].t_hold = +PCMCIA_MK_CLKS (pio_config_ns[i].t_hold, gd->bus_clk); +debug ("PIO Mode %d: setup=%2d ns/%d clk" " len=%3d ns/%d clk" +" hold=%2d ns/%d clk\n" , i, pio_config_ns[i].t_setup, + pio_config_clk[i].t_setup, pio_config_ns[i].t_length, + pio_config_clk[i].t_length, pio_config_ns[i].t_hold, + pio_config_clk[i].t_hold); + } + +return 0 ; +} + +int ide_init_postreset (void ) +{ +volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR ; +volatile pcmconf8xx_t *pcmp = &(immr->im_pcmcia); + +/* PCMCIA / IDE initialization for common mem space */ + pcmp->pcmc_pgcrb =0 ;
arch/powerpc/lib/ide.c line 192
Quoted 10 lines
arch/powerpc/lib/ide.c new file +10
-0+ +/* start in PIO mode 0 - most relaxed timings */ + pio_mode =0 ; +set_pcmcia_timing (pio_mode); + return 0; +} +#endif /* CONFIG_IDE_8xx_DIRECT */ + + +
DTTO
Quoted 5 lines
arch/powerpc/lib/ide.c new file +5
-0+#ifdef CONFIG_IDE_8xx_PCCARD + +int ide_preinit (void ) +{ + ide_devices_found =0 ;
arch/powerpc/lib/ide.c line 207
Quoted 10 lines
arch/powerpc/lib/ide.c new file +10
-0+/* initialize the PCMCIA IDE adapter card */ +pcmcia_on (); +if (!ide_devices_found) +return 1 ; +udelay (1000000 );/* 1 s */ + return 0; +} +#endif + +
Trailing newlines
Quoted 25 lines
arch/powerpc/lib/ide.h new file +19
-0@@ -0,0 +1,31 @@ +/* +* (C) Copyright 2012 +* Pavel Herrmann <[email protected]> +* +* See file CREDITS for list of people who contributed to this +* project. +* +* 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. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software
arch/powerpc/lib/ide.h line 29
Quoted 10 lines
arch/powerpc/lib/ide.h new file +10
-0+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#ifndef _MPC8XX_IDE_H_ +#define _MPC8XX_IDE_H_ 1 + +#ifdef CONFIG_IDE_8xx_PCCARD +int pcmcia_on (void ); +extern int ide_devices_found;
Why is this needed? Where was this before ? Is include/pcmcia.h not good?
Quoted 2 lines
arch/powerpc/lib/ide.h new file +2
-0+#endif +#endif
[...]
include/configs/ICU862.h line 352
Quoted 9 lines
include/configs/ICU862.h +1
-0@@ -349,6 +349,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */
Do you need this defined to a particular value or is having this defined enough?
Quoted 1 line
include/configs/ICU862.h +0
-0#define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter
[...]
Quoted 20 lines
include/ide.h +8
-0@@ -54,6 +54,14 @@ void ide_init(void);ulong ide_read (int device,lbaint_t blknr,ulong blkcnt,void *buffer);ulong ide_write (int device,lbaint_t blknr,ulong blkcnt,const void *buffer); +#ifdef CONFIG_IDE_PREINIT +int ide_preinit (void ); +#endif + +#ifdef CONFIG_IDE_INIT_POSTRESET +int ide_init_postreset (void ); +#endif +#if defined(CONFIG_OF_IDE_FIXUP )int ide_device_present (int dev);#endif
PATCH 2/10 split mpc8xx hooks from cmd_ide.c
In reply to Pavel HerrmannDear Pavel Herrmann,
Quoted 11 lines
move most of mpc8xx hooks from
cmd_ide.cintoide_preinit()and newly createdide_init_postreset()(invoked after callingide_resetafteride_preinit), some cleanup to make checkpatch happy, enable IDE init hooks in configs of affected boards.
Confusingly, these hooks are used by more than just mpc8xx-based boards, and therefore are placed inarch/ppc/lib/note: checkpatch still emits warnings about using volatile
Signed-off-by Pavel Herrmann <[email protected]>---
[...]
include/ide.h void ide_init(void); · line 58
Quoted 8 lines
include/ide.h +1
-0@@ -54,6 +54,14 @@ void ide_init(void);ulong ide_read (int device,lbaint_t blknr,ulong blkcnt,void *buffer);ulong ide_write (int device,lbaint_t blknr,ulong blkcnt,const void *buffer); +#ifdef CONFIG_IDE_PREINIT
Is there some documentation for these new config variables?
Quoted 10 lines
include/ide.h +7
-0+int ide_preinit (void ); +#endif + +#ifdef CONFIG_IDE_INIT_POSTRESET +int ide_init_postreset (void ); +#endif +#if defined(CONFIG_OF_IDE_FIXUP )int ide_device_present (int dev);#endif
PATCH v2 2/10 split mpc8xx hooks from cmd_ide.c
In reply to Pavel Herrmannmove most of mpc8xx hooks from cmd_ide.c into ide_preinit() and newly created ide_init_postreset() (invoked after calling ide_reset after ide_preinit), some cleanup to make checkpatch happy, enable IDE init hooks in configs of affected boards.
confusingly, these hooks are used by more than just mpc8xx-based boards, and therefore are placed in arch/ppc/lib/
note: checkpatch still emits warnings about using volatile
---
Changes for v2:
style fixes
arch/powerpc/lib/Makefile | 1 + arch/powerpc/lib/ide.c | 201 +++++++++++++++++++++++++++++++++++++++++++ arch/powerpc/lib/ide.h | 31 +++++++ common/cmd_ide.c | 190 ++-------------------------------------- include/configs/CPC45.h | 1 + include/configs/ICU862.h | 1 + include/configs/IVML24.h | 2 + include/configs/IVMS8.h | 2 + include/configs/KUP4K.h | 1 + include/configs/KUP4X.h | 1 + include/configs/MBX.h | 1 + include/configs/NETTA.h | 1 + include/configs/NSCU.h | 1 + include/configs/R360MPI.h | 1 + include/configs/RPXClassic.h | 1 + include/configs/RPXlite.h | 1 + include/configs/RPXlite_DW.h | 1 + include/configs/RRvision.h | 1 + include/configs/SPD823TS.h | 2 + include/configs/TK885D.h | 1 + include/configs/TQM823L.h | 1 + include/configs/TQM823M.h | 1 + include/configs/TQM850L.h | 1 + include/configs/TQM850M.h | 1 + include/configs/TQM855L.h | 1 + include/configs/TQM855M.h | 1 + include/configs/TQM860L.h | 1 + include/configs/TQM860M.h | 1 + include/configs/TQM862L.h | 1 + include/configs/TQM862M.h | 1 + include/configs/TQM866M.h | 1 + include/configs/TQM885D.h | 1 + include/configs/atc.h | 1 + include/configs/c2mon.h | 1 + include/configs/lwmon.h | 1 + include/configs/quantum.h | 1 + include/configs/svm_sc8xx.h | 2 + include/configs/uc100.h | 1 + include/configs/virtlab2.h | 1 + include/ide.h | 8 ++ 40 files changed, 287 insertions(+), 183 deletions(-) create mode 100644 arch/powerpc/lib/ide.c create mode 100644 arch/powerpc/lib/ide.h
arch/powerpc/lib/Makefile +1 -0
@@ -50,6 +50,7 @@ COBJS-y += cache.o COBJS-y += extable.o COBJS-y += interrupts.o COBJS-$(CONFIG_CMD_KGDB) += kgdb.o +COBJS-${CONFIG_CMD_IDE} += ide.o COBJS-y += time.o # Workaround for local bus unaligned access problems
arch/powerpc/lib/ide.c new file +201 -0
201 lines not on this page · raw message
arch/powerpc/lib/ide.h new file +31 -0
@@ -0,0 +1,31 @@ +/* +* (C) Copyright 2012 +* Pavel Herrmann <[email protected]> +* +* See file CREDITS for list of people who contributed to this +* project. +* +* 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. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#ifndef _MPC8XX_IDE_H_ +#define _MPC8XX_IDE_H_ 1 + +#ifdef CONFIG_IDE_8xx_PCCARD +int pcmcia_on (void ); +extern int ide_devices_found; +#endif +#endif
common/cmd_ide.c +7 -183
243 lines not on this page · raw message
include/configs/CPC45.h +1 -0
@@ -480,6 +480,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/ICU862.h +1 -0
@@ -349,6 +349,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/IVML24.h +2 -0
@@ -318,6 +318,8 @@* IDE/ATA stuff *----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ +#define CONFIG_IDE_INIT_POSTRESET 1/* Use postreset IDE hook */ #define CONFIG_IDE_8xx_DIRECT 1/* PCMCIA interface required */ #define CONFIG_IDE_RESET 1/* reset for ide supported */
include/configs/IVMS8.h +2 -0
@@ -312,6 +312,8 @@* IDE/ATA stuff *----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ +#define CONFIG_IDE_INIT_POSTRESET 1/* Use postreset IDE hook */ #define CONFIG_IDE_8xx_DIRECT 1/* PCMCIA interface required */ #define CONFIG_IDE_RESET 1/* reset for ide supported */
include/configs/KUP4K.h +1 -0
@@ -353,6 +353,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/KUP4X.h +1 -0
@@ -366,6 +366,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/MBX.h +1 -0
@@ -276,6 +276,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/NETTA.h +1 -0
@@ -629,6 +629,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/NSCU.h +1 -0
@@ -318,6 +318,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/R360MPI.h +1 -0
@@ -329,6 +329,7 @@*/ #if 1 +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/RPXClassic.h +1 -0
@@ -314,6 +314,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/RPXlite.h +1 -0
@@ -249,6 +249,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/RPXlite_DW.h +1 -0
@@ -335,6 +335,7 @@* IDE/ATA stuff (Supports IDE harddisk on PCMCIA Adapter) *----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/RRvision.h +1 -0
@@ -329,6 +329,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/SPD823TS.h +2 -0
@@ -303,6 +303,8 @@* IDE/ATA stuff *----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ +#define CONFIG_IDE_INIT_POSTRESET 1/* Use postreset IDE hook */ #define CONFIG_IDE_8xx_DIRECT 1/* PCMCIA interface required */ #define CONFIG_IDE_LED 1/* LED for ide supported */ #define CONFIG_IDE_RESET 1/* reset for ide supported */
include/configs/TK885D.h +1 -0
@@ -343,6 +343,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/TQM823L.h +1 -0
@@ -335,6 +335,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/TQM823M.h +1 -0
@@ -331,6 +331,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/TQM850L.h +1 -0
@@ -320,6 +320,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/TQM850M.h +1 -0
@@ -322,6 +322,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/TQM855L.h +1 -0
@@ -324,6 +324,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/TQM855M.h +1 -0
@@ -359,6 +359,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/TQM860L.h +1 -0
@@ -323,6 +323,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/TQM860M.h +1 -0
@@ -324,6 +324,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/TQM862L.h +1 -0
@@ -327,6 +327,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/TQM862M.h +1 -0
@@ -328,6 +328,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/TQM866M.h +1 -0
@@ -356,6 +356,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/TQM885D.h +1 -0
@@ -341,6 +341,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/atc.h +1 -0
@@ -482,6 +482,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/c2mon.h +1 -0
@@ -302,6 +302,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/lwmon.h +1 -0
@@ -494,6 +494,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/quantum.h +1 -0
@@ -317,6 +317,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/svm_sc8xx.h +2 -0
@@ -359,6 +359,8 @@#undef CONFIG_IDE_8xx_PCCARD/* Use IDE with PC Card Adapter */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ +#define CONFIG_IDE_INIT_POSTRESET 1/* Use postreset IDE hook */ #define CONFIG_IDE_8xx_DIRECT 1/* Direct IDE not supported */ #undef CONFIG_IDE_LED/* LED for ide not supported */ #undef CONFIG_IDE_RESET/* reset for ide not supported */
include/configs/uc100.h +1 -0
@@ -331,6 +331,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/configs/virtlab2.h +1 -0
@@ -329,6 +329,7 @@*----------------------------------------------------------------------- */ +#define CONFIG_IDE_PREINIT 1/* Use preinit IDE hook */ #define CONFIG_IDE_8xx_PCCARD 1/* Use IDE with PC Card Adapter */ #undef CONFIG_IDE_8xx_DIRECT/* Direct IDE not supported */
include/ide.h +8 -0
@@ -54,6 +54,14 @@ void ide_init(void);ulong ide_read (int device,lbaint_t blknr,ulong blkcnt,void *buffer);ulong ide_write (int device,lbaint_t blknr,ulong blkcnt,const void *buffer); +#ifdef CONFIG_IDE_PREINIT +int ide_preinit (void ); +#endif + +#ifdef CONFIG_IDE_INIT_POSTRESET +int ide_init_postreset (void ); +#endif +#if defined(CONFIG_OF_IDE_FIXUP )int ide_device_present (int dev);#endif
Signature · 1 line
1.7.12
PATCH 3/10 split IVM power hooks from cmd_ide.c
In reply to Pavel HerrmannMove power control code from ide_reset() into IVM-specific IDE reset code.
--- board/ivm/ivm.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ common/cmd_ide.c | 48 ------------------------------------------------ 2 files changed, 46 insertions(+), 48 deletions(-)
board/ivm/ivm.c +46 -0
@@ -333,13 +333,59 @@ void show_boot_progress (int status)void ide_set_reset (int on) {volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR ; +int i;/* * Configure PC for IDE Reset Pin */ if (on) {/* assert RESET */ immr->im_ioport.iop_pcdat &= ~(CONFIG_SYS_PC_IDE_RESET ); + +#ifdef CONFIG_SYS_PB_12V_ENABLE +/* 12V Enable output OFF */ + immr->im_cpm.cp_pbdat &= ~(CONFIG_SYS_PB_12V_ENABLE ); + + immr->im_cpm.cp_pbpar &= ~(CONFIG_SYS_PB_12V_ENABLE ); + immr->im_cpm.cp_pbodr &= ~(CONFIG_SYS_PB_12V_ENABLE ); + immr->im_cpm.cp_pbdir |=CONFIG_SYS_PB_12V_ENABLE ; + +/* wait 500 ms for the voltage to stabilize */ +for (i =0 ; i <500 ; ++i) +udelay (1000 ); +#endif /* CONFIG_SYS_PB_12V_ENABLE */ }else {/* release RESET */ +#ifdef CONFIG_SYS_PB_12V_ENABLE +/* 12V Enable output ON */ + immr->im_cpm.cp_pbdat |=CONFIG_SYS_PB_12V_ENABLE ; +#endif /* CONFIG_SYS_PB_12V_ENABLE */ + +#ifdef CONFIG_SYS_PB_IDE_MOTOR +/* configure IDE Motor voltage monitor pin as input */ + immr->im_cpm.cp_pbpar &= ~(CONFIG_SYS_PB_IDE_MOTOR ); + immr->im_cpm.cp_pbodr &= ~(CONFIG_SYS_PB_IDE_MOTOR ); + immr->im_cpm.cp_pbdir &= ~(CONFIG_SYS_PB_IDE_MOTOR ); + +/* wait up to 1 s for the motor voltage to stabilize */ +for (i =0 ; i <1000 ; ++i) { +if ((immr->im_cpm.cp_pbdat + &CONFIG_SYS_PB_IDE_MOTOR ) !=0 ) +break ; +udelay (1000 ); + } + +if (i ==1000 ) {/* Timeout */ +printf ("\nWarning: 5V for IDE Motor missing\n" ); +#ifdef CONFIG_STATUS_LED +#ifdef STATUS_LED_YELLOW +status_led_set (STATUS_LED_YELLOW ,STATUS_LED_ON ); +#endif +#ifdef STATUS_LED_GREEN +status_led_set (STATUS_LED_GREEN ,STATUS_LED_OFF ); +#endif +#endif /* CONFIG_STATUS_LED */ + } +#endif /* CONFIG_SYS_PB_IDE_MOTOR */ + immr->im_ioport.iop_pcdat |=CONFIG_SYS_PC_IDE_RESET ; }
common/cmd_ide.c +0 -48
60 lines not on this page · raw message
Signature · 1 line
1.7.12
PATCH 4/10 change all versions of input_data() and output_data() to global weak aliases
In reply to Pavel HerrmannThis changes input_data() and friends from static function to global symbols under weak alias, to enable board specific overrides (and therefore get rid of board-specific code in cmd_ide.c)
Also declare ide_bus_offset in the header file, so other files can use ATA_CURR_BASE as well.
--- board/esd/cpci750/ide.c | 1 - board/linkstation/ide.c | 1 - board/pcs440ep/pcs440ep.c | 1 - common/cmd_ide.c | 57 ++++++++++++++++++++++++++++++----------------- include/ide.h | 11 +++++++++ 5 files changed, 48 insertions(+), 23 deletions(-)
board/esd/cpci750/ide.c +0 -1
@@ -30,7 +30,6 @@#include <ide.h> #include <pci.h> -extern ulong ide_bus_offset[CONFIG_SYS_IDE_MAXBUS ];int cpci_hd_type;int ata_device (int dev)
board/linkstation/ide.c +0 -1
@@ -37,7 +37,6 @@#define IT8212_PCI_IdeBusSkewCONTROL 0x4c#define IT8212_PCI_IdeDrivingCURRENT 0x42 -extern ulong ide_bus_offset[CONFIG_SYS_IDE_MAXBUS ];extern struct pci_controller hose;int ide_preinit (void )
board/pcs440ep/pcs440ep.c +0 -1
@@ -672,7 +672,6 @@ U_BOOT_CMD(* ( bus per_addr 20 -30 is connectsd on CF bus A10-A0) * These values are shifted */ -extern ulong *ide_bus_offset;void inline ide_outb (int dev,int port,unsigned char val) { debug ("ide_outb (dev= %d, port= 0x%x, val= 0x%02x) : @ 0x%08lx\n",
common/cmd_ide.c +37 -20
155 lines not on this page · raw message
include/ide.h +11 -0
@@ -27,6 +27,7 @@#define IDE_BUS (dev) (dev >> 1)#define ATA_CURR_BASE (dev) (CONFIG_SYS_ATA_BASE_ADDR+ide_bus_offset[IDE_BUS(dev)]) +extern ulong ide_bus_offset[];#ifdef CONFIG_IDE_LED
@@ -72,4 +73,14 @@ void ide_write_register(int dev, unsigned int port, unsigned char val);void ide_read_data (int dev,ulong *sect_buf,int words);void ide_write_data (int dev,ulong *sect_buf,int words);#endif + +/* +* I/O function overrides +*/ +void ide_input_swap_data (int dev,ulong *sect_buf,int words); +void ide_input_data (int dev,ulong *sect_buf,int words); +void ide_output_data (int dev,const ulong *sect_buf,int words); +void ide_input_data_shorts (int dev,ushort *sect_buf,int words); +void ide_output_data_shorts (int dev,ushort *sect_buf,int words); +#endif /* _IDE_H */
Signature · 1 line
1.7.12
PATCH 4/10 change all versions of input_data() and output_data() to global weak aliases
Dear Pavel Herrmann,
Quoted 8 lines
This changes
input_data()and friends from static function to global symbols under weak alias, to enable board specific overrides (and therefore get rid of board-specific code incmd_ide.c)
Also declareide_bus_offsetin the header file, so other files can useATA_CURR_BASEas well.Signed-off-by Pavel Herrmann <[email protected]>---
[...]
common/cmd_ide.c block_dev_desc_t *ide_get_dev(int dev) · line 485
Quoted 2 lines
common/cmd_ide.c +2
-0+void ide_input_swap_data (int dev,ulong *sect_buf,int words) + __attribute__ ((weak,alias ("__ide_input_swap_data" )));
#include <linux/compiler.h>
__weak void ide_input_swap_data(int dev, ulong *sect_buf, int words) {
... body ...
}
Works just fine ;-)
[...]
include/ide.h void ide_write_register(int dev, unsigned int port, unsigned char val); · line 84
Quoted 8 lines
include/ide.h +8
-0+/* +* I/O function overrides +*/ +void ide_input_swap_data (int dev,ulong *sect_buf,int words); +void ide_input_data (int dev,ulong *sect_buf,int words); +void ide_output_data (int dev,const ulong *sect_buf,int words); +void ide_input_data_shorts (int dev,ushort *sect_buf,int words); +void ide_output_data_shorts (int dev,ushort *sect_buf,int words);
Shorts ... you mean like pants ? :-p
I'd say it's supposed to be "short", like u16 ;-)
Quoted 2 lines
+
#endif /*_IDE_H*/
PATCH 4/10 change all versions of input_data() and output_data() to global weak aliases
Quoted 38 lines · On Sunday 07 of October 2012 20:14:23 Marek Vasut wrote:
Dear Pavel Herrmann,
Quoted 8 lines
This changes
input_data()and friends from static function to global symbols under weak alias, to enable board specific overrides (and therefore get rid of board-specific code incmd_ide.c)
Also declareide_bus_offsetin the header file, so other files can useATA_CURR_BASEas well.Signed-off-by Pavel Herrmann <[email protected]>---
[...]
common/cmd_ide.c block_dev_desc_t *ide_get_dev(int dev) · line 485
Quoted 2 lines
common/cmd_ide.c +2
-0+void ide_input_swap_data (int dev,ulong *sect_buf,int words) + __attribute__ ((weak,alias ("__ide_input_swap_data" )));#include <
linux/compiler.h>
__weakvoidide_input_swap_data(int dev, ulong *sect_buf, int words){ ... body ... }Works just fine ;-)
[...]
include/ide.h void ide_write_register(int dev, unsigned int port, unsigned char val); · line 84
Quoted 8 lines
include/ide.h +8
-0+/* +* I/O function overrides +*/ +void ide_input_swap_data (int dev,ulong *sect_buf,int words); +void ide_input_data (int dev,ulong *sect_buf,int words); +void ide_output_data (int dev,const ulong *sect_buf,int words); +void ide_input_data_shorts (int dev,ushort *sect_buf,int words); +void ide_output_data_shorts (int dev,ushort *sect_buf,int words);Shorts ... you mean like pants ? :-p
Quoted 1 line
I'd say it's supposed to be "short", like u16 ;-)
the code says "shorts", as in "multiple of u16", rather than "pants".
Pavel Herrmann
PATCH 4/10 change all versions of input_data() and output_data() to global weak aliases
Dear Pavel Herrmann,
Quoted 41 lines · On Sunday 07 of October 2012 20:14:23 Marek Vasut wrote:
Quoted 40 lines
Dear Pavel Herrmann,
Quoted 8 lines
This changes
input_data()and friends from static function to global symbols under weak alias, to enable board specific overrides (and therefore get rid of board-specific code incmd_ide.c)
Also declareide_bus_offsetin the header file, so other files can useATA_CURR_BASEas well.Signed-off-by Pavel Herrmann <[email protected]>---
[...]
common/cmd_ide.c block_dev_desc_t *ide_get_dev(int dev) · line 485
Quoted 2 lines
common/cmd_ide.c +2
-0+void ide_input_swap_data (int dev,ulong *sect_buf,int words) + __attribute__ ((weak,alias ("__ide_input_swap_data" )));#include <
linux/compiler.h>
__weakvoidide_input_swap_data(int dev, ulong *sect_buf, int words){... body ...}
Works just fine ;-)
[...]
include/ide.h void ide_write_register(int dev, unsigned int port, unsigned char val); · line 84
Quoted 8 lines
include/ide.h +8
-0+/* +* I/O function overrides +*/ +void ide_input_swap_data (int dev,ulong *sect_buf,int words); +void ide_input_data (int dev,ulong *sect_buf,int words); +void ide_output_data (int dev,const ulong *sect_buf,int words); +void ide_input_data_shorts (int dev,ushort *sect_buf,int words); +void ide_output_data_shorts (int dev,ushort *sect_buf,int words);Shorts ... you mean like pants ? :-p
Quoted 3 lines
Quoted 1 line
I'd say it's supposed to be "short", like u16 ;-)
the code says "shorts", as in "multiple of u16", rather than "pants".
Hm, ide_input_data_u16 is good, no ?
Best regards,
Marek Vasut
PATCH v2 4/10 change all versions of input_data() and output_data() to global weak aliases
In reply to Pavel HerrmannThis changes input_data() and friends from static function to global symbols under weak alias, to enable board specific overrides (and therefore get rid of board-specific code in cmd_ide.c)
Also declare ide_bus_offset in the header file, so other files can use ATA_CURR_BASE as well.
---
Changes for v2:
rebase on top of next
use "shorts" as a count parameter for the short-aligned I/O calls
board/esd/cpci750/ide.c | 1 - board/linkstation/ide.c | 1 - board/pcs440ep/pcs440ep.c | 1 - common/cmd_ide.c | 57 ++++++++++++++++++++++++++++++----------------- include/ide.h | 11 +++++++++ 5 files changed, 48 insertions(+), 23 deletions(-)
board/esd/cpci750/ide.c +0 -1
@@ -30,7 +30,6 @@#include <ide.h> #include <pci.h> -extern ulong ide_bus_offset[CONFIG_SYS_IDE_MAXBUS ];int cpci_hd_type;int ata_device (int dev)
board/linkstation/ide.c +0 -1
@@ -37,7 +37,6 @@#define IT8212_PCI_IdeBusSkewCONTROL 0x4c#define IT8212_PCI_IdeDrivingCURRENT 0x42 -extern ulong ide_bus_offset[CONFIG_SYS_IDE_MAXBUS ];extern struct pci_controller hose;int ide_preinit (void )
board/pcs440ep/pcs440ep.c +0 -1
@@ -672,7 +672,6 @@ U_BOOT_CMD(* ( bus per_addr 20 -30 is connectsd on CF bus A10-A0) * These values are shifted */ -extern ulong *ide_bus_offset;void inline ide_outb (int dev,int port,unsigned char val) { debug ("ide_outb (dev= %d, port= 0x%x, val= 0x%02x) : @ 0x%08lx\n",
common/cmd_ide.c +37 -20
154 lines not on this page · raw message
include/ide.h +11 -0
@@ -27,6 +27,7 @@#define IDE_BUS (dev) (dev / (CONFIG_SYS_IDE_MAXDEVICE / CONFIG_SYS_IDE_MAXBUS))#define ATA_CURR_BASE (dev) (CONFIG_SYS_ATA_BASE_ADDR+ide_bus_offset[IDE_BUS(dev)]) +extern ulong ide_bus_offset[];#ifdef CONFIG_IDE_LED
@@ -72,4 +73,14 @@ void ide_write_register(int dev, unsigned int port, unsigned char val);void ide_read_data (int dev,ulong *sect_buf,int words);void ide_write_data (int dev,ulong *sect_buf,int words);#endif + +/* +* I/O function overrides +*/ +void ide_input_swap_data (int dev,ulong *sect_buf,int words); +void ide_input_data (int dev,ulong *sect_buf,int words); +void ide_output_data (int dev,const ulong *sect_buf,int words); +void ide_input_data_shorts (int dev,ushort *sect_buf,int shorts); +void ide_output_data_shorts (int dev,ushort *sect_buf,int shorts); +#endif /* _IDE_H */
Signature · 1 line
1.7.12
PATCH 5/10 split CPC45 board-specific IDE functions from cmd_ide.c
In reply to Pavel HerrmannMove input_data() and friends to board/cpc45/ide.c, as overrides for weak aliases in cmd_ide.c
note: checkpatch emits warnings about using volatile
--- board/cpc45/Makefile | 2 +- board/cpc45/ide.c | 130 +++++++++++++++++++++++++++++++++++++++++++++++++++ common/cmd_ide.c | 91 ------------------------------------ 3 files changed, 131 insertions(+), 92 deletions(-) create mode 100644 board/cpc45/ide.c
board/cpc45/Makefile +1 -1
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(BOARD).o -COBJS = $(BOARD).o flash.o plx9030.o pd67290.o +COBJS = $(BOARD).o flash.o plx9030.o pd67290.o ide.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS))
board/cpc45/ide.c new file +130 -0
130 lines not on this page · raw message
common/cmd_ide.c +0 -91
149 lines not on this page · raw message
Signature · 1 line
1.7.12
PATCH 5/10 split CPC45 board-specific IDE functions from cmd_ide.c
Dear Pavel Herrmann,
Quoted 55 lines
Move
input_data()and friends toboard/cpc45/ide.c, as overrides for weak aliases incmd_ide.cnote: checkpatch emits warnings about using volatile
Signed-off-by Pavel Herrmann <[email protected]>--- board/cpc45/Makefile | 2 +- board/cpc45/ide.c | 130 +++++++++++++++++++++++++++++++++++++++++++++++++++ common/cmd_ide.c | 91 ------------------------------------ 3 files changed, 131 insertions(+), 92 deletions(-) create mode 100644 board/cpc45/ide.cboard/cpc45/Makefile +1
-1@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(BOARD).o -COBJS = $(BOARD).o flash.o plx9030.o pd67290.o +COBJS = $(BOARD).o flash.o plx9030.o pd67290.o ide.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS))board/cpc45/ide.c new file +22
-0@@ -0,0 +1,130 @@ +/* +* (C) Copyright 2001 +* Rob Taylor, Flying Pig Systems. robt at flyingpig.com. +* +* (C) Copyright 2000-2011 +* Wolfgang Denk, DENX Software Engineering, wd at denx.de. +* +* See file CREDITS for list of people who contributed to this +* project. +* +* 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. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software
board/cpc45/ide.c line 32
Quoted 10 lines
board/cpc45/ide.c new file +10
-0+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#include <common.h> +#include <ide.h> +#include <ata.h> + +#define EIEIO __asm__ volatile ("eieio") +#define SYNC __asm__ volatile ("sync")
Make it asm, not __asm__
board/cpc45/ide.c line 41
Quoted 9 lines
board/cpc45/ide.c new file +9
-0+ +void ide_input_swap_data (int dev,ulong *sect_buf,int words) +{ +uchar i; +volatile uchar *pbuf_even = + (uchar *) (ATA_CURR_BASE (dev) +ATA_DATA_EVEN ); +volatile uchar *pbuf_odd = + (uchar *) (ATA_CURR_BASE (dev) +ATA_DATA_ODD ); +ushort *dbuf = (ushort *) sect_buf;
What's this, some kind of __swab16() ?
board/cpc45/ide.c line 50
Quoted 8 lines
board/cpc45/ide.c new file +8
-0+while (words--) { +for (i =0 ; i <2 ; i++) { + *(((uchar *) (dbuf)) +1 ) = *pbuf_even; + *(uchar *) dbuf = *pbuf_odd; + dbuf +=1 ; + } + } +}
[...]
I'm not reviewing this any further ... this is some ancient code, right?
PATCH 5/10 split CPC45 board-specific IDE functions from cmd_ide.c
Quoted 74 lines · On Sunday 07 of October 2012 20:20:08 Marek Vasut wrote:
Dear Pavel Herrmann,
Quoted 59 lines
Move
input_data()and friends toboard/cpc45/ide.c, as overrides for weak aliases incmd_ide.cnote: checkpatch emits warnings about using volatile
Signed-off-by Pavel Herrmann <[email protected]>---
board/cpc45/Makefile | 2 +- board/cpc45/ide.c | 130+++++++++++++++++++++++++++++++++++++++++++++++++++
common/cmd_ide.c|91 ------------------------------------
3 files changed, 131 insertions(+), 92 deletions(-) create mode 100644 board/cpc45/ide.cboard/cpc45/Makefile +1
-1@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(BOARD).o -COBJS = $(BOARD).o flash.o plx9030.o pd67290.o +COBJS = $(BOARD).o flash.o plx9030.o pd67290.o ide.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS))board/cpc45/ide.c new file +22
-0@@ -0,0 +1,130 @@ +/* +* (C) Copyright 2001 +* Rob Taylor, Flying Pig Systems. robt at flyingpig.com. +* +* (C) Copyright 2000-2011 +* Wolfgang Denk, DENX Software Engineering, wd at denx.de. +* +* See file CREDITS for list of people who contributed to this +* project. +* +* 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. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software board/cpc45/ide.c line 32
Quoted 10 lines
board/cpc45/ide.c new file +10
-0+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#include <common.h> +#include <ide.h> +#include <ata.h> + +#define EIEIO __asm__ volatile ("eieio") +#define SYNC __asm__ volatile ("sync")Make it asm, not
__asm__
Quoted 11 lines
board/cpc45/ide.c line 41
Quoted 9 lines
board/cpc45/ide.c new file +9
-0+ +void ide_input_swap_data (int dev,ulong *sect_buf,int words) +{ +uchar i; +volatile uchar *pbuf_even = + (uchar *) (ATA_CURR_BASE (dev) +ATA_DATA_EVEN ); +volatile uchar *pbuf_odd = + (uchar *) (ATA_CURR_BASE (dev) +ATA_DATA_ODD ); +ushort *dbuf = (ushort *) sect_buf;What's this, some kind of
__swab16()?
more probably this is a hack for strange wiring on the board
Quoted 11 lines
Quoted 8 lines
board/cpc45/ide.c new file +8
-0+while (words--) { +for (i =0 ; i <2 ; i++) { + *(((uchar *) (dbuf)) +1 ) = *pbuf_even; + *(uchar *) dbuf = *pbuf_odd; + dbuf +=1 ; + } + } +}[...]
Quoted 1 line
I'm not reviewing this any further ... this is some ancient code, right?
yes, this series is mostly cut-and-paste cleanup of old code, changes were made only when checkpatch didnt approve.
Pavel Herrmann
PATCH 5/10 split CPC45 board-specific IDE functions from cmd_ide.c
Dear Pavel Herrmann,
Quoted 88 lines · On Sunday 07 of October 2012 20:20:08 Marek Vasut wrote:
Quoted 75 lines
Dear Pavel Herrmann,
Quoted 60 lines
Move
input_data()and friends toboard/cpc45/ide.c, as overrides for weak aliases incmd_ide.cnote: checkpatch emits warnings about using volatile
Signed-off-by Pavel Herrmann <[email protected]>---
board/cpc45/Makefile | 2 +- board/cpc45/ide.c | 130+++++++++++++++++++++++++++++++++++++++++++++++++++
common/cmd_ide.c
|91 ------------------------------------
3 files changed, 131 insertions(+), 92 deletions(-) create mode 100644 board/cpc45/ide.cboard/cpc45/Makefile +1
-1@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(BOARD).o -COBJS = $(BOARD).o flash.o plx9030.o pd67290.o +COBJS = $(BOARD).o flash.o plx9030.o pd67290.o ide.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS))board/cpc45/ide.c new file +22
-0@@ -0,0 +1,130 @@ +/* +* (C) Copyright 2001 +* Rob Taylor, Flying Pig Systems. robt at flyingpig.com. +* +* (C) Copyright 2000-2011 +* Wolfgang Denk, DENX Software Engineering, wd at denx.de. +* +* See file CREDITS for list of people who contributed to this +* project. +* +* 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. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software board/cpc45/ide.c line 32
Quoted 10 lines
board/cpc45/ide.c new file +10
-0+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#include <common.h> +#include <ide.h> +#include <ata.h> + +#define EIEIO __asm__ volatile ("eieio") +#define SYNC __asm__ volatile ("sync")Make it asm, not
__asm__Quoted 11 lines
board/cpc45/ide.c line 41
Quoted 9 lines
board/cpc45/ide.c new file +9
-0+ +void ide_input_swap_data (int dev,ulong *sect_buf,int words) +{ +uchar i; +volatile uchar *pbuf_even = + (uchar *) (ATA_CURR_BASE (dev) +ATA_DATA_EVEN ); +volatile uchar *pbuf_odd = + (uchar *) (ATA_CURR_BASE (dev) +ATA_DATA_ODD ); +ushort *dbuf = (ushort *) sect_buf;What's this, some kind of
__swab16()?
Quoted 1 line
more probably this is a hack for strange wiring on the board
That much I see myself ... but the goo below does the same thing as swab16(), doesn't it ?
Quoted 11 lines
Quoted 11 lines
Quoted 8 lines
board/cpc45/ide.c new file +8
-0+while (words--) { +for (i =0 ; i <2 ; i++) { + *(((uchar *) (dbuf)) +1 ) = *pbuf_even; + *(uchar *) dbuf = *pbuf_odd; + dbuf +=1 ; + } + } +}[...]
Quoted 6 lines
Quoted 1 line
I'm not reviewing this any further ... this is some ancient code, right?
yes, this series is mostly cut-and-paste cleanup of old code, changes were made only when checkpatch didnt approve.
Pavel Herrmann
Best regards,
Marek Vasut
PATCH 6/10 make ide_led() a weak alias
In reply to Pavel HerrmannMake ide_led() a weak alias instead of global/local function/empty macro based on CONFIG_IDE_LED value and/or board-specific CONFIGs, to get rid of board-specific code in cmd_ide.c
Define dummy values to get rid of compoler errors in case where ide_led() used to be an empty macro
--- common/cmd_ide.c | 63 ++++++++++++++++++++++++-------------------------------- 1 file changed, 27 insertions(+), 36 deletions(-)
common/cmd_ide.c +27 -36
@@ -81,19 +81,6 @@ static int ide_bus_ok[CONFIG_SYS_IDE_MAXBUS];block_dev_desc_t ide_dev_desc[CONFIG_SYS_IDE_MAXDEVICE ];/* ------------------------------------------------------------------------- */ -#ifdef CONFIG_IDE_LED -# if !defined(CONFIG_BMS2003 ) && \ - !defined(CONFIG_CPC45 ) && \ - !defined(CONFIG_KUP4K ) && \ - !defined(CONFIG_KUP4X ) -static void ide_led (uchar led,uchar status); -#else -extern void ide_led (uchar led,uchar status); -#endif -#else -#define ide_led (a,b)/* dummy */ -#endif -#ifdef CONFIG_IDE_RESET static void ide_reset (void );#else
@@ -290,6 +277,33 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])/* ------------------------------------------------------------------------- */ +void __ide_led (uchar led,uchar status) +{ +#if defined(CONFIG_IDE_LED ) && defined(PER8_BASE )/* required by LED_PORT */ +static uchar led_buffer;/* Buffer for current LED status */ + +uchar *led_port =LED_PORT ; + +if (status)/* switch LED on */ + led_buffer |= led; +else /* switch LED off */ + led_buffer &= ~led; + + *led_port = led_buffer; +#endif +} + +void ide_led (uchar led,uchar status) + __attribute__ ((weak,alias ("__ide_led" ))); + +#ifndef CONFIG_IDE_LED /* define LED macros, they are not used anyways */ +# define DEVICE_LED (x) 0 +# define LED_IDE1 1 +# define LED_IDE2 2 +#endif + +/* ------------------------------------------------------------------------- */ +inline void __ide_outb (int dev,int port,unsigned char val) { debug("ide_outb (dev= %d, port= 0x%x, val= 0x%02x) : @ 0x%08lx\n",
@@ -442,9 +456,7 @@ void ide_init(void) curr_device =-1 ;for (i =0 ; i <CONFIG_SYS_IDE_MAXDEVICE ; ++i) { -#ifdef CONFIG_IDE_LED int led = (IDE_BUS (i) ==0 ) ?LED_IDE1 :LED_IDE2 ; -#endif ide_dev_desc[i].type =DEV_TYPE_UNKNOWN ; ide_dev_desc[i].if_type =IF_TYPE_IDE ; ide_dev_desc[i].dev = i;
@@ -1146,27 +1158,6 @@ static void ide_reset(void)/* ------------------------------------------------------------------------- */ -#if defined(CONFIG_IDE_LED ) && \ - !defined(CONFIG_CPC45 ) && \ - !defined(CONFIG_KUP4K ) && \ - !defined(CONFIG_KUP4X ) - -static uchar led_buffer;/* Buffer for current LED status */ - -static void ide_led (uchar led,uchar status) -{ -uchar *led_port =LED_PORT ; - -if (status)/* switch LED on */ - led_buffer |= led; -else /* switch LED off */ - led_buffer &= ~led; - - *led_port = led_buffer; -} - -#endif /* CONFIG_IDE_LED */ -#if defined(CONFIG_OF_IDE_FIXUP )int ide_device_present (int dev) {
Signature · 1 line
1.7.12
PATCH 7/10 move CPC45 ide_led to the same file as other IDE hooks
In reply to Pavel HerrmannKeep all IDE-related hooks and overrides in a single file, to avoid confusion.
--- board/cpc45/cpc45.c | 15 --------------- board/cpc45/ide.c | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 15 deletions(-)
board/cpc45/cpc45.c +0 -15
@@ -260,21 +260,6 @@ int pcmcia_init(void)#endif -# ifdef CONFIG_IDE_LED -void ide_led (uchar led,uchar status) -{ -u_char val; -/* We have one PCMCIA slot and use LED H4 for the IDE Interface */ - val =readb (BCSR_BASE +0x04 ); -if (status) {/* led on */ - val |=B_CTRL_LED0 ; - }else { - val &= ~B_CTRL_LED0 ; - } -writeb (val,BCSR_BASE +0x04 ); -} -# endif -int board_eth_init (bd_t *bis) {return pci_eth_init (bis);
board/cpc45/ide.c +15 -0
@@ -27,6 +27,7 @@#include <common.h> #include <ide.h> #include <ata.h> +#include <asm/io.h> #define EIEIO __asm__ volatile ("eieio")#define SYNC __asm__ volatile ("sync")
@@ -128,3 +129,17 @@ void ide_output_data_shorts(int dev, ushort *sect_buf, int shorts) *pbuf_odd = *dbuf++; } } + +void ide_led (uchar led,uchar status) +{ +u_char val; +/* We have one PCMCIA slot and use LED H4 for the IDE Interface */ + val =readb (BCSR_BASE +0x04 ); +if (status) {/* led on */ + val |=B_CTRL_LED0 ; + }else { + val &= ~B_CTRL_LED0 ; + } +writeb (val,BCSR_BASE +0x04 ); +} +
Signature · 1 line
1.7.12
PATCH 7/10 move CPC45 ide_led to the same file as other IDE hooks
Dear Pavel Herrmann,
Quoted 5 lines
Keep all IDE-related hooks and overrides in a single file, to avoid confusion.
Signed-off-by Pavel Herrmann <[email protected]>---
[...]
board/cpc45/ide.c void ide_output_data_shorts(int dev, ushort *sect_buf, int shorts) · line 142
Quoted 11 lines
board/cpc45/ide.c +11
-0+ +void ide_led (uchar led,uchar status) +{ +u_char val; +/* We have one PCMCIA slot and use LED H4 for the IDE Interface */ + val =readb (BCSR_BASE +0x04 ); +if (status) {/* led on */ + val |=B_CTRL_LED0 ; + }else { + val &= ~B_CTRL_LED0 ; + }
Remove these {} for conditions with single line expression
board/cpc45/ide.c void ide_output_data_shorts(int dev, ushort *sect_buf, int shorts) · line 145
Quoted 3 lines
board/cpc45/ide.c +3
-0+writeb (val,BCSR_BASE +0x04 ); +} +
Best regards,
Marek Vasut
PATCH v2 7/10 move CPC45 ide_led to the same file as other IDE hooks
In reply to Pavel HerrmannKeep all IDE-related hooks and overrides in a single file, to avoid confusion
---
Changes for v2:
style fixes
board/cpc45/cpc45.c | 15 --------------- board/cpc45/ide.c | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 15 deletions(-)
board/cpc45/cpc45.c +0 -15
@@ -260,21 +260,6 @@ int pcmcia_init(void)#endif -# ifdef CONFIG_IDE_LED -void ide_led (uchar led,uchar status) -{ -u_char val; -/* We have one PCMCIA slot and use LED H4 for the IDE Interface */ - val =readb (BCSR_BASE +0x04 ); -if (status) {/* led on */ - val |=B_CTRL_LED0 ; - }else { - val &= ~B_CTRL_LED0 ; - } -writeb (val,BCSR_BASE +0x04 ); -} -# endif -int board_eth_init (bd_t *bis) {return pci_eth_init (bis);
board/cpc45/ide.c +15 -0
@@ -27,6 +27,7 @@#include <common.h> #include <ide.h> #include <ata.h> +#include <asm/io.h> #define EIEIO __asm__ volatile ("eieio")#define SYNC __asm__ volatile ("sync")
@@ -128,3 +129,17 @@ void ide_output_data_shorts(int dev, ushort *sect_buf, int shorts) *pbuf_odd = *dbuf++; } } + +void ide_led (uchar led,uchar status) +{ +u_char val; +/* We have one PCMCIA slot and use LED H4 for the IDE Interface */ + val =readb (BCSR_BASE +0x04 ); +if (status)/* led on */ + val |=B_CTRL_LED0 ; +else + val &= ~B_CTRL_LED0 ; + +writeb (val,BCSR_BASE +0x04 ); +} +
Signature · 1 line
1.7.12
PATCH 8/10 split AU1X00 specific code from cmd_ide.c
In reply to Pavel HerrmannMove special case of ide_swap_read() for AU1X00 SoC into SoC-specific directory.
--- arch/mips/cpu/mips32/au1x00/Makefile | 2 +- arch/mips/cpu/mips32/au1x00/au1x00_ide.c | 33 ++++++++++++++++++++++++++++++++ common/cmd_ide.c | 6 ++---- 3 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 arch/mips/cpu/mips32/au1x00/au1x00_ide.c
arch/mips/cpu/mips32/au1x00/Makefile +1 -1
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(SOC).o -COBJS = au1x00_eth.o au1x00_serial.o au1x00_usb_ohci.o +COBJS = au1x00_eth.o au1x00_serial.o au1x00_usb_ohci.o au1x00_ide.o SRCS := $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS))
arch/mips/cpu/mips32/au1x00/au1x00_ide.c new file +33 -0
@@ -0,0 +1,33 @@ +/* +* (C) Copyright 2000-2011 +* Wolfgang Denk, DENX Software Engineering, wd at denx.de. +* +* See file CREDITS for list of people who contributed to this +* project. +* +* 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. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +* +*/ + +#include <ide.h> + +/* AU1X00 swaps data in big-endian mode, enforce little-endian function */ +#ifndef CONFIG_GTH2 /* GTH2 board behaves as it should */ +void ide_input_swap_data (int dev,ulong *sect_buf,int words) +{ +ide_input_data (dev, sect_buf, words); +} +
common/cmd_ide.c +2 -4
@@ -503,9 +503,7 @@ void ide_output_data(int dev, const ulong *sect_buf, int words) __attribute__ ((weak, alias("__ide_output_data")));/* We only need to swap data if we are running on a big endian cpu. */ -/* But Au1x00 cpu:s already swaps data in big endian mode! */ -#if defined(__LITTLE_ENDIAN) || \ - (defined(CONFIG_SOC_AU1X00 ) && !defined(CONFIG_GTH2 )) +#if defined(__LITTLE_ENDIAN)void __ide_input_swap_data (int dev,ulong *sect_buf,int words) {ide_input_data (dev, sect_buf, words);
@@ -533,7 +531,7 @@ void __ide_input_swap_data(int dev, ulong *sect_buf, int words) #endif /* !MIPS */ } } -#endif /* __LITTLE_ENDIAN || CONFIG_AU1X00 */ +#endif /* __LITTLE_ENDIAN */ #if defined(CONFIG_IDE_SWAP_IO )
Signature · 1 line
1.7.12
PATCH 8/10 split AU1X00 specific code from cmd_ide.c
Quoted 4 lines · Pavel Herrmann
Move special case of
ide_swap_read()for AU1X00 SoC into SoC-specific directory.Signed-off-by Pavel Herrmann <[email protected]>
Two problems:
Quoted 1 line
arch/mips/cpu/mips32/au1x00/au1x00_ide.c +0
-0
[snip]
common/cmd_ide.c
Quoted 7 lines
arch/mips/cpu/mips32/au1x00/au1x00_ide.c +6
-0+#ifndef CONFIG_GTH2 /* GTH2 board behaves as it should */ +void ide_input_swap_data (int dev,ulong *sect_buf,int words) +{ +ide_input_data (dev, sect_buf, words); +} +common/cmd_ide.c +0
-0
That won't compile :)
Second, re-base on top of next where the gth2 board is gone, this will make things simpiler.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20121008/ff63a63b/attachment.pgp>
PATCH 8/10 split AU1X00 specific code from cmd_ide.c
Quoted 11 lines · On Monday 08 of October 2012 16:38:46 Tom Rini wrote:
Quoted 4 lines · Pavel Herrmann
Move special case of
ide_swap_read()for AU1X00 SoC into SoC-specific directory.Signed-off-by Pavel Herrmann <[email protected]>Two problems:
Quoted 2 lines
arch/mips/cpu/mips32/au1x00/au1x00_ide.c +0
-0[snip]
Quoted 9 lines
common/cmd_ide.c
Quoted 7 lines
arch/mips/cpu/mips32/au1x00/au1x00_ide.c +6
-0+#ifndef CONFIG_GTH2 /* GTH2 board behaves as it should */ +void ide_input_swap_data (int dev,ulong *sect_buf,int words) +{ +ide_input_data (dev, sect_buf, words); +} +common/cmd_ide.c +0
-0That won't compile :)
sorry, my bad, i only compile tested on ppc, this is missing a header and endif
Quoted 2 lines
Second, re-base on top of next where the gth2 board is gone, this will make things simpiler.
done, will send V2 after MAKEALL -a powerpc finishes, just to be sure
cheers
Pavel Herrmann
PATCH v2 8/10 split AU1X00 specific code from cmd_ide.c
In reply to Pavel Herrmannmove special case of ide_swap_read() for AU1X00 SoC into SoC-specific directory.
---
Changes for v2:
rebase on top of next
include missing <common.h> to fix compilation
arch/mips/cpu/mips32/au1x00/Makefile | 2 +- arch/mips/cpu/mips32/au1x00/au1x00_ide.c | 32 ++++++++++++++++++++++++++++++++ common/cmd_ide.c | 5 ++--- 3 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 arch/mips/cpu/mips32/au1x00/au1x00_ide.c
arch/mips/cpu/mips32/au1x00/Makefile +1 -1
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(SOC).o -COBJS = au1x00_eth.o au1x00_serial.o au1x00_usb_ohci.o +COBJS = au1x00_eth.o au1x00_serial.o au1x00_usb_ohci.o au1x00_ide.o SRCS := $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS))
arch/mips/cpu/mips32/au1x00/au1x00_ide.c new file +32 -0
@@ -0,0 +1,32 @@ +/* +* (C) Copyright 2000-2011 +* Wolfgang Denk, DENX Software Engineering, wd at denx.de. +* +* See file CREDITS for list of people who contributed to this +* project. +* +* 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. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +* +*/ + +#include <common.h> +#include <ide.h> + +/* AU1X00 swaps data in big-endian mode, enforce little-endian function */ +void ide_input_swap_data (int dev,ulong *sect_buf,int words) +{ +ide_input_data (dev, sect_buf, words); +}
common/cmd_ide.c +2 -3
@@ -503,8 +503,7 @@ void ide_output_data(int dev, const ulong *sect_buf, int words) __attribute__ ((weak, alias("__ide_output_data")));/* We only need to swap data if we are running on a big endian cpu. */ -/* But Au1x00 cpu:s already swaps data in big endian mode! */ -#if defined(__LITTLE_ENDIAN) || defined(CONFIG_SOC_AU1X00 ) +#if defined(__LITTLE_ENDIAN)void __ide_input_swap_data (int dev,ulong *sect_buf,int words) {ide_input_data (dev, sect_buf, words);
@@ -532,7 +531,7 @@ void __ide_input_swap_data(int dev, ulong *sect_buf, int words) #endif /* !MIPS */ } } -#endif /* __LITTLE_ENDIAN || CONFIG_AU1X00 */ +#endif /* __LITTLE_ENDIAN */ #if defined(CONFIG_IDE_SWAP_IO )
Signature · 1 line
1.7.12
PATCH 9/10 split PCS440EP specific code from cmd_ide.c
In reply to Pavel HerrmannMove specific ide_input_data and friends to board-specific file.
--- board/pcs440ep/pcs440ep.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++ common/cmd_ide.c | 18 --------------- 2 files changed, 56 insertions(+), 18 deletions(-)
board/pcs440ep/pcs440ep.c +56 -0
@@ -32,6 +32,7 @@#include <sha1.h> #include <asm/io.h> #include <net.h> +#include <ata.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -713,3 +714,58 @@ void ide_set_reset (int idereset)udelay (10000 ); }#endif /* defined (CONFIG_CMD_IDE) && defined (CONFIG_IDE_RESET) */ + + +/* this is motly the same as it should, causing a little code duplication */ +#if defined(CONFIG_CMD_IDE ) +#define EIEIO __asm__ volatile ("eieio") + +void ide_input_swap_data (int dev,ulong *sect_buf,int words) +{ +volatile ushort *pbuf = + (ushort *) (ATA_CURR_BASE (dev) +ATA_DATA_REG ); +ushort *dbuf = (ushort *) sect_buf; + +debug ("in input swap data base for read is %lx\n" , + (unsigned long ) pbuf); + +while (words--) { + *dbuf++ = *pbuf; + *dbuf++ = *pbuf; + } +} + +void ide_output_data (int dev,const ulong *sect_buf,int words) +{ +ushort *dbuf; +volatile ushort *pbuf; + + pbuf = (ushort *) (ATA_CURR_BASE (dev) +ATA_DATA_REG ); + dbuf = (ushort *) sect_buf; +while (words--) { +EIEIO ; + *pbuf =ld_le16 (dbuf++); +EIEIO ; + *pbuf =ld_le16 (dbuf++); + } +} + +void ide_input_data (int dev,ulong *sect_buf,int words) +{ +ushort *dbuf; +volatile ushort *pbuf; + + pbuf = (ushort *) (ATA_CURR_BASE (dev) +ATA_DATA_REG ); + dbuf = (ushort *) sect_buf; + +debug ("in input data base for read is %lx\n" , (unsigned long ) pbuf); + +while (words--) { +EIEIO ; + *dbuf++ =ld_le16 (pbuf); +EIEIO ; + *dbuf++ =ld_le16 (pbuf); + } +} + +#endif
common/cmd_ide.c +0 -18
@@ -522,9 +522,6 @@ void __ide_input_swap_data(int dev, ulong *sect_buf, int words)#ifdef __MIPS__ *dbuf++ =swab16p ((u16 *) pbuf); *dbuf++ =swab16p ((u16 *) pbuf); -#elif defined(CONFIG_PCS440EP ) - *dbuf++ = *pbuf; - *dbuf++ = *pbuf;#else *dbuf++ =ld_le16 (pbuf); *dbuf++ =ld_le16 (pbuf);
@@ -543,18 +540,10 @@ void __ide_output_data(int dev, const ulong *sect_buf, int words) pbuf = (ushort *) (ATA_CURR_BASE (dev) +ATA_DATA_REG ); dbuf = (ushort *) sect_buf;while (words--) { -#if defined(CONFIG_PCS440EP ) -/* not tested, because CF was write protected */ -EIEIO ; - *pbuf =ld_le16 (dbuf++); -EIEIO ; - *pbuf =ld_le16 (dbuf++); -#else EIEIO ; *pbuf = *dbuf++;EIEIO ; *pbuf = *dbuf++; -#endif } }#else /* ! CONFIG_IDE_SWAP_IO */
@@ -580,17 +569,10 @@ void __ide_input_data(int dev, ulong *sect_buf, int words)debug ("in input data base for read is %lx\n" , (unsigned long ) pbuf);while (words--) { -#if defined(CONFIG_PCS440EP ) -EIEIO ; - *dbuf++ =ld_le16 (pbuf); -EIEIO ; - *dbuf++ =ld_le16 (pbuf); -#else EIEIO ; *dbuf++ = *pbuf;EIEIO ; *dbuf++ = *pbuf; -#endif } }#else /* ! CONFIG_IDE_SWAP_IO */
Signature · 1 line
1.7.12
PATCH 10/10 remove unnecessary includes from cmd_ide.c
In reply to Pavel Herrmannmpc8xx and mpc5xxx specific includes in cmd_ide.c are not required, remove them.
--- common/cmd_ide.c | 8 -------- 1 file changed, 8 deletions(-)
common/cmd_ide.c +0 -8
@@ -38,14 +38,6 @@# include <pcmcia.h> #endif -#ifdef CONFIG_8xx -# include <mpc8xx.h> -#endif - -#ifdef CONFIG_MPC5xxx -#include <mpc5xxx.h> -#endif -#include <ide.h> #include <ata.h>
Signature · 1 line
1.7.12
cover IDE code cleanup
In reply to Pavel HerrmannDear Pavel Herrmann,
Quoted 9 lines
This series tries to remove all SoC-specific and board-specific code from
cmd_ide. Whenever an existing hook is present, it is used instead, when no appropriate hook is present, one is created (either as a hook call or by using the weak alias technique). The aim of this series is to prepare for DM conversion, where most of thecmd_idecode will create a new universal IDE driver, and all hooks and overrides will be provided in its platform data.note: this series has not been tested on the actual hardware
[...]
All in all, it looks mostly good
Best regards,
Marek Vasut