All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 01/13 V2] at91sam9/at91cap: spi init add hardware chip select support
@ 2009-03-27 22:30 Jean-Christophe PLAGNIOL-VILLARD
  2009-03-27 22:30 ` [U-Boot] [PATCH 02/13 V2] at91sam9: add watchdog support Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 62+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-03-27 22:30 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
Fix typo in the commit message

Best Regards,
J.
 cpu/arm926ejs/at91/at91cap9_spi.c    |   37 ++++++++++++++++++++++++++++-----
 cpu/arm926ejs/at91/at91sam9260_spi.c |   36 +++++++++++++++++++++++++++-----
 cpu/arm926ejs/at91/at91sam9261_spi.c |   36 +++++++++++++++++++++++++++-----
 cpu/arm926ejs/at91/at91sam9263_spi.c |   36 +++++++++++++++++++++++++++-----
 cpu/arm926ejs/at91/at91sam9rl_spi.c  |   18 +++++++++++++--
 5 files changed, 136 insertions(+), 27 deletions(-)

diff --git a/cpu/arm926ejs/at91/at91cap9_spi.c b/cpu/arm926ejs/at91/at91cap9_spi.c
index 356a804..cd8143b 100644
--- a/cpu/arm926ejs/at91/at91cap9_spi.c
+++ b/cpu/arm926ejs/at91/at91cap9_spi.c
@@ -38,15 +38,27 @@ void at91_spi0_hw_init(unsigned long cs_mask)
 	at91_sys_write(AT91_PMC_PCER, 1 << AT91CAP9_ID_SPI0);
 
 	if (cs_mask & (1 << 0)) {
-		at91_set_gpio_output(AT91_PIN_PA5, 1);
+		at91_set_B_periph(AT91_PIN_PA5, 1);
 	}
 	if (cs_mask & (1 << 1)) {
-		at91_set_gpio_output(AT91_PIN_PA3, 1);
+		at91_set_B_periph(AT91_PIN_PA3, 1);
 	}
 	if (cs_mask & (1 << 2)) {
-		at91_set_gpio_output(AT91_PIN_PD0, 1);
+		at91_set_B_periph(AT91_PIN_PD0, 1);
 	}
 	if (cs_mask & (1 << 3)) {
+		at91_set_B_periph(AT91_PIN_PD1, 1);
+	}
+	if (cs_mask & (1 << 4)) {
+		at91_set_gpio_output(AT91_PIN_PA5, 1);
+	}
+	if (cs_mask & (1 << 5)) {
+		at91_set_gpio_output(AT91_PIN_PA3, 1);
+	}
+	if (cs_mask & (1 << 6)) {
+		at91_set_gpio_output(AT91_PIN_PD0, 1);
+	}
+	if (cs_mask & (1 << 7)) {
 		at91_set_gpio_output(AT91_PIN_PD1, 1);
 	}
 }
@@ -61,15 +73,28 @@ void at91_spi1_hw_init(unsigned long cs_mask)
 	at91_sys_write(AT91_PMC_PCER, 1 << AT91CAP9_ID_SPI1);
 
 	if (cs_mask & (1 << 0)) {
-		at91_set_gpio_output(AT91_PIN_PB15, 1);
+		at91_set_A_periph(AT91_PIN_PB15, 1);
 	}
 	if (cs_mask & (1 << 1)) {
-		at91_set_gpio_output(AT91_PIN_PB16, 1);
+		at91_set_A_periph(AT91_PIN_PB16, 1);
 	}
 	if (cs_mask & (1 << 2)) {
-		at91_set_gpio_output(AT91_PIN_PB17, 1);
+		at91_set_A_periph(AT91_PIN_PB17, 1);
 	}
 	if (cs_mask & (1 << 3)) {
+		at91_set_A_periph(AT91_PIN_PB18, 1);
+	}
+	if (cs_mask & (1 << 4)) {
+		at91_set_gpio_output(AT91_PIN_PB15, 1);
+	}
+	if (cs_mask & (1 << 5)) {
+		at91_set_gpio_output(AT91_PIN_PB16, 1);
+	}
+	if (cs_mask & (1 << 6)) {
+		at91_set_gpio_output(AT91_PIN_PB17, 1);
+	}
+	if (cs_mask & (1 << 7)) {
 		at91_set_gpio_output(AT91_PIN_PB18, 1);
 	}
+
 }
diff --git a/cpu/arm926ejs/at91/at91sam9260_spi.c b/cpu/arm926ejs/at91/at91sam9260_spi.c
index 0105072..d6fd80e 100644
--- a/cpu/arm926ejs/at91/at91sam9260_spi.c
+++ b/cpu/arm926ejs/at91/at91sam9260_spi.c
@@ -38,15 +38,27 @@ void at91_spi0_hw_init(unsigned long cs_mask)
 	at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_SPI0);
 
 	if (cs_mask & (1 << 0)) {
-		at91_set_gpio_output(AT91_PIN_PA3, 1);
+		at91_set_A_periph(AT91_PIN_PA3, 1);
 	}
 	if (cs_mask & (1 << 1)) {
-		at91_set_gpio_output(AT91_PIN_PC11, 1);
+		at91_set_B_periph(AT91_PIN_PC11, 1);
 	}
 	if (cs_mask & (1 << 2)) {
-		at91_set_gpio_output(AT91_PIN_PC16, 1);
+		at91_set_B_periph(AT91_PIN_PC16, 1);
 	}
 	if (cs_mask & (1 << 3)) {
+		at91_set_B_periph(AT91_PIN_PC17, 1);
+	}
+	if (cs_mask & (1 << 4)) {
+		at91_set_gpio_output(AT91_PIN_PA3, 1);
+	}
+	if (cs_mask & (1 << 5)) {
+		at91_set_gpio_output(AT91_PIN_PC11, 1);
+	}
+	if (cs_mask & (1 << 6)) {
+		at91_set_gpio_output(AT91_PIN_PC16, 1);
+	}
+	if (cs_mask & (1 << 7)) {
 		at91_set_gpio_output(AT91_PIN_PC17, 1);
 	}
 }
@@ -61,15 +73,27 @@ void at91_spi1_hw_init(unsigned long cs_mask)
 	at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_SPI1);
 
 	if (cs_mask & (1 << 0)) {
-		at91_set_gpio_output(AT91_PIN_PB3, 1);
+		at91_set_A_periph(AT91_PIN_PB3, 1);
 	}
 	if (cs_mask & (1 << 1)) {
-		at91_set_gpio_output(AT91_PIN_PC5, 1);
+		at91_set_B_periph(AT91_PIN_PC5, 1);
 	}
 	if (cs_mask & (1 << 2)) {
-		at91_set_gpio_output(AT91_PIN_PC4, 1);
+		at91_set_B_periph(AT91_PIN_PC4, 1);
 	}
 	if (cs_mask & (1 << 3)) {
 		at91_set_gpio_output(AT91_PIN_PC3, 1);
 	}
+	if (cs_mask & (1 << 4)) {
+		at91_set_gpio_output(AT91_PIN_PB3, 1);
+	}
+	if (cs_mask & (1 << 5)) {
+		at91_set_gpio_output(AT91_PIN_PC5, 1);
+	}
+	if (cs_mask & (1 << 6)) {
+		at91_set_gpio_output(AT91_PIN_PC4, 1);
+	}
+	if (cs_mask & (1 << 7)) {
+		at91_set_gpio_output(AT91_PIN_PC3, 1);
+	}
 }
diff --git a/cpu/arm926ejs/at91/at91sam9261_spi.c b/cpu/arm926ejs/at91/at91sam9261_spi.c
index f70320d..9383dc6 100644
--- a/cpu/arm926ejs/at91/at91sam9261_spi.c
+++ b/cpu/arm926ejs/at91/at91sam9261_spi.c
@@ -38,15 +38,27 @@ void at91_spi0_hw_init(unsigned long cs_mask)
 	at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9261_ID_SPI0);
 
 	if (cs_mask & (1 << 0)) {
-		at91_set_gpio_output(AT91_PIN_PA3, 1);
+		at91_set_A_periph(AT91_PIN_PA3, 1);
 	}
 	if (cs_mask & (1 << 1)) {
-		at91_set_gpio_output(AT91_PIN_PA4, 1);
+		at91_set_A_periph(AT91_PIN_PA4, 1);
 	}
 	if (cs_mask & (1 << 2)) {
-		at91_set_gpio_output(AT91_PIN_PA5, 1);
+		at91_set_A_periph(AT91_PIN_PA5, 1);
 	}
 	if (cs_mask & (1 << 3)) {
+		at91_set_A_periph(AT91_PIN_PA6, 1);
+	}
+	if (cs_mask & (1 << 4)) {
+		at91_set_gpio_output(AT91_PIN_PA3, 1);
+	}
+	if (cs_mask & (1 << 5)) {
+		at91_set_gpio_output(AT91_PIN_PA4, 1);
+	}
+	if (cs_mask & (1 << 6)) {
+		at91_set_gpio_output(AT91_PIN_PA5, 1);
+	}
+	if (cs_mask & (1 << 7)) {
 		at91_set_gpio_output(AT91_PIN_PA6, 1);
 	}
 }
@@ -61,15 +73,27 @@ void at91_spi1_hw_init(unsigned long cs_mask)
 	at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9261_ID_SPI1);
 
 	if (cs_mask & (1 << 0)) {
-		at91_set_gpio_output(AT91_PIN_PB28, 1);
+		at91_set_A_periph(AT91_PIN_PB28, 1);
 	}
 	if (cs_mask & (1 << 1)) {
-		at91_set_gpio_output(AT91_PIN_PA24, 1);
+		at91_set_B_periph(AT91_PIN_PA24, 1);
 	}
 	if (cs_mask & (1 << 2)) {
-		at91_set_gpio_output(AT91_PIN_PA25, 1);
+		at91_set_B_periph(AT91_PIN_PA25, 1);
 	}
 	if (cs_mask & (1 << 3)) {
+		at91_set_A_periph(AT91_PIN_PA26, 1);
+	}
+	if (cs_mask & (1 << 4)) {
+		at91_set_gpio_output(AT91_PIN_PB28, 1);
+	}
+	if (cs_mask & (1 << 5)) {
+		at91_set_gpio_output(AT91_PIN_PA24, 1);
+	}
+	if (cs_mask & (1 << 6)) {
+		at91_set_gpio_output(AT91_PIN_PA25, 1);
+	}
+	if (cs_mask & (1 << 7)) {
 		at91_set_gpio_output(AT91_PIN_PA26, 1);
 	}
 }
diff --git a/cpu/arm926ejs/at91/at91sam9263_spi.c b/cpu/arm926ejs/at91/at91sam9263_spi.c
index 1dda04c..e52dd61 100644
--- a/cpu/arm926ejs/at91/at91sam9263_spi.c
+++ b/cpu/arm926ejs/at91/at91sam9263_spi.c
@@ -38,15 +38,27 @@ void at91_spi0_hw_init(unsigned long cs_mask)
 	at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_SPI0);
 
 	if (cs_mask & (1 << 0)) {
-		at91_set_gpio_output(AT91_PIN_PA5, 1);
+		at91_set_B_periph(AT91_PIN_PA5, 1);
 	}
 	if (cs_mask & (1 << 1)) {
-		at91_set_gpio_output(AT91_PIN_PA3, 1);
+		at91_set_B_periph(AT91_PIN_PA3, 1);
 	}
 	if (cs_mask & (1 << 2)) {
-		at91_set_gpio_output(AT91_PIN_PA4, 1);
+		at91_set_B_periph(AT91_PIN_PA4, 1);
 	}
 	if (cs_mask & (1 << 3)) {
+		at91_set_B_periph(AT91_PIN_PB11, 1);
+	}
+	if (cs_mask & (1 << 4)) {
+		at91_set_gpio_output(AT91_PIN_PA5, 1);
+	}
+	if (cs_mask & (1 << 5)) {
+		at91_set_gpio_output(AT91_PIN_PA3, 1);
+	}
+	if (cs_mask & (1 << 6)) {
+		at91_set_gpio_output(AT91_PIN_PA4, 1);
+	}
+	if (cs_mask & (1 << 7)) {
 		at91_set_gpio_output(AT91_PIN_PB11, 1);
 	}
 }
@@ -61,15 +73,27 @@ void at91_spi1_hw_init(unsigned long cs_mask)
 	at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_SPI1);
 
 	if (cs_mask & (1 << 0)) {
-		at91_set_gpio_output(AT91_PIN_PB15, 1);
+		at91_set_A_periph(AT91_PIN_PB15, 1);
 	}
 	if (cs_mask & (1 << 1)) {
-		at91_set_gpio_output(AT91_PIN_PB16, 1);
+		at91_set_A_periph(AT91_PIN_PB16, 1);
 	}
 	if (cs_mask & (1 << 2)) {
-		at91_set_gpio_output(AT91_PIN_PB17, 1);
+		at91_set_A_periph(AT91_PIN_PB17, 1);
 	}
 	if (cs_mask & (1 << 3)) {
+		at91_set_A_periph(AT91_PIN_PB18, 1);
+	}
+	if (cs_mask & (1 << 4)) {
+		at91_set_gpio_output(AT91_PIN_PB15, 1);
+	}
+	if (cs_mask & (1 << 5)) {
+		at91_set_gpio_output(AT91_PIN_PB16, 1);
+	}
+	if (cs_mask & (1 << 6)) {
+		at91_set_gpio_output(AT91_PIN_PB17, 1);
+	}
+	if (cs_mask & (1 << 7)) {
 		at91_set_gpio_output(AT91_PIN_PB18, 1);
 	}
 }
diff --git a/cpu/arm926ejs/at91/at91sam9rl_spi.c b/cpu/arm926ejs/at91/at91sam9rl_spi.c
index aa9c183..389d6d8 100644
--- a/cpu/arm926ejs/at91/at91sam9rl_spi.c
+++ b/cpu/arm926ejs/at91/at91sam9rl_spi.c
@@ -38,15 +38,27 @@ void at91_spi0_hw_init(unsigned long cs_mask)
 	at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9RL_ID_SPI);
 
 	if (cs_mask & (1 << 0)) {
-		at91_set_gpio_output(AT91_PIN_PA28, 1);
+		at91_set_A_periph(AT91_PIN_PA28, 1);
 	}
 	if (cs_mask & (1 << 1)) {
-		at91_set_gpio_output(AT91_PIN_PB7, 1);
+		at91_set_B_periph(AT91_PIN_PB7, 1);
 	}
 	if (cs_mask & (1 << 2)) {
-		at91_set_gpio_output(AT91_PIN_PD8, 1);
+		at91_set_A_periph(AT91_PIN_PD8, 1);
 	}
 	if (cs_mask & (1 << 3)) {
+		at91_set_B_periph(AT91_PIN_PD9, 1);
+	}
+	if (cs_mask & (1 << 4)) {
+		at91_set_gpio_output(AT91_PIN_PA28, 1);
+	}
+	if (cs_mask & (1 << 5)) {
+		at91_set_gpio_output(AT91_PIN_PB7, 1);
+	}
+	if (cs_mask & (1 << 6)) {
+		at91_set_gpio_output(AT91_PIN_PD8, 1);
+	}
+	if (cs_mask & (1 << 7)) {
 		at91_set_gpio_output(AT91_PIN_PD9, 1);
 	}
 }
-- 
1.6.2.1

^ permalink raw reply related	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 02/13 V2] at91sam9: add watchdog support
  2009-03-27 22:30 [U-Boot] [PATCH 01/13 V2] at91sam9/at91cap: spi init add hardware chip select support Jean-Christophe PLAGNIOL-VILLARD
@ 2009-03-27 22:30 ` Jean-Christophe PLAGNIOL-VILLARD
  2009-03-27 22:30   ` [U-Boot] [PATCH 03/13] at91: rename DATAFLASH_MMC_SELECT to CONFIG_DATAFLASH_MMC_SELECT Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 62+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-03-27 22:30 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
update the readme

Best Regards,
J.
 Makefile                             |    1 +
 doc/README.at91                      |   11 +++++
 drivers/serial/atmel_usart.c         |    4 +-
 drivers/watchdog/Makefile            |   46 ++++++++++++++++++++
 drivers/watchdog/at91sam9_wdt.c      |   79 ++++++++++++++++++++++++++++++++++
 include/asm-arm/arch-at91/at91_wdt.h |   38 ++++++++++++++++
 6 files changed, 178 insertions(+), 1 deletions(-)
 create mode 100644 drivers/watchdog/Makefile
 create mode 100644 drivers/watchdog/at91sam9_wdt.c
 create mode 100644 include/asm-arm/arch-at91/at91_wdt.h

diff --git a/Makefile b/Makefile
index 1cce381..d774e2e 100644
--- a/Makefile
+++ b/Makefile
@@ -264,6 +264,7 @@ LIBS += drivers/rtc/librtc.a
 LIBS += drivers/serial/libserial.a
 LIBS += drivers/usb/libusb.a
 LIBS += drivers/video/libvideo.a
+LIBS += drivers/watchdog/libwatchdog.a
 LIBS += common/libcommon.a
 LIBS += libfdt/libfdt.a
 LIBS += api/libapi.a
diff --git a/doc/README.at91 b/doc/README.at91
index e460e66..9b4eae6 100644
--- a/doc/README.at91
+++ b/doc/README.at91
@@ -2,6 +2,7 @@ Atmel AT91 Evaluation kits
 
 http://atmel.com/dyn/products/tools.asp?family_id=605#1443
 
+I. Board mapping & boot media
 ------------------------------------------------------------------------------
 AT91SAM9260EK, AT91SAM9G20EK & AT91SAM9XEEK
 ------------------------------------------------------------------------------
@@ -86,3 +87,13 @@ Environment variables
 		make at91sam9263ek_config		- use data flash (spi cs0) (default)
 		make at91sam9263ek_nandflash_config	- use nand flash
 		make at91sam9263ek_dataflash_cs0_config	- use data flash (spi cs0)
+
+II. Watchdog support
+
+	For security reasons, the at91 watchdog is running at boot time and,
+	if deactivated, cannot be used anymore.
+	If you want to use the watchdog, you will need to keep it running in
+	your code (make sure not to disable it in AT91Bootstrap for instance).
+
+	In the U-Boot configuration, the AT91 watchdog support is enabled using
+	the CONFIG_AT91SAM9_WATCHDOG and CONFIG_HW_WATCHDOG options.
diff --git a/drivers/serial/atmel_usart.c b/drivers/serial/atmel_usart.c
index f3b146c..f50552a 100644
--- a/drivers/serial/atmel_usart.c
+++ b/drivers/serial/atmel_usart.c
@@ -16,6 +16,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 #include <common.h>
+#include <watchdog.h>
 
 #include <asm/io.h>
 #include <asm/arch/clk.h>
@@ -87,7 +88,8 @@ void serial_puts(const char *s)
 
 int serial_getc(void)
 {
-	while (!(usart3_readl(CSR) & USART3_BIT(RXRDY))) ;
+	while (!(usart3_readl(CSR) & USART3_BIT(RXRDY)))
+		 WATCHDOG_RESET();
 	return usart3_readl(RHR);
 }
 
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
new file mode 100644
index 0000000..200968d
--- /dev/null
+++ b/drivers/watchdog/Makefile
@@ -0,0 +1,46 @@
+#
+# (C) Copyright 2008
+# 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 $(TOPDIR)/config.mk
+
+LIB	:= $(obj)libwatchdog.a
+
+COBJS-$(CONFIG_AT91SAM9_WATCHDOG) += at91sam9_wdt.o
+
+COBJS	:= $(COBJS-y)
+SRCS	:= $(COBJS:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS))
+
+all:	$(LIB)
+
+$(LIB):	$(obj).depend $(OBJS)
+	$(AR) $(ARFLAGS) $@ $(OBJS)
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/drivers/watchdog/at91sam9_wdt.c b/drivers/watchdog/at91sam9_wdt.c
new file mode 100644
index 0000000..5bb8b77
--- /dev/null
+++ b/drivers/watchdog/at91sam9_wdt.c
@@ -0,0 +1,79 @@
+/*
+ * [origin: Linux kernel drivers/watchdog/at91sam9_wdt.c]
+ *
+ * Watchdog driver for Atmel AT91SAM9x processors.
+ *
+ * Copyright (C) 2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+ * Copyright (C) 2008 Renaud CERRATO r.cerrato at til-technologies.fr
+ *
+ * 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.
+ */
+
+/*
+ * The Watchdog Timer Mode Register can be only written to once. If the
+ * timeout need to be set from U-Boot, be sure that the bootstrap doesn't
+ * write to this register. Inform Linux to it too
+ */
+
+#include <common.h>
+#include <watchdog.h>
+#include <asm/arch/hardware.h>
+#include <asm/arch/io.h>
+#include <asm/arch/at91_wdt.h>
+
+/*
+ * AT91SAM9 watchdog runs a 12bit counter @ 256Hz,
+ * use this to convert a watchdog
+ * value from/to milliseconds.
+ */
+#define ms_to_ticks(t)	(((t << 8) / 1000) - 1)
+#define ticks_to_ms(t)	(((t + 1) * 1000) >> 8)
+
+/* Hardware timeout in seconds */
+#define WDT_HW_TIMEOUT 2
+
+/*
+ * Set the watchdog time interval in 1/256Hz (write-once)
+ * Counter is 12 bit.
+ */
+static int at91_wdt_settimeout(unsigned int timeout)
+{
+	unsigned int reg;
+	unsigned int mr;
+
+	/* Check if disabled */
+	mr = at91_sys_read(AT91_WDT_MR);
+	if (mr & AT91_WDT_WDDIS) {
+		printf("sorry, watchdog is disabled\n");
+		return -1;
+	}
+
+	/*
+	 * All counting occurs at SLOW_CLOCK / 128 = 256 Hz
+	 *
+	 * Since WDV is a 12-bit counter, the maximum period is
+	 * 4096 / 256 = 16 seconds.
+	 */
+	reg = AT91_WDT_WDRSTEN	/* causes watchdog reset */
+		/* | AT91_WDT_WDRPROC	causes processor reset only */
+		| AT91_WDT_WDDBGHLT		/* disabled in debug mode */
+		| AT91_WDT_WDD			/* restart at any time */
+		| (timeout & AT91_WDT_WDV);	/* timer value */
+	at91_sys_write(AT91_WDT_MR, reg);
+
+	return 0;
+}
+
+void hw_watchdog_reset(void)
+{
+	at91_sys_write(AT91_WDT_CR, AT91_WDT_KEY | AT91_WDT_WDRSTT);
+}
+
+void hw_watchdog_init(void)
+{
+	/* 16 seconds timer, resets enabled */
+	at91_wdt_settimeout(ms_to_ticks(WDT_HW_TIMEOUT * 1000));
+}
diff --git a/include/asm-arm/arch-at91/at91_wdt.h b/include/asm-arm/arch-at91/at91_wdt.h
new file mode 100644
index 0000000..7e18537
--- /dev/null
+++ b/include/asm-arm/arch-at91/at91_wdt.h
@@ -0,0 +1,38 @@
+/*
+ * [origin: Linux kernel arch/arm/mach-at91/include/mach/at91_wdt.h]
+ *
+ * Copyright (C) 2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+ * Copyright (C) 2007 Andrew Victor
+ * Copyright (C) 2007 Atmel Corporation.
+ *
+ * Watchdog Timer (WDT) - System peripherals regsters.
+ * Based on AT91SAM9261 datasheet revision D.
+ *
+ * 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.
+ */
+
+#ifndef AT91_WDT_H
+#define AT91_WDT_H
+
+#define AT91_WDT_CR		(AT91_WDT + 0x00)	/* Watchdog Control Register */
+#define		AT91_WDT_WDRSTT		(1    << 0)		/* Restart */
+#define		AT91_WDT_KEY		(0xa5 << 24)		/* KEY Password */
+
+#define AT91_WDT_MR		(AT91_WDT + 0x04)	/* Watchdog Mode Register */
+#define		AT91_WDT_WDV		(0xfff << 0)		/* Counter Value */
+#define		AT91_WDT_WDFIEN		(1     << 12)		/* Fault Interrupt Enable */
+#define		AT91_WDT_WDRSTEN	(1     << 13)		/* Reset Processor */
+#define		AT91_WDT_WDRPROC	(1     << 14)		/* Timer Restart */
+#define		AT91_WDT_WDDIS		(1     << 15)		/* Watchdog Disable */
+#define		AT91_WDT_WDD		(0xfff << 16)		/* Delta Value */
+#define		AT91_WDT_WDDBGHLT	(1     << 28)		/* Debug Halt */
+#define		AT91_WDT_WDIDLEHLT	(1     << 29)		/* Idle Halt */
+
+#define AT91_WDT_SR		(AT91_WDT + 0x08)	/* Watchdog Status Register */
+#define		AT91_WDT_WDUNF		(1 << 0)		/* Watchdog Underflow */
+#define		AT91_WDT_WDERR		(1 << 1)		/* Watchdog Error */
+
+#endif
-- 
1.6.2.1

^ permalink raw reply related	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 03/13] at91: rename DATAFLASH_MMC_SELECT to CONFIG_DATAFLASH_MMC_SELECT
  2009-03-27 22:30 ` [U-Boot] [PATCH 02/13 V2] at91sam9: add watchdog support Jean-Christophe PLAGNIOL-VILLARD
@ 2009-03-27 22:30   ` Jean-Christophe PLAGNIOL-VILLARD
  2009-03-27 22:30     ` [U-Boot] [PATCH 04/13] at91rm9200dk: Move conditional compilation to Makefile Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 62+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-03-27 22:30 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 board/atmel/at91rm9200dk/mux.c |   74 ++++++++++++++++++++--------------------
 cpu/arm926ejs/at91/.gitignore  |    5 +++
 include/at45.h                 |    2 +-
 3 files changed, 43 insertions(+), 38 deletions(-)
 rewrite board/atmel/at91rm9200dk/mux.c (69%)
 create mode 100644 cpu/arm926ejs/at91/.gitignore

diff --git a/board/atmel/at91rm9200dk/mux.c b/board/atmel/at91rm9200dk/mux.c
dissimilarity index 69%
index 767d280..5e03673 100644
--- a/board/atmel/at91rm9200dk/mux.c
+++ b/board/atmel/at91rm9200dk/mux.c
@@ -1,37 +1,37 @@
-#include <config.h>
-#include <common.h>
-#include <asm/hardware.h>
-#include <dataflash.h>
-
-int AT91F_GetMuxStatus(void) {
-#ifdef	DATAFLASH_MMC_SELECT
-	AT91C_BASE_PIOB->PIO_PER = DATAFLASH_MMC_SELECT; /* Set in PIO mode */
-	AT91C_BASE_PIOB->PIO_OER = DATAFLASH_MMC_SELECT; /* Configure in output */
-
-
-	if(AT91C_BASE_PIOB->PIO_ODSR & DATAFLASH_MMC_SELECT) {
-		return 1;
-	} else {
-		return 0;
-	}
-#endif
-	return 0;
-}
-
-void AT91F_SelectMMC(void) {
-#ifdef	DATAFLASH_MMC_SELECT
-	AT91C_BASE_PIOB->PIO_PER = DATAFLASH_MMC_SELECT;	/* Set in PIO mode */
-	AT91C_BASE_PIOB->PIO_OER = DATAFLASH_MMC_SELECT;	/* Configure in output */
-	/* Set Output */
-	AT91C_BASE_PIOB->PIO_SODR = DATAFLASH_MMC_SELECT;
-#endif
-}
-
-void AT91F_SelectSPI(void) {
-#ifdef	DATAFLASH_MMC_SELECT
-	AT91C_BASE_PIOB->PIO_PER = DATAFLASH_MMC_SELECT;	/* Set in PIO mode */
-	AT91C_BASE_PIOB->PIO_OER = DATAFLASH_MMC_SELECT;	/* Configure in output */
-	/* Clear Output */
-	AT91C_BASE_PIOB->PIO_CODR = DATAFLASH_MMC_SELECT;
-#endif
-}
+#include <config.h>
+#include <common.h>
+#include <asm/hardware.h>
+#include <dataflash.h>
+
+int AT91F_GetMuxStatus(void) {
+#ifdef	CONFIG_DATAFLASH_MMC_SELECT
+	AT91C_BASE_PIOB->PIO_PER = CONFIG_SYS_DATAFLASH_MMC_PIO; /* Set in PIO mode */
+	AT91C_BASE_PIOB->PIO_OER = CONFIG_SYS_DATAFLASH_MMC_PIO; /* Configure in output */
+
+
+	if(AT91C_BASE_PIOB->PIO_ODSR & CONFIG_SYS_DATAFLASH_MMC_PIO) {
+		return 1;
+	} else {
+		return 0;
+	}
+#endif
+	return 0;
+}
+
+void AT91F_SelectMMC(void) {
+#ifdef	CONFIG_DATAFLASH_MMC_SELECT
+	AT91C_BASE_PIOB->PIO_PER = CONFIG_SYS_DATAFLASH_MMC_PIO; /* Set in PIO mode */
+	AT91C_BASE_PIOB->PIO_OER = CONFIG_SYS_DATAFLASH_MMC_PIO; /* Configure in output */
+	/* Set Output */
+	AT91C_BASE_PIOB->PIO_SODR = CONFIG_SYS_DATAFLASH_MMC_PIO;
+#endif
+}
+
+void AT91F_SelectSPI(void) {
+#ifdef	CONFIG_DATAFLASH_MMC_SELECT
+	AT91C_BASE_PIOB->PIO_PER = CONFIG_SYS_DATAFLASH_MMC_PIO; /* Set in PIO mode */
+	AT91C_BASE_PIOB->PIO_OER = CONFIG_SYS_DATAFLASH_MMC_PIO; /* Configure in output */
+	/* Clear Output */
+	AT91C_BASE_PIOB->PIO_CODR = CONFIG_SYS_DATAFLASH_MMC_PIO;
+#endif
+}
diff --git a/cpu/arm926ejs/at91/.gitignore b/cpu/arm926ejs/at91/.gitignore
new file mode 100644
index 0000000..8a8c3b8
--- /dev/null
+++ b/cpu/arm926ejs/at91/.gitignore
@@ -0,0 +1,5 @@
+#
+# Generated files
+#
+
+/u-boot.lds
diff --git a/include/at45.h b/include/at45.h
index 40bb4a0..e7e3711 100644
--- a/include/at45.h
+++ b/include/at45.h
@@ -1,7 +1,7 @@
 
 #ifndef	_AT45_H_
 #define	_AT45_H_
-#ifdef	DATAFLASH_MMC_SELECT
+#ifdef	CONFIG_DATAFLASH_MMC_SELECT
 extern	void AT91F_SelectMMC(void);
 extern	void AT91F_SelectSPI(void);
 extern	int AT91F_GetMuxStatus(void);
-- 
1.6.2.1

^ permalink raw reply related	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 04/13] at91rm9200dk: Move conditional compilation to Makefile
  2009-03-27 22:30   ` [U-Boot] [PATCH 03/13] at91: rename DATAFLASH_MMC_SELECT to CONFIG_DATAFLASH_MMC_SELECT Jean-Christophe PLAGNIOL-VILLARD
@ 2009-03-27 22:30     ` Jean-Christophe PLAGNIOL-VILLARD
  2009-03-27 22:30       ` [U-Boot] [PATCH 05/13] add dataflash mmc mux missing support Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 62+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-03-27 22:30 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 board/atmel/at91rm9200dk/Makefile |   14 ++++++++++----
 board/atmel/at91rm9200dk/mux.c    |   12 ++----------
 2 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/board/atmel/at91rm9200dk/Makefile b/board/atmel/at91rm9200dk/Makefile
index 2d806d0..79d41d6 100644
--- a/board/atmel/at91rm9200dk/Makefile
+++ b/board/atmel/at91rm9200dk/Makefile
@@ -25,10 +25,16 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(BOARD).a
 
-COBJS	:= at91rm9200dk.o flash.o led.o mux.o partition.o
-
-SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS	:= $(addprefix $(obj),$(COBJS))
+COBJS-y += $(BOARD).o
+COBJS-y += flash.o
+COBJS-y += led.o
+ifdef CONFIG_HAS_DATAFLASH
+COBJS-$(CONFIG_DATAFLASH_MMC_SELECT) += mux.o
+COBJS-y += partition.o
+endif
+
+SRCS	:= $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS-y))
 SOBJS	:= $(addprefix $(obj),$(SOBJS))
 
 $(LIB):	$(obj).depend $(OBJS) $(SOBJS)
diff --git a/board/atmel/at91rm9200dk/mux.c b/board/atmel/at91rm9200dk/mux.c
index 5e03673..a00563e 100644
--- a/board/atmel/at91rm9200dk/mux.c
+++ b/board/atmel/at91rm9200dk/mux.c
@@ -4,34 +4,26 @@
 #include <dataflash.h>
 
 int AT91F_GetMuxStatus(void) {
-#ifdef	CONFIG_DATAFLASH_MMC_SELECT
 	AT91C_BASE_PIOB->PIO_PER = CONFIG_SYS_DATAFLASH_MMC_PIO; /* Set in PIO mode */
 	AT91C_BASE_PIOB->PIO_OER = CONFIG_SYS_DATAFLASH_MMC_PIO; /* Configure in output */
 
 
-	if(AT91C_BASE_PIOB->PIO_ODSR & CONFIG_SYS_DATAFLASH_MMC_PIO) {
+	if(AT91C_BASE_PIOB->PIO_ODSR & CONFIG_SYS_DATAFLASH_MMC_PIO)
 		return 1;
-	} else {
-		return 0;
-	}
-#endif
+
 	return 0;
 }
 
 void AT91F_SelectMMC(void) {
-#ifdef	CONFIG_DATAFLASH_MMC_SELECT
 	AT91C_BASE_PIOB->PIO_PER = CONFIG_SYS_DATAFLASH_MMC_PIO; /* Set in PIO mode */
 	AT91C_BASE_PIOB->PIO_OER = CONFIG_SYS_DATAFLASH_MMC_PIO; /* Configure in output */
 	/* Set Output */
 	AT91C_BASE_PIOB->PIO_SODR = CONFIG_SYS_DATAFLASH_MMC_PIO;
-#endif
 }
 
 void AT91F_SelectSPI(void) {
-#ifdef	CONFIG_DATAFLASH_MMC_SELECT
 	AT91C_BASE_PIOB->PIO_PER = CONFIG_SYS_DATAFLASH_MMC_PIO; /* Set in PIO mode */
 	AT91C_BASE_PIOB->PIO_OER = CONFIG_SYS_DATAFLASH_MMC_PIO; /* Configure in output */
 	/* Clear Output */
 	AT91C_BASE_PIOB->PIO_CODR = CONFIG_SYS_DATAFLASH_MMC_PIO;
-#endif
 }
-- 
1.6.2.1

^ permalink raw reply related	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 05/13] add dataflash mmc mux missing support
  2009-03-27 22:30     ` [U-Boot] [PATCH 04/13] at91rm9200dk: Move conditional compilation to Makefile Jean-Christophe PLAGNIOL-VILLARD
@ 2009-03-27 22:30       ` Jean-Christophe PLAGNIOL-VILLARD
  2009-03-27 22:30         ` [U-Boot] [PATCH 06/13] Add support for the AT91RM9200EK Board Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 62+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-03-27 22:30 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 common/Makefile                |    1 +
 common/cmd_dataflash_mmc_mux.c |   65 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 66 insertions(+), 0 deletions(-)
 create mode 100644 common/cmd_dataflash_mmc_mux.c

diff --git a/common/Makefile b/common/Makefile
index 23171ca..b6f36c9 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -70,6 +70,7 @@ COBJS-$(CONFIG_CMD_BOOTLDR) += cmd_bootldr.o
 COBJS-$(CONFIG_CMD_CACHE) += cmd_cache.o
 COBJS-$(CONFIG_CMD_CONSOLE) += cmd_console.o
 COBJS-$(CONFIG_CMD_CPLBINFO) += cmd_cplbinfo.o
+COBJS-$(CONFIG_DATAFLASH_MMC_SELECT) += cmd_dataflash_mmc_mux.o
 COBJS-$(CONFIG_CMD_DATE) += cmd_date.o
 ifdef CONFIG_4xx
 COBJS-$(CONFIG_CMD_SETGETDCR) += cmd_dcr.o
diff --git a/common/cmd_dataflash_mmc_mux.c b/common/cmd_dataflash_mmc_mux.c
new file mode 100644
index 0000000..4b2cf1c
--- /dev/null
+++ b/common/cmd_dataflash_mmc_mux.c
@@ -0,0 +1,65 @@
+/*
+ * (C) Copyright 2000
+ * 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 <command.h>
+
+static int mmc_nspi (const char *);
+
+int do_dataflash_mmc_mux (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+	switch (argc) {
+	case 2:			/* on / off	*/
+		switch (mmc_nspi (argv[1])) {
+		case 0:	AT91F_SelectSPI ();
+			break;
+		case 1:	AT91F_SelectMMC ();
+			break;
+		}
+	case 1:			/* get status */
+		printf ("Mux is configured to be %s\n",
+			AT91F_GetMuxStatus () ? "MMC" : "SPI");
+		return 0;
+	default:
+		printf ("Usage:\n%s\n", cmdtp->usage);
+		return 1;
+	}
+	return 0;
+}
+
+static int mmc_nspi (const char *s)
+{
+	if (strcmp (s, "mmc") == 0) {
+		return 1;
+	} else if (strcmp (s, "spi") == 0) {
+		return 0;
+	}
+	return -1;
+}
+
+U_BOOT_CMD(
+	dataflash_mmc_mux, 2, 1, do_dataflash_mmc_mux,
+	"dataflash_mmc_mux\t- enable or disable MMC or SPI\n",
+	"[mmc, spi]\n"
+	"    - enable or disable MMC or SPI\n"
+);
-- 
1.6.2.1

^ permalink raw reply related	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 06/13] Add support for the AT91RM9200EK Board.
  2009-03-27 22:30       ` [U-Boot] [PATCH 05/13] add dataflash mmc mux missing support Jean-Christophe PLAGNIOL-VILLARD
@ 2009-03-27 22:30         ` Jean-Christophe PLAGNIOL-VILLARD
  2009-03-27 22:30           ` [U-Boot] [PATCH 07/13] at91rm9200: move serial driver to drivers/serial Jean-Christophe PLAGNIOL-VILLARD
  2009-05-26 15:47           ` [U-Boot] [PATCH 06/13] Add support for the AT91RM9200EK Board Haavard Skinnemoen
  0 siblings, 2 replies; 62+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-03-27 22:30 UTC (permalink / raw)
  To: u-boot

From: Ulf Samuelsson <ulf@atmel.com>

The AT91RM9200-EK Evaluation Board supports the AT91RM9200
ARM9-based 32-bit RISC microcontroller and enables real-time code development
and evaluation.

Here is the chip page on Atmel website:
http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3507

with
	- NOR (cfi driver)
	- DataFlash
	- USB OHCI
	- Net
	- I2C (hard)

Signed-off-by: Ulf Samuelsson <ulf@atmel.com>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 MAKEALL                                 |    1 +
 Makefile                                |    3 +
 board/atmel/at91rm9200ek/Makefile       |   56 ++++++
 board/atmel/at91rm9200ek/at91rm9200ek.c |   86 ++++++++
 board/atmel/at91rm9200ek/config.mk      |    1 +
 board/atmel/at91rm9200ek/led.c          |   89 +++++++++
 board/atmel/at91rm9200ek/misc.c         |   51 +++++
 board/atmel/at91rm9200ek/mux.c          |   38 ++++
 board/atmel/at91rm9200ek/partition.c    |   38 ++++
 board/atmel/at91rm9200ek/u-boot.lds     |   56 ++++++
 cpu/arm920t/start.S                     |    4 +-
 drivers/mtd/cfi_flash.c                 |    5 +-
 include/configs/at91rm9200ek.h          |  326 +++++++++++++++++++++++++++++++
 13 files changed, 747 insertions(+), 7 deletions(-)
 create mode 100644 board/atmel/at91rm9200ek/Makefile
 create mode 100644 board/atmel/at91rm9200ek/at91rm9200ek.c
 create mode 100644 board/atmel/at91rm9200ek/config.mk
 create mode 100644 board/atmel/at91rm9200ek/led.c
 create mode 100644 board/atmel/at91rm9200ek/misc.c
 create mode 100644 board/atmel/at91rm9200ek/mux.c
 create mode 100644 board/atmel/at91rm9200ek/partition.c
 create mode 100644 board/atmel/at91rm9200ek/u-boot.lds
 create mode 100644 include/configs/at91rm9200ek.h

diff --git a/MAKEALL b/MAKEALL
index aa7095e..89f1c55 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -570,6 +570,7 @@ LIST_at91="		\
 	afeb9260	\
 	at91cap9adk	\
 	at91rm9200dk	\
+	at91rm9200ek	\
 	at91sam9260ek	\
 	at91sam9261ek	\
 	at91sam9263ek	\
diff --git a/Makefile b/Makefile
index d774e2e..a9f25c9 100644
--- a/Makefile
+++ b/Makefile
@@ -2626,6 +2626,9 @@ shannon_config	:	unconfig
 at91rm9200dk_config	:	unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm920t at91rm9200dk atmel at91rm9200
 
+at91rm9200ek_config	:	unconfig
+	@$(MKCONFIG) $(@:_config=) arm arm920t at91rm9200ek atmel at91rm9200
+
 cmc_pu2_config	:	unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm920t cmc_pu2 NULL at91rm9200
 
diff --git a/board/atmel/at91rm9200ek/Makefile b/board/atmel/at91rm9200ek/Makefile
new file mode 100644
index 0000000..500ce72
--- /dev/null
+++ b/board/atmel/at91rm9200ek/Makefile
@@ -0,0 +1,56 @@
+#
+# (C) Copyright 2003-2008
+# 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 $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(BOARD).a
+
+COBJS-y += $(BOARD).o
+COBJS-y += led.o
+COBJS-y += misc.o
+ifdef CONFIG_HAS_DATAFLASH
+COBJS-$(CONFIG_DATAFLASH_MMC_SELECT) += mux.o
+COBJS-y += partition.o
+endif
+
+SRCS	:= $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS-y))
+SOBJS	:= $(addprefix $(obj),$(SOBJS))
+
+$(LIB):	$(obj).depend $(OBJS) $(SOBJS)
+	$(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)
+
+clean:
+	rm -f $(SOBJS) $(OBJS)
+
+distclean:	clean
+	rm -f $(LIB) core *.bak $(obj).depend
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/atmel/at91rm9200ek/at91rm9200ek.c b/board/atmel/at91rm9200ek/at91rm9200ek.c
new file mode 100644
index 0000000..ea684e9
--- /dev/null
+++ b/board/atmel/at91rm9200ek/at91rm9200ek.c
@@ -0,0 +1,86 @@
+/*
+ * (C) Copyright 2002
+ * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
+ * Marius Groeger <mgroeger@sysgo.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 <asm/arch/AT91RM9200.h>
+#include <at91rm9200_net.h>
+#include <dm9161.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/* ------------------------------------------------------------------------- */
+/*
+ * Miscelaneous platform dependent initialisations
+ */
+
+int board_init (void)
+{
+	/* Enable Ctrlc */
+	console_init_f ();
+
+	/*
+	 * Correct IRDA resistor problem
+	 * Set PA23_TXD in Output
+	 */
+	writel(AT91C_PA23_TXD2, ((AT91PS_PIO) AT91C_BASE_PIOA)->PIO_OER);
+
+	/*
+	 * memory and cpu-speed are setup before relocation
+	 * so we do _nothing_ here
+	 */
+
+	/* arch number of AT91RM9200EK-Board */
+	gd->bd->bi_arch_number = MACH_TYPE_AT91RM9200EK;
+	/* adress of boot parameters */
+	gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
+
+	return 0;
+}
+
+int dram_init (void)
+{
+	gd->bd->bi_dram[0].start = PHYS_SDRAM;
+	gd->bd->bi_dram[0].size = PHYS_SDRAM_SIZE;
+	return 0;
+}
+
+#if defined(CONFIG_DRIVER_ETHER) && defined(CONFIG_CMD_NET)
+/*
+ * Name:
+ *	at91rm9200_GetPhyInterface
+ * Description:
+ *	Initialise the interface functions to the PHY
+ * Arguments:
+ *	None
+ * Return value:
+ *	None
+ */
+void at91rm9200_GetPhyInterface(AT91PS_PhyOps p_phyops)
+{
+	p_phyops->Init = dm9161_InitPhy;
+	p_phyops->IsPhyConnected = dm9161_IsPhyConnected;
+	p_phyops->GetLinkSpeed = dm9161_GetLinkSpeed;
+	p_phyops->AutoNegotiate = dm9161_AutoNegotiate;
+}
+#endif
diff --git a/board/atmel/at91rm9200ek/config.mk b/board/atmel/at91rm9200ek/config.mk
new file mode 100644
index 0000000..9ce161e
--- /dev/null
+++ b/board/atmel/at91rm9200ek/config.mk
@@ -0,0 +1 @@
+TEXT_BASE = 0x21f00000
diff --git a/board/atmel/at91rm9200ek/led.c b/board/atmel/at91rm9200ek/led.c
new file mode 100644
index 0000000..9464952
--- /dev/null
+++ b/board/atmel/at91rm9200ek/led.c
@@ -0,0 +1,89 @@
+/*
+ * (C) Copyright 2006
+ * Atmel Nordic AB <www.atmel.com>
+ * Ulf Samuelsson <ulf@atmel.com>
+ *
+ * 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 <asm/arch/AT91RM9200.h>
+#include <asm/io.h>
+
+#define	GREEN_LED	AT91C_PIO_PB0
+#define	YELLOW_LED	AT91C_PIO_PB1
+#define	RED_LED		AT91C_PIO_PB2
+
+void	green_LED_on(void)
+{
+	AT91PS_PIO	PIOB	= AT91C_BASE_PIOB;
+
+	writel(GREEN_LED, PIOB->PIO_CODR);
+}
+
+void	 yellow_LED_on(void)
+{
+	AT91PS_PIO	PIOB	= AT91C_BASE_PIOB;
+
+	writel(YELLOW_LED, PIOB->PIO_CODR);
+}
+
+void	 red_LED_on(void)
+{
+	AT91PS_PIO	PIOB	= AT91C_BASE_PIOB;
+
+	writel(RED_LED, PIOB->PIO_CODR);
+}
+
+void	green_LED_off(void)
+{
+	AT91PS_PIO	PIOB	= AT91C_BASE_PIOB;
+
+	writel(GREEN_LED, PIOB->PIO_SODR);
+}
+
+void	yellow_LED_off(void)
+{
+	AT91PS_PIO	PIOB	= AT91C_BASE_PIOB;
+
+	writel(YELLOW_LED, PIOB->PIO_SODR);
+}
+
+void	red_LED_off(void)
+{
+	AT91PS_PIO	PIOB	= AT91C_BASE_PIOB;
+
+	writel(RED_LED, PIOB->PIO_SODR);
+}
+
+
+void coloured_LED_init (void)
+{
+	AT91PS_PIO	PIOB	= AT91C_BASE_PIOB;
+	AT91PS_PMC	PMC	= AT91C_BASE_PMC;
+
+	/* Enable PIOB clock */
+	writel((1 << AT91C_ID_PIOB), PMC->PMC_PCER);
+	/* Disable peripherals on LEDs */
+	writel(AT91C_PIO_PB2 | AT91C_PIO_PB1 | AT91C_PIO_PB0, PIOB->PIO_PER);
+	/* Enable pins as outputs */
+	writel(AT91C_PIO_PB2 | AT91C_PIO_PB1 | AT91C_PIO_PB0, PIOB->PIO_OER);
+	/* Turn all LEDs OFF */
+	writel(AT91C_PIO_PB2 | AT91C_PIO_PB1 | AT91C_PIO_PB0, PIOB->PIO_SODR);
+}
diff --git a/board/atmel/at91rm9200ek/misc.c b/board/atmel/at91rm9200ek/misc.c
new file mode 100644
index 0000000..d56f33f
--- /dev/null
+++ b/board/atmel/at91rm9200ek/misc.c
@@ -0,0 +1,51 @@
+/*
+ * (C) Copyright 2002
+ * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
+ * Marius Groeger <mgroeger@sysgo.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 <asm/arch/AT91RM9200.h>
+#include <at91rm9200_net.h>
+#include <dm9161.h>
+#include <net.h>
+
+int board_late_init(void)
+{
+	DECLARE_GLOBAL_DATA_PTR;
+
+	/* Fix Ethernet Initialization Bug when starting Linux from U-Boot */
+	eth_init(gd->bd);
+	return 0;
+}
+
+
+/* checks if addr is in RAM */
+int addr2ram(ulong addr)
+{
+	int result = 0;
+
+	if((addr >= PHYS_SDRAM) && (addr < (PHYS_SDRAM + PHYS_SDRAM_SIZE)))
+		result = 1;
+
+	return result;
+}
+
diff --git a/board/atmel/at91rm9200ek/mux.c b/board/atmel/at91rm9200ek/mux.c
new file mode 100644
index 0000000..bdd44e8
--- /dev/null
+++ b/board/atmel/at91rm9200ek/mux.c
@@ -0,0 +1,38 @@
+#include <config.h>
+#include <common.h>
+#include <asm/hardware.h>
+#include <asm/io.h>
+#include <dataflash.h>
+
+int AT91F_GetMuxStatus(void)
+{
+	/* Set in PIO mode */
+	writel(CONFIG_SYS_DATAFLASH_MMC_PIO, AT91C_BASE_PIOB->PIO_PER);
+	/* Configure in output */
+	writel(CONFIG_SYS_DATAFLASH_MMC_PIO, AT91C_BASE_PIOB->PIO_OER);
+
+	if(readl(AT91C_BASE_PIOB->PIO_ODSR) & CONFIG_SYS_DATAFLASH_MMC_PIO)
+		return 1;
+
+	return 0;
+}
+
+void AT91F_SelectMMC(void)
+{
+	/* Set in PIO mode */
+	writel(CONFIG_SYS_DATAFLASH_MMC_PIO, AT91C_BASE_PIOB->PIO_PER);
+	/* Configure in output */
+	writel(CONFIG_SYS_DATAFLASH_MMC_PIO, AT91C_BASE_PIOB->PIO_OER);
+	/* Set Output */
+	writel(CONFIG_SYS_DATAFLASH_MMC_PIO, AT91C_BASE_PIOB->PIO_SODR);
+}
+
+void AT91F_SelectSPI(void)
+{
+	/* Set in PIO mode */
+	writel(CONFIG_SYS_DATAFLASH_MMC_PIO, AT91C_BASE_PIOB->PIO_PER);
+	/* Configure in output */
+	writel(CONFIG_SYS_DATAFLASH_MMC_PIO, AT91C_BASE_PIOB->PIO_OER);
+	/* Clear Output */
+	writel(CONFIG_SYS_DATAFLASH_MMC_PIO, AT91C_BASE_PIOB->PIO_CODR);
+}
diff --git a/board/atmel/at91rm9200ek/partition.c b/board/atmel/at91rm9200ek/partition.c
new file mode 100644
index 0000000..990cbcf
--- /dev/null
+++ b/board/atmel/at91rm9200ek/partition.c
@@ -0,0 +1,38 @@
+/*
+ *
+ * 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 <config.h>
+#include <asm/hardware.h>
+#include <dataflash.h>
+
+AT91S_DATAFLASH_INFO dataflash_info[CONFIG_SYS_MAX_DATAFLASH_BANKS];
+
+struct dataflash_addr cs[CONFIG_SYS_MAX_DATAFLASH_BANKS] = {
+	{CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0, 0},	/* Logical adress, CS */
+	{CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS3, 3}
+};
+
+/*define the area offsets*/
+dataflash_protect_t area_list[NB_DATAFLASH_AREA] = {
+	{0x00000000, 0x000041FF, FLAG_PROTECT_SET,	0, "Bootstrap"},
+	{0x00004200, 0x000083FF, FLAG_PROTECT_CLEAR,	0, "Environment"},
+	{0x00008400, 0x00041FFF, FLAG_PROTECT_SET,	0, "U-Boot"},
+	{0x00042000, 0x00251FFF, FLAG_PROTECT_CLEAR,	0, "Kernel"},
+	{0x00252000, 0xFFFFFFFF, FLAG_PROTECT_CLEAR,	0, "FS"},
+};
diff --git a/board/atmel/at91rm9200ek/u-boot.lds b/board/atmel/at91rm9200ek/u-boot.lds
new file mode 100644
index 0000000..045e849
--- /dev/null
+++ b/board/atmel/at91rm9200ek/u-boot.lds
@@ -0,0 +1,56 @@
+/*
+ * (C) Copyright 2002
+ * Gary Jennejohn, DENX Software Engineering, <gj@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
+ */
+
+OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
+OUTPUT_ARCH(arm)
+ENTRY(_start)
+SECTIONS
+{
+	. = 0x00000000;
+
+	. = ALIGN(4);
+	.text :
+	{
+		cpu/arm920t/start.o	(.text)
+		*(.text)
+	}
+
+	. = ALIGN(4);
+	.rodata : { *(.rodata) }
+
+	. = ALIGN(4);
+	.data : { *(.data) }
+
+	. = ALIGN(4);
+	.got : { *(.got) }
+
+	. = .;
+	__u_boot_cmd_start = .;
+	.u_boot_cmd : { *(.u_boot_cmd) }
+	__u_boot_cmd_end = .;
+
+	. = ALIGN(4);
+	__bss_start = .;
+	.bss : { *(.bss) }
+	_end = .;
+}
diff --git a/cpu/arm920t/start.S b/cpu/arm920t/start.S
index fbcfe6d..f610e9f 100644
--- a/cpu/arm920t/start.S
+++ b/cpu/arm920t/start.S
@@ -258,11 +258,9 @@ cpu_init_crit:
 	 * find a lowlevel_init.S in your board directory.
 	 */
 	mov	ip, lr
-#if	defined(CONFIG_AT91RM9200EK)
 
-#else
 	bl	lowlevel_init
-#endif
+
 	mov	lr, ip
 	mov	pc, lr
 #endif /* CONFIG_SKIP_LOWLEVEL_INIT */
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 631b969..175d82a 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -1788,13 +1788,10 @@ static void flash_fixup_atmel(flash_info_t *info, struct cfi_qry *qry)
 
 	/* AT49BV6416(T) list the erase regions in the wrong order.
 	 * However, the device ID is identical with the non-broken
-	 * AT49BV642D since u-boot only reads the low byte (they
-	 * differ in the high byte.) So leave out this fixup for now.
+	 * AT49BV642D they differ in the high byte.
 	 */
-#if 0
 	if (info->device_id == 0xd6 || info->device_id == 0xd2)
 		reverse_geometry = !reverse_geometry;
-#endif
 
 	if (reverse_geometry)
 		cfi_reverse_geometry(qry);
diff --git a/include/configs/at91rm9200ek.h b/include/configs/at91rm9200ek.h
new file mode 100644
index 0000000..692ccdb
--- /dev/null
+++ b/include/configs/at91rm9200ek.h
@@ -0,0 +1,326 @@
+/*
+ * Ulf Samuelsson <ulf@atmel.com>
+ * Rick Bronson <rick@efn.org>
+ *
+ * Configuration settings for the AT91RM9200EK board.
+ *
+ * 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 __CONFIG_H
+#define __CONFIG_H
+
+/* ARM asynchronous clock */
+/*
+ * from 18.432 MHz crystal
+ * (18432000 / 4 * 39)
+ */
+#define AT91C_MAIN_CLOCK	179712000
+/*
+ * peripheral clock
+ * (AT91C_MASTER_CLOCK / 3)
+ */
+#define AT91C_MASTER_CLOCK	59904000
+
+#define AT91_SLOW_CLOCK		32768	/* slow clock */
+
+#define CONFIG_ARM920T		1	/* This is an ARM920T Core	*/
+#define CONFIG_AT91RM9200	1	/* It's an Atmel AT91RM9200 SoC	*/
+#define CONFIG_AT91RM9200EK	1	/* on an AT91RM9200EK Board	*/
+#undef  CONFIG_USE_IRQ			/* we don't need IRQ/FIQ stuff	*/
+#define USE_920T_MMU		1
+
+#define CONFIG_CMDLINE_TAG	1	/* enable passing of ATAGs	*/
+#define CONFIG_SETUP_MEMORY_TAGS 1
+#define CONFIG_INITRD_TAG	1
+
+/*
+ * LowLevel Init
+ */
+#ifndef CONFIG_SKIP_LOWLEVEL_INIT
+#define CONFIG_SYS_USE_MAIN_OSCILLATOR		1
+/* flash */
+#define CONFIG_SYS_MC_PUIA_VAL	0x00000000
+#define CONFIG_SYS_MC_PUP_VAL	0x00000000
+#define CONFIG_SYS_MC_PUER_VAL	0x00000000
+#define CONFIG_SYS_MC_ASR_VAL	0x00000000
+#define CONFIG_SYS_MC_AASR_VAL	0x00000000
+#define CONFIG_SYS_EBI_CFGR_VAL	0x00000000
+#define CONFIG_SYS_SMC_CSR0_VAL	0x00003284 /* 16bit, 2 TDF, 4 WS */
+
+/* clocks */
+#define CONFIG_SYS_PLLAR_VAL	0x20263E04 /* 179.712000 MHz for PCK */
+#define CONFIG_SYS_PLLBR_VAL	0x10483E0E /* 48.054857 MHz (divider by 2 for USB) */
+/* PCK/3 = MCK Master Clock = 59.904000MHz from PLLA */
+#define CONFIG_SYS_MCKR_VAL	0x00000202
+
+/* sdram */
+#define CONFIG_SYS_PIOC_ASR_VAL	0xFFFF0000 /* Configure PIOC as peripheral (D16/D31) */
+#define CONFIG_SYS_PIOC_BSR_VAL	0x00000000
+#define CONFIG_SYS_PIOC_PDR_VAL	0xFFFF0000
+#define CONFIG_SYS_EBI_CSA_VAL	0x00000002 /* CS1=CONFIG_SYS_SDRAM */
+#define CONFIG_SYS_SDRC_CR_VAL	0x2188c155 /* set up the CONFIG_SYS_SDRAM */
+#define CONFIG_SYS_SDRAM	0x20000000 /* address of the CONFIG_SYS_SDRAM */
+#define CONFIG_SYS_SDRAM1	0x20000080 /* address of the CONFIG_SYS_SDRAM */
+#define CONFIG_SYS_SDRAM_VAL	0x00000000 /* value written to CONFIG_SYS_SDRAM */
+#define CONFIG_SYS_SDRC_MR_VAL	0x00000002 /* Precharge All */
+#define CONFIG_SYS_SDRC_MR_VAL1	0x00000004 /* refresh */
+#define CONFIG_SYS_SDRC_MR_VAL2	0x00000003 /* Load Mode Register */
+#define CONFIG_SYS_SDRC_MR_VAL3	0x00000000 /* Normal Mode */
+#define CONFIG_SYS_SDRC_TR_VAL	0x000002E0 /* Write refresh rate */
+#else
+#define CONFIG_SKIP_RELOCATE_UBOOT
+#endif	/* CONFIG_SKIP_LOWLEVEL_INIT */
+
+/* hardcode so no __divsi3 : AT91C_MASTER_CLOCK / baudrate / 16 */
+#define CONFIG_SYS_AT91C_BRGR_DIVISOR	33
+
+/*
+ * Memory Configuration
+ */
+#define CONFIG_NR_DRAM_BANKS		1
+#define PHYS_SDRAM			0x20000000
+#define PHYS_SDRAM_SIZE			0x02000000	/* 32 megs */
+
+#define CONFIG_SYS_MEMTEST_START	PHYS_SDRAM
+#define CONFIG_SYS_MEMTEST_END		\
+		(CONFIG_SYS_MEMTEST_START + PHYS_SDRAM_SIZE - 262144)
+
+/*
+ * Hardware drivers
+ */
+
+/*
+ * UART Configuration
+ *
+ * define one of these to choose the DBGU,
+ * USART0 or USART1 as console
+ */
+#define CONFIG_DBGU
+#undef CONFIG_USART0
+#undef CONFIG_USART1
+/* don't include RTS/CTS flow control support	*/
+#undef	CONFIG_HWFLOW
+/* disable modem initialization stuff */
+#undef	CONFIG_MODEM_SUPPORT
+
+#define CONFIG_SYS_BAUDRATE_TABLE	{115200 , 19200, 38400, 57600, 9600 }
+#define CONFIG_BAUDRATE			115200
+
+/*
+ * Command line configuration.
+ */
+#include <config_cmd_default.h>
+
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_FAT
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_PING
+
+#undef CONFIG_CMD_BDI
+#undef CONFIG_CMD_IMI
+#undef CONFIG_CMD_FPGA
+#undef CONFIG_CMD_MISC
+#undef CONFIG_CMD_LOADS
+
+#include <asm/arch/AT91RM9200.h>	/* needed for port definitions */
+/* Options for MMC/SD Card */
+#define CONFIG_DOS_PARTITION	1
+#undef CONFIG_MMC
+#define CONFIG_SYS_MMC_BASE		0xFFFB4000
+#define CONFIG_SYS_MMC_BLOCKSIZE	512
+
+/*
+ * Network Driver Setting
+ */
+#define CONFIG_DRIVER_ETHER
+#define CONFIG_NET_RETRY_COUNT		20
+#define CONFIG_AT91C_USE_RMII
+
+/*
+ * AC Characteristics
+ * DLYBS = tCSS = 250ns min and DLYBCT = tCSH = 250ns
+ */
+#define DATAFLASH_TCSS	(0xC << 16)
+#define DATAFLASH_TCHS	(0x1 << 24)
+
+#if defined(CONFIG_HAS_DATAFLASH)
+#define CONFIG_SYS_SPI_WRITE_TOUT		(5 * CONFIG_SYS_HZ)
+#define CONFIG_SYS_MAX_DATAFLASH_BANKS		2
+#define CONFIG_SYS_MAX_DATAFLASH_PAGES		16384
+/* Logical adress for CS0 */
+#define CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0	0xC0000000
+/* Logical adress for CS3 */
+#define CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS3	0xD0000000
+#define	CONFIG_SYS_SUPPORT_BLOCK_ERASE		1
+#define	CONFIG_SYS_DATAFLASH_MMC_PIO		AT91C_PIO_PB22
+#endif
+
+/*
+ * NOR Flash
+ */
+#define CONFIG_SYS_FLASH_BASE			0x10000000
+#define PHYS_FLASH_SIZE				0x800000	/* 8MB */
+#define CONFIG_SYS_FLASH_CFI			1
+#define CONFIG_FLASH_CFI_DRIVER			1
+#define CONFIG_SYS_MAX_FLASH_BANKS		1
+#define CONFIG_SYS_MAX_FLASH_SECT		256
+#define CONFIG_SYS_FLASH_PROTECTION
+
+/*
+ * Environment Settings
+ */
+#ifdef CONFIG_ENV_IS_IN_DATAFLASH
+/*
+ * Datasflash Environment Settings
+ */
+#define CONFIG_ENV_OFFSET			0x4200
+#define CONFIG_ENV_ADDR			\
+		(CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 + CONFIG_ENV_OFFSET)
+/* 8 * 1056 really , but start.s is not OK with this*/
+#define CONFIG_ENV_SIZE			0x2000
+
+#else
+/*
+ * NOR Flash Environment Settings
+ */
+#define CONFIG_ENV_IS_IN_FLASH		1
+
+#ifdef CONFIG_SKIP_LOWLEVEL_INIT
+/*
+ * between boot.bin and u-boot.bin.gz
+ */
+#define CONFIG_ENV_ADDR			(CONFIG_SYS_FLASH_BASE + 0xe000)
+#define CONFIG_ENV_SIZE			0x10000 /* sectors are 64K here */
+#else
+/*
+ * after u-boot.bin
+ */
+#define CONFIG_ENV_ADDR			\
+		(CONFIG_SYS_FLASH_BASE + CONFIG_SYS_MONITOR_LEN)
+#define CONFIG_ENV_SIZE			0x10000 /* sectors are 64K here */
+/* The following #defines are needed to get flash environment right */
+#define CONFIG_SYS_MONITOR_BASE		CONFIG_SYS_FLASH_BASE
+#define CONFIG_SYS_MONITOR_LEN		\
+		(CONFIG_SYS_BOOT_SIZE + CONFIG_SYS_U_BOOT_SIZE)
+#endif	/* CONFIG_SKIP_LOWLEVEL_INIT */
+
+#endif	/* CONFIG_ENV_IS_IN_DATAFLASH */
+
+/*
+ * Boot option
+ */
+#define CONFIG_BOOTDELAY		3
+
+#ifdef CONFIG_SKIP_LOWLEVEL_INIT
+/* boot.bin, env, u-boot.bin.gz */
+#define CONFIG_SYS_BOOT_SIZE		0x6000 /* 24 KBytes */
+#define CONFIG_SYS_U_BOOT_BASE		(CONFIG_SYS_FLASH_BASE + 0x10000)
+#define CONFIG_SYS_U_BOOT_SIZE		0x10000 /* 64 KBytes */
+#else
+/* u-boot.bin */
+#define CONFIG_SYS_BOOT_SIZE		0x0 /* 0 KBytes */
+#define CONFIG_SYS_U_BOOT_BASE		CONFIG_SYS_FLASH_BASE
+#define CONFIG_SYS_U_BOOT_SIZE		0x40000 /* 128 KBytes */
+#endif /* CONFIG_SKIP_LOWLEVEL_INIT */
+
+#define CONFIG_SYS_LOAD_ADDR		0x21000000 /* default load address */
+#define CONFIG_ENV_OVERWRITE	1
+
+/*
+ * USB Config
+ */
+#define CONFIG_CMD_USB
+#define CONFIG_USB_OHCI_NEW	1
+#define CONFIG_USB_KEYBOARD	1
+#define CONFIG_USB_STORAGE	1
+#define CONFIG_DOS_PARTITION	1
+
+#undef CONFIG_SYS_USB_OHCI_BOARD_INIT
+#define CONFIG_SYS_USB_OHCI_CPU_INIT		1
+#define CONFIG_SYS_USB_OHCI_REGS_BASE		AT91_USB_HOST_BASE
+#define CONFIG_SYS_USB_OHCI_SLOT_NAME		"at91rm9200"
+#define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS	15
+
+/*
+ * I2C
+ */
+#define CONFIG_HARD_I2C
+
+#ifdef CONFIG_HARD_I2C
+#define CONFIG_CMD_I2C
+#define CONFIG_I2C_CMD_TREE
+#define CONFIG_SYS_I2C_SPEED		0	/* not used */
+#define CONFIG_SYS_I2C_SLAVE		0	/* not used */
+#endif
+
+/*
+ * Shell Settings
+ */
+#define CONFIG_CMDLINE_EDITING		1
+#define CONFIG_SYS_LONGHELP		1
+#define CONFIG_AUTO_COMPLETE		1
+#define CONFIG_SYS_HUSH_PARSER		1
+#define CONFIG_SYS_PROMPT		"U-Boot> "
+#define CONFIG_SYS_PROMPT_HUSH_PS2	"> "
+#define CONFIG_SYS_CBSIZE		256	/* Console I/O Buffer Size */
+#define CONFIG_SYS_MAXARGS		16	/* max number of command args */
+/* Print Buffer Size */
+#define CONFIG_SYS_PBSIZE		\
+		(CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
+
+#ifndef __ASSEMBLY__
+/*-----------------------------------------------------------------------
+ * Board specific extension for bd_info
+ *
+ * This structure is embedded in the global bd_info (bd_t) structure
+ * and can be used by the board specific code (eg board/...)
+ */
+
+struct bd_info_ext {
+	/* helper variable for board environment handling
+	 *
+	 * env_crc_valid == 0	=>	uninitialised
+	 * env_crc_valid > 0	=>	environment crc in flash is valid
+	 * env_crc_valid < 0	=>	environment crc in flash is invalid
+	 */
+	int env_crc_valid;
+};
+#endif
+
+#define CONFIG_SYS_HZ 1000
+/*
+ * AT91C_TC0_CMR is implicitly set to
+ * AT91C_TC_TIMER_DIV1_CLOCK
+ */
+#define CONFIG_SYS_HZ_CLOCK (AT91C_MASTER_CLOCK / 2)
+
+#define ROUND(A, B)		(((A) + (B)) & ~((B) - 1))
+/*
+ * Size of malloc() pool
+ */
+#define CONFIG_SYS_MALLOC_LEN		ROUND(3 * CONFIG_ENV_SIZE + 128 * 1024 \
+					     , 0x1000)
+/* size in bytes reserved for initial data */
+#define CONFIG_SYS_GBL_DATA_SIZE	128
+
+#define CONFIG_STACKSIZE		(32 * 1024)	/* regular stack */
+#define CONFIG_STACKSIZE_IRQ		(4 * 1024) /* Unsure if to big or to small*/
+#define CONFIG_STACKSIZE_FIQ		(4 * 1024) /* Unsure if to big or to small*/
+#endif
-- 
1.6.2.1

^ permalink raw reply related	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 07/13] at91rm9200: move serial driver to drivers/serial
  2009-03-27 22:30         ` [U-Boot] [PATCH 06/13] Add support for the AT91RM9200EK Board Jean-Christophe PLAGNIOL-VILLARD
@ 2009-03-27 22:30           ` Jean-Christophe PLAGNIOL-VILLARD
  2009-03-27 22:30             ` [U-Boot] [PATCH 08/13] at91rm9200: move serial shutdown code to serial drivers Jean-Christophe PLAGNIOL-VILLARD
  2009-04-01 22:14             ` [U-Boot] [PATCH 07/13] at91rm9200: move serial driver to drivers/serial Wolfgang Denk
  2009-05-26 15:47           ` [U-Boot] [PATCH 06/13] Add support for the AT91RM9200EK Board Haavard Skinnemoen
  1 sibling, 2 replies; 62+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-03-27 22:30 UTC (permalink / raw)
  To: u-boot

add CONFIG_AT91RM9200_USART to activate the driver

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 cpu/arm920t/at91rm9200/Makefile                    |    2 +-
 drivers/serial/Makefile                            |    1 +
 .../serial.c => drivers/serial/at91rm9200_usart.c  |    0
 include/configs/at91rm9200dk.h                     |    1 +
 include/configs/at91rm9200ek.h                     |    1 +
 include/configs/cmc_pu2.h                          |    1 +
 include/configs/csb637.h                           |    1 +
 include/configs/kb9202.h                           |    1 +
 include/configs/m501sk.h                           |    1 +
 include/configs/mp2usb.h                           |    1 +
 10 files changed, 9 insertions(+), 1 deletions(-)
 rename cpu/arm920t/at91rm9200/serial.c => drivers/serial/at91rm9200_usart.c (100%)

diff --git a/cpu/arm920t/at91rm9200/Makefile b/cpu/arm920t/at91rm9200/Makefile
index ab4c52c..67f17fa 100644
--- a/cpu/arm920t/at91rm9200/Makefile
+++ b/cpu/arm920t/at91rm9200/Makefile
@@ -26,7 +26,7 @@ include $(TOPDIR)/config.mk
 LIB	= $(obj)lib$(SOC).a
 
 COBJS	= bcm5221.o dm9161.o ether.o i2c.o interrupts.o \
-	  lxt972.o serial.o usb.o spi.o
+	  lxt972.o usb.o spi.o
 SOBJS	= lowlevel_init.o
 
 SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile
index d0efd73..465b29f 100644
--- a/drivers/serial/Makefile
+++ b/drivers/serial/Makefile
@@ -26,6 +26,7 @@ include $(TOPDIR)/config.mk
 LIB	:= $(obj)libserial.a
 
 COBJS-$(CONFIG_ARM_DCC) += arm_dcc.o
+COBJS-$(CONFIG_AT91RM9200_USART) += at91rm9200_usart.o
 COBJS-$(CONFIG_ATMEL_USART) += atmel_usart.o
 COBJS-$(CONFIG_MCFUART) += mcfuart.o
 COBJS-$(CONFIG_NS9750_UART) += ns9750_serial.o
diff --git a/cpu/arm920t/at91rm9200/serial.c b/drivers/serial/at91rm9200_usart.c
similarity index 100%
rename from cpu/arm920t/at91rm9200/serial.c
rename to drivers/serial/at91rm9200_usart.c
diff --git a/include/configs/at91rm9200dk.h b/include/configs/at91rm9200dk.h
index 5a980d3..56128c1 100644
--- a/include/configs/at91rm9200dk.h
+++ b/include/configs/at91rm9200dk.h
@@ -88,6 +88,7 @@
  */
 
 /* define one of these to choose the DBGU, USART0  or USART1 as console */
+#define CONFIG_AT91RM9200_USART
 #define CONFIG_DBGU
 #undef CONFIG_USART0
 #undef CONFIG_USART1
diff --git a/include/configs/at91rm9200ek.h b/include/configs/at91rm9200ek.h
index 692ccdb..a018873 100644
--- a/include/configs/at91rm9200ek.h
+++ b/include/configs/at91rm9200ek.h
@@ -112,6 +112,7 @@
  * define one of these to choose the DBGU,
  * USART0 or USART1 as console
  */
+#define CONFIG_AT91RM9200_USART
 #define CONFIG_DBGU
 #undef CONFIG_USART0
 #undef CONFIG_USART1
diff --git a/include/configs/cmc_pu2.h b/include/configs/cmc_pu2.h
index e5c74e1..80559bf 100644
--- a/include/configs/cmc_pu2.h
+++ b/include/configs/cmc_pu2.h
@@ -88,6 +88,7 @@
  */
 
 /* define one of these to choose the DBGU, USART0  or USART1 as console */
+#define CONFIG_AT91RM9200_USART
 #undef CONFIG_DBGU
 #define CONFIG_USART0
 #undef CONFIG_USART1
diff --git a/include/configs/csb637.h b/include/configs/csb637.h
index 761c0dc..e1cdc7f 100644
--- a/include/configs/csb637.h
+++ b/include/configs/csb637.h
@@ -90,6 +90,7 @@
  */
 
 /* define one of these to choose the DBGU, USART0  or USART1 as console */
+#define CONFIG_AT91RM9200_USART
 #define CONFIG_DBGU
 #undef CONFIG_USART0
 #undef CONFIG_USART1
diff --git a/include/configs/kb9202.h b/include/configs/kb9202.h
index 1ce8c69..7dd81e6 100644
--- a/include/configs/kb9202.h
+++ b/include/configs/kb9202.h
@@ -72,6 +72,7 @@
  */
 
 /* define one of these to choose the DBGU, USART0  or USART1 as console */
+#define CONFIG_AT91RM9200_USART
 #define CONFIG_DBGU
 #undef CONFIG_USART0
 #undef CONFIG_USART1
diff --git a/include/configs/m501sk.h b/include/configs/m501sk.h
index a432850..1e7d90e 100644
--- a/include/configs/m501sk.h
+++ b/include/configs/m501sk.h
@@ -110,6 +110,7 @@
 #define CONFIG_CMC_PU2
 
 /* define one of these to choose the DBGU, USART0  or USART1 as console */
+#define CONFIG_AT91RM9200_USART
 #define CONFIG_DBGU
 #undef CONFIG_USART0
 #undef CONFIG_USART1
diff --git a/include/configs/mp2usb.h b/include/configs/mp2usb.h
index 9ac7e9a..b78fc76 100644
--- a/include/configs/mp2usb.h
+++ b/include/configs/mp2usb.h
@@ -95,6 +95,7 @@
  */
 
 /* define one of these to choose the DBGU, USART0  or USART1 as console */
+#define CONFIG_AT91RM9200_USART
 #define CONFIG_DBGU
 #undef CONFIG_USART0
 #undef CONFIG_USART1
-- 
1.6.2.1

^ permalink raw reply related	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 08/13] at91rm9200: move serial shutdown code to serial drivers
  2009-03-27 22:30           ` [U-Boot] [PATCH 07/13] at91rm9200: move serial driver to drivers/serial Jean-Christophe PLAGNIOL-VILLARD
@ 2009-03-27 22:30             ` Jean-Christophe PLAGNIOL-VILLARD
  2009-03-27 22:30               ` [U-Boot] [PATCH 09/13] at91rm9200: Reset update Jean-Christophe PLAGNIOL-VILLARD
  2009-04-01 22:15               ` [U-Boot] [PATCH 08/13] at91rm9200: move serial shutdown code to serial drivers Wolfgang Denk
  2009-04-01 22:14             ` [U-Boot] [PATCH 07/13] at91rm9200: move serial driver to drivers/serial Wolfgang Denk
  1 sibling, 2 replies; 62+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-03-27 22:30 UTC (permalink / raw)
  To: u-boot

introduce serial_exit for this purpose. Use it only when the rm9200
serial driver is active

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 cpu/arm920t/at91rm9200/interrupts.c |   13 +++----------
 drivers/serial/at91rm9200_usart.c   |    5 +++++
 include/common.h                    |    1 +
 3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/cpu/arm920t/at91rm9200/interrupts.c b/cpu/arm920t/at91rm9200/interrupts.c
index 5f0703c..15e22bf 100644
--- a/cpu/arm920t/at91rm9200/interrupts.c
+++ b/cpu/arm920t/at91rm9200/interrupts.c
@@ -166,21 +166,14 @@ ulong get_tbclk (void)
 void reset_cpu (ulong ignored)
 {
 
-#ifdef CONFIG_DBGU
-	AT91PS_USART us = (AT91PS_USART) AT91C_BASE_DBGU;
-#endif
-#ifdef CONFIG_USART0
-	AT91PS_USART us = AT91C_BASE_US0;
-#endif
-#ifdef CONFIG_USART1
-	AT91PS_USART us = AT91C_BASE_US1;
-#endif
 #ifdef CONFIG_AT91RM9200DK
 	AT91PS_PIO pio = AT91C_BASE_PIOA;
 #endif
 
+#if defined(CONFIG_AT91RM9200_USART)
 	/*shutdown the console to avoid strange chars during reset */
-	us->US_CR = (AT91C_US_RSTRX | AT91C_US_RSTTX);
+	serial_exit();
+#endif
 
 #ifdef CONFIG_AT91RM9200DK
 	/* Clear PA19 to trigger the hard reset */
diff --git a/drivers/serial/at91rm9200_usart.c b/drivers/serial/at91rm9200_usart.c
index d563445..858bde9 100644
--- a/drivers/serial/at91rm9200_usart.c
+++ b/drivers/serial/at91rm9200_usart.c
@@ -86,6 +86,11 @@ int serial_init (void)
 	return (0);
 }
 
+void serial_exit (void)
+{
+	us->US_CR = (AT91C_US_RSTRX | AT91C_US_RSTTX);
+}
+
 void serial_putc (const char c)
 {
 	if (c == '\n')
diff --git a/include/common.h b/include/common.h
index 952ddff..43068e6 100644
--- a/include/common.h
+++ b/include/common.h
@@ -453,6 +453,7 @@ void ft_pci_setup(void *blob, bd_t *bd);
 
 /* $(CPU)/serial.c */
 int	serial_init   (void);
+void	serial_exit   (void);
 void	serial_addr   (unsigned int);
 void	serial_setbrg (void);
 void	serial_putc   (const char);
-- 
1.6.2.1

^ permalink raw reply related	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 09/13] at91rm9200: Reset update
  2009-03-27 22:30             ` [U-Boot] [PATCH 08/13] at91rm9200: move serial shutdown code to serial drivers Jean-Christophe PLAGNIOL-VILLARD
@ 2009-03-27 22:30               ` Jean-Christophe PLAGNIOL-VILLARD
  2009-03-27 22:30                 ` [U-Boot] [PATCH 10/13] at91: move usb driver to drivers/usb Jean-Christophe PLAGNIOL-VILLARD
  2009-04-01 22:15               ` [U-Boot] [PATCH 08/13] at91rm9200: move serial shutdown code to serial drivers Wolfgang Denk
  1 sibling, 1 reply; 62+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-03-27 22:30 UTC (permalink / raw)
  To: u-boot

Update the rm9200 reset sequence to try executing a board-specific reset
function and move specific board reset to board.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 board/atmel/at91rm9200dk/at91rm9200dk.c |   10 ++++++++++
 cpu/arm920t/at91rm9200/interrupts.c     |   14 ++++----------
 2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/board/atmel/at91rm9200dk/at91rm9200dk.c b/board/atmel/at91rm9200dk/at91rm9200dk.c
index b89a3fd..c761dd7 100644
--- a/board/atmel/at91rm9200dk/at91rm9200dk.c
+++ b/board/atmel/at91rm9200dk/at91rm9200dk.c
@@ -54,6 +54,16 @@ int board_init (void)
 	return 0;
 }
 
+void board_reset (void)
+{
+	AT91PS_PIO pio = AT91C_BASE_PIOA;
+
+	/* Clear PA19 to trigger the hard reset */
+	writel(0x00080000, pio->PIO_CODR);
+	writel(0x00080000, pio->PIO_OER);
+	writel(0x00080000, pio->PIO_PER);
+}
+
 int dram_init (void)
 {
 	gd->bd->bi_dram[0].start = PHYS_SDRAM;
diff --git a/cpu/arm920t/at91rm9200/interrupts.c b/cpu/arm920t/at91rm9200/interrupts.c
index 15e22bf..cff4916 100644
--- a/cpu/arm920t/at91rm9200/interrupts.c
+++ b/cpu/arm920t/at91rm9200/interrupts.c
@@ -45,6 +45,8 @@ AT91PS_TC tmr;
 static ulong timestamp;
 static ulong lastinc;
 
+void board_reset(void) __attribute__((__weak__));
+
 int interrupt_init (void)
 {
 	tmr = AT91C_BASE_TC0;
@@ -166,21 +168,13 @@ ulong get_tbclk (void)
 void reset_cpu (ulong ignored)
 {
 
-#ifdef CONFIG_AT91RM9200DK
-	AT91PS_PIO pio = AT91C_BASE_PIOA;
-#endif
-
 #if defined(CONFIG_AT91RM9200_USART)
 	/*shutdown the console to avoid strange chars during reset */
 	serial_exit();
 #endif
 
-#ifdef CONFIG_AT91RM9200DK
-	/* Clear PA19 to trigger the hard reset */
-	pio->PIO_CODR = 0x00080000;
-	pio->PIO_OER  = 0x00080000;
-	pio->PIO_PER  = 0x00080000;
-#endif
+	if (board_reset)
+		board_reset();
 
 	/* this is the way Linux does it */
 
-- 
1.6.2.1

^ permalink raw reply related	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 10/13] at91: move usb driver to drivers/usb
  2009-03-27 22:30               ` [U-Boot] [PATCH 09/13] at91rm9200: Reset update Jean-Christophe PLAGNIOL-VILLARD
@ 2009-03-27 22:30                 ` Jean-Christophe PLAGNIOL-VILLARD
  2009-03-27 22:30                   ` [U-Boot] [PATCH 11/13] at91: move dataflash spi driver to drivers/spi Jean-Christophe PLAGNIOL-VILLARD
  2009-03-31 18:28                   ` [U-Boot] [PATCH 10/13] at91: move usb driver to drivers/usb Remy Bohmer
  0 siblings, 2 replies; 62+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-03-27 22:30 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 cpu/arm926ejs/at91/Makefile                        |    1 -
 drivers/usb/Makefile                               |    1 +
 .../at91/usb.c => drivers/usb/atmel_usb.c          |    0
 include/configs/afeb9260.h                         |    1 +
 include/configs/at91cap9adk.h                      |    1 +
 include/configs/at91sam9260ek.h                    |    1 +
 include/configs/at91sam9261ek.h                    |    1 +
 include/configs/at91sam9263ek.h                    |    1 +
 8 files changed, 6 insertions(+), 1 deletions(-)
 rename cpu/arm926ejs/at91/usb.c => drivers/usb/atmel_usb.c (100%)

diff --git a/cpu/arm926ejs/at91/Makefile b/cpu/arm926ejs/at91/Makefile
index f9e739c..d0d47e6 100644
--- a/cpu/arm926ejs/at91/Makefile
+++ b/cpu/arm926ejs/at91/Makefile
@@ -57,7 +57,6 @@ endif
 COBJS-$(CONFIG_AT91_LED)	+= led.o
 COBJS-$(CONFIG_HAS_DATAFLASH)	+= spi.o
 COBJS-y	+= timer.o
-COBJS-y	+= usb.o
 SOBJS	= lowlevel_init.o
 
 SRCS    := $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile
index b306a65..de46b7b 100644
--- a/drivers/usb/Makefile
+++ b/drivers/usb/Makefile
@@ -31,6 +31,7 @@ COBJS-$(CONFIG_USB_OHCI_NEW) += usb_ohci.o
 COBJS-$(CONFIG_USB_EHCI) += usb_ehci_core.o
 
 # host
+COBJS-$(CONFIG_USB_ATMEL) += atmel_usb.o
 COBJS-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o
 COBJS-$(CONFIG_USB_R8A66597_HCD) += r8a66597-hcd.o
 COBJS-$(CONFIG_USB_SL811HS) += sl811_usb.o
diff --git a/cpu/arm926ejs/at91/usb.c b/drivers/usb/atmel_usb.c
similarity index 100%
rename from cpu/arm926ejs/at91/usb.c
rename to drivers/usb/atmel_usb.c
diff --git a/include/configs/afeb9260.h b/include/configs/afeb9260.h
index 33a67ca..3a51e60 100644
--- a/include/configs/afeb9260.h
+++ b/include/configs/afeb9260.h
@@ -122,6 +122,7 @@
 #define CONFIG_NET_RETRY_COUNT		20
 
 /* USB */
+#define CONFIG_USB_ATMEL
 #define CONFIG_USB_OHCI_NEW		1
 #define CONFIG_DOS_PARTITION		1
 #define CONFIG_SYS_USB_OHCI_CPU_INIT		1
diff --git a/include/configs/at91cap9adk.h b/include/configs/at91cap9adk.h
index 7e7f124..45af688 100644
--- a/include/configs/at91cap9adk.h
+++ b/include/configs/at91cap9adk.h
@@ -144,6 +144,7 @@
 #define CONFIG_RESET_PHY_R		1
 
 /* USB */
+#define CONFIG_USB_ATMEL
 #define CONFIG_USB_OHCI_NEW		1
 #define CONFIG_DOS_PARTITION		1
 #define CONFIG_SYS_USB_OHCI_CPU_INIT		1
diff --git a/include/configs/at91sam9260ek.h b/include/configs/at91sam9260ek.h
index 1fae3a3..18c81f6 100644
--- a/include/configs/at91sam9260ek.h
+++ b/include/configs/at91sam9260ek.h
@@ -142,6 +142,7 @@
 #define CONFIG_RESET_PHY_R		1
 
 /* USB */
+#define CONFIG_USB_ATMEL
 #define CONFIG_USB_OHCI_NEW		1
 #define CONFIG_DOS_PARTITION		1
 #define CONFIG_SYS_USB_OHCI_CPU_INIT		1
diff --git a/include/configs/at91sam9261ek.h b/include/configs/at91sam9261ek.h
index 752d7e9..5c94407 100644
--- a/include/configs/at91sam9261ek.h
+++ b/include/configs/at91sam9261ek.h
@@ -143,6 +143,7 @@
 #define CONFIG_RESET_PHY_R		1
 
 /* USB */
+#define CONFIG_USB_ATMEL
 #define CONFIG_USB_OHCI_NEW		1
 #define CONFIG_DOS_PARTITION		1
 #define CONFIG_SYS_USB_OHCI_CPU_INIT		1
diff --git a/include/configs/at91sam9263ek.h b/include/configs/at91sam9263ek.h
index dd500ca..d77a780 100644
--- a/include/configs/at91sam9263ek.h
+++ b/include/configs/at91sam9263ek.h
@@ -150,6 +150,7 @@
 #define CONFIG_RESET_PHY_R		1
 
 /* USB */
+#define CONFIG_USB_ATMEL
 #define CONFIG_USB_OHCI_NEW		1
 #define CONFIG_DOS_PARTITION		1
 #define CONFIG_SYS_USB_OHCI_CPU_INIT		1
-- 
1.6.2.1

^ permalink raw reply related	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 11/13] at91: move dataflash spi driver to drivers/spi
  2009-03-27 22:30                 ` [U-Boot] [PATCH 10/13] at91: move usb driver to drivers/usb Jean-Christophe PLAGNIOL-VILLARD
@ 2009-03-27 22:30                   ` Jean-Christophe PLAGNIOL-VILLARD
  2009-03-27 22:30                     ` [U-Boot] [PATCH 12/13] at91: add hardware i2c drivers Jean-Christophe PLAGNIOL-VILLARD
  2009-03-31 18:28                   ` [U-Boot] [PATCH 10/13] at91: move usb driver to drivers/usb Remy Bohmer
  1 sibling, 1 reply; 62+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-03-27 22:30 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 cpu/arm926ejs/at91/Makefile                        |    1 -
 drivers/spi/Makefile                               |    1 +
 .../spi.c => drivers/spi/atmel_dataflash_spi.c     |    0
 include/configs/afeb9260.h                         |    1 +
 include/configs/at91cap9adk.h                      |    1 +
 include/configs/at91sam9260ek.h                    |    1 +
 include/configs/at91sam9261ek.h                    |    1 +
 include/configs/at91sam9263ek.h                    |    1 +
 include/configs/at91sam9rlek.h                     |    1 +
 9 files changed, 7 insertions(+), 1 deletions(-)
 rename cpu/arm926ejs/at91/spi.c => drivers/spi/atmel_dataflash_spi.c (100%)

diff --git a/cpu/arm926ejs/at91/Makefile b/cpu/arm926ejs/at91/Makefile
index d0d47e6..34e7461 100644
--- a/cpu/arm926ejs/at91/Makefile
+++ b/cpu/arm926ejs/at91/Makefile
@@ -55,7 +55,6 @@ COBJS-y				+= at91sam9rl_serial.o
 COBJS-$(CONFIG_HAS_DATAFLASH)	+= at91sam9rl_spi.o
 endif
 COBJS-$(CONFIG_AT91_LED)	+= led.o
-COBJS-$(CONFIG_HAS_DATAFLASH)	+= spi.o
 COBJS-y	+= timer.o
 SOBJS	= lowlevel_init.o
 
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index 6e2c121..1350f3e 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -25,6 +25,7 @@ include $(TOPDIR)/config.mk
 
 LIB	:= $(obj)libspi.a
 
+COBJS-$(CONFIG_ATMEL_DATAFLASH_SPI) += atmel_dataflash_spi.o
 COBJS-$(CONFIG_ATMEL_SPI) += atmel_spi.o
 COBJS-$(CONFIG_BFIN_SPI) += bfin_spi.o
 COBJS-$(CONFIG_MPC8XXX_SPI) += mpc8xxx_spi.o
diff --git a/cpu/arm926ejs/at91/spi.c b/drivers/spi/atmel_dataflash_spi.c
similarity index 100%
rename from cpu/arm926ejs/at91/spi.c
rename to drivers/spi/atmel_dataflash_spi.c
diff --git a/include/configs/afeb9260.h b/include/configs/afeb9260.h
index 3a51e60..bcd8d35 100644
--- a/include/configs/afeb9260.h
+++ b/include/configs/afeb9260.h
@@ -87,6 +87,7 @@
 #define PHYS_SDRAM_SIZE			0x04000000	/* 64 megs */
 
 /* DataFlash */
+#define CONFIG_ATMEL_DATAFLASH_SPI
 #define CONFIG_HAS_DATAFLASH		1
 #define CONFIG_SYS_SPI_WRITE_TOUT		(5 * CONFIG_SYS_HZ)
 #define CONFIG_SYS_MAX_DATAFLASH_BANKS		2
diff --git a/include/configs/at91cap9adk.h b/include/configs/at91cap9adk.h
index 45af688..af81f1d 100644
--- a/include/configs/at91cap9adk.h
+++ b/include/configs/at91cap9adk.h
@@ -107,6 +107,7 @@
 #define PHYS_SDRAM_SIZE			0x04000000	/* 64 megs */
 
 /* DataFlash */
+#define CONFIG_ATMEL_DATAFLASH_SPI
 #define CONFIG_HAS_DATAFLASH		1
 #define CONFIG_SYS_SPI_WRITE_TOUT		(5*CONFIG_SYS_HZ)
 #define CONFIG_SYS_MAX_DATAFLASH_BANKS		1
diff --git a/include/configs/at91sam9260ek.h b/include/configs/at91sam9260ek.h
index 18c81f6..ac58f27 100644
--- a/include/configs/at91sam9260ek.h
+++ b/include/configs/at91sam9260ek.h
@@ -103,6 +103,7 @@
 #define PHYS_SDRAM_SIZE			0x04000000	/* 64 megs */
 
 /* DataFlash */
+#define CONFIG_ATMEL_DATAFLASH_SPI
 #define CONFIG_HAS_DATAFLASH		1
 #define CONFIG_SYS_SPI_WRITE_TOUT		(5*CONFIG_SYS_HZ)
 #define CONFIG_SYS_MAX_DATAFLASH_BANKS		2
diff --git a/include/configs/at91sam9261ek.h b/include/configs/at91sam9261ek.h
index 5c94407..57bb9fa 100644
--- a/include/configs/at91sam9261ek.h
+++ b/include/configs/at91sam9261ek.h
@@ -107,6 +107,7 @@
 #define PHYS_SDRAM_SIZE			0x04000000	/* 64 megs */
 
 /* DataFlash */
+#define CONFIG_ATMEL_DATAFLASH_SPI
 #define CONFIG_HAS_DATAFLASH		1
 #define CONFIG_SYS_SPI_WRITE_TOUT		(5*CONFIG_SYS_HZ)
 #define CONFIG_SYS_MAX_DATAFLASH_BANKS		2
diff --git a/include/configs/at91sam9263ek.h b/include/configs/at91sam9263ek.h
index d77a780..dd0d552 100644
--- a/include/configs/at91sam9263ek.h
+++ b/include/configs/at91sam9263ek.h
@@ -108,6 +108,7 @@
 #define PHYS_SDRAM_SIZE			0x04000000	/* 64 megs */
 
 /* DataFlash */
+#define CONFIG_ATMEL_DATAFLASH_SPI
 #define CONFIG_HAS_DATAFLASH		1
 #define CONFIG_SYS_SPI_WRITE_TOUT		(5*CONFIG_SYS_HZ)
 #define CONFIG_SYS_MAX_DATAFLASH_BANKS		1
diff --git a/include/configs/at91sam9rlek.h b/include/configs/at91sam9rlek.h
index 7a4039c..cef98e4 100644
--- a/include/configs/at91sam9rlek.h
+++ b/include/configs/at91sam9rlek.h
@@ -98,6 +98,7 @@
 #define PHYS_SDRAM_SIZE			0x04000000	/* 64 megs */
 
 /* DataFlash */
+#define CONFIG_ATMEL_DATAFLASH_SPI
 #define CONFIG_HAS_DATAFLASH		1
 #define CONFIG_SYS_SPI_WRITE_TOUT		(5*CONFIG_SYS_HZ)
 #define CONFIG_SYS_MAX_DATAFLASH_BANKS		1
-- 
1.6.2.1

^ permalink raw reply related	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 12/13] at91: add hardware i2c drivers
  2009-03-27 22:30                   ` [U-Boot] [PATCH 11/13] at91: move dataflash spi driver to drivers/spi Jean-Christophe PLAGNIOL-VILLARD
@ 2009-03-27 22:30                     ` Jean-Christophe PLAGNIOL-VILLARD
  2009-03-27 22:30                       ` [U-Boot] [PATCH 13/13] at91sam9263ek: active hush and auto compelete support Jean-Christophe PLAGNIOL-VILLARD
                                         ` (2 more replies)
  0 siblings, 3 replies; 62+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-03-27 22:30 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 cpu/arm926ejs/at91/Makefile                        |    6 +
 .../arm926ejs/at91/at91cap9_i2c.c                  |   31 ++--
 .../arm926ejs/at91/at91sam9260_i2c.c               |   31 ++--
 .../arm926ejs/at91/at91sam9261_i2c.c               |   31 ++--
 .../arm926ejs/at91/at91sam9263_i2c.c               |   31 ++--
 .../clk.h => cpu/arm926ejs/at91/at91sam9rl_i2c.c   |   37 ++--
 drivers/i2c/Makefile                               |    1 +
 drivers/i2c/atmel_i2c.c                            |  234 ++++++++++++++++++++
 include/asm-arm/arch-at91/at91_common.h            |    2 +
 include/asm-arm/arch-at91/at91_twi.h               |   68 ++++++
 include/asm-arm/arch-at91/clk.h                    |    4 +
 include/asm-arm/arch-at91/hardware.h               |    5 +
 12 files changed, 405 insertions(+), 76 deletions(-)
 copy include/asm-arm/arch-at91/at91_common.h => cpu/arm926ejs/at91/at91cap9_i2c.c (61%)
 copy include/asm-arm/arch-at91/at91_common.h => cpu/arm926ejs/at91/at91sam9260_i2c.c (61%)
 copy include/asm-arm/arch-at91/at91_common.h => cpu/arm926ejs/at91/at91sam9261_i2c.c (61%)
 copy include/asm-arm/arch-at91/at91_common.h => cpu/arm926ejs/at91/at91sam9263_i2c.c (61%)
 copy include/asm-arm/arch-at91/clk.h => cpu/arm926ejs/at91/at91sam9rl_i2c.c (52%)
 create mode 100644 drivers/i2c/atmel_i2c.c
 create mode 100644 include/asm-arm/arch-at91/at91_twi.h

diff --git a/cpu/arm926ejs/at91/Makefile b/cpu/arm926ejs/at91/Makefile
index 34e7461..d37814f 100644
--- a/cpu/arm926ejs/at91/Makefile
+++ b/cpu/arm926ejs/at91/Makefile
@@ -26,31 +26,37 @@ include $(TOPDIR)/config.mk
 LIB	= $(obj)lib$(SOC).a
 
 ifdef CONFIG_AT91CAP9
+COBJS-$(CONFIG_HARD_I2C)	+= at91cap9_i2c.o
 COBJS-$(CONFIG_MACB)		+= at91cap9_macb.o
 COBJS-y				+= at91cap9_serial.o
 COBJS-$(CONFIG_HAS_DATAFLASH)	+= at91cap9_spi.o
 endif
 ifdef CONFIG_AT91SAM9260
+COBJS-$(CONFIG_HARD_I2C)	+= at91sam9260_i2c.o
 COBJS-$(CONFIG_MACB)		+= at91sam9260_macb.o
 COBJS-y				+= at91sam9260_serial.o
 COBJS-$(CONFIG_HAS_DATAFLASH)	+= at91sam9260_spi.o
 endif
 ifdef CONFIG_AT91SAM9G20
+COBJS-$(CONFIG_HARD_I2C)	+= at91sam9260_i2c.o
 COBJS-$(CONFIG_MACB)		+= at91sam9260_macb.o
 COBJS-y				+= at91sam9260_serial.o
 COBJS-$(CONFIG_HAS_DATAFLASH)	+= at91sam9260_spi.o
 endif
 ifdef CONFIG_AT91SAM9261
+COBJS-$(CONFIG_HARD_I2C)	+= at91sam9261_i2c.o
 COBJS-y				+= at91sam9261_serial.o
 COBJS-$(CONFIG_HAS_DATAFLASH)	+= at91sam9261_spi.o
 endif
 ifdef CONFIG_AT91SAM9263
+COBJS-$(CONFIG_HARD_I2C)	+= at91sam9263_i2c.o
 COBJS-$(CONFIG_MACB)		+= at91sam9263_macb.o
 COBJS-y				+= at91sam9263_serial.o
 COBJS-$(CONFIG_HAS_DATAFLASH)	+= at91sam9263_spi.o
 COBJS-$(CONFIG_USB_OHCI_NEW)	+= at91sam9263_usb.o
 endif
 ifdef CONFIG_AT91SAM9RL
+COBJS-$(CONFIG_HARD_I2C)	+= at91sam9rl_i2c.o
 COBJS-y				+= at91sam9rl_serial.o
 COBJS-$(CONFIG_HAS_DATAFLASH)	+= at91sam9rl_spi.o
 endif
diff --git a/include/asm-arm/arch-at91/at91_common.h b/cpu/arm926ejs/at91/at91cap9_i2c.c
similarity index 61%
copy from include/asm-arm/arch-at91/at91_common.h
copy to cpu/arm926ejs/at91/at91cap9_i2c.c
index 9c4e019..feb65bf 100644
--- a/include/asm-arm/arch-at91/at91_common.h
+++ b/cpu/arm926ejs/at91/at91cap9_i2c.c
@@ -1,7 +1,6 @@
 /*
- * (C) Copyright 2007-2008
- * Stelian Pop <stelian.pop@leadtechdesign.com>
- * Lead Tech Design <www.leadtechdesign.com>
+ * (C) Copyright 2009
+ * Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
  *
  * See file CREDITS for list of people who contributed to this
  * project.
@@ -22,17 +21,19 @@
  * MA 02111-1307 USA
  */
 
-#ifndef AT91_COMMON_H
-#define AT91_COMMON_H
+#include <common.h>
+#include <asm/arch/at91_common.h>
+#include <asm/arch/at91_pmc.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/io.h>
 
-void at91_macb_hw_init(void);
-void at91_serial_hw_init(void);
-void at91_serial0_hw_init(void);
-void at91_serial1_hw_init(void);
-void at91_serial2_hw_init(void);
-void at91_serial3_hw_init(void);
-void at91_spi0_hw_init(unsigned long cs_mask);
-void at91_spi1_hw_init(unsigned long cs_mask);
-void at91_uhp_hw_init(void);
+void at91_twi0_hw_init(void)
+{
+	at91_set_B_periph(AT91_PIN_PB4, 0);	/* TWD */
+	at91_set_multi_drive(AT91_PIN_PB4, 1);
 
-#endif /* AT91_COMMON_H */
+	at91_set_5_periph(AT91_PIN_PB5, 0);	/* TWCK */
+	at91_set_multi_drive(AT91_PIN_PB5, 1);
+
+	at91_sys_write(AT91_PMC_PCER, 1 << AT91CAP9_ID_TWI);
+}
diff --git a/include/asm-arm/arch-at91/at91_common.h b/cpu/arm926ejs/at91/at91sam9260_i2c.c
similarity index 61%
copy from include/asm-arm/arch-at91/at91_common.h
copy to cpu/arm926ejs/at91/at91sam9260_i2c.c
index 9c4e019..ff8659f 100644
--- a/include/asm-arm/arch-at91/at91_common.h
+++ b/cpu/arm926ejs/at91/at91sam9260_i2c.c
@@ -1,7 +1,6 @@
 /*
- * (C) Copyright 2007-2008
- * Stelian Pop <stelian.pop@leadtechdesign.com>
- * Lead Tech Design <www.leadtechdesign.com>
+ * (C) Copyright 2009
+ * Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
  *
  * See file CREDITS for list of people who contributed to this
  * project.
@@ -22,17 +21,19 @@
  * MA 02111-1307 USA
  */
 
-#ifndef AT91_COMMON_H
-#define AT91_COMMON_H
+#include <common.h>
+#include <asm/arch/at91_common.h>
+#include <asm/arch/at91_pmc.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/io.h>
 
-void at91_macb_hw_init(void);
-void at91_serial_hw_init(void);
-void at91_serial0_hw_init(void);
-void at91_serial1_hw_init(void);
-void at91_serial2_hw_init(void);
-void at91_serial3_hw_init(void);
-void at91_spi0_hw_init(unsigned long cs_mask);
-void at91_spi1_hw_init(unsigned long cs_mask);
-void at91_uhp_hw_init(void);
+void at91_twi0_hw_init(void)
+{
+	at91_set_A_periph(AT91_PIN_PA23, 0);	/* TWD */
+	at91_set_multi_drive(AT91_PIN_PA23, 1);
 
-#endif /* AT91_COMMON_H */
+	at91_set_A_periph(AT91_PIN_PA24, 0);	/* TWCK */
+	at91_set_multi_drive(AT91_PIN_PA24, 1);
+
+	at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_TWI);
+}
diff --git a/include/asm-arm/arch-at91/at91_common.h b/cpu/arm926ejs/at91/at91sam9261_i2c.c
similarity index 61%
copy from include/asm-arm/arch-at91/at91_common.h
copy to cpu/arm926ejs/at91/at91sam9261_i2c.c
index 9c4e019..5873e10 100644
--- a/include/asm-arm/arch-at91/at91_common.h
+++ b/cpu/arm926ejs/at91/at91sam9261_i2c.c
@@ -1,7 +1,6 @@
 /*
- * (C) Copyright 2007-2008
- * Stelian Pop <stelian.pop@leadtechdesign.com>
- * Lead Tech Design <www.leadtechdesign.com>
+ * (C) Copyright 2009
+ * Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
  *
  * See file CREDITS for list of people who contributed to this
  * project.
@@ -22,17 +21,19 @@
  * MA 02111-1307 USA
  */
 
-#ifndef AT91_COMMON_H
-#define AT91_COMMON_H
+#include <common.h>
+#include <asm/arch/at91_common.h>
+#include <asm/arch/at91_pmc.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/io.h>
 
-void at91_macb_hw_init(void);
-void at91_serial_hw_init(void);
-void at91_serial0_hw_init(void);
-void at91_serial1_hw_init(void);
-void at91_serial2_hw_init(void);
-void at91_serial3_hw_init(void);
-void at91_spi0_hw_init(unsigned long cs_mask);
-void at91_spi1_hw_init(unsigned long cs_mask);
-void at91_uhp_hw_init(void);
+void at91_twi0_hw_init(void)
+{
+	at91_set_A_periph(AT91_PIN_PA7, 0);	/* TWD */
+	at91_set_multi_drive(AT91_PIN_PA7, 1);
 
-#endif /* AT91_COMMON_H */
+	at91_set_A_periph(AT91_PIN_PA8, 0);	/* TWCK */
+	at91_set_multi_drive(AT91_PIN_PA8, 1);
+
+	at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9261_ID_TWI);
+}
diff --git a/include/asm-arm/arch-at91/at91_common.h b/cpu/arm926ejs/at91/at91sam9263_i2c.c
similarity index 61%
copy from include/asm-arm/arch-at91/at91_common.h
copy to cpu/arm926ejs/at91/at91sam9263_i2c.c
index 9c4e019..e8f63ad 100644
--- a/include/asm-arm/arch-at91/at91_common.h
+++ b/cpu/arm926ejs/at91/at91sam9263_i2c.c
@@ -1,7 +1,6 @@
 /*
- * (C) Copyright 2007-2008
- * Stelian Pop <stelian.pop@leadtechdesign.com>
- * Lead Tech Design <www.leadtechdesign.com>
+ * (C) Copyright 2009
+ * Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
  *
  * See file CREDITS for list of people who contributed to this
  * project.
@@ -22,17 +21,19 @@
  * MA 02111-1307 USA
  */
 
-#ifndef AT91_COMMON_H
-#define AT91_COMMON_H
+#include <common.h>
+#include <asm/arch/at91_common.h>
+#include <asm/arch/at91_pmc.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/io.h>
 
-void at91_macb_hw_init(void);
-void at91_serial_hw_init(void);
-void at91_serial0_hw_init(void);
-void at91_serial1_hw_init(void);
-void at91_serial2_hw_init(void);
-void at91_serial3_hw_init(void);
-void at91_spi0_hw_init(unsigned long cs_mask);
-void at91_spi1_hw_init(unsigned long cs_mask);
-void at91_uhp_hw_init(void);
+void at91_twi0_hw_init(void)
+{
+	at91_set_A_periph(AT91_PIN_PB4, 0);	/* TWD */
+	at91_set_multi_drive(AT91_PIN_PB4, 1);
 
-#endif /* AT91_COMMON_H */
+	at91_set_A_periph(AT91_PIN_PB5, 0);	/* TWCK */
+	at91_set_multi_drive(AT91_PIN_PB5, 1);
+
+	at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_TWI);
+}
diff --git a/include/asm-arm/arch-at91/clk.h b/cpu/arm926ejs/at91/at91sam9rl_i2c.c
similarity index 52%
copy from include/asm-arm/arch-at91/clk.h
copy to cpu/arm926ejs/at91/at91sam9rl_i2c.c
index 1b502c8..f12f0fd 100644
--- a/include/asm-arm/arch-at91/clk.h
+++ b/cpu/arm926ejs/at91/at91sam9rl_i2c.c
@@ -1,7 +1,6 @@
 /*
- * (C) Copyright 2007
- * Stelian Pop <stelian.pop@leadtechdesign.com>
- * Lead Tech Design <www.leadtechdesign.com>
+ * (C) Copyright 2009
+ * Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
  *
  * See file CREDITS for list of people who contributed to this
  * project.
@@ -21,25 +20,31 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  * MA 02111-1307 USA
  */
-#ifndef __ASM_ARM_ARCH_CLK_H__
-#define __ASM_ARM_ARCH_CLK_H__
 
-#include <asm/arch/hardware.h>
+#include <common.h>
+#include <asm/arch/at91_common.h>
+#include <asm/arch/at91_pmc.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/io.h>
 
-static inline unsigned long get_macb_pclk_rate(unsigned int dev_id)
+void at91_twi0_hw_init(void)
 {
-	return AT91_MASTER_CLOCK;
-}
+	at91_set_A_periph(AT91_PIN_PA23, 0);	/* TWD */
+	at91_set_multi_drive(AT91_PIN_PA23, 1);
 
-static inline unsigned long get_usart_clk_rate(unsigned int dev_id)
-{
-	return AT91_MASTER_CLOCK;
+	at91_set_A_periph(AT91_PIN_PA24, 0);	/* TWCK */
+	at91_set_multi_drive(AT91_PIN_PA24, 1);
+
+	at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9RL_ID_TWI0);
 }
 
-static inline unsigned long get_lcdc_clk_rate(unsigned int dev_id)
+void at91_twi1_hw_init(void)
 {
-	return AT91_MASTER_CLOCK;
-}
+	at91_set_A_periph(AT91_PIN_PD10, 0);	/* TWD */
+	at91_set_multi_drive(AT91_PIN_PD10, 1);
 
+	at91_set_A_periph(AT91_PIN_PD11, 0);	/* TWCK */
+	at91_set_multi_drive(AT91_PIN_PD11, 1);
 
-#endif /* __ASM_ARM_ARCH_CLK_H__ */
+	at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9RL_ID_TWI1);
+}
diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile
index 9c74657..27a5251 100644
--- a/drivers/i2c/Makefile
+++ b/drivers/i2c/Makefile
@@ -25,6 +25,7 @@ include $(TOPDIR)/config.mk
 
 LIB	:= $(obj)libi2c.a
 
+COBJS-$(CONFIG_I2C_ATMEL) += atmel_i2c.o
 COBJS-$(CONFIG_BFIN_TWI_I2C) += bfin-twi_i2c.o
 COBJS-$(CONFIG_FSL_I2C) += fsl_i2c.o
 COBJS-$(CONFIG_I2C_MXC) += mxc_i2c.o
diff --git a/drivers/i2c/atmel_i2c.c b/drivers/i2c/atmel_i2c.c
new file mode 100644
index 0000000..b4c5530
--- /dev/null
+++ b/drivers/i2c/atmel_i2c.c
@@ -0,0 +1,234 @@
+/*
+ *  i2c Support for Atmel's AT91RM9200 Two-Wire Interface
+ *
+ *  (c) Rick Bronson
+ *
+ *  Borrowed heavily from original work by:
+ *  Copyright (c) 2000 Philip Edelbrock <phil@stimpy.netroedge.com>
+ *
+ *  Modified to work with u-boot by (C) 2004 Gary Jennejohn garyj at denx.de
+ *
+ *  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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+*/
+#include <common.h>
+
+#ifdef CONFIG_HARD_I2C
+
+#include <i2c.h>
+#include <asm/io.h>
+#include <asm/arch/hardware.h>
+#include <asm/arch/at91_twi.h>
+#include <asm/arch/clk.h>
+
+#define TWI_CLOCK		100000		/* Hz. max 400 Kbits/sec */
+
+#define at91_twi_read(reg)		__raw_readl(AT91_BASE_TWI + (reg))
+#define at91_twi_write(reg, val)	__raw_writel((val), AT91_BASE_TWI + (reg))
+/* define DEBUG */
+
+/*
+ * Poll the i2c status register until the specified bit is set.
+ * Returns 0 if timed out (100 msec)
+ */
+static short at91_poll_status(unsigned long bit)
+{
+	int loop_cntr = 10000;
+
+	do {
+		udelay(10);
+	} while (!(at91_twi_read(AT91_TWI_SR) & bit) && (--loop_cntr > 0));
+
+	return (loop_cntr > 0);
+}
+
+static int xfer_read(unsigned char *buf, int length)
+{
+	/* Send Start */
+	at91_twi_write(AT91_TWI_CR, AT91_TWI_START);
+
+	/* Read data */
+	while (length--) {
+		if (!length)	/* need to send Stop before reading last byte */
+			at91_twi_write(AT91_TWI_CR, AT91_TWI_STOP);
+		if (!at91_poll_status(AT91_TWI_RXRDY)) {
+			debug("at91_i2c: RXRDY timeout\n");
+			return 1;
+		}
+		*buf++ = (at91_twi_read(AT91_TWI_RHR) & 0xff);
+	}
+
+	return 0;
+}
+
+static int xfer_write(unsigned char *buf, int length)
+{
+	/* Load first byte into transmitter */
+	at91_twi_write(AT91_TWI_THR, *buf++);
+
+	/* Send Start */
+	at91_twi_write(AT91_TWI_CR, AT91_TWI_START);
+
+	do {
+		if (!at91_poll_status(AT91_TWI_TXRDY)) {
+			debug ("at91_i2c: TXRDY timeout\n");
+			return 1;
+		}
+
+		length--;	/* byte was transmitted */
+
+		if (length > 0)		/* more data to send? */
+			at91_twi_write(AT91_TWI_THR, *buf++);
+	} while (length);
+
+	/* Send Stop */
+	at91_twi_write(AT91_TWI_CR, AT91_TWI_STOP);
+
+	return 0;
+}
+
+/*
+ * Generic i2c master transfer entrypoint
+ *
+ * rw == 1 means that this is a read
+ */
+static int at91_xfer(unsigned char chip, unsigned int addr, int alen,
+		     unsigned char *buffer, int len, int rw)
+{
+	int length;
+	int ret = -1;
+	unsigned char *buf;
+
+	/* Set the TWI Master Mode Register */
+	at91_twi_write(AT91_TWI_MMR, (chip << 16) | (alen << 8)
+				    | ((rw == 1) ? AT91_TWI_MREAD : 0));
+
+	/* Set TWI Internal Address Register with first messages data field */
+	if (alen > 0)
+		at91_twi_write(AT91_TWI_IADR, addr);
+
+	length = len;
+	buf = buffer;
+	if (length && buf) {	/* sanity check */
+		if (rw)
+			ret = xfer_read(buf, len);
+		else
+			ret = xfer_write(buf, len);
+	}
+
+	return ret;
+}
+
+int
+i2c_probe(unsigned char chip)
+{
+	unsigned char buffer[1];
+
+	return at91_xfer(chip, 0, 0, buffer, 1, 1);
+}
+
+int
+i2c_read (unsigned char chip, unsigned int addr, int alen,
+	  unsigned char *buffer, int len)
+{
+#ifdef CONFIG_SYS_I2C_EEPROM_ADDR_OVERFLOW
+	/* we only allow one address byte */
+	if (alen > 1)
+		return 1;
+	/* XXX assume an ATMEL AT24C16 */
+	if (alen == 1) {
+#if 0 /* EEPROM code already sets this correctly */
+		chip |= (addr >> 8) & 0xff;
+#endif
+		addr = addr & 0xff;
+	}
+#endif
+	return at91_xfer(chip, addr, alen, buffer, len, 1);
+}
+
+int
+i2c_write(unsigned char chip, unsigned int addr, int alen,
+	  unsigned char *buffer, int len)
+{
+#ifdef CONFIG_SYS_I2C_EEPROM_ADDR_OVERFLOW
+	int i;
+	unsigned char *buf;
+
+	/* we only allow one address byte */
+	if (alen > 1)
+		return 1;
+	/* XXX assume an ATMEL AT24C16 */
+	if (alen == 1) {
+		buf = buffer;
+		/* do single byte writes */
+		for (i = 0; i < len; i++) {
+#if 0 /* EEPROM code already sets this correctly */
+			chip |= (addr >> 8) & 0xff;
+#endif
+			addr = addr & 0xff;
+			if (at91_xfer(chip, addr, alen, buf++, 1, 0))
+				return 1;
+			addr++;
+		}
+		return 0;
+	}
+#endif
+	return at91_xfer(chip, addr, alen, buffer, len, 0);
+}
+
+/*
+ * Main initialization routine
+ */
+void i2c_init(int speed, int slaveaddr)
+{
+	unsigned long cdiv, ckdiv;
+
+	at91_twi_write(AT91_TWI_IDR, 0xffffffff);	/* Disable all interrupts */
+	at91_twi_write(AT91_TWI_CR, AT91_TWI_SWRST);	/* Reset peripheral */
+	at91_twi_write(AT91_TWI_CR, AT91_TWI_MSEN);	/* Set Master mode */
+
+	/* Calcuate clock dividers */
+	cdiv = (get_twi_clk_rate(0) / (2 * TWI_CLOCK)) - 3;
+	cdiv = cdiv + 1;	/* round up */
+	ckdiv = 0;
+	while (cdiv > 255) {
+		ckdiv++;
+		cdiv = cdiv >> 1;
+	}
+
+#ifdef CONFIG_AT91RM9200
+	if (ckdiv > 5) {
+		printf("AT91 I2C: Invalid TWI_CLOCK value!\n");
+		ckdiv = 5;
+	}
+#endif
+
+	at91_twi_write(AT91_TWI_CWGR, (ckdiv << 16) | (cdiv << 8) | cdiv);
+
+	debug ("Found AT91 i2c\n");
+	return;
+}
+
+int i2c_set_bus_speed(unsigned int speed)
+{
+	return -1;
+}
+
+unsigned int i2c_get_bus_speed(void)
+{
+	return CONFIG_SYS_I2C_SPEED;
+}
+
+#endif /* CONFIG_HARD_I2C */
diff --git a/include/asm-arm/arch-at91/at91_common.h b/include/asm-arm/arch-at91/at91_common.h
index 9c4e019..43a5e07 100644
--- a/include/asm-arm/arch-at91/at91_common.h
+++ b/include/asm-arm/arch-at91/at91_common.h
@@ -33,6 +33,8 @@ void at91_serial2_hw_init(void);
 void at91_serial3_hw_init(void);
 void at91_spi0_hw_init(unsigned long cs_mask);
 void at91_spi1_hw_init(unsigned long cs_mask);
+void at91_twi0_hw_init(void);
+void at91_twi1_hw_init(void);
 void at91_uhp_hw_init(void);
 
 #endif /* AT91_COMMON_H */
diff --git a/include/asm-arm/arch-at91/at91_twi.h b/include/asm-arm/arch-at91/at91_twi.h
new file mode 100644
index 0000000..bb2880f
--- /dev/null
+++ b/include/asm-arm/arch-at91/at91_twi.h
@@ -0,0 +1,68 @@
+/*
+ * arch/arm/mach-at91/include/mach/at91_twi.h
+ *
+ * Copyright (C) 2005 Ivan Kokshaysky
+ * Copyright (C) SAN People
+ *
+ * Two-wire Interface (TWI) registers.
+ * Based on AT91RM9200 datasheet revision E.
+ *
+ * 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.
+ */
+
+#ifndef AT91_TWI_H
+#define AT91_TWI_H
+
+#define	AT91_TWI_CR		0x00		/* Control Register */
+#define		AT91_TWI_START		(1 <<  0)	/* Send a Start Condition */
+#define		AT91_TWI_STOP		(1 <<  1)	/* Send a Stop Condition */
+#define		AT91_TWI_MSEN		(1 <<  2)	/* Master Transfer Enable */
+#define		AT91_TWI_MSDIS		(1 <<  3)	/* Master Transfer Disable */
+#define		AT91_TWI_SVEN		(1 <<  4)	/* Slave Transfer Enable [SAM9260 only] */
+#define		AT91_TWI_SVDIS		(1 <<  5)	/* Slave Transfer Disable [SAM9260 only] */
+#define		AT91_TWI_SWRST		(1 <<  7)	/* Software Reset */
+
+#define	AT91_TWI_MMR		0x04		/* Master Mode Register */
+#define		AT91_TWI_IADRSZ		(3    <<  8)	/* Internal Device Address Size */
+#define			AT91_TWI_IADRSZ_NO		(0 << 8)
+#define			AT91_TWI_IADRSZ_1		(1 << 8)
+#define			AT91_TWI_IADRSZ_2		(2 << 8)
+#define			AT91_TWI_IADRSZ_3		(3 << 8)
+#define		AT91_TWI_MREAD		(1    << 12)	/* Master Read Direction */
+#define		AT91_TWI_DADR		(0x7f << 16)	/* Device Address */
+
+#define	AT91_TWI_SMR		0x08		/* Slave Mode Register [SAM9260 only] */
+#define		AT91_TWI_SADR		(0x7f << 16)	/* Slave Address */
+
+#define	AT91_TWI_IADR		0x0c		/* Internal Address Register */
+
+#define	AT91_TWI_CWGR		0x10		/* Clock Waveform Generator Register */
+#define		AT91_TWI_CLDIV		(0xff <<  0)	/* Clock Low Divisor */
+#define		AT91_TWI_CHDIV		(0xff <<  8)	/* Clock High Divisor */
+#define		AT91_TWI_CKDIV		(7    << 16)	/* Clock Divider */
+
+#define	AT91_TWI_SR		0x20		/* Status Register */
+#define		AT91_TWI_TXCOMP		(1 <<  0)	/* Transmission Complete */
+#define		AT91_TWI_RXRDY		(1 <<  1)	/* Receive Holding Register Ready */
+#define		AT91_TWI_TXRDY		(1 <<  2)	/* Transmit Holding Register Ready */
+#define		AT91_TWI_SVREAD		(1 <<  3)	/* Slave Read [SAM9260 only] */
+#define		AT91_TWI_SVACC		(1 <<  4)	/* Slave Access [SAM9260 only] */
+#define		AT91_TWI_GACC		(1 <<  5)	/* General Call Access [SAM9260 only] */
+#define		AT91_TWI_OVRE		(1 <<  6)	/* Overrun Error [AT91RM9200 only] */
+#define		AT91_TWI_UNRE		(1 <<  7)	/* Underrun Error [AT91RM9200 only] */
+#define		AT91_TWI_NACK		(1 <<  8)	/* Not Acknowledged */
+#define		AT91_TWI_ARBLST		(1 <<  9)	/* Arbitration Lost [SAM9260 only] */
+#define		AT91_TWI_SCLWS		(1 << 10)	/* Clock Wait State [SAM9260 only] */
+#define		AT91_TWI_EOSACC		(1 << 11)	/* End of Slave Address [SAM9260 only] */
+
+#define	AT91_TWI_IER		0x24		/* Interrupt Enable Register */
+#define	AT91_TWI_IDR		0x28		/* Interrupt Disable Register */
+#define	AT91_TWI_IMR		0x2c		/* Interrupt Mask Register */
+#define	AT91_TWI_RHR		0x30		/* Receive Holding Register */
+#define	AT91_TWI_THR		0x34		/* Transmit Holding Register */
+
+#endif
+
diff --git a/include/asm-arm/arch-at91/clk.h b/include/asm-arm/arch-at91/clk.h
index 1b502c8..85ab68e 100644
--- a/include/asm-arm/arch-at91/clk.h
+++ b/include/asm-arm/arch-at91/clk.h
@@ -41,5 +41,9 @@ static inline unsigned long get_lcdc_clk_rate(unsigned int dev_id)
 	return AT91_MASTER_CLOCK;
 }
 
+static inline unsigned long get_twi_clk_rate(unsigned int dev_id)
+{
+	return AT91_MASTER_CLOCK;
+}
 
 #endif /* __ASM_ARM_ARCH_CLK_H__ */
diff --git a/include/asm-arm/arch-at91/hardware.h b/include/asm-arm/arch-at91/hardware.h
index 4f0e1a7..f34071c 100644
--- a/include/asm-arm/arch-at91/hardware.h
+++ b/include/asm-arm/arch-at91/hardware.h
@@ -21,25 +21,30 @@
 #elif defined(CONFIG_AT91SAM9260) || defined(CONFIG_AT91SAM9G20)
 #include <asm/arch/at91sam9260.h>
 #define AT91_BASE_SPI	AT91SAM9260_BASE_SPI0
+#define AT91_BASE_TWI	AT91SAM9260_BASE_TWI
 #define AT91_ID_UHP	AT91SAM9260_ID_UHP
 #define AT91_PMC_UHP	AT91SAM926x_PMC_UHP
 #elif defined(CONFIG_AT91SAM9261)
 #include <asm/arch/at91sam9261.h>
 #define AT91_BASE_SPI	AT91SAM9261_BASE_SPI0
+#define AT91_BASE_TWI	AT91SAM9261_BASE_TWI
 #define AT91_ID_UHP	AT91SAM9261_ID_UHP
 #define AT91_PMC_UHP	AT91SAM926x_PMC_UHP
 #elif defined(CONFIG_AT91SAM9263)
 #include <asm/arch/at91sam9263.h>
 #define AT91_BASE_SPI	AT91SAM9263_BASE_SPI0
+#define AT91_BASE_TWI	AT91SAM9263_BASE_TWI
 #define AT91_ID_UHP	AT91SAM9263_ID_UHP
 #define AT91_PMC_UHP	AT91SAM926x_PMC_UHP
 #elif defined(CONFIG_AT91SAM9RL)
 #include <asm/arch/at91sam9rl.h>
 #define AT91_BASE_SPI	AT91SAM9RL_BASE_SPI
+#define AT91_BASE_TWI	AT91SAM9RL_BASE_TWI
 #define AT91_ID_UHP	AT91SAM9RL_ID_UHP
 #elif defined(CONFIG_AT91CAP9)
 #include <asm/arch/at91cap9.h>
 #define AT91_BASE_SPI	AT91CAP9_BASE_SPI0
+#define AT91_BASE_TWI	AT91CAP9_BASE_TWI
 #define AT91_ID_UHP	AT91CAP9_ID_UHP
 #define AT91_PMC_UHP	AT91CAP9_PMC_UHP
 #elif defined(CONFIG_AT91X40)
-- 
1.6.2.1

^ permalink raw reply related	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 13/13] at91sam9263ek: active hush and auto compelete support
  2009-03-27 22:30                     ` [U-Boot] [PATCH 12/13] at91: add hardware i2c drivers Jean-Christophe PLAGNIOL-VILLARD
@ 2009-03-27 22:30                       ` Jean-Christophe PLAGNIOL-VILLARD
  2009-03-31 20:35                         ` Wolfgang Denk
  2009-03-30  5:53                       ` [U-Boot] [PATCH 12/13] at91: add hardware i2c drivers Heiko Schocher
  2009-05-14  6:06                       ` Daniel Gorsulowski
  2 siblings, 1 reply; 62+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-03-27 22:30 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 include/configs/at91sam9263ek.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/include/configs/at91sam9263ek.h b/include/configs/at91sam9263ek.h
index dd0d552..fc87241 100644
--- a/include/configs/at91sam9263ek.h
+++ b/include/configs/at91sam9263ek.h
@@ -204,6 +204,9 @@
 #define CONFIG_SYS_PBSIZE		(CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
 #define CONFIG_SYS_LONGHELP		1
 #define CONFIG_CMDLINE_EDITING	1
+#define CONFIG_AUTO_COMPLETE
+#define CONFIG_SYS_HUSH_PARSER
+#define CONFIG_SYS_PROMPT_HUSH_PS2	"> "
 
 #define ROUND(A, B)		(((A) + (B)) & ~((B) - 1))
 /*
-- 
1.6.2.1

^ permalink raw reply related	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 12/13] at91: add hardware i2c drivers
  2009-03-27 22:30                     ` [U-Boot] [PATCH 12/13] at91: add hardware i2c drivers Jean-Christophe PLAGNIOL-VILLARD
  2009-03-27 22:30                       ` [U-Boot] [PATCH 13/13] at91sam9263ek: active hush and auto compelete support Jean-Christophe PLAGNIOL-VILLARD
@ 2009-03-30  5:53                       ` Heiko Schocher
  2009-03-30  7:24                         ` Jean-Christophe PLAGNIOL-VILLARD
  2009-03-31 20:40                         ` Wolfgang Denk
  2009-05-14  6:06                       ` Daniel Gorsulowski
  2 siblings, 2 replies; 62+ messages in thread
From: Heiko Schocher @ 2009-03-30  5:53 UTC (permalink / raw)
  To: u-boot

Hello Jean,

Jean-Christophe PLAGNIOL-VILLARD wrote:
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  cpu/arm926ejs/at91/Makefile                        |    6 +
>  .../arm926ejs/at91/at91cap9_i2c.c                  |   31 ++--
>  .../arm926ejs/at91/at91sam9260_i2c.c               |   31 ++--
>  .../arm926ejs/at91/at91sam9261_i2c.c               |   31 ++--
>  .../arm926ejs/at91/at91sam9263_i2c.c               |   31 ++--
>  .../clk.h => cpu/arm926ejs/at91/at91sam9rl_i2c.c   |   37 ++--
>  drivers/i2c/Makefile                               |    1 +
>  drivers/i2c/atmel_i2c.c                            |  234 ++++++++++++++++++++
>  include/asm-arm/arch-at91/at91_common.h            |    2 +
>  include/asm-arm/arch-at91/at91_twi.h               |   68 ++++++
>  include/asm-arm/arch-at91/clk.h                    |    4 +
>  include/asm-arm/arch-at91/hardware.h               |    5 +
>  12 files changed, 405 insertions(+), 76 deletions(-)
>  copy include/asm-arm/arch-at91/at91_common.h => cpu/arm926ejs/at91/at91cap9_i2c.c (61%)
>  copy include/asm-arm/arch-at91/at91_common.h => cpu/arm926ejs/at91/at91sam9260_i2c.c (61%)
>  copy include/asm-arm/arch-at91/at91_common.h => cpu/arm926ejs/at91/at91sam9261_i2c.c (61%)
>  copy include/asm-arm/arch-at91/at91_common.h => cpu/arm926ejs/at91/at91sam9263_i2c.c (61%)
>  copy include/asm-arm/arch-at91/clk.h => cpu/arm926ejs/at91/at91sam9rl_i2c.c (52%)
>  create mode 100644 drivers/i2c/atmel_i2c.c
>  create mode 100644 include/asm-arm/arch-at91/at91_twi.h
>
>   
[...]
> diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile
> index 9c74657..27a5251 100644
> --- a/drivers/i2c/Makefile
> +++ b/drivers/i2c/Makefile
> @@ -25,6 +25,7 @@ include $(TOPDIR)/config.mk
>  
>  LIB	:= $(obj)libi2c.a
>  
> +COBJS-$(CONFIG_I2C_ATMEL) += atmel_i2c.o
>  COBJS-$(CONFIG_BFIN_TWI_I2C) += bfin-twi_i2c.o
>  COBJS-$(CONFIG_FSL_I2C) += fsl_i2c.o
>  COBJS-$(CONFIG_I2C_MXC) += mxc_i2c.o
>   

Independent from your patch, I think we need here a common
rule. Either we name in future this define "CONFIG_I2C_XXX"
or "CONFIG_XXX_I2C. I vote for using "CONFIG_I2C_XXX"

> diff --git a/drivers/i2c/atmel_i2c.c b/drivers/i2c/atmel_i2c.c
> new file mode 100644
> index 0000000..b4c5530
> --- /dev/null
> +++ b/drivers/i2c/atmel_i2c.c
> @@ -0,0 +1,234 @@
> +/*
> + *  i2c Support for Atmel's AT91RM9200 Two-Wire Interface
> + *
> + *  (c) Rick Bronson
> + *
> + *  Borrowed heavily from original work by:
> + *  Copyright (c) 2000 Philip Edelbrock <phil@stimpy.netroedge.com>
> + *
> + *  Modified to work with u-boot by (C) 2004 Gary Jennejohn garyj at denx.de
> + *
> + *  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., 675 Mass Ave, Cambridge, MA 02139, USA.
> + *
> +*/
> +#include <common.h>
> +
> +#ifdef CONFIG_HARD_I2C
>   

Why not "#if defined(CONFIG_I2C_ATMEL)" as in the Makefile?

> +
> +#include <i2c.h>
> +#include <asm/io.h>
>   
[...]
> +	if (alen > 1)
> +		return 1;
> +	/* XXX assume an ATMEL AT24C16 */
> +	if (alen == 1) {
> +#if 0 /* EEPROM code already sets this correctly */
> +		chip |= (addr >> 8) & 0xff;
> +#endif
>   

please remove dead code.

> +		addr = addr & 0xff;
> +	}
> +#endif
> +	return at91_xfer(chip, addr, alen, buffer, len, 1);
> +}
> +
> +int
> +i2c_write(unsigned char chip, unsigned int addr, int alen,
> +	  unsigned char *buffer, int len)
> +{
> +#ifdef CONFIG_SYS_I2C_EEPROM_ADDR_OVERFLOW
> +	int i;
> +	unsigned char *buf;
> +
> +	/* we only allow one address byte */
> +	if (alen > 1)
> +		return 1;
> +	/* XXX assume an ATMEL AT24C16 */
> +	if (alen == 1) {
> +		buf = buffer;
> +		/* do single byte writes */
> +		for (i = 0; i < len; i++) {
> +#if 0 /* EEPROM code already sets this correctly */
> +			chip |= (addr >> 8) & 0xff;
> +#endif
>   

here too, please remove dead code.

> +			addr = addr & 0xff;
> +			if (at91_xfer(chip, addr, alen, buf++, 1, 0))
> +				return 1;
> +			addr++;
> +		}
> +		return 0;
>   
[...]
> diff --git a/include/asm-arm/arch-at91/at91_twi.h b/include/asm-arm/arch-at91/at91_twi.h
> new file mode 100644
> index 0000000..bb2880f
> --- /dev/null
> +++ b/include/asm-arm/arch-at91/at91_twi.h
> @@ -0,0 +1,68 @@
> +/*
> + * arch/arm/mach-at91/include/mach/at91_twi.h
> + *
> + * Copyright (C) 2005 Ivan Kokshaysky
> + * Copyright (C) SAN People
> + *
> + * Two-wire Interface (TWI) registers.
> + * Based on AT91RM9200 datasheet revision E.
> + *
> + * 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.
> + */
> +
> +#ifndef AT91_TWI_H
> +#define AT91_TWI_H
> +
> +#define	AT91_TWI_CR		0x00		/* Control Register */
> +#define		AT91_TWI_START		(1 <<  0)	/* Send a Start Condition */
> +#define		AT91_TWI_STOP		(1 <<  1)	/* Send a Stop Condition */
> +#define		AT91_TWI_MSEN		(1 <<  2)	/* Master Transfer Enable */
> +#define		AT91_TWI_MSDIS		(1 <<  3)	/* Master Transfer Disable */
> +#define		AT91_TWI_SVEN		(1 <<  4)	/* Slave Transfer Enable [SAM9260 only] */
> +#define		AT91_TWI_SVDIS		(1 <<  5)	/* Slave Transfer Disable [SAM9260 only] */
> +#define		AT91_TWI_SWRST		(1 <<  7)	/* Software Reset */
>   
                 ^^^^^^^^^^^^^^^
                 doule tabs breaks line length (this affects for the
whole file)

> +
> +#define	AT91_TWI_MMR		0x04		/* Master Mode Register */
> +#define		AT91_TWI_IADRSZ		(3    <<  8)	/* Internal Device Address Size */
> +#define			AT91_TWI_IADRSZ_NO		(0 << 8)
> +#define			AT91_TWI_IADRSZ_1		(1 << 8)
> +#define			AT91_TWI_IADRSZ_2		(2 << 8)
> +#define			AT91_TWI_IADRSZ_3		(3 << 8)
> +#define		AT91_TWI_MREAD		(1    << 12)	/* Master Read Direction */
> +#define		AT91_TWI_DADR		(0x7f << 16)	/* Device Address */
> +
> +#define	AT91_TWI_SMR		0x08		/* Slave Mode Register [SAM9260 only] */
> +#define		AT91_TWI_SADR		(0x7f << 16)	/* Slave Address */
> +
> +#define	AT91_TWI_IADR		0x0c		/* Internal Address Register */
> +
> +#define	AT91_TWI_CWGR		0x10		/* Clock Waveform Generator Register */
> +#define		AT91_TWI_CLDIV		(0xff <<  0)	/* Clock Low Divisor */
> +#define		AT91_TWI_CHDIV		(0xff <<  8)	/* Clock High Divisor */
> +#define		AT91_TWI_CKDIV		(7    << 16)	/* Clock Divider */
> +
> +#define	AT91_TWI_SR		0x20		/* Status Register */
> +#define		AT91_TWI_TXCOMP		(1 <<  0)	/* Transmission Complete */
> +#define		AT91_TWI_RXRDY		(1 <<  1)	/* Receive Holding Register Ready */
> +#define		AT91_TWI_TXRDY		(1 <<  2)	/* Transmit Holding Register Ready */
> +#define		AT91_TWI_SVREAD		(1 <<  3)	/* Slave Read [SAM9260 only] */
> +#define		AT91_TWI_SVACC		(1 <<  4)	/* Slave Access [SAM9260 only] */
> +#define		AT91_TWI_GACC		(1 <<  5)	/* General Call Access [SAM9260 only] */
> +#define		AT91_TWI_OVRE		(1 <<  6)	/* Overrun Error [AT91RM9200 only] */
> +#define		AT91_TWI_UNRE		(1 <<  7)	/* Underrun Error [AT91RM9200 only] */
> +#define		AT91_TWI_NACK		(1 <<  8)	/* Not Acknowledged */
> +#define		AT91_TWI_ARBLST		(1 <<  9)	/* Arbitration Lost [SAM9260 only] */
> +#define		AT91_TWI_SCLWS		(1 << 10)	/* Clock Wait State [SAM9260 only] */
> +#define		AT91_TWI_EOSACC		(1 << 11)	/* End of Slave Address [SAM9260 only] */
> +
> +#define	AT91_TWI_IER		0x24		/* Interrupt Enable Register */
> +#define	AT91_TWI_IDR		0x28		/* Interrupt Disable Register */
> +#define	AT91_TWI_IMR		0x2c		/* Interrupt Mask Register */
> +#define	AT91_TWI_RHR		0x30		/* Receive Holding Register */
> +#define	AT91_TWI_THR		0x34		/* Transmit Holding Register */
> +
> +#endif
> +
>   
bye
Heiko

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany 

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 12/13] at91: add hardware i2c drivers
  2009-03-30  5:53                       ` [U-Boot] [PATCH 12/13] at91: add hardware i2c drivers Heiko Schocher
@ 2009-03-30  7:24                         ` Jean-Christophe PLAGNIOL-VILLARD
  2009-03-30  8:26                           ` Heiko Schocher
  2009-03-31 20:40                         ` Wolfgang Denk
  1 sibling, 1 reply; 62+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-03-30  7:24 UTC (permalink / raw)
  To: u-boot

On 07:53 Mon 30 Mar     , Heiko Schocher wrote:
> Hello Jean,
> 
> Jean-Christophe PLAGNIOL-VILLARD wrote:
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > ---
> >  cpu/arm926ejs/at91/Makefile                        |    6 +
> >  .../arm926ejs/at91/at91cap9_i2c.c                  |   31 ++--
> >  .../arm926ejs/at91/at91sam9260_i2c.c               |   31 ++--
> >  .../arm926ejs/at91/at91sam9261_i2c.c               |   31 ++--
> >  .../arm926ejs/at91/at91sam9263_i2c.c               |   31 ++--
> >  .../clk.h => cpu/arm926ejs/at91/at91sam9rl_i2c.c   |   37 ++--
> >  drivers/i2c/Makefile                               |    1 +
> >  drivers/i2c/atmel_i2c.c                            |  234 ++++++++++++++++++++
> >  include/asm-arm/arch-at91/at91_common.h            |    2 +
> >  include/asm-arm/arch-at91/at91_twi.h               |   68 ++++++
> >  include/asm-arm/arch-at91/clk.h                    |    4 +
> >  include/asm-arm/arch-at91/hardware.h               |    5 +
> >  12 files changed, 405 insertions(+), 76 deletions(-)
> >  copy include/asm-arm/arch-at91/at91_common.h => cpu/arm926ejs/at91/at91cap9_i2c.c (61%)
> >  copy include/asm-arm/arch-at91/at91_common.h => cpu/arm926ejs/at91/at91sam9260_i2c.c (61%)
> >  copy include/asm-arm/arch-at91/at91_common.h => cpu/arm926ejs/at91/at91sam9261_i2c.c (61%)
> >  copy include/asm-arm/arch-at91/at91_common.h => cpu/arm926ejs/at91/at91sam9263_i2c.c (61%)
> >  copy include/asm-arm/arch-at91/clk.h => cpu/arm926ejs/at91/at91sam9rl_i2c.c (52%)
> >  create mode 100644 drivers/i2c/atmel_i2c.c
> >  create mode 100644 include/asm-arm/arch-at91/at91_twi.h
> >
> >   
> [...]
> > diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile
> > index 9c74657..27a5251 100644
> > --- a/drivers/i2c/Makefile
> > +++ b/drivers/i2c/Makefile
> > @@ -25,6 +25,7 @@ include $(TOPDIR)/config.mk
> >  
> >  LIB	:= $(obj)libi2c.a
> >  
> > +COBJS-$(CONFIG_I2C_ATMEL) += atmel_i2c.o
> >  COBJS-$(CONFIG_BFIN_TWI_I2C) += bfin-twi_i2c.o
> >  COBJS-$(CONFIG_FSL_I2C) += fsl_i2c.o
> >  COBJS-$(CONFIG_I2C_MXC) += mxc_i2c.o
> >   
> 
> Independent from your patch, I think we need here a common
> rule. Either we name in future this define "CONFIG_I2C_XXX"
> or "CONFIG_XXX_I2C. I vote for using "CONFIG_I2C_XXX"
it's plan to clean up the driver CONFIG_ just before send the Kconfig patch
series

> > + *
> > +*/
> > +#include <common.h>
> > +
> > +#ifdef CONFIG_HARD_I2C
> >   
> 
> Why not "#if defined(CONFIG_I2C_ATMEL)" as in the Makefile?
until the Kconfig I'll prefer to keep the CONFIG_HARD_I2C
> 
> > +
> > +#include <i2c.h>
> > +#include <asm/io.h>
> >   
> [...]
> > +	if (alen > 1)
> > +		return 1;
> > +	/* XXX assume an ATMEL AT24C16 */
> > +	if (alen == 1) {
> > +#if 0 /* EEPROM code already sets this correctly */
> > +		chip |= (addr >> 8) & 0xff;
> > +#endif
> >   
> 
> please remove dead code.
> 
> > +		addr = addr & 0xff;
> > +	}
> > +#endif
> > +	return at91_xfer(chip, addr, alen, buffer, len, 1);
> > +}
> > +
> > +int
> > +i2c_write(unsigned char chip, unsigned int addr, int alen,
> > +	  unsigned char *buffer, int len)
> > +{
> > +#ifdef CONFIG_SYS_I2C_EEPROM_ADDR_OVERFLOW
> > +	int i;
> > +	unsigned char *buf;
> > +
> > +	/* we only allow one address byte */
> > +	if (alen > 1)
> > +		return 1;
> > +	/* XXX assume an ATMEL AT24C16 */
> > +	if (alen == 1) {
> > +		buf = buffer;
> > +		/* do single byte writes */
> > +		for (i = 0; i < len; i++) {
> > +#if 0 /* EEPROM code already sets this correctly */
> > +			chip |= (addr >> 8) & 0xff;
> > +#endif
> >   
> 
> here too, please remove dead code.
> 
> > +			addr = addr & 0xff;
> > +			if (at91_xfer(chip, addr, alen, buf++, 1, 0))
> > +				return 1;
> > +			addr++;
> > +		}
> > +		return 0;
> >   
> [...]
> > diff --git a/include/asm-arm/arch-at91/at91_twi.h b/include/asm-arm/arch-at91/at91_twi.h
> > new file mode 100644
> > index 0000000..bb2880f
> > --- /dev/null
> > +++ b/include/asm-arm/arch-at91/at91_twi.h
> > @@ -0,0 +1,68 @@
> > +/*
> > + * arch/arm/mach-at91/include/mach/at91_twi.h
> > + *
> > + * Copyright (C) 2005 Ivan Kokshaysky
> > + * Copyright (C) SAN People
> > + *
> > + * Two-wire Interface (TWI) registers.
> > + * Based on AT91RM9200 datasheet revision E.
> > + *
> > + * 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.
> > + */
> > +
> > +#ifndef AT91_TWI_H
> > +#define AT91_TWI_H
> > +
> > +#define	AT91_TWI_CR		0x00		/* Control Register */
> > +#define		AT91_TWI_START		(1 <<  0)	/* Send a Start Condition */
> > +#define		AT91_TWI_STOP		(1 <<  1)	/* Send a Stop Condition */
> > +#define		AT91_TWI_MSEN		(1 <<  2)	/* Master Transfer Enable */
> > +#define		AT91_TWI_MSDIS		(1 <<  3)	/* Master Transfer Disable */
> > +#define		AT91_TWI_SVEN		(1 <<  4)	/* Slave Transfer Enable [SAM9260 only] */
> > +#define		AT91_TWI_SVDIS		(1 <<  5)	/* Slave Transfer Disable [SAM9260 only] */
> > +#define		AT91_TWI_SWRST		(1 <<  7)	/* Software Reset */
> >   
>                  ^^^^^^^^^^^^^^^
>                  doule tabs breaks line length (this affects for the
> whole file)
> 
I'll prefer to keep it as it because it's an import from Linux

Best Regards,
J.

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 12/13] at91: add hardware i2c drivers
  2009-03-30  7:24                         ` Jean-Christophe PLAGNIOL-VILLARD
@ 2009-03-30  8:26                           ` Heiko Schocher
  2009-03-30  8:50                             ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 62+ messages in thread
From: Heiko Schocher @ 2009-03-30  8:26 UTC (permalink / raw)
  To: u-boot

Hello Jean-Christophe,

Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 07:53 Mon 30 Mar     , Heiko Schocher wrote:
>> Hello Jean,
>>
>> Jean-Christophe PLAGNIOL-VILLARD wrote:
>>> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
>>> ---
>>>  cpu/arm926ejs/at91/Makefile                        |    6 +
>>>  .../arm926ejs/at91/at91cap9_i2c.c                  |   31 ++--
>>>  .../arm926ejs/at91/at91sam9260_i2c.c               |   31 ++--
>>>  .../arm926ejs/at91/at91sam9261_i2c.c               |   31 ++--
>>>  .../arm926ejs/at91/at91sam9263_i2c.c               |   31 ++--
>>>  .../clk.h => cpu/arm926ejs/at91/at91sam9rl_i2c.c   |   37 ++--
>>>  drivers/i2c/Makefile                               |    1 +
>>>  drivers/i2c/atmel_i2c.c                            |  234 ++++++++++++++++++++
>>>  include/asm-arm/arch-at91/at91_common.h            |    2 +
>>>  include/asm-arm/arch-at91/at91_twi.h               |   68 ++++++
>>>  include/asm-arm/arch-at91/clk.h                    |    4 +
>>>  include/asm-arm/arch-at91/hardware.h               |    5 +
>>>  12 files changed, 405 insertions(+), 76 deletions(-)
>>>  copy include/asm-arm/arch-at91/at91_common.h => cpu/arm926ejs/at91/at91cap9_i2c.c (61%)
>>>  copy include/asm-arm/arch-at91/at91_common.h => cpu/arm926ejs/at91/at91sam9260_i2c.c (61%)
>>>  copy include/asm-arm/arch-at91/at91_common.h => cpu/arm926ejs/at91/at91sam9261_i2c.c (61%)
>>>  copy include/asm-arm/arch-at91/at91_common.h => cpu/arm926ejs/at91/at91sam9263_i2c.c (61%)
>>>  copy include/asm-arm/arch-at91/clk.h => cpu/arm926ejs/at91/at91sam9rl_i2c.c (52%)
>>>  create mode 100644 drivers/i2c/atmel_i2c.c
>>>  create mode 100644 include/asm-arm/arch-at91/at91_twi.h
>>>
>>>   
>> [...]
>>> diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile
>>> index 9c74657..27a5251 100644
>>> --- a/drivers/i2c/Makefile
>>> +++ b/drivers/i2c/Makefile
>>> @@ -25,6 +25,7 @@ include $(TOPDIR)/config.mk
>>>  
>>>  LIB	:= $(obj)libi2c.a
>>>  
>>> +COBJS-$(CONFIG_I2C_ATMEL) += atmel_i2c.o
>>>  COBJS-$(CONFIG_BFIN_TWI_I2C) += bfin-twi_i2c.o
>>>  COBJS-$(CONFIG_FSL_I2C) += fsl_i2c.o
>>>  COBJS-$(CONFIG_I2C_MXC) += mxc_i2c.o
>>>   
>> Independent from your patch, I think we need here a common
>> rule. Either we name in future this define "CONFIG_I2C_XXX"
>> or "CONFIG_XXX_I2C. I vote for using "CONFIG_I2C_XXX"
> it's plan to clean up the driver CONFIG_ just before send the Kconfig patch
> series

Ah, ok, thanks.

>>> + *
>>> +*/
>>> +#include <common.h>
>>> +
>>> +#ifdef CONFIG_HARD_I2C
>>>   
>> Why not "#if defined(CONFIG_I2C_ATMEL)" as in the Makefile?
> until the Kconfig I'll prefer to keep the CONFIG_HARD_I2C

ok.

>>> +
>>> +#include <i2c.h>
>>> +#include <asm/io.h>
>>>   
>> [...]
>>> +	if (alen > 1)
>>> +		return 1;
>>> +	/* XXX assume an ATMEL AT24C16 */

[...]

>>> diff --git a/include/asm-arm/arch-at91/at91_twi.h b/include/asm-arm/arch-at91/at91_twi.h
>>> new file mode 100644
>>> index 0000000..bb2880f
>>> --- /dev/null
>>> +++ b/include/asm-arm/arch-at91/at91_twi.h
>>> @@ -0,0 +1,68 @@
>>> +/*
>>> + * arch/arm/mach-at91/include/mach/at91_twi.h
>>> + *
>>> + * Copyright (C) 2005 Ivan Kokshaysky
>>> + * Copyright (C) SAN People
>>> + *
>>> + * Two-wire Interface (TWI) registers.
>>> + * Based on AT91RM9200 datasheet revision E.
>>> + *
>>> + * 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.
>>> + */
>>> +
>>> +#ifndef AT91_TWI_H
>>> +#define AT91_TWI_H
>>> +
>>> +#define	AT91_TWI_CR		0x00		/* Control Register */
>>> +#define		AT91_TWI_START		(1 <<  0)	/* Send a Start Condition */
>>> +#define		AT91_TWI_STOP		(1 <<  1)	/* Send a Stop Condition */
>>> +#define		AT91_TWI_MSEN		(1 <<  2)	/* Master Transfer Enable */
>>> +#define		AT91_TWI_MSDIS		(1 <<  3)	/* Master Transfer Disable */
>>> +#define		AT91_TWI_SVEN		(1 <<  4)	/* Slave Transfer Enable [SAM9260 only] */
>>> +#define		AT91_TWI_SVDIS		(1 <<  5)	/* Slave Transfer Disable [SAM9260 only] */
>>> +#define		AT91_TWI_SWRST		(1 <<  7)	/* Software Reset */
>>>   
>>                  ^^^^^^^^^^^^^^^
>>                  doule tabs breaks line length (this affects for the
>> whole file)
>>
> I'll prefer to keep it as it because it's an import from Linux

Hmm.. maybe this should be fixed in Linux too.

bye
Heiko
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 12/13] at91: add hardware i2c drivers
  2009-03-30  8:26                           ` Heiko Schocher
@ 2009-03-30  8:50                             ` Jean-Christophe PLAGNIOL-VILLARD
  2009-03-30 10:43                               ` Wolfgang Denk
  0 siblings, 1 reply; 62+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-03-30  8:50 UTC (permalink / raw)
  To: u-boot

> >>> +#ifndef AT91_TWI_H
> >>> +#define AT91_TWI_H
> >>> +
> >>> +#define	AT91_TWI_CR		0x00		/* Control Register */
> >>> +#define		AT91_TWI_START		(1 <<  0)	/* Send a Start Condition */
> >>> +#define		AT91_TWI_STOP		(1 <<  1)	/* Send a Stop Condition */
> >>> +#define		AT91_TWI_MSEN		(1 <<  2)	/* Master Transfer Enable */
> >>> +#define		AT91_TWI_MSDIS		(1 <<  3)	/* Master Transfer Disable */
> >>> +#define		AT91_TWI_SVEN		(1 <<  4)	/* Slave Transfer Enable [SAM9260 only] */
> >>> +#define		AT91_TWI_SVDIS		(1 <<  5)	/* Slave Transfer Disable [SAM9260 only] */
> >>> +#define		AT91_TWI_SWRST		(1 <<  7)	/* Software Reset */
> >>>   
> >>                  ^^^^^^^^^^^^^^^
> >>                  doule tabs breaks line length (this affects for the
> >> whole file)
> >>
> > I'll prefer to keep it as it because it's an import from Linux
> 
> Hmm.. maybe this should be fixed in Linux too.
IMHO no because the double tab was use to align but field of the register

Best Regards,
J.

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 12/13] at91: add hardware i2c drivers
  2009-03-30  8:50                             ` Jean-Christophe PLAGNIOL-VILLARD
@ 2009-03-30 10:43                               ` Wolfgang Denk
  2009-03-30 11:55                                 ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 62+ messages in thread
From: Wolfgang Denk @ 2009-03-30 10:43 UTC (permalink / raw)
  To: u-boot

Dear Jean-Christophe PLAGNIOL-VILLARD,

In message <20090330085011.GA21302@game.jcrosoft.org> you wrote:
>
> > Hmm.. maybe this should be fixed in Linux too.
> IMHO no because the double tab was use to align but field of the register

It doesn't matter what it's being used for when it causes too long
lines.

Best regards,

Wolfgang Denk

-- 
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
Punishment becomes ineffective after a certain point. Men become  in-
sensitive.
	-- Eneg, "Patterns of Force", stardate 2534.7

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 12/13] at91: add hardware i2c drivers
  2009-03-30 10:43                               ` Wolfgang Denk
@ 2009-03-30 11:55                                 ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 62+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-03-30 11:55 UTC (permalink / raw)
  To: u-boot

On 12:43 Mon 30 Mar     , Wolfgang Denk wrote:
> Dear Jean-Christophe PLAGNIOL-VILLARD,
> 
> In message <20090330085011.GA21302@game.jcrosoft.org> you wrote:
> >
> > > Hmm.. maybe this should be fixed in Linux too.
> > IMHO no because the double tab was use to align but field of the register
> 
> It doesn't matter what it's being used for when it causes too long
> lines.
but it clearly an import from linux and I do want to be sync so I'll prefer to
not modify it to simplify the update and tacking

I'll send an e-mail to Andrew Victor to known if he is ok to split

Best Regards,
J.

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 10/13] at91: move usb driver to drivers/usb
  2009-03-27 22:30                 ` [U-Boot] [PATCH 10/13] at91: move usb driver to drivers/usb Jean-Christophe PLAGNIOL-VILLARD
  2009-03-27 22:30                   ` [U-Boot] [PATCH 11/13] at91: move dataflash spi driver to drivers/spi Jean-Christophe PLAGNIOL-VILLARD
@ 2009-03-31 18:28                   ` Remy Bohmer
  2009-03-31 19:21                     ` Jean-Christophe PLAGNIOL-VILLARD
  2009-03-31 20:36                     ` Wolfgang Denk
  1 sibling, 2 replies; 62+ messages in thread
From: Remy Bohmer @ 2009-03-31 18:28 UTC (permalink / raw)
  To: u-boot

Hello,

> ?drivers/usb/Makefile ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? | ? ?1 +
> ?.../at91/usb.c => drivers/usb/atmel_usb.c ? ? ? ? ?| ? ?0
> ?rename cpu/arm926ejs/at91/usb.c => drivers/usb/atmel_usb.c (100%)

Same here, this is architecture specific code, why move it to generic code?

Remy

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 10/13] at91: move usb driver to drivers/usb
  2009-03-31 18:28                   ` [U-Boot] [PATCH 10/13] at91: move usb driver to drivers/usb Remy Bohmer
@ 2009-03-31 19:21                     ` Jean-Christophe PLAGNIOL-VILLARD
  2009-03-31 20:38                       ` Wolfgang Denk
  2009-03-31 21:22                       ` Remy Bohmer
  2009-03-31 20:36                     ` Wolfgang Denk
  1 sibling, 2 replies; 62+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-03-31 19:21 UTC (permalink / raw)
  To: u-boot

On 20:28 Tue 31 Mar     , Remy Bohmer wrote:
> Hello,
> 
> > ?drivers/usb/Makefile ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? | ? ?1 +
> > ?.../at91/usb.c => drivers/usb/atmel_usb.c ? ? ? ? ?| ? ?0
> > ?rename cpu/arm926ejs/at91/usb.c => drivers/usb/atmel_usb.c (100%)
> 
> Same here, this is architecture specific code, why move it to generic code?
it's the at91 usb drivers and we need to have it in the driver/usb
and it's not at91/arm926 specific but it's also shared with the at91rm9200

so I move to drivers usb

please note that the RM9200 will be move to the at91 API next release

Best Regards,
J.

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 13/13] at91sam9263ek: active hush and auto compelete support
  2009-03-27 22:30                       ` [U-Boot] [PATCH 13/13] at91sam9263ek: active hush and auto compelete support Jean-Christophe PLAGNIOL-VILLARD
@ 2009-03-31 20:35                         ` Wolfgang Denk
  2009-03-31 22:42                           ` Stelian Pop
  0 siblings, 1 reply; 62+ messages in thread
From: Wolfgang Denk @ 2009-03-31 20:35 UTC (permalink / raw)
  To: u-boot

Dear Jean-Christophe PLAGNIOL-VILLARD,

In message <1238193026-12564-13-git-send-email-plagnioj@jcrosoft.com> you wrote:
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  include/configs/at91sam9263ek.h |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/include/configs/at91sam9263ek.h b/include/configs/at91sam9263ek.h
> index dd0d552..fc87241 100644
> --- a/include/configs/at91sam9263ek.h
> +++ b/include/configs/at91sam9263ek.h
> @@ -204,6 +204,9 @@
>  #define CONFIG_SYS_PBSIZE		(CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
>  #define CONFIG_SYS_LONGHELP		1
>  #define CONFIG_CMDLINE_EDITING	1
> +#define CONFIG_AUTO_COMPLETE
> +#define CONFIG_SYS_HUSH_PARSER
> +#define CONFIG_SYS_PROMPT_HUSH_PS2	"> "

You are not the maintainer of this board.

You are not supposed to make any such modifications without permission
of the board mainteiner.

Stelian, please comment.

Best regards,

Wolfgang Denk

-- 
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
When properly administered, vacations do not  diminish  productivity:
for every week you're away and get nothing done, there's another when
your boss is away and you get twice as much done.  -- Daniel B. Luten

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 10/13] at91: move usb driver to drivers/usb
  2009-03-31 18:28                   ` [U-Boot] [PATCH 10/13] at91: move usb driver to drivers/usb Remy Bohmer
  2009-03-31 19:21                     ` Jean-Christophe PLAGNIOL-VILLARD
@ 2009-03-31 20:36                     ` Wolfgang Denk
  1 sibling, 0 replies; 62+ messages in thread
From: Wolfgang Denk @ 2009-03-31 20:36 UTC (permalink / raw)
  To: u-boot

Dear Remy Bohmer,

In message <3efb10970903311128t2b9ac2dn4d4b1ee9022a855b@mail.gmail.com> you wrote:
>
> > ?drivers/usb/Makefile ? ? ? ? ? ? ? ? ? ? ? ? > ? ? ? | ? ?1 +
> > ?.../at91/usb.c => drivers/usb/atmel_usb.c ? ? ? ? ?| ? > ?0
> > ?rename cpu/arm926ejs/at91/usb.c => drivers/usb/atmel_usb.c (100%)
>
> Same here, this is architecture specific code, why move it to generic code?

I agree with Remy here. The modification makes no sense to me.

Please don't.

Best regards,

Wolfgang Denk

-- 
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 day," said a dull voice from down below, "I'm going to  be  back
in  form again and you're going to be very sorry you said that. For a
very long time. I might even go so far as to make even more Time just
for you to be sorry in."              - Terry Pratchett, _Small Gods_

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 10/13] at91: move usb driver to drivers/usb
  2009-03-31 19:21                     ` Jean-Christophe PLAGNIOL-VILLARD
@ 2009-03-31 20:38                       ` Wolfgang Denk
  2009-03-31 21:55                         ` Jean-Christophe PLAGNIOL-VILLARD
  2009-04-01  6:55                         ` Stefan Roese
  2009-03-31 21:22                       ` Remy Bohmer
  1 sibling, 2 replies; 62+ messages in thread
From: Wolfgang Denk @ 2009-03-31 20:38 UTC (permalink / raw)
  To: u-boot

Dear Jean-Christophe PLAGNIOL-VILLARD,

In message <20090331192117.GF24923@game.jcrosoft.org> you wrote:
>
> > > ?drivers/usb/Makefile ? ? ? ? ? ? ? ? ? ? ? ?>  ? ? ? | ? ?1 +
> > > ?.../at91/usb.c => drivers/usb/atmel_usb.c ? ? ? ? ?| ?>  ?0
> > > ?rename cpu/arm926ejs/at91/usb.c => drivers/usb/atmel_usb.c (100%)
> > >
> > Same here, this is architecture specific code, why move it to generic cod> e?
> it's the at91 usb drivers and we need to have it in the driver/usb

Why do we need to have it in the driver/usb ?

Please explain in detail.

> and it's not at91/arm926 specific but it's also shared with the at91rm9200
>
> so I move to drivers usb
>
> please note that the RM9200 will be move to the at91 API next release

So. Will it. Really? Who discussed this, and where, and when?
Please explain in detail.


Best regards,

Wolfgang Denk

-- 
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
Weekends were made for programming.                 - Karl Lehenbauer

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 12/13] at91: add hardware i2c drivers
  2009-03-30  5:53                       ` [U-Boot] [PATCH 12/13] at91: add hardware i2c drivers Heiko Schocher
  2009-03-30  7:24                         ` Jean-Christophe PLAGNIOL-VILLARD
@ 2009-03-31 20:40                         ` Wolfgang Denk
  1 sibling, 0 replies; 62+ messages in thread
From: Wolfgang Denk @ 2009-03-31 20:40 UTC (permalink / raw)
  To: u-boot

Dear Heiko Schocher,

In message <49D05E5F.6060000@denx.de> you wrote:
> 
...
> Independent from your patch, I think we need here a common
> rule. Either we name in future this define "CONFIG_I2C_XXX"
> or "CONFIG_XXX_I2C. I vote for using "CONFIG_I2C_XXX"

Me too.

...
> > +#ifdef CONFIG_HARD_I2C
> 
> Why not "#if defined(CONFIG_I2C_ATMEL)" as in the Makefile?

Excellent question.

> > +#if 0 /* EEPROM code already sets this correctly */
> > +		chip |= (addr >> 8) & 0xff;
> > +#endif
> >   
> 
> please remove dead code.

Agreed.

> > +#if 0 /* EEPROM code already sets this correctly */
> > +			chip |= (addr >> 8) & 0xff;
> > +#endif
> 
> here too, please remove dead code.

Ditto.


Best regards,

Wolfgang Denk

-- 
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
Anyone can count the seeds in an apple.
No one can count the apples in a seed.

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 10/13] at91: move usb driver to drivers/usb
  2009-03-31 19:21                     ` Jean-Christophe PLAGNIOL-VILLARD
  2009-03-31 20:38                       ` Wolfgang Denk
@ 2009-03-31 21:22                       ` Remy Bohmer
  1 sibling, 0 replies; 62+ messages in thread
From: Remy Bohmer @ 2009-03-31 21:22 UTC (permalink / raw)
  To: u-boot

Hello Jean-Christophe,

> it's the at91 usb drivers and we need to have it in the driver/usb
> and it's not at91/arm926 specific but it's also shared with the at91rm9200
> so I move to drivers usb

Then I can agree that the arm926 tree is not the correct place; but
that does not automatically make the generic driver code the right
place either...

Kind Regards,

Remy

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 10/13] at91: move usb driver to drivers/usb
  2009-03-31 20:38                       ` Wolfgang Denk
@ 2009-03-31 21:55                         ` Jean-Christophe PLAGNIOL-VILLARD
  2009-04-01  6:55                         ` Stefan Roese
  1 sibling, 0 replies; 62+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-03-31 21:55 UTC (permalink / raw)
  To: u-boot

On 22:38 Tue 31 Mar     , Wolfgang Denk wrote:
> Dear Jean-Christophe PLAGNIOL-VILLARD,
> 
> In message <20090331192117.GF24923@game.jcrosoft.org> you wrote:
> >
> > > > ?drivers/usb/Makefile ? ? ? ? ? ? ? ? ? ? ? ?>  ? ? ? | ? ?1 +
> > > > ?.../at91/usb.c => drivers/usb/atmel_usb.c ? ? ? ? ?| ?>  ?0
> > > > ?rename cpu/arm926ejs/at91/usb.c => drivers/usb/atmel_usb.c (100%)
> > > >
> > > Same here, this is architecture specific code, why move it to generic cod> e?
> > it's the at91 usb drivers and we need to have it in the driver/usb
> 
> Why do we need to have it in the driver/usb ?
> 
> Please explain in detail.
> 
> > and it's not at91/arm926 specific but it's also shared with the at91rm9200
> >
> > so I move to drivers usb
> >
> > please note that the RM9200 will be move to the at91 API next release
> 
> So. Will it. Really? Who discussed this, and where, and when?
> Please explain in detail.
as I said the usb drivers, spi, serial are shared between at91sam9, rm9200
and some with avr32
so do need to avoid copy and paste to each cpu specialy when it's drivers or
IP init not specific to a SOC

The RM9200 is in preparation and will be finished for the next merge window
so no patch has been yes published until it's finished

Best Regards,
J.

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 13/13] at91sam9263ek: active hush and auto compelete support
  2009-03-31 20:35                         ` Wolfgang Denk
@ 2009-03-31 22:42                           ` Stelian Pop
  0 siblings, 0 replies; 62+ messages in thread
From: Stelian Pop @ 2009-03-31 22:42 UTC (permalink / raw)
  To: u-boot

On Tue, Mar 31, 2009 at 10:35:00PM +0200, Wolfgang Denk wrote:

> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > +#define CONFIG_AUTO_COMPLETE
> > +#define CONFIG_SYS_HUSH_PARSER
> > +#define CONFIG_SYS_PROMPT_HUSH_PS2	"> "
> 
> You are not the maintainer of this board.
> 
> You are not supposed to make any such modifications without permission
> of the board mainteiner.
> 
> Stelian, please comment.

In the interest of keeping the various Atmel boards uniform, I'm ok
with this patch. So:
	Signed-off-by: Stelian Pop <stelian@popies.net>

JC: please CC: me directly next time, I'm rather busy lately and not
always following the posts on the mailing list...

Thanks !

-- 
Stelian Pop <stelian@popies.net>

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 10/13] at91: move usb driver to drivers/usb
  2009-03-31 20:38                       ` Wolfgang Denk
  2009-03-31 21:55                         ` Jean-Christophe PLAGNIOL-VILLARD
@ 2009-04-01  6:55                         ` Stefan Roese
  2009-04-01  7:25                           ` Remy Bohmer
  2009-04-01 15:48                           ` ksi at koi8.net
  1 sibling, 2 replies; 62+ messages in thread
From: Stefan Roese @ 2009-04-01  6:55 UTC (permalink / raw)
  To: u-boot

On Tuesday 31 March 2009, Wolfgang Denk wrote:
> In message <20090331192117.GF24923@game.jcrosoft.org> you wrote:
> > > > ?drivers/usb/Makefile ? ? ? ? ? ? ? ? ? ? ? ?>  ? ? ? | ? ?1 +
> > > > ?.../at91/usb.c => drivers/usb/atmel_usb.c ? ? ? ? ?| ?>  ?0
> > > > ?rename cpu/arm926ejs/at91/usb.c => drivers/usb/atmel_usb.c (100%)
> > >
> > > Same here, this is architecture specific code, why move it to generic
> > > cod> e?
> >
> > it's the at91 usb drivers and we need to have it in the driver/usb
>
> Why do we need to have it in the driver/usb ?
>
> Please explain in detail.

From what I remember we all agreed to move the device drivers (e.g. ethernet, 
NAND, USB, serial etc) from the architecture/board (cpu/... board/...) to the 
drivers directories at some time.

Speaking for PPC4xx, the 4xx ethernet driver has recently been moved from 
cpu/ppc4xx to drivers/net. And I'm planning to move the 4xx NAND driver (and 
others) soon too.

So if this atmel_usb.c driver isn't just platform USB init code, but a real 
USB driver, then I'm voting to move it to drivers/usb as well.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 10/13] at91: move usb driver to drivers/usb
  2009-04-01  7:25                           ` Remy Bohmer
@ 2009-04-01  7:22                             ` Jean-Christophe PLAGNIOL-VILLARD
  2009-04-01  7:57                               ` Remy Bohmer
  2009-04-01 15:53                             ` ksi at koi8.net
  1 sibling, 1 reply; 62+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-04-01  7:22 UTC (permalink / raw)
  To: u-boot

On 09:25 Wed 01 Apr     , Remy Bohmer wrote:
> Hello Stefan,
> 
> > From what I remember we all agreed to move the device drivers (e.g. ethernet,
> > NAND, USB, serial etc) from the architecture/board (cpu/... board/...) to the
> > drivers directories at some time.
> >
> > Speaking for PPC4xx, the 4xx ethernet driver has recently been moved from
> > cpu/ppc4xx to drivers/net. And I'm planning to move the 4xx NAND driver (and
> > others) soon too.
> >
> > So if this atmel_usb.c driver isn't just platform USB init code, but a real
> > USB driver, then I'm voting to move it to drivers/usb as well.
> 
> And that is exactly the issue here. The discussion is about moving
> 'platform USB init code' to generic driver code.
> I would have no problems with moving real USB drivers to the generic
> driver section, if they are cleaned from board specific code, of
> course.
in our case it's not a cpu specify init but an IP init which is share to
multiple soc for multiple arch

Best Regards,
J.

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 10/13] at91: move usb driver to drivers/usb
  2009-04-01  6:55                         ` Stefan Roese
@ 2009-04-01  7:25                           ` Remy Bohmer
  2009-04-01  7:22                             ` Jean-Christophe PLAGNIOL-VILLARD
  2009-04-01 15:53                             ` ksi at koi8.net
  2009-04-01 15:48                           ` ksi at koi8.net
  1 sibling, 2 replies; 62+ messages in thread
From: Remy Bohmer @ 2009-04-01  7:25 UTC (permalink / raw)
  To: u-boot

Hello Stefan,

> From what I remember we all agreed to move the device drivers (e.g. ethernet,
> NAND, USB, serial etc) from the architecture/board (cpu/... board/...) to the
> drivers directories at some time.
>
> Speaking for PPC4xx, the 4xx ethernet driver has recently been moved from
> cpu/ppc4xx to drivers/net. And I'm planning to move the 4xx NAND driver (and
> others) soon too.
>
> So if this atmel_usb.c driver isn't just platform USB init code, but a real
> USB driver, then I'm voting to move it to drivers/usb as well.

And that is exactly the issue here. The discussion is about moving
'platform USB init code' to generic driver code.
I would have no problems with moving real USB drivers to the generic
driver section, if they are cleaned from board specific code, of
course.


Kind Regards,

Remy

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 10/13] at91: move usb driver to drivers/usb
  2009-04-01  7:22                             ` Jean-Christophe PLAGNIOL-VILLARD
@ 2009-04-01  7:57                               ` Remy Bohmer
  2009-04-01  8:01                                 ` Jean-Christophe PLAGNIOL-VILLARD
  2009-04-01  8:13                                 ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 2 replies; 62+ messages in thread
From: Remy Bohmer @ 2009-04-01  7:57 UTC (permalink / raw)
  To: u-boot

Hello Jean-Christophe,

>> And that is exactly the issue here. The discussion is about moving
>> 'platform USB init code' to generic driver code.
>> I would have no problems with moving real USB drivers to the generic
>> driver section, if they are cleaned from board specific code, of
>> course.
> in our case it's not a cpu specify init but an IP init which is share to
> multiple soc for multiple arch

IMHO, that still does not justify it to make it part of the generic drivers.
And I already mentioned yesterday, that I agree that it does not
really belong in the cpu section as well.
We should not pollute one area by cleaning another area.

So, we seem to be lacking a SoC/board specific section, like the linux
kernel handles it.
Maybe we have to work on that?

Kind Regards,

Remy

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 10/13] at91: move usb driver to drivers/usb
  2009-04-01  7:57                               ` Remy Bohmer
@ 2009-04-01  8:01                                 ` Jean-Christophe PLAGNIOL-VILLARD
  2009-04-01  9:07                                   ` Wolfgang Denk
  2009-04-01  8:13                                 ` Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 1 reply; 62+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-04-01  8:01 UTC (permalink / raw)
  To: u-boot

On 09:57 Wed 01 Apr     , Remy Bohmer wrote:
> Hello Jean-Christophe,
> 
> >> And that is exactly the issue here. The discussion is about moving
> >> 'platform USB init code' to generic driver code.
> >> I would have no problems with moving real USB drivers to the generic
> >> driver section, if they are cleaned from board specific code, of
> >> course.
> > in our case it's not a cpu specify init but an IP init which is share to
> > multiple soc for multiple arch
> 
> IMHO, that still does not justify it to make it part of the generic drivers.
> And I already mentioned yesterday, that I agree that it does not
> really belong in the cpu section as well.
> We should not pollute one area by cleaning another area.
> 
> So, we seem to be lacking a SoC/board specific section, like the linux
> kernel handles it.
> Maybe we have to work on that?
actualy it's clearly not possible and I'll not ACK any patch that dupplicate
code in the boards specialy after clean up the duplicate hardware init.

Actually the best place is the drivers/usb/

Best Regards,
J.

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 10/13] at91: move usb driver to drivers/usb
  2009-04-01  7:57                               ` Remy Bohmer
  2009-04-01  8:01                                 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2009-04-01  8:13                                 ` Jean-Christophe PLAGNIOL-VILLARD
  2009-04-01  8:59                                   ` Michael Trimarchi
  1 sibling, 1 reply; 62+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-04-01  8:13 UTC (permalink / raw)
  To: u-boot

On 09:57 Wed 01 Apr     , Remy Bohmer wrote:
> Hello Jean-Christophe,
> 
> >> And that is exactly the issue here. The discussion is about moving
> >> 'platform USB init code' to generic driver code.
> >> I would have no problems with moving real USB drivers to the generic
> >> driver section, if they are cleaned from board specific code, of
> >> course.
> > in our case it's not a cpu specify init but an IP init which is share to
> > multiple soc for multiple arch
> 
> IMHO, that still does not justify it to make it part of the generic drivers.
> And I already mentioned yesterday, that I agree that it does not
> really belong in the cpu section as well.
> We should not pollute one area by cleaning another area.
> 
> So, we seem to be lacking a SoC/board specific section, like the linux
> kernel handles it.
btw in linux the similar usb code is here
drivers/usb/host/ohci-at91.c

Best Regards,
J.

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 10/13] at91: move usb driver to drivers/usb
  2009-04-01  8:13                                 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2009-04-01  8:59                                   ` Michael Trimarchi
  2009-04-01  9:27                                     ` Stefan Roese
  0 siblings, 1 reply; 62+ messages in thread
From: Michael Trimarchi @ 2009-04-01  8:59 UTC (permalink / raw)
  To: u-boot

Hi,

Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 09:57 Wed 01 Apr     , Remy Bohmer wrote:
>   
>> Hello Jean-Christophe,
>>
>>     
>>>> And that is exactly the issue here. The discussion is about moving
>>>> 'platform USB init code' to generic driver code.
>>>> I would have no problems with moving real USB drivers to the generic
>>>> driver section, if they are cleaned from board specific code, of
>>>> course.
>>>>         
>>> in our case it's not a cpu specify init but an IP init which is share to
>>> multiple soc for multiple arch
>>>       
>> IMHO, that still does not justify it to make it part of the generic drivers.
>> And I already mentioned yesterday, that I agree that it does not
>> really belong in the cpu section as well.
>> We should not pollute one area by cleaning another area.
>>
>> So, we seem to be lacking a SoC/board specific section, like the linux
>> kernel handles it.
>>     
> btw in linux the similar usb code is here
> drivers/usb/host/ohci-at91.c
>
> Best Regards,
> J.
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
>   

It is just a glue code in linux. Maybe it will be simple if you create a 
core direcory
and a host directory under the usb. An move the specific part in the host.

Michael

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 10/13] at91: move usb driver to drivers/usb
  2009-04-01  8:01                                 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2009-04-01  9:07                                   ` Wolfgang Denk
  0 siblings, 0 replies; 62+ messages in thread
From: Wolfgang Denk @ 2009-04-01  9:07 UTC (permalink / raw)
  To: u-boot

Dear Jean-Christophe PLAGNIOL-VILLARD,

In message <20090401080151.GB23893@game.jcrosoft.org> you wrote:
>
> Actually the best place is the drivers/usb/

I agree with Remy: "We should not pollute one area by cleaning another
area."

Best regards,

Wolfgang Denk

-- 
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
About the use of language: it is impossible to sharpen a pencil  with
a  blunt  ax.  It is equally vain to try to do it with ten blunt axes
instead.                                           -- Edsger Dijkstra

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 10/13] at91: move usb driver to drivers/usb
  2009-04-01  8:59                                   ` Michael Trimarchi
@ 2009-04-01  9:27                                     ` Stefan Roese
  2009-04-01  9:44                                       ` Jean-Christophe PLAGNIOL-VILLARD
  2009-04-01 15:56                                       ` [U-Boot] [PATCH 10/13] at91: move usb driver to drivers/usb ksi at koi8.net
  0 siblings, 2 replies; 62+ messages in thread
From: Stefan Roese @ 2009-04-01  9:27 UTC (permalink / raw)
  To: u-boot

On Wednesday 01 April 2009, Michael Trimarchi wrote:
> It is just a glue code in linux. Maybe it will be simple if you create a
> core direcory
> and a host directory under the usb. An move the specific part in the host.

Yes, I like this idea. This gets us closer to the Linux directory structure.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 10/13] at91: move usb driver to drivers/usb
  2009-04-01  9:27                                     ` Stefan Roese
@ 2009-04-01  9:44                                       ` Jean-Christophe PLAGNIOL-VILLARD
  2009-04-01 12:19                                         ` Stefan Roese
  2009-04-01 15:56                                       ` [U-Boot] [PATCH 10/13] at91: move usb driver to drivers/usb ksi at koi8.net
  1 sibling, 1 reply; 62+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-04-01  9:44 UTC (permalink / raw)
  To: u-boot

On 11:27 Wed 01 Apr     , Stefan Roese wrote:
> On Wednesday 01 April 2009, Michael Trimarchi wrote:
> > It is just a glue code in linux. Maybe it will be simple if you create a
> > core direcory
> > and a host directory under the usb. An move the specific part in the host.
> 
> Yes, I like this idea. This gets us closer to the Linux directory structure.
I like too
so at the same time we could do the same for the device

Best Regards,
J.

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 10/13] at91: move usb driver to drivers/usb
  2009-04-01  9:44                                       ` Jean-Christophe PLAGNIOL-VILLARD
@ 2009-04-01 12:19                                         ` Stefan Roese
  2009-04-01 17:21                                           ` [U-Boot] [RFC PATCH] drivers/usb: regorganisation Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 62+ messages in thread
From: Stefan Roese @ 2009-04-01 12:19 UTC (permalink / raw)
  To: u-boot

On Wednesday 01 April 2009, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 11:27 Wed 01 Apr     , Stefan Roese wrote:
> > On Wednesday 01 April 2009, Michael Trimarchi wrote:
> > > It is just a glue code in linux. Maybe it will be simple if you create
> > > a core direcory
> > > and a host directory under the usb. An move the specific part in the
> > > host.
> >
> > Yes, I like this idea. This gets us closer to the Linux directory
> > structure.
>
> I like too
> so at the same time we could do the same for the device

Exactly.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 10/13] at91: move usb driver to drivers/usb
  2009-04-01  6:55                         ` Stefan Roese
  2009-04-01  7:25                           ` Remy Bohmer
@ 2009-04-01 15:48                           ` ksi at koi8.net
  2009-04-01 16:03                             ` Michael Trimarchi
                                               ` (2 more replies)
  1 sibling, 3 replies; 62+ messages in thread
From: ksi at koi8.net @ 2009-04-01 15:48 UTC (permalink / raw)
  To: u-boot

On Wed, 1 Apr 2009, Stefan Roese wrote:

> On Tuesday 31 March 2009, Wolfgang Denk wrote:
> > In message <20090331192117.GF24923@game.jcrosoft.org> you wrote:
> > > > > ?drivers/usb/Makefile ? ? ? ? ? ? ? ? ? ? ? ?>  ? ? ? | ? ?1 +
> > > > > ?.../at91/usb.c => drivers/usb/atmel_usb.c ? ? ? ? ?| ?>  ?0
> > > > > ?rename cpu/arm926ejs/at91/usb.c => drivers/usb/atmel_usb.c
> (100%)
> > > >
> > > > Same here, this is architecture specific code, why move it to
> generic
> > > > cod> e?
> > >
> > > it's the at91 usb drivers and we need to have it in the driver/usb
> >
> > Why do we need to have it in the driver/usb ?
> >
> > Please explain in detail.
> 
> >From what I remember we all agreed to move the device drivers (e.g.
> ethernet, 
> NAND, USB, serial etc) from the architecture/board (cpu/... board/...)
> to the 
> drivers directories at some time.
> 
> Speaking for PPC4xx, the 4xx ethernet driver has recently been moved
> from 
> cpu/ppc4xx to drivers/net. And I'm planning to move the 4xx NAND driver
> (and 
> others) soon too.
> 
> So if this atmel_usb.c driver isn't just platform USB init code, but a
> real 
> USB driver, then I'm voting to move it to drivers/usb as well.

I also vote for moving _ALL_ the drivers (i2c, usb, net, etc.) to
appropriate directories under drivers/ no matter architecture specific they
are or not.

This will make the tree more logical and one wouldn't have to chase say USB
driver all over the source tree.

Also it is a first step to general overhaul that would allow for multiple
drivers support. The fact some SoC has a built-in, say USB controller does
_NOT_ mean there is no more USB controllers on the same board. Some can be
on PCI bus etc. The same is true for each and every other driver. And we
should _NOT_ treat some drivers (e.g. SPI) as marginal. AT91RM9200 for
example can _NOT_ boot off of parallel flash because of silicon error so it
boots off of SPI DataFlash thus making SPI driver essential for the system.

To contain drivers is a reason for drivers/* to exist, isn't it?

---
******************************************************************
*  KSI at home    KOI8 Net  < >  The impossible we do immediately.  *
*  Las Vegas   NV, USA   < >  Miracles require 24-hour notice.   *
******************************************************************

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 10/13] at91: move usb driver to drivers/usb
  2009-04-01  7:25                           ` Remy Bohmer
  2009-04-01  7:22                             ` Jean-Christophe PLAGNIOL-VILLARD
@ 2009-04-01 15:53                             ` ksi at koi8.net
  1 sibling, 0 replies; 62+ messages in thread
From: ksi at koi8.net @ 2009-04-01 15:53 UTC (permalink / raw)
  To: u-boot

On Wed, 1 Apr 2009, Remy Bohmer wrote:

> Hello Stefan,
> 
> > From what I remember we all agreed to move the device drivers (e.g.
> ethernet,
> > NAND, USB, serial etc) from the architecture/board (cpu/... board/...)
> to the
> > drivers directories at some time.
> >
> > Speaking for PPC4xx, the 4xx ethernet driver has recently been moved
> from
> > cpu/ppc4xx to drivers/net. And I'm planning to move the 4xx NAND
> driver (and
> > others) soon too.
> >
> > So if this atmel_usb.c driver isn't just platform USB init code, but a
> real
> > USB driver, then I'm voting to move it to drivers/usb as well.
> 
> And that is exactly the issue here. The discussion is about moving
> 'platform USB init code' to generic driver code.
> I would have no problems with moving real USB drivers to the generic
> driver section, if they are cleaned from board specific code, of
> course.

Board specific code belongs to $(BOARD).c. It does _NOT_ belong to cpu/*
either so it should be moved to $(BOARD).c no matter where that platform
driver resides.

That is why we should put something like platform_$(DRIVER)_init() in all
those drivers (most of them do already have it, see e.g. I2C drivers) and
move that portion in board specific functions in $(BOARD).c.

---
******************************************************************
*  KSI at home    KOI8 Net  < >  The impossible we do immediately.  *
*  Las Vegas   NV, USA   < >  Miracles require 24-hour notice.   *
******************************************************************

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 10/13] at91: move usb driver to drivers/usb
  2009-04-01  9:27                                     ` Stefan Roese
  2009-04-01  9:44                                       ` Jean-Christophe PLAGNIOL-VILLARD
@ 2009-04-01 15:56                                       ` ksi at koi8.net
  1 sibling, 0 replies; 62+ messages in thread
From: ksi at koi8.net @ 2009-04-01 15:56 UTC (permalink / raw)
  To: u-boot

On Wed, 1 Apr 2009, Stefan Roese wrote:

> On Wednesday 01 April 2009, Michael Trimarchi wrote:
> > It is just a glue code in linux. Maybe it will be simple if you create
> a
> > core direcory
> > and a host directory under the usb. An move the specific part in the
> host.
> 
> Yes, I like this idea. This gets us closer to the Linux directory
> structure.

I agree. Drivers are going under drivers/ so it is OK. Generic ones should
be kept right under drivers/something, platform specific go under
drivers/something/host.

---
******************************************************************
*  KSI at home    KOI8 Net  < >  The impossible we do immediately.  *
*  Las Vegas   NV, USA   < >  Miracles require 24-hour notice.   *
******************************************************************

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 10/13] at91: move usb driver to drivers/usb
  2009-04-01 15:48                           ` ksi at koi8.net
@ 2009-04-01 16:03                             ` Michael Trimarchi
  2009-04-01 16:31                               ` Jean-Christophe PLAGNIOL-VILLARD
  2009-04-01 16:28                             ` Jean-Christophe PLAGNIOL-VILLARD
  2009-04-01 19:42                             ` Scott Wood
  2 siblings, 1 reply; 62+ messages in thread
From: Michael Trimarchi @ 2009-04-01 16:03 UTC (permalink / raw)
  To: u-boot

ksi at koi8.net wrote:
> On Wed, 1 Apr 2009, Stefan Roese wrote:
>
>   
>> On Tuesday 31 March 2009, Wolfgang Denk wrote:
>>     
>>> In message <20090331192117.GF24923@game.jcrosoft.org> you wrote:
>>>       
>>>>>>  drivers/usb/Makefile                        >        |    1 +
>>>>>>  .../at91/usb.c => drivers/usb/atmel_usb.c          |  >   0
>>>>>>  rename cpu/arm926ejs/at91/usb.c => drivers/usb/atmel_usb.c
>>>>>>             
>> (100%)
>>     
>>>>> Same here, this is architecture specific code, why move it to
>>>>>           
>> generic
>>     
>>>>> cod> e?
>>>>>           
>>>> it's the at91 usb drivers and we need to have it in the driver/usb
>>>>         
>>> Why do we need to have it in the driver/usb ?
>>>
>>> Please explain in detail.
>>>       
>> >From what I remember we all agreed to move the device drivers (e.g.
>> ethernet, 
>> NAND, USB, serial etc) from the architecture/board (cpu/... board/...)
>> to the 
>> drivers directories at some time.
>>
>> Speaking for PPC4xx, the 4xx ethernet driver has recently been moved
>> from 
>> cpu/ppc4xx to drivers/net. And I'm planning to move the 4xx NAND driver
>> (and 
>> others) soon too.
>>
>> So if this atmel_usb.c driver isn't just platform USB init code, but a
>> real 
>> USB driver, then I'm voting to move it to drivers/usb as well.
>>     
>
> I also vote for moving _ALL_ the drivers (i2c, usb, net, etc.) to
> appropriate directories under drivers/ no matter architecture specific they
> are or not.
>
> This will make the tree more logical and one wouldn't have to chase say USB
> driver all over the source tree.
>
> Also it is a first step to general overhaul that would allow for multiple
> drivers support. The fact some SoC has a built-in, say USB controller does
> _NOT_ mean there is no more USB controllers on the same board. Some can be
> on PCI bus etc. The same is true for each and every other driver. And we
> should _NOT_ treat some drivers (e.g. SPI) as marginal. AT91RM9200 for
> example can _NOT_ boot off of parallel flash because of silicon error so it
> boots off of SPI DataFlash thus making SPI driver essential for the system.
>
> To contain drivers is a reason for drivers/* to exist, isn't it?
>
> ---
> ******************************************************************
> *  KSI at home    KOI8 Net  < >  The impossible we do immediately.  *
> *  Las Vegas   NV, USA   < >  Miracles require 24-hour notice.   *
> ******************************************************************
> ------------------------------------------------------------------------
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>   
Somenthing like that for usb?

:-----core
: :-----include
:-----device
: :-----include
:-----host
: :-----include

Michael



-------------- next part --------------
A non-text attachment was scrubbed...
Name: makefile.patch
Type: text/x-patch
Size: 2040 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090401/afea2e02/attachment.bin 

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 10/13] at91: move usb driver to drivers/usb
  2009-04-01 15:48                           ` ksi at koi8.net
  2009-04-01 16:03                             ` Michael Trimarchi
@ 2009-04-01 16:28                             ` Jean-Christophe PLAGNIOL-VILLARD
  2009-04-01 19:42                             ` Scott Wood
  2 siblings, 0 replies; 62+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-04-01 16:28 UTC (permalink / raw)
  To: u-boot

> And we
> should _NOT_ treat some drivers (e.g. SPI) as marginal. AT91RM9200 for
> example can _NOT_ boot off of parallel flash because of silicon error so it
> boots off of SPI DataFlash thus making SPI driver essential for the system.
no the RM9200 can boot from NOR Flash I do it myself
maybe not on some old RM9200 rev

Best Regards,
J.

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 10/13] at91: move usb driver to drivers/usb
  2009-04-01 16:03                             ` Michael Trimarchi
@ 2009-04-01 16:31                               ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 62+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-04-01 16:31 UTC (permalink / raw)
  To: u-boot

On 18:03 Wed 01 Apr     , Michael Trimarchi wrote:
> ksi at koi8.net wrote:
>> On Wed, 1 Apr 2009, Stefan Roese wrote:
>>
>>   
>>> On Tuesday 31 March 2009, Wolfgang Denk wrote:
>>>     
>>>> In message <20090331192117.GF24923@game.jcrosoft.org> you wrote:
>>>>       
>>>>>>>  drivers/usb/Makefile                        >        |    1 +
>>>>>>>  .../at91/usb.c => drivers/usb/atmel_usb.c          |  >   0
>>>>>>>  rename cpu/arm926ejs/at91/usb.c => drivers/usb/atmel_usb.c
>>>>>>>             
>>> (100%)
>>>     
>>>>>> Same here, this is architecture specific code, why move it to
>>>>>>           
>>> generic
>>>     
>>>>>> cod> e?
>>>>>>           
>>>>> it's the at91 usb drivers and we need to have it in the driver/usb
>>>>>         
>>>> Why do we need to have it in the driver/usb ?
>>>>
>>>> Please explain in detail.
>>>>       
>>> >From what I remember we all agreed to move the device drivers (e.g.
>>> ethernet, NAND, USB, serial etc) from the architecture/board (cpu/... 
>>> board/...)
>>> to the drivers directories at some time.
>>>
>>> Speaking for PPC4xx, the 4xx ethernet driver has recently been moved
>>> from cpu/ppc4xx to drivers/net. And I'm planning to move the 4xx NAND 
>>> driver
>>> (and others) soon too.
>>>
>>> So if this atmel_usb.c driver isn't just platform USB init code, but a
>>> real USB driver, then I'm voting to move it to drivers/usb as well.
>>>     
>>
>> I also vote for moving _ALL_ the drivers (i2c, usb, net, etc.) to
>> appropriate directories under drivers/ no matter architecture specific they
>> are or not.
>>
>> This will make the tree more logical and one wouldn't have to chase say USB
>> driver all over the source tree.
>>
>> Also it is a first step to general overhaul that would allow for multiple
>> drivers support. The fact some SoC has a built-in, say USB controller does
>> _NOT_ mean there is no more USB controllers on the same board. Some can be
>> on PCI bus etc. The same is true for each and every other driver. And we
>> should _NOT_ treat some drivers (e.g. SPI) as marginal. AT91RM9200 for
>> example can _NOT_ boot off of parallel flash because of silicon error so it
>> boots off of SPI DataFlash thus making SPI driver essential for the system.
>>
>> To contain drivers is a reason for drivers/* to exist, isn't it?
>>
>> ---
>> ******************************************************************
>> *  KSI at home    KOI8 Net  < >  The impossible we do immediately.  *
>> *  Las Vegas   NV, USA   < >  Miracles require 24-hour notice.   *
>> ******************************************************************
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> U-Boot mailing list
>> U-Boot at lists.denx.de
>> http://lists.denx.de/mailman/listinfo/u-boot
>>   
> Somenthing like that for usb?
>
> :-----core
> : :-----include
> :-----device
> : :-----include
> :-----host
> : :-----include
include is a few overkill

code
host
gadget

I've in mind

Best Regards,
J.

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [RFC PATCH] drivers/usb: regorganisation
  2009-04-01 12:19                                         ` Stefan Roese
@ 2009-04-01 17:21                                           ` Jean-Christophe PLAGNIOL-VILLARD
  2009-04-01 22:12                                             ` Wolfgang Denk
  2009-04-02 11:11                                             ` [U-Boot] [RFC PATCH] " Mike Frysinger
  0 siblings, 2 replies; 62+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-04-01 17:21 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
better description will be wrote for the final patch

Best Regards,
J.
 Makefile                                     |    4 +++-
 drivers/usb/{ => core}/Makefile              |   22 +---------------------
 drivers/usb/{ => core}/usb_ehci_core.c       |    2 +-
 drivers/usb/{ => core}/usb_ohci.c            |    2 +-
 drivers/usb/{ => core}/usbdcore.c            |    2 +-
 drivers/usb/{ => gadget}/Makefile            |   19 +------------------
 drivers/usb/{ => gadget}/usbdcore_ep0.c      |    2 +-
 drivers/usb/{ => gadget}/usbdcore_mpc8xx.c   |    4 ++--
 drivers/usb/{ => gadget}/usbdcore_omap1510.c |    4 ++--
 drivers/usb/{ => host}/Makefile              |   15 +--------------
 drivers/usb/{ => host}/davinci_usb.c         |    0
 drivers/usb/{ => host}/davinci_usb.h         |    0
 drivers/usb/{ => host}/isp116x-hcd.c         |    0
 drivers/usb/{ => host}/isp116x.h             |    0
 drivers/usb/{ => host}/musb_core.c           |    0
 drivers/usb/{ => host}/musb_core.h           |    0
 drivers/usb/{ => host}/musb_hcd.c            |    0
 drivers/usb/{ => host}/musb_hcd.h            |    0
 drivers/usb/{ => host}/r8a66597-hcd.c        |    0
 drivers/usb/{ => host}/r8a66597.h            |    0
 drivers/usb/{ => host}/sl811.h               |    0
 drivers/usb/{ => host}/sl811_usb.c           |    2 +-
 drivers/usb/{ => host}/usb_ehci_fsl.c        |    5 ++---
 drivers/usb/{ => host}/usb_ehci_fsl.h        |    0
 drivers/usb/{ => host}/usb_ehci_ixp.c        |    4 ++--
 drivers/usb/{ => host}/usb_ehci_pci.c        |    4 ++--
 drivers/usb/{ => host}/usb_ehci_vct.c        |    5 ++---
 {drivers/usb => include}/usb_ehci.h          |    0
 {drivers/usb => include}/usb_ehci_core.h     |    0
 {drivers/usb => include}/usb_ohci.h          |    0
 30 files changed, 23 insertions(+), 73 deletions(-)
 copy drivers/usb/{ => core}/Makefile (67%)
 rename drivers/usb/{ => core}/usb_ehci_core.c (99%)
 rename drivers/usb/{ => core}/usb_ohci.c (99%)
 rename drivers/usb/{ => core}/usbdcore.c (99%)
 copy drivers/usb/{ => gadget}/Makefile (71%)
 rename drivers/usb/{ => gadget}/usbdcore_ep0.c (99%)
 rename drivers/usb/{ => gadget}/usbdcore_mpc8xx.c (99%)
 rename drivers/usb/{ => gadget}/usbdcore_omap1510.c (99%)
 rename drivers/usb/{ => host}/Makefile (82%)
 rename drivers/usb/{ => host}/davinci_usb.c (100%)
 rename drivers/usb/{ => host}/davinci_usb.h (100%)
 rename drivers/usb/{ => host}/isp116x-hcd.c (100%)
 rename drivers/usb/{ => host}/isp116x.h (100%)
 rename drivers/usb/{ => host}/musb_core.c (100%)
 rename drivers/usb/{ => host}/musb_core.h (100%)
 rename drivers/usb/{ => host}/musb_hcd.c (100%)
 rename drivers/usb/{ => host}/musb_hcd.h (100%)
 rename drivers/usb/{ => host}/r8a66597-hcd.c (100%)
 rename drivers/usb/{ => host}/r8a66597.h (100%)
 rename drivers/usb/{ => host}/sl811.h (100%)
 rename drivers/usb/{ => host}/sl811_usb.c (99%)
 rename drivers/usb/{ => host}/usb_ehci_fsl.c (98%)
 rename drivers/usb/{ => host}/usb_ehci_fsl.h (100%)
 rename drivers/usb/{ => host}/usb_ehci_ixp.c (96%)
 rename drivers/usb/{ => host}/usb_ehci_pci.c (97%)
 rename drivers/usb/{ => host}/usb_ehci_vct.c (96%)
 rename {drivers/usb => include}/usb_ehci.h (100%)
 rename {drivers/usb => include}/usb_ehci_core.h (100%)
 rename {drivers/usb => include}/usb_ohci.h (100%)

diff --git a/Makefile b/Makefile
index 1cce381..cad21ac 100644
--- a/Makefile
+++ b/Makefile
@@ -262,7 +262,9 @@ TAG_SUBDIRS += cpu/mpc8xxx
 endif
 LIBS += drivers/rtc/librtc.a
 LIBS += drivers/serial/libserial.a
-LIBS += drivers/usb/libusb.a
+LIBS += drivers/usb/core/libusb_core.a
+LIBS += drivers/usb/gadget/libusb_gadget.a
+LIBS += drivers/usb/host/libusb_host.a
 LIBS += drivers/video/libvideo.a
 LIBS += common/libcommon.a
 LIBS += libfdt/libfdt.a
diff --git a/drivers/usb/Makefile b/drivers/usb/core/Makefile
similarity index 67%
copy from drivers/usb/Makefile
copy to drivers/usb/core/Makefile
index b306a65..249da4b 100644
--- a/drivers/usb/Makefile
+++ b/drivers/usb/core/Makefile
@@ -23,32 +23,12 @@
 
 include $(TOPDIR)/config.mk
 
-LIB	:= $(obj)libusb.a
+LIB	:= $(obj)libusb_core.a
 
-# core
 COBJS-y += usbdcore.o
 COBJS-$(CONFIG_USB_OHCI_NEW) += usb_ohci.o
 COBJS-$(CONFIG_USB_EHCI) += usb_ehci_core.o
 
-# host
-COBJS-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o
-COBJS-$(CONFIG_USB_R8A66597_HCD) += r8a66597-hcd.o
-COBJS-$(CONFIG_USB_SL811HS) += sl811_usb.o
-COBJS-$(CONFIG_USB_EHCI_FSL) += usb_ehci_fsl.o
-COBJS-$(CONFIG_USB_EHCI_PCI) += usb_ehci_pci.o
-COBJS-$(CONFIG_USB_EHCI_IXP4XX) += usb_ehci_ixp.o
-COBJS-$(CONFIG_MUSB_HCD) += musb_hcd.o musb_core.o
-COBJS-$(CONFIG_USB_DAVINCI) += davinci_usb.o
-COBJS-$(CONFIG_USB_EHCI_VCT) += usb_ehci_vct.o
-
-# device
-ifdef CONFIG_USB_DEVICE
-COBJS-y += usbdcore_ep0.o
-COBJS-$(CONFIG_OMAP1510) += usbdcore_omap1510.o
-COBJS-$(CONFIG_OMAP1610) += usbdcore_omap1510.o
-COBJS-$(CONFIG_MPC885_FAMILY) += usbdcore_mpc8xx.o
-endif
-
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS))
diff --git a/drivers/usb/usb_ehci_core.c b/drivers/usb/core/usb_ehci_core.c
similarity index 99%
rename from drivers/usb/usb_ehci_core.c
rename to drivers/usb/core/usb_ehci_core.c
index 4dbfb66..081622b 100644
--- a/drivers/usb/usb_ehci_core.c
+++ b/drivers/usb/core/usb_ehci_core.c
@@ -25,7 +25,7 @@
 #include <usb.h>
 #include <asm/io.h>
 #include <malloc.h>
-#include "usb_ehci.h"
+#include <usb_ehci.h>
 
 int rootdev;
 struct ehci_hccr *hccr;	/* R/O registers, not need for volatile */
diff --git a/drivers/usb/usb_ohci.c b/drivers/usb/core/usb_ohci.c
similarity index 99%
rename from drivers/usb/usb_ohci.c
rename to drivers/usb/core/usb_ohci.c
index 0bbee0f..464dbe2 100644
--- a/drivers/usb/usb_ohci.c
+++ b/drivers/usb/core/usb_ohci.c
@@ -57,7 +57,7 @@
 
 #include <malloc.h>
 #include <usb.h>
-#include "usb_ohci.h"
+#include <usb_ohci.h>
 
 #ifdef CONFIG_AT91RM9200
 #include <asm/arch/hardware.h>	/* needed for AT91_USB_HOST_BASE */
diff --git a/drivers/usb/usbdcore.c b/drivers/usb/core/usbdcore.c
similarity index 99%
rename from drivers/usb/usbdcore.c
rename to drivers/usb/core/usbdcore.c
index 53ed669..7955096 100644
--- a/drivers/usb/usbdcore.c
+++ b/drivers/usb/core/usbdcore.c
@@ -30,7 +30,7 @@
  */
 
 #include <malloc.h>
-#include "usbdcore.h"
+#include <usbdcore.h>
 
 #define MAX_INTERFACES 2
 
diff --git a/drivers/usb/Makefile b/drivers/usb/gadget/Makefile
similarity index 71%
copy from drivers/usb/Makefile
copy to drivers/usb/gadget/Makefile
index b306a65..933eac9 100644
--- a/drivers/usb/Makefile
+++ b/drivers/usb/gadget/Makefile
@@ -23,25 +23,8 @@
 
 include $(TOPDIR)/config.mk
 
-LIB	:= $(obj)libusb.a
+LIB	:= $(obj)libusb_gadget.a
 
-# core
-COBJS-y += usbdcore.o
-COBJS-$(CONFIG_USB_OHCI_NEW) += usb_ohci.o
-COBJS-$(CONFIG_USB_EHCI) += usb_ehci_core.o
-
-# host
-COBJS-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o
-COBJS-$(CONFIG_USB_R8A66597_HCD) += r8a66597-hcd.o
-COBJS-$(CONFIG_USB_SL811HS) += sl811_usb.o
-COBJS-$(CONFIG_USB_EHCI_FSL) += usb_ehci_fsl.o
-COBJS-$(CONFIG_USB_EHCI_PCI) += usb_ehci_pci.o
-COBJS-$(CONFIG_USB_EHCI_IXP4XX) += usb_ehci_ixp.o
-COBJS-$(CONFIG_MUSB_HCD) += musb_hcd.o musb_core.o
-COBJS-$(CONFIG_USB_DAVINCI) += davinci_usb.o
-COBJS-$(CONFIG_USB_EHCI_VCT) += usb_ehci_vct.o
-
-# device
 ifdef CONFIG_USB_DEVICE
 COBJS-y += usbdcore_ep0.o
 COBJS-$(CONFIG_OMAP1510) += usbdcore_omap1510.o
diff --git a/drivers/usb/usbdcore_ep0.c b/drivers/usb/gadget/usbdcore_ep0.c
similarity index 99%
rename from drivers/usb/usbdcore_ep0.c
rename to drivers/usb/gadget/usbdcore_ep0.c
index f6e017d..a1a117d 100644
--- a/drivers/usb/usbdcore_ep0.c
+++ b/drivers/usb/gadget/usbdcore_ep0.c
@@ -51,7 +51,7 @@
  */
 
 #include <common.h>
-#include "usbdcore.h"
+#include <usbdcore.h>
 
 #if 0
 #define dbg_ep0(lvl,fmt,args...) serial_printf("[%s] %s:%d: "fmt"\n",__FILE__,__FUNCTION__,__LINE__,##args)
diff --git a/drivers/usb/usbdcore_mpc8xx.c b/drivers/usb/gadget/usbdcore_mpc8xx.c
similarity index 99%
rename from drivers/usb/usbdcore_mpc8xx.c
rename to drivers/usb/gadget/usbdcore_mpc8xx.c
index 0e311ad..e2439cd 100644
--- a/drivers/usb/usbdcore_mpc8xx.c
+++ b/drivers/usb/gadget/usbdcore_mpc8xx.c
@@ -59,9 +59,9 @@
 #include <common.h>
 #include <config.h>
 #include <commproc.h>
-#include "usbdcore.h"
+#include <usbdcore.h>
 #include "usbdcore_mpc8xx.h"
-#include "usbdcore_ep0.h"
+#include <usbdcore_ep0.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/drivers/usb/usbdcore_omap1510.c b/drivers/usb/gadget/usbdcore_omap1510.c
similarity index 99%
rename from drivers/usb/usbdcore_omap1510.c
rename to drivers/usb/gadget/usbdcore_omap1510.c
index 6b7b61b..4fb6cc5 100644
--- a/drivers/usb/usbdcore_omap1510.c
+++ b/drivers/usb/gadget/usbdcore_omap1510.c
@@ -32,9 +32,9 @@
 #include <i2c.h>
 #endif
 
-#include "usbdcore.h"
+#include <usbdcore.h>
 #include "usbdcore_omap1510.h"
-#include "usbdcore_ep0.h"
+#include <usbdcore_ep0.h>
 
 
 #define UDC_INIT_MDELAY		     80 /* Device settle delay */
diff --git a/drivers/usb/Makefile b/drivers/usb/host/Makefile
similarity index 82%
rename from drivers/usb/Makefile
rename to drivers/usb/host/Makefile
index b306a65..240bc36 100644
--- a/drivers/usb/Makefile
+++ b/drivers/usb/host/Makefile
@@ -23,12 +23,7 @@
 
 include $(TOPDIR)/config.mk
 
-LIB	:= $(obj)libusb.a
-
-# core
-COBJS-y += usbdcore.o
-COBJS-$(CONFIG_USB_OHCI_NEW) += usb_ohci.o
-COBJS-$(CONFIG_USB_EHCI) += usb_ehci_core.o
+LIB	:= $(obj)libusb_host.a
 
 # host
 COBJS-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o
@@ -41,14 +36,6 @@ COBJS-$(CONFIG_MUSB_HCD) += musb_hcd.o musb_core.o
 COBJS-$(CONFIG_USB_DAVINCI) += davinci_usb.o
 COBJS-$(CONFIG_USB_EHCI_VCT) += usb_ehci_vct.o
 
-# device
-ifdef CONFIG_USB_DEVICE
-COBJS-y += usbdcore_ep0.o
-COBJS-$(CONFIG_OMAP1510) += usbdcore_omap1510.o
-COBJS-$(CONFIG_OMAP1610) += usbdcore_omap1510.o
-COBJS-$(CONFIG_MPC885_FAMILY) += usbdcore_mpc8xx.o
-endif
-
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS))
diff --git a/drivers/usb/davinci_usb.c b/drivers/usb/host/davinci_usb.c
similarity index 100%
rename from drivers/usb/davinci_usb.c
rename to drivers/usb/host/davinci_usb.c
diff --git a/drivers/usb/davinci_usb.h b/drivers/usb/host/davinci_usb.h
similarity index 100%
rename from drivers/usb/davinci_usb.h
rename to drivers/usb/host/davinci_usb.h
diff --git a/drivers/usb/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c
similarity index 100%
rename from drivers/usb/isp116x-hcd.c
rename to drivers/usb/host/isp116x-hcd.c
diff --git a/drivers/usb/isp116x.h b/drivers/usb/host/isp116x.h
similarity index 100%
rename from drivers/usb/isp116x.h
rename to drivers/usb/host/isp116x.h
diff --git a/drivers/usb/musb_core.c b/drivers/usb/host/musb_core.c
similarity index 100%
rename from drivers/usb/musb_core.c
rename to drivers/usb/host/musb_core.c
diff --git a/drivers/usb/musb_core.h b/drivers/usb/host/musb_core.h
similarity index 100%
rename from drivers/usb/musb_core.h
rename to drivers/usb/host/musb_core.h
diff --git a/drivers/usb/musb_hcd.c b/drivers/usb/host/musb_hcd.c
similarity index 100%
rename from drivers/usb/musb_hcd.c
rename to drivers/usb/host/musb_hcd.c
diff --git a/drivers/usb/musb_hcd.h b/drivers/usb/host/musb_hcd.h
similarity index 100%
rename from drivers/usb/musb_hcd.h
rename to drivers/usb/host/musb_hcd.h
diff --git a/drivers/usb/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
similarity index 100%
rename from drivers/usb/r8a66597-hcd.c
rename to drivers/usb/host/r8a66597-hcd.c
diff --git a/drivers/usb/r8a66597.h b/drivers/usb/host/r8a66597.h
similarity index 100%
rename from drivers/usb/r8a66597.h
rename to drivers/usb/host/r8a66597.h
diff --git a/drivers/usb/sl811.h b/drivers/usb/host/sl811.h
similarity index 100%
rename from drivers/usb/sl811.h
rename to drivers/usb/host/sl811.h
diff --git a/drivers/usb/sl811_usb.c b/drivers/usb/host/sl811_usb.c
similarity index 99%
rename from drivers/usb/sl811_usb.c
rename to drivers/usb/host/sl811_usb.c
index a03e469..82a8b36 100644
--- a/drivers/usb/sl811_usb.c
+++ b/drivers/usb/host/sl811_usb.c
@@ -40,7 +40,7 @@
 #include <usb.h>
 #include "sl811.h"
 
-#include "../../board/kup/common/kup.h"
+#include "../../../board/kup/common/kup.h"
 
 #ifdef __PPC__
 # define EIEIO		__asm__ volatile ("eieio")
diff --git a/drivers/usb/usb_ehci_fsl.c b/drivers/usb/host/usb_ehci_fsl.c
similarity index 98%
rename from drivers/usb/usb_ehci_fsl.c
rename to drivers/usb/host/usb_ehci_fsl.c
index 81d5d21..866a83d 100644
--- a/drivers/usb/usb_ehci_fsl.c
+++ b/drivers/usb/host/usb_ehci_fsl.c
@@ -25,10 +25,9 @@
 #include <mpc83xx.h>
 #include <asm/io.h>
 #include <asm/bitops.h>
-
-#include "usb_ehci.h"
+#include <usb_ehci.h>
 #include "usb_ehci_fsl.h"
-#include "usb_ehci_core.h"
+#include <usb_ehci_core.h>
 
 /*
  * Create the appropriate control structures to manage
diff --git a/drivers/usb/usb_ehci_fsl.h b/drivers/usb/host/usb_ehci_fsl.h
similarity index 100%
rename from drivers/usb/usb_ehci_fsl.h
rename to drivers/usb/host/usb_ehci_fsl.h
diff --git a/drivers/usb/usb_ehci_ixp.c b/drivers/usb/host/usb_ehci_ixp.c
similarity index 96%
rename from drivers/usb/usb_ehci_ixp.c
rename to drivers/usb/host/usb_ehci_ixp.c
index 25c18c1..f6d1d02 100644
--- a/drivers/usb/usb_ehci_ixp.c
+++ b/drivers/usb/host/usb_ehci_ixp.c
@@ -21,8 +21,8 @@
  */
 #include <common.h>
 #include <usb.h>
-#include "usb_ehci.h"
-#include "usb_ehci_core.h"
+#include <usb_ehci.h>
+#include <usb_ehci_core.h>
 /*
  * Create the appropriate control structures to manage
  * a new EHCI host controller.
diff --git a/drivers/usb/usb_ehci_pci.c b/drivers/usb/host/usb_ehci_pci.c
similarity index 97%
rename from drivers/usb/usb_ehci_pci.c
rename to drivers/usb/host/usb_ehci_pci.c
index 3e7143c..64ca3df 100644
--- a/drivers/usb/usb_ehci_pci.c
+++ b/drivers/usb/host/usb_ehci_pci.c
@@ -21,8 +21,8 @@
 #include <common.h>
 #include <pci.h>
 #include <usb.h>
-#include "usb_ehci.h"
-#include "usb_ehci_core.h"
+#include <usb_ehci.h>
+#include <usb_ehci_core.h>
 
 #ifdef CONFIG_PCI_EHCI_DEVICE
 static struct pci_device_id ehci_pci_ids[] = {
diff --git a/drivers/usb/usb_ehci_vct.c b/drivers/usb/host/usb_ehci_vct.c
similarity index 96%
rename from drivers/usb/usb_ehci_vct.c
rename to drivers/usb/host/usb_ehci_vct.c
index 89daaaf..769b4b2 100644
--- a/drivers/usb/usb_ehci_vct.c
+++ b/drivers/usb/host/usb_ehci_vct.c
@@ -19,9 +19,8 @@
 
 #include <common.h>
 #include <usb.h>
-
-#include "usb_ehci.h"
-#include "usb_ehci_core.h"
+#include <usb_ehci.h>
+#include <usb_ehci_core.h>
 
 int vct_ehci_hcd_init(u32 *hccr, u32 *hcor);
 
diff --git a/drivers/usb/usb_ehci.h b/include/usb_ehci.h
similarity index 100%
rename from drivers/usb/usb_ehci.h
rename to include/usb_ehci.h
diff --git a/drivers/usb/usb_ehci_core.h b/include/usb_ehci_core.h
similarity index 100%
rename from drivers/usb/usb_ehci_core.h
rename to include/usb_ehci_core.h
diff --git a/drivers/usb/usb_ohci.h b/include/usb_ohci.h
similarity index 100%
rename from drivers/usb/usb_ohci.h
rename to include/usb_ohci.h
-- 
1.6.1.3

^ permalink raw reply related	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 10/13] at91: move usb driver to drivers/usb
  2009-04-01 15:48                           ` ksi at koi8.net
  2009-04-01 16:03                             ` Michael Trimarchi
  2009-04-01 16:28                             ` Jean-Christophe PLAGNIOL-VILLARD
@ 2009-04-01 19:42                             ` Scott Wood
  2 siblings, 0 replies; 62+ messages in thread
From: Scott Wood @ 2009-04-01 19:42 UTC (permalink / raw)
  To: u-boot

On Wed, Apr 01, 2009 at 08:48:51AM -0700, ksi at koi8.net wrote:
> I also vote for moving _ALL_ the drivers (i2c, usb, net, etc.) to
> appropriate directories under drivers/ no matter architecture specific they
> are or not.

Seconded.  The criteria should generally be whether the code interacts
with the subsystem (as opposed to some isolated register poking to "turn
on" a common logic block), with a fair bit of deference to the
developer/maintainer's intuition rather than an unyielding rule (we have
enough of those in u-boot).

> This will make the tree more logical and one wouldn't have to chase say USB
> driver all over the source tree.

And when someone adds a new board, they may find that their
"board-specific" driver code wasn't actually as board-specific as they
thought if something very similar is sitting in the same directory they
need to add it to, as opposed to having 100 copies of it hidden in the
directories of other boards.

> Also it is a first step to general overhaul that would allow for multiple
> drivers support.

Yes.  We should get away from the model of having generic code call *the*
USB/NAND/SATA/whatever driver which is chosen at link time.

-Scott

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [RFC PATCH] drivers/usb: regorganisation
  2009-04-01 17:21                                           ` [U-Boot] [RFC PATCH] drivers/usb: regorganisation Jean-Christophe PLAGNIOL-VILLARD
@ 2009-04-01 22:12                                             ` Wolfgang Denk
  2009-04-02  5:22                                               ` Jean-Christophe PLAGNIOL-VILLARD
  2009-04-02 11:11                                             ` [U-Boot] [RFC PATCH] " Mike Frysinger
  1 sibling, 1 reply; 62+ messages in thread
From: Wolfgang Denk @ 2009-04-01 22:12 UTC (permalink / raw)
  To: u-boot

Dear Jean-Christophe PLAGNIOL-VILLARD,

In message <1238606479-914-1-git-send-email-plagnioj@jcrosoft.com> you wrote:
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
> better description will be wrote for the final patch

Maybe we should then remove some redundancy in the file names, too?
Like that:

> Best Regards,
> 
>  Makefile                                     |    4 +++-
>  drivers/usb/{ => core}/Makefile              |   22 +---------------------
>  drivers/usb/{ => core}/usb_ehci_core.c       |    2 +-
>  drivers/usb/{ => core}/usb_ohci.c            |    2 +-

usb_ehci_core.c => ehci_core.c ?
usb_ohci.c => ohci.c ?

>  drivers/usb/{ => core}/usbdcore.c            |    2 +-
>  drivers/usb/{ => gadget}/Makefile            |   19 +------------------
>  drivers/usb/{ => gadget}/usbdcore_ep0.c      |    2 +-
>  drivers/usb/{ => gadget}/usbdcore_mpc8xx.c   |    4 ++--
>  drivers/usb/{ => gadget}/usbdcore_omap1510.c |    4 ++--

usbdcore => dcore ?

>  drivers/usb/{ => host}/usb_ehci_fsl.c        |    5 ++---
>  drivers/usb/{ => host}/usb_ehci_fsl.h        |    0
>  drivers/usb/{ => host}/usb_ehci_ixp.c        |    4 ++--
>  drivers/usb/{ => host}/usb_ehci_pci.c        |    4 ++--
>  drivers/usb/{ => host}/usb_ehci_vct.c        |    5 ++---
>  {drivers/usb => include}/usb_ehci.h          |    0
>  {drivers/usb => include}/usb_ehci_core.h     |    0
>  {drivers/usb => include}/usb_ohci.h          |    0

usb_[eo]hci => [eo]hci ?

etc.

Best regards,

Wolfgang Denk

-- 
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
"More software projects have gone awry for lack of calendar time than
for all other causes combined."
                         - Fred Brooks, Jr., _The Mythical Man Month_

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 07/13] at91rm9200: move serial driver to drivers/serial
  2009-03-27 22:30           ` [U-Boot] [PATCH 07/13] at91rm9200: move serial driver to drivers/serial Jean-Christophe PLAGNIOL-VILLARD
  2009-03-27 22:30             ` [U-Boot] [PATCH 08/13] at91rm9200: move serial shutdown code to serial drivers Jean-Christophe PLAGNIOL-VILLARD
@ 2009-04-01 22:14             ` Wolfgang Denk
  1 sibling, 0 replies; 62+ messages in thread
From: Wolfgang Denk @ 2009-04-01 22:14 UTC (permalink / raw)
  To: u-boot

Dear Jean-Christophe PLAGNIOL-VILLARD,

In message <1238193026-12564-7-git-send-email-plagnioj@jcrosoft.com> you wrote:
> add CONFIG_AT91RM9200_USART to activate the driver
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  cpu/arm920t/at91rm9200/Makefile                    |    2 +-
>  drivers/serial/Makefile                            |    1 +
>  .../serial.c => drivers/serial/at91rm9200_usart.c  |    0
>  include/configs/at91rm9200dk.h                     |    1 +
>  include/configs/at91rm9200ek.h                     |    1 +
>  include/configs/cmc_pu2.h                          |    1 +
>  include/configs/csb637.h                           |    1 +
>  include/configs/kb9202.h                           |    1 +
>  include/configs/m501sk.h                           |    1 +
>  include/configs/mp2usb.h                           |    1 +
>  10 files changed, 9 insertions(+), 1 deletions(-)
>  rename cpu/arm920t/at91rm9200/serial.c => drivers/serial/at91rm9200_usart.c (100%)

What the heck is this?

A new version of the previously submitted patch?

Why do you not mark this in the subject line like "[PATCH 07/13 V2]"
or similar?

Why do you not add any comment?


It is IMPOSSIBLE this way to keep track of which patch versions might
be current in your patch stack. 

This is a nightmare.

Best regards,

Wolfgang Denk

-- 
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
Motto of the Electrical Engineer: Working computer hardware is a  lot
like an erect penis: it stays up as long as you don't fuck with it.

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 08/13] at91rm9200: move serial shutdown code to serial drivers
  2009-03-27 22:30             ` [U-Boot] [PATCH 08/13] at91rm9200: move serial shutdown code to serial drivers Jean-Christophe PLAGNIOL-VILLARD
  2009-03-27 22:30               ` [U-Boot] [PATCH 09/13] at91rm9200: Reset update Jean-Christophe PLAGNIOL-VILLARD
@ 2009-04-01 22:15               ` Wolfgang Denk
  1 sibling, 0 replies; 62+ messages in thread
From: Wolfgang Denk @ 2009-04-01 22:15 UTC (permalink / raw)
  To: u-boot

Dear Jean-Christophe PLAGNIOL-VILLARD,

In message <1238193026-12564-8-git-send-email-plagnioj@jcrosoft.com> you wrote:
> introduce serial_exit for this purpose. Use it only when the rm9200
> serial driver is active
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  cpu/arm920t/at91rm9200/interrupts.c |   13 +++----------
>  drivers/serial/at91rm9200_usart.c   |    5 +++++
>  include/common.h                    |    1 +
>  3 files changed, 9 insertions(+), 10 deletions(-)

New patch version or what? No comments?

Come on, we cannot work like this.

Please learn to play by the rules.

Best regards,

Wolfgang Denk

-- 
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
Punishment becomes ineffective after a certain point. Men become  in-
sensitive.
	-- Eneg, "Patterns of Force", stardate 2534.7

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [RFC PATCH] drivers/usb: regorganisation
  2009-04-01 22:12                                             ` Wolfgang Denk
@ 2009-04-02  5:22                                               ` Jean-Christophe PLAGNIOL-VILLARD
  2009-04-02 15:26                                                 ` Remy Bohmer
  0 siblings, 1 reply; 62+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-04-02  5:22 UTC (permalink / raw)
  To: u-boot

On 00:12 Thu 02 Apr     , Wolfgang Denk wrote:
> Dear Jean-Christophe PLAGNIOL-VILLARD,
> 
> In message <1238606479-914-1-git-send-email-plagnioj@jcrosoft.com> you wrote:
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > ---
> > better description will be wrote for the final patch
> 
> Maybe we should then remove some redundancy in the file names, too?
> Like that:
> 
> > Best Regards,
> > 
> >  Makefile                                     |    4 +++-
> >  drivers/usb/{ => core}/Makefile              |   22 +---------------------
> >  drivers/usb/{ => core}/usb_ehci_core.c       |    2 +-
> >  drivers/usb/{ => core}/usb_ohci.c            |    2 +-
> 
> usb_ehci_core.c => ehci_core.c ?
> usb_ohci.c => ohci.c ?
is this case ehci.c could be better
> 
> >  drivers/usb/{ => core}/usbdcore.c            |    2 +-
> >  drivers/usb/{ => gadget}/Makefile            |   19 +------------------
> >  drivers/usb/{ => gadget}/usbdcore_ep0.c      |    2 +-
> >  drivers/usb/{ => gadget}/usbdcore_mpc8xx.c   |    4 ++--
> >  drivers/usb/{ => gadget}/usbdcore_omap1510.c |    4 ++--
> 
> usbdcore => dcore ?
device or udc as in most of the linux file name
> 
> >  drivers/usb/{ => host}/usb_ehci_fsl.c        |    5 ++---
> >  drivers/usb/{ => host}/usb_ehci_fsl.h        |    0
> >  drivers/usb/{ => host}/usb_ehci_ixp.c        |    4 ++--
> >  drivers/usb/{ => host}/usb_ehci_pci.c        |    4 ++--
> >  drivers/usb/{ => host}/usb_ehci_vct.c        |    5 ++---
> >  {drivers/usb => include}/usb_ehci.h          |    0
> >  {drivers/usb => include}/usb_ehci_core.h     |    0
> >  {drivers/usb => include}/usb_ohci.h          |    0
> 
> usb_[eo]hci => [eo]hci ?
> 
Remy what do you prefer?

Best Regards,
J.

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [RFC PATCH] drivers/usb: regorganisation
  2009-04-01 17:21                                           ` [U-Boot] [RFC PATCH] drivers/usb: regorganisation Jean-Christophe PLAGNIOL-VILLARD
  2009-04-01 22:12                                             ` Wolfgang Denk
@ 2009-04-02 11:11                                             ` Mike Frysinger
  1 sibling, 0 replies; 62+ messages in thread
From: Mike Frysinger @ 2009-04-02 11:11 UTC (permalink / raw)
  To: u-boot

On Wednesday 01 April 2009 13:21:19 Jean-Christophe PLAGNIOL-VILLARD wrote:
>  drivers/usb/{ => gadget}/Makefile            |   19 +------------------
>  drivers/usb/{ => gadget}/usbdcore_ep0.c      |    2 +-
>  drivers/usb/{ => gadget}/usbdcore_mpc8xx.c   |    4 ++--
>  drivers/usb/{ => gadget}/usbdcore_omap1510.c |    4 ++--

sounds like a good idea ... the task of identifying available gadget drivers 
has been a pain with the current setup.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090402/ca0fdd23/attachment-0001.pgp 

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [RFC PATCH] drivers/usb: regorganisation
  2009-04-02  5:22                                               ` Jean-Christophe PLAGNIOL-VILLARD
@ 2009-04-02 15:26                                                 ` Remy Bohmer
  2009-04-02 16:55                                                   ` [U-Boot] [RFC PATCH V2] " Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 62+ messages in thread
From: Remy Bohmer @ 2009-04-02 15:26 UTC (permalink / raw)
  To: u-boot

Hello Jean-Christophe,

>> usb_[eo]hci => [eo]hci ?
>>
> Remy what do you prefer?

I think this structure is a whole lot better then dumping everything
in a flat directory tree.
And I also prefer to follow the Linux kernel structure, thus without
usb_ prefixes.

e.g.: drivers/usb/host/ochi.c or drivers/usb/host/echi.c

Kind Regards,

Remy

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [RFC PATCH V2] drivers/usb: regorganisation
  2009-04-02 15:26                                                 ` Remy Bohmer
@ 2009-04-02 16:55                                                   ` Jean-Christophe PLAGNIOL-VILLARD
  2009-04-02 18:07                                                     ` Wolfgang Denk
  0 siblings, 1 reply; 62+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-04-02 16:55 UTC (permalink / raw)
  To: u-boot

move to linux usb driver organisation

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Remy Bohmer <linux@bohmer.net>
---
Remy is this one ok for you?

I've try to respect the usb driver linux organistation at maximum

Best Regards,
J.

 Makefile                                           |    4 +-
 drivers/serial/usbtty.c                            |    2 +-
 drivers/serial/usbtty.h                            |    6 +-
 drivers/usb/{ => gadget}/Makefile                  |   29 +++----------
 drivers/usb/{usbdcore.c => gadget/core.c}          |    2 +-
 drivers/usb/{usbdcore_ep0.c => gadget/ep0.c}       |    2 +-
 include/usbdcore_ep0.h => drivers/usb/gadget/ep0.h |    0
 .../usb/{usbdcore_mpc8xx.c => gadget/mpc8xx_udc.c} |    9 ++--
 .../{usbdcore_omap1510.c => gadget/omap1510_udc.c} |    6 +-
 drivers/usb/{ => host}/Makefile                    |   35 +++++----------
 drivers/usb/{usb_ehci_core.h => host/ehci-core.h}  |    0
 drivers/usb/{usb_ehci_fsl.c => host/ehci-fsl.c}    |    6 +-
 drivers/usb/{usb_ehci_fsl.h => host/ehci-fsl.h}    |    0
 drivers/usb/{usb_ehci_core.c => host/ehci-hcd.c}   |    3 +-
 drivers/usb/{usb_ehci_ixp.c => host/ehci-ixp4xx.c} |    5 +-
 drivers/usb/{usb_ehci_pci.c => host/ehci-pci.c}    |    5 +-
 drivers/usb/{usb_ehci_vct.c => host/ehci-vct.c}    |    4 +-
 drivers/usb/{usb_ehci.h => host/ehci.h}            |    0
 drivers/usb/{ => host}/isp116x-hcd.c               |    0
 drivers/usb/{ => host}/isp116x.h                   |    0
 drivers/usb/{usb_ohci.c => host/ohci-hcd.c}        |    3 +-
 drivers/usb/{usb_ohci.h => host/ohci.h}            |    0
 drivers/usb/{ => host}/r8a66597-hcd.c              |    0
 drivers/usb/{ => host}/r8a66597.h                  |    0
 drivers/usb/{s3c64xx_usb.c => host/s3c64xx-hcd.c}  |    0
 drivers/usb/{sl811_usb.c => host/sl811-hcd.c}      |    2 +-
 drivers/usb/{ => host}/sl811.h                     |    0
 drivers/usb/musb/Makefile                          |   47 ++++++++++++++++++++
 drivers/usb/{davinci_usb.c => musb/davinci.c}      |    2 +-
 drivers/usb/{davinci_usb.h => musb/davinci.h}      |    0
 drivers/usb/{ => musb}/musb_core.c                 |    0
 drivers/usb/{ => musb}/musb_core.h                 |    0
 drivers/usb/{ => musb}/musb_hcd.c                  |    0
 drivers/usb/{ => musb}/musb_hcd.h                  |    0
 include/{usbdcore_mpc8xx.h => usb/mpc8xx_udc.h}    |    0
 .../{usbdcore_omap1510.h => usb/omap1510_udc.h}    |    0
 include/{usbdcore.h => usbdevice.h}                |    0
 37 files changed, 99 insertions(+), 73 deletions(-)
 copy drivers/usb/{ => gadget}/Makefile (61%)
 rename drivers/usb/{usbdcore.c => gadget/core.c} (99%)
 rename drivers/usb/{usbdcore_ep0.c => gadget/ep0.c} (99%)
 rename include/usbdcore_ep0.h => drivers/usb/gadget/ep0.h (100%)
 rename drivers/usb/{usbdcore_mpc8xx.c => gadget/mpc8xx_udc.c} (99%)
 rename drivers/usb/{usbdcore_omap1510.c => gadget/omap1510_udc.c} (99%)
 rename drivers/usb/{ => host}/Makefile (65%)
 rename drivers/usb/{usb_ehci_core.h => host/ehci-core.h} (100%)
 rename drivers/usb/{usb_ehci_fsl.c => host/ehci-fsl.c} (97%)
 rename drivers/usb/{usb_ehci_fsl.h => host/ehci-fsl.h} (100%)
 rename drivers/usb/{usb_ehci_core.c => host/ehci-hcd.c} (99%)
 rename drivers/usb/{usb_ehci_ixp.c => host/ehci-ixp4xx.c} (96%)
 rename drivers/usb/{usb_ehci_pci.c => host/ehci-pci.c} (97%)
 rename drivers/usb/{usb_ehci_vct.c => host/ehci-vct.c} (96%)
 rename drivers/usb/{usb_ehci.h => host/ehci.h} (100%)
 rename drivers/usb/{ => host}/isp116x-hcd.c (100%)
 rename drivers/usb/{ => host}/isp116x.h (100%)
 rename drivers/usb/{usb_ohci.c => host/ohci-hcd.c} (99%)
 rename drivers/usb/{usb_ohci.h => host/ohci.h} (100%)
 rename drivers/usb/{ => host}/r8a66597-hcd.c (100%)
 rename drivers/usb/{ => host}/r8a66597.h (100%)
 rename drivers/usb/{s3c64xx_usb.c => host/s3c64xx-hcd.c} (100%)
 rename drivers/usb/{sl811_usb.c => host/sl811-hcd.c} (99%)
 rename drivers/usb/{ => host}/sl811.h (100%)
 create mode 100644 drivers/usb/musb/Makefile
 rename drivers/usb/{davinci_usb.c => musb/davinci.c} (99%)
 rename drivers/usb/{davinci_usb.h => musb/davinci.h} (100%)
 rename drivers/usb/{ => musb}/musb_core.c (100%)
 rename drivers/usb/{ => musb}/musb_core.h (100%)
 rename drivers/usb/{ => musb}/musb_hcd.c (100%)
 rename drivers/usb/{ => musb}/musb_hcd.h (100%)
 rename include/{usbdcore_mpc8xx.h => usb/mpc8xx_udc.h} (100%)
 rename include/{usbdcore_omap1510.h => usb/omap1510_udc.h} (100%)
 rename include/{usbdcore.h => usbdevice.h} (100%)

diff --git a/Makefile b/Makefile
index f857641..565df93 100644
--- a/Makefile
+++ b/Makefile
@@ -263,7 +263,9 @@ endif
 LIBS += drivers/rtc/librtc.a
 LIBS += drivers/serial/libserial.a
 LIBS += drivers/twserial/libtws.a
-LIBS += drivers/usb/libusb.a
+LIBS += drivers/usb/gadget/libusb_gadget.a
+LIBS += drivers/usb/musb/libusb_musb.a
+LIBS += drivers/usb/host/libusb_host.a
 LIBS += drivers/video/libvideo.a
 LIBS += common/libcommon.a
 LIBS += libfdt/libfdt.a
diff --git a/drivers/serial/usbtty.c b/drivers/serial/usbtty.c
index d8b1387..71f0e5b 100644
--- a/drivers/serial/usbtty.c
+++ b/drivers/serial/usbtty.c
@@ -94,7 +94,7 @@ static char serial_number[16];
  * Descriptors, Strings, Local variables.
  */
 
-/* defined and used by usbdcore_ep0.c */
+/* defined and used by ep0.c */
 extern struct usb_string_descriptor **usb_strings;
 
 /* Indicies, References */
diff --git a/drivers/serial/usbtty.h b/drivers/serial/usbtty.h
index ecefde5..77db972 100644
--- a/drivers/serial/usbtty.h
+++ b/drivers/serial/usbtty.h
@@ -24,11 +24,11 @@
 #ifndef __USB_TTY_H__
 #define __USB_TTY_H__
 
-#include <usbdcore.h>
+#include <usbdevice.h>
 #if defined(CONFIG_PPC)
-#include <usbdcore_mpc8xx.h>
+#include <usb/mpc8xx_udc.h>
 #elif defined(CONFIG_ARM)
-#include <usbdcore_omap1510.h>
+#include <usb/omap1510_udc.h>
 #endif
 
 #include <version_autogenerated.h>
diff --git a/drivers/usb/Makefile b/drivers/usb/gadget/Makefile
similarity index 61%
copy from drivers/usb/Makefile
copy to drivers/usb/gadget/Makefile
index 7ddb72a..251724f 100644
--- a/drivers/usb/Makefile
+++ b/drivers/usb/gadget/Makefile
@@ -23,31 +23,14 @@
 
 include $(TOPDIR)/config.mk
 
-LIB	:= $(obj)libusb.a
+LIB	:= $(obj)libusb_gadget.a
 
-# core
-COBJS-y += usbdcore.o
-COBJS-$(CONFIG_USB_OHCI_NEW) += usb_ohci.o
-COBJS-$(CONFIG_USB_EHCI) += usb_ehci_core.o
-
-# host
-COBJS-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o
-COBJS-$(CONFIG_USB_R8A66597_HCD) += r8a66597-hcd.o
-COBJS-$(CONFIG_USB_S3C64XX) += s3c64xx_usb.o
-COBJS-$(CONFIG_USB_SL811HS) += sl811_usb.o
-COBJS-$(CONFIG_USB_EHCI_FSL) += usb_ehci_fsl.o
-COBJS-$(CONFIG_USB_EHCI_PCI) += usb_ehci_pci.o
-COBJS-$(CONFIG_USB_EHCI_IXP4XX) += usb_ehci_ixp.o
-COBJS-$(CONFIG_MUSB_HCD) += musb_hcd.o musb_core.o
-COBJS-$(CONFIG_USB_DAVINCI) += davinci_usb.o
-COBJS-$(CONFIG_USB_EHCI_VCT) += usb_ehci_vct.o
-
-# device
 ifdef CONFIG_USB_DEVICE
-COBJS-y += usbdcore_ep0.o
-COBJS-$(CONFIG_OMAP1510) += usbdcore_omap1510.o
-COBJS-$(CONFIG_OMAP1610) += usbdcore_omap1510.o
-COBJS-$(CONFIG_MPC885_FAMILY) += usbdcore_mpc8xx.o
+COBJS-y += core.o
+COBJS-y += ep0.o
+COBJS-$(CONFIG_OMAP1510) += omap1510_udc.o
+COBJS-$(CONFIG_OMAP1610) += omap1510_udc.o
+COBJS-$(CONFIG_MPC885_FAMILY) += mpc8xx_udc.o
 endif
 
 COBJS	:= $(COBJS-y)
diff --git a/drivers/usb/usbdcore.c b/drivers/usb/gadget/core.c
similarity index 99%
rename from drivers/usb/usbdcore.c
rename to drivers/usb/gadget/core.c
index 53ed669..67b6681 100644
--- a/drivers/usb/usbdcore.c
+++ b/drivers/usb/gadget/core.c
@@ -30,7 +30,7 @@
  */
 
 #include <malloc.h>
-#include "usbdcore.h"
+#include <usbdevice.h>
 
 #define MAX_INTERFACES 2
 
diff --git a/drivers/usb/usbdcore_ep0.c b/drivers/usb/gadget/ep0.c
similarity index 99%
rename from drivers/usb/usbdcore_ep0.c
rename to drivers/usb/gadget/ep0.c
index f6e017d..2b4ec44 100644
--- a/drivers/usb/usbdcore_ep0.c
+++ b/drivers/usb/gadget/ep0.c
@@ -51,7 +51,7 @@
  */
 
 #include <common.h>
-#include "usbdcore.h"
+#include <usbdevice.h>
 
 #if 0
 #define dbg_ep0(lvl,fmt,args...) serial_printf("[%s] %s:%d: "fmt"\n",__FILE__,__FUNCTION__,__LINE__,##args)
diff --git a/include/usbdcore_ep0.h b/drivers/usb/gadget/ep0.h
similarity index 100%
rename from include/usbdcore_ep0.h
rename to drivers/usb/gadget/ep0.h
diff --git a/drivers/usb/usbdcore_mpc8xx.c b/drivers/usb/gadget/mpc8xx_udc.c
similarity index 99%
rename from drivers/usb/usbdcore_mpc8xx.c
rename to drivers/usb/gadget/mpc8xx_udc.c
index 0e311ad..8d7bd65 100644
--- a/drivers/usb/usbdcore_mpc8xx.c
+++ b/drivers/usb/gadget/mpc8xx_udc.c
@@ -3,7 +3,7 @@
  * bodonoghue at CodeHermit.ie
  *
  * References
- * DasUBoot/drivers/usb/usbdcore_omap1510.c, for design and implementation
+ * DasUBoot/drivers/usb/omap1510_udc.c, for design and implementation
  * ideas.
  *
  * This program is free software; you can redistribute it and/or modify
@@ -59,9 +59,10 @@
 #include <common.h>
 #include <config.h>
 #include <commproc.h>
-#include "usbdcore.h"
-#include "usbdcore_mpc8xx.h"
-#include "usbdcore_ep0.h"
+#include <usbdevice.h>
+#include <usb/mpc8xx_udc.h>
+
+#include "ep0.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/drivers/usb/usbdcore_omap1510.c b/drivers/usb/gadget/omap1510_udc.c
similarity index 99%
rename from drivers/usb/usbdcore_omap1510.c
rename to drivers/usb/gadget/omap1510_udc.c
index 6b7b61b..90f7907 100644
--- a/drivers/usb/usbdcore_omap1510.c
+++ b/drivers/usb/gadget/omap1510_udc.c
@@ -31,10 +31,10 @@
 #ifdef CONFIG_OMAP_SX1
 #include <i2c.h>
 #endif
+#include <usbdevice.h>
+#include <usb/omap1510_udc.h>
 
-#include "usbdcore.h"
-#include "usbdcore_omap1510.h"
-#include "usbdcore_ep0.h"
+#include "ep0.h"
 
 
 #define UDC_INIT_MDELAY		     80 /* Device settle delay */
diff --git a/drivers/usb/Makefile b/drivers/usb/host/Makefile
similarity index 65%
rename from drivers/usb/Makefile
rename to drivers/usb/host/Makefile
index 7ddb72a..f6c9299 100644
--- a/drivers/usb/Makefile
+++ b/drivers/usb/host/Makefile
@@ -23,32 +23,21 @@
 
 include $(TOPDIR)/config.mk
 
-LIB	:= $(obj)libusb.a
+LIB	:= $(obj)libusb_host.a
 
-# core
-COBJS-y += usbdcore.o
-COBJS-$(CONFIG_USB_OHCI_NEW) += usb_ohci.o
-COBJS-$(CONFIG_USB_EHCI) += usb_ehci_core.o
-
-# host
+# ohci
+COBJS-$(CONFIG_USB_OHCI_NEW) += ohci-hcd.o
 COBJS-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o
 COBJS-$(CONFIG_USB_R8A66597_HCD) += r8a66597-hcd.o
-COBJS-$(CONFIG_USB_S3C64XX) += s3c64xx_usb.o
-COBJS-$(CONFIG_USB_SL811HS) += sl811_usb.o
-COBJS-$(CONFIG_USB_EHCI_FSL) += usb_ehci_fsl.o
-COBJS-$(CONFIG_USB_EHCI_PCI) += usb_ehci_pci.o
-COBJS-$(CONFIG_USB_EHCI_IXP4XX) += usb_ehci_ixp.o
-COBJS-$(CONFIG_MUSB_HCD) += musb_hcd.o musb_core.o
-COBJS-$(CONFIG_USB_DAVINCI) += davinci_usb.o
-COBJS-$(CONFIG_USB_EHCI_VCT) += usb_ehci_vct.o
-
-# device
-ifdef CONFIG_USB_DEVICE
-COBJS-y += usbdcore_ep0.o
-COBJS-$(CONFIG_OMAP1510) += usbdcore_omap1510.o
-COBJS-$(CONFIG_OMAP1610) += usbdcore_omap1510.o
-COBJS-$(CONFIG_MPC885_FAMILY) += usbdcore_mpc8xx.o
-endif
+COBJS-$(CONFIG_USB_S3C64XX) += s3c64xx-hcd.o
+COBJS-$(CONFIG_USB_SL811HS) += sl811-hcd.o
+
+# echi
+COBJS-$(CONFIG_USB_EHCI) += ehci-hcd.o
+COBJS-$(CONFIG_USB_EHCI_FSL) += ehci-fsl.o
+COBJS-$(CONFIG_USB_EHCI_PCI) += ehci-pci.o
+COBJS-$(CONFIG_USB_EHCI_IXP4XX) += ehci-ixp.o
+COBJS-$(CONFIG_USB_EHCI_VCT) += ehci-vct.o
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
diff --git a/drivers/usb/usb_ehci_core.h b/drivers/usb/host/ehci-core.h
similarity index 100%
rename from drivers/usb/usb_ehci_core.h
rename to drivers/usb/host/ehci-core.h
diff --git a/drivers/usb/usb_ehci_fsl.c b/drivers/usb/host/ehci-fsl.c
similarity index 97%
rename from drivers/usb/usb_ehci_fsl.c
rename to drivers/usb/host/ehci-fsl.c
index 81d5d21..86ee1d5 100644
--- a/drivers/usb/usb_ehci_fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -26,9 +26,9 @@
 #include <asm/io.h>
 #include <asm/bitops.h>
 
-#include "usb_ehci.h"
-#include "usb_ehci_fsl.h"
-#include "usb_ehci_core.h"
+#include "ehci.h"
+#include "ehci-fsl.h"
+#include "ehci-core.h"
 
 /*
  * Create the appropriate control structures to manage
diff --git a/drivers/usb/usb_ehci_fsl.h b/drivers/usb/host/ehci-fsl.h
similarity index 100%
rename from drivers/usb/usb_ehci_fsl.h
rename to drivers/usb/host/ehci-fsl.h
diff --git a/drivers/usb/usb_ehci_core.c b/drivers/usb/host/ehci-hcd.c
similarity index 99%
rename from drivers/usb/usb_ehci_core.c
rename to drivers/usb/host/ehci-hcd.c
index 4dbfb66..bbd547b 100644
--- a/drivers/usb/usb_ehci_core.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -25,7 +25,8 @@
 #include <usb.h>
 #include <asm/io.h>
 #include <malloc.h>
-#include "usb_ehci.h"
+
+#include "ehci.h"
 
 int rootdev;
 struct ehci_hccr *hccr;	/* R/O registers, not need for volatile */
diff --git a/drivers/usb/usb_ehci_ixp.c b/drivers/usb/host/ehci-ixp4xx.c
similarity index 96%
rename from drivers/usb/usb_ehci_ixp.c
rename to drivers/usb/host/ehci-ixp4xx.c
index 25c18c1..b8f15ae 100644
--- a/drivers/usb/usb_ehci_ixp.c
+++ b/drivers/usb/host/ehci-ixp4xx.c
@@ -21,8 +21,9 @@
  */
 #include <common.h>
 #include <usb.h>
-#include "usb_ehci.h"
-#include "usb_ehci_core.h"
+
+#include "ehci.h"
+#include "ehci-core.h"
 /*
  * Create the appropriate control structures to manage
  * a new EHCI host controller.
diff --git a/drivers/usb/usb_ehci_pci.c b/drivers/usb/host/ehci-pci.c
similarity index 97%
rename from drivers/usb/usb_ehci_pci.c
rename to drivers/usb/host/ehci-pci.c
index 3e7143c..441b1a2 100644
--- a/drivers/usb/usb_ehci_pci.c
+++ b/drivers/usb/host/ehci-pci.c
@@ -21,8 +21,9 @@
 #include <common.h>
 #include <pci.h>
 #include <usb.h>
-#include "usb_ehci.h"
-#include "usb_ehci_core.h"
+
+#include "ehci.h"
+#include "ehci-core.h"
 
 #ifdef CONFIG_PCI_EHCI_DEVICE
 static struct pci_device_id ehci_pci_ids[] = {
diff --git a/drivers/usb/usb_ehci_vct.c b/drivers/usb/host/ehci-vct.c
similarity index 96%
rename from drivers/usb/usb_ehci_vct.c
rename to drivers/usb/host/ehci-vct.c
index 89daaaf..3063dd1 100644
--- a/drivers/usb/usb_ehci_vct.c
+++ b/drivers/usb/host/ehci-vct.c
@@ -20,8 +20,8 @@
 #include <common.h>
 #include <usb.h>
 
-#include "usb_ehci.h"
-#include "usb_ehci_core.h"
+#include "ehci.h"
+#include "ehci-core.h"
 
 int vct_ehci_hcd_init(u32 *hccr, u32 *hcor);
 
diff --git a/drivers/usb/usb_ehci.h b/drivers/usb/host/ehci.h
similarity index 100%
rename from drivers/usb/usb_ehci.h
rename to drivers/usb/host/ehci.h
diff --git a/drivers/usb/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c
similarity index 100%
rename from drivers/usb/isp116x-hcd.c
rename to drivers/usb/host/isp116x-hcd.c
diff --git a/drivers/usb/isp116x.h b/drivers/usb/host/isp116x.h
similarity index 100%
rename from drivers/usb/isp116x.h
rename to drivers/usb/host/isp116x.h
diff --git a/drivers/usb/usb_ohci.c b/drivers/usb/host/ohci-hcd.c
similarity index 99%
rename from drivers/usb/usb_ohci.c
rename to drivers/usb/host/ohci-hcd.c
index 0bbee0f..e2f289e 100644
--- a/drivers/usb/usb_ohci.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -57,7 +57,8 @@
 
 #include <malloc.h>
 #include <usb.h>
-#include "usb_ohci.h"
+
+#include "ohci.h"
 
 #ifdef CONFIG_AT91RM9200
 #include <asm/arch/hardware.h>	/* needed for AT91_USB_HOST_BASE */
diff --git a/drivers/usb/usb_ohci.h b/drivers/usb/host/ohci.h
similarity index 100%
rename from drivers/usb/usb_ohci.h
rename to drivers/usb/host/ohci.h
diff --git a/drivers/usb/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
similarity index 100%
rename from drivers/usb/r8a66597-hcd.c
rename to drivers/usb/host/r8a66597-hcd.c
diff --git a/drivers/usb/r8a66597.h b/drivers/usb/host/r8a66597.h
similarity index 100%
rename from drivers/usb/r8a66597.h
rename to drivers/usb/host/r8a66597.h
diff --git a/drivers/usb/s3c64xx_usb.c b/drivers/usb/host/s3c64xx-hcd.c
similarity index 100%
rename from drivers/usb/s3c64xx_usb.c
rename to drivers/usb/host/s3c64xx-hcd.c
diff --git a/drivers/usb/sl811_usb.c b/drivers/usb/host/sl811-hcd.c
similarity index 99%
rename from drivers/usb/sl811_usb.c
rename to drivers/usb/host/sl811-hcd.c
index a03e469..82a8b36 100644
--- a/drivers/usb/sl811_usb.c
+++ b/drivers/usb/host/sl811-hcd.c
@@ -40,7 +40,7 @@
 #include <usb.h>
 #include "sl811.h"
 
-#include "../../board/kup/common/kup.h"
+#include "../../../board/kup/common/kup.h"
 
 #ifdef __PPC__
 # define EIEIO		__asm__ volatile ("eieio")
diff --git a/drivers/usb/sl811.h b/drivers/usb/host/sl811.h
similarity index 100%
rename from drivers/usb/sl811.h
rename to drivers/usb/host/sl811.h
diff --git a/drivers/usb/musb/Makefile b/drivers/usb/musb/Makefile
new file mode 100644
index 0000000..09e0a5f
--- /dev/null
+++ b/drivers/usb/musb/Makefile
@@ -0,0 +1,47 @@
+#
+# (C) Copyright 2000-2007
+# 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 $(TOPDIR)/config.mk
+
+LIB	:= $(obj)libusb_musb.a
+
+COBJS-$(CONFIG_MUSB_HCD) += musb_hcd.o musb_core.o
+COBJS-$(CONFIG_USB_DAVINCI) += davinci.o
+
+COBJS	:= $(COBJS-y)
+SRCS	:= $(COBJS:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS))
+
+all:	$(LIB)
+
+$(LIB):	$(obj).depend $(OBJS)
+	$(AR) $(ARFLAGS) $@ $(OBJS)
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/drivers/usb/davinci_usb.c b/drivers/usb/musb/davinci.c
similarity index 99%
rename from drivers/usb/davinci_usb.c
rename to drivers/usb/musb/davinci.c
index e66f660..a7648fc 100644
--- a/drivers/usb/davinci_usb.c
+++ b/drivers/usb/musb/davinci.c
@@ -23,7 +23,7 @@
 
 #include <common.h>
 #include <asm/io.h>
-#include "davinci_usb.h"
+#include "davinci.h"
 
 /* MUSB platform configuration */
 struct musb_config musb_cfg = {
diff --git a/drivers/usb/davinci_usb.h b/drivers/usb/musb/davinci.h
similarity index 100%
rename from drivers/usb/davinci_usb.h
rename to drivers/usb/musb/davinci.h
diff --git a/drivers/usb/musb_core.c b/drivers/usb/musb/musb_core.c
similarity index 100%
rename from drivers/usb/musb_core.c
rename to drivers/usb/musb/musb_core.c
diff --git a/drivers/usb/musb_core.h b/drivers/usb/musb/musb_core.h
similarity index 100%
rename from drivers/usb/musb_core.h
rename to drivers/usb/musb/musb_core.h
diff --git a/drivers/usb/musb_hcd.c b/drivers/usb/musb/musb_hcd.c
similarity index 100%
rename from drivers/usb/musb_hcd.c
rename to drivers/usb/musb/musb_hcd.c
diff --git a/drivers/usb/musb_hcd.h b/drivers/usb/musb/musb_hcd.h
similarity index 100%
rename from drivers/usb/musb_hcd.h
rename to drivers/usb/musb/musb_hcd.h
diff --git a/include/usbdcore_mpc8xx.h b/include/usb/mpc8xx_udc.h
similarity index 100%
rename from include/usbdcore_mpc8xx.h
rename to include/usb/mpc8xx_udc.h
diff --git a/include/usbdcore_omap1510.h b/include/usb/omap1510_udc.h
similarity index 100%
rename from include/usbdcore_omap1510.h
rename to include/usb/omap1510_udc.h
diff --git a/include/usbdcore.h b/include/usbdevice.h
similarity index 100%
rename from include/usbdcore.h
rename to include/usbdevice.h
-- 
1.6.1.3

^ permalink raw reply related	[flat|nested] 62+ messages in thread

* [U-Boot] [RFC PATCH V2] drivers/usb: regorganisation
  2009-04-02 16:55                                                   ` [U-Boot] [RFC PATCH V2] " Jean-Christophe PLAGNIOL-VILLARD
@ 2009-04-02 18:07                                                     ` Wolfgang Denk
  2009-04-02 19:27                                                       ` Jean-Christophe PLAGNIOL-VILLARD
  2009-04-03 10:46                                                       ` [U-Boot] [PATCH] " Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 2 replies; 62+ messages in thread
From: Wolfgang Denk @ 2009-04-02 18:07 UTC (permalink / raw)
  To: u-boot

Dear Jean-Christophe PLAGNIOL-VILLARD,

In message <1238691332-27548-1-git-send-email-plagnioj@jcrosoft.com> you wrote:
> move to linux usb driver organisation
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> Cc: Remy Bohmer <linux@bohmer.net>
> ---
> Remy is this one ok for you?

Looks OK to me, but..


> diff --git a/drivers/serial/usbtty.c b/drivers/serial/usbtty.c
> index d8b1387..71f0e5b 100644
> --- a/drivers/serial/usbtty.c
> +++ b/drivers/serial/usbtty.c
> @@ -94,7 +94,7 @@ static char serial_number[16];
>   * Descriptors, Strings, Local variables.
>   */
>  
> -/* defined and used by usbdcore_ep0.c */
> +/* defined and used by ep0.c */
>  extern struct usb_string_descriptor **usb_strings;

This is now too short. Where might ep0.c be? Please use "gadget/ep0.c"
here.


> rename to drivers/usb/gadget/mpc8xx_udc.c
> index 0e311ad..8d7bd65 100644
> --- a/drivers/usb/usbdcore_mpc8xx.c
> +++ b/drivers/usb/gadget/mpc8xx_udc.c
> @@ -3,7 +3,7 @@
>   * bodonoghue at CodeHermit.ie
>   *
>   * References
> - * DasUBoot/drivers/usb/usbdcore_omap1510.c, for design and implementation
> + * DasUBoot/drivers/usb/omap1510_udc.c, for design and implementation

Please change into "drivers/usb/omap1510_udc.c"


Best regards,

Wolfgang Denk

-- 
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
When a woman marries again it is because she detested her first  hus-
band.  When  a  man  marries again, it is because he adored his first
wife.                                                  -- Oscar Wilde

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [RFC PATCH V2] drivers/usb: regorganisation
  2009-04-02 18:07                                                     ` Wolfgang Denk
@ 2009-04-02 19:27                                                       ` Jean-Christophe PLAGNIOL-VILLARD
  2009-04-02 23:06                                                         ` Wolfgang Denk
  2009-04-03 10:46                                                       ` [U-Boot] [PATCH] " Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 1 reply; 62+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-04-02 19:27 UTC (permalink / raw)
  To: u-boot

On 20:07 Thu 02 Apr     , Wolfgang Denk wrote:
> Dear Jean-Christophe PLAGNIOL-VILLARD,
> 
> In message <1238691332-27548-1-git-send-email-plagnioj@jcrosoft.com> you wrote:
> > move to linux usb driver organisation
> > 
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > Cc: Remy Bohmer <linux@bohmer.net>
> > ---
> > Remy is this one ok for you?
> 
> Looks OK to me, but..
> 
> 
> > diff --git a/drivers/serial/usbtty.c b/drivers/serial/usbtty.c
> > index d8b1387..71f0e5b 100644
> > --- a/drivers/serial/usbtty.c
> > +++ b/drivers/serial/usbtty.c
> > @@ -94,7 +94,7 @@ static char serial_number[16];
> >   * Descriptors, Strings, Local variables.
> >   */
> >  
> > -/* defined and used by usbdcore_ep0.c */
> > +/* defined and used by ep0.c */
> >  extern struct usb_string_descriptor **usb_strings;
> 
> This is now too short. Where might ep0.c be? Please use "gadget/ep0.c"
> here.
ok
> 
> 
> > rename to drivers/usb/gadget/mpc8xx_udc.c
> > index 0e311ad..8d7bd65 100644
> > --- a/drivers/usb/usbdcore_mpc8xx.c
> > +++ b/drivers/usb/gadget/mpc8xx_udc.c
> > @@ -3,7 +3,7 @@
> >   * bodonoghue at CodeHermit.ie
> >   *
> >   * References
> > - * DasUBoot/drivers/usb/usbdcore_omap1510.c, for design and implementation
> > + * DasUBoot/drivers/usb/omap1510_udc.c, for design and implementation
> 
> Please change into "drivers/usb/omap1510_udc.c"
drivers/usb/gadget/omap1510_udc.c
ok

if Remy is ok
could apply the at91 pull request then I will generate the final usb
reorganisation patch?

Best Regards,
J.

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [RFC PATCH V2] drivers/usb: regorganisation
  2009-04-02 19:27                                                       ` Jean-Christophe PLAGNIOL-VILLARD
@ 2009-04-02 23:06                                                         ` Wolfgang Denk
  2009-04-03  5:10                                                           ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 62+ messages in thread
From: Wolfgang Denk @ 2009-04-02 23:06 UTC (permalink / raw)
  To: u-boot

Dear Jean-Christophe PLAGNIOL-VILLARD,

In message <20090402192755.GB15621@game.jcrosoft.org> you wrote:
>
> if Remy is ok
> could apply the at91 pull request then I will generate the final usb
> reorganisation patch?

That should go through the USB custodian tree.

Best regards,

Wolfgang Denk

-- 
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
"I like your game but we have to change the rules."

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [RFC PATCH V2] drivers/usb: regorganisation
  2009-04-02 23:06                                                         ` Wolfgang Denk
@ 2009-04-03  5:10                                                           ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 62+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-04-03  5:10 UTC (permalink / raw)
  To: u-boot

On 01:06 Fri 03 Apr     , Wolfgang Denk wrote:
> Dear Jean-Christophe PLAGNIOL-VILLARD,
> 
> In message <20090402192755.GB15621@game.jcrosoft.org> you wrote:
> >
> > if Remy is ok
> > could apply the at91 pull request then I will generate the final usb
> > reorganisation patch?
> 
> That should go through the USB custodian tree.
the reorganisation patch ofcourse

In the a91 pull request I've move the at91 usb drivers if you can applied it
I will base my reorganication patch on this

and the Remy will handle the reorganisation patch through it's tree ofcourse

Best Regards,
J.

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH] drivers/usb: regorganisation
  2009-04-02 18:07                                                     ` Wolfgang Denk
  2009-04-02 19:27                                                       ` Jean-Christophe PLAGNIOL-VILLARD
@ 2009-04-03 10:46                                                       ` Jean-Christophe PLAGNIOL-VILLARD
  2009-04-03 11:19                                                         ` Remy Bohmer
  1 sibling, 1 reply; 62+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-04-03 10:46 UTC (permalink / raw)
  To: u-boot

move to linux usb driver organisation

as following

drivers/usb/gadget
drivers/usb/host
drivers/usb/musb

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Remy Bohmer <linux@bohmer.net>
---
Hi Remy,
This version containt everyone ask
and is based on the AT91 tree
which contain the patch that move the at91 usb to drivers/usb

Best Regards,
J.
 Makefile                                           |    4 +-
 drivers/serial/usbtty.c                            |    2 +-
 drivers/serial/usbtty.h                            |    6 +-
 drivers/usb/{ => gadget}/Makefile                  |   30 +++----------
 drivers/usb/{usbdcore.c => gadget/core.c}          |    2 +-
 drivers/usb/{usbdcore_ep0.c => gadget/ep0.c}       |    2 +-
 include/usbdcore_ep0.h => drivers/usb/gadget/ep0.h |    0
 .../usb/{usbdcore_mpc8xx.c => gadget/mpc8xx_udc.c} |    9 ++--
 .../{usbdcore_omap1510.c => gadget/omap1510_udc.c} |    6 +-
 drivers/usb/{ => host}/Makefile                    |   37 +++++----------
 drivers/usb/{usb_ehci_core.h => host/ehci-core.h}  |    0
 drivers/usb/{usb_ehci_fsl.c => host/ehci-fsl.c}    |    6 +-
 drivers/usb/{usb_ehci_fsl.h => host/ehci-fsl.h}    |    0
 drivers/usb/{usb_ehci_core.c => host/ehci-hcd.c}   |    3 +-
 drivers/usb/{usb_ehci_ixp.c => host/ehci-ixp4xx.c} |    5 +-
 drivers/usb/{usb_ehci_pci.c => host/ehci-pci.c}    |    5 +-
 drivers/usb/{usb_ehci_vct.c => host/ehci-vct.c}    |    4 +-
 drivers/usb/{usb_ehci.h => host/ehci.h}            |    0
 drivers/usb/{ => host}/isp116x-hcd.c               |    0
 drivers/usb/{ => host}/isp116x.h                   |    0
 drivers/usb/{atmel_usb.c => host/ohci-at91.c}      |    0
 drivers/usb/{usb_ohci.c => host/ohci-hcd.c}        |    3 +-
 drivers/usb/{usb_ohci.h => host/ohci.h}            |    0
 drivers/usb/{ => host}/r8a66597-hcd.c              |    0
 drivers/usb/{ => host}/r8a66597.h                  |    0
 drivers/usb/{s3c64xx_usb.c => host/s3c64xx-hcd.c}  |    0
 drivers/usb/{sl811_usb.c => host/sl811-hcd.c}      |    2 +-
 drivers/usb/{ => host}/sl811.h                     |    0
 drivers/usb/musb/Makefile                          |   47 ++++++++++++++++++++
 drivers/usb/{davinci_usb.c => musb/davinci.c}      |    2 +-
 drivers/usb/{davinci_usb.h => musb/davinci.h}      |    0
 drivers/usb/{ => musb}/musb_core.c                 |    0
 drivers/usb/{ => musb}/musb_core.h                 |    0
 drivers/usb/{ => musb}/musb_hcd.c                  |    0
 drivers/usb/{ => musb}/musb_hcd.h                  |    0
 include/{usbdcore_mpc8xx.h => usb/mpc8xx_udc.h}    |    0
 .../{usbdcore_omap1510.h => usb/omap1510_udc.h}    |    0
 include/{usbdcore.h => usbdevice.h}                |    0
 38 files changed, 100 insertions(+), 75 deletions(-)
 copy drivers/usb/{ => gadget}/Makefile (60%)
 rename drivers/usb/{usbdcore.c => gadget/core.c} (99%)
 rename drivers/usb/{usbdcore_ep0.c => gadget/ep0.c} (99%)
 rename include/usbdcore_ep0.h => drivers/usb/gadget/ep0.h (100%)
 rename drivers/usb/{usbdcore_mpc8xx.c => gadget/mpc8xx_udc.c} (99%)
 rename drivers/usb/{usbdcore_omap1510.c => gadget/omap1510_udc.c} (99%)
 rename drivers/usb/{ => host}/Makefile (64%)
 rename drivers/usb/{usb_ehci_core.h => host/ehci-core.h} (100%)
 rename drivers/usb/{usb_ehci_fsl.c => host/ehci-fsl.c} (97%)
 rename drivers/usb/{usb_ehci_fsl.h => host/ehci-fsl.h} (100%)
 rename drivers/usb/{usb_ehci_core.c => host/ehci-hcd.c} (99%)
 rename drivers/usb/{usb_ehci_ixp.c => host/ehci-ixp4xx.c} (96%)
 rename drivers/usb/{usb_ehci_pci.c => host/ehci-pci.c} (97%)
 rename drivers/usb/{usb_ehci_vct.c => host/ehci-vct.c} (96%)
 rename drivers/usb/{usb_ehci.h => host/ehci.h} (100%)
 rename drivers/usb/{ => host}/isp116x-hcd.c (100%)
 rename drivers/usb/{ => host}/isp116x.h (100%)
 rename drivers/usb/{atmel_usb.c => host/ohci-at91.c} (100%)
 rename drivers/usb/{usb_ohci.c => host/ohci-hcd.c} (99%)
 rename drivers/usb/{usb_ohci.h => host/ohci.h} (100%)
 rename drivers/usb/{ => host}/r8a66597-hcd.c (100%)
 rename drivers/usb/{ => host}/r8a66597.h (100%)
 rename drivers/usb/{s3c64xx_usb.c => host/s3c64xx-hcd.c} (100%)
 rename drivers/usb/{sl811_usb.c => host/sl811-hcd.c} (99%)
 rename drivers/usb/{ => host}/sl811.h (100%)
 create mode 100644 drivers/usb/musb/Makefile
 rename drivers/usb/{davinci_usb.c => musb/davinci.c} (99%)
 rename drivers/usb/{davinci_usb.h => musb/davinci.h} (100%)
 rename drivers/usb/{ => musb}/musb_core.c (100%)
 rename drivers/usb/{ => musb}/musb_core.h (100%)
 rename drivers/usb/{ => musb}/musb_hcd.c (100%)
 rename drivers/usb/{ => musb}/musb_hcd.h (100%)
 rename include/{usbdcore_mpc8xx.h => usb/mpc8xx_udc.h} (100%)
 rename include/{usbdcore_omap1510.h => usb/omap1510_udc.h} (100%)
 rename include/{usbdcore.h => usbdevice.h} (100%)

diff --git a/Makefile b/Makefile
index 39c1903..b946009 100644
--- a/Makefile
+++ b/Makefile
@@ -263,7 +263,9 @@ endif
 LIBS += drivers/rtc/librtc.a
 LIBS += drivers/serial/libserial.a
 LIBS += drivers/twserial/libtws.a
-LIBS += drivers/usb/libusb.a
+LIBS += drivers/usb/gadget/libusb_gadget.a
+LIBS += drivers/usb/host/libusb_host.a
+LIBS += drivers/usb/musb/libusb_musb.a
 LIBS += drivers/video/libvideo.a
 LIBS += drivers/watchdog/libwatchdog.a
 LIBS += common/libcommon.a
diff --git a/drivers/serial/usbtty.c b/drivers/serial/usbtty.c
index d8b1387..f711d0b 100644
--- a/drivers/serial/usbtty.c
+++ b/drivers/serial/usbtty.c
@@ -94,7 +94,7 @@ static char serial_number[16];
  * Descriptors, Strings, Local variables.
  */
 
-/* defined and used by usbdcore_ep0.c */
+/* defined and used by gadget/ep0.c */
 extern struct usb_string_descriptor **usb_strings;
 
 /* Indicies, References */
diff --git a/drivers/serial/usbtty.h b/drivers/serial/usbtty.h
index ecefde5..77db972 100644
--- a/drivers/serial/usbtty.h
+++ b/drivers/serial/usbtty.h
@@ -24,11 +24,11 @@
 #ifndef __USB_TTY_H__
 #define __USB_TTY_H__
 
-#include <usbdcore.h>
+#include <usbdevice.h>
 #if defined(CONFIG_PPC)
-#include <usbdcore_mpc8xx.h>
+#include <usb/mpc8xx_udc.h>
 #elif defined(CONFIG_ARM)
-#include <usbdcore_omap1510.h>
+#include <usb/omap1510_udc.h>
 #endif
 
 #include <version_autogenerated.h>
diff --git a/drivers/usb/Makefile b/drivers/usb/gadget/Makefile
similarity index 60%
copy from drivers/usb/Makefile
copy to drivers/usb/gadget/Makefile
index 5523cbd..251724f 100644
--- a/drivers/usb/Makefile
+++ b/drivers/usb/gadget/Makefile
@@ -23,32 +23,14 @@
 
 include $(TOPDIR)/config.mk
 
-LIB	:= $(obj)libusb.a
+LIB	:= $(obj)libusb_gadget.a
 
-# core
-COBJS-y += usbdcore.o
-COBJS-$(CONFIG_USB_OHCI_NEW) += usb_ohci.o
-COBJS-$(CONFIG_USB_EHCI) += usb_ehci_core.o
-
-# host
-COBJS-$(CONFIG_USB_ATMEL) += atmel_usb.o
-COBJS-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o
-COBJS-$(CONFIG_USB_R8A66597_HCD) += r8a66597-hcd.o
-COBJS-$(CONFIG_USB_S3C64XX) += s3c64xx_usb.o
-COBJS-$(CONFIG_USB_SL811HS) += sl811_usb.o
-COBJS-$(CONFIG_USB_EHCI_FSL) += usb_ehci_fsl.o
-COBJS-$(CONFIG_USB_EHCI_PCI) += usb_ehci_pci.o
-COBJS-$(CONFIG_USB_EHCI_IXP4XX) += usb_ehci_ixp.o
-COBJS-$(CONFIG_MUSB_HCD) += musb_hcd.o musb_core.o
-COBJS-$(CONFIG_USB_DAVINCI) += davinci_usb.o
-COBJS-$(CONFIG_USB_EHCI_VCT) += usb_ehci_vct.o
-
-# device
 ifdef CONFIG_USB_DEVICE
-COBJS-y += usbdcore_ep0.o
-COBJS-$(CONFIG_OMAP1510) += usbdcore_omap1510.o
-COBJS-$(CONFIG_OMAP1610) += usbdcore_omap1510.o
-COBJS-$(CONFIG_MPC885_FAMILY) += usbdcore_mpc8xx.o
+COBJS-y += core.o
+COBJS-y += ep0.o
+COBJS-$(CONFIG_OMAP1510) += omap1510_udc.o
+COBJS-$(CONFIG_OMAP1610) += omap1510_udc.o
+COBJS-$(CONFIG_MPC885_FAMILY) += mpc8xx_udc.o
 endif
 
 COBJS	:= $(COBJS-y)
diff --git a/drivers/usb/usbdcore.c b/drivers/usb/gadget/core.c
similarity index 99%
rename from drivers/usb/usbdcore.c
rename to drivers/usb/gadget/core.c
index 53ed669..67b6681 100644
--- a/drivers/usb/usbdcore.c
+++ b/drivers/usb/gadget/core.c
@@ -30,7 +30,7 @@
  */
 
 #include <malloc.h>
-#include "usbdcore.h"
+#include <usbdevice.h>
 
 #define MAX_INTERFACES 2
 
diff --git a/drivers/usb/usbdcore_ep0.c b/drivers/usb/gadget/ep0.c
similarity index 99%
rename from drivers/usb/usbdcore_ep0.c
rename to drivers/usb/gadget/ep0.c
index f6e017d..2b4ec44 100644
--- a/drivers/usb/usbdcore_ep0.c
+++ b/drivers/usb/gadget/ep0.c
@@ -51,7 +51,7 @@
  */
 
 #include <common.h>
-#include "usbdcore.h"
+#include <usbdevice.h>
 
 #if 0
 #define dbg_ep0(lvl,fmt,args...) serial_printf("[%s] %s:%d: "fmt"\n",__FILE__,__FUNCTION__,__LINE__,##args)
diff --git a/include/usbdcore_ep0.h b/drivers/usb/gadget/ep0.h
similarity index 100%
rename from include/usbdcore_ep0.h
rename to drivers/usb/gadget/ep0.h
diff --git a/drivers/usb/usbdcore_mpc8xx.c b/drivers/usb/gadget/mpc8xx_udc.c
similarity index 99%
rename from drivers/usb/usbdcore_mpc8xx.c
rename to drivers/usb/gadget/mpc8xx_udc.c
index 0e311ad..da3fbba 100644
--- a/drivers/usb/usbdcore_mpc8xx.c
+++ b/drivers/usb/gadget/mpc8xx_udc.c
@@ -3,7 +3,7 @@
  * bodonoghue at CodeHermit.ie
  *
  * References
- * DasUBoot/drivers/usb/usbdcore_omap1510.c, for design and implementation
+ * DasUBoot/drivers/usb/gadget/omap1510_udc.c, for design and implementation
  * ideas.
  *
  * This program is free software; you can redistribute it and/or modify
@@ -59,9 +59,10 @@
 #include <common.h>
 #include <config.h>
 #include <commproc.h>
-#include "usbdcore.h"
-#include "usbdcore_mpc8xx.h"
-#include "usbdcore_ep0.h"
+#include <usbdevice.h>
+#include <usb/mpc8xx_udc.h>
+
+#include "ep0.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/drivers/usb/usbdcore_omap1510.c b/drivers/usb/gadget/omap1510_udc.c
similarity index 99%
rename from drivers/usb/usbdcore_omap1510.c
rename to drivers/usb/gadget/omap1510_udc.c
index 6b7b61b..90f7907 100644
--- a/drivers/usb/usbdcore_omap1510.c
+++ b/drivers/usb/gadget/omap1510_udc.c
@@ -31,10 +31,10 @@
 #ifdef CONFIG_OMAP_SX1
 #include <i2c.h>
 #endif
+#include <usbdevice.h>
+#include <usb/omap1510_udc.h>
 
-#include "usbdcore.h"
-#include "usbdcore_omap1510.h"
-#include "usbdcore_ep0.h"
+#include "ep0.h"
 
 
 #define UDC_INIT_MDELAY		     80 /* Device settle delay */
diff --git a/drivers/usb/Makefile b/drivers/usb/host/Makefile
similarity index 64%
rename from drivers/usb/Makefile
rename to drivers/usb/host/Makefile
index 5523cbd..ec1d689 100644
--- a/drivers/usb/Makefile
+++ b/drivers/usb/host/Makefile
@@ -23,33 +23,22 @@
 
 include $(TOPDIR)/config.mk
 
-LIB	:= $(obj)libusb.a
+LIB	:= $(obj)libusb_host.a
 
-# core
-COBJS-y += usbdcore.o
-COBJS-$(CONFIG_USB_OHCI_NEW) += usb_ohci.o
-COBJS-$(CONFIG_USB_EHCI) += usb_ehci_core.o
-
-# host
-COBJS-$(CONFIG_USB_ATMEL) += atmel_usb.o
+# ohci
+COBJS-$(CONFIG_USB_OHCI_NEW) += ohci-hcd.o
+COBJS-$(CONFIG_USB_ATMEL) += ohci-at91.o
 COBJS-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o
 COBJS-$(CONFIG_USB_R8A66597_HCD) += r8a66597-hcd.o
-COBJS-$(CONFIG_USB_S3C64XX) += s3c64xx_usb.o
-COBJS-$(CONFIG_USB_SL811HS) += sl811_usb.o
-COBJS-$(CONFIG_USB_EHCI_FSL) += usb_ehci_fsl.o
-COBJS-$(CONFIG_USB_EHCI_PCI) += usb_ehci_pci.o
-COBJS-$(CONFIG_USB_EHCI_IXP4XX) += usb_ehci_ixp.o
-COBJS-$(CONFIG_MUSB_HCD) += musb_hcd.o musb_core.o
-COBJS-$(CONFIG_USB_DAVINCI) += davinci_usb.o
-COBJS-$(CONFIG_USB_EHCI_VCT) += usb_ehci_vct.o
-
-# device
-ifdef CONFIG_USB_DEVICE
-COBJS-y += usbdcore_ep0.o
-COBJS-$(CONFIG_OMAP1510) += usbdcore_omap1510.o
-COBJS-$(CONFIG_OMAP1610) += usbdcore_omap1510.o
-COBJS-$(CONFIG_MPC885_FAMILY) += usbdcore_mpc8xx.o
-endif
+COBJS-$(CONFIG_USB_S3C64XX) += s3c64xx-hcd.o
+COBJS-$(CONFIG_USB_SL811HS) += sl811-hcd.o
+
+# echi
+COBJS-$(CONFIG_USB_EHCI) += ehci-hcd.o
+COBJS-$(CONFIG_USB_EHCI_FSL) += ehci-fsl.o
+COBJS-$(CONFIG_USB_EHCI_IXP4XX) += ehci-ixp.o
+COBJS-$(CONFIG_USB_EHCI_PCI) += ehci-pci.o
+COBJS-$(CONFIG_USB_EHCI_VCT) += ehci-vct.o
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
diff --git a/drivers/usb/usb_ehci_core.h b/drivers/usb/host/ehci-core.h
similarity index 100%
rename from drivers/usb/usb_ehci_core.h
rename to drivers/usb/host/ehci-core.h
diff --git a/drivers/usb/usb_ehci_fsl.c b/drivers/usb/host/ehci-fsl.c
similarity index 97%
rename from drivers/usb/usb_ehci_fsl.c
rename to drivers/usb/host/ehci-fsl.c
index 81d5d21..86ee1d5 100644
--- a/drivers/usb/usb_ehci_fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -26,9 +26,9 @@
 #include <asm/io.h>
 #include <asm/bitops.h>
 
-#include "usb_ehci.h"
-#include "usb_ehci_fsl.h"
-#include "usb_ehci_core.h"
+#include "ehci.h"
+#include "ehci-fsl.h"
+#include "ehci-core.h"
 
 /*
  * Create the appropriate control structures to manage
diff --git a/drivers/usb/usb_ehci_fsl.h b/drivers/usb/host/ehci-fsl.h
similarity index 100%
rename from drivers/usb/usb_ehci_fsl.h
rename to drivers/usb/host/ehci-fsl.h
diff --git a/drivers/usb/usb_ehci_core.c b/drivers/usb/host/ehci-hcd.c
similarity index 99%
rename from drivers/usb/usb_ehci_core.c
rename to drivers/usb/host/ehci-hcd.c
index 4dbfb66..bbd547b 100644
--- a/drivers/usb/usb_ehci_core.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -25,7 +25,8 @@
 #include <usb.h>
 #include <asm/io.h>
 #include <malloc.h>
-#include "usb_ehci.h"
+
+#include "ehci.h"
 
 int rootdev;
 struct ehci_hccr *hccr;	/* R/O registers, not need for volatile */
diff --git a/drivers/usb/usb_ehci_ixp.c b/drivers/usb/host/ehci-ixp4xx.c
similarity index 96%
rename from drivers/usb/usb_ehci_ixp.c
rename to drivers/usb/host/ehci-ixp4xx.c
index 25c18c1..b8f15ae 100644
--- a/drivers/usb/usb_ehci_ixp.c
+++ b/drivers/usb/host/ehci-ixp4xx.c
@@ -21,8 +21,9 @@
  */
 #include <common.h>
 #include <usb.h>
-#include "usb_ehci.h"
-#include "usb_ehci_core.h"
+
+#include "ehci.h"
+#include "ehci-core.h"
 /*
  * Create the appropriate control structures to manage
  * a new EHCI host controller.
diff --git a/drivers/usb/usb_ehci_pci.c b/drivers/usb/host/ehci-pci.c
similarity index 97%
rename from drivers/usb/usb_ehci_pci.c
rename to drivers/usb/host/ehci-pci.c
index 3e7143c..441b1a2 100644
--- a/drivers/usb/usb_ehci_pci.c
+++ b/drivers/usb/host/ehci-pci.c
@@ -21,8 +21,9 @@
 #include <common.h>
 #include <pci.h>
 #include <usb.h>
-#include "usb_ehci.h"
-#include "usb_ehci_core.h"
+
+#include "ehci.h"
+#include "ehci-core.h"
 
 #ifdef CONFIG_PCI_EHCI_DEVICE
 static struct pci_device_id ehci_pci_ids[] = {
diff --git a/drivers/usb/usb_ehci_vct.c b/drivers/usb/host/ehci-vct.c
similarity index 96%
rename from drivers/usb/usb_ehci_vct.c
rename to drivers/usb/host/ehci-vct.c
index 89daaaf..3063dd1 100644
--- a/drivers/usb/usb_ehci_vct.c
+++ b/drivers/usb/host/ehci-vct.c
@@ -20,8 +20,8 @@
 #include <common.h>
 #include <usb.h>
 
-#include "usb_ehci.h"
-#include "usb_ehci_core.h"
+#include "ehci.h"
+#include "ehci-core.h"
 
 int vct_ehci_hcd_init(u32 *hccr, u32 *hcor);
 
diff --git a/drivers/usb/usb_ehci.h b/drivers/usb/host/ehci.h
similarity index 100%
rename from drivers/usb/usb_ehci.h
rename to drivers/usb/host/ehci.h
diff --git a/drivers/usb/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c
similarity index 100%
rename from drivers/usb/isp116x-hcd.c
rename to drivers/usb/host/isp116x-hcd.c
diff --git a/drivers/usb/isp116x.h b/drivers/usb/host/isp116x.h
similarity index 100%
rename from drivers/usb/isp116x.h
rename to drivers/usb/host/isp116x.h
diff --git a/drivers/usb/atmel_usb.c b/drivers/usb/host/ohci-at91.c
similarity index 100%
rename from drivers/usb/atmel_usb.c
rename to drivers/usb/host/ohci-at91.c
diff --git a/drivers/usb/usb_ohci.c b/drivers/usb/host/ohci-hcd.c
similarity index 99%
rename from drivers/usb/usb_ohci.c
rename to drivers/usb/host/ohci-hcd.c
index 0bbee0f..e2f289e 100644
--- a/drivers/usb/usb_ohci.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -57,7 +57,8 @@
 
 #include <malloc.h>
 #include <usb.h>
-#include "usb_ohci.h"
+
+#include "ohci.h"
 
 #ifdef CONFIG_AT91RM9200
 #include <asm/arch/hardware.h>	/* needed for AT91_USB_HOST_BASE */
diff --git a/drivers/usb/usb_ohci.h b/drivers/usb/host/ohci.h
similarity index 100%
rename from drivers/usb/usb_ohci.h
rename to drivers/usb/host/ohci.h
diff --git a/drivers/usb/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
similarity index 100%
rename from drivers/usb/r8a66597-hcd.c
rename to drivers/usb/host/r8a66597-hcd.c
diff --git a/drivers/usb/r8a66597.h b/drivers/usb/host/r8a66597.h
similarity index 100%
rename from drivers/usb/r8a66597.h
rename to drivers/usb/host/r8a66597.h
diff --git a/drivers/usb/s3c64xx_usb.c b/drivers/usb/host/s3c64xx-hcd.c
similarity index 100%
rename from drivers/usb/s3c64xx_usb.c
rename to drivers/usb/host/s3c64xx-hcd.c
diff --git a/drivers/usb/sl811_usb.c b/drivers/usb/host/sl811-hcd.c
similarity index 99%
rename from drivers/usb/sl811_usb.c
rename to drivers/usb/host/sl811-hcd.c
index a03e469..82a8b36 100644
--- a/drivers/usb/sl811_usb.c
+++ b/drivers/usb/host/sl811-hcd.c
@@ -40,7 +40,7 @@
 #include <usb.h>
 #include "sl811.h"
 
-#include "../../board/kup/common/kup.h"
+#include "../../../board/kup/common/kup.h"
 
 #ifdef __PPC__
 # define EIEIO		__asm__ volatile ("eieio")
diff --git a/drivers/usb/sl811.h b/drivers/usb/host/sl811.h
similarity index 100%
rename from drivers/usb/sl811.h
rename to drivers/usb/host/sl811.h
diff --git a/drivers/usb/musb/Makefile b/drivers/usb/musb/Makefile
new file mode 100644
index 0000000..09e0a5f
--- /dev/null
+++ b/drivers/usb/musb/Makefile
@@ -0,0 +1,47 @@
+#
+# (C) Copyright 2000-2007
+# 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 $(TOPDIR)/config.mk
+
+LIB	:= $(obj)libusb_musb.a
+
+COBJS-$(CONFIG_MUSB_HCD) += musb_hcd.o musb_core.o
+COBJS-$(CONFIG_USB_DAVINCI) += davinci.o
+
+COBJS	:= $(COBJS-y)
+SRCS	:= $(COBJS:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS))
+
+all:	$(LIB)
+
+$(LIB):	$(obj).depend $(OBJS)
+	$(AR) $(ARFLAGS) $@ $(OBJS)
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/drivers/usb/davinci_usb.c b/drivers/usb/musb/davinci.c
similarity index 99%
rename from drivers/usb/davinci_usb.c
rename to drivers/usb/musb/davinci.c
index e66f660..a7648fc 100644
--- a/drivers/usb/davinci_usb.c
+++ b/drivers/usb/musb/davinci.c
@@ -23,7 +23,7 @@
 
 #include <common.h>
 #include <asm/io.h>
-#include "davinci_usb.h"
+#include "davinci.h"
 
 /* MUSB platform configuration */
 struct musb_config musb_cfg = {
diff --git a/drivers/usb/davinci_usb.h b/drivers/usb/musb/davinci.h
similarity index 100%
rename from drivers/usb/davinci_usb.h
rename to drivers/usb/musb/davinci.h
diff --git a/drivers/usb/musb_core.c b/drivers/usb/musb/musb_core.c
similarity index 100%
rename from drivers/usb/musb_core.c
rename to drivers/usb/musb/musb_core.c
diff --git a/drivers/usb/musb_core.h b/drivers/usb/musb/musb_core.h
similarity index 100%
rename from drivers/usb/musb_core.h
rename to drivers/usb/musb/musb_core.h
diff --git a/drivers/usb/musb_hcd.c b/drivers/usb/musb/musb_hcd.c
similarity index 100%
rename from drivers/usb/musb_hcd.c
rename to drivers/usb/musb/musb_hcd.c
diff --git a/drivers/usb/musb_hcd.h b/drivers/usb/musb/musb_hcd.h
similarity index 100%
rename from drivers/usb/musb_hcd.h
rename to drivers/usb/musb/musb_hcd.h
diff --git a/include/usbdcore_mpc8xx.h b/include/usb/mpc8xx_udc.h
similarity index 100%
rename from include/usbdcore_mpc8xx.h
rename to include/usb/mpc8xx_udc.h
diff --git a/include/usbdcore_omap1510.h b/include/usb/omap1510_udc.h
similarity index 100%
rename from include/usbdcore_omap1510.h
rename to include/usb/omap1510_udc.h
diff --git a/include/usbdcore.h b/include/usbdevice.h
similarity index 100%
rename from include/usbdcore.h
rename to include/usbdevice.h
-- 
1.6.1.3

^ permalink raw reply related	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH] drivers/usb: regorganisation
  2009-04-03 10:46                                                       ` [U-Boot] [PATCH] " Jean-Christophe PLAGNIOL-VILLARD
@ 2009-04-03 11:19                                                         ` Remy Bohmer
  0 siblings, 0 replies; 62+ messages in thread
From: Remy Bohmer @ 2009-04-03 11:19 UTC (permalink / raw)
  To: u-boot

Hello Jean-Christophe,

2009/4/3 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>:
> move to linux usb driver organisation
>
> as following
>
> drivers/usb/gadget
> drivers/usb/host
> drivers/usb/musb
>
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> Cc: Remy Bohmer <linux@bohmer.net>
> ---
> Hi Remy,
> This version containt everyone ask
> and is based on the AT91 tree
> which contain the patch that move the at91 usb to drivers/usb

I will wait until the at91 has been pulled by mainline, then I can
integrate this patch in the usb-branch

Thanks.

Remy


>
> Best Regards,
> J.
> ?Makefile ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? | ? ?4 +-
> ?drivers/serial/usbtty.c ? ? ? ? ? ? ? ? ? ? ? ? ? ?| ? ?2 +-
> ?drivers/serial/usbtty.h ? ? ? ? ? ? ? ? ? ? ? ? ? ?| ? ?6 +-
> ?drivers/usb/{ => gadget}/Makefile ? ? ? ? ? ? ? ? ?| ? 30 +++----------
> ?drivers/usb/{usbdcore.c => gadget/core.c} ? ? ? ? ?| ? ?2 +-
> ?drivers/usb/{usbdcore_ep0.c => gadget/ep0.c} ? ? ? | ? ?2 +-
> ?include/usbdcore_ep0.h => drivers/usb/gadget/ep0.h | ? ?0
> ?.../usb/{usbdcore_mpc8xx.c => gadget/mpc8xx_udc.c} | ? ?9 ++--
> ?.../{usbdcore_omap1510.c => gadget/omap1510_udc.c} | ? ?6 +-
> ?drivers/usb/{ => host}/Makefile ? ? ? ? ? ? ? ? ? ?| ? 37 +++++----------
> ?drivers/usb/{usb_ehci_core.h => host/ehci-core.h} ?| ? ?0
> ?drivers/usb/{usb_ehci_fsl.c => host/ehci-fsl.c} ? ?| ? ?6 +-
> ?drivers/usb/{usb_ehci_fsl.h => host/ehci-fsl.h} ? ?| ? ?0
> ?drivers/usb/{usb_ehci_core.c => host/ehci-hcd.c} ? | ? ?3 +-
> ?drivers/usb/{usb_ehci_ixp.c => host/ehci-ixp4xx.c} | ? ?5 +-
> ?drivers/usb/{usb_ehci_pci.c => host/ehci-pci.c} ? ?| ? ?5 +-
> ?drivers/usb/{usb_ehci_vct.c => host/ehci-vct.c} ? ?| ? ?4 +-
> ?drivers/usb/{usb_ehci.h => host/ehci.h} ? ? ? ? ? ?| ? ?0
> ?drivers/usb/{ => host}/isp116x-hcd.c ? ? ? ? ? ? ? | ? ?0
> ?drivers/usb/{ => host}/isp116x.h ? ? ? ? ? ? ? ? ? | ? ?0
> ?drivers/usb/{atmel_usb.c => host/ohci-at91.c} ? ? ?| ? ?0
> ?drivers/usb/{usb_ohci.c => host/ohci-hcd.c} ? ? ? ?| ? ?3 +-
> ?drivers/usb/{usb_ohci.h => host/ohci.h} ? ? ? ? ? ?| ? ?0
> ?drivers/usb/{ => host}/r8a66597-hcd.c ? ? ? ? ? ? ?| ? ?0
> ?drivers/usb/{ => host}/r8a66597.h ? ? ? ? ? ? ? ? ?| ? ?0
> ?drivers/usb/{s3c64xx_usb.c => host/s3c64xx-hcd.c} ?| ? ?0
> ?drivers/usb/{sl811_usb.c => host/sl811-hcd.c} ? ? ?| ? ?2 +-
> ?drivers/usb/{ => host}/sl811.h ? ? ? ? ? ? ? ? ? ? | ? ?0
> ?drivers/usb/musb/Makefile ? ? ? ? ? ? ? ? ? ? ? ? ?| ? 47 ++++++++++++++++++++
> ?drivers/usb/{davinci_usb.c => musb/davinci.c} ? ? ?| ? ?2 +-
> ?drivers/usb/{davinci_usb.h => musb/davinci.h} ? ? ?| ? ?0
> ?drivers/usb/{ => musb}/musb_core.c ? ? ? ? ? ? ? ? | ? ?0
> ?drivers/usb/{ => musb}/musb_core.h ? ? ? ? ? ? ? ? | ? ?0
> ?drivers/usb/{ => musb}/musb_hcd.c ? ? ? ? ? ? ? ? ?| ? ?0
> ?drivers/usb/{ => musb}/musb_hcd.h ? ? ? ? ? ? ? ? ?| ? ?0
> ?include/{usbdcore_mpc8xx.h => usb/mpc8xx_udc.h} ? ?| ? ?0
> ?.../{usbdcore_omap1510.h => usb/omap1510_udc.h} ? ?| ? ?0
> ?include/{usbdcore.h => usbdevice.h} ? ? ? ? ? ? ? ?| ? ?0
> ?38 files changed, 100 insertions(+), 75 deletions(-)
> ?copy drivers/usb/{ => gadget}/Makefile (60%)
> ?rename drivers/usb/{usbdcore.c => gadget/core.c} (99%)
> ?rename drivers/usb/{usbdcore_ep0.c => gadget/ep0.c} (99%)
> ?rename include/usbdcore_ep0.h => drivers/usb/gadget/ep0.h (100%)
> ?rename drivers/usb/{usbdcore_mpc8xx.c => gadget/mpc8xx_udc.c} (99%)
> ?rename drivers/usb/{usbdcore_omap1510.c => gadget/omap1510_udc.c} (99%)
> ?rename drivers/usb/{ => host}/Makefile (64%)
> ?rename drivers/usb/{usb_ehci_core.h => host/ehci-core.h} (100%)
> ?rename drivers/usb/{usb_ehci_fsl.c => host/ehci-fsl.c} (97%)
> ?rename drivers/usb/{usb_ehci_fsl.h => host/ehci-fsl.h} (100%)
> ?rename drivers/usb/{usb_ehci_core.c => host/ehci-hcd.c} (99%)
> ?rename drivers/usb/{usb_ehci_ixp.c => host/ehci-ixp4xx.c} (96%)
> ?rename drivers/usb/{usb_ehci_pci.c => host/ehci-pci.c} (97%)
> ?rename drivers/usb/{usb_ehci_vct.c => host/ehci-vct.c} (96%)
> ?rename drivers/usb/{usb_ehci.h => host/ehci.h} (100%)
> ?rename drivers/usb/{ => host}/isp116x-hcd.c (100%)
> ?rename drivers/usb/{ => host}/isp116x.h (100%)
> ?rename drivers/usb/{atmel_usb.c => host/ohci-at91.c} (100%)
> ?rename drivers/usb/{usb_ohci.c => host/ohci-hcd.c} (99%)
> ?rename drivers/usb/{usb_ohci.h => host/ohci.h} (100%)
> ?rename drivers/usb/{ => host}/r8a66597-hcd.c (100%)
> ?rename drivers/usb/{ => host}/r8a66597.h (100%)
> ?rename drivers/usb/{s3c64xx_usb.c => host/s3c64xx-hcd.c} (100%)
> ?rename drivers/usb/{sl811_usb.c => host/sl811-hcd.c} (99%)
> ?rename drivers/usb/{ => host}/sl811.h (100%)
> ?create mode 100644 drivers/usb/musb/Makefile
> ?rename drivers/usb/{davinci_usb.c => musb/davinci.c} (99%)
> ?rename drivers/usb/{davinci_usb.h => musb/davinci.h} (100%)
> ?rename drivers/usb/{ => musb}/musb_core.c (100%)
> ?rename drivers/usb/{ => musb}/musb_core.h (100%)
> ?rename drivers/usb/{ => musb}/musb_hcd.c (100%)
> ?rename drivers/usb/{ => musb}/musb_hcd.h (100%)
> ?rename include/{usbdcore_mpc8xx.h => usb/mpc8xx_udc.h} (100%)
> ?rename include/{usbdcore_omap1510.h => usb/omap1510_udc.h} (100%)
> ?rename include/{usbdcore.h => usbdevice.h} (100%)
>
> diff --git a/Makefile b/Makefile
> index 39c1903..b946009 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -263,7 +263,9 @@ endif
> ?LIBS += drivers/rtc/librtc.a
> ?LIBS += drivers/serial/libserial.a
> ?LIBS += drivers/twserial/libtws.a
> -LIBS += drivers/usb/libusb.a
> +LIBS += drivers/usb/gadget/libusb_gadget.a
> +LIBS += drivers/usb/host/libusb_host.a
> +LIBS += drivers/usb/musb/libusb_musb.a
> ?LIBS += drivers/video/libvideo.a
> ?LIBS += drivers/watchdog/libwatchdog.a
> ?LIBS += common/libcommon.a
> diff --git a/drivers/serial/usbtty.c b/drivers/serial/usbtty.c
> index d8b1387..f711d0b 100644
> --- a/drivers/serial/usbtty.c
> +++ b/drivers/serial/usbtty.c
> @@ -94,7 +94,7 @@ static char serial_number[16];
> ?* Descriptors, Strings, Local variables.
> ?*/
>
> -/* defined and used by usbdcore_ep0.c */
> +/* defined and used by gadget/ep0.c */
> ?extern struct usb_string_descriptor **usb_strings;
>
> ?/* Indicies, References */
> diff --git a/drivers/serial/usbtty.h b/drivers/serial/usbtty.h
> index ecefde5..77db972 100644
> --- a/drivers/serial/usbtty.h
> +++ b/drivers/serial/usbtty.h
> @@ -24,11 +24,11 @@
> ?#ifndef __USB_TTY_H__
> ?#define __USB_TTY_H__
>
> -#include <usbdcore.h>
> +#include <usbdevice.h>
> ?#if defined(CONFIG_PPC)
> -#include <usbdcore_mpc8xx.h>
> +#include <usb/mpc8xx_udc.h>
> ?#elif defined(CONFIG_ARM)
> -#include <usbdcore_omap1510.h>
> +#include <usb/omap1510_udc.h>
> ?#endif
>
> ?#include <version_autogenerated.h>
> diff --git a/drivers/usb/Makefile b/drivers/usb/gadget/Makefile
> similarity index 60%
> copy from drivers/usb/Makefile
> copy to drivers/usb/gadget/Makefile
> index 5523cbd..251724f 100644
> --- a/drivers/usb/Makefile
> +++ b/drivers/usb/gadget/Makefile
> @@ -23,32 +23,14 @@
>
> ?include $(TOPDIR)/config.mk
>
> -LIB ? ?:= $(obj)libusb.a
> +LIB ? ?:= $(obj)libusb_gadget.a
>
> -# core
> -COBJS-y += usbdcore.o
> -COBJS-$(CONFIG_USB_OHCI_NEW) += usb_ohci.o
> -COBJS-$(CONFIG_USB_EHCI) += usb_ehci_core.o
> -
> -# host
> -COBJS-$(CONFIG_USB_ATMEL) += atmel_usb.o
> -COBJS-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o
> -COBJS-$(CONFIG_USB_R8A66597_HCD) += r8a66597-hcd.o
> -COBJS-$(CONFIG_USB_S3C64XX) += s3c64xx_usb.o
> -COBJS-$(CONFIG_USB_SL811HS) += sl811_usb.o
> -COBJS-$(CONFIG_USB_EHCI_FSL) += usb_ehci_fsl.o
> -COBJS-$(CONFIG_USB_EHCI_PCI) += usb_ehci_pci.o
> -COBJS-$(CONFIG_USB_EHCI_IXP4XX) += usb_ehci_ixp.o
> -COBJS-$(CONFIG_MUSB_HCD) += musb_hcd.o musb_core.o
> -COBJS-$(CONFIG_USB_DAVINCI) += davinci_usb.o
> -COBJS-$(CONFIG_USB_EHCI_VCT) += usb_ehci_vct.o
> -
> -# device
> ?ifdef CONFIG_USB_DEVICE
> -COBJS-y += usbdcore_ep0.o
> -COBJS-$(CONFIG_OMAP1510) += usbdcore_omap1510.o
> -COBJS-$(CONFIG_OMAP1610) += usbdcore_omap1510.o
> -COBJS-$(CONFIG_MPC885_FAMILY) += usbdcore_mpc8xx.o
> +COBJS-y += core.o
> +COBJS-y += ep0.o
> +COBJS-$(CONFIG_OMAP1510) += omap1510_udc.o
> +COBJS-$(CONFIG_OMAP1610) += omap1510_udc.o
> +COBJS-$(CONFIG_MPC885_FAMILY) += mpc8xx_udc.o
> ?endif
>
> ?COBJS ?:= $(COBJS-y)
> diff --git a/drivers/usb/usbdcore.c b/drivers/usb/gadget/core.c
> similarity index 99%
> rename from drivers/usb/usbdcore.c
> rename to drivers/usb/gadget/core.c
> index 53ed669..67b6681 100644
> --- a/drivers/usb/usbdcore.c
> +++ b/drivers/usb/gadget/core.c
> @@ -30,7 +30,7 @@
> ?*/
>
> ?#include <malloc.h>
> -#include "usbdcore.h"
> +#include <usbdevice.h>
>
> ?#define MAX_INTERFACES 2
>
> diff --git a/drivers/usb/usbdcore_ep0.c b/drivers/usb/gadget/ep0.c
> similarity index 99%
> rename from drivers/usb/usbdcore_ep0.c
> rename to drivers/usb/gadget/ep0.c
> index f6e017d..2b4ec44 100644
> --- a/drivers/usb/usbdcore_ep0.c
> +++ b/drivers/usb/gadget/ep0.c
> @@ -51,7 +51,7 @@
> ?*/
>
> ?#include <common.h>
> -#include "usbdcore.h"
> +#include <usbdevice.h>
>
> ?#if 0
> ?#define dbg_ep0(lvl,fmt,args...) serial_printf("[%s] %s:%d: "fmt"\n",__FILE__,__FUNCTION__,__LINE__,##args)
> diff --git a/include/usbdcore_ep0.h b/drivers/usb/gadget/ep0.h
> similarity index 100%
> rename from include/usbdcore_ep0.h
> rename to drivers/usb/gadget/ep0.h
> diff --git a/drivers/usb/usbdcore_mpc8xx.c b/drivers/usb/gadget/mpc8xx_udc.c
> similarity index 99%
> rename from drivers/usb/usbdcore_mpc8xx.c
> rename to drivers/usb/gadget/mpc8xx_udc.c
> index 0e311ad..da3fbba 100644
> --- a/drivers/usb/usbdcore_mpc8xx.c
> +++ b/drivers/usb/gadget/mpc8xx_udc.c
> @@ -3,7 +3,7 @@
> ?* bodonoghue at CodeHermit.ie
> ?*
> ?* References
> - * DasUBoot/drivers/usb/usbdcore_omap1510.c, for design and implementation
> + * DasUBoot/drivers/usb/gadget/omap1510_udc.c, for design and implementation
> ?* ideas.
> ?*
> ?* This program is free software; you can redistribute it and/or modify
> @@ -59,9 +59,10 @@
> ?#include <common.h>
> ?#include <config.h>
> ?#include <commproc.h>
> -#include "usbdcore.h"
> -#include "usbdcore_mpc8xx.h"
> -#include "usbdcore_ep0.h"
> +#include <usbdevice.h>
> +#include <usb/mpc8xx_udc.h>
> +
> +#include "ep0.h"
>
> ?DECLARE_GLOBAL_DATA_PTR;
>
> diff --git a/drivers/usb/usbdcore_omap1510.c b/drivers/usb/gadget/omap1510_udc.c
> similarity index 99%
> rename from drivers/usb/usbdcore_omap1510.c
> rename to drivers/usb/gadget/omap1510_udc.c
> index 6b7b61b..90f7907 100644
> --- a/drivers/usb/usbdcore_omap1510.c
> +++ b/drivers/usb/gadget/omap1510_udc.c
> @@ -31,10 +31,10 @@
> ?#ifdef CONFIG_OMAP_SX1
> ?#include <i2c.h>
> ?#endif
> +#include <usbdevice.h>
> +#include <usb/omap1510_udc.h>
>
> -#include "usbdcore.h"
> -#include "usbdcore_omap1510.h"
> -#include "usbdcore_ep0.h"
> +#include "ep0.h"
>
>
> ?#define UDC_INIT_MDELAY ? ? ? ? ? ? ? ? ? ? 80 /* Device settle delay */
> diff --git a/drivers/usb/Makefile b/drivers/usb/host/Makefile
> similarity index 64%
> rename from drivers/usb/Makefile
> rename to drivers/usb/host/Makefile
> index 5523cbd..ec1d689 100644
> --- a/drivers/usb/Makefile
> +++ b/drivers/usb/host/Makefile
> @@ -23,33 +23,22 @@
>
> ?include $(TOPDIR)/config.mk
>
> -LIB ? ?:= $(obj)libusb.a
> +LIB ? ?:= $(obj)libusb_host.a
>
> -# core
> -COBJS-y += usbdcore.o
> -COBJS-$(CONFIG_USB_OHCI_NEW) += usb_ohci.o
> -COBJS-$(CONFIG_USB_EHCI) += usb_ehci_core.o
> -
> -# host
> -COBJS-$(CONFIG_USB_ATMEL) += atmel_usb.o
> +# ohci
> +COBJS-$(CONFIG_USB_OHCI_NEW) += ohci-hcd.o
> +COBJS-$(CONFIG_USB_ATMEL) += ohci-at91.o
> ?COBJS-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o
> ?COBJS-$(CONFIG_USB_R8A66597_HCD) += r8a66597-hcd.o
> -COBJS-$(CONFIG_USB_S3C64XX) += s3c64xx_usb.o
> -COBJS-$(CONFIG_USB_SL811HS) += sl811_usb.o
> -COBJS-$(CONFIG_USB_EHCI_FSL) += usb_ehci_fsl.o
> -COBJS-$(CONFIG_USB_EHCI_PCI) += usb_ehci_pci.o
> -COBJS-$(CONFIG_USB_EHCI_IXP4XX) += usb_ehci_ixp.o
> -COBJS-$(CONFIG_MUSB_HCD) += musb_hcd.o musb_core.o
> -COBJS-$(CONFIG_USB_DAVINCI) += davinci_usb.o
> -COBJS-$(CONFIG_USB_EHCI_VCT) += usb_ehci_vct.o
> -
> -# device
> -ifdef CONFIG_USB_DEVICE
> -COBJS-y += usbdcore_ep0.o
> -COBJS-$(CONFIG_OMAP1510) += usbdcore_omap1510.o
> -COBJS-$(CONFIG_OMAP1610) += usbdcore_omap1510.o
> -COBJS-$(CONFIG_MPC885_FAMILY) += usbdcore_mpc8xx.o
> -endif
> +COBJS-$(CONFIG_USB_S3C64XX) += s3c64xx-hcd.o
> +COBJS-$(CONFIG_USB_SL811HS) += sl811-hcd.o
> +
> +# echi
> +COBJS-$(CONFIG_USB_EHCI) += ehci-hcd.o
> +COBJS-$(CONFIG_USB_EHCI_FSL) += ehci-fsl.o
> +COBJS-$(CONFIG_USB_EHCI_IXP4XX) += ehci-ixp.o
> +COBJS-$(CONFIG_USB_EHCI_PCI) += ehci-pci.o
> +COBJS-$(CONFIG_USB_EHCI_VCT) += ehci-vct.o
>
> ?COBJS ?:= $(COBJS-y)
> ?SRCS ? := $(COBJS:.o=.c)
> diff --git a/drivers/usb/usb_ehci_core.h b/drivers/usb/host/ehci-core.h
> similarity index 100%
> rename from drivers/usb/usb_ehci_core.h
> rename to drivers/usb/host/ehci-core.h
> diff --git a/drivers/usb/usb_ehci_fsl.c b/drivers/usb/host/ehci-fsl.c
> similarity index 97%
> rename from drivers/usb/usb_ehci_fsl.c
> rename to drivers/usb/host/ehci-fsl.c
> index 81d5d21..86ee1d5 100644
> --- a/drivers/usb/usb_ehci_fsl.c
> +++ b/drivers/usb/host/ehci-fsl.c
> @@ -26,9 +26,9 @@
> ?#include <asm/io.h>
> ?#include <asm/bitops.h>
>
> -#include "usb_ehci.h"
> -#include "usb_ehci_fsl.h"
> -#include "usb_ehci_core.h"
> +#include "ehci.h"
> +#include "ehci-fsl.h"
> +#include "ehci-core.h"
>
> ?/*
> ?* Create the appropriate control structures to manage
> diff --git a/drivers/usb/usb_ehci_fsl.h b/drivers/usb/host/ehci-fsl.h
> similarity index 100%
> rename from drivers/usb/usb_ehci_fsl.h
> rename to drivers/usb/host/ehci-fsl.h
> diff --git a/drivers/usb/usb_ehci_core.c b/drivers/usb/host/ehci-hcd.c
> similarity index 99%
> rename from drivers/usb/usb_ehci_core.c
> rename to drivers/usb/host/ehci-hcd.c
> index 4dbfb66..bbd547b 100644
> --- a/drivers/usb/usb_ehci_core.c
> +++ b/drivers/usb/host/ehci-hcd.c
> @@ -25,7 +25,8 @@
> ?#include <usb.h>
> ?#include <asm/io.h>
> ?#include <malloc.h>
> -#include "usb_ehci.h"
> +
> +#include "ehci.h"
>
> ?int rootdev;
> ?struct ehci_hccr *hccr; ? ? ? ?/* R/O registers, not need for volatile */
> diff --git a/drivers/usb/usb_ehci_ixp.c b/drivers/usb/host/ehci-ixp4xx.c
> similarity index 96%
> rename from drivers/usb/usb_ehci_ixp.c
> rename to drivers/usb/host/ehci-ixp4xx.c
> index 25c18c1..b8f15ae 100644
> --- a/drivers/usb/usb_ehci_ixp.c
> +++ b/drivers/usb/host/ehci-ixp4xx.c
> @@ -21,8 +21,9 @@
> ?*/
> ?#include <common.h>
> ?#include <usb.h>
> -#include "usb_ehci.h"
> -#include "usb_ehci_core.h"
> +
> +#include "ehci.h"
> +#include "ehci-core.h"
> ?/*
> ?* Create the appropriate control structures to manage
> ?* a new EHCI host controller.
> diff --git a/drivers/usb/usb_ehci_pci.c b/drivers/usb/host/ehci-pci.c
> similarity index 97%
> rename from drivers/usb/usb_ehci_pci.c
> rename to drivers/usb/host/ehci-pci.c
> index 3e7143c..441b1a2 100644
> --- a/drivers/usb/usb_ehci_pci.c
> +++ b/drivers/usb/host/ehci-pci.c
> @@ -21,8 +21,9 @@
> ?#include <common.h>
> ?#include <pci.h>
> ?#include <usb.h>
> -#include "usb_ehci.h"
> -#include "usb_ehci_core.h"
> +
> +#include "ehci.h"
> +#include "ehci-core.h"
>
> ?#ifdef CONFIG_PCI_EHCI_DEVICE
> ?static struct pci_device_id ehci_pci_ids[] = {
> diff --git a/drivers/usb/usb_ehci_vct.c b/drivers/usb/host/ehci-vct.c
> similarity index 96%
> rename from drivers/usb/usb_ehci_vct.c
> rename to drivers/usb/host/ehci-vct.c
> index 89daaaf..3063dd1 100644
> --- a/drivers/usb/usb_ehci_vct.c
> +++ b/drivers/usb/host/ehci-vct.c
> @@ -20,8 +20,8 @@
> ?#include <common.h>
> ?#include <usb.h>
>
> -#include "usb_ehci.h"
> -#include "usb_ehci_core.h"
> +#include "ehci.h"
> +#include "ehci-core.h"
>
> ?int vct_ehci_hcd_init(u32 *hccr, u32 *hcor);
>
> diff --git a/drivers/usb/usb_ehci.h b/drivers/usb/host/ehci.h
> similarity index 100%
> rename from drivers/usb/usb_ehci.h
> rename to drivers/usb/host/ehci.h
> diff --git a/drivers/usb/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c
> similarity index 100%
> rename from drivers/usb/isp116x-hcd.c
> rename to drivers/usb/host/isp116x-hcd.c
> diff --git a/drivers/usb/isp116x.h b/drivers/usb/host/isp116x.h
> similarity index 100%
> rename from drivers/usb/isp116x.h
> rename to drivers/usb/host/isp116x.h
> diff --git a/drivers/usb/atmel_usb.c b/drivers/usb/host/ohci-at91.c
> similarity index 100%
> rename from drivers/usb/atmel_usb.c
> rename to drivers/usb/host/ohci-at91.c
> diff --git a/drivers/usb/usb_ohci.c b/drivers/usb/host/ohci-hcd.c
> similarity index 99%
> rename from drivers/usb/usb_ohci.c
> rename to drivers/usb/host/ohci-hcd.c
> index 0bbee0f..e2f289e 100644
> --- a/drivers/usb/usb_ohci.c
> +++ b/drivers/usb/host/ohci-hcd.c
> @@ -57,7 +57,8 @@
>
> ?#include <malloc.h>
> ?#include <usb.h>
> -#include "usb_ohci.h"
> +
> +#include "ohci.h"
>
> ?#ifdef CONFIG_AT91RM9200
> ?#include <asm/arch/hardware.h> /* needed for AT91_USB_HOST_BASE */
> diff --git a/drivers/usb/usb_ohci.h b/drivers/usb/host/ohci.h
> similarity index 100%
> rename from drivers/usb/usb_ohci.h
> rename to drivers/usb/host/ohci.h
> diff --git a/drivers/usb/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
> similarity index 100%
> rename from drivers/usb/r8a66597-hcd.c
> rename to drivers/usb/host/r8a66597-hcd.c
> diff --git a/drivers/usb/r8a66597.h b/drivers/usb/host/r8a66597.h
> similarity index 100%
> rename from drivers/usb/r8a66597.h
> rename to drivers/usb/host/r8a66597.h
> diff --git a/drivers/usb/s3c64xx_usb.c b/drivers/usb/host/s3c64xx-hcd.c
> similarity index 100%
> rename from drivers/usb/s3c64xx_usb.c
> rename to drivers/usb/host/s3c64xx-hcd.c
> diff --git a/drivers/usb/sl811_usb.c b/drivers/usb/host/sl811-hcd.c
> similarity index 99%
> rename from drivers/usb/sl811_usb.c
> rename to drivers/usb/host/sl811-hcd.c
> index a03e469..82a8b36 100644
> --- a/drivers/usb/sl811_usb.c
> +++ b/drivers/usb/host/sl811-hcd.c
> @@ -40,7 +40,7 @@
> ?#include <usb.h>
> ?#include "sl811.h"
>
> -#include "../../board/kup/common/kup.h"
> +#include "../../../board/kup/common/kup.h"
>
> ?#ifdef __PPC__
> ?# define EIEIO ? ? ? ? __asm__ volatile ("eieio")
> diff --git a/drivers/usb/sl811.h b/drivers/usb/host/sl811.h
> similarity index 100%
> rename from drivers/usb/sl811.h
> rename to drivers/usb/host/sl811.h
> diff --git a/drivers/usb/musb/Makefile b/drivers/usb/musb/Makefile
> new file mode 100644
> index 0000000..09e0a5f
> --- /dev/null
> +++ b/drivers/usb/musb/Makefile
> @@ -0,0 +1,47 @@
> +#
> +# (C) Copyright 2000-2007
> +# 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 $(TOPDIR)/config.mk
> +
> +LIB ? ?:= $(obj)libusb_musb.a
> +
> +COBJS-$(CONFIG_MUSB_HCD) += musb_hcd.o musb_core.o
> +COBJS-$(CONFIG_USB_DAVINCI) += davinci.o
> +
> +COBJS ?:= $(COBJS-y)
> +SRCS ? := $(COBJS:.o=.c)
> +OBJS ? := $(addprefix $(obj),$(COBJS))
> +
> +all: ? $(LIB)
> +
> +$(LIB): ? ? ? ?$(obj).depend $(OBJS)
> + ? ? ? $(AR) $(ARFLAGS) $@ $(OBJS)
> +
> +#########################################################################
> +
> +# defines $(obj).depend target
> +include $(SRCTREE)/rules.mk
> +
> +sinclude $(obj).depend
> +
> +#########################################################################
> diff --git a/drivers/usb/davinci_usb.c b/drivers/usb/musb/davinci.c
> similarity index 99%
> rename from drivers/usb/davinci_usb.c
> rename to drivers/usb/musb/davinci.c
> index e66f660..a7648fc 100644
> --- a/drivers/usb/davinci_usb.c
> +++ b/drivers/usb/musb/davinci.c
> @@ -23,7 +23,7 @@
>
> ?#include <common.h>
> ?#include <asm/io.h>
> -#include "davinci_usb.h"
> +#include "davinci.h"
>
> ?/* MUSB platform configuration */
> ?struct musb_config musb_cfg = {
> diff --git a/drivers/usb/davinci_usb.h b/drivers/usb/musb/davinci.h
> similarity index 100%
> rename from drivers/usb/davinci_usb.h
> rename to drivers/usb/musb/davinci.h
> diff --git a/drivers/usb/musb_core.c b/drivers/usb/musb/musb_core.c
> similarity index 100%
> rename from drivers/usb/musb_core.c
> rename to drivers/usb/musb/musb_core.c
> diff --git a/drivers/usb/musb_core.h b/drivers/usb/musb/musb_core.h
> similarity index 100%
> rename from drivers/usb/musb_core.h
> rename to drivers/usb/musb/musb_core.h
> diff --git a/drivers/usb/musb_hcd.c b/drivers/usb/musb/musb_hcd.c
> similarity index 100%
> rename from drivers/usb/musb_hcd.c
> rename to drivers/usb/musb/musb_hcd.c
> diff --git a/drivers/usb/musb_hcd.h b/drivers/usb/musb/musb_hcd.h
> similarity index 100%
> rename from drivers/usb/musb_hcd.h
> rename to drivers/usb/musb/musb_hcd.h
> diff --git a/include/usbdcore_mpc8xx.h b/include/usb/mpc8xx_udc.h
> similarity index 100%
> rename from include/usbdcore_mpc8xx.h
> rename to include/usb/mpc8xx_udc.h
> diff --git a/include/usbdcore_omap1510.h b/include/usb/omap1510_udc.h
> similarity index 100%
> rename from include/usbdcore_omap1510.h
> rename to include/usb/omap1510_udc.h
> diff --git a/include/usbdcore.h b/include/usbdevice.h
> similarity index 100%
> rename from include/usbdcore.h
> rename to include/usbdevice.h
> --
> 1.6.1.3
>
>

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 12/13] at91: add hardware i2c drivers
  2009-03-27 22:30                     ` [U-Boot] [PATCH 12/13] at91: add hardware i2c drivers Jean-Christophe PLAGNIOL-VILLARD
  2009-03-27 22:30                       ` [U-Boot] [PATCH 13/13] at91sam9263ek: active hush and auto compelete support Jean-Christophe PLAGNIOL-VILLARD
  2009-03-30  5:53                       ` [U-Boot] [PATCH 12/13] at91: add hardware i2c drivers Heiko Schocher
@ 2009-05-14  6:06                       ` Daniel Gorsulowski
  2 siblings, 0 replies; 62+ messages in thread
From: Daniel Gorsulowski @ 2009-05-14  6:06 UTC (permalink / raw)
  To: u-boot

Dear Jean-Christophe,

On Friday 27 March 2009 23:30 you wrote:
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  cpu/arm926ejs/at91/Makefile                        |    6 +
>  .../arm926ejs/at91/at91cap9_i2c.c                  |   31 ++--
>  .../arm926ejs/at91/at91sam9260_i2c.c               |   31 ++--
>  .../arm926ejs/at91/at91sam9261_i2c.c               |   31 ++--
>  .../arm926ejs/at91/at91sam9263_i2c.c               |   31 ++--
>  .../clk.h => cpu/arm926ejs/at91/at91sam9rl_i2c.c   |   37 ++--
>  drivers/i2c/Makefile                               |    1 +
>  drivers/i2c/atmel_i2c.c                            |  234 ++++++++++++++++++++
>  include/asm-arm/arch-at91/at91_common.h            |    2 +
>  include/asm-arm/arch-at91/at91_twi.h               |   68 ++++++
>  include/asm-arm/arch-at91/clk.h                    |    4 +
>  include/asm-arm/arch-at91/hardware.h               |    5 +
>  12 files changed, 405 insertions(+), 76 deletions(-)
>  copy include/asm-arm/arch-at91/at91_common.h => cpu/arm926ejs/at91/at91cap9_i2c.c (61%)
>  copy include/asm-arm/arch-at91/at91_common.h => cpu/arm926ejs/at91/at91sam9260_i2c.c (61%)
>  copy include/asm-arm/arch-at91/at91_common.h => cpu/arm926ejs/at91/at91sam9261_i2c.c (61%)
>  copy include/asm-arm/arch-at91/at91_common.h => cpu/arm926ejs/at91/at91sam9263_i2c.c (61%)
>  copy include/asm-arm/arch-at91/clk.h => cpu/arm926ejs/at91/at91sam9rl_i2c.c (52%)
>  create mode 100644 drivers/i2c/atmel_i2c.c
>  create mode 100644 include/asm-arm/arch-at91/at91_twi.h
> 
...

Do you aim to commit a new clean patch for this issue?
Hard I2C support would be a really nice feature!

Best regards,
Daniel Gorsulowski

^ permalink raw reply	[flat|nested] 62+ messages in thread

* [U-Boot] [PATCH 06/13] Add support for the AT91RM9200EK Board.
  2009-03-27 22:30         ` [U-Boot] [PATCH 06/13] Add support for the AT91RM9200EK Board Jean-Christophe PLAGNIOL-VILLARD
  2009-03-27 22:30           ` [U-Boot] [PATCH 07/13] at91rm9200: move serial driver to drivers/serial Jean-Christophe PLAGNIOL-VILLARD
@ 2009-05-26 15:47           ` Haavard Skinnemoen
  1 sibling, 0 replies; 62+ messages in thread
From: Haavard Skinnemoen @ 2009-05-26 15:47 UTC (permalink / raw)
  To: u-boot

On Fri, 27 Mar 2009 23:30:19 +0100
Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> wrote:

> diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
> index 631b969..175d82a 100644
> --- a/drivers/mtd/cfi_flash.c
> +++ b/drivers/mtd/cfi_flash.c
> @@ -1788,13 +1788,10 @@ static void flash_fixup_atmel(flash_info_t
> *info, struct cfi_qry *qry) 
>  	/* AT49BV6416(T) list the erase regions in the wrong order.
>  	 * However, the device ID is identical with the non-broken
> -	 * AT49BV642D since u-boot only reads the low byte (they
> -	 * differ in the high byte.) So leave out this fixup for now.
> +	 * AT49BV642D they differ in the high byte.
>  	 */
> -#if 0
>  	if (info->device_id == 0xd6 || info->device_id == 0xd2)
>  		reverse_geometry = !reverse_geometry;
> -#endif

Hmm...was this shortcoming actually fixed or does this change bugger up
a large number of currently working boards?

Haavard

^ permalink raw reply	[flat|nested] 62+ messages in thread

end of thread, other threads:[~2009-05-26 15:47 UTC | newest]

Thread overview: 62+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-27 22:30 [U-Boot] [PATCH 01/13 V2] at91sam9/at91cap: spi init add hardware chip select support Jean-Christophe PLAGNIOL-VILLARD
2009-03-27 22:30 ` [U-Boot] [PATCH 02/13 V2] at91sam9: add watchdog support Jean-Christophe PLAGNIOL-VILLARD
2009-03-27 22:30   ` [U-Boot] [PATCH 03/13] at91: rename DATAFLASH_MMC_SELECT to CONFIG_DATAFLASH_MMC_SELECT Jean-Christophe PLAGNIOL-VILLARD
2009-03-27 22:30     ` [U-Boot] [PATCH 04/13] at91rm9200dk: Move conditional compilation to Makefile Jean-Christophe PLAGNIOL-VILLARD
2009-03-27 22:30       ` [U-Boot] [PATCH 05/13] add dataflash mmc mux missing support Jean-Christophe PLAGNIOL-VILLARD
2009-03-27 22:30         ` [U-Boot] [PATCH 06/13] Add support for the AT91RM9200EK Board Jean-Christophe PLAGNIOL-VILLARD
2009-03-27 22:30           ` [U-Boot] [PATCH 07/13] at91rm9200: move serial driver to drivers/serial Jean-Christophe PLAGNIOL-VILLARD
2009-03-27 22:30             ` [U-Boot] [PATCH 08/13] at91rm9200: move serial shutdown code to serial drivers Jean-Christophe PLAGNIOL-VILLARD
2009-03-27 22:30               ` [U-Boot] [PATCH 09/13] at91rm9200: Reset update Jean-Christophe PLAGNIOL-VILLARD
2009-03-27 22:30                 ` [U-Boot] [PATCH 10/13] at91: move usb driver to drivers/usb Jean-Christophe PLAGNIOL-VILLARD
2009-03-27 22:30                   ` [U-Boot] [PATCH 11/13] at91: move dataflash spi driver to drivers/spi Jean-Christophe PLAGNIOL-VILLARD
2009-03-27 22:30                     ` [U-Boot] [PATCH 12/13] at91: add hardware i2c drivers Jean-Christophe PLAGNIOL-VILLARD
2009-03-27 22:30                       ` [U-Boot] [PATCH 13/13] at91sam9263ek: active hush and auto compelete support Jean-Christophe PLAGNIOL-VILLARD
2009-03-31 20:35                         ` Wolfgang Denk
2009-03-31 22:42                           ` Stelian Pop
2009-03-30  5:53                       ` [U-Boot] [PATCH 12/13] at91: add hardware i2c drivers Heiko Schocher
2009-03-30  7:24                         ` Jean-Christophe PLAGNIOL-VILLARD
2009-03-30  8:26                           ` Heiko Schocher
2009-03-30  8:50                             ` Jean-Christophe PLAGNIOL-VILLARD
2009-03-30 10:43                               ` Wolfgang Denk
2009-03-30 11:55                                 ` Jean-Christophe PLAGNIOL-VILLARD
2009-03-31 20:40                         ` Wolfgang Denk
2009-05-14  6:06                       ` Daniel Gorsulowski
2009-03-31 18:28                   ` [U-Boot] [PATCH 10/13] at91: move usb driver to drivers/usb Remy Bohmer
2009-03-31 19:21                     ` Jean-Christophe PLAGNIOL-VILLARD
2009-03-31 20:38                       ` Wolfgang Denk
2009-03-31 21:55                         ` Jean-Christophe PLAGNIOL-VILLARD
2009-04-01  6:55                         ` Stefan Roese
2009-04-01  7:25                           ` Remy Bohmer
2009-04-01  7:22                             ` Jean-Christophe PLAGNIOL-VILLARD
2009-04-01  7:57                               ` Remy Bohmer
2009-04-01  8:01                                 ` Jean-Christophe PLAGNIOL-VILLARD
2009-04-01  9:07                                   ` Wolfgang Denk
2009-04-01  8:13                                 ` Jean-Christophe PLAGNIOL-VILLARD
2009-04-01  8:59                                   ` Michael Trimarchi
2009-04-01  9:27                                     ` Stefan Roese
2009-04-01  9:44                                       ` Jean-Christophe PLAGNIOL-VILLARD
2009-04-01 12:19                                         ` Stefan Roese
2009-04-01 17:21                                           ` [U-Boot] [RFC PATCH] drivers/usb: regorganisation Jean-Christophe PLAGNIOL-VILLARD
2009-04-01 22:12                                             ` Wolfgang Denk
2009-04-02  5:22                                               ` Jean-Christophe PLAGNIOL-VILLARD
2009-04-02 15:26                                                 ` Remy Bohmer
2009-04-02 16:55                                                   ` [U-Boot] [RFC PATCH V2] " Jean-Christophe PLAGNIOL-VILLARD
2009-04-02 18:07                                                     ` Wolfgang Denk
2009-04-02 19:27                                                       ` Jean-Christophe PLAGNIOL-VILLARD
2009-04-02 23:06                                                         ` Wolfgang Denk
2009-04-03  5:10                                                           ` Jean-Christophe PLAGNIOL-VILLARD
2009-04-03 10:46                                                       ` [U-Boot] [PATCH] " Jean-Christophe PLAGNIOL-VILLARD
2009-04-03 11:19                                                         ` Remy Bohmer
2009-04-02 11:11                                             ` [U-Boot] [RFC PATCH] " Mike Frysinger
2009-04-01 15:56                                       ` [U-Boot] [PATCH 10/13] at91: move usb driver to drivers/usb ksi at koi8.net
2009-04-01 15:53                             ` ksi at koi8.net
2009-04-01 15:48                           ` ksi at koi8.net
2009-04-01 16:03                             ` Michael Trimarchi
2009-04-01 16:31                               ` Jean-Christophe PLAGNIOL-VILLARD
2009-04-01 16:28                             ` Jean-Christophe PLAGNIOL-VILLARD
2009-04-01 19:42                             ` Scott Wood
2009-03-31 21:22                       ` Remy Bohmer
2009-03-31 20:36                     ` Wolfgang Denk
2009-04-01 22:15               ` [U-Boot] [PATCH 08/13] at91rm9200: move serial shutdown code to serial drivers Wolfgang Denk
2009-04-01 22:14             ` [U-Boot] [PATCH 07/13] at91rm9200: move serial driver to drivers/serial Wolfgang Denk
2009-05-26 15:47           ` [U-Boot] [PATCH 06/13] Add support for the AT91RM9200EK Board Haavard Skinnemoen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.