cmd_ide: enhance new feature "CONFIG_IDE_AHB"
PATCH v2 1/2 cmd_ide: enhance new feature "CONFIG_IDE_AHB"
Although most IDE controller is designed to be connected to PCI bridge, there are still some IDE controller support AHB interface for SoC design.
The driver implementation of these IDE-AHB controllers differ from other IDE-PCI controller, some additional registers and commands access is required during CMD/DATA I/O. Hence a configuration "CONFIG_IDE_AHB" in cmd_ide.c is required to be defined to support these kinds of SoC controllers. Such as Faraday's FTIDE020 series and Global Unichip's UINF-0301.
---
Changes for v2:
- Move new prototype decarations related to AHB to from cmd_ide.c to ide.h.
- clean up.
README | 8 ++++++++ common/cmd_ide.c | 29 ++++++++++++++++++++++++++++- include/ide.h | 7 +++++++ 3 files changed, 43 insertions(+), 1 deletions(-)
README +8 -0
@@ -2673,6 +2673,14 @@ Low Level (hardware related) configuration options: source code. It is used to make hardware dependant initializations. +- CONFIG_IDE_AHB: + Most IDE controllers were designed to be connected with PCI + interface. Only few of them were designed for AHB interface. + When software is doing ATA command and data transfer to + IDE devices through IDE-AHB controller, some additional + registers accessing to these kind of IDE-AHB controller + is requierd. + - CONFIG_SYS_IMMR: Physical address of the Internal Memory. DO NOT CHANGE unless you know exactly what you're doing! (11-4) [MPC8xx/82xx systems only]
common/cmd_ide.c +28 -1
@@ -518,8 +518,20 @@ __ide_outb(int dev, int port, unsigned char val) {debug ("ide_outb (dev= %d, port= 0x%x, val= 0x%02x) : @ 0x%08lx\n" , dev, port, val, (ATA_CURR_BASE (dev)+CONFIG_SYS_ATA_PORT_ADDR (port))); + +#if defined(CONFIG_IDE_AHB ) +if (port) { +/* write command */ +ide_write_register (dev, port, val); + }else { +/* write data */ +outb (val, (ATA_CURR_BASE (dev))); + } +#else outb (val, (ATA_CURR_BASE (dev)+CONFIG_SYS_ATA_PORT_ADDR (port))); +#endif } +void ide_outb (int dev,int port,unsigned char val) __attribute__((weak,alias ("__ide_outb" )));
@@ -527,7 +539,13 @@ unsigned char inline __ide_inb(int dev, int port) {uchar val; + +#if defined(CONFIG_IDE_AHB ) + val =ide_read_register (dev, port); +#else val =inb ((ATA_CURR_BASE (dev)+CONFIG_SYS_ATA_PORT_ADDR (port))); +#endif +debug ("ide_inb (dev= %d, port= 0x%x) : @ 0x%08lx -> 0x%02x\n" , dev, port, (ATA_CURR_BASE (dev)+CONFIG_SYS_ATA_PORT_ADDR (port)), val);return val;
@@ -696,6 +714,7 @@ void ide_init (void) ide_dev_desc[i].blksz=0 ; ide_dev_desc[i].lba=0 ; ide_dev_desc[i].block_read=ide_read; + ide_dev_desc[i].block_write = ide_write;if (!ide_bus_ok[IDE_BUS (i)])continue ;ide_led (led,1 );/* LED on */
@@ -902,7 +921,11 @@ output_data(int dev, ulong *sect_buf, int words)static void output_data (int dev,ulong *sect_buf,int words) { -outsw (ATA_CURR_BASE (dev)+ATA_DATA_REG , sect_buf, words<<1 ); +#if defined(CONFIG_IDE_AHB ) +ide_write_data (dev, sect_buf, words); +#else +outsw (ATA_CURR_BASE (dev)+ATA_DATA_REG , sect_buf, words <<1 ); +#endif }#endif /* CONFIG_IDE_SWAP_IO */
@@ -960,7 +983,11 @@ input_data(int dev, ulong *sect_buf, int words)static void input_data (int dev,ulong *sect_buf,int words) { +#if defined(CONFIG_IDE_AHB ) +ide_read_data (dev, sect_buf, words); +#else insw (ATA_CURR_BASE (dev)+ATA_DATA_REG , sect_buf, words <<1 ); +#endif }#endif /* CONFIG_IDE_SWAP_IO */
include/ide.h +7 -0
@@ -57,4 +57,11 @@ ulong ide_write(int device, lbaint_t blknr, ulong blkcnt, void *buffer);#if defined(CONFIG_OF_IDE_FIXUP )int ide_device_present (int dev);#endif + +#if defined(CONFIG_IDE_AHB ) +unsigned char ide_read_register (int dev,unsigned int port); +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 #endif /* _IDE_H */
Signature · 1 line
1.7.3.5
PATCH v2 2/2 ftide020: add faraday ide ahb controller
Faraday's ftide020_s is an IDE-AHB controller for SoC design. This patch add the u-boot driver (PIO) of ftide020 ATA (IDE) driver. IDE commands include read, info, and other functions has been implemented.
Because this IDE controller support AHB interface only which is differ from other most IDE controller supports PCI interface. Some registers access is required during CMD/DATA I/O. Hence a configuration "CONFIG_IDE_AHB" is required to be defined according to the feature in cmd_ide.c.
---
Changes for v2:
- replace default PIO mode from 0 to 4.
- clean up lines exceed 80 charecters as could as possible.
- Since the Linux driver of ftide020 hasn't been send to kernel mailing list, we fixed the GPL statement in this driver.
- clean up space before tab problem.
drivers/block/Makefile | 1 + drivers/block/ftide020.c | 385 ++++++++++++++++++++++++++++++++++++++++++++++ drivers/block/ftide020.h | 265 +++++++++++++++++++++++++++++++ 3 files changed, 651 insertions(+), 0 deletions(-) create mode 100644 drivers/block/ftide020.c create mode 100644 drivers/block/ftide020.h
drivers/block/Makefile +1 -0
@@ -28,6 +28,7 @@ LIB := $(obj)libblock.o COBJS-$(CONFIG_SCSI_AHCI) += ahci.o COBJS-$(CONFIG_ATA_PIIX) += ata_piix.o COBJS-$(CONFIG_FSL_SATA) += fsl_sata.o +COBJS-$(CONFIG_IDE_FTIDE020) += ftide020.o COBJS-$(CONFIG_LIBATA) += libata.o COBJS-$(CONFIG_CMD_MG_DISK) += mg_disk.o COBJS-$(CONFIG_MVSATA_IDE) += mvsata_ide.o
drivers/block/ftide020.c new file +385 -0
385 lines not on this page · raw message
drivers/block/ftide020.h new file +265 -0
265 lines not on this page · raw message
Signature · 1 line
1.7.3.5
PATCH v2 2/2 ftide020: add faraday ide ahb controller
Dear Macpaul Lin,
Quoted 10 lines · In message <[email protected]> you wrote:
Faraday's
ftide020_sis an IDE-AHB controller for SoC design. This patch add the u-boot driver (PIO) of ftide020 ATA (IDE) driver. IDE commands include read, info, and other functions has been implemented.Because this IDE controller support AHB interface only which is differ from other most IDE controller supports PCI interface. Some registers access is required during CMD/DATA I/O. Hence a configuration "
CONFIG_IDE_AHB" is required to be defined according to the feature incmd_ide.c.
Quoted 6 lines
Signed-off-by Macpaul Lin <[email protected]>---
Changes for v2:
- replace default PIO mode from 0 to 4.
- clean up lines exceed 80 charecters as could as possible.
Please clean up the remaining ones, too.
Quoted 1 line
+#define
FTIDE_DRIVER_VERSION"1.0.1"
Can we get rid of this? Experience is that nobody ever updates this field when making changes to that file, so it's worthless.
drivers/block/ftide020.c line 48
Quoted 7 lines
drivers/block/ftide020.c new file +7
-0+#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef FALSE +#define FALSE 0 +#endif
Please get rid of these two.
drivers/block/ftide020.c line 55
Quoted 6 lines
drivers/block/ftide020.c new file +6
-0+/* DEBUG */ +#ifdef FTIDE_DEBUG + #define P_DEBUG(fmt, args...) printf(FTIDE_IP_NAME ":" fmt, ## args) +#else + #define P_DEBUG(a...) +#endif
Can you please use debug() instead?
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
There's a way out of any cage.
-- Captain Christopher Pike, "The Menagerie" ("The Cage"),
stardate unknown.PATCH v3 1/1 ftide020: add faraday ide ahb controller
In reply to Macpaul LinFaraday's ftide020_s is an IDE-AHB controller for SoC design. This patch add the u-boot driver (PIO) of ftide020 ATA (IDE) driver. IDE commands include read, info, and other functions has been implemented.
Because this IDE controller support AHB interface only which is differ from other most IDE controller supports PCI interface. Some registers access is required during CMD/DATA I/O. Hence a configuration "CONFIG_IDE_AHB" is required to be defined according to the feature in cmd_ide.c.
---
Changes for v2:
- replace default PIO mode from 0 to 4.
- clean up lines exceed 80 charecters as could as possible.
- Since the Linux driver of ftide020 hasn't been send to kernel mailing list, we fixed the GPL statement in this driver.
- clean up space before tab problem.
Changes for v3:
- Clean up remaining lines over 80 characters in ftide020.h.
- Remove useless driver version define.
- Remove redundant TRUE/FALSE define.
- Replace P_DEBUG marco to debug().
drivers/block/Makefile | 1 + drivers/block/ftide020.c | 367 ++++++++++++++++++++++++++++++++++++++++++++++ drivers/block/ftide020.h | 283 +++++++++++++++++++++++++++++++++++ 3 files changed, 651 insertions(+), 0 deletions(-) create mode 100644 drivers/block/ftide020.c create mode 100644 drivers/block/ftide020.h
drivers/block/Makefile +1 -0
@@ -28,6 +28,7 @@ LIB := $(obj)libblock.o COBJS-$(CONFIG_SCSI_AHCI) += ahci.o COBJS-$(CONFIG_ATA_PIIX) += ata_piix.o COBJS-$(CONFIG_FSL_SATA) += fsl_sata.o +COBJS-$(CONFIG_IDE_FTIDE020) += ftide020.o COBJS-$(CONFIG_LIBATA) += libata.o COBJS-$(CONFIG_CMD_MG_DISK) += mg_disk.o COBJS-$(CONFIG_MVSATA_IDE) += mvsata_ide.o
drivers/block/ftide020.c new file +367 -0
367 lines not on this page · raw message
drivers/block/ftide020.h new file +283 -0
283 lines not on this page · raw message
Signature · 1 line
1.7.3.5
Wolfgang Denk
AppliedPATCH v3 1/1 ftide020: add faraday ide ahb controller
Dear Macpaul Lin,
Quoted 24 lines · In message <[email protected]> you wrote:
Faraday's
ftide020_sis an IDE-AHB controller for SoC design. This patch add the u-boot driver (PIO) of ftide020 ATA (IDE) driver. IDE commands include read, info, and other functions has been implemented.Because this IDE controller support AHB interface only which is differ from other most IDE controller supports PCI interface. Some registers access is required during CMD/DATA I/O. Hence a configuration "
CONFIG_IDE_AHB" is required to be defined according to the feature incmd_ide.c.Signed-off-by Macpaul Lin <[email protected]>---
Changes for v2:
- replace default PIO mode from 0 to 4.
- clean up lines exceed 80 charecters as could as possible.
- Since the Linux driver of ftide020 hasn't been send to kernel mailing list, we fixed the GPL statement in this driver.
- clean up space before tab problem.
Changes for v3:
- Clean up remaining lines over 80 characters inftide020.h.
- Remove useless driver version define.
- Remove redundant TRUE/FALSE define.
- ReplaceP_DEBUGmarco todebug().
Quoted 6 lines
drivers/block/Makefile | 1 + drivers/block/ftide020.c | 367 ++++++++++++++++++++++++++++++++++++++++++++++ drivers/block/ftide020.h | 283 +++++++++++++++++++++++++++++++++++ 3 files changed, 651 insertions(+), 0 deletions(-) create mode 100644 drivers/block/ftide020.c create mode 100644 drivers/block/ftide020.h
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Philosophy: A route of many roads leading from nowhere to nothing. - Ambrose Bierce
Wolfgang Denk
AppliedPATCH v2 1/2 cmd_ide: enhance new feature "CONFIG_IDE_AHB"
In reply to Macpaul LinDear Macpaul Lin,
Quoted 16 lines · In message <[email protected]> you wrote:
Although most IDE controller is designed to be connected to PCI bridge, there are still some IDE controller support AHB interface for SoC design.
The driver implementation of these IDE-AHB controllers differ from other IDE-PCI controller, some additional registers and commands access is required during CMD/DATA I/O. Hence a configuration "
CONFIG_IDE_AHB" incmd_ide.cis required to be defined to support these kinds of SoC controllers. Such as Faraday's FTIDE020 series and Global Unichip's UINF-0301.Signed-off-by Macpaul Lin <[email protected]>---
Changes for v2:
- Move new prototype decarations related to AHB to fromcmd_ide.ctoide.h.
- clean up.
Quoted 4 lines
README | 8 ++++++++ common/cmd_ide.c | 29 ++++++++++++++++++++++++++++- include/ide.h | 7 +++++++ 3 files changed, 43 insertions(+), 1 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "Life sucks, but it's better than the alternative." - Peter da Silva
PATCH 1/1 IDE: fix compiler warnings
In reply to Macpaul LinThe changes introduced by commit 0abddf8 ``cmd_ide: enhance new feature "CONFIG_IDE_AHB"'' caused compiler warnings like
cmd_ide.c: In function 'ide_init':
cmd_ide.c:716: warning: assignment from incompatible pointer type
Constify the respective function arguments to fix this.
--- common/cmd_ide.c | 8 ++++---- include/ide.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)
common/cmd_ide.c +4 -4
@@ -160,7 +160,7 @@ static uchar ide_wait (int dev, ulong t);#define IDE_SPIN_UP_TIME_OUT 5000/* 5 sec spin-up timeout */ static void input_data (int dev,ulong *sect_buf,int words); -static void output_data (int dev,ulong *sect_buf,int words); +static void output_data (int dev,const ulong *sect_buf,int words);static void ident_cpy (unsigned char *dest,unsigned char *src,unsigned int len);#ifndef CONFIG_SYS_ATA_PORT_ADDR
@@ -875,7 +875,7 @@ input_swap_data(int dev, ulong *sect_buf, int words)#if defined(CONFIG_IDE_SWAP_IO )static void -output_data (int dev,ulong *sect_buf,int words) +output_data (int dev,const ulong *sect_buf,int words) {#if defined(CONFIG_CPC45 )uchar *dbuf;
@@ -919,7 +919,7 @@ output_data(int dev, ulong *sect_buf, int words) }#else /* ! CONFIG_IDE_SWAP_IO */ static void -output_data (int dev,ulong *sect_buf,int words) +output_data (int dev,const ulong *sect_buf,int words) {#if defined(CONFIG_IDE_AHB )ide_write_data (dev, sect_buf, words);
@@ -1348,7 +1348,7 @@ IDE_READ_E:/* ------------------------------------------------------------------------- */ -ulong ide_write (int device,lbaint_t blknr,ulong blkcnt,void *buffer) +ulong ide_write (int device,lbaint_t blknr,ulong blkcnt,const void *buffer) {ulong n =0 ;unsigned char c;
include/ide.h +1 -1
@@ -52,7 +52,7 @@ typedef ulong lbaint_t;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,void *buffer); +ulong ide_write (int device,lbaint_t blknr,ulong blkcnt,const void *buffer);#if defined(CONFIG_OF_IDE_FIXUP )int ide_device_present (int dev);
Signature · 1 line
1.7.4.2
Wolfgang Denk
AppliedPATCH 1/1 IDE: fix compiler warnings
Dear Wolfgang Denk,
Quoted 6 lines · In message <[email protected]> you wrote:
The changes introduced by commit 0abddf8 ``cmd_ide: enhance new feature "
CONFIG_IDE_AHB"'' caused compiler warnings like
cmd_ide.c: In function 'ide_init':
cmd_ide.c:716: warning: assignment from incompatible pointer type
Quoted 7 lines
Constify the respective function arguments to fix this.
Signed-off-by Wolfgang Denk <[email protected]>--- common/cmd_ide.c | 8 ++++---- include/ide.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)
Applied.
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de One essential to success is that you desire be an all-obsessing one, your thoughts and aims be co-ordinated, and your energy be concentra- ted and applied without letup.
PATCH 1/1 IDE: fix compiler warnings
Hi Wolfgang,
Quoted 5 lines
The changes introduced by commit 0abddf8 ``cmd_ide: enhance new feature "
CONFIG_IDE_AHB"'' caused compiler warnings like
cmd_ide.c: In function 'ide_init':
cmd_ide.c:716: warning: assignment from incompatible pointer type
Thanks!
Signature · 2 lines
Best regards, Macpaul Lin