
-----Original Message----- From: u-boot-bounces@lists.denx.de [mailto:u-boot-bounces@lists.denx.de] On Behalf Of Albert Aribaud Sent: Friday, July 09, 2010 12:11 AM To: u-boot@lists.denx.de Subject: [U-Boot] [PATCH V3 2/4] drivers/block: add mv_sata_ide driver
This driver only provides initialization code; actual driving is done by cmd_ide.c using the ATA compatibility mode of the Marvell SATAHC controller.
Signed-off-by: Albert Aribaud albert.aribaud@free.fr
drivers/block/Makefile | 1 + drivers/block/mv_sata_ide.c | 61 +++++++++++++++++++++++++++++++++++++++++++ include/mv_sata_ide.h | 54 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 116 insertions(+), 0 deletions(-) create mode 100644 drivers/block/mv_sata_ide.c create mode 100644 include/mv_sata_ide.h
diff --git a/drivers/block/Makefile b/drivers/block/Makefile index 3f6ad5c..b47a5e4 100644 --- a/drivers/block/Makefile +++ b/drivers/block/Makefile @@ -36,6 +36,7 @@ COBJS-$(CONFIG_SATA_SIL3114) += sata_sil3114.o COBJS-$(CONFIG_SCSI_AHCI) += ahci.o COBJS-$(CONFIG_SCSI_SYM53C8XX) += sym53c8xx.o COBJS-$(CONFIG_SYSTEMACE) += systemace.o +COBJS-$(CONFIG_MV_SATA_IDE) += mv_sata_ide.o
Pls correct ordering here
COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c) diff --git a/drivers/block/mv_sata_ide.c b/drivers/block/mv_sata_ide.c new file mode 100644 index 0000000..10f8bf6 --- /dev/null +++ b/drivers/block/mv_sata_ide.c @@ -0,0 +1,61 @@ +/*
- Copyright (C) 2010 Albert ARIBAUD albert.aribaud@free.fr
- Written-by: Albert ARIBAUD albert.aribaud@free.fr
- 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., 51 Franklin Street, Fifth Floor, Boston,
- MA 02110-1301 USA
- */
+#include <common.h> +#include <asm/io.h> +#include "mv_sata_ide.h"
+/* Mask and values for device DETection and link initialization */ +#define MV_SATA_SCONTROL_DET_MASK 0x0000000F
Overall if you use MVSATA you can make your patch shorter.
+#define MV_SATA_SCONTROL_DET_NONE 0x00000000 +#define MV_SATA_SCONTROL_DET_INIT 0x00000001
+/* Mask and values for device Interface Power Management */ +#define MV_SATA_SCONTROL_IMP_MASK 0x00000F00 +#define MV_SATA_SCONTROL_IMP_NO_LP_ALLOWED 0x00000300
+#define MV_SATA_SCONTROL_MASK \
- (MV_SATA_SCONTROL_DET_MASK|MV_SATA_SCONTROL_IMP_MASK)
+#define MV_SATA_PORT_INIT \
- (MV_SATA_SCONTROL_DET_INIT|MV_SATA_SCONTROL_IMP_NO_LP_ALLOWED)
+#define MV_SATA_PORT_USE \
- (MV_SATA_SCONTROL_DET_NONE|MV_SATA_SCONTROL_IMP_NO_LP_ALLOWED)
+void mv_sata_ide_initialize_port(
- struct mv_sata_interface_registers *port)
+{
- u32 reg;
- reg = readl(&port->SControl);
- reg = (reg & ~MV_SATA_SCONTROL_MASK) | MV_SATA_PORT_INIT;
- writel(reg, &port->SControl);
- reg = (reg & ~MV_SATA_SCONTROL_MASK) | MV_SATA_PORT_USE;
- writel(reg, &port->SControl);
+} diff --git a/include/mv_sata_ide.h b/include/mv_sata_ide.h new file mode 100644 index 0000000..fdcb137 --- /dev/null +++ b/include/mv_sata_ide.h @@ -0,0 +1,54 @@ +/*
- Copyright (C) 2010 Albert ARIBAUD albert.aribaud@free.fr
- Written-by: Albert ARIBAUD albert.aribaud@free.fr
- 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., 51 Franklin Street, Fifth Floor, Boston,
- MA 02110-1301 USA
- */
+#ifndef _MV_SATA_IDE_H +#define _MV_SATA_IDE_H
+#ifndef __ASSEMBLY__
+/* SATA insterface registers */ +struct mv_sata_interface_registers +{
- volatile u32 SStatus;
Pls remove volatiles from here
- volatile u32 SError;
- volatile u32 SControl;
- volatile u32 LTMode;
- volatile u32 PhyMode3;
- volatile u32 PhyMode4;
- volatile u32 Reserved1[5];
- volatile u32 PhyMode1;
- volatile u32 PhyMode2;
- volatile u32 BIST_CR;
- volatile u32 BIST_DW1;
- volatile u32 BIST_DW2;
- volatile u32 SErrorIntrMask;
+};
+/* Initialize a SATA port */ +void mv_sata_ide_initialize_port(
- struct mv_sata_interface_registers *port);
+#endif /* __ASSEMBLY__ */
+#endif /* _MV_SATA_IDE_H */
Regards.. Prafulla . .