From: Remy Bohmer <linux@bohmer.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/3] Enable the use of Ethernet over USB (CDC) for the AT91SAM9261EK board.
Date: Thu, 12 Aug 2010 19:36:53 +0200 [thread overview]
Message-ID: <1281634613-2707-3-git-send-email-linux@bohmer.net> (raw)
In-Reply-To: <1281634613-2707-1-git-send-email-linux@bohmer.net>
Signed-off-by: Thomas Smits <ts.smits@gmail.com>
Signed-off-by: Remy Bohmer <linux@bohmer.net>
---
board/atmel/at91sam9261ek/at91sam9261ek.c | 43 +++++++++++++++++++++++++++-
include/configs/at91sam9261ek.h | 17 +++++++++++
2 files changed, 58 insertions(+), 2 deletions(-)
diff --git a/board/atmel/at91sam9261ek/at91sam9261ek.c b/board/atmel/at91sam9261ek/at91sam9261ek.c
index de5cfae..1a27e53 100644
--- a/board/atmel/at91sam9261ek/at91sam9261ek.c
+++ b/board/atmel/at91sam9261ek/at91sam9261ek.c
@@ -33,14 +33,29 @@
#include <asm/arch/gpio.h>
#include <asm/arch/io.h>
#include <lcd.h>
+#include <usb/at91_udc.h>
#include <atmel_lcdc.h>
#if defined(CONFIG_RESET_PHY_R) && defined(CONFIG_DRIVER_DM9000)
#include <net.h>
#include <netdev.h>
#endif
+#if defined(CONFIG_USB_GADGET_AT91) && !defined(CONFIG_USB_GADGET)
+#error "Need CONFIG_USB_GADGET when CONFIG_USB_GADGET_AT91 enabled"
+#endif
+
DECLARE_GLOBAL_DATA_PTR;
+#ifdef CONFIG_USB_GADGET_AT91
+struct platform_data brd = {
+ .board = {
+ .vbus_pin = AT91_PIN_PB29,
+ .pullup_pin = 0,
+ },
+ .udc_clk = AT91SAM9261_ID_UDP,
+};
+#endif
+
/* ------------------------------------------------------------------------- */
/*
* Miscelaneous platform dependent initialisations
@@ -141,6 +156,16 @@ static void at91sam9261ek_dm9000_hw_init(void)
}
#endif
+#ifdef CONFIG_USB_GADGET_AT91
+static void at91sam9261ek_usbd_hw_init(void)
+{
+ /* PLLB is already enabled by the bootstrap loader... */
+ at91_sys_write(AT91_PMC_SCER, AT91SAM926x_PMC_UDP);
+ at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9261_ID_PIOB);
+ at91_set_gpio_input(brd.board.vbus_pin, 0);
+}
+#endif
+
#ifdef CONFIG_LCD
vidinfo_t panel_info = {
vl_col: 240,
@@ -255,6 +280,9 @@ int board_init(void)
#ifdef CONFIG_HAS_DATAFLASH
at91_spi0_hw_init(1 << 0);
#endif
+#ifdef CONFIG_USB_GADGET_AT91
+ at91sam9261ek_usbd_hw_init();
+#endif
#ifdef CONFIG_DRIVER_DM9000
at91sam9261ek_dm9000_hw_init();
#endif
@@ -264,10 +292,21 @@ int board_init(void)
return 0;
}
-#ifdef CONFIG_DRIVER_DM9000
+#if defined(CONFIG_DRIVER_DM9000) || defined(CONFIG_USB_GADGET_AT91)
int board_eth_init(bd_t *bis)
{
- return dm9000_initialize(bis);
+ int res = -1;
+
+#if defined(CONFIG_DRIVER_DM9000)
+ res = dm9000_initialize(bis);
+#endif
+#if defined(CONFIG_USB_GADGET_AT91)
+ at91udc_probe(&brd);
+
+ if (usb_eth_initialize(bis) >= 0)
+ res = 0;
+#endif
+ return res;
}
#endif
diff --git a/include/configs/at91sam9261ek.h b/include/configs/at91sam9261ek.h
index df8181b..8749b51 100644
--- a/include/configs/at91sam9261ek.h
+++ b/include/configs/at91sam9261ek.h
@@ -151,6 +151,23 @@
#define CONFIG_DM9000_NO_SROM 1
#define CONFIG_NET_RETRY_COUNT 20
#define CONFIG_RESET_PHY_R 1
+#define CONFIG_NET_DO_NOT_TRY_ANOTHER 1
+
+/* Configure Ethernet over USB */
+#define CONFIG_USB_GADGET 1
+#define CONFIG_USB_GADGET_AT91 1
+#define CONFIG_USB_ETHER 1
+#ifdef CONFIG_USB_GADGET
+#define CFG_USBD_REGS_BASE AT91SAM9261_BASE_UDP
+#endif
+#define CONFIG_USBNET_MANUFACTURER "Atmel AT91SAM9261-EK"
+/* ethaddr settings can be overruled via environment settings */
+#define CONFIG_USBNET_DEV_ADDR "8e:28:0f:fa:3c:39"
+#define CONFIG_USBNET_HOST_ADDR "0a:fa:63:8b:e8:0a"
+#define CONFIG_USB_CDC_VENDOR_ID 0x0525
+#define CONFIG_USB_CDC_PRODUCT_ID 0xa4a1
+#define CONFIG_USB_RNDIS_VENDOR_ID 0x0525
+#define CONFIG_USB_RNDIS_PRODUCT_ID 0xa4a2
/* USB */
#define CONFIG_USB_ATMEL
--
1.7.0.4
prev parent reply other threads:[~2010-08-12 17:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-12 17:36 [U-Boot] [PATCH 1/3] Integrate USB gadget layer and USB CDC driver layer Remy Bohmer
2010-08-12 17:36 ` [U-Boot] [PATCH 2/3] Connect the AT91 UDC to USB CDC-ethernet support Remy Bohmer
2010-08-12 18:57 ` Reinhard Meyer
2010-08-12 19:50 ` Remy Bohmer
2010-08-12 20:56 ` Wolfgang Denk
2010-08-12 22:58 ` Reinhard Meyer
2010-08-13 9:14 ` Remy Bohmer
2010-08-13 10:55 ` Reinhard Meyer
2010-08-13 11:03 ` Remy Bohmer
2010-08-13 9:16 ` Remy Bohmer
2010-08-13 10:22 ` Wolfgang Denk
2010-08-13 11:18 ` Remy Bohmer
2010-08-13 14:04 ` Wolfgang Denk
2010-08-12 17:36 ` Remy Bohmer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1281634613-2707-3-git-send-email-linux@bohmer.net \
--to=linux@bohmer.net \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox