U-Boot
Threads by month
- ----- 2025 -----
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2000 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
February 2010
- 130 participants
- 318 discussions

03 Feb '10
* add's at91_emac (AT91RM9200) network driver (NET_MULTI api)
* enable driver with CONFIG_DRIVER_AT91EMAC
* generic PHY initialization
* modify AT91RM9200 boards to use NET_MULTI driver
* the drivers has been tested with LXT971 Phy and DM9161 Phy at
MII and RMII interface
Signed-off-by: Jens Scharsig <js_at_ng(a)scharsoft.de>
---
README | 10 +
board/atmel/at91rm9200dk/at91rm9200dk.c | 15 +
board/atmel/at91rm9200ek/at91rm9200ek.c | 14 +
board/cmc_pu2/cmc_pu2.c | 13 +
board/csb637/csb637.c | 13 +
board/eukrea/cpuat91/cpuat91.c | 14 +
board/kb9202/kb9202.c | 13 +
board/m501sk/m501sk.c | 14 +
board/mp2usb/mp2usb.c | 13 +
cpu/arm920t/at91rm9200/bcm5221.c | 4 +-
cpu/arm920t/at91rm9200/dm9161.c | 3 +-
drivers/net/Makefile | 1 +
drivers/net/at91_emac.c | 498 +++++++++++++++++++++++++++++++
include/asm-arm/arch-at91/at91_emac.h | 145 +++++++++
include/configs/at91rm9200dk.h | 9 +-
include/configs/at91rm9200ek.h | 8 +-
include/configs/cmc_pu2.h | 8 +-
include/configs/cpuat91.h | 8 +-
include/configs/csb637.h | 8 +-
include/configs/kb9202.h | 8 +-
include/configs/m501sk.h | 9 +-
include/configs/mp2usb.h | 8 +-
include/netdev.h | 1 +
23 files changed, 825 insertions(+), 12 deletions(-)
create mode 100644 drivers/net/at91_emac.c
create mode 100644 include/asm-arm/arch-at91/at91_emac.h
diff --git a/README b/README
index 7affe10..3b9eb28 100644
--- a/README
+++ b/README
@@ -822,6 +822,16 @@ The following options need to be configured:
- NETWORK Support (other):
+ CONFIG_DRIVER_AT91EMAC
+ Support for AT91RM9200 EMAC.
+
+ CONFIG_RMII
+ Define this to use reduced MII inteface
+
+ CONFIG_DRIVER_AT91EMAC_QUIET
+ If this defined, the driver is quiet.
+ The driver doen't show link status messages.
+
CONFIG_DRIVER_LAN91C96
Support for SMSC's LAN91C96 chips.
diff --git a/board/atmel/at91rm9200dk/at91rm9200dk.c b/board/atmel/at91rm9200dk/at91rm9200dk.c
index c761dd7..49b5fe3 100644
--- a/board/atmel/at91rm9200dk/at91rm9200dk.c
+++ b/board/atmel/at91rm9200dk/at91rm9200dk.c
@@ -23,9 +23,15 @@
*/
#include <common.h>
+#include <exports.h>
+#include <netdev.h>
#include <asm/arch/AT91RM9200.h>
+#include <asm/io.h>
+
+#if defined(CONFIG_DRIVER_ETHER)
#include <at91rm9200_net.h>
#include <dm9161.h>
+#endif
DECLARE_GLOBAL_DATA_PTR;
@@ -95,6 +101,15 @@ void at91rm9200_GetPhyInterface(AT91PS_PhyOps p_phyops)
#endif
#endif /* CONFIG_DRIVER_ETHER */
+#ifdef CONFIG_DRIVER_AT91EMAC
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+ rc = at91emac_register(bis, 0);
+ return rc;
+}
+#endif
+
/*
* Disk On Chip (NAND) Millenium initialization.
* The NAND lives in the CS2* space
diff --git a/board/atmel/at91rm9200ek/at91rm9200ek.c b/board/atmel/at91rm9200ek/at91rm9200ek.c
index ea684e9..570a09a 100644
--- a/board/atmel/at91rm9200ek/at91rm9200ek.c
+++ b/board/atmel/at91rm9200ek/at91rm9200ek.c
@@ -23,9 +23,14 @@
*/
#include <common.h>
+#include <exports.h>
+#include <netdev.h>
#include <asm/arch/AT91RM9200.h>
+#include <asm/io.h>
+#if defined(CONFIG_DRIVER_ETHER)
#include <at91rm9200_net.h>
#include <dm9161.h>
+#endif
DECLARE_GLOBAL_DATA_PTR;
@@ -84,3 +89,12 @@ void at91rm9200_GetPhyInterface(AT91PS_PhyOps p_phyops)
p_phyops->AutoNegotiate = dm9161_AutoNegotiate;
}
#endif
+
+#ifdef CONFIG_DRIVER_AT91EMAC
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+ rc = at91emac_register(bis, 0);
+ return rc;
+}
+#endif
diff --git a/board/cmc_pu2/cmc_pu2.c b/board/cmc_pu2/cmc_pu2.c
index 3ad756d..0ac851c 100644
--- a/board/cmc_pu2/cmc_pu2.c
+++ b/board/cmc_pu2/cmc_pu2.c
@@ -30,8 +30,12 @@
#include <common.h>
#include <asm/mach-types.h>
#include <asm/arch/AT91RM9200.h>
+#include <asm/io.h>
+#include <netdev.h>
+#if defined(CONFIG_DRIVER_ETHER)
#include <at91rm9200_net.h>
#include <dm9161.h>
+#endif
DECLARE_GLOBAL_DATA_PTR;
@@ -177,3 +181,12 @@ void at91rm9200_GetPhyInterface(AT91PS_PhyOps p_phyops)
#endif
#endif /* CONFIG_DRIVER_ETHER */
+
+#ifdef CONFIG_DRIVER_AT91EMAC
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+ rc = at91emac_register(bis, 0);
+ return rc;
+}
+#endif
diff --git a/board/csb637/csb637.c b/board/csb637/csb637.c
index fbc3c87..d7fdcc4 100644
--- a/board/csb637/csb637.c
+++ b/board/csb637/csb637.c
@@ -23,8 +23,12 @@
#include <common.h>
#include <asm/arch/AT91RM9200.h>
+#include <netdev.h>
+#include <asm/io.h>
+#if defined(CONFIG_DRIVER_ETHER)
#include <at91rm9200_net.h>
#include <bcm5221.h>
+#endif
DECLARE_GLOBAL_DATA_PTR;
@@ -79,3 +83,12 @@ void at91rm9200_GetPhyInterface(AT91PS_PhyOps p_phyops)
#endif
#endif /* CONFIG_DRIVER_ETHER */
+
+#ifdef CONFIG_DRIVER_AT91EMAC
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+ rc = at91emac_register(bis, 0);
+ return rc;
+}
+#endif
diff --git a/board/eukrea/cpuat91/cpuat91.c b/board/eukrea/cpuat91/cpuat91.c
index 1a700b6..0017962 100644
--- a/board/eukrea/cpuat91/cpuat91.c
+++ b/board/eukrea/cpuat91/cpuat91.c
@@ -26,9 +26,14 @@
*/
#include <common.h>
+#include <netdev.h>
#include <asm/arch/AT91RM9200.h>
+#include <asm/io.h>
+
+#if defined(CONFIG_DRIVER_ETHER)
#include <at91rm9200_net.h>
#include <ks8721.h>
+#endif
DECLARE_GLOBAL_DATA_PTR;
@@ -79,3 +84,12 @@ void at91rm9200_GetPhyInterface(AT91PS_PhyOps p_phyops)
#endif /* CONFIG_CMD_NET */
#endif /* CONFIG_DRIVER_ETHER */
+#ifdef CONFIG_DRIVER_AT91EMAC
+
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+ rc = at91emac_register(bis, 0);
+ return rc;
+}
+#endif
diff --git a/board/kb9202/kb9202.c b/board/kb9202/kb9202.c
index 59ed8ff..3164cc5 100644
--- a/board/kb9202/kb9202.c
+++ b/board/kb9202/kb9202.c
@@ -28,8 +28,12 @@
#include <common.h>
#include <asm/arch/AT91RM9200.h>
+#include <asm/io.h>
+#include <netdev.h>
+#if defined(CONFIG_DRIVER_ETHER)
#include <at91rm9200_net.h>
#include <lxt971a.h>
+#endif
DECLARE_GLOBAL_DATA_PTR;
@@ -92,3 +96,12 @@ void at91rm9200_GetPhyInterface(AT91PS_PhyOps p_phyops)
#endif
#endif /* CONFIG_DRIVER_ETHER */
+
+#ifdef CONFIG_DRIVER_AT91EMAC
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+ rc = at91emac_register(bis, 0);
+ return rc;
+}
+#endif
diff --git a/board/m501sk/m501sk.c b/board/m501sk/m501sk.c
index 1e6a605..c995768 100644
--- a/board/m501sk/m501sk.c
+++ b/board/m501sk/m501sk.c
@@ -24,8 +24,13 @@
*/
#include <common.h>
+#include <asm/io.h>
+#include <netdev.h>
+#if defined(CONFIG_DRIVER_ETHER)
#include <at91rm9200_net.h>
#include <dm9161.h>
+#endif
+
#include "m501sk.h"
#include "net.h"
@@ -186,4 +191,13 @@ void at91rm9200_GetPhyInterface(AT91PS_PhyOps p_phyops)
}
#endif /* CONFIG_CMD_NET */
#endif /* CONFIG_DRIVER_ETHER */
+
+#ifdef CONFIG_DRIVER_AT91EMAC
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+ rc = at91emac_register(bis, 0);
+ return rc;
+}
+#endif
#endif /* CONFIG_M501SK */
diff --git a/board/mp2usb/mp2usb.c b/board/mp2usb/mp2usb.c
index dcda699..e5eba6b 100644
--- a/board/mp2usb/mp2usb.c
+++ b/board/mp2usb/mp2usb.c
@@ -27,8 +27,12 @@
#include <common.h>
#include <asm/arch/AT91RM9200.h>
+#include <netdev.h>
+#include <asm/io.h>
+#if defined(CONFIG_DRIVER_ETHER)
#include <at91rm9200_net.h>
#include <dm9161.h>
+#endif
#include <asm/mach-types.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -83,3 +87,12 @@ void at91rm9200_GetPhyInterface(AT91PS_PhyOps p_phyops)
#endif
#endif /* CONFIG_DRIVER_ETHER */
+
+#ifdef CONFIG_DRIVER_AT91EMAC
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+ rc = at91emac_register(bis, 0);
+ return rc;
+}
+#endif
diff --git a/cpu/arm920t/at91rm9200/bcm5221.c b/cpu/arm920t/at91rm9200/bcm5221.c
index b52c615..8de3cba 100644
--- a/cpu/arm920t/at91rm9200/bcm5221.c
+++ b/cpu/arm920t/at91rm9200/bcm5221.c
@@ -28,10 +28,10 @@
#include <at91rm9200_net.h>
#include <net.h>
-#include <bcm5221.h>
-
#ifdef CONFIG_DRIVER_ETHER
+#include <bcm5221.h>
+
#if defined(CONFIG_CMD_NET)
/*
diff --git a/cpu/arm920t/at91rm9200/dm9161.c b/cpu/arm920t/at91rm9200/dm9161.c
index 1beb6e8..6d4384f 100644
--- a/cpu/arm920t/at91rm9200/dm9161.c
+++ b/cpu/arm920t/at91rm9200/dm9161.c
@@ -23,9 +23,8 @@
#include <at91rm9200_net.h>
#include <net.h>
-#include <dm9161.h>
-
#ifdef CONFIG_DRIVER_ETHER
+#include <dm9161.h>
#if defined(CONFIG_CMD_NET)
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 904727e..b6de1e3 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -27,6 +27,7 @@ LIB := $(obj)libnet.a
COBJS-$(CONFIG_DRIVER_3C589) += 3c589.o
COBJS-$(CONFIG_PPC4xx_EMAC) += 4xx_enet.o
+COBJS-$(CONFIG_DRIVER_AT91EMAC) += at91_emac.o
COBJS-$(CONFIG_DRIVER_AX88180) += ax88180.o
COBJS-$(CONFIG_BCM570x) += bcm570x.o bcm570x_autoneg.o 5701rls.o
COBJS-$(CONFIG_BFIN_MAC) += bfin_mac.o
diff --git a/drivers/net/at91_emac.c b/drivers/net/at91_emac.c
new file mode 100644
index 0000000..2399569
--- /dev/null
+++ b/drivers/net/at91_emac.c
@@ -0,0 +1,498 @@
+/*
+ * Copyright (C) 2009 BuS Elektronik GmbH & Co. KG
+ * Jens Scharsig (esw(a)bus-elektronik.de)
+ *
+ * (C) Copyright 2003
+ * Author : Hamid Ikdoumi (Atmel)
+
+ * 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/io.h>
+#ifndef CONFIG_AT91_LEGACY
+#include <asm/arch/hardware.h>
+#include <asm/arch/at91_emac.h>
+#include <asm/arch/at91_pmc.h>
+#include <asm/arch/at91_pio.h>
+#else
+/* remove next 5 lines, if all RM9200 boards convert to at91 arch */
+#include <asm/arch-at91/at91rm9200.h>
+#include <asm/arch-at91/hardware.h>
+#include <asm/arch-at91/at91_emac.h>
+#include <asm/arch-at91/at91_pmc.h>
+#include <asm/arch-at91/at91_pio.h>
+#endif
+#include <net.h>
+#include <netdev.h>
+#include <malloc.h>
+#include <miiphy.h>
+#include <linux/mii.h>
+
+#undef MII_DEBUG
+#undef ET_DEBUG
+
+#if (CONFIG_SYS_RX_ETH_BUFFER > 1024)
+#error AT91 EMAC supports max 1024 RX buffers. \
+ Please decrease the CONFIG_SYS_RX_ETH_BUFFER value
+#endif
+
+/* MDIO clock must not exceed 2.5 MHz, so enable MCK divider */
+#if (AT91C_MASTER_CLOCK > 80000000)
+ #define HCLK_DIV AT91_EMAC_CFG_MCLK_64
+#elif (AT91C_MASTER_CLOCK > 40000000)
+ #define HCLK_DIV AT91_EMAC_CFG_MCLK_32
+#elif (AT91C_MASTER_CLOCK > 20000000)
+ #define HCLK_DIV AT91_EMAC_CFG_MCLK_16
+#else
+ #define HCLK_DIV AT91_EMAC_CFG_MCLK_8
+#endif
+
+#ifdef ET_DEBUG
+#define DEBUG_AT91EMAC(...) printf(__VA_ARGS__);
+#else
+#define DEBUG_AT91EMAC(...)
+#endif
+
+#ifdef MII_DEBUG
+#define DEBUG_AT91PHY(...) printf(__VA_ARGS__);
+#else
+#define DEBUG_AT91PHY(...)
+#endif
+
+#ifndef CONFIG_DRIVER_AT91EMAC_QUIET
+#define VERBOSEP(...) printf(__VA_ARGS__);
+#else
+#define VERBOSEP(...)
+#endif
+
+#define RBF_ADDR 0xfffffffc
+#define RBF_OWNER (1<<0)
+#define RBF_WRAP (1<<1)
+#define RBF_BROADCAST (1<<31)
+#define RBF_MULTICAST (1<<30)
+#define RBF_UNICAST (1<<29)
+#define RBF_EXTERNAL (1<<28)
+#define RBF_UNKOWN (1<<27)
+#define RBF_SIZE 0x07ff
+#define RBF_LOCAL4 (1<<26)
+#define RBF_LOCAL3 (1<<25)
+#define RBF_LOCAL2 (1<<24)
+#define RBF_LOCAL1 (1<<23)
+
+#define RBF_FRAMEMAX CONFIG_SYS_RX_ETH_BUFFER
+#define RBF_FRAMELEN 0x600
+
+typedef struct {
+ unsigned long addr, size;
+} rbf_t;
+
+typedef struct {
+ rbf_t rbfdt[RBF_FRAMEMAX];
+ unsigned long rbindex;
+} emac_device;
+
+void at91emac_EnableMDIO(at91_emac_t *at91mac)
+{
+ /* Mac CTRL reg set for MDIO enable */
+ writel(readl(&at91mac->ctl) | AT91_EMAC_CTL_MPE, &at91mac->ctl);
+}
+
+void at91emac_DisableMDIO(at91_emac_t *at91mac)
+{
+ /* Mac CTRL reg set for MDIO disable */
+ writel(readl(&at91mac->ctl) & ~AT91_EMAC_CTL_MPE, &at91mac->ctl);
+}
+
+int at91emac_read(at91_emac_t *at91mac, unsigned char addr,
+ unsigned char reg, unsigned short *value)
+{
+ at91emac_EnableMDIO(at91mac);
+
+ writel(AT91_EMAC_MAN_HIGH | AT91_EMAC_MAN_RW_R |
+ AT91_EMAC_MAN_REGA(reg) | AT91_EMAC_MAN_CODE_802_3 |
+ AT91_EMAC_MAN_PHYA(addr),
+ &at91mac->man);
+ udelay(10000);
+ *value = readl(&at91mac->man) & AT91_EMAC_MAN_DATA_MASK;
+
+ at91emac_DisableMDIO(at91mac);
+
+ DEBUG_AT91PHY("AT91PHY read %x REG(%d)=%x\n", at91mac, reg, *value)
+
+ return 0;
+}
+
+int at91emac_write(at91_emac_t *at91mac, unsigned char addr,
+ unsigned char reg, unsigned short value)
+{
+ DEBUG_AT91PHY("AT91PHY write %x REG(%d)=%x\n", at91mac, reg, &value)
+
+ at91emac_EnableMDIO(at91mac);
+
+ writel(AT91_EMAC_MAN_HIGH | AT91_EMAC_MAN_RW_W |
+ AT91_EMAC_MAN_REGA(reg) | AT91_EMAC_MAN_CODE_802_3 |
+ AT91_EMAC_MAN_PHYA(addr) | (value & AT91_EMAC_MAN_DATA_MASK),
+ &at91mac->man);
+ udelay(10000);
+
+ at91emac_DisableMDIO(at91mac);
+ return 0;
+}
+
+#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII)
+
+at91_emac_t *get_emacbase_by_name(char *devname)
+{
+ struct eth_device *netdev;
+
+ netdev = eth_get_dev_by_name(devname);
+ return (at91_emac_t *) netdev->iobase;
+}
+
+int at91emac_mii_read(char *devname, unsigned char addr,
+ unsigned char reg, unsigned short *value)
+{
+ at91_emac_t *emac;
+
+ emac = get_emacbase_by_name(devname);
+ at91emac_read(emac , addr, reg, value);
+ return 0;
+}
+
+
+int at91emac_mii_write(char *devname, unsigned char addr,
+ unsigned char reg, unsigned short value)
+{
+ at91_emac_t *emac;
+
+ emac = get_emacbase_by_name(devname);
+ at91emac_write(emac, addr, reg, value);
+ return 0;
+}
+
+#endif
+
+static int at91emac_phy_reset(struct eth_device *netdev)
+{
+ int i;
+ u16 status, adv;
+ at91_emac_t *emac;
+
+ emac = (at91_emac_t *) netdev->iobase;
+
+ adv = ADVERTISE_CSMA | ADVERTISE_ALL;
+ at91emac_write(emac, 0, MII_ADVERTISE, adv);
+ VERBOSEP("%s: Starting autonegotiation...\n", netdev->name);
+ at91emac_write(emac, 0, MII_BMCR, (BMCR_ANENABLE | BMCR_ANRESTART));
+
+ for (i = 0; i < 100000 / 100; i++) {
+ at91emac_read(emac, 0, MII_BMSR, &status);
+ if (status & BMSR_ANEGCOMPLETE)
+ break;
+ udelay(100);
+ }
+
+ if (status & BMSR_ANEGCOMPLETE) {
+ VERBOSEP("%s: Autonegotiation complete\n", netdev->name);
+ } else {
+ printf("%s: Autonegotiation timed out (status=0x%04x)\n",
+ netdev->name, status);
+ return 1;
+ }
+ return 0;
+}
+
+static int at91emac_phy_init(struct eth_device *netdev)
+{
+ u16 phy_id, status, adv, lpa;
+ int media, speed, duplex;
+ int i;
+ at91_emac_t *emac;
+
+ emac = (at91_emac_t *) netdev->iobase;
+
+ /* Check if the PHY is up to snuff... */
+ at91emac_read(emac, 0, MII_PHYSID1, &phy_id);
+ if (phy_id == 0xffff) {
+ printf("%s: No PHY present\n", netdev->name);
+ return 1;
+ }
+
+ at91emac_read(emac, 0, MII_BMSR, &status);
+
+ if (!(status & BMSR_LSTATUS)) {
+ /* Try to re-negotiate if we don't have link already. */
+ if (at91emac_phy_reset(netdev))
+ return 2;
+
+ for (i = 0; i < 100000 / 100; i++) {
+ at91emac_read(emac, 0, MII_BMSR, &status);
+ if (status & BMSR_LSTATUS)
+ break;
+ udelay(100);
+ }
+ }
+ if (!(status & BMSR_LSTATUS)) {
+ VERBOSEP("%s: link down\n", netdev->name);
+ return 3;
+ } else {
+ at91emac_read(emac, 0, MII_ADVERTISE, &adv);
+ at91emac_read(emac, 0, MII_LPA, &lpa);
+ media = mii_nway_result(lpa & adv);
+ speed = (media & (ADVERTISE_100FULL | ADVERTISE_100HALF)
+ ? 1 : 0);
+ duplex = (media & ADVERTISE_FULL) ? 1 : 0;
+ VERBOSEP("%s: link up, %sMbps %s-duplex\n",
+ netdev->name,
+ speed ? "100" : "10",
+ duplex ? "full" : "half");
+ }
+ return 0;
+}
+
+int at91emac_UpdateLinkSpeed(at91_emac_t *emac)
+{
+ unsigned short stat1;
+
+ at91emac_read(emac, 0, MII_BMSR, &stat1);
+
+ if (!(stat1 & BMSR_LSTATUS)) /* link status up? */
+ return 1;
+
+ if (stat1 & BMSR_100FULL) {
+ /*set Emac for 100BaseTX and Full Duplex */
+ writel(readl(&emac->cfg) |
+ AT91_EMAC_CFG_SPD | AT91_EMAC_CFG_FD,
+ &emac->cfg);
+ return 0;
+ }
+
+ if (stat1 & BMSR_10FULL) {
+ /*set MII for 10BaseT and Full Duplex */
+ writel((readl(&emac->cfg) &
+ ~(AT91_EMAC_CFG_SPD | AT91_EMAC_CFG_FD)
+ ) | AT91_EMAC_CFG_FD,
+ &emac->cfg);
+ return 0;
+ }
+
+ if (stat1 & BMSR_100HALF) {
+ /*set MII for 100BaseTX and Half Duplex */
+ writel((readl(&emac->cfg) &
+ ~(AT91_EMAC_CFG_SPD | AT91_EMAC_CFG_FD)
+ ) | AT91_EMAC_CFG_SPD,
+ &emac->cfg);
+ return 0;
+ }
+
+ if (stat1 & BMSR_10HALF) {
+ /*set MII for 10BaseT and Half Duplex */
+ writel((readl(&emac->cfg) &
+ ~(AT91_EMAC_CFG_SPD | AT91_EMAC_CFG_FD)),
+ &emac->cfg);
+ return 0;
+ }
+ return 1;
+}
+
+static int at91emac_init(struct eth_device *netdev, bd_t *bd)
+{
+ int i;
+ u32 value;
+ emac_device *dev;
+ at91_emac_t *emac;
+ at91_pio_t *pio = (at91_pio_t *) AT91_PIO_BASE;
+ at91_pmc_t *pmc = (at91_pmc_t *) AT91_PMC_BASE;
+
+ emac = (at91_emac_t *) netdev->iobase;
+ dev = (emac_device *) netdev->priv;
+
+ /* PIO Disable Register */
+ value = AT91_PMX_AA_EMDIO | AT91_PMX_AA_EMDC |
+ AT91_PMX_AA_ERXER | AT91_PMX_AA_ERX1 |
+ AT91_PMX_AA_ERX0 | AT91_PMX_AA_ECRS |
+ AT91_PMX_AA_ETX1 | AT91_PMX_AA_ETX0 |
+ AT91_PMX_AA_ETXEN | AT91_PMX_AA_EREFCK;
+
+ writel(value, &pio->pioa.pdr);
+ writel(value, &pio->pioa.asr);
+
+#ifdef CONFIG_RMII
+ value = AT91_PMX_BA_ERXCK;
+#else
+ value = AT91_PMX_BA_ERXCK | AT91_PMX_BA_ECOL |
+ AT91_PMX_BA_ERXDV | AT91_PMX_BA_ERX3 |
+ AT91_PMX_BA_ERX2 | AT91_PMX_BA_ETXER |
+ AT91_PMX_BA_ETX3 | AT91_PMX_BA_ETX2;
+#endif
+ writel(value, &pio->piob.pdr);
+ writel(value, &pio->piob.bsr);
+
+ writel(1 << AT91_ID_EMAC, &pmc->pcer);
+ writel(readl(&emac->ctl) | AT91_EMAC_CTL_CSR, &emac->ctl);
+
+ DEBUG_AT91EMAC("init MAC-ADDR %x%x \n",
+ cpu_to_le16(*((u16 *)(netdev->enetaddr + 4))),
+ cpu_to_le32(*((u32 *)netdev->enetaddr)));
+ writel(cpu_to_le32(*((u32 *)netdev->enetaddr)), &emac->sa2l);
+ writel(cpu_to_le16(*((u16 *)(netdev->enetaddr + 4))), &emac->sa2h);
+ DEBUG_AT91EMAC("init MAC-ADDR %x%x \n",
+ readl(&emac->sa2h), readl(&emac->sa2l));
+
+ /* Init Ethernet buffers */
+ for (i = 0; i < RBF_FRAMEMAX; i++) {
+ dev->rbfdt[i].addr = (unsigned long) NetRxPackets[i];
+ dev->rbfdt[i].size = 0;
+ }
+ dev->rbfdt[RBF_FRAMEMAX - 1].addr |= RBF_WRAP;
+ dev->rbindex = 0;
+ writel((u32) &(dev->rbfdt[0]), &emac->rbqp);
+
+ writel(readl(&emac->rsr) &
+ ~(AT91_EMAC_RSR_OVR | AT91_EMAC_RSR_REC | AT91_EMAC_RSR_BNA),
+ &emac->rsr);
+
+ value = AT91_EMAC_CFG_CAF | AT91_EMAC_CFG_NBC |
+ HCLK_DIV;
+#ifdef CONFIG_RMII
+ value |= AT91C_EMAC_RMII;
+#endif
+ writel(value, &emac->cfg);
+
+ writel(readl(&emac->ctl) | AT91_EMAC_CTL_TE | AT91_EMAC_CTL_RE,
+ &emac->ctl);
+
+ if (!at91emac_phy_init(netdev)) {
+ at91emac_UpdateLinkSpeed(emac);
+ return 0;
+ }
+ return 1;
+}
+
+static void at91emac_halt(struct eth_device *netdev)
+{
+ at91_emac_t *emac;
+
+ emac = (at91_emac_t *) netdev->iobase;
+ writel(readl(&emac->ctl) & ~(AT91_EMAC_CTL_TE | AT91_EMAC_CTL_RE),
+ &emac->ctl);
+ DEBUG_AT91EMAC("halt MAC\n");
+}
+
+static int at91emac_send(struct eth_device *netdev, volatile void *packet,
+ int length)
+{
+ at91_emac_t *emac;
+
+ emac = (at91_emac_t *) netdev->iobase;
+
+ while (!(readl(&emac->tsr) & AT91_EMAC_TSR_BNQ))
+ ;
+ writel((u32) packet, &emac->tar);
+ writel(AT91_EMAC_TCR_LEN(length), &emac->tcr);
+ while (AT91_EMAC_TCR_LEN(readl(&emac->tcr)))
+ ;
+ DEBUG_AT91EMAC("Send %d \n", length);
+ writel(readl(&emac->tsr) | AT91_EMAC_TSR_COMP, &emac->tsr);
+ return 0;
+}
+
+static int at91emac_recv(struct eth_device *netdev)
+{
+ emac_device *dev;
+ at91_emac_t *emac;
+ rbf_t *rbfp;
+ int size;
+
+ emac = (at91_emac_t *) netdev->iobase;
+ dev = (emac_device *) netdev->priv;
+
+ rbfp = &dev->rbfdt[dev->rbindex];
+ while (rbfp->addr & RBF_OWNER) {
+ size = rbfp->size & RBF_SIZE;
+ NetReceive(NetRxPackets[dev->rbindex], size);
+
+ DEBUG_AT91EMAC("Recv[%d]: %d bytes @ %x \n",
+ dev->rbindex, size, rbfp->addr);
+
+ rbfp->addr &= ~RBF_OWNER;
+ rbfp->size = 0;
+ if (dev->rbindex < (RBF_FRAMEMAX-1))
+ dev->rbindex++;
+ else
+ dev->rbindex = 0;
+
+ rbfp = &(dev->rbfdt[dev->rbindex]);
+ if (!(rbfp->addr & RBF_OWNER))
+ writel(readl(&emac->rsr) | AT91_EMAC_RSR_REC,
+ &emac->rsr);
+ }
+
+ if (readl(&emac->isr) & AT91_EMAC_IxR_RBNA) {
+ /* EMAC silicon bug 41.3.1 workaround 1 */
+ writel(readl(&emac->ctl) & ~AT91_EMAC_CTL_RE, &emac->ctl);
+ writel(readl(&emac->ctl) | AT91_EMAC_CTL_RE, &emac->ctl);
+ dev->rbindex = 0;
+ printf("%s: reset receiver (EMAC dead lock bug)\n",
+ netdev->name);
+ }
+ return 0;
+}
+
+int at91emac_register(bd_t *bis, unsigned long iobase)
+{
+ emac_device *emac;
+ emac_device *emacfix;
+ struct eth_device *dev;
+
+ if (iobase == 0)
+ iobase = AT91_EMAC_BASE;
+ emac = malloc(sizeof(*emac)+512);
+ if (emac == NULL)
+ return 1;
+ dev = malloc(sizeof(*dev));
+ if (dev == NULL) {
+ free(emac);
+ return 1;
+ }
+ /* alignment as per Errata (64 bytes) is insufficient! */
+ emacfix = (emac_device *) (((unsigned long) emac + 0x1ff) & 0xFFFFFE00);
+ memset(emacfix, 0, sizeof(emac_device));
+
+ memset(dev, 0, sizeof(*dev));
+#ifndef CONFIG_RMII
+ sprintf(dev->name, "AT91 EMAC");
+#else
+ sprintf(dev->name, "AT91 EMAC RMII");
+#endif
+ dev->iobase = iobase;
+ dev->priv = emacfix;
+ dev->init = at91emac_init;
+ dev->halt = at91emac_halt;
+ dev->send = at91emac_send;
+ dev->recv = at91emac_recv;
+
+ eth_register(dev);
+
+#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII)
+ miiphy_register(dev->name, at91emac_mii_read, at91emac_mii_write);
+#endif
+ return 1;
+}
diff --git a/include/asm-arm/arch-at91/at91_emac.h b/include/asm-arm/arch-at91/at91_emac.h
new file mode 100644
index 0000000..4b96f04
--- /dev/null
+++ b/include/asm-arm/arch-at91/at91_emac.h
@@ -0,0 +1,145 @@
+/*
+ * Memory Setup stuff - taken from blob memsetup.S
+ *
+ * Copyright (C) 2009 Jens Scharsig (js_at_ng(a)scharsoft.de)
+ *
+ * based on AT91RM9200 datasheet revision I (36. Ethernet MAC (EMAC))
+ *
+ * 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 AT91_H
+#define AT91_H
+
+typedef struct at91_emac {
+ u32 ctl;
+ u32 cfg;
+ u32 sr;
+ u32 tar;
+ u32 tcr;
+ u32 tsr;
+ u32 rbqp;
+ u32 reserved0;
+ u32 rsr;
+ u32 isr;
+ u32 ier;
+ u32 idr;
+ u32 imr;
+ u32 man;
+ u32 reserved1[2];
+ u32 fra;
+ u32 scol;
+ u32 mocl;
+ u32 ok;
+ u32 seqe;
+ u32 ale;
+ u32 dte;
+ u32 lcol;
+ u32 ecol;
+ u32 cse;
+ u32 tue;
+ u32 cde;
+ u32 elr;
+ u32 rjb;
+ u32 usf;
+ u32 sqee;
+ u32 drfc;
+ u32 reserved2[3];
+ u32 hsh;
+ u32 hsl;
+ u32 sh1l;
+ u32 sa1h;
+ u32 sa2l;
+ u32 sa2h;
+ u32 sa3l;
+ u32 sa3h;
+ u32 sa4l;
+ u32 sa4h;
+} at91_emac_t;
+
+#define AT91_EMAC_CTL_LB 0x0001
+#define AT91_EMAC_CTL_LBL 0x0002
+#define AT91_EMAC_CTL_RE 0x0004
+#define AT91_EMAC_CTL_TE 0x0008
+#define AT91_EMAC_CTL_MPE 0x0010
+#define AT91_EMAC_CTL_CSR 0x0020
+#define AT91_EMAC_CTL_ISR 0x0040
+#define AT91_EMAC_CTL_WES 0x0080
+#define AT91_EMAC_CTL_BP 0x1000
+
+#define AT91_EMAC_CFG_SPD 0x0001
+#define AT91_EMAC_CFG_FD 0x0002
+#define AT91_EMAC_CFG_BR 0x0004
+#define AT91_EMAC_CFG_CAF 0x0010
+#define AT91_EMAC_CFG_NBC 0x0020
+#define AT91_EMAC_CFG_MTI 0x0040
+#define AT91_EMAC_CFG_UNI 0x0080
+#define AT91_EMAC_CFG_BIG 0x0100
+#define AT91_EMAC_CFG_EAE 0x0200
+#define AT91_EMAC_CFG_CLK_MASK 0xFFFFF3FF
+#define AT91_EMAC_CFG_MCLK_8 0x0000
+#define AT91_EMAC_CFG_MCLK_16 0x0400
+#define AT91_EMAC_CFG_MCLK_32 0x0800
+#define AT91_EMAC_CFG_MCLK_64 0x0C00
+#define AT91_EMAC_CFG_RTY 0x1000
+#define AT91_EMAC_CFG_RMII 0x2000
+
+#define AT91_EMAC_SR_LINK 0x0001
+#define AT91_EMAC_SR_MDIO 0x0002
+#define AT91_EMAC_SR_IDLE 0x0004
+
+#define AT91_EMAC_TCR_LEN(x) (x & 0x7FF)
+#define AT91_EMAC_TCR_NCRC 0x8000
+
+#define AT91_EMAC_TSR_OVR 0x0001
+#define AT91_EMAC_TSR_COL 0x0002
+#define AT91_EMAC_TSR_RLE 0x0004
+#define AT91_EMAC_TSR_TXIDLE 0x0008
+#define AT91_EMAC_TSR_BNQ 0x0010
+#define AT91_EMAC_TSR_COMP 0x0020
+#define AT91_EMAC_TSR_UND 0x0040
+
+#define AT91_EMAC_RSR_BNA 0x0001
+#define AT91_EMAC_RSR_REC 0x0002
+#define AT91_EMAC_RSR_OVR 0x0004
+
+/* ISR, IER, IDR, IMR use the same bits */
+#define AT91_EMAC_IxR_DONE 0x0001
+#define AT91_EMAC_IxR_RCOM 0x0002
+#define AT91_EMAC_IxR_RBNA 0x0004
+#define AT91_EMAC_IxR_TOVR 0x0008
+#define AT91_EMAC_IxR_TUND 0x0010
+#define AT91_EMAC_IxR_RTRY 0x0020
+#define AT91_EMAC_IxR_TBRE 0x0040
+#define AT91_EMAC_IxR_TCOM 0x0080
+#define AT91_EMAC_IxR_TIDLE 0x0100
+#define AT91_EMAC_IxR_LINK 0x0200
+#define AT91_EMAC_IxR_ROVR 0x0400
+#define AT91_EMAC_IxR_HRESP 0x0800
+
+#define AT91_EMAC_MAN_DATA_MASK 0xFFFF
+#define AT91_EMAC_MAN_CODE_802_3 0x00020000
+#define AT91_EMAC_MAN_REGA(reg) ((reg & 0x1F) << 18)
+#define AT91_EMAC_MAN_PHYA(phy) ((phy & 0x1F) << 23)
+#define AT91_EMAC_MAN_RW_R 0x20000000
+#define AT91_EMAC_MAN_RW_W 0x10000000
+#define AT91_EMAC_MAN_HIGH 0x40000000
+#define AT91_EMAC_MAN_LOW 0x80000000
+
+#endif
diff --git a/include/configs/at91rm9200dk.h b/include/configs/at91rm9200dk.h
index bc61677..d39e8f2 100644
--- a/include/configs/at91rm9200dk.h
+++ b/include/configs/at91rm9200dk.h
@@ -124,7 +124,14 @@
#define CONFIG_SYS_MEMTEST_START PHYS_SDRAM
#define CONFIG_SYS_MEMTEST_END CONFIG_SYS_MEMTEST_START + PHYS_SDRAM_SIZE - 262144
-#define CONFIG_DRIVER_ETHER
+#define CONFIG_NET_MULTI 1
+#ifdef CONFIG_NET_MULTI
+#define CONFIG_DRIVER_AT91EMAC 1
+#define CONFIG_SYS_RX_ETH_BUFFER 8
+#else
+#define CONFIG_DRIVER_ETHER 1
+#endif
+
#define CONFIG_NET_RETRY_COUNT 20
#define CONFIG_AT91C_USE_RMII
diff --git a/include/configs/at91rm9200ek.h b/include/configs/at91rm9200ek.h
index f5206b1..145c3c3 100644
--- a/include/configs/at91rm9200ek.h
+++ b/include/configs/at91rm9200ek.h
@@ -147,7 +147,13 @@
/*
* Network Driver Setting
*/
-#define CONFIG_DRIVER_ETHER
+#define CONFIG_NET_MULTI 1
+#ifdef CONFIG_NET_MULTI
+#define CONFIG_DRIVER_AT91EMAC 1
+#define CONFIG_SYS_RX_ETH_BUFFER 8
+#else
+#define CONFIG_DRIVER_ETHER 1
+#endif
#define CONFIG_NET_RETRY_COUNT 20
#define CONFIG_AT91C_USE_RMII
diff --git a/include/configs/cmc_pu2.h b/include/configs/cmc_pu2.h
index 16ae03e..ffe83f0 100644
--- a/include/configs/cmc_pu2.h
+++ b/include/configs/cmc_pu2.h
@@ -154,7 +154,13 @@
#define CONFIG_SYS_MEMTEST_START PHYS_SDRAM
#define CONFIG_SYS_MEMTEST_END CONFIG_SYS_MEMTEST_START + PHYS_SDRAM_SIZE - 262144
-#define CONFIG_DRIVER_ETHER
+#define CONFIG_NET_MULTI 1
+#ifdef CONFIG_NET_MULTI
+#define CONFIG_DRIVER_AT91EMAC 1
+#define CONFIG_SYS_RX_ETH_BUFFER 8
+#else
+#define CONFIG_DRIVER_ETHER 1
+#endif
#define CONFIG_NET_RETRY_COUNT 20
#define CONFIG_AT91C_USE_RMII
diff --git a/include/configs/cpuat91.h b/include/configs/cpuat91.h
index 9f0ac03..b4fda76 100644
--- a/include/configs/cpuat91.h
+++ b/include/configs/cpuat91.h
@@ -130,7 +130,13 @@
#define CONFIG_SYS_MEMTEST_END \
(CONFIG_SYS_MEMTEST_START + PHYS_SDRAM_SIZE - 512 * 1024)
-#define CONFIG_DRIVER_ETHER 1
+#define CONFIG_NET_MULTI 1
+#ifdef CONFIG_NET_MULTI
+#define CONFIG_DRIVER_AT91EMAC 1
+#define CONFIG_SYS_RX_ETH_BUFFER 8
+#else
+#define CONFIG_DRIVER_ETHER 1
+#endif
#define CONFIG_NET_RETRY_COUNT 20
#define CONFIG_AT91C_USE_RMII 1
#define CONFIG_PHY_ADDRESS (1 << 5)
diff --git a/include/configs/csb637.h b/include/configs/csb637.h
index 90269a7..efa2780 100644
--- a/include/configs/csb637.h
+++ b/include/configs/csb637.h
@@ -128,7 +128,13 @@
#define CONFIG_SYS_ALT_MEMTEST 1
#define CONFIG_SYS_MEMTEST_SCRATCH CONFIG_SYS_MEMTEST_START + PHYS_SDRAM_SIZE - 4
-#define CONFIG_DRIVER_ETHER
+#define CONFIG_NET_MULTI 1
+#ifdef CONFIG_NET_MULTI
+#define CONFIG_DRIVER_AT91EMAC 1
+#define CONFIG_SYS_RX_ETH_BUFFER 8
+#else
+#define CONFIG_DRIVER_ETHER 1
+#endif
#define CONFIG_NET_RETRY_COUNT 20
#undef CONFIG_AT91C_USE_RMII
diff --git a/include/configs/kb9202.h b/include/configs/kb9202.h
index 24fd1ef..41ec1d5 100644
--- a/include/configs/kb9202.h
+++ b/include/configs/kb9202.h
@@ -117,7 +117,13 @@
#define CONFIG_SYS_MEMTEST_START PHYS_SDRAM
#define CONFIG_SYS_MEMTEST_END CONFIG_SYS_MEMTEST_START + PHYS_SDRAM_SIZE - (512*1024)
-#define CONFIG_DRIVER_ETHER
+#define CONFIG_NET_MULTI 1
+#ifdef CONFIG_NET_MULTI
+#define CONFIG_DRIVER_AT91EMAC 1
+#define CONFIG_SYS_RX_ETH_BUFFER 8
+#else
+#define CONFIG_DRIVER_ETHER 1
+#endif
#define CONFIG_NET_RETRY_COUNT 20
#define CONFIG_SYS_FLASH_BASE 0x10000000
diff --git a/include/configs/m501sk.h b/include/configs/m501sk.h
index 17469e5..26c2bcb 100644
--- a/include/configs/m501sk.h
+++ b/include/configs/m501sk.h
@@ -36,6 +36,7 @@
#define AT91C_MASTER_CLOCK 59904000
#define AT91_SLOW_CLOCK 32768 /* slow clock */
+#define CONFIG_AT91RM9200 1 /* It's an Atmel AT91RM9200 SoC */
#define CONFIG_AT91RM9200DK 1 /* on an AT91RM9200DK Board */
#undef CONFIG_USE_IRQ /* we don't need IRQ/FIQ stuff */
#define CONFIG_CMDLINE_TAG 1 /* enable passing of ATAGs */
@@ -168,7 +169,13 @@
/* CONFIG_SYS_MEMTEST_START + PHYS_SDRAM_SIZE - 262144 */
#define CONFIG_SYS_MEMTEST_END 0x00100000
-#define CONFIG_DRIVER_ETHER
+#define CONFIG_NET_MULTI 1
+#ifdef CONFIG_NET_MULTI
+#define CONFIG_DRIVER_AT91EMAC 1
+#define CONFIG_SYS_RX_ETH_BUFFER 8
+#else
+#define CONFIG_DRIVER_ETHER 1
+#endif
#define CONFIG_NET_RETRY_COUNT 20
#define CONFIG_AT91C_USE_RMII
diff --git a/include/configs/mp2usb.h b/include/configs/mp2usb.h
index c66f8ea..3138b49 100644
--- a/include/configs/mp2usb.h
+++ b/include/configs/mp2usb.h
@@ -183,7 +183,13 @@
#define CONFIG_SYS_MEMTEST_START PHYS_SDRAM
#define CONFIG_SYS_MEMTEST_END CONFIG_SYS_MEMTEST_START + PHYS_SDRAM_SIZE - 262144
-#define CONFIG_DRIVER_ETHER
+#define CONFIG_NET_MULTI 1
+#ifdef CONFIG_NET_MULTI
+#define CONFIG_DRIVER_AT91EMAC 1
+#define CONFIG_SYS_RX_ETH_BUFFER 8
+#else
+#define CONFIG_DRIVER_ETHER 1
+#endif
#define CONFIG_NET_RETRY_COUNT 20
#undef CONFIG_AT91C_USE_RMII
diff --git a/include/netdev.h b/include/netdev.h
index a9d5ec9..078bba7 100644
--- a/include/netdev.h
+++ b/include/netdev.h
@@ -42,6 +42,7 @@ int cpu_eth_init(bd_t *bis);
/* Driver initialization prototypes */
int au1x00_enet_initialize(bd_t*);
+int at91emac_register(bd_t *bis, unsigned long iobase);
int bfin_EMAC_initialize(bd_t *bis);
int cs8900_initialize(u8 dev_num, int base_addr);
int dc21x4x_initialize(bd_t *bis);
3
3
* prepare joining at91 and at91rm9200
* please read README.soc-at91 for details
Signed-off-by: Jens Scharsig <js_at_ng(a)scharsoft.de>
---
cpu/arm920t/at91/Makefile | 47 +++++++++
cpu/arm920t/at91/lowlevel_init.S | 177 ++++++++++++++++++++++++++++++++
cpu/arm920t/at91/reset.c | 59 +++++++++++
cpu/arm920t/at91/timer.c | 163 +++++++++++++++++++++++++++++
cpu/arm920t/cpu.c | 4 +
doc/README.at91-soc | 24 ++++-
include/asm-arm/arch-at91/at91_mc.h | 89 ++++++++++++++++
include/asm-arm/arch-at91/at91_st.h | 48 +++++++++
include/asm-arm/arch-at91/at91_tc.h | 79 ++++++++++++++
include/asm-arm/arch-at91/at91rm9200.h | 135 ++++++++++++++++++++++++
include/asm-arm/arch-at91/hardware.h | 2 +-
11 files changed, 825 insertions(+), 2 deletions(-)
create mode 100644 cpu/arm920t/at91/Makefile
create mode 100644 cpu/arm920t/at91/lowlevel_init.S
create mode 100644 cpu/arm920t/at91/reset.c
create mode 100644 cpu/arm920t/at91/timer.c
create mode 100644 include/asm-arm/arch-at91/at91_mc.h
create mode 100644 include/asm-arm/arch-at91/at91_st.h
create mode 100644 include/asm-arm/arch-at91/at91_tc.h
create mode 100644 include/asm-arm/arch-at91/at91rm9200.h
diff --git a/cpu/arm920t/at91/Makefile b/cpu/arm920t/at91/Makefile
new file mode 100644
index 0000000..6e683f6
--- /dev/null
+++ b/cpu/arm920t/at91/Makefile
@@ -0,0 +1,47 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, wd(a)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$(SOC).a
+
+SOBJS += lowlevel_init.o
+COBJS += reset.o
+COBJS += timer.o
+
+SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
+
+all: $(obj).depend $(LIB)
+
+$(LIB): $(OBJS)
+ $(AR) $(ARFLAGS) $@ $(OBJS)
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/cpu/arm920t/at91/lowlevel_init.S b/cpu/arm920t/at91/lowlevel_init.S
new file mode 100644
index 0000000..ecd3d7e
--- /dev/null
+++ b/cpu/arm920t/at91/lowlevel_init.S
@@ -0,0 +1,177 @@
+/*
+ * Memory Setup stuff - taken from blob memsetup.S
+ *
+ * Copyright (C) 1999 2000 2001 Erik Mouw (J.A.K.Mouw(a)its.tudelft.nl) and
+ * Jan-Derk Bakker (J.D.Bakker(a)its.tudelft.nl)
+ *
+ * Modified for the at91rm9200dk board by
+ * (C) Copyright 2004
+ * Gary Jennejohn, DENX Software Engineering, <garyj(a)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 <config.h>
+#include <version.h>
+
+#ifndef CONFIG_SKIP_LOWLEVEL_INIT
+
+#define AT91_PMC_MOR 0xFFFFFC20 /* Main oscillator register */
+#define AT91_PMC_PLLAR 0xFFFFFC28
+#define AT91_PMC_PLLBR 0xFFFFFC2C
+#define AT91_PMC_MCKR 0xFFFFFC30
+
+#define AT91_PIOC_ASR 0xFFFFF870
+#define AT91_PIOC_BSR 0xFFFFF874
+#define AT91_PIOC_PDR 0xFFFFF804
+
+#define AT91_MC_EBI_CSA 0xFFFFFF60
+#define AT91_MC_EBI_CFG 0xFFFFFF64
+#define AT91_MC_SMC_CSR0 0xFFFFFF70
+
+#define AT91_MC_SDRAMC_MR 0xFFFFFF90
+#define AT91_MC_SDRAMC_TR 0xFFFFFF94
+#define AT91_MC_SDRAMC_CR 0xFFFFFF98
+
+_MTEXT_BASE:
+#undef START_FROM_MEM
+#ifdef START_FROM_MEM
+ .word TEXT_BASE-PHYS_FLASH_1
+#else
+ .word TEXT_BASE
+#endif
+
+.globl lowlevel_init
+lowlevel_init:
+ ldr r1, =AT91_PMC_MOR
+ /* Main oscillator Enable register */
+#ifdef CONFIG_SYS_USE_MAIN_OSCILLATOR
+ ldr r0, =0x0000FF01 /* Enable main oscillator */
+#else
+ ldr r0, =0x0000FF00 /* Disable main oscillator */
+#endif
+ str r0, [r1] /*AT91C_CKGR_MOR] */
+ /* Add loop to compensate Main Oscillator startup time */
+ ldr r0, =0x00000010
+LoopOsc:
+ subs r0, r0, #1
+ bhi LoopOsc
+
+ /* memory control configuration */
+ /* this isn't very elegant, but what the heck */
+ ldr r0, =SMRDATA
+ ldr r1, _MTEXT_BASE
+ sub r0, r0, r1
+ add r2, r0, #80
+0:
+ /* the address */
+ ldr r1, [r0], #4
+ /* the value */
+ ldr r3, [r0], #4
+ str r3, [r1]
+ cmp r2, r0
+ bne 0b
+ /* delay - this is all done by guess */
+ ldr r0, =0x00010000
+ /* (vs reading PMC_SR for LOCKA, LOCKB ... or MOSCS earlier) */
+1:
+ subs r0, r0, #1
+ bhi 1b
+ ldr r0, =SMRDATA1
+ ldr r1, _MTEXT_BASE
+ sub r0, r0, r1
+ add r2, r0, #176
+2:
+ /* the address */
+ ldr r1, [r0], #4
+ /* the value */
+ ldr r3, [r0], #4
+ str r3, [r1]
+ cmp r2, r0
+ bne 2b
+
+ /* switch from FastBus to Asynchronous clock mode */
+ mrc p15, 0, r0, c1, c0, 0
+ orr r0, r0, #0xC0000000 @ set bit 31 (iA) and 30 (nF)
+ mcr p15, 0, r0, c1, c0, 0
+
+ /* everything is fine now */
+ mov pc, lr
+
+ .ltorg
+
+SMRDATA:
+ .word AT91_MC_EBI_CFG
+ .word CONFIG_SYS_EBI_CFGR_VAL
+ .word AT91_MC_SMC_CSR0
+ .word CONFIG_SYS_SMC_CSR0_VAL
+ .word AT91_PMC_PLLAR
+ .word CONFIG_SYS_PLLAR_VAL
+ .word AT91_PMC_PLLBR
+ .word CONFIG_SYS_PLLBR_VAL
+ .word AT91_PMC_MCKR
+ .word CONFIG_SYS_MCKR_VAL
+ /* here there's a delay */
+SMRDATA1:
+ .word AT91_PIOC_ASR
+ .word CONFIG_SYS_PIOC_ASR_VAL
+ .word AT91_PIOC_BSR
+ .word CONFIG_SYS_PIOC_BSR_VAL
+ .word AT91_PIOC_PDR
+ .word CONFIG_SYS_PIOC_PDR_VAL
+ .word AT91_MC_EBI_CSA
+ .word CONFIG_SYS_EBI_CSA_VAL
+ .word AT91_MC_SDRAMC_CR
+ .word CONFIG_SYS_SDRC_CR_VAL
+ .word AT91_MC_SDRAMC_MR
+ .word CONFIG_SYS_SDRC_MR_VAL
+ .word CONFIG_SYS_SDRAM
+ .word CONFIG_SYS_SDRAM_VAL
+ .word AT91_MC_SDRAMC_MR
+ .word CONFIG_SYS_SDRC_MR_VAL1
+ .word CONFIG_SYS_SDRAM
+ .word CONFIG_SYS_SDRAM_VAL
+ .word CONFIG_SYS_SDRAM
+ .word CONFIG_SYS_SDRAM_VAL
+ .word CONFIG_SYS_SDRAM
+ .word CONFIG_SYS_SDRAM_VAL
+ .word CONFIG_SYS_SDRAM
+ .word CONFIG_SYS_SDRAM_VAL
+ .word CONFIG_SYS_SDRAM
+ .word CONFIG_SYS_SDRAM_VAL
+ .word CONFIG_SYS_SDRAM
+ .word CONFIG_SYS_SDRAM_VAL
+ .word CONFIG_SYS_SDRAM
+ .word CONFIG_SYS_SDRAM_VAL
+ .word CONFIG_SYS_SDRAM
+ .word CONFIG_SYS_SDRAM_VAL
+ .word AT91_MC_SDRAMC_MR
+ .word CONFIG_SYS_SDRC_MR_VAL2
+ .word CONFIG_SYS_SDRAM1
+ .word CONFIG_SYS_SDRAM_VAL
+ .word AT91_MC_SDRAMC_TR
+ .word CONFIG_SYS_SDRC_TR_VAL
+ .word CONFIG_SYS_SDRAM
+ .word CONFIG_SYS_SDRAM_VAL
+ .word AT91_MC_SDRAMC_MR
+ .word CONFIG_SYS_SDRC_MR_VAL3
+ .word CONFIG_SYS_SDRAM
+ .word CONFIG_SYS_SDRAM_VAL
+ /* SMRDATA1 is 176 bytes long */
+#endif /* CONFIG_SKIP_LOWLEVEL_INIT */
diff --git a/cpu/arm920t/at91/reset.c b/cpu/arm920t/at91/reset.c
new file mode 100644
index 0000000..d38c53b
--- /dev/null
+++ b/cpu/arm920t/at91/reset.c
@@ -0,0 +1,59 @@
+/*
+ * (C) Copyright 2002
+ * Lineo, Inc. <www.lineo.com>
+ * Bernhard Kuhn <bkuhn(a)lineo.com>
+ *
+ * (C) Copyright 2002
+ * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
+ * Marius Groeger <mgroeger(a)sysgo.de>
+ *
+ * (C) Copyright 2002
+ * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
+ * Alex Zuepke <azu(a)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/io.h>
+#include <asm/arch/hardware.h>
+#include <asm/arch/at91_st.h>
+
+void board_reset(void) __attribute__((__weak__));
+
+void reset_cpu(ulong ignored)
+{
+ at91_st_t *st = (at91_st_t *) AT91_ST_BASE;
+#if defined(CONFIG_AT91RM9200_USART) || defined(CONFIG_AT91_USART)
+ /*shutdown the console to avoid strange chars during reset */
+ serial_exit();
+#endif
+
+ if (board_reset)
+ board_reset();
+
+ /* Reset the cpu by setting up the watchdog timer */
+ writel(AT91_ST_WDMR_RSTEN | AT91_ST_WDMR_EXTEN | AT91_ST_WDMR_WDV(2),
+ &st->wdmr);
+ writel(AT91_ST_CR_WDRST, &st->cr);
+ /* and let him time out */
+ while (1)
+ ;
+ /* Never reached */
+}
diff --git a/cpu/arm920t/at91/timer.c b/cpu/arm920t/at91/timer.c
new file mode 100644
index 0000000..91377d4
--- /dev/null
+++ b/cpu/arm920t/at91/timer.c
@@ -0,0 +1,163 @@
+/*
+ * (C) Copyright 2002
+ * Lineo, Inc. <www.lineo.com>
+ * Bernhard Kuhn <bkuhn(a)lineo.com>
+ *
+ * (C) Copyright 2002
+ * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
+ * Marius Groeger <mgroeger(a)sysgo.de>
+ *
+ * (C) Copyright 2002
+ * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
+ * Alex Zuepke <azu(a)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/io.h>
+#include <asm/hardware.h>
+#include <asm/arch/at91_tc.h>
+#include <asm/arch/at91_pmc.h>
+
+/* the number of clocks per CONFIG_SYS_HZ */
+#define TIMER_LOAD_VAL (CONFIG_SYS_HZ_CLOCK/CONFIG_SYS_HZ)
+
+static u32 timestamp;
+static u32 lastinc;
+
+int timer_init(void)
+{
+ at91_tc_t *tc = (at91_tc_t *) AT91_TC_BASE;
+ at91_pmc_t *pmc = (at91_pmc_t *) AT91_PMC_BASE;
+
+ /* enables TC1.0 clock */
+ writel(1 << AT91_ID_TC0, &pmc->pcer); /* enable clock */
+
+ writel(0, &tc->bcr);
+ writel(AT91_TC_BMR_TC0XC0S_NONE | AT91_TC_BMR_TC1XC1S_NONE |
+ AT91_TC_BMR_TC2XC2S_NONE , &tc->bmr);
+
+ writel(AT91_TC_CCR_CLKDIS, &tc->tc[0].ccr);
+ /* set to MCLK/2 and restart the timer
+ when the value in TC_RC is reached */
+ writel(AT91_TC_CMR_TCCLKS_CLOCK1 | AT91_TC_CMR_CPCTRG, &tc->tc[0].cmr);
+
+ writel(0xFFFFFFFF, &tc->tc[0].idr); /* disable interupts */
+ writel(TIMER_LOAD_VAL, &tc->tc[0].rc);
+
+ writel(AT91_TC_CCR_SWTRG | AT91_TC_CCR_CLKEN, &tc->tc[0].ccr);
+ lastinc = 0;
+ timestamp = 0;
+
+ return 0;
+}
+
+/*
+ * timer without interrupts
+ */
+
+void reset_timer(void)
+{
+ reset_timer_masked();
+}
+
+ulong get_timer(ulong base)
+{
+ return get_timer_masked() - base;
+}
+
+void set_timer(ulong t)
+{
+ timestamp = t;
+}
+
+void __udelay(unsigned long usec)
+{
+ udelay_masked(usec);
+}
+
+void reset_timer_masked(void)
+{
+ /* reset time */
+ at91_tc_t *tc = (at91_tc_t *) AT91_TC_BASE;
+ lastinc = readl(&tc->tc[0].cv) & 0x0000ffff;
+ timestamp = 0;
+}
+
+ulong get_timer_raw(void)
+{
+ at91_tc_t *tc = (at91_tc_t *) AT91_TC_BASE;
+ u32 now;
+
+ now = readl(&tc->tc[0].cv) & 0x0000ffff;
+
+ if (now >= lastinc) {
+ /* normal mode */
+ timestamp += now - lastinc;
+ } else {
+ /* we have an overflow ... */
+ timestamp += now + TIMER_LOAD_VAL - lastinc;
+ }
+ lastinc = now;
+
+ return timestamp;
+}
+
+ulong get_timer_masked(void)
+{
+ return get_timer_raw()/TIMER_LOAD_VAL;
+}
+
+void udelay_masked(unsigned long usec)
+{
+ u32 tmo;
+ u32 endtime;
+ signed long diff;
+
+ tmo = CONFIG_SYS_HZ_CLOCK / 1000;
+ tmo *= usec;
+ tmo /= 1000;
+
+ endtime = get_timer_raw() + tmo;
+
+ do {
+ u32 now = get_timer_raw();
+ diff = endtime - now;
+ } while (diff >= 0);
+}
+
+/*
+ * This function is derived from PowerPC code (read timebase as long long).
+ * On ARM it just returns the timer value.
+ */
+unsigned long long get_ticks(void)
+{
+ return get_timer(0);
+}
+
+/*
+ * This function is derived from PowerPC code (timebase clock frequency).
+ * On ARM it returns the number of timer ticks per second.
+ */
+ulong get_tbclk(void)
+{
+ return CONFIG_SYS_HZ;
+}
diff --git a/cpu/arm920t/cpu.c b/cpu/arm920t/cpu.c
index 34adb11..be82c87 100644
--- a/cpu/arm920t/cpu.c
+++ b/cpu/arm920t/cpu.c
@@ -33,6 +33,10 @@
#include <command.h>
#include <asm/system.h>
+#ifdef CONFIG_AT91_LEGACY
+#warning Your board is using legacy AT91RM9200 SoC access. Please update!
+#endif
+
static void cache_flush(void);
int cleanup_before_linux (void)
diff --git a/doc/README.at91-soc b/doc/README.at91-soc
index 063016e..29234b1 100644
--- a/doc/README.at91-soc
+++ b/doc/README.at91-soc
@@ -37,6 +37,28 @@ The Way
1. add's the new temporary CONFIG_AT91_LEGACY to all board configs
that not converted to new SoC access
2. add new structures for SoC access
-3. Convert arch, driver and boards file zu new SoC
+3. Convert arch, driver and boards file to new SoC
4. remove legacy code, if all boards and drives are ready
+ Join AT91 and AT91RM9200 SoC
+==============================
+
+Approximately 95 percent of AT91 and AT91RM9200 SoC parts are the same.
+So, we should use the chance, to join both archs togetter.
+
+To do this follow step needed:
+
+1. change Makefile
+ @$(MKCONFIG) $(@:_config=) arm arm920t board vendor at91rm9200
+ to
+ @$(MKCONFIG) $(@:_config=) arm arm920t board vendor at91
+2. remove CONFIG_AT91_LEGACY in board config
+3. convert boards file to new SoC access
+4. convert or change drivers
+
+To support the joining process, a new SoC dir (at91) has been adding to
+arm920t arch directory. This directory contains files like at91rm9200 dir, but
+uses the new c structure Soc access. The advantage of this is, we don't merge
+old Soc access code and new code while the board are not converted.
+Finally we can delete the whole at91rm9200 dir, if all board support the
+new AT91-SoC access.
diff --git a/include/asm-arm/arch-at91/at91_mc.h b/include/asm-arm/arch-at91/at91_mc.h
new file mode 100644
index 0000000..19d9755
--- /dev/null
+++ b/include/asm-arm/arch-at91/at91_mc.h
@@ -0,0 +1,89 @@
+/*
+ * Memory Setup stuff - taken from blob memsetup.S
+ *
+ * Copyright (C) 2009 Jens Scharsig (js_at_ng(a)scharsoft.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
+ */
+
+#ifndef AT91_MC_H
+#define AT91_MC_H
+
+typedef struct at91_ebi {
+ u32 csa; /* 0x00 Chip Select Assignment Register */
+ u32 cfgr; /* 0x04 Configuration Register */
+ u32 reserved[2];
+} at91_ebi_t;
+
+#define AT91_EBI_CSA_CS0A 0x0001
+#define AT91_EBI_CSA_CS1A 0x0002
+
+#define AT91_EBI_CSA_CS3A 0x0008
+#define AT91_EBI_CSA_CS4A 0x0010
+
+typedef struct at91_sdramc {
+ u32 mr; /* 0x00 SDRAMC Mode Register */
+ u32 tr; /* 0x04 SDRAMC Refresh Timer Register */
+ u32 cr; /* 0x08 SDRAMC Configuration Register */
+ u32 ssr; /* 0x0C SDRAMC Self Refresh Register */
+ u32 lpr; /* 0x10 SDRAMC Low Power Register */
+ u32 ier; /* 0x14 SDRAMC Interrupt Enable Register */
+ u32 idr; /* 0x18 SDRAMC Interrupt Disable Register */
+ u32 imr; /* 0x1C SDRAMC Interrupt Mask Register */
+ u32 icr; /* 0x20 SDRAMC Interrupt Status Register */
+ u32 reserved[3];
+} at91_sdramc_t;
+
+typedef struct at91_smc {
+ u32 csr[8]; /* 0x00 SDRAMC Mode Register */
+} at91_smc_t;
+
+#define AT91_SMC_CSR_RWHOLD(x) ((x & 0x7) << 28)
+#define AT91_SMC_CSR_RWSETUP(x) ((x & 0x7) << 24)
+#define AT91_SMC_CSR_ACSS_STANDARD 0x00000000
+#define AT91_SMC_CSR_ACSS_1CYCLE 0x00010000
+#define AT91_SMC_CSR_ACSS_2CYCLE 0x00020000
+#define AT91_SMC_CSR_ACSS_3CYCLE 0x00030000
+#define AT91_SMC_CSR_DRP 0x00008000
+#define AT91_SMC_CSR_DBW_8 0x00004000
+#define AT91_SMC_CSR_DBW_16 0x00002000
+#define AT91_SMC_CSR_BAT_8 0x00000000
+#define AT91_SMC_CSR_BAT_16 0x00001000
+#define AT91_SMC_CSR_TDF(x) ((x & 0xF) << 8)
+#define AT91_SMC_CSR_WSEN 0x00000080
+#define AT91_SMC_CSR_NWS(x) (x & 0x7F)
+
+typedef struct at91_bfc {
+ u32 mr; /* 0x00 SDRAMC Mode Register */
+} at91_bfc_t;
+
+typedef struct at91_mc {
+ u32 rcr; /* 0x00 MC Remap Control Register */
+ u32 asr; /* 0x04 MC Abort Status Register */
+ u32 aasr; /* 0x08 MC Abort Address Status Reg */
+ u32 mpr; /* 0x0C MC Master Priority Register */
+ u32 reserved1[20]; /* 0x10-0x5C */
+ at91_ebi_t ebi; /* 0x60 - 0x6C EBI */
+ at91_smc_t smc; /* 0x70 - 0x8C SMC User Interface */
+ at91_sdramc_t sdramc; /* 0x90 - 0xBC SDRAMC User Interface */
+ at91_bfc_t bfc; /* 0xC0 BFC User Interface */
+ u32 reserved2[15];
+} at91_mc_t;
+
+#endif
diff --git a/include/asm-arm/arch-at91/at91_st.h b/include/asm-arm/arch-at91/at91_st.h
new file mode 100644
index 0000000..a5fcfd2
--- /dev/null
+++ b/include/asm-arm/arch-at91/at91_st.h
@@ -0,0 +1,48 @@
+/*
+ * Memory Setup stuff - taken from blob memsetup.S
+ *
+ * Copyright (C) 2009 Jens Scharsig (js_at_ng(a)scharsoft.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
+ */
+
+#ifndef AT91_ST_H
+#define AT91_ST_H
+
+typedef struct at91_st {
+
+ u32 cr;
+ u32 pimr;
+ u32 wdmr;
+ u32 rtmr;
+ u32 sr;
+ u32 ier;
+ u32 idr;
+ u32 imr;
+ u32 rtar;
+ u32 crtr;
+} at91_st_t;
+
+#define AT91_ST_CR_WDRST 1
+
+#define AT91_ST_WDMR_WDV(x) (x & 0xFFFF)
+#define AT91_ST_WDMR_RSTEN 0x00010000
+#define AT91_ST_WDMR_EXTEN 0x00020000
+
+#endif
diff --git a/include/asm-arm/arch-at91/at91_tc.h b/include/asm-arm/arch-at91/at91_tc.h
new file mode 100644
index 0000000..b40cd20
--- /dev/null
+++ b/include/asm-arm/arch-at91/at91_tc.h
@@ -0,0 +1,79 @@
+/*
+ * Memory Setup stuff - taken from blob memsetup.S
+ *
+ * Copyright (C) 2009 Jens Scharsig (js_at_ng(a)scharsoft.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
+ */
+
+#ifndef AT91_TC_H
+#define AT91_TC_H
+
+typedef struct at91_tcc {
+ u32 ccr; /* 0x00 Channel Control Register */
+ u32 cmr; /* 0x04 Channel Mode Register */
+ u32 reserved1[2];
+ u32 cv; /* 0x10 Counter Value */
+ u32 ra; /* 0x14 Register A */
+ u32 rb; /* 0x18 Register B */
+ u32 rc; /* 0x1C Register C */
+ u32 sr; /* 0x20 Status Register */
+ u32 ier; /* 0x24 Interrupt Enable Register */
+ u32 idr; /* 0x28 Interrupt Disable Register */
+ u32 imr; /* 0x2C Interrupt Mask Register */
+ u32 reserved3[4];
+} at91_tcc_t;
+
+#define AT91_TC_CCR_CLKEN 0x00000001
+#define AT91_TC_CCR_CLKDIS 0x00000002
+#define AT91_TC_CCR_SWTRG 0x00000004
+
+#define AT91_TC_CMR_CPCTRG 0x00004000
+
+#define AT91_TC_CMR_TCCLKS_CLOCK1 0x00000000
+#define AT91_TC_CMR_TCCLKS_CLOCK2 0x00000001
+#define AT91_TC_CMR_TCCLKS_CLOCK3 0x00000002
+#define AT91_TC_CMR_TCCLKS_CLOCK4 0x00000003
+#define AT91_TC_CMR_TCCLKS_CLOCK5 0x00000004
+#define AT91_TC_CMR_TCCLKS_XC0 0x00000005
+#define AT91_TC_CMR_TCCLKS_XC1 0x00000006
+#define AT91_TC_CMR_TCCLKS_XC2 0x00000007
+
+typedef struct at91_tc {
+ at91_tcc_t tc[3]; /* 0x00 TC Channel 0-2 */
+ u32 bcr; /* 0xC0 TC Block Control Register */
+ u32 bmr; /* 0xC4 TC Block Mode Register */
+} at91_tc_t;
+
+#define AT91_TC_BMR_TC0XC0S_TCLK0 0x00000000
+#define AT91_TC_BMR_TC0XC0S_NONE 0x00000001
+#define AT91_TC_BMR_TC0XC0S_TIOA1 0x00000002
+#define AT91_TC_BMR_TC0XC0S_TIOA2 0x00000003
+
+#define AT91_TC_BMR_TC1XC1S_TCLK1 0x00000000
+#define AT91_TC_BMR_TC1XC1S_NONE 0x00000004
+#define AT91_TC_BMR_TC1XC1S_TIOA0 0x00000008
+#define AT91_TC_BMR_TC1XC1S_TIOA2 0x0000000C
+
+#define AT91_TC_BMR_TC2XC2S_TCLK2 0x00000000
+#define AT91_TC_BMR_TC2XC2S_NONE 0x00000010
+#define AT91_TC_BMR_TC2XC2S_TIOA0 0x00000020
+#define AT91_TC_BMR_TC2XC2S_TIOA1 0x00000030
+
+#endif
diff --git a/include/asm-arm/arch-at91/at91rm9200.h b/include/asm-arm/arch-at91/at91rm9200.h
new file mode 100644
index 0000000..da6843b
--- /dev/null
+++ b/include/asm-arm/arch-at91/at91rm9200.h
@@ -0,0 +1,135 @@
+/*
+ * 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 optionany 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 __AT91RM9200_H__
+#define __AT91RM9200_H__
+
+/* Periperial Identifiers */
+
+#define AT91_ID_SYS 1 /* System Peripheral */
+#define AT91_ID_PIOA 2 /* PIO port A */
+#define AT91_ID_PIOB 3 /* PIO port B */
+#define AT91_ID_PIOC 4 /* PIO port C */
+#define AT91_ID_PIOD 5 /* PIO port D BGA only */
+#define AT91_ID_USART0 6 /* USART 0 */
+#define AT91_ID_USART1 7 /* USART 1 */
+#define AT91_ID_USART2 8 /* USART 2 */
+#define AT91_ID_USART3 9 /* USART 3 */
+#define AT91_ID_MCI 10 /* Multimedia Card Interface */
+#define AT91_ID_UDP 11 /* USB Device Port */
+#define AT91_ID_TWI 12 /* Two Wire Interface */
+#define AT91_ID_SPI 13 /* Serial Peripheral Interface */
+#define AT91_ID_SSC0 14 /* Synch. Serial Controller 0 */
+#define AT91_ID_SSC1 15 /* Synch. Serial Controller 1 */
+#define AT91_ID_SSC2 16 /* Synch. Serial Controller 2 */
+#define AT91_ID_TC0 17 /* Timer Counter 0 */
+#define AT91_ID_TC1 18 /* Timer Counter 1 */
+#define AT91_ID_TC2 19 /* Timer Counter 2 */
+#define AT91_ID_TC3 20 /* Timer Counter 3 */
+#define AT91_ID_TC4 21 /* Timer Counter 4 */
+#define AT91_ID_TC5 22 /* Timer Counter 5 */
+#define AT91_ID_UHP 23 /* OHCI USB Host Port */
+#define AT91_ID_EMAC 24 /* Ethernet MAC */
+#define AT91_ID_IRQ0 25 /* Advanced Interrupt Controller */
+#define AT91_ID_IRQ1 26 /* Advanced Interrupt Controller */
+#define AT91_ID_IRQ2 27 /* Advanced Interrupt Controller */
+#define AT91_ID_IRQ3 28 /* Advanced Interrupt Controller */
+#define AT91_ID_IRQ4 29 /* Advanced Interrupt Controller */
+#define AT91_ID_IRQ5 30 /* Advanced Interrupt Controller */
+#define AT91_ID_IRQ6 31 /* Advanced Interrupt Controller */
+
+#define AT91_USB_HOST_BASE 0x00300000
+
+#define AT91_TC_BASE 0xFFFA0000
+#define AT91_UDP_BASE 0xFFFB0000
+#define AT91_MCI_BASE 0xFFFB4000
+#define AT91_TWI_BASE 0xFFFB8000
+#define AT91_EMAC_BASE 0xFFFBC000
+#define AT91_USART_BASE 0xFFFC0000 /* 4x 0x4000 Offset */
+#define AT91_SCC_BASE 0xFFFD0000 /* 4x 0x4000 Offset */
+#define AT91_SPI_BASE 0xFFFE0000
+
+#define AT91_AIC_BASE 0xFFFFF000
+#define AT91_DBGU_BASE 0xFFFFF200
+#define AT91_PIO_BASE 0xFFFFF400 /* 4x 0x200 Offset */
+#define AT91_PMC_BASE 0xFFFFFC00
+#define AT91_ST_BASE 0xFFFFFD00
+#define AT91_ST_BASE 0xFFFFFD00
+#define AT91_RTC_BASE 0xFFFFFE00
+#define AT91_MC_BASE 0xFFFFFF00
+
+
+/* AT91RM9200 Periperial Multiplexing A */
+/* Port A */
+#define AT91_PMX_AA_EREFCK 0x00000080
+#define AT91_PMX_AA_ETXCK 0x00000080
+#define AT91_PMX_AA_ETXEN 0x00000100
+#define AT91_PMX_AA_ETX0 0x00000200
+#define AT91_PMX_AA_ETX1 0x00000400
+#define AT91_PMX_AA_ECRS 0x00000800
+#define AT91_PMX_AA_ECRSDV 0x00000800
+#define AT91_PMX_AA_ERX0 0x00001000
+#define AT91_PMX_AA_ERX1 0x00002000
+#define AT91_PMX_AA_ERXER 0x00004000
+#define AT91_PMX_AA_EMDC 0x00008000
+#define AT91_PMX_AA_EMDIO 0x00010000
+
+#define AT91_PMX_AA_TXD2 0x00810000
+
+#define AT91_PMX_AA_TWD 0x02000000
+#define AT91_PMX_AA_TWCK 0x04000000
+
+/* Port B */
+#define AT91_PMX_BA_ERXCK 0x00080000
+#define AT91_PMX_BA_ECOL 0x00040000
+#define AT91_PMX_BA_ERXDV 0x00020000
+#define AT91_PMX_BA_ERX3 0x00010000
+#define AT91_PMX_BA_ERX2 0x00008000
+#define AT91_PMX_BA_ETXER 0x00004000
+#define AT91_PMX_BA_ETX3 0x00002000
+#define AT91_PMX_BA_ETX2 0x00001000
+
+/* Port B */
+
+#define AT91_PMX_CA_BFCK 0x00000001
+#define AT91_PMX_CA_BFRDY 0x00000002
+#define AT91_PMX_CA_SMOE 0x00000002
+#define AT91_PMX_CA_BFAVD 0x00000004
+#define AT91_PMX_CA_BFBAA 0x00000008
+#define AT91_PMX_CA_SMWE 0x00000008
+#define AT91_PMX_CA_BFOE 0x00000010
+#define AT91_PMX_CA_BFWE 0x00000020
+#define AT91_PMX_CA_NWAIT 0x00000040
+#define AT91_PMX_CA_A23 0x00000080
+#define AT91_PMX_CA_A24 0x00000100
+#define AT91_PMX_CA_A25 0x00000200
+#define AT91_PMX_CA_CFRNW 0x00000200
+#define AT91_PMX_CA_NCS4 0x00000400
+#define AT91_PMX_CA_CFCS 0x00000400
+#define AT91_PMX_CA_NCS5 0x00000800
+#define AT91_PMX_CA_CFCE1 0x00001000
+#define AT91_PMX_CA_NCS6 0x00001000
+#define AT91_PMX_CA_CFCE2 0x00002000
+#define AT91_PMX_CA_NCS7 0x00002000
+#define AT91_PMX_CA_D16_31 0xFFFF0000
+
+#define AT91_CPU_NAME "AT91RM9200"
+
+#endif
diff --git a/include/asm-arm/arch-at91/hardware.h b/include/asm-arm/arch-at91/hardware.h
index de06a10..4ddb315 100644
--- a/include/asm-arm/arch-at91/hardware.h
+++ b/include/asm-arm/arch-at91/hardware.h
@@ -17,7 +17,7 @@
#include <asm/sizes.h>
#if defined(CONFIG_AT91RM9200)
-#include <asm/arch/at91rm9200.h>
+#include <asm/arch-at91/at91rm9200.h>
#elif defined(CONFIG_AT91SAM9260) || defined(CONFIG_AT91SAM9G20)
#include <asm/arch/at91sam9260.h>
#define AT91_BASE_SPI AT91SAM9260_BASE_SPI0
2
4

03 Feb '10
From: Ladislav Michl <ladis(a)linux-mips.org>
ns16550 busyloops waiting for incoming byte causing watchdog to reboot
while waiting for a key press. A call to WATCHDOG_RESET in NS16550_getc
loop fixes it.
Signed-off-by: Ladislav Michl <ladis(a)linux-mips.org>
---
diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
index 2fcc8c3..b3bf10b 100644
--- a/drivers/serial/ns16550.c
+++ b/drivers/serial/ns16550.c
@@ -6,6 +6,7 @@
#include <config.h>
#include <ns16550.h>
+#include <watchdog.h>
#define UART_LCRVAL UART_LCR_8N1 /* 8 data, 1 stop, no parity */
#define UART_MCRVAL (UART_MCR_DTR | \
@@ -70,6 +71,7 @@ char NS16550_getc (NS16550_t com_port)
extern void usbtty_poll(void);
usbtty_poll();
#endif
+ WATCHDOG_RESET();
}
return (com_port->rbr);
}
2
1

03 Feb '10
* convert at91sam9263ek board to use c stucture SoC access
* demonstates how to use new SoC
Signed-off-by: Jens Scharsig <js_at_ng(a)scharsoft.de>
---
board/atmel/at91sam9263ek/at91sam9263ek.c | 147 +++++++++++++++--------------
board/atmel/at91sam9263ek/led.c | 9 +-
include/configs/at91sam9263ek.h | 83 ++++++++---------
3 files changed, 119 insertions(+), 120 deletions(-)
diff --git a/board/atmel/at91sam9263ek/at91sam9263ek.c b/board/atmel/at91sam9263ek/at91sam9263ek.c
index 0b7065b..43a1aab 100644
--- a/board/atmel/at91sam9263ek/at91sam9263ek.c
+++ b/board/atmel/at91sam9263ek/at91sam9263ek.c
@@ -25,13 +25,13 @@
#include <common.h>
#include <asm/sizes.h>
#include <asm/arch/at91sam9263.h>
-#include <asm/arch/at91sam9263_matrix.h>
#include <asm/arch/at91sam9_smc.h>
#include <asm/arch/at91_common.h>
#include <asm/arch/at91_pmc.h>
#include <asm/arch/at91_rstc.h>
+#include <asm/arch/at91_matrix.h>
+#include <asm/arch/at91_pio.h>
#include <asm/arch/clk.h>
-#include <asm/arch/gpio.h>
#include <asm/arch/io.h>
#include <asm/arch/hardware.h>
#include <lcd.h>
@@ -52,33 +52,39 @@ DECLARE_GLOBAL_DATA_PTR;
static void at91sam9263ek_nand_hw_init(void)
{
unsigned long csa;
+ at91_smc_t *smc = (at91_smc_t *) AT91_SMC0_BASE;
+ at91_matrix_t *matrix = (at91_matrix_t *) AT91_MATRIX_BASE;
+ at91_pmc_t *pmc = (at91_pmc_t *) AT91_PMC_BASE;
+
+ /* Enable CS3 */
+ csa = readl(&matrix->csa[0]) | AT91_MATRIX_CSA_EBI_CS3A;
+ writel(csa, &matrix->csa[0]);
/* Enable CS3 */
- csa = at91_sys_read(AT91_MATRIX_EBI0CSA);
- at91_sys_write(AT91_MATRIX_EBI0CSA,
- csa | AT91_MATRIX_EBI0_CS3A_SMC_SMARTMEDIA);
/* Configure SMC CS3 for NAND/SmartMedia */
- at91_sys_write(AT91_SMC_SETUP(3),
- AT91_SMC_NWESETUP_(1) | AT91_SMC_NCS_WRSETUP_(0) |
- AT91_SMC_NRDSETUP_(1) | AT91_SMC_NCS_RDSETUP_(0));
- at91_sys_write(AT91_SMC_PULSE(3),
- AT91_SMC_NWEPULSE_(3) | AT91_SMC_NCS_WRPULSE_(3) |
- AT91_SMC_NRDPULSE_(3) | AT91_SMC_NCS_RDPULSE_(3));
- at91_sys_write(AT91_SMC_CYCLE(3),
- AT91_SMC_NWECYCLE_(5) | AT91_SMC_NRDCYCLE_(5));
- at91_sys_write(AT91_SMC_MODE(3),
- AT91_SMC_READMODE | AT91_SMC_WRITEMODE |
- AT91_SMC_EXNWMODE_DISABLE |
+ writel(AT91_SMC_SETUP_NWE(1) | AT91_SMC_SETUP_NCS_WR(0) |
+ AT91_SMC_SETUP_NRD(1) | AT91_SMC_SETUP_NCS_RD(0),
+ &smc->cs[3].setup);
+
+ writel(AT91_SMC_PULSE_NWE(3) | AT91_SMC_PULSE_NCS_WR(3) |
+ AT91_SMC_PULSE_NRD(3) | AT91_SMC_PULSE_NCS_RD(3),
+ &smc->cs[3].pulse);
+
+ writel(AT91_SMC_CYCLE_NWE(5) | AT91_SMC_CYCLE_NRD(5),
+ &smc->cs[3].cycle);
+ writel(AT91_SMC_MODE_RM_NRD | AT91_SMC_MODE_WM_NWE |
+ AT91_SMC_MODE_EXNW_DISABLE |
#ifdef CONFIG_SYS_NAND_DBW_16
- AT91_SMC_DBW_16 |
+ AT91_SMC_MODE_DBW_16 |
#else /* CONFIG_SYS_NAND_DBW_8 */
- AT91_SMC_DBW_8 |
+ AT91_SMC_MODE_DBW_8 |
#endif
- AT91_SMC_TDF_(2));
+ AT91_SMC_MODE_TDF_CYCLE(2),
+ &smc->cs[3].mode);
- at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_PIOA |
- 1 << AT91SAM9263_ID_PIOCDE);
+ writel(1 << AT91SAM9263_ID_PIOA | 1 << AT91SAM9263_ID_PIOCDE,
+ &pmc->pcer);
/* Configure RDY/BSY */
at91_set_gpio_input(CONFIG_SYS_NAND_READY_PIN, 1);
@@ -91,10 +97,12 @@ static void at91sam9263ek_nand_hw_init(void)
#ifdef CONFIG_MACB
static void at91sam9263ek_macb_hw_init(void)
{
- unsigned long rstc;
-
+ unsigned long erstl;
+ at91_pmc_t *pmc = (at91_pmc_t *) AT91_PMC_BASE;
+ at91_pio_t *pio = (at91_pio_t *) AT91_PIO_BASE;
+ at91_rstc_t *rstc = (at91_rstc_t *) AT91_RSTC_BASE;
/* Enable clock */
- at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_EMAC);
+ writel(1 << AT91SAM9263_ID_EMAC, &pmc->pcer);
/*
* Disable pull-up on:
@@ -104,35 +112,27 @@ static void at91sam9263ek_macb_hw_init(void)
*
* PHY has internal pull-down
*/
- writel(pin_to_mask(AT91_PIN_PC25),
- pin_to_controller(AT91_PIN_PC0) + PIO_PUDR);
- writel(pin_to_mask(AT91_PIN_PE25) |
- pin_to_mask(AT91_PIN_PE26),
- pin_to_controller(AT91_PIN_PE0) + PIO_PUDR);
- rstc = at91_sys_read(AT91_RSTC_MR) & AT91_RSTC_ERSTL;
+ writel(AT91_PIN_TO_MASK(25), &pio->pioc.pudr);
+ writel(AT91_PIN_TO_MASK(25) | AT91_PIN_TO_MASK(26), &pio->pioe.pudr);
- /* Need to reset PHY -> 500ms reset */
- at91_sys_write(AT91_RSTC_MR, AT91_RSTC_KEY |
- (AT91_RSTC_ERSTL & (0x0D << 8)) |
- AT91_RSTC_URSTEN);
+ erstl = readl(&rstc->mr) & AT91_RSTC_MR_ERSTL_MASK;
- at91_sys_write(AT91_RSTC_CR, AT91_RSTC_KEY | AT91_RSTC_EXTRST);
+ /* Need to reset PHY -> 500ms reset */
+ writel(AT91_RSTC_KEY | AT91_RSTC_MR_ERSTL(0x0D) |
+ AT91_RSTC_MR_URSTEN, &rstc->mr);
+ writel(AT91_RSTC_KEY | AT91_RSTC_CR_EXTRST, &rstc->cr);
/* Wait for end hardware reset */
- while (!(at91_sys_read(AT91_RSTC_SR) & AT91_RSTC_NRSTL));
+ while (!(readl(&rstc->sr) & AT91_RSTC_SR_NRSTL))
+ ;
/* Restore NRST value */
- at91_sys_write(AT91_RSTC_MR, AT91_RSTC_KEY |
- (rstc) |
- AT91_RSTC_URSTEN);
+ writel(AT91_RSTC_KEY | erstl | AT91_RSTC_MR_URSTEN, &rstc->mr);
/* Re-enable pull-up */
- writel(pin_to_mask(AT91_PIN_PC25),
- pin_to_controller(AT91_PIN_PC0) + PIO_PUER);
- writel(pin_to_mask(AT91_PIN_PE25) |
- pin_to_mask(AT91_PIN_PE26),
- pin_to_controller(AT91_PIN_PE0) + PIO_PUER);
+ writel(AT91_PIN_TO_MASK(25), &pio->pioc.puer);
+ writel(AT91_PIN_TO_MASK(25) | AT91_PIN_TO_MASK(26), &pio->pioe.puer);
at91_macb_hw_init();
}
@@ -158,41 +158,42 @@ vidinfo_t panel_info = {
void lcd_enable(void)
{
- at91_set_gpio_value(AT91_PIN_PA30, 1); /* power up */
+ at91_set_gpio_value(AT91_PORTPIN(A, 30), 1); /* power up */
}
void lcd_disable(void)
{
- at91_set_gpio_value(AT91_PIN_PA30, 0); /* power down */
+ at91_set_gpio_value(AT91_PORTPIN(A, 30), 0); /* power down */
}
static void at91sam9263ek_lcd_hw_init(void)
{
- at91_set_A_periph(AT91_PIN_PC1, 0); /* LCDHSYNC */
- at91_set_A_periph(AT91_PIN_PC2, 0); /* LCDDOTCK */
- at91_set_A_periph(AT91_PIN_PC3, 0); /* LCDDEN */
- at91_set_B_periph(AT91_PIN_PB9, 0); /* LCDCC */
- at91_set_A_periph(AT91_PIN_PC6, 0); /* LCDD2 */
- at91_set_A_periph(AT91_PIN_PC7, 0); /* LCDD3 */
- at91_set_A_periph(AT91_PIN_PC8, 0); /* LCDD4 */
- at91_set_A_periph(AT91_PIN_PC9, 0); /* LCDD5 */
- at91_set_A_periph(AT91_PIN_PC10, 0); /* LCDD6 */
- at91_set_A_periph(AT91_PIN_PC11, 0); /* LCDD7 */
- at91_set_A_periph(AT91_PIN_PC14, 0); /* LCDD10 */
- at91_set_A_periph(AT91_PIN_PC15, 0); /* LCDD11 */
- at91_set_A_periph(AT91_PIN_PC16, 0); /* LCDD12 */
- at91_set_B_periph(AT91_PIN_PC12, 0); /* LCDD13 */
- at91_set_A_periph(AT91_PIN_PC18, 0); /* LCDD14 */
- at91_set_A_periph(AT91_PIN_PC19, 0); /* LCDD15 */
- at91_set_A_periph(AT91_PIN_PC22, 0); /* LCDD18 */
- at91_set_A_periph(AT91_PIN_PC23, 0); /* LCDD19 */
- at91_set_A_periph(AT91_PIN_PC24, 0); /* LCDD20 */
- at91_set_B_periph(AT91_PIN_PC17, 0); /* LCDD21 */
- at91_set_A_periph(AT91_PIN_PC26, 0); /* LCDD22 */
- at91_set_A_periph(AT91_PIN_PC27, 0); /* LCDD23 */
-
- at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_LCDC);
-
+ at91_pmc_t *pmc = (at91_pmc_t *) AT91_PMC_BASE;
+
+ at91_set_a_periph(AT91_PORTPIN(C, 1), 0); /* LCDHSYNC */
+ at91_set_a_periph(AT91_PORTPIN(C, 2), 0); /* LCDDOTCK */
+ at91_set_a_periph(AT91_PORTPIN(C, 3), 0); /* LCDDEN */
+ at91_set_b_periph(AT91_PORTPIN(B, 9), 0); /* LCDCC */
+ at91_set_a_periph(AT91_PORTPIN(C, 6), 0); /* LCDD2 */
+ at91_set_a_periph(AT91_PORTPIN(C, 7), 0); /* LCDD3 */
+ at91_set_a_periph(AT91_PORTPIN(C, 8), 0); /* LCDD4 */
+ at91_set_a_periph(AT91_PORTPIN(C, 9), 0); /* LCDD5 */
+ at91_set_a_periph(AT91_PORTPIN(C, 10), 0); /* LCDD6 */
+ at91_set_a_periph(AT91_PORTPIN(C, 11), 0); /* LCDD7 */
+ at91_set_a_periph(AT91_PORTPIN(C, 14), 0); /* LCDD10 */
+ at91_set_a_periph(AT91_PORTPIN(C, 15), 0); /* LCDD11 */
+ at91_set_a_periph(AT91_PORTPIN(C, 16), 0); /* LCDD12 */
+ at91_set_b_periph(AT91_PORTPIN(C, 12), 0); /* LCDD13 */
+ at91_set_a_periph(AT91_PORTPIN(C, 18), 0); /* LCDD14 */
+ at91_set_a_periph(AT91_PORTPIN(C, 19), 0); /* LCDD15 */
+ at91_set_a_periph(AT91_PORTPIN(C, 22), 0); /* LCDD18 */
+ at91_set_a_periph(AT91_PORTPIN(C, 23), 0); /* LCDD19 */
+ at91_set_a_periph(AT91_PORTPIN(C, 24), 0); /* LCDD20 */
+ at91_set_b_periph(AT91_PORTPIN(C, 17), 0); /* LCDD21 */
+ at91_set_a_periph(AT91_PORTPIN(C, 26), 0); /* LCDD22 */
+ at91_set_a_periph(AT91_PORTPIN(C, 27), 0); /* LCDD23 */
+
+ writel(1 << AT91SAM9263_ID_LCDC, &pmc->pcer);
gd->fb_base = AT91SAM9263_SRAM0_BASE;
}
@@ -258,7 +259,7 @@ int board_init(void)
at91sam9263ek_nand_hw_init();
#endif
#ifdef CONFIG_HAS_DATAFLASH
- at91_set_gpio_output(AT91_PIN_PE20, 1); /* select spi0 clock */
+ at91_set_gpio_output(AT91_PORTPIN(E, 20), 1); /* select spi0 clock */
at91_spi0_hw_init(1 << 0);
#endif
#ifdef CONFIG_MACB
@@ -297,7 +298,7 @@ int board_eth_init(bd_t *bis)
{
int rc = 0;
#ifdef CONFIG_MACB
- rc = macb_eth_initialize(0, (void *)AT91SAM9263_BASE_EMAC, 0x00);
+ rc = macb_eth_initialize(0, (void *) AT91_EMAC_BASE, 0x00);
#endif
return rc;
}
diff --git a/board/atmel/at91sam9263ek/led.c b/board/atmel/at91sam9263ek/led.c
index 82c5388..e5817df 100644
--- a/board/atmel/at91sam9263ek/led.c
+++ b/board/atmel/at91sam9263ek/led.c
@@ -23,16 +23,19 @@
*/
#include <common.h>
-#include <asm/arch/at91sam9263.h>
+#include <asm/arch/hardware.h>
#include <asm/arch/at91_pmc.h>
+#include <asm/arch/at91_pio.h>
#include <asm/arch/gpio.h>
#include <asm/arch/io.h>
void coloured_LED_init(void)
{
/* Enable clock */
- at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_PIOB |
- 1 << AT91SAM9263_ID_PIOCDE);
+ at91_pmc_t *pmc = (at91_pmc_t *) AT91_PMC_BASE;
+
+ writel(1 << AT91SAM9263_ID_PIOB | 1 << AT91SAM9263_ID_PIOCDE,
+ &pmc->pcer);
at91_set_gpio_output(CONFIG_RED_LED, 1);
at91_set_gpio_output(CONFIG_GREEN_LED, 1);
diff --git a/include/configs/at91sam9263ek.h b/include/configs/at91sam9263ek.h
index dc010f2..68e8310 100644
--- a/include/configs/at91sam9263ek.h
+++ b/include/configs/at91sam9263ek.h
@@ -27,8 +27,6 @@
#ifndef __CONFIG_H
#define __CONFIG_H
-#define CONFIG_AT91_LEGACY
-
/* ARM asynchronous clock */
#define AT91_MAIN_CLOCK 16367660 /* 16.367 MHz crystal */
#define CONFIG_SYS_HZ 1000
@@ -73,9 +71,9 @@
/* LED */
#define CONFIG_AT91_LED
-#define CONFIG_RED_LED AT91_PIN_PB7 /* this is the power led */
-#define CONFIG_GREEN_LED AT91_PIN_PB8 /* this is the user1 led */
-#define CONFIG_YELLOW_LED AT91_PIN_PC29 /* this is the user2 led */
+#define CONFIG_RED_LED AT91_PORTPIN(B, 7) /* the power led */
+#define CONFIG_GREEN_LED AT91_PORTPIN(B, 8) /* the user1 led */
+#define CONFIG_YELLOW_LED AT91_PORTPIN(C, 29) /* the user2 led */
#define CONFIG_BOOTDELAY 3
@@ -151,39 +149,36 @@
#ifndef CONFIG_SKIP_LOWLEVEL_INIT
#define MASTER_PLL_MUL 171
#define MASTER_PLL_DIV 14
+#define MASTER_PLL_OUT 3
/* clocks */
#define CONFIG_SYS_MOR_VAL \
- (AT91_PMC_MOSCEN | \
- (255 << 8)) /* Main Oscillator Start-up Time */
-#define CONFIG_SYS_PLLAR_VAL \
- (AT91_PMC_PLLA_WR_ERRATA | /* Bit 29 must be 1 when prog */ \
- AT91_PMC_OUT | \
- AT91_PMC_PLLCOUNT | /* PLL Counter */ \
- (2 << 28) | /* PLL Clock Frequency Range */ \
- ((MASTER_PLL_MUL - 1) << 16) | (MASTER_PLL_DIV))
+ (AT91_PMC_MOR_MOSCEN | AT91_PMC_MOR_OSCOUNT(255))
+#define CONFIG_SYS_PLLAR_VAL \
+ (AT91_PMC_PLLAR_29 | \
+ AT91_PMC_PLLxR_OUT(MASTER_PLL_OUT) | \
+ AT91_PMC_PLLxR_PLLCOUNT(63) | \
+ AT91_PMC_PLLxR_MUL(MASTER_PLL_MUL - 1) | \
+ AT91_PMC_PLLxR_DIV(MASTER_PLL_DIV))
/* PCK/2 = MCK Master Clock from PLLA */
#define CONFIG_SYS_MCKR1_VAL \
- (AT91_PMC_CSS_SLOW | \
- AT91_PMC_PRES_1 | \
- AT91SAM9_PMC_MDIV_2 | \
- AT91_PMC_PDIV_1)
+ (AT91_PMC_MCKR_CSS_SLOW | AT91_PMC_MCKR_PRES_1 | \
+ AT91_PMC_MCKR_MDIV_2)
+
/* PCK/2 = MCK Master Clock from PLLA */
#define CONFIG_SYS_MCKR2_VAL \
- (AT91_PMC_CSS_PLLA | \
- AT91_PMC_PRES_1 | \
- AT91SAM9_PMC_MDIV_2 | \
- AT91_PMC_PDIV_1)
+ (AT91_PMC_MCKR_CSS_PLLA | AT91_PMC_MCKR_PRES_1 | \
+ AT91_PMC_MCKR_MDIV_2)
/* define PDC[31:16] as DATA[31:16] */
#define CONFIG_SYS_PIOD_PDR_VAL1 0xFFFF0000
/* no pull-up for D[31:16] */
#define CONFIG_SYS_PIOD_PPUDR_VAL 0xFFFF0000
/* EBI0_CSA, CS1 SDRAM, CS3 NAND Flash, 3.3V memories */
-#define CONFIG_SYS_MATRIX_EBI0CSA_VAL \
- (AT91_MATRIX_EBI0_DBPUC | AT91_MATRIX_EBI0_VDDIOMSEL_3_3V | \
- AT91_MATRIX_EBI0_CS1A_SDRAMC)
+#define CONFIG_SYS_MATRIX_EBICSA_VAL \
+ (AT91_MATRIX_CSA_DBPUC | AT91_MATRIX_CSA_VDDIOMSEL_3_3V | \
+ AT91_MATRIX_CSA_EBI_CS1A)
/* SDRAM */
/* SDRAMC_MR Mode register */
@@ -225,33 +220,32 @@
#define CONFIG_SYS_SDRAM_VAL12 0 /* SDRAM_BASE */
/* setup SMC0, CS0 (NOR Flash) - 16-bit, 15 WS */
-#define CONFIG_SYS_SMC0_SETUP0_VAL \
- (AT91_SMC_NWESETUP_(10) | AT91_SMC_NCS_WRSETUP_(10) | \
- AT91_SMC_NRDSETUP_(10) | AT91_SMC_NCS_RDSETUP_(10))
-#define CONFIG_SYS_SMC0_PULSE0_VAL \
- (AT91_SMC_NWEPULSE_(11) | AT91_SMC_NCS_WRPULSE_(11) | \
- AT91_SMC_NRDPULSE_(11) | AT91_SMC_NCS_RDPULSE_(11))
+#define CONFIG_SYS_SMC0_SETUP0_VAL \
+ (AT91_SMC_SETUP_NWE(10) | AT91_SMC_SETUP_NCS_WR(10) | \
+ AT91_SMC_SETUP_NRD(10) | AT91_SMC_SETUP_NCS_RD(10))
+#define CONFIG_SYS_SMC0_PULSE0_VAL \
+ (AT91_SMC_PULSE_NWE(11) | AT91_SMC_PULSE_NCS_WR(11) | \
+ AT91_SMC_PULSE_NRD(11) | AT91_SMC_PULSE_NCS_RD(11))
#define CONFIG_SYS_SMC0_CYCLE0_VAL \
- (AT91_SMC_NWECYCLE_(22) | AT91_SMC_NRDCYCLE_(22))
+ (AT91_SMC_CYCLE_NWE(22) | AT91_SMC_CYCLE_NRD(22))
#define CONFIG_SYS_SMC0_MODE0_VAL \
- (AT91_SMC_READMODE | AT91_SMC_WRITEMODE | \
- AT91_SMC_DBW_16 | \
- AT91_SMC_TDFMODE | \
- AT91_SMC_TDF_(6))
+ (AT91_SMC_MODE_RM_NRD | AT91_SMC_MODE_WM_NWE | \
+ AT91_SMC_MODE_DBW_16 | \
+ AT91_SMC_MODE_TDF | AT91_SMC_MODE_TDF_CYCLE(6))
/* user reset enable */
#define CONFIG_SYS_RSTC_RMR_VAL \
(AT91_RSTC_KEY | \
- AT91_RSTC_PROCRST | \
- AT91_RSTC_RSTTYP_WAKEUP | \
- AT91_RSTC_RSTTYP_WATCHDOG)
+ AT91_RSTC_MR_URSTEN | \
+ AT91_RSTC_MR_ERSTL(15))
/* Disable Watchdog */
#define CONFIG_SYS_WDTC_WDMR_VAL \
- (AT91_WDT_WDIDLEHLT | AT91_WDT_WDDBGHLT | \
- AT91_WDT_WDV | \
- AT91_WDT_WDDIS | \
- AT91_WDT_WDD)
+ (AT91_WDT_MR_WDIDLEHLT | AT91_WDT_MR_WDDBGHLT | \
+ AT91_WDT_MR_WDV(0xfff) | \
+ AT91_WDT_MR_WDDIS | \
+ AT91_WDT_MR_WDD(0xfff))
+
#endif
#else
@@ -268,9 +262,10 @@
#define CONFIG_SYS_NAND_MASK_ALE (1 << 21)
/* our CLE is AD22 */
#define CONFIG_SYS_NAND_MASK_CLE (1 << 22)
-#define CONFIG_SYS_NAND_ENABLE_PIN AT91_PIN_PD15
-#define CONFIG_SYS_NAND_READY_PIN AT91_PIN_PA22
+#define CONFIG_SYS_NAND_ENABLE_PIN AT91_PORTPIN(D, 15)
+#define CONFIG_SYS_NAND_READY_PIN AT91_PORTPIN(A, 22)
+#define CONFIG_SYS_64BIT_VSPRINTF /* needed for nand_util.c */
#endif
/* Ethernet */
2
3

[U-Boot] [PATCH 4/9 V3] convert all at91 files to use at91_gpio driver syntax
by Jens Scharsig 03 Feb '10
by Jens Scharsig 03 Feb '10
03 Feb '10
* convert all files cpu/../at91 to use at91_gpio driver syntax
* change AT91_PINP([A-F])(\d+) to AT91_PORTPIN(\1, \2),
this makes all 160 AT91_PINPxxx defines obsolete
* AT91_PINPxxx defines can be remove if all boards converted
to new SoC access
Signed-off-by: Jens Scharsig <js_at_ng(a)scharsoft.de>
---
cpu/arm926ejs/at91/at91cap9_devices.c | 100 +++++++++++++-------------
cpu/arm926ejs/at91/at91sam9260_devices.c | 100 +++++++++++++-------------
cpu/arm926ejs/at91/at91sam9261_devices.c | 60 ++++++++--------
cpu/arm926ejs/at91/at91sam9263_devices.c | 104 +++++++++++++-------------
cpu/arm926ejs/at91/at91sam9m10g45_devices.c | 96 ++++++++++++------------
cpu/arm926ejs/at91/at91sam9rl_devices.c | 38 +++++-----
6 files changed, 249 insertions(+), 249 deletions(-)
diff --git a/cpu/arm926ejs/at91/at91cap9_devices.c b/cpu/arm926ejs/at91/at91cap9_devices.c
index 39e405f..c41e139 100644
--- a/cpu/arm926ejs/at91/at91cap9_devices.c
+++ b/cpu/arm926ejs/at91/at91cap9_devices.c
@@ -34,29 +34,29 @@
void at91_serial0_hw_init(void)
{
- at91_set_A_periph(AT91_PIN_PA22, 1); /* TXD0 */
- at91_set_A_periph(AT91_PIN_PA23, 0); /* RXD0 */
+ at91_set_a_periph(AT91_PORTPIN(A, 22), 1); /* TXD0 */
+ at91_set_a_periph(AT91_PORTPIN(A, 23), 0); /* RXD0 */
at91_sys_write(AT91_PMC_PCER, 1 << AT91CAP9_ID_US0);
}
void at91_serial1_hw_init(void)
{
- at91_set_A_periph(AT91_PIN_PD0, 1); /* TXD1 */
- at91_set_A_periph(AT91_PIN_PD1, 0); /* RXD1 */
+ at91_set_a_periph(AT91_PORTPIN(D, 0), 1); /* TXD1 */
+ at91_set_a_periph(AT91_PORTPIN(D, 1), 0); /* RXD1 */
at91_sys_write(AT91_PMC_PCER, 1 << AT91CAP9_ID_US1);
}
void at91_serial2_hw_init(void)
{
- at91_set_A_periph(AT91_PIN_PD2, 1); /* TXD2 */
- at91_set_A_periph(AT91_PIN_PD3, 0); /* RXD2 */
+ at91_set_a_periph(AT91_PORTPIN(D, 2), 1); /* TXD2 */
+ at91_set_a_periph(AT91_PORTPIN(D, 3), 0); /* RXD2 */
at91_sys_write(AT91_PMC_PCER, 1 << AT91CAP9_ID_US2);
}
void at91_serial3_hw_init(void)
{
- at91_set_A_periph(AT91_PIN_PC30, 0); /* DRXD */
- at91_set_A_periph(AT91_PIN_PC31, 1); /* DTXD */
+ at91_set_a_periph(AT91_PORTPIN(C, 30), 0); /* DRXD */
+ at91_set_a_periph(AT91_PORTPIN(C, 31), 1); /* DTXD */
at91_sys_write(AT91_PMC_PCER, 1 << AT91_ID_SYS);
}
@@ -82,71 +82,71 @@ void at91_serial_hw_init(void)
#ifdef CONFIG_HAS_DATAFLASH
void at91_spi0_hw_init(unsigned long cs_mask)
{
- at91_set_B_periph(AT91_PIN_PA0, 0); /* SPI0_MISO */
- at91_set_B_periph(AT91_PIN_PA1, 0); /* SPI0_MOSI */
- at91_set_B_periph(AT91_PIN_PA2, 0); /* SPI0_SPCK */
+ at91_set_b_periph(AT91_PORTPIN(A, 0), 0); /* SPI0_MISO */
+ at91_set_b_periph(AT91_PORTPIN(A, 1), 0); /* SPI0_MOSI */
+ at91_set_b_periph(AT91_PORTPIN(A, 2), 0); /* SPI0_SPCK */
/* Enable clock */
at91_sys_write(AT91_PMC_PCER, 1 << AT91CAP9_ID_SPI0);
if (cs_mask & (1 << 0)) {
- at91_set_B_periph(AT91_PIN_PA5, 1);
+ at91_set_b_periph(AT91_PORTPIN(A, 5), 1);
}
if (cs_mask & (1 << 1)) {
- at91_set_B_periph(AT91_PIN_PA3, 1);
+ at91_set_b_periph(AT91_PORTPIN(A, 3), 1);
}
if (cs_mask & (1 << 2)) {
- at91_set_B_periph(AT91_PIN_PD0, 1);
+ at91_set_b_periph(AT91_PORTPIN(D, 0), 1);
}
if (cs_mask & (1 << 3)) {
- at91_set_B_periph(AT91_PIN_PD1, 1);
+ at91_set_b_periph(AT91_PORTPIN(D, 1), 1);
}
if (cs_mask & (1 << 4)) {
- at91_set_gpio_output(AT91_PIN_PA5, 1);
+ at91_set_gpio_output(AT91_PORTPIN(A, 5), 1);
}
if (cs_mask & (1 << 5)) {
- at91_set_gpio_output(AT91_PIN_PA3, 1);
+ at91_set_gpio_output(AT91_PORTPIN(A, 3), 1);
}
if (cs_mask & (1 << 6)) {
- at91_set_gpio_output(AT91_PIN_PD0, 1);
+ at91_set_gpio_output(AT91_PORTPIN(D, 0), 1);
}
if (cs_mask & (1 << 7)) {
- at91_set_gpio_output(AT91_PIN_PD1, 1);
+ at91_set_gpio_output(AT91_PORTPIN(D, 1), 1);
}
}
void at91_spi1_hw_init(unsigned long cs_mask)
{
- at91_set_A_periph(AT91_PIN_PB12, 0); /* SPI1_MISO */
- at91_set_A_periph(AT91_PIN_PB13, 0); /* SPI1_MOSI */
- at91_set_A_periph(AT91_PIN_PB14, 0); /* SPI1_SPCK */
+ at91_set_a_periph(AT91_PORTPIN(B, 12), 0); /* SPI1_MISO */
+ at91_set_a_periph(AT91_PORTPIN(B, 13), 0); /* SPI1_MOSI */
+ at91_set_a_periph(AT91_PORTPIN(B, 14), 0); /* SPI1_SPCK */
/* Enable clock */
at91_sys_write(AT91_PMC_PCER, 1 << AT91CAP9_ID_SPI1);
if (cs_mask & (1 << 0)) {
- at91_set_A_periph(AT91_PIN_PB15, 1);
+ at91_set_a_periph(AT91_PORTPIN(B, 15), 1);
}
if (cs_mask & (1 << 1)) {
- at91_set_A_periph(AT91_PIN_PB16, 1);
+ at91_set_a_periph(AT91_PORTPIN(B, 16), 1);
}
if (cs_mask & (1 << 2)) {
- at91_set_A_periph(AT91_PIN_PB17, 1);
+ at91_set_a_periph(AT91_PORTPIN(B, 17), 1);
}
if (cs_mask & (1 << 3)) {
- at91_set_A_periph(AT91_PIN_PB18, 1);
+ at91_set_a_periph(AT91_PORTPIN(B, 18), 1);
}
if (cs_mask & (1 << 4)) {
- at91_set_gpio_output(AT91_PIN_PB15, 1);
+ at91_set_gpio_output(AT91_PORTPIN(B, 15), 1);
}
if (cs_mask & (1 << 5)) {
- at91_set_gpio_output(AT91_PIN_PB16, 1);
+ at91_set_gpio_output(AT91_PORTPIN(B, 16), 1);
}
if (cs_mask & (1 << 6)) {
- at91_set_gpio_output(AT91_PIN_PB17, 1);
+ at91_set_gpio_output(AT91_PORTPIN(B, 17), 1);
}
if (cs_mask & (1 << 7)) {
- at91_set_gpio_output(AT91_PIN_PB18, 1);
+ at91_set_gpio_output(AT91_PORTPIN(B, 18), 1);
}
}
@@ -155,26 +155,26 @@ void at91_spi1_hw_init(unsigned long cs_mask)
#ifdef CONFIG_MACB
void at91_macb_hw_init(void)
{
- at91_set_A_periph(AT91_PIN_PB21, 0); /* ETXCK_EREFCK */
- at91_set_A_periph(AT91_PIN_PB22, 0); /* ERXDV */
- at91_set_A_periph(AT91_PIN_PB25, 0); /* ERX0 */
- at91_set_A_periph(AT91_PIN_PB26, 0); /* ERX1 */
- at91_set_A_periph(AT91_PIN_PB27, 0); /* ERXER */
- at91_set_A_periph(AT91_PIN_PB28, 0); /* ETXEN */
- at91_set_A_periph(AT91_PIN_PB23, 0); /* ETX0 */
- at91_set_A_periph(AT91_PIN_PB24, 0); /* ETX1 */
- at91_set_A_periph(AT91_PIN_PB30, 0); /* EMDIO */
- at91_set_A_periph(AT91_PIN_PB29, 0); /* EMDC */
+ at91_set_a_periph(AT91_PORTPIN(B, 21), 0); /* ETXCK_EREFCK */
+ at91_set_a_periph(AT91_PORTPIN(B, 22), 0); /* ERXDV */
+ at91_set_a_periph(AT91_PORTPIN(B, 25), 0); /* ERX0 */
+ at91_set_a_periph(AT91_PORTPIN(B, 26), 0); /* ERX1 */
+ at91_set_a_periph(AT91_PORTPIN(B, 27), 0); /* ERXER */
+ at91_set_a_periph(AT91_PORTPIN(B, 28), 0); /* ETXEN */
+ at91_set_a_periph(AT91_PORTPIN(B, 23), 0); /* ETX0 */
+ at91_set_a_periph(AT91_PORTPIN(B, 24), 0); /* ETX1 */
+ at91_set_a_periph(AT91_PORTPIN(B, 30), 0); /* EMDIO */
+ at91_set_a_periph(AT91_PORTPIN(B, 29), 0); /* EMDC */
#ifndef CONFIG_RMII
- at91_set_B_periph(AT91_PIN_PC25, 0); /* ECRS */
- at91_set_B_periph(AT91_PIN_PC26, 0); /* ECOL */
- at91_set_B_periph(AT91_PIN_PC22, 0); /* ERX2 */
- at91_set_B_periph(AT91_PIN_PC23, 0); /* ERX3 */
- at91_set_B_periph(AT91_PIN_PC27, 0); /* ERXCK */
- at91_set_B_periph(AT91_PIN_PC20, 0); /* ETX2 */
- at91_set_B_periph(AT91_PIN_PC21, 0); /* ETX3 */
- at91_set_B_periph(AT91_PIN_PC24, 0); /* ETXER */
+ at91_set_b_periph(AT91_PORTPIN(C, 25), 0); /* ECRS */
+ at91_set_b_periph(AT91_PORTPIN(C, 26), 0); /* ECOL */
+ at91_set_b_periph(AT91_PORTPIN(C, 22), 0); /* ERX2 */
+ at91_set_b_periph(AT91_PORTPIN(C, 23), 0); /* ERX3 */
+ at91_set_b_periph(AT91_PORTPIN(C, 27), 0); /* ERXCK */
+ at91_set_b_periph(AT91_PORTPIN(C, 20), 0); /* ETX2 */
+ at91_set_b_periph(AT91_PORTPIN(C, 21), 0); /* ETX3 */
+ at91_set_b_periph(AT91_PORTPIN(C, 24), 0); /* ETXER */
#endif
}
#endif
@@ -182,8 +182,8 @@ void at91_macb_hw_init(void)
#ifdef CONFIG_AT91_CAN
void at91_can_hw_init(void)
{
- at91_set_A_periph(AT91_PIN_PA12, 0); /* CAN_TX */
- at91_set_A_periph(AT91_PIN_PA13, 1); /* CAN_RX */
+ at91_set_a_periph(AT91_PORTPIN(A, 12), 0); /* CAN_TX */
+ at91_set_a_periph(AT91_PORTPIN(A, 13), 1); /* CAN_RX */
/* Enable clock */
at91_sys_write(AT91_PMC_PCER, 1 << AT91CAP9_ID_CAN);
diff --git a/cpu/arm926ejs/at91/at91sam9260_devices.c b/cpu/arm926ejs/at91/at91sam9260_devices.c
index f86cb99..d7d6f49 100644
--- a/cpu/arm926ejs/at91/at91sam9260_devices.c
+++ b/cpu/arm926ejs/at91/at91sam9260_devices.c
@@ -30,29 +30,29 @@
void at91_serial0_hw_init(void)
{
- at91_set_A_periph(AT91_PIN_PB4, 1); /* TXD0 */
- at91_set_A_periph(AT91_PIN_PB5, 0); /* RXD0 */
+ at91_set_A_periph(AT91_PORTPIN(B, 4), 1); /* TXD0 */
+ at91_set_A_periph(AT91_PORTPIN(B, 5), 0); /* RXD0 */
at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_US0);
}
void at91_serial1_hw_init(void)
{
- at91_set_A_periph(AT91_PIN_PB6, 1); /* TXD1 */
- at91_set_A_periph(AT91_PIN_PB7, 0); /* RXD1 */
+ at91_set_A_periph(AT91_PORTPIN(B, 6), 1); /* TXD1 */
+ at91_set_A_periph(AT91_PORTPIN(B, 7), 0); /* RXD1 */
at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_US1);
}
void at91_serial2_hw_init(void)
{
- at91_set_A_periph(AT91_PIN_PB8, 1); /* TXD2 */
- at91_set_A_periph(AT91_PIN_PB9, 0); /* RXD2 */
+ at91_set_A_periph(AT91_PORTPIN(B, 8), 1); /* TXD2 */
+ at91_set_A_periph(AT91_PORTPIN(B, 9), 0); /* RXD2 */
at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_US2);
}
void at91_serial3_hw_init(void)
{
- at91_set_A_periph(AT91_PIN_PB14, 0); /* DRXD */
- at91_set_A_periph(AT91_PIN_PB15, 1); /* DTXD */
+ at91_set_A_periph(AT91_PORTPIN(B, 14), 0); /* DRXD */
+ at91_set_A_periph(AT91_PORTPIN(B, 15), 1); /* DTXD */
at91_sys_write(AT91_PMC_PCER, 1 << AT91_ID_SYS);
}
@@ -78,71 +78,71 @@ void at91_serial_hw_init(void)
#if defined(CONFIG_HAS_DATAFLASH) || defined(CONFIG_ATMEL_SPI)
void at91_spi0_hw_init(unsigned long cs_mask)
{
- at91_set_A_periph(AT91_PIN_PA0, 0); /* SPI0_MISO */
- at91_set_A_periph(AT91_PIN_PA1, 0); /* SPI0_MOSI */
- at91_set_A_periph(AT91_PIN_PA2, 0); /* SPI0_SPCK */
+ at91_set_A_periph(AT91_PORTPIN(A, 0), 0); /* SPI0_MISO */
+ at91_set_A_periph(AT91_PORTPIN(A, 1), 0); /* SPI0_MOSI */
+ at91_set_A_periph(AT91_PORTPIN(A, 2), 0); /* SPI0_SPCK */
/* Enable clock */
at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_SPI0);
if (cs_mask & (1 << 0)) {
- at91_set_A_periph(AT91_PIN_PA3, 1);
+ at91_set_A_periph(AT91_PORTPIN(A, 3), 1);
}
if (cs_mask & (1 << 1)) {
- at91_set_B_periph(AT91_PIN_PC11, 1);
+ at91_set_B_periph(AT91_PORTPIN(C, 11), 1);
}
if (cs_mask & (1 << 2)) {
- at91_set_B_periph(AT91_PIN_PC16, 1);
+ at91_set_B_periph(AT91_PORTPIN(C, 16), 1);
}
if (cs_mask & (1 << 3)) {
- at91_set_B_periph(AT91_PIN_PC17, 1);
+ at91_set_B_periph(AT91_PORTPIN(C, 17), 1);
}
if (cs_mask & (1 << 4)) {
- at91_set_gpio_output(AT91_PIN_PA3, 1);
+ at91_set_gpio_output(AT91_PORTPIN(A, 3), 1);
}
if (cs_mask & (1 << 5)) {
- at91_set_gpio_output(AT91_PIN_PC11, 1);
+ at91_set_gpio_output(AT91_PORTPIN(C, 11), 1);
}
if (cs_mask & (1 << 6)) {
- at91_set_gpio_output(AT91_PIN_PC16, 1);
+ at91_set_gpio_output(AT91_PORTPIN(C, 16), 1);
}
if (cs_mask & (1 << 7)) {
- at91_set_gpio_output(AT91_PIN_PC17, 1);
+ at91_set_gpio_output(AT91_PORTPIN(C, 17), 1);
}
}
void at91_spi1_hw_init(unsigned long cs_mask)
{
- at91_set_A_periph(AT91_PIN_PB0, 0); /* SPI1_MISO */
- at91_set_A_periph(AT91_PIN_PB1, 0); /* SPI1_MOSI */
- at91_set_A_periph(AT91_PIN_PB2, 0); /* SPI1_SPCK */
+ at91_set_A_periph(AT91_PORTPIN(B, 0), 0); /* SPI1_MISO */
+ at91_set_A_periph(AT91_PORTPIN(B, 1), 0); /* SPI1_MOSI */
+ at91_set_A_periph(AT91_PORTPIN(B, 2), 0); /* SPI1_SPCK */
/* Enable clock */
at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_SPI1);
if (cs_mask & (1 << 0)) {
- at91_set_A_periph(AT91_PIN_PB3, 1);
+ at91_set_A_periph(AT91_PORTPIN(B, 3), 1);
}
if (cs_mask & (1 << 1)) {
- at91_set_B_periph(AT91_PIN_PC5, 1);
+ at91_set_B_periph(AT91_PORTPIN(C, 5), 1);
}
if (cs_mask & (1 << 2)) {
- at91_set_B_periph(AT91_PIN_PC4, 1);
+ at91_set_B_periph(AT91_PORTPIN(C, 4), 1);
}
if (cs_mask & (1 << 3)) {
- at91_set_gpio_output(AT91_PIN_PC3, 1);
+ at91_set_gpio_output(AT91_PORTPIN(C, 3), 1);
}
if (cs_mask & (1 << 4)) {
- at91_set_gpio_output(AT91_PIN_PB3, 1);
+ at91_set_gpio_output(AT91_PORTPIN(B, 3), 1);
}
if (cs_mask & (1 << 5)) {
- at91_set_gpio_output(AT91_PIN_PC5, 1);
+ at91_set_gpio_output(AT91_PORTPIN(C, 5), 1);
}
if (cs_mask & (1 << 6)) {
- at91_set_gpio_output(AT91_PIN_PC4, 1);
+ at91_set_gpio_output(AT91_PORTPIN(C, 4), 1);
}
if (cs_mask & (1 << 7)) {
- at91_set_gpio_output(AT91_PIN_PC3, 1);
+ at91_set_gpio_output(AT91_PORTPIN(C, 3), 1);
}
}
#endif
@@ -150,35 +150,35 @@ void at91_spi1_hw_init(unsigned long cs_mask)
#ifdef CONFIG_MACB
void at91_macb_hw_init(void)
{
- at91_set_A_periph(AT91_PIN_PA19, 0); /* ETXCK_EREFCK */
- at91_set_A_periph(AT91_PIN_PA17, 0); /* ERXDV */
- at91_set_A_periph(AT91_PIN_PA14, 0); /* ERX0 */
- at91_set_A_periph(AT91_PIN_PA15, 0); /* ERX1 */
- at91_set_A_periph(AT91_PIN_PA18, 0); /* ERXER */
- at91_set_A_periph(AT91_PIN_PA16, 0); /* ETXEN */
- at91_set_A_periph(AT91_PIN_PA12, 0); /* ETX0 */
- at91_set_A_periph(AT91_PIN_PA13, 0); /* ETX1 */
- at91_set_A_periph(AT91_PIN_PA21, 0); /* EMDIO */
- at91_set_A_periph(AT91_PIN_PA20, 0); /* EMDC */
+ at91_set_A_periph(AT91_PORTPIN(A, 19), 0); /* ETXCK_EREFCK */
+ at91_set_A_periph(AT91_PORTPIN(A, 17), 0); /* ERXDV */
+ at91_set_A_periph(AT91_PORTPIN(A, 14), 0); /* ERX0 */
+ at91_set_A_periph(AT91_PORTPIN(A, 15), 0); /* ERX1 */
+ at91_set_A_periph(AT91_PORTPIN(A, 18), 0); /* ERXER */
+ at91_set_A_periph(AT91_PORTPIN(A, 16), 0); /* ETXEN */
+ at91_set_A_periph(AT91_PORTPIN(A, 12), 0); /* ETX0 */
+ at91_set_A_periph(AT91_PORTPIN(A, 13), 0); /* ETX1 */
+ at91_set_A_periph(AT91_PORTPIN(A, 21), 0); /* EMDIO */
+ at91_set_A_periph(AT91_PORTPIN(A, 20), 0); /* EMDC */
#ifndef CONFIG_RMII
- at91_set_B_periph(AT91_PIN_PA28, 0); /* ECRS */
- at91_set_B_periph(AT91_PIN_PA29, 0); /* ECOL */
- at91_set_B_periph(AT91_PIN_PA25, 0); /* ERX2 */
- at91_set_B_periph(AT91_PIN_PA26, 0); /* ERX3 */
- at91_set_B_periph(AT91_PIN_PA27, 0); /* ERXCK */
+ at91_set_B_periph(AT91_PORTPIN(A, 28), 0); /* ECRS */
+ at91_set_B_periph(AT91_PORTPIN(A, 29), 0); /* ECOL */
+ at91_set_B_periph(AT91_PORTPIN(A, 25), 0); /* ERX2 */
+ at91_set_B_periph(AT91_PORTPIN(A, 26), 0); /* ERX3 */
+ at91_set_B_periph(AT91_PORTPIN(A, 27), 0); /* ERXCK */
#if defined(CONFIG_AT91SAM9260EK) || defined(CONFIG_AFEB9260)
/*
* use PA10, PA11 for ETX2, ETX3.
* PA23 and PA24 are for TWI EEPROM
*/
- at91_set_B_periph(AT91_PIN_PA10, 0); /* ETX2 */
- at91_set_B_periph(AT91_PIN_PA11, 0); /* ETX3 */
+ at91_set_B_periph(AT91_PORTPIN(A, 10), 0); /* ETX2 */
+ at91_set_B_periph(AT91_PORTPIN(A, 11), 0); /* ETX3 */
#else
- at91_set_B_periph(AT91_PIN_PA23, 0); /* ETX2 */
- at91_set_B_periph(AT91_PIN_PA24, 0); /* ETX3 */
+ at91_set_B_periph(AT91_PORTPIN(A, 23), 0); /* ETX2 */
+ at91_set_B_periph(AT91_PORTPIN(A, 24), 0); /* ETX3 */
#endif
- at91_set_B_periph(AT91_PIN_PA22, 0); /* ETXER */
+ at91_set_B_periph(AT91_PORTPIN(A, 22), 0); /* ETXER */
#endif
}
#endif
diff --git a/cpu/arm926ejs/at91/at91sam9261_devices.c b/cpu/arm926ejs/at91/at91sam9261_devices.c
index 16d411f..9112ccb 100644
--- a/cpu/arm926ejs/at91/at91sam9261_devices.c
+++ b/cpu/arm926ejs/at91/at91sam9261_devices.c
@@ -30,29 +30,29 @@
void at91_serial0_hw_init(void)
{
- at91_set_A_periph(AT91_PIN_PC8, 1); /* TXD0 */
- at91_set_A_periph(AT91_PIN_PC9, 0); /* RXD0 */
+ at91_set_a_periph(AT91_PORTPIN(C, 8), 1); /* TXD0 */
+ at91_set_a_periph(AT91_PORTPIN(C, 9), 0); /* RXD0 */
at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9261_ID_US0);
}
void at91_serial1_hw_init(void)
{
- at91_set_A_periph(AT91_PIN_PC12, 1); /* TXD1 */
- at91_set_A_periph(AT91_PIN_PC13, 0); /* RXD1 */
+ at91_set_a_periph(AT91_PORTPIN(C, 12), 1); /* TXD1 */
+ at91_set_a_periph(AT91_PORTPIN(C, 13), 0); /* RXD1 */
at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9261_ID_US1);
}
void at91_serial2_hw_init(void)
{
- at91_set_A_periph(AT91_PIN_PC14, 1); /* TXD2 */
- at91_set_A_periph(AT91_PIN_PC15, 0); /* RXD2 */
+ at91_set_a_periph(AT91_PORTPIN(C, 14), 1); /* TXD2 */
+ at91_set_a_periph(AT91_PORTPIN(C, 15), 0); /* RXD2 */
at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9261_ID_US2);
}
void at91_serial3_hw_init(void)
{
- at91_set_A_periph(AT91_PIN_PA9, 0); /* DRXD */
- at91_set_A_periph(AT91_PIN_PA10, 1); /* DTXD */
+ at91_set_a_periph(AT91_PORTPIN(A, 9), 0); /* DRXD */
+ at91_set_a_periph(AT91_PORTPIN(A, 10), 1); /* DTXD */
at91_sys_write(AT91_PMC_PCER, 1 << AT91_ID_SYS);
}
@@ -78,71 +78,71 @@ void at91_serial_hw_init(void)
#ifdef CONFIG_HAS_DATAFLASH
void at91_spi0_hw_init(unsigned long cs_mask)
{
- at91_set_A_periph(AT91_PIN_PA0, 0); /* SPI0_MISO */
- at91_set_A_periph(AT91_PIN_PA1, 0); /* SPI0_MOSI */
- at91_set_A_periph(AT91_PIN_PA2, 0); /* SPI0_SPCK */
+ at91_set_a_periph(AT91_PORTPIN(A, 0), 0); /* SPI0_MISO */
+ at91_set_a_periph(AT91_PORTPIN(A, 1), 0); /* SPI0_MOSI */
+ at91_set_a_periph(AT91_PORTPIN(A, 2), 0); /* SPI0_SPCK */
/* Enable clock */
at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9261_ID_SPI0);
if (cs_mask & (1 << 0)) {
- at91_set_A_periph(AT91_PIN_PA3, 1);
+ at91_set_a_periph(AT91_PORTPIN(A, 3), 1);
}
if (cs_mask & (1 << 1)) {
- at91_set_A_periph(AT91_PIN_PA4, 1);
+ at91_set_a_periph(AT91_PORTPIN(A, 4), 1);
}
if (cs_mask & (1 << 2)) {
- at91_set_A_periph(AT91_PIN_PA5, 1);
+ at91_set_a_periph(AT91_PORTPIN(A, 5), 1);
}
if (cs_mask & (1 << 3)) {
- at91_set_A_periph(AT91_PIN_PA6, 1);
+ at91_set_a_periph(AT91_PORTPIN(A, 6), 1);
}
if (cs_mask & (1 << 4)) {
- at91_set_gpio_output(AT91_PIN_PA3, 1);
+ at91_set_gpio_output(AT91_PORTPIN(A, 3), 1);
}
if (cs_mask & (1 << 5)) {
- at91_set_gpio_output(AT91_PIN_PA4, 1);
+ at91_set_gpio_output(AT91_PORTPIN(A, 4), 1);
}
if (cs_mask & (1 << 6)) {
- at91_set_gpio_output(AT91_PIN_PA5, 1);
+ at91_set_gpio_output(AT91_PORTPIN(A, 5), 1);
}
if (cs_mask & (1 << 7)) {
- at91_set_gpio_output(AT91_PIN_PA6, 1);
+ at91_set_gpio_output(AT91_PORTPIN(A, 6), 1);
}
}
void at91_spi1_hw_init(unsigned long cs_mask)
{
- at91_set_A_periph(AT91_PIN_PB30, 0); /* SPI1_MISO */
- at91_set_A_periph(AT91_PIN_PB31, 0); /* SPI1_MOSI */
- at91_set_A_periph(AT91_PIN_PB29, 0); /* SPI1_SPCK */
+ at91_set_a_periph(AT91_PORTPIN(B, 30), 0); /* SPI1_MISO */
+ at91_set_a_periph(AT91_PORTPIN(B, 31), 0); /* SPI1_MOSI */
+ at91_set_a_periph(AT91_PORTPIN(B, 29), 0); /* SPI1_SPCK */
/* Enable clock */
at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9261_ID_SPI1);
if (cs_mask & (1 << 0)) {
- at91_set_A_periph(AT91_PIN_PB28, 1);
+ at91_set_a_periph(AT91_PORTPIN(B, 28), 1);
}
if (cs_mask & (1 << 1)) {
- at91_set_B_periph(AT91_PIN_PA24, 1);
+ at91_set_b_periph(AT91_PORTPIN(A, 24), 1);
}
if (cs_mask & (1 << 2)) {
- at91_set_B_periph(AT91_PIN_PA25, 1);
+ at91_set_b_periph(AT91_PORTPIN(A, 25), 1);
}
if (cs_mask & (1 << 3)) {
- at91_set_A_periph(AT91_PIN_PA26, 1);
+ at91_set_a_periph(AT91_PORTPIN(A, 26), 1);
}
if (cs_mask & (1 << 4)) {
- at91_set_gpio_output(AT91_PIN_PB28, 1);
+ at91_set_gpio_output(AT91_PORTPIN(B, 28), 1);
}
if (cs_mask & (1 << 5)) {
- at91_set_gpio_output(AT91_PIN_PA24, 1);
+ at91_set_gpio_output(AT91_PORTPIN(A, 24), 1);
}
if (cs_mask & (1 << 6)) {
- at91_set_gpio_output(AT91_PIN_PA25, 1);
+ at91_set_gpio_output(AT91_PORTPIN(A, 25), 1);
}
if (cs_mask & (1 << 7)) {
- at91_set_gpio_output(AT91_PIN_PA26, 1);
+ at91_set_gpio_output(AT91_PORTPIN(A, 26), 1);
}
}
#endif
diff --git a/cpu/arm926ejs/at91/at91sam9263_devices.c b/cpu/arm926ejs/at91/at91sam9263_devices.c
index f72efdf..eb56ebf 100644
--- a/cpu/arm926ejs/at91/at91sam9263_devices.c
+++ b/cpu/arm926ejs/at91/at91sam9263_devices.c
@@ -34,29 +34,29 @@
void at91_serial0_hw_init(void)
{
- at91_set_A_periph(AT91_PIN_PA26, 1); /* TXD0 */
- at91_set_A_periph(AT91_PIN_PA27, 0); /* RXD0 */
+ at91_set_a_periph(AT91_PORTPIN(A, 26), 1); /* TXD0 */
+ at91_set_a_periph(AT91_PORTPIN(A, 27), 0); /* RXD0 */
at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_US0);
}
void at91_serial1_hw_init(void)
{
- at91_set_A_periph(AT91_PIN_PD0, 1); /* TXD1 */
- at91_set_A_periph(AT91_PIN_PD1, 0); /* RXD1 */
+ at91_set_a_periph(AT91_PORTPIN(D, 0), 1); /* TXD1 */
+ at91_set_a_periph(AT91_PORTPIN(D, 1), 0); /* RXD1 */
at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_US1);
}
void at91_serial2_hw_init(void)
{
- at91_set_A_periph(AT91_PIN_PD2, 1); /* TXD2 */
- at91_set_A_periph(AT91_PIN_PD3, 0); /* RXD2 */
+ at91_set_a_periph(AT91_PORTPIN(D, 2), 1); /* TXD2 */
+ at91_set_a_periph(AT91_PORTPIN(D, 3), 0); /* RXD2 */
at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_US2);
}
void at91_serial3_hw_init(void)
{
- at91_set_A_periph(AT91_PIN_PC30, 0); /* DRXD */
- at91_set_A_periph(AT91_PIN_PC31, 1); /* DTXD */
+ at91_set_a_periph(AT91_PORTPIN(C, 30), 0); /* DRXD */
+ at91_set_a_periph(AT91_PORTPIN(C, 31), 1); /* DTXD */
at91_sys_write(AT91_PMC_PCER, 1 << AT91_ID_SYS);
}
@@ -82,71 +82,71 @@ void at91_serial_hw_init(void)
#ifdef CONFIG_HAS_DATAFLASH
void at91_spi0_hw_init(unsigned long cs_mask)
{
- at91_set_B_periph(AT91_PIN_PA0, 0); /* SPI0_MISO */
- at91_set_B_periph(AT91_PIN_PA1, 0); /* SPI0_MOSI */
- at91_set_B_periph(AT91_PIN_PA2, 0); /* SPI0_SPCK */
+ at91_set_b_periph(AT91_PORTPIN(A, 0), 0); /* SPI0_MISO */
+ at91_set_b_periph(AT91_PORTPIN(A, 1), 0); /* SPI0_MOSI */
+ at91_set_b_periph(AT91_PORTPIN(A, 2), 0); /* SPI0_SPCK */
/* Enable clock */
at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_SPI0);
if (cs_mask & (1 << 0)) {
- at91_set_B_periph(AT91_PIN_PA5, 1);
+ at91_set_b_periph(AT91_PORTPIN(A, 5), 1);
}
if (cs_mask & (1 << 1)) {
- at91_set_B_periph(AT91_PIN_PA3, 1);
+ at91_set_b_periph(AT91_PORTPIN(A, 3), 1);
}
if (cs_mask & (1 << 2)) {
- at91_set_B_periph(AT91_PIN_PA4, 1);
+ at91_set_b_periph(AT91_PORTPIN(A, 4), 1);
}
if (cs_mask & (1 << 3)) {
- at91_set_B_periph(AT91_PIN_PB11, 1);
+ at91_set_b_periph(AT91_PORTPIN(B, 11), 1);
}
if (cs_mask & (1 << 4)) {
- at91_set_gpio_output(AT91_PIN_PA5, 1);
+ at91_set_gpio_output(AT91_PORTPIN(A, 5), 1);
}
if (cs_mask & (1 << 5)) {
- at91_set_gpio_output(AT91_PIN_PA3, 1);
+ at91_set_gpio_output(AT91_PORTPIN(A, 3), 1);
}
if (cs_mask & (1 << 6)) {
- at91_set_gpio_output(AT91_PIN_PA4, 1);
+ at91_set_gpio_output(AT91_PORTPIN(A, 4), 1);
}
if (cs_mask & (1 << 7)) {
- at91_set_gpio_output(AT91_PIN_PB11, 1);
+ at91_set_gpio_output(AT91_PORTPIN(B, 11), 1);
}
}
void at91_spi1_hw_init(unsigned long cs_mask)
{
- at91_set_A_periph(AT91_PIN_PB12, 0); /* SPI1_MISO */
- at91_set_A_periph(AT91_PIN_PB13, 0); /* SPI1_MOSI */
- at91_set_A_periph(AT91_PIN_PB14, 0); /* SPI1_SPCK */
+ at91_set_a_periph(AT91_PORTPIN(B, 12), 0); /* SPI1_MISO */
+ at91_set_a_periph(AT91_PORTPIN(B, 13), 0); /* SPI1_MOSI */
+ at91_set_a_periph(AT91_PORTPIN(B, 14), 0); /* SPI1_SPCK */
/* Enable clock */
at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_SPI1);
if (cs_mask & (1 << 0)) {
- at91_set_A_periph(AT91_PIN_PB15, 1);
+ at91_set_a_periph(AT91_PORTPIN(B, 15), 1);
}
if (cs_mask & (1 << 1)) {
- at91_set_A_periph(AT91_PIN_PB16, 1);
+ at91_set_a_periph(AT91_PORTPIN(B, 16), 1);
}
if (cs_mask & (1 << 2)) {
- at91_set_A_periph(AT91_PIN_PB17, 1);
+ at91_set_a_periph(AT91_PORTPIN(B, 17), 1);
}
if (cs_mask & (1 << 3)) {
- at91_set_A_periph(AT91_PIN_PB18, 1);
+ at91_set_a_periph(AT91_PORTPIN(B, 18), 1);
}
if (cs_mask & (1 << 4)) {
- at91_set_gpio_output(AT91_PIN_PB15, 1);
+ at91_set_gpio_output(AT91_PORTPIN(B, 15), 1);
}
if (cs_mask & (1 << 5)) {
- at91_set_gpio_output(AT91_PIN_PB16, 1);
+ at91_set_gpio_output(AT91_PORTPIN(B, 16), 1);
}
if (cs_mask & (1 << 6)) {
- at91_set_gpio_output(AT91_PIN_PB17, 1);
+ at91_set_gpio_output(AT91_PORTPIN(B, 17), 1);
}
if (cs_mask & (1 << 7)) {
- at91_set_gpio_output(AT91_PIN_PB18, 1);
+ at91_set_gpio_output(AT91_PORTPIN(B, 18), 1);
}
}
#endif
@@ -154,26 +154,26 @@ void at91_spi1_hw_init(unsigned long cs_mask)
#ifdef CONFIG_MACB
void at91_macb_hw_init(void)
{
- at91_set_A_periph(AT91_PIN_PE21, 0); /* ETXCK_EREFCK */
- at91_set_B_periph(AT91_PIN_PC25, 0); /* ERXDV */
- at91_set_A_periph(AT91_PIN_PE25, 0); /* ERX0 */
- at91_set_A_periph(AT91_PIN_PE26, 0); /* ERX1 */
- at91_set_A_periph(AT91_PIN_PE27, 0); /* ERXER */
- at91_set_A_periph(AT91_PIN_PE28, 0); /* ETXEN */
- at91_set_A_periph(AT91_PIN_PE23, 0); /* ETX0 */
- at91_set_A_periph(AT91_PIN_PE24, 0); /* ETX1 */
- at91_set_A_periph(AT91_PIN_PE30, 0); /* EMDIO */
- at91_set_A_periph(AT91_PIN_PE29, 0); /* EMDC */
+ at91_set_a_periph(AT91_PORTPIN(E, 21), 0); /* ETXCK_EREFCK */
+ at91_set_b_periph(AT91_PORTPIN(C, 25), 0); /* ERXDV */
+ at91_set_a_periph(AT91_PORTPIN(E, 25), 0); /* ERX0 */
+ at91_set_a_periph(AT91_PORTPIN(E, 26), 0); /* ERX1 */
+ at91_set_a_periph(AT91_PORTPIN(E, 27), 0); /* ERXER */
+ at91_set_a_periph(AT91_PORTPIN(E, 28), 0); /* ETXEN */
+ at91_set_a_periph(AT91_PORTPIN(E, 23), 0); /* ETX0 */
+ at91_set_a_periph(AT91_PORTPIN(E, 24), 0); /* ETX1 */
+ at91_set_a_periph(AT91_PORTPIN(E, 30), 0); /* EMDIO */
+ at91_set_a_periph(AT91_PORTPIN(E, 29), 0); /* EMDC */
#ifndef CONFIG_RMII
- at91_set_A_periph(AT91_PIN_PE22, 0); /* ECRS */
- at91_set_B_periph(AT91_PIN_PC26, 0); /* ECOL */
- at91_set_B_periph(AT91_PIN_PC22, 0); /* ERX2 */
- at91_set_B_periph(AT91_PIN_PC23, 0); /* ERX3 */
- at91_set_B_periph(AT91_PIN_PC27, 0); /* ERXCK */
- at91_set_B_periph(AT91_PIN_PC20, 0); /* ETX2 */
- at91_set_B_periph(AT91_PIN_PC21, 0); /* ETX3 */
- at91_set_B_periph(AT91_PIN_PC24, 0); /* ETXER */
+ at91_set_a_periph(AT91_PORTPIN(E, 22), 0); /* ECRS */
+ at91_set_b_periph(AT91_PORTPIN(C, 26), 0); /* ECOL */
+ at91_set_b_periph(AT91_PORTPIN(C, 22), 0); /* ERX2 */
+ at91_set_b_periph(AT91_PORTPIN(C, 23), 0); /* ERX3 */
+ at91_set_b_periph(AT91_PORTPIN(C, 27), 0); /* ERXCK */
+ at91_set_b_periph(AT91_PORTPIN(C, 20), 0); /* ETX2 */
+ at91_set_b_periph(AT91_PORTPIN(C, 21), 0); /* ETX3 */
+ at91_set_b_periph(AT91_PORTPIN(C, 24), 0); /* ETXER */
#endif
}
#endif
@@ -182,16 +182,16 @@ void at91_macb_hw_init(void)
void at91_uhp_hw_init(void)
{
/* Enable VBus on UHP ports */
- at91_set_gpio_output(AT91_PIN_PA21, 0);
- at91_set_gpio_output(AT91_PIN_PA24, 0);
+ at91_set_gpio_output(AT91_PORTPIN(A, 21), 0);
+ at91_set_gpio_output(AT91_PORTPIN(A, 24), 0);
}
#endif
#ifdef CONFIG_AT91_CAN
void at91_can_hw_init(void)
{
- at91_set_A_periph(AT91_PIN_PA13, 0); /* CAN_TX */
- at91_set_A_periph(AT91_PIN_PA14, 1); /* CAN_RX */
+ at91_set_a_periph(AT91_PORTPIN(A, 13), 0); /* CAN_TX */
+ at91_set_a_periph(AT91_PORTPIN(A, 14), 1); /* CAN_RX */
/* Enable clock */
at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_CAN);
diff --git a/cpu/arm926ejs/at91/at91sam9m10g45_devices.c b/cpu/arm926ejs/at91/at91sam9m10g45_devices.c
index 98d90f2..c3a2102 100644
--- a/cpu/arm926ejs/at91/at91sam9m10g45_devices.c
+++ b/cpu/arm926ejs/at91/at91sam9m10g45_devices.c
@@ -30,29 +30,29 @@
void at91_serial0_hw_init(void)
{
- at91_set_A_periph(AT91_PIN_PB19, 1); /* TXD0 */
- at91_set_A_periph(AT91_PIN_PB18, 0); /* RXD0 */
+ at91_set_a_periph(AT91_PORTPIN(B, 19), 1); /* TXD0 */
+ at91_set_a_periph(AT91_PORTPIN(B, 18), 0); /* RXD0 */
at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9G45_ID_US0);
}
void at91_serial1_hw_init(void)
{
- at91_set_A_periph(AT91_PIN_PB4, 1); /* TXD1 */
- at91_set_A_periph(AT91_PIN_PB5, 0); /* RXD1 */
+ at91_set_a_periph(AT91_PORTPIN(B, 4), 1); /* TXD1 */
+ at91_set_a_periph(AT91_PORTPIN(B, 5), 0); /* RXD1 */
at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9G45_ID_US1);
}
void at91_serial2_hw_init(void)
{
- at91_set_A_periph(AT91_PIN_PD6, 1); /* TXD2 */
- at91_set_A_periph(AT91_PIN_PD7, 0); /* RXD2 */
+ at91_set_a_periph(AT91_PORTPIN(D, 6), 1); /* TXD2 */
+ at91_set_a_periph(AT91_PORTPIN(D, 7), 0); /* RXD2 */
at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9G45_ID_US2);
}
void at91_serial3_hw_init(void)
{
- at91_set_A_periph(AT91_PIN_PB12, 0); /* DRXD */
- at91_set_A_periph(AT91_PIN_PB13, 1); /* DTXD */
+ at91_set_a_periph(AT91_PORTPIN(B, 12), 0); /* DRXD */
+ at91_set_a_periph(AT91_PORTPIN(B, 13), 1); /* DTXD */
at91_sys_write(AT91_PMC_PCER, 1 << AT91_ID_SYS);;
}
@@ -78,71 +78,71 @@ void at91_serial_hw_init(void)
#ifdef CONFIG_ATMEL_SPI
void at91_spi0_hw_init(unsigned long cs_mask)
{
- at91_set_A_periph(AT91_PIN_PB0, 0); /* SPI0_MISO */
- at91_set_A_periph(AT91_PIN_PB1, 0); /* SPI0_MOSI */
- at91_set_A_periph(AT91_PIN_PB2, 0); /* SPI0_SPCK */
+ at91_set_a_periph(AT91_PORTPIN(B, 0), 0); /* SPI0_MISO */
+ at91_set_a_periph(AT91_PORTPIN(B, 1), 0); /* SPI0_MOSI */
+ at91_set_a_periph(AT91_PORTPIN(B, 2), 0); /* SPI0_SPCK */
/* Enable clock */
at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9G45_ID_SPI0);
if (cs_mask & (1 << 0)) {
- at91_set_A_periph(AT91_PIN_PB3, 0);
+ at91_set_a_periph(AT91_PORTPIN(B, 3), 0);
}
if (cs_mask & (1 << 1)) {
- at91_set_B_periph(AT91_PIN_PB18, 0);
+ at91_set_b_periph(AT91_PORTPIN(B, 18), 0);
}
if (cs_mask & (1 << 2)) {
- at91_set_B_periph(AT91_PIN_PB19, 0);
+ at91_set_b_periph(AT91_PORTPIN(B, 19), 0);
}
if (cs_mask & (1 << 3)) {
- at91_set_B_periph(AT91_PIN_PD27, 0);
+ at91_set_b_periph(AT91_PORTPIN(D, 27), 0);
}
if (cs_mask & (1 << 4)) {
- at91_set_gpio_output(AT91_PIN_PB3, 0);
+ at91_set_gpio_output(AT91_PORTPIN(B, 3), 0);
}
if (cs_mask & (1 << 5)) {
- at91_set_gpio_output(AT91_PIN_PB18, 0);
+ at91_set_gpio_output(AT91_PORTPIN(B, 18), 0);
}
if (cs_mask & (1 << 6)) {
- at91_set_gpio_output(AT91_PIN_PB19, 0);
+ at91_set_gpio_output(AT91_PORTPIN(B, 19), 0);
}
if (cs_mask & (1 << 7)) {
- at91_set_gpio_output(AT91_PIN_PD27, 0);
+ at91_set_gpio_output(AT91_PORTPIN(D, 27), 0);
}
}
void at91_spi1_hw_init(unsigned long cs_mask)
{
- at91_set_A_periph(AT91_PIN_PB14, 0); /* SPI1_MISO */
- at91_set_A_periph(AT91_PIN_PB15, 0); /* SPI1_MOSI */
- at91_set_A_periph(AT91_PIN_PB16, 0); /* SPI1_SPCK */
+ at91_set_a_periph(AT91_PORTPIN(B, 14), 0); /* SPI1_MISO */
+ at91_set_a_periph(AT91_PORTPIN(B, 15), 0); /* SPI1_MOSI */
+ at91_set_a_periph(AT91_PORTPIN(B, 16), 0); /* SPI1_SPCK */
/* Enable clock */
at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9G45_ID_SPI1);
if (cs_mask & (1 << 0)) {
- at91_set_A_periph(AT91_PIN_PB17, 0);
+ at91_set_a_periph(AT91_PORTPIN(B, 17), 0);
}
if (cs_mask & (1 << 1)) {
- at91_set_B_periph(AT91_PIN_PD28, 0);
+ at91_set_b_periph(AT91_PORTPIN(D, 28), 0);
}
if (cs_mask & (1 << 2)) {
- at91_set_A_periph(AT91_PIN_PD18, 0);
+ at91_set_a_periph(AT91_PORTPIN(D, 18), 0);
}
if (cs_mask & (1 << 3)) {
- at91_set_A_periph(AT91_PIN_PD19, 0);
+ at91_set_a_periph(AT91_PORTPIN(D, 19), 0);
}
if (cs_mask & (1 << 4)) {
- at91_set_gpio_output(AT91_PIN_PB17, 0);
+ at91_set_gpio_output(AT91_PORTPIN(B, 17), 0);
}
if (cs_mask & (1 << 5)) {
- at91_set_gpio_output(AT91_PIN_PD28, 0);
+ at91_set_gpio_output(AT91_PORTPIN(D, 28), 0);
}
if (cs_mask & (1 << 6)) {
- at91_set_gpio_output(AT91_PIN_PD18, 0);
+ at91_set_gpio_output(AT91_PORTPIN(D, 18), 0);
}
if (cs_mask & (1 << 7)) {
- at91_set_gpio_output(AT91_PIN_PD19, 0);
+ at91_set_gpio_output(AT91_PORTPIN(D, 19), 0);
}
}
@@ -151,25 +151,25 @@ void at91_spi1_hw_init(unsigned long cs_mask)
#ifdef CONFIG_MACB
void at91_macb_hw_init(void)
{
- at91_set_A_periph(AT91_PIN_PA17, 0); /* ETXCK_EREFCK */
- at91_set_A_periph(AT91_PIN_PA15, 0); /* ERXDV */
- at91_set_A_periph(AT91_PIN_PA12, 0); /* ERX0 */
- at91_set_A_periph(AT91_PIN_PA13, 0); /* ERX1 */
- at91_set_A_periph(AT91_PIN_PA16, 0); /* ERXER */
- at91_set_A_periph(AT91_PIN_PA14, 0); /* ETXEN */
- at91_set_A_periph(AT91_PIN_PA10, 0); /* ETX0 */
- at91_set_A_periph(AT91_PIN_PA11, 0); /* ETX1 */
- at91_set_A_periph(AT91_PIN_PA19, 0); /* EMDIO */
- at91_set_A_periph(AT91_PIN_PA18, 0); /* EMDC */
+ at91_set_a_periph(AT91_PORTPIN(A, 17), 0); /* ETXCK_EREFCK */
+ at91_set_a_periph(AT91_PORTPIN(A, 15), 0); /* ERXDV */
+ at91_set_a_periph(AT91_PORTPIN(A, 12), 0); /* ERX0 */
+ at91_set_a_periph(AT91_PORTPIN(A, 13), 0); /* ERX1 */
+ at91_set_a_periph(AT91_PORTPIN(A, 16), 0); /* ERXER */
+ at91_set_a_periph(AT91_PORTPIN(A, 14), 0); /* ETXEN */
+ at91_set_a_periph(AT91_PORTPIN(A, 10), 0); /* ETX0 */
+ at91_set_a_periph(AT91_PORTPIN(A, 11), 0); /* ETX1 */
+ at91_set_a_periph(AT91_PORTPIN(A, 19), 0); /* EMDIO */
+ at91_set_a_periph(AT91_PORTPIN(A, 18), 0); /* EMDC */
#ifndef CONFIG_RMII
- at91_set_B_periph(AT91_PIN_PA29, 0); /* ECRS */
- at91_set_B_periph(AT91_PIN_PA30, 0); /* ECOL */
- at91_set_B_periph(AT91_PIN_PA8, 0); /* ERX2 */
- at91_set_B_periph(AT91_PIN_PA9, 0); /* ERX3 */
- at91_set_B_periph(AT91_PIN_PA28, 0); /* ERXCK */
- at91_set_B_periph(AT91_PIN_PA6, 0); /* ETX2 */
- at91_set_B_periph(AT91_PIN_PA7, 0); /* ETX3 */
- at91_set_B_periph(AT91_PIN_PA27, 0); /* ETXER */
+ at91_set_b_periph(AT91_PORTPIN(A, 29), 0); /* ECRS */
+ at91_set_b_periph(AT91_PORTPIN(A, 30), 0); /* ECOL */
+ at91_set_b_periph(AT91_PORTPIN(A, 8), 0); /* ERX2 */
+ at91_set_b_periph(AT91_PORTPIN(A, 9), 0); /* ERX3 */
+ at91_set_b_periph(AT91_PORTPIN(A, 28), 0); /* ERXCK */
+ at91_set_b_periph(AT91_PORTPIN(A, 6), 0); /* ETX2 */
+ at91_set_b_periph(AT91_PORTPIN(A, 7), 0); /* ETX3 */
+ at91_set_b_periph(AT91_PORTPIN(A, 27), 0); /* ETXER */
#endif
}
#endif
diff --git a/cpu/arm926ejs/at91/at91sam9rl_devices.c b/cpu/arm926ejs/at91/at91sam9rl_devices.c
index ebed193..9c5624a 100644
--- a/cpu/arm926ejs/at91/at91sam9rl_devices.c
+++ b/cpu/arm926ejs/at91/at91sam9rl_devices.c
@@ -30,29 +30,29 @@
void at91_serial0_hw_init(void)
{
- at91_set_A_periph(AT91_PIN_PA6, 1); /* TXD0 */
- at91_set_A_periph(AT91_PIN_PA7, 0); /* RXD0 */
+ at91_set_a_periph(AT91_PORTPIN(A, 6), 1); /* TXD0 */
+ at91_set_a_periph(AT91_PORTPIN(A, 7), 0); /* RXD0 */
at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9RL_ID_US0);
}
void at91_serial1_hw_init(void)
{
- at91_set_A_periph(AT91_PIN_PA11, 1); /* TXD1 */
- at91_set_A_periph(AT91_PIN_PA12, 0); /* RXD1 */
+ at91_set_a_periph(AT91_PORTPIN(A, 11), 1); /* TXD1 */
+ at91_set_a_periph(AT91_PORTPIN(A, 12), 0); /* RXD1 */
at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9RL_ID_US1);
}
void at91_serial2_hw_init(void)
{
- at91_set_A_periph(AT91_PIN_PA13, 1); /* TXD2 */
- at91_set_A_periph(AT91_PIN_PA14, 0); /* RXD2 */
+ at91_set_a_periph(AT91_PORTPIN(A, 13), 1); /* TXD2 */
+ at91_set_a_periph(AT91_PORTPIN(A, 14), 0); /* RXD2 */
at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9RL_ID_US2);
}
void at91_serial3_hw_init(void)
{
- at91_set_A_periph(AT91_PIN_PA21, 0); /* DRXD */
- at91_set_A_periph(AT91_PIN_PA22, 1); /* DTXD */
+ at91_set_a_periph(AT91_PORTPIN(A, 21), 0); /* DRXD */
+ at91_set_a_periph(AT91_PORTPIN(A, 22), 1); /* DTXD */
at91_sys_write(AT91_PMC_PCER, 1 << AT91_ID_SYS);
}
@@ -78,36 +78,36 @@ void at91_serial_hw_init(void)
#ifdef CONFIG_HAS_DATAFLASH
void at91_spi0_hw_init(unsigned long cs_mask)
{
- at91_set_A_periph(AT91_PIN_PA25, 0); /* SPI0_MISO */
- at91_set_A_periph(AT91_PIN_PA26, 0); /* SPI0_MOSI */
- at91_set_A_periph(AT91_PIN_PA27, 0); /* SPI0_SPCK */
+ at91_set_a_periph(AT91_PORTPIN(A, 25), 0); /* SPI0_MISO */
+ at91_set_a_periph(AT91_PORTPIN(A, 26), 0); /* SPI0_MOSI */
+ at91_set_a_periph(AT91_PORTPIN(A, 27), 0); /* SPI0_SPCK */
/* Enable clock */
at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9RL_ID_SPI);
if (cs_mask & (1 << 0)) {
- at91_set_A_periph(AT91_PIN_PA28, 1);
+ at91_set_a_periph(AT91_PORTPIN(A, 28), 1);
}
if (cs_mask & (1 << 1)) {
- at91_set_B_periph(AT91_PIN_PB7, 1);
+ at91_set_b_periph(AT91_PORTPIN(B, 7), 1);
}
if (cs_mask & (1 << 2)) {
- at91_set_A_periph(AT91_PIN_PD8, 1);
+ at91_set_a_periph(AT91_PORTPIN(D, 8), 1);
}
if (cs_mask & (1 << 3)) {
- at91_set_B_periph(AT91_PIN_PD9, 1);
+ at91_set_b_periph(AT91_PORTPIN(D, 9), 1);
}
if (cs_mask & (1 << 4)) {
- at91_set_gpio_output(AT91_PIN_PA28, 1);
+ at91_set_gpio_output(AT91_PORTPIN(A, 28), 1);
}
if (cs_mask & (1 << 5)) {
- at91_set_gpio_output(AT91_PIN_PB7, 1);
+ at91_set_gpio_output(AT91_PORTPIN(B, 7), 1);
}
if (cs_mask & (1 << 6)) {
- at91_set_gpio_output(AT91_PIN_PD8, 1);
+ at91_set_gpio_output(AT91_PORTPIN(D, 8), 1);
}
if (cs_mask & (1 << 7)) {
- at91_set_gpio_output(AT91_PIN_PD9, 1);
+ at91_set_gpio_output(AT91_PORTPIN(D, 9), 1);
}
}
#endif
2
2
* add a real AT91 GPIO driver instead of header inline code
* change board config files to use new driver
Signed-off-by: Jens Scharsig <js_at_ng(a)scharsoft.de>
---
drivers/gpio/Makefile | 1 +
drivers/gpio/at91_gpio.c | 240 ++++++++++++++++++++++++++++++++++++
include/asm-arm/arch-at91/gpio.h | 151 +----------------------
include/configs/afeb9260.h | 1 +
include/configs/at91cap9adk.h | 1 +
include/configs/at91sam9260ek.h | 2 +
include/configs/at91sam9261ek.h | 2 +
include/configs/at91sam9263ek.h | 2 +
include/configs/at91sam9m10g45ek.h | 2 +
include/configs/at91sam9rlek.h | 2 +
include/configs/cpu9260.h | 2 +
include/configs/meesc.h | 2 +
include/configs/pm9261.h | 2 +
include/configs/pm9263.h | 2 +
include/configs/sbc35_a9g20.h | 2 +
include/configs/tny_a9260.h | 2 +
16 files changed, 268 insertions(+), 148 deletions(-)
create mode 100644 drivers/gpio/at91_gpio.c
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index acba56c..d966082 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -25,6 +25,7 @@ include $(TOPDIR)/config.mk
LIB := $(obj)libgpio.a
+COBJS-$(CONFIG_AT91_GPIO) += at91_gpio.o
COBJS-$(CONFIG_KIRKWOOD_GPIO) += kw_gpio.o
COBJS-$(CONFIG_MX31_GPIO) += mx31_gpio.o
COBJS-$(CONFIG_PCA953X) += pca953x.o
diff --git a/drivers/gpio/at91_gpio.c b/drivers/gpio/at91_gpio.c
new file mode 100644
index 0000000..5e50ead
--- /dev/null
+++ b/drivers/gpio/at91_gpio.c
@@ -0,0 +1,240 @@
+/*
+ * Memory Setup stuff - taken from blob memsetup.S
+ *
+ * Copyright (C) 2009 Jens Scharsig (js_at_ng(a)scharsoft.de)
+ *
+ * Copyright (C) 2005 HP Labs
+ *
+ * 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 <config.h>
+#include <common.h>
+#include <asm/sizes.h>
+#include <asm/arch/hardware.h>
+#include <asm/arch/io.h>
+#include <asm/arch/at91_pio.h>
+
+#define PIN_BASE 32
+
+u32 portpin_to_port(u32 portpin)
+{
+ return (portpin - PIN_BASE) / 32;
+}
+
+u32 portpin_to_pin(u32 portpin)
+{
+ return 1 << ((portpin - PIN_BASE) % 32);
+}
+
+/*
+ * mux the pin to the "GPIO" peripheral role.
+ */
+int at91_set_gpio_periph(unsigned pin, int use_pullup)
+{
+ at91_pio_t *pio = (at91_pio_t *) AT91_PIO_BASE;
+ u32 port = portpin_to_port(pin);
+ u32 mask = portpin_to_pin(pin);
+
+ writel(mask, &pio->port[port].idr);
+ if (use_pullup)
+ writel(mask, &pio->port[port].puer);
+ else
+ writel(mask, &pio->port[port].pudr);
+ writel(mask, &pio->port[port].per);
+
+ return 0;
+}
+
+/*
+ * mux the pin to the "A" internal peripheral role.
+ */
+int at91_set_a_periph(unsigned pin, int use_pullup)
+{
+ at91_pio_t *pio = (at91_pio_t *) AT91_PIO_BASE;
+ u32 port = portpin_to_port(pin);
+ u32 mask = portpin_to_pin(pin);
+
+ writel(mask, &pio->port[port].idr);
+ if (use_pullup)
+ writel(mask, &pio->port[port].puer);
+ else
+ writel(mask, &pio->port[port].pudr);
+ writel(mask, &pio->port[port].asr);
+ writel(mask, &pio->port[port].pdr);
+
+ return 0;
+}
+
+/*
+ * mux the pin to the "B" internal peripheral role.
+ */
+int at91_set_b_periph(unsigned pin, int use_pullup)
+{
+ at91_pio_t *pio = (at91_pio_t *) AT91_PIO_BASE;
+ u32 port = portpin_to_port(pin);
+ u32 mask = portpin_to_pin(pin);
+
+ writel(mask, &pio->port[port].idr);
+ if (use_pullup)
+ writel(mask, &pio->port[port].puer);
+ else
+ writel(mask, &pio->port[port].pudr);
+ writel(mask, &pio->port[port].bsr);
+ writel(mask, &pio->port[port].pdr);
+
+ return 0;
+}
+
+/*
+ * mux the pin to the gpio controller (instead of "A" or "B" peripheral), and
+ * configure it for an input.
+ */
+int at91_set_gpio_input(u32 pin, int use_pullup)
+{
+ at91_pio_t *pio = (at91_pio_t *) AT91_PIO_BASE;
+ u32 port = portpin_to_port(pin);
+ u32 mask = portpin_to_pin(pin);
+
+ writel(mask, &pio->port[port].idr);
+ if (use_pullup)
+ writel(mask, &pio->port[port].puer);
+ else
+ writel(mask, &pio->port[port].pudr);
+ writel(mask, &pio->port[port].odr);
+ writel(mask, &pio->port[port].per);
+ return 0;
+}
+
+/*
+ * mux the pin to the gpio controller (instead of "A" or "B" peripheral),
+ * and configure it for an output.
+ */
+int at91_set_gpio_output(u32 pin, int value)
+{
+ at91_pio_t *pio = (at91_pio_t *) AT91_PIO_BASE;
+ u32 port = portpin_to_port(pin);
+ u32 mask = portpin_to_pin(pin);
+
+ writel(mask, &pio->port[port].idr);
+ writel(mask, &pio->port[port].pudr);
+ if (value)
+ writel(mask, &pio->port[port].sodr);
+ else
+ writel(mask, &pio->port[port].codr);
+ writel(mask, &pio->port[port].oer);
+ writel(mask, &pio->port[port].per);
+
+ return 0;
+}
+
+/*
+ * enable/disable the glitch filter; mostly used with IRQ handling.
+ */
+int at91_set_deglitch(unsigned pin, int is_on)
+{
+ at91_pio_t *pio = (at91_pio_t *) AT91_PIO_BASE;
+ u32 port = portpin_to_port(pin);
+ u32 mask = portpin_to_pin(pin);
+
+ if (is_on)
+ writel(mask, &pio->port[port].ifer);
+ else
+ writel(mask, &pio->port[port].ifdr);
+ return 0;
+}
+
+/*
+ * enable/disable the multi-driver; This is only valid for output and
+ * allows the output pin to run as an open collector output.
+ */
+int at91_set_multi_drive(unsigned pin, int is_on)
+{
+ at91_pio_t *pio = (at91_pio_t *) AT91_PIO_BASE;
+ u32 port = portpin_to_port(pin);
+ u32 mask = portpin_to_pin(pin);
+
+ if (is_on)
+ writel(mask, &pio->port[port].mder);
+ else
+ writel(mask, &pio->port[port].mddr);
+ return 0;
+}
+
+/*
+int gpio_direction_input(unsigned pin)
+{
+ at91_pio_t *pio = (at91_pio_t *) AT91_PIO_BASE;
+ u32 port = portpin_to_port(pin);
+ u32 mask = portpin_to_pin(pin);
+
+ if (!(readl(&pio->port[port].psr) & mask))
+ return -EINVAL;
+ writel(mask, &pio->port[port].odr);
+ return 0;
+}
+
+int gpio_direction_output(unsigned pin, int value)
+{
+ at91_pio_t *pio = (at91_pio_t *) AT91_PIO_BASE;
+ u32 port = portpin_to_port(pin);
+ u32 mask = portpin_to_pin(pin);
+
+ if (!(readl(&pio->port[port].psr) & mask))
+ return -EINVAL;
+ if (value)
+ writel(mask, &pio->port[port].sodr);
+ else
+ writel(mask, &pio->port[port].codr);
+ writel(mask, &pio->port[port].oer);
+
+ return 0;
+}
+*/
+/*
+ * assuming the pin is muxed as a gpio output, set its value.
+ */
+int at91_set_gpio_value(unsigned pin, int value)
+{
+ at91_pio_t *pio = (at91_pio_t *) AT91_PIO_BASE;
+ u32 port = portpin_to_port(pin);
+ u32 mask = portpin_to_pin(pin);
+
+ /* printf("%d = Port %d Pin %d (%d)",pin, port, mask, value); */
+ if (value)
+ writel(mask, &pio->port[port].sodr);
+ else
+ writel(mask, &pio->port[port].codr);
+ return 0;
+}
+
+/*
+ * read the pin's value (works even if it's not muxed as a gpio).
+ */
+int at91_get_gpio_value(unsigned pin)
+{
+ at91_pio_t *pio = (at91_pio_t *) AT91_PIO_BASE;
+ u32 port = portpin_to_port(pin);
+ u32 mask = portpin_to_pin(pin);
+ u32 pdsr;
+
+ pdsr = readl(&pio->port[port]);
+ return (pdsr & mask) != 0;
+}
+
diff --git a/include/asm-arm/arch-at91/gpio.h b/include/asm-arm/arch-at91/gpio.h
index bc53171..b0c572f 100644
--- a/include/asm-arm/arch-at91/gpio.h
+++ b/include/asm-arm/arch-at91/gpio.h
@@ -216,155 +216,10 @@ static inline unsigned pin_to_mask(unsigned pin)
return 1 << (pin % 32);
}
-/*
- * mux the pin to the "GPIO" peripheral role.
- */
-static inline int at91_set_GPIO_periph(unsigned pin, int use_pullup)
-{
- void *pio = pin_to_controller(pin);
- unsigned mask = pin_to_mask(pin);
-
- __raw_writel(mask, pio + PIO_IDR);
- __raw_writel(mask, pio + (use_pullup ? PIO_PUER : PIO_PUDR));
- __raw_writel(mask, pio + PIO_PER);
- return 0;
-}
-
-/*
- * mux the pin to the "A" internal peripheral role.
- */
-static inline int at91_set_A_periph(unsigned pin, int use_pullup)
-{
- void *pio = pin_to_controller(pin);
- unsigned mask = pin_to_mask(pin);
-
- __raw_writel(mask, pio + PIO_IDR);
- __raw_writel(mask, pio + (use_pullup ? PIO_PUER : PIO_PUDR));
- __raw_writel(mask, pio + PIO_ASR);
- __raw_writel(mask, pio + PIO_PDR);
- return 0;
-}
-
-/*
- * mux the pin to the "B" internal peripheral role.
- */
-static inline int at91_set_B_periph(unsigned pin, int use_pullup)
-{
- void *pio = pin_to_controller(pin);
- unsigned mask = pin_to_mask(pin);
-
- __raw_writel(mask, pio + PIO_IDR);
- __raw_writel(mask, pio + (use_pullup ? PIO_PUER : PIO_PUDR));
- __raw_writel(mask, pio + PIO_BSR);
- __raw_writel(mask, pio + PIO_PDR);
- return 0;
-}
-
-/*
- * mux the pin to the gpio controller (instead of "A" or "B" peripheral), and
- * configure it for an input.
- */
-static inline int at91_set_gpio_input(unsigned pin, int use_pullup)
-{
- void *pio = pin_to_controller(pin);
- unsigned mask = pin_to_mask(pin);
-
- __raw_writel(mask, pio + PIO_IDR);
- __raw_writel(mask, pio + (use_pullup ? PIO_PUER : PIO_PUDR));
- __raw_writel(mask, pio + PIO_ODR);
- __raw_writel(mask, pio + PIO_PER);
- return 0;
-}
-
-/*
- * mux the pin to the gpio controller (instead of "A" or "B" peripheral),
- * and configure it for an output.
- */
-static inline int at91_set_gpio_output(unsigned pin, int value)
-{
- void *pio = pin_to_controller(pin);
- unsigned mask = pin_to_mask(pin);
-
- __raw_writel(mask, pio + PIO_IDR);
- __raw_writel(mask, pio + PIO_PUDR);
- __raw_writel(mask, pio + (value ? PIO_SODR : PIO_CODR));
- __raw_writel(mask, pio + PIO_OER);
- __raw_writel(mask, pio + PIO_PER);
- return 0;
-}
-
-/*
- * enable/disable the glitch filter; mostly used with IRQ handling.
- */
-static inline int at91_set_deglitch(unsigned pin, int is_on)
-{
- void *pio = pin_to_controller(pin);
- unsigned mask = pin_to_mask(pin);
-
- __raw_writel(mask, pio + (is_on ? PIO_IFER : PIO_IFDR));
- return 0;
-}
-
-/*
- * enable/disable the multi-driver; This is only valid for output and
- * allows the output pin to run as an open collector output.
- */
-static inline int at91_set_multi_drive(unsigned pin, int is_on)
-{
- void *pio = pin_to_controller(pin);
- unsigned mask = pin_to_mask(pin);
-
- __raw_writel(mask, pio + (is_on ? PIO_MDER : PIO_MDDR));
- return 0;
-}
-
-static inline int gpio_direction_input(unsigned pin)
-{
- void *pio = pin_to_controller(pin);
- unsigned mask = pin_to_mask(pin);
-
- if (!(__raw_readl(pio + PIO_PSR) & mask))
- return -EINVAL;
- __raw_writel(mask, pio + PIO_ODR);
- return 0;
-}
+#define at91_set_GPIO_periph at91_set_gpio_periph
+#define at91_set_A_periph at91_set_a_periph
+#define at91_set_B_periph at91_set_b_periph
-static inline int gpio_direction_output(unsigned pin, int value)
-{
- void *pio = pin_to_controller(pin);
- unsigned mask = pin_to_mask(pin);
-
- if (!(__raw_readl(pio + PIO_PSR) & mask))
- return -EINVAL;
- __raw_writel(mask, pio + (value ? PIO_SODR : PIO_CODR));
- __raw_writel(mask, pio + PIO_OER);
- return 0;
-}
-
-/*
- * assuming the pin is muxed as a gpio output, set its value.
- */
-static inline int at91_set_gpio_value(unsigned pin, int value)
-{
- void *pio = pin_to_controller(pin);
- unsigned mask = pin_to_mask(pin);
-
- __raw_writel(mask, pio + (value ? PIO_SODR : PIO_CODR));
- return 0;
-}
-
-/*
- * read the pin's value (works even if it's not muxed as a gpio).
- */
-static inline int at91_get_gpio_value(unsigned pin)
-{
- void *pio = pin_to_controller(pin);
- unsigned mask = pin_to_mask(pin);
- u32 pdsr;
-
- pdsr = __raw_readl(pio + PIO_PDSR);
- return (pdsr & mask) != 0;
-}
#endif
#endif
diff --git a/include/configs/afeb9260.h b/include/configs/afeb9260.h
index 3b69de8..9f8c567 100644
--- a/include/configs/afeb9260.h
+++ b/include/configs/afeb9260.h
@@ -47,6 +47,7 @@
/*
* Hardware drivers
*/
+#define CONFIG_AT91_GPIO 1
#define CONFIG_ATMEL_USART 1
#undef CONFIG_USART0
#undef CONFIG_USART1
diff --git a/include/configs/at91cap9adk.h b/include/configs/at91cap9adk.h
index 4c2782a..9da5846 100644
--- a/include/configs/at91cap9adk.h
+++ b/include/configs/at91cap9adk.h
@@ -49,6 +49,7 @@
/*
* Hardware drivers
*/
+#define CONFIG_AT91_GPIO 1
#define CONFIG_ATMEL_USART 1
#undef CONFIG_USART0
#undef CONFIG_USART1
diff --git a/include/configs/at91sam9260ek.h b/include/configs/at91sam9260ek.h
index a620d57..6d8969b 100644
--- a/include/configs/at91sam9260ek.h
+++ b/include/configs/at91sam9260ek.h
@@ -54,6 +54,8 @@
/*
* Hardware drivers
*/
+#define CONFIG_AT91_GPIO 1
+
#define CONFIG_ATMEL_USART 1
#undef CONFIG_USART0
#undef CONFIG_USART1
diff --git a/include/configs/at91sam9261ek.h b/include/configs/at91sam9261ek.h
index 832b1cd..e67d899 100644
--- a/include/configs/at91sam9261ek.h
+++ b/include/configs/at91sam9261ek.h
@@ -52,6 +52,8 @@
/*
* Hardware drivers
*/
+#define CONFIG_AT91_GPIO 1
+
#define CONFIG_ATMEL_USART 1
#undef CONFIG_USART0
#undef CONFIG_USART1
diff --git a/include/configs/at91sam9263ek.h b/include/configs/at91sam9263ek.h
index 1d82a15..dc010f2 100644
--- a/include/configs/at91sam9263ek.h
+++ b/include/configs/at91sam9263ek.h
@@ -51,6 +51,8 @@
/*
* Hardware drivers
*/
+#define CONFIG_AT91_GPIO 1
+
#define CONFIG_ATMEL_USART 1
#undef CONFIG_USART0
#undef CONFIG_USART1
diff --git a/include/configs/at91sam9m10g45ek.h b/include/configs/at91sam9m10g45ek.h
index 50b118f..d034863 100644
--- a/include/configs/at91sam9m10g45ek.h
+++ b/include/configs/at91sam9m10g45ek.h
@@ -52,6 +52,8 @@
/*
* Hardware drivers
*/
+#define CONFIG_AT91_GPIO 1
+
#define CONFIG_ATMEL_USART 1
#undef CONFIG_USART0
#undef CONFIG_USART1
diff --git a/include/configs/at91sam9rlek.h b/include/configs/at91sam9rlek.h
index 8db296a..423890b 100644
--- a/include/configs/at91sam9rlek.h
+++ b/include/configs/at91sam9rlek.h
@@ -49,6 +49,8 @@
/*
* Hardware drivers
*/
+#define CONFIG_AT91_GPIO 1
+
#define CONFIG_ATMEL_USART 1
#undef CONFIG_USART0
#undef CONFIG_USART1
diff --git a/include/configs/cpu9260.h b/include/configs/cpu9260.h
index e967e7c..50e31ff 100644
--- a/include/configs/cpu9260.h
+++ b/include/configs/cpu9260.h
@@ -244,6 +244,8 @@
/*
* Hardware drivers
*/
+#define CONFIG_AT91_GPIO 1
+
#define CONFIG_ATMEL_USART 1
#undef CONFIG_USART0
#undef CONFIG_USART1
diff --git a/include/configs/meesc.h b/include/configs/meesc.h
index 253a53d..13e60e7 100644
--- a/include/configs/meesc.h
+++ b/include/configs/meesc.h
@@ -58,6 +58,8 @@
*/
/* Console output */
+#define CONFIG_AT91_GPIO 1
+
#define CONFIG_ATMEL_USART 1
#undef CONFIG_USART0
#undef CONFIG_USART1
diff --git a/include/configs/pm9261.h b/include/configs/pm9261.h
index 26a2fad..25b6689 100644
--- a/include/configs/pm9261.h
+++ b/include/configs/pm9261.h
@@ -159,6 +159,8 @@
/*
* Hardware drivers
*/
+#define CONFIG_AT91_GPIO 1
+
#define CONFIG_ATMEL_USART 1
#undef CONFIG_USART0
#undef CONFIG_USART1
diff --git a/include/configs/pm9263.h b/include/configs/pm9263.h
index e55098c..f318a86 100644
--- a/include/configs/pm9263.h
+++ b/include/configs/pm9263.h
@@ -173,6 +173,8 @@
/*
* Hardware drivers
*/
+#define CONFIG_AT91_GPIO 1
+
#define CONFIG_ATMEL_USART 1
#undef CONFIG_USART0
#undef CONFIG_USART1
diff --git a/include/configs/sbc35_a9g20.h b/include/configs/sbc35_a9g20.h
index 7bdc729..3f0723f 100644
--- a/include/configs/sbc35_a9g20.h
+++ b/include/configs/sbc35_a9g20.h
@@ -59,6 +59,8 @@
/*
* Hardware drivers
*/
+#define CONFIG_AT91_GPIO 1
+
#define CONFIG_ATMEL_USART
#define CONFIG_USART0
#undef CONFIG_USART1
diff --git a/include/configs/tny_a9260.h b/include/configs/tny_a9260.h
index 21475f8..466d27b 100644
--- a/include/configs/tny_a9260.h
+++ b/include/configs/tny_a9260.h
@@ -68,6 +68,8 @@
/*
* Hardware drivers
*/
+#define CONFIG_AT91_GPIO 1
+
#define CONFIG_ATMEL_USART 1
#undef CONFIG_USART0
#undef CONFIG_USART1
2
2
* add's c structures for SoC access to pheriperials head files
* add's missing pheriperials head files (new SoC)
Signed-off-by: Jens Scharsig <js_at_ng(a)scharsoft.de>
---
include/asm-arm/arch-at91/at91_matrix.h | 125 +++++++++++++++++++++++++++
include/asm-arm/arch-at91/at91_pdc.h | 41 +++++++++
include/asm-arm/arch-at91/at91_pio.h | 104 ++++++++++++++++++++++
include/asm-arm/arch-at91/at91_pit.h | 15 +++
include/asm-arm/arch-at91/at91_pmc.h | 100 +++++++++++++++++++++
include/asm-arm/arch-at91/at91_rstc.h | 30 ++++++-
include/asm-arm/arch-at91/at91_spi.h | 21 +++++
include/asm-arm/arch-at91/at91_wdt.h | 29 ++++++
include/asm-arm/arch-at91/at91cap9.h | 9 ++
include/asm-arm/arch-at91/at91sam9260.h | 17 ++++
include/asm-arm/arch-at91/at91sam9261.h | 14 +++-
include/asm-arm/arch-at91/at91sam9263.h | 22 +++++
include/asm-arm/arch-at91/at91sam9_sdramc.h | 13 +++
include/asm-arm/arch-at91/at91sam9_smc.h | 63 ++++++++++++++
include/asm-arm/arch-at91/at91sam9g45.h | 15 +++
include/asm-arm/arch-at91/at91sam9rl.h | 14 +++-
include/asm-arm/arch-at91/gpio.h | 3 +
include/asm-arm/arch-at91/io.h | 3 +
18 files changed, 635 insertions(+), 3 deletions(-)
create mode 100644 include/asm-arm/arch-at91/at91_matrix.h
create mode 100644 include/asm-arm/arch-at91/at91_pdc.h
diff --git a/include/asm-arm/arch-at91/at91_matrix.h b/include/asm-arm/arch-at91/at91_matrix.h
new file mode 100644
index 0000000..eeaae9d
--- /dev/null
+++ b/include/asm-arm/arch-at91/at91_matrix.h
@@ -0,0 +1,125 @@
+/*
+ * Memory Setup stuff - taken from blob memsetup.S
+ *
+ * Copyright (C) 2009 Jens Scharsig (js_at_ng(a)scharsoft.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
+ */
+
+#ifndef AT91_MATRIX_H
+#define AT91_MATRIX_H
+
+#ifdef __ASSEMBLY__
+
+#if defined(CONFIG_AT91SAM9260) || defined(CONFIG_AT91SAM9G20)
+#define AT91_ASM_MATRIX_CSA0 (AT91_MATRIX_BASE + 0x11C)
+#elif defined(CONFIG_AT91SAM9261)
+#define AT91_ASM_MATRIX_CSA0 (AT91_MATRIX_BASE + 0x30)
+#elif defined(CONFIG_AT91SAM9263)
+#define AT91_ASM_MATRIX_CSA0 (AT91_MATRIX_BASE + 0x120)
+#elif defined(CONFIG_AT91SAM9G45)
+#define AT91_ASM_MATRIX_CSA0 (AT91_MATRIX_BASE + 0x128)
+#else
+#error AT91_ASM_MATRIX_CSA0 is not definied for current CPU
+#endif
+
+#define AT91_ASM_MATRIX_MCFG AT91_MATRIX_BASE
+
+#else
+#if defined(CONFIG_AT91SAM9260) || defined(CONFIG_AT91SAM9G20)
+#define AT91_MATRIX_MASTERS 6
+#define AT91_MATRIX_SLAVES 5
+#elif defined(CONFIG_AT91SAM9261)
+#define AT91_MATRIX_MASTERS 1
+#define AT91_MATRIX_SLAVES 5
+#elif defined(CONFIG_AT91SAM9263)
+#define AT91_MATRIX_MASTERS 9
+#define AT91_MATRIX_SLAVES 7
+#elif defined(CONFIG_AT91SAM9G45)
+#define AT91_MATRIX_MASTERS 11
+#define AT91_MATRIX_SLAVES 8
+#else
+#error CPU not supported. Please update at91_matrix.h
+#endif
+
+typedef struct at91_prority {
+ u32 a;
+ u32 b;
+} at91_prority_t;
+
+
+typedef struct at91_matrix {
+ u32 mcfg[AT91_MATRIX_MASTERS];
+#if defined(CONFIG_AT91SAM9261)
+ u32 scfg[AT91_MATRIX_SLAVES];
+ u32 res61_1[3];
+ u32 tcr;
+ u32 res61_2[2];
+ u32 csa;
+ u32 pucr;
+ u32 res61_3[114];
+#else
+#if (AT91_MATRIX_MASTERS < 16)
+ u32 reserve1[16 - AT91_MATRIX_MASTERS];
+#endif
+ u32 scfg[AT91_MATRIX_SLAVES];
+#if (AT91_MATRIX_SLAVES < 16)
+ u32 reserve2[16 - AT91_MATRIX_SLAVES];
+#endif
+ at91_prority_t pr[AT91_MATRIX_SLAVES];
+#if (AT91_MATRIX_SLAVES < 16)
+ u32 reserve3[32 - (2 * AT91_MATRIX_SLAVES)];
+#endif
+ u32 mrcr; /* 0x100 Master Remap Control */
+ u32 reserve4[3];
+#if defined(CONFIG_AT91SAM9G45)
+ u32 ccr[52] /* 0x110 - 0x1E0 Chip Configuration */
+ u32 womr; /* 0x1E4 Write Protect Mode */
+ u32 wpsr; /* 0x1E8 Write Protect Status */
+ u32 resg45_1[10];
+#elif defined(CONFIG_AT91SAM9260) || defined(CONFIG_AT91SAM9G20)
+ u32 res60_1[3];
+ u32 csa;
+ u32 res60_2[56];
+#elif defined(CONFIG_AT91SAM9263)
+ u32 res63_1;
+ u32 tcmr;
+ u32 res63_2[2];
+ u32 csa[2];
+ u32 res63_3[54];
+#else
+ u32 reserve5[60];
+#endif
+#endif
+} at91_matrix_t;
+
+#endif /* __ASSEMBLY__ */
+
+#define AT91_MATRIX_CSA_DBPUC 0x00000100
+#define AT91_MATRIX_CSA_VDDIOMSEL_1_8V 0x00000000
+#define AT91_MATRIX_CSA_VDDIOMSEL_3_3V 0x00010000
+
+#define AT91_MATRIX_CSA_EBI_CS1A 0x00000002
+#define AT91_MATRIX_CSA_EBI_CS3A 0x00000008
+#define AT91_MATRIX_CSA_EBI_CS4A 0x00000010
+#define AT91_MATRIX_CSA_EBI_CS5A 0x00000020
+
+#define AT91_MATRIX_CSA_EBI1_CS2A 0x00000008
+
+#endif
diff --git a/include/asm-arm/arch-at91/at91_pdc.h b/include/asm-arm/arch-at91/at91_pdc.h
new file mode 100644
index 0000000..dd12587
--- /dev/null
+++ b/include/asm-arm/arch-at91/at91_pdc.h
@@ -0,0 +1,41 @@
+/*
+ * Memory Setup stuff - taken from blob memsetup.S
+ *
+ * Copyright (C) 2009 Jens Scharsig (js_at_ng(a)scharsoft.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
+ */
+
+#ifndef AT91_PDC_H
+#define AT91_PDC_H
+
+typedef struct at91_pdc {
+ u32 rpr; /* 0x100 Receive Pointer Register */
+ u32 rcr; /* 0x104 Receive Counter Register */
+ u32 tpr; /* 0x108 Transmit Pointer Register */
+ u32 tcr; /* 0x10C Transmit Counter Register */
+ u32 pnpr; /* 0x110 Receive Next Pointer Register */
+ u32 pncr; /* 0x114 Receive Next Counter Register */
+ u32 tnpr; /* 0x118 Transmit Next Pointer Register */
+ u32 tncr; /* 0x11C Transmit Next Counter Register */
+ u32 ptcr; /* 0x120 Transfer Control Register */
+ u32 ptsr; /* 0x124 Transfer Status Register */
+} at91_pdc_t;
+
+#endif
diff --git a/include/asm-arm/arch-at91/at91_pio.h b/include/asm-arm/arch-at91/at91_pio.h
index f6ce1f9..52724e5 100644
--- a/include/asm-arm/arch-at91/at91_pio.h
+++ b/include/asm-arm/arch-at91/at91_pio.h
@@ -16,6 +16,109 @@
#ifndef AT91_PIO_H
#define AT91_PIO_H
+#ifdef __ASSEMBLY__
+
+#define AT91_ASM_PIO_RANGE 0x200
+#define AT91_ASM_PIOC_PDR \
+ (AT91_PIO_BASE + AT91_PIO_PORTC*AT91_ASM_PIO_RANGE + 0x04)
+#define AT91_ASM_PIOC_PUDR \
+ (AT91_PIO_BASE + AT91_PIO_PORTC*AT91_ASM_PIO_RANGE + 0x60)
+
+#define AT91_ASM_PIOD_PDR \
+ (AT91_PIO_BASE + AT91_PIO_PORTD*AT91_ASM_PIO_RANGE + 0x04)
+#define AT91_ASM_PIOD_PUDR \
+ (AT91_PIO_BASE + AT91_PIO_PORTD*AT91_ASM_PIO_RANGE + 0x60)
+#define AT91_ASM_PIOD_ASR \
+ (AT91_PIO_BASE + AT91_PIO_PORTD*AT91_ASM_PIO_RANGE + 0x70)
+
+#else
+
+typedef struct at91_port {
+ u32 per; /* 0x00 PIO Enable Register */
+ u32 pdr; /* 0x04 PIO Disable Register */
+ u32 psr; /* 0x08 PIO Status Register */
+ u32 reserved0;
+ u32 oer; /* 0x10 Output Enable Register */
+ u32 odr; /* 0x14 Output Disable Registerr */
+ u32 osr; /* 0x18 Output Status Register */
+ u32 reserved1;
+ u32 ifer; /* 0x20 Input Filter Enable Register */
+ u32 ifdr; /* 0x24 Input Filter Disable Register */
+ u32 ifsr; /* 0x28 Input Filter Status Register */
+ u32 reserved2;
+ u32 sodr; /* 0x30 Set Output Data Register */
+ u32 codr; /* 0x34 Clear Output Data Register */
+ u32 odsr; /* 0x38 Output Data Status Register */
+ u32 pdsr; /* 0x3C Pin Data Status Register */
+ u32 ier; /* 0x40 Interrupt Enable Register */
+ u32 idr; /* 0x44 Interrupt Disable Register */
+ u32 imr; /* 0x48 Interrupt Mask Register */
+ u32 isr; /* 0x4C Interrupt Status Register */
+ u32 mder; /* 0x50 Multi-driver Enable Register */
+ u32 mddr; /* 0x54 Multi-driver Disable Register */
+ u32 mdsr; /* 0x58 Multi-driver Status Register */
+ u32 reserved3;
+ u32 pudr; /* 0x60 Pull-up Disable Register */
+ u32 puer; /* 0x64 Pull-up Enable Register */
+ u32 pusr; /* 0x68 Pad Pull-up Status Register */
+ u32 reserved4;
+ u32 asr; /* 0x70 Select A Register */
+ u32 bsr; /* 0x74 Select B Register */
+ u32 absr; /* 0x78 AB Select Status Register */
+ u32 reserved5[9]; /* */
+ u32 ower; /* 0xA0 Output Write Enable Register */
+ u32 owdr; /* 0xA4 Output Write Disable Register */
+ u32 owsr; /* OxA8 utput Write Status Register */
+ u32 reserved6[85];
+} at91_port_t;
+
+#if defined(CONFIG_AT91SAM9260) || defined(CONFIG_AT91SAM9261)
+#define AT91_PIO_PORTS 3
+#elif defined(CONFIG_AT91SAM9263)
+#define AT91_PIO_PORTS 5
+#else
+#define AT91_PIO_PORTS 4
+#endif
+
+typedef union at91_pio {
+ struct {
+ at91_port_t pioa;
+ at91_port_t piob;
+ at91_port_t pioc;
+ #if (AT91_PIO_PORTS > 3)
+ at91_port_t piod;
+ #endif
+ #if (AT91_PIO_PORTS > 4)
+ at91_port_t pioe;
+ #endif
+ } ;
+ at91_port_t port[AT91_PIO_PORTS];
+} at91_pio_t;
+
+#ifdef CONFIG_AT91_GPIO
+int at91_set_gpio_periph(u32 pin, int use_pullup);
+int at91_set_a_periph(u32 pin, int use_pullup);
+int at91_set_b_periph(u32 pin, int use_pullup);
+int at91_set_gpio_input(u32 pin, int use_pullup);
+int at91_set_gpio_output(u32 pin, int value);
+int at91_set_deglitch(u32 pin, int is_on);
+int at91_set_multi_drive(u32 pin, int is_on);
+int at91_set_gpio_value(u32 pin, int value);
+int at91_get_gpio_value(u32 pin);
+#endif
+
+#endif
+
+#define AT91_PIN_TO_MASK(x) (1<<x)
+#define AT91_PORTPIN(PORT, PIN) ((0x0##PORT - 9) * 32 + ((PIN) & 0x1F))
+#define AT91_PIO_PORTA 0x0
+#define AT91_PIO_PORTB 0x1
+#define AT91_PIO_PORTC 0x2
+#define AT91_PIO_PORTD 0x3
+#define AT91_PIO_PORTE 0x4
+
+#ifdef CONFIG_AT91_LEGACY
+
#define PIO_PER 0x00 /* Enable Register */
#define PIO_PDR 0x04 /* Disable Register */
#define PIO_PSR 0x08 /* Status Register */
@@ -45,5 +148,6 @@
#define PIO_OWER 0xa0 /* Output Write Enable Register */
#define PIO_OWDR 0xa4 /* Output Write Disable Register */
#define PIO_OWSR 0xa8 /* Output Write Status Register */
+#endif
#endif
diff --git a/include/asm-arm/arch-at91/at91_pit.h b/include/asm-arm/arch-at91/at91_pit.h
index 94dd242..5615a02 100644
--- a/include/asm-arm/arch-at91/at91_pit.h
+++ b/include/asm-arm/arch-at91/at91_pit.h
@@ -16,6 +16,20 @@
#ifndef AT91_PIT_H
#define AT91_PIT_H
+typedef struct at91_pit {
+ u32 mr; /* 0x00 Mode Register */
+ u32 sr; /* 0x04 Status Register */
+ u32 pivr; /* 0x08 Periodic Interval Value Register */
+ u32 piir; /* 0x0C Periodic Interval Image Register */
+} at91_pit_t;
+
+#define AT91_PIT_MR_IEN 0x02000000
+#define AT91_PIT_MR_EN 0x01000000
+#define AT91_PIT_MR_PIV_MASK (x & 0x000fffff)
+#define AT91_PIT_MR_PIV(x) (x & AT91_PIT_MR_PIV_MASK)
+
+#ifdef CONFIG_AT91_LEGACY
+
#define AT91_PIT_MR (AT91_PIT + 0x00) /* Mode Register */
#define AT91_PIT_PITIEN (1 << 25) /* Timer Interrupt Enable */
#define AT91_PIT_PITEN (1 << 24) /* Timer Enabled */
@@ -29,4 +43,5 @@
#define AT91_PIT_PICNT (0xfff << 20) /* Interval Counter */
#define AT91_PIT_CPIV (0xfffff) /* Inverval Value */
+#endif /* CONFIG_AT91_LEGACY */
#endif
diff --git a/include/asm-arm/arch-at91/at91_pmc.h b/include/asm-arm/arch-at91/at91_pmc.h
index 9fe94c7..9a0e1d2 100644
--- a/include/asm-arm/arch-at91/at91_pmc.h
+++ b/include/asm-arm/arch-at91/at91_pmc.h
@@ -16,6 +16,105 @@
#ifndef AT91_PMC_H
#define AT91_PMC_H
+#ifdef __ASSEMBLY__
+
+#define AT91_ASM_PMC_MOR (AT91_PMC_BASE + 0x20)
+#define AT91_ASM_PMC_PLLAR (AT91_PMC_BASE + 0x28)
+#define AT91_ASM_PMC_PLLBR (AT91_PMC_BASE + 0x2c)
+#define AT91_ASM_PMC_MCKR (AT91_PMC_BASE + 0x30)
+#define AT91_ASM_PMC_SR (AT91_PMC_BASE + 0x68)
+
+#else
+
+#include <asm/types.h>
+
+typedef struct at91_pmc {
+ u32 scer; /* 0x00 System Clock Enable Register */
+ u32 scdr; /* 0x04 System Clock Disable Register */
+ u32 scsr; /* 0x08 System Clock Status Register */
+ u32 reserved0;
+ u32 pcer; /* 0x10 Peripheral Clock Enable Register */
+ u32 pcdr; /* 0x14 Peripheral Clock Disable Register */
+ u32 pcsr; /* 0x18 Peripheral Clock Status Register */
+ u32 reserved1;
+ u32 mor; /* 0x20 Main Oscilator Register */
+ u32 mcfr; /* 0x24 Main Clock Frequency Register */
+ u32 pllar; /* 0x28 PLL A Register */
+ u32 pllbr; /* 0x2C PLL B Register */
+ u32 mckr; /* 0x30 Master Clock Register */
+ u32 reserved2[3];
+ u32 pck[4]; /* 0x40 Programmable Clock Register 0 - 3 */
+ u32 reserved3[4];
+ u32 ier; /* 0x60 Interrupt Enable Register */
+ u32 idr; /* 0x64 Interrupt Disable Register */
+ u32 sr; /* 0x68 Status Register */
+ u32 imr; /* 0x6C Interrupt Mask Register */
+ u32 reserved4[4];
+#ifdef CONFIG_AT91SAM9
+ u32 pllicpr; /* 0x80 Change Pump Current Register */
+#else
+ u32 reserved5;
+#endif
+ u32 reserved6[21];
+#ifdef CONFIG_AT91CAP9
+ u32 wpmr; /* 0xE4 Write Protect Mode Register */
+ u32 wpsr; /* 0xE8 Write Protect Status Register */
+#else
+ u32 reserved7[2];
+#endif
+ u32 reserved8[5];
+} at91_pmc_t;
+
+#endif /* end assembly */
+
+#define AT91_PMC_MOR_MOSCEN 0x01
+#define AT91_PMC_MOR_OSCBYPASS 0x02
+#define AT91_PMC_MOR_OSCOUNT(x) ((x & 0xff) << 8)
+
+#define AT91_PMC_PLLxR_DIV(x) (x & 0xFF)
+#define AT91_PMC_PLLxR_PLLCOUNT(x) ((x & 0x3F) << 8)
+#define AT91_PMC_PLLxR_OUT(x) ((x & 0x03) << 14)
+#define AT91_PMC_PLLxR_MUL(x) ((x & 0x7FF) << 16)
+#define AT91_PMC_PLLAR_29 0x20000000
+#define AT91_PMC_PLLBR_USBDIV_1 0x00000000
+#define AT91_PMC_PLLBR_USBDIV_2 0x10000000
+#define AT91_PMC_PLLBR_USBDIV_4 0x20000000
+
+#define AT91_PMC_MCKR_CSS_SLOW 0x00000000
+#define AT91_PMC_MCKR_CSS_MAIN 0x00000001
+#define AT91_PMC_MCKR_CSS_PLLA 0x00000002
+#define AT91_PMC_MCKR_CSS_PLLB 0x00000003
+#define AT91_PMC_MCKR_CSS_MASK 0x00000003
+
+#define AT91_PMC_MCKR_PRES_1 0x00000000
+#define AT91_PMC_MCKR_PRES_2 0x00000004
+#define AT91_PMC_MCKR_PRES_4 0x00000008
+#define AT91_PMC_MCKR_PRES_8 0x0000000C
+#define AT91_PMC_MCKR_PRES_16 0x00000010
+#define AT91_PMC_MCKR_PRES_32 0x00000014
+#define AT91_PMC_MCKR_PRES_64 0x00000018
+#define AT91_PMC_MCKR_PRES_MASK 0x0000001C
+
+#define AT91_PMC_MCKR_MDIV_1 0x00000000
+#define AT91_PMC_MCKR_MDIV_2 0x00000100
+#define AT91_PMC_MCKR_MDIV_4 0x00000200
+#define AT91_PMC_MCKR_MDIV_MASK 0x00000300
+
+#define AT91_PMC_MCKR_PLLADIV_1 0x00001000
+#define AT91_PMC_MCKR_PLLADIV_2 0x00002000
+
+#define AT91_PMC_IxR_MOSCS 0x00000001
+#define AT91_PMC_IxR_LOCKA 0x00000002
+#define AT91_PMC_IxR_LOCKB 0x00000004
+#define AT91_PMC_IxR_MCKRDY 0x00000008
+#define AT91_PMC_IxR_LOCKU 0x00000040
+#define AT91_PMC_IxR_PCKRDY0 0x00000100
+#define AT91_PMC_IxR_PCKRDY1 0x00000200
+#define AT91_PMC_IxR_PCKRDY2 0x00000400
+#define AT91_PMC_IxR_PCKRDY3 0x00000800
+
+#ifdef CONFIG_AT91_LEGACY
+
#define AT91_PMC_SCER (AT91_PMC + 0x00) /* System Clock Enable Register */
#define AT91_PMC_SCDR (AT91_PMC + 0x04) /* System Clock Disable Register */
@@ -117,4 +216,5 @@
#define AT91_PMC_VER (AT91_PMC + 0xfc) /* PMC Module Version [AT91CAP9 only] */
+#endif /* CONFIG_AT91_LEGACY */
#endif
diff --git a/include/asm-arm/arch-at91/at91_rstc.h b/include/asm-arm/arch-at91/at91_rstc.h
index e49caef..86f4ffb 100644
--- a/include/asm-arm/arch-at91/at91_rstc.h
+++ b/include/asm-arm/arch-at91/at91_rstc.h
@@ -16,11 +16,37 @@
#ifndef AT91_RSTC_H
#define AT91_RSTC_H
+#ifdef __ASSEMBLY__
+#define AT91_ASM_RSTC_MR (AT91_RSTC_BASE + 0x08)
+#else
+
+typedef struct at91_rstc {
+ u32 cr; /* Reset Controller Control Register */
+ u32 sr; /* Reset Controller Status Register */
+ u32 mr; /* Reset Controller Mode Register */
+} at91_rstc_t;
+
+#endif /* __ASSEMBLY__ */
+
+#define AT91_RSTC_KEY 0xA5000000
+
+#define AT91_RSTC_CR_PROCRST 0x00000001
+#define AT91_RSTC_CR_PERRST 0x00000004
+#define AT91_RSTC_CR_EXTRST 0x00000008
+
+#define AT91_RSTC_MR_URSTEN 0x00000001
+#define AT91_RSTC_MR_URSTIEN 0x00000010
+#define AT91_RSTC_MR_ERSTL(x) ((x & 0xf) << 8)
+#define AT91_RSTC_MR_ERSTL_MASK 0x0000FF00
+
+#define AT91_RSTC_SR_NRSTL 0x00010000
+
+#ifdef CONFIG_AT91_LEGACY
+
#define AT91_RSTC_CR (AT91_RSTC + 0x00) /* Reset Controller Control Register */
#define AT91_RSTC_PROCRST (1 << 0) /* Processor Reset */
#define AT91_RSTC_PERRST (1 << 2) /* Peripheral Reset */
#define AT91_RSTC_EXTRST (1 << 3) /* External Reset */
-#define AT91_RSTC_KEY (0xa5 << 24) /* KEY Password */
#define AT91_RSTC_SR (AT91_RSTC + 0x04) /* Reset Controller Status Register */
#define AT91_RSTC_URSTS (1 << 0) /* User Reset Status */
@@ -38,4 +64,6 @@
#define AT91_RSTC_URSTIEN (1 << 4) /* User Reset Interrupt Enable */
#define AT91_RSTC_ERSTL (0xf << 8) /* External Reset Length */
+#endif /* CONFIG_AT91_LEGACY */
+
#endif
diff --git a/include/asm-arm/arch-at91/at91_spi.h b/include/asm-arm/arch-at91/at91_spi.h
index 30643c6..c520e89 100644
--- a/include/asm-arm/arch-at91/at91_spi.h
+++ b/include/asm-arm/arch-at91/at91_spi.h
@@ -16,6 +16,25 @@
#ifndef AT91_SPI_H
#define AT91_SPI_H
+#include <asm/arch/at91_pdc.h>
+
+typedef struct at91_spi {
+ u32 cr; /* 0x00 Control Register */
+ u32 mr; /* 0x04 Mode Register */
+ u32 rdr; /* 0x08 Receive Data Register */
+ u32 tdr; /* 0x0C Transmit Data Register */
+ u32 sr; /* 0x10 Status Register */
+ u32 ier; /* 0x14 Interrupt Enable Register */
+ u32 idr; /* 0x18 Interrupt Disable Register */
+ u32 imr; /* 0x1C Interrupt Mask Register */
+ u32 reserve1[4];
+ u32 csr[4]; /* 0x30 Chip Select Register 0-3 */
+ u32 reserve2[48];
+ at91_pdc_t pdc;
+} at91_spi_t;
+
+#ifdef CONFIG_AT91_LEGACY
+
#define AT91_SPI_CR 0x00 /* Control Register */
#define AT91_SPI_SPIEN (1 << 0) /* SPI Enable */
#define AT91_SPI_SPIDIS (1 << 1) /* SPI Disable */
@@ -102,4 +121,6 @@
#define AT91_SPI_PTSR 0x0124 /* PDC Transfer Status Register */
+#endif /* CONFIG_AT91_LEGACY */
+
#endif
diff --git a/include/asm-arm/arch-at91/at91_wdt.h b/include/asm-arm/arch-at91/at91_wdt.h
index 7e18537..cf08daf 100644
--- a/include/asm-arm/arch-at91/at91_wdt.h
+++ b/include/asm-arm/arch-at91/at91_wdt.h
@@ -17,6 +17,34 @@
#ifndef AT91_WDT_H
#define AT91_WDT_H
+#ifdef __ASSEMBLY__
+
+#define AT91_ASM_WDT_MR (AT91_WDT_BASE + 0x04)
+
+#else
+
+typedef struct at91_wdt {
+ u32 cr;
+ u32 mr;
+ u32 sr;
+} at91_wdt_t;
+
+#endif
+
+#define AT91_WDT_CR_WDRSTT 1
+#define AT91_WDT_CR_KEY 0xa5000000 /* KEY Password */
+
+#define AT91_WDT_MR_WDV(x) (x & 0xfff)
+#define AT91_WDT_MR_WDFIEN 0x00001000
+#define AT91_WDT_MR_WDRSTEN 0x00002000
+#define AT91_WDT_MR_WDRPROC 0x00004000
+#define AT91_WDT_MR_WDDIS 0x00008000
+#define AT91_WDT_MR_WDD(x) ((x & 0xfff) << 16)
+#define AT91_WDT_MR_WDDBGHLT 0x10000000
+#define AT91_WDT_MR_WDIDLEHLT 0x20000000
+
+#ifdef CONFIG_AT91_LEGACY
+
#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 */
@@ -35,4 +63,5 @@
#define AT91_WDT_WDUNF (1 << 0) /* Watchdog Underflow */
#define AT91_WDT_WDERR (1 << 1) /* Watchdog Error */
+#endif /* CONFIG_AT91_LEGACY */
#endif
diff --git a/include/asm-arm/arch-at91/at91cap9.h b/include/asm-arm/arch-at91/at91cap9.h
index b128ac5..c825710 100644
--- a/include/asm-arm/arch-at91/at91cap9.h
+++ b/include/asm-arm/arch-at91/at91cap9.h
@@ -53,6 +53,14 @@
#define AT91CAP9_ID_IRQ0 30 /* Advanced Interrupt Controller (IRQ0) */
#define AT91CAP9_ID_IRQ1 31 /* Advanced Interrupt Controller (IRQ1) */
+#define AT91_PIO_BASE 0xfffff200
+#define AT91_PMC_BASE 0xfffffc00
+#define AT91_RSTC_BASE 0xfffffd00
+
+#define AT91_PIT_BASE 0xfffffd30
+
+#ifdef CONFIG_AT91_LEGACY
+
/*
* User Peripheral physical base addresses.
*/
@@ -119,6 +127,7 @@
#define AT91CAP9_SCKCR_OSCSEL_RC (0 << 3)
#define AT91CAP9_SCKCR_OSCSEL_32 (1 << 3)
+#endif /* CONFIG_AT91_LEGACY */
/*
* Internal Memory.
*/
diff --git a/include/asm-arm/arch-at91/at91sam9260.h b/include/asm-arm/arch-at91/at91sam9260.h
index 73975f4..fd38fab 100644
--- a/include/asm-arm/arch-at91/at91sam9260.h
+++ b/include/asm-arm/arch-at91/at91sam9260.h
@@ -49,6 +49,21 @@
#define AT91SAM9260_ID_IRQ1 30 /* Advanced Interrupt Controller (IRQ1) */
#define AT91SAM9260_ID_IRQ2 31 /* Advanced Interrupt Controller (IRQ2) */
+#define AT91_EMAC_BASE 0xfffc4000
+
+#define AT91_SDRAMC_BASE 0xffffea00
+#define AT91_SMC_BASE 0xffffec00
+#define AT91_MATRIX_BASE 0xffffee00
+
+#define AT91_PIO_BASE 0xfffff400
+#define AT91_PMC_BASE 0xfffffc00
+#define AT91_RSTC_BASE 0xfffffd00
+
+#define AT91_PIT_BASE 0xfffffd30
+#define AT91_WDT_BASE 0xfffffd40
+
+#ifdef CONFIG_AT91_LEGACY
+
/*
* User Peripheral physical base addresses.
*/
@@ -105,6 +120,8 @@
#define AT91_USART4 AT91SAM9260_BASE_US4
#define AT91_USART5 AT91SAM9260_BASE_US5
+#endif /* CONFIG_AT91_LEGACY */
+
/*
* Internal Memory.
*/
diff --git a/include/asm-arm/arch-at91/at91sam9261.h b/include/asm-arm/arch-at91/at91sam9261.h
index b303e07..2fe9d17 100644
--- a/include/asm-arm/arch-at91/at91sam9261.h
+++ b/include/asm-arm/arch-at91/at91sam9261.h
@@ -43,6 +43,18 @@
#define AT91SAM9261_ID_IRQ1 30 /* Advanced Interrupt Controller (IRQ1) */
#define AT91SAM9261_ID_IRQ2 31 /* Advanced Interrupt Controller (IRQ2) */
+#define AT91_SDRAMC_BASE 0xffffea00
+#define AT91_SMC_BASE 0xffffec00
+#define AT91_MATRIX_BASE 0xffffee00
+
+#define AT91_PIO_BASE 0xfffff400
+#define AT91_PMC_BASE 0xfffffc00
+#define AT91_RSTC_BASE 0xfffffd00
+
+#define AT91_PIT_BASE 0xfffffd30
+#define AT91_WDT_BASE 0xfffffd40
+
+#ifdef CONFIG_AT91_LEGACY
/*
* User Peripheral physical base addresses.
@@ -64,7 +76,6 @@
#define AT91SAM9261_BASE_SPI1 0xfffcc000
#define AT91_BASE_SYS 0xffffea00
-
/*
* System Peripherals (offset from AT91_BASE_SYS)
*/
@@ -88,6 +99,7 @@
#define AT91_USART1 AT91SAM9261_BASE_US1
#define AT91_USART2 AT91SAM9261_BASE_US2
+#endif /* CONFIG_AT91_LEGACY */
/*
* Internal Memory.
diff --git a/include/asm-arm/arch-at91/at91sam9263.h b/include/asm-arm/arch-at91/at91sam9263.h
index 966a683..e52c297 100644
--- a/include/asm-arm/arch-at91/at91sam9263.h
+++ b/include/asm-arm/arch-at91/at91sam9263.h
@@ -47,6 +47,26 @@
#define AT91SAM9263_ID_IRQ0 30 /* Advanced Interrupt Controller (IRQ0) */
#define AT91SAM9263_ID_IRQ1 31 /* Advanced Interrupt Controller (IRQ1) */
+#define AT91_EMAC_BASE 0xfffbc000
+
+#define AT91_ECC0_BASE 0xffffe000
+#define AT91_SDRAMC0_BASE 0xffffe200
+#define AT91_SMC0_BASE 0xffffe400
+#define AT91_ECC1_BASE 0xffffe600
+#define AT91_SDRAMC1_BASE 0xffffe800
+#define AT91_SMC1_BASE 0xffffea00
+#define AT91_MATRIX_BASE 0xffffec00
+#define AT91_CCFG_BASE 0xffffed10
+#define AT91_DBGU_BASE 0xffffee00
+#define AT91_AIC_BASE 0xfffff000
+#define AT91_PIO_BASE 0xfffff200
+#define AT91_PMC_BASE 0xfffffc00
+#define AT91_RSTC_BASE 0xfffffd00
+
+#define AT91_PIT_BASE 0xfffffd30
+#define AT91_WDT_BASE 0xfffffd40
+
+#ifdef CONFIG_AT91_LEGACY
/*
* User Peripheral physical base addresses.
@@ -108,6 +128,8 @@
#define AT91_SMC AT91_SMC0
#define AT91_SDRAMC AT91_SDRAMC0
+#endif /* CONFIG_AT91_LEGACY */
+
/*
* Internal Memory.
*/
diff --git a/include/asm-arm/arch-at91/at91sam9_sdramc.h b/include/asm-arm/arch-at91/at91sam9_sdramc.h
index 5af2b54..c3da3a6 100644
--- a/include/asm-arm/arch-at91/at91sam9_sdramc.h
+++ b/include/asm-arm/arch-at91/at91sam9_sdramc.h
@@ -17,6 +17,19 @@
#ifndef AT91SAM9_SDRAMC_H
#define AT91SAM9_SDRAMC_H
+#ifdef __ASSEMBLY__
+
+#ifndef AT91_SDRAMC_BASE
+#define AT91_SDRAMC_BASE AT91_SDRAMC0_BASE
+#endif
+
+#define AT91_ASM_SDRAMC_MR AT91_SDRAMC_BASE
+#define AT91_ASM_SDRAMC_TR (AT91_SDRAMC_BASE + 0x04)
+#define AT91_ASM_SDRAMC_CR (AT91_SDRAMC_BASE + 0x08)
+#define AT91_ASM_SDRAMC_MDR (AT91_SDRAMC_BASE + 0x24)
+
+#endif
+
/* SDRAM Controller (SDRAMC) registers */
#define AT91_SDRAMC_MR (AT91_SDRAMC + 0x00) /* SDRAM Controller Mode Register */
#define AT91_SDRAMC_MODE (0xf << 0) /* Command Mode */
diff --git a/include/asm-arm/arch-at91/at91sam9_smc.h b/include/asm-arm/arch-at91/at91sam9_smc.h
index d64511b..8173c4e 100644
--- a/include/asm-arm/arch-at91/at91sam9_smc.h
+++ b/include/asm-arm/arch-at91/at91sam9_smc.h
@@ -16,6 +16,68 @@
#ifndef AT91SAM9_SMC_H
#define AT91SAM9_SMC_H
+#ifdef __ASSEMBLY__
+
+#ifndef AT91_SMC_BASE
+#define AT91_SMC_BASE AT91_SMC0_BASE
+#endif
+
+#define AT91_ASM_SMC_SETUP0 AT91_SMC_BASE
+#define AT91_ASM_SMC_PULSE0 (AT91_SMC_BASE + 0x04)
+#define AT91_ASM_SMC_CYCLE0 (AT91_SMC_BASE + 0x08)
+#define AT91_ASM_SMC_MODE0 (AT91_SMC_BASE + 0x0C)
+
+#else
+
+typedef struct at91_cs {
+ u32 setup; /* 0x00 SMC Setup Register */
+ u32 pulse; /* 0x04 SMC Pulse Register */
+ u32 cycle; /* 0x08 SMC Cycle Register */
+ u32 mode; /* 0x0C SMC Mode Register */
+} at91_cs_t;
+
+typedef struct at91_smc {
+ at91_cs_t cs[8];
+} at91_smc_t;
+
+#endif /* __ASSEMBLY__ */
+
+#define AT91_SMC_SETUP_NWE(x) (x & 0x3f)
+#define AT91_SMC_SETUP_NCS_WR(x) ((x & 0x3f) << 8)
+#define AT91_SMC_SETUP_NRD(x) ((x & 0x3f) << 16)
+#define AT91_SMC_SETUP_NCS_RD(x) ((x & 0x3f) << 24)
+
+#define AT91_SMC_PULSE_NWE(x) (x & 0x7f)
+#define AT91_SMC_PULSE_NCS_WR(x) ((x & 0x7f) << 8)
+#define AT91_SMC_PULSE_NRD(x) ((x & 0x7f) << 16)
+#define AT91_SMC_PULSE_NCS_RD(x) ((x & 0x7f) << 24)
+
+#define AT91_SMC_CYCLE_NWE(x) (x & 0x1ff)
+#define AT91_SMC_CYCLE_NRD(x) ((x & 0x1ff) << 16)
+
+#define AT91_SMC_MODE_RM_NCS 0x00000000
+#define AT91_SMC_MODE_RM_NRD 0x00000001
+#define AT91_SMC_MODE_WM_NCS 0x00000000
+#define AT91_SMC_MODE_WM_NWE 0x00000002
+
+#define AT91_SMC_MODE_EXNW_DISABLE 0x00000000
+#define AT91_SMC_MODE_EXNW_FROZEN 0x00000020
+#define AT91_SMC_MODE_EXNW_READY 0x00000030
+
+#define AT91_SMC_MODE_BAT 0x00000100
+#define AT91_SMC_MODE_DBW_8 0x00000000
+#define AT91_SMC_MODE_DBW_16 0x00001000
+#define AT91_SMC_MODE_DBW_32 0x00002000
+#define AT91_SMC_MODE_TDF_CYCLE(x) ((x & 0xf) << 16)
+#define AT91_SMC_MODE_TDF 0x00100000
+#define AT91_SMC_MODE_PMEN 0x01000000
+#define AT91_SMC_MODE_PS_4 0x00000000
+#define AT91_SMC_MODE_PS_8 0x10000000
+#define AT91_SMC_MODE_PS_16 0x20000000
+#define AT91_SMC_MODE_PS_32 0x30000000
+
+#ifdef CONFIG_AT91_LEGACY
+
#define AT91_SMC_SETUP(n) (AT91_SMC + 0x00 + ((n)*0x10)) /* Setup Register for CS n */
#define AT91_SMC_NWESETUP (0x3f << 0) /* NWE Setup Length */
#define AT91_SMC_NWESETUP_(x) ((x) << 0)
@@ -74,3 +136,4 @@
#endif
#endif
+#endif
diff --git a/include/asm-arm/arch-at91/at91sam9g45.h b/include/asm-arm/arch-at91/at91sam9g45.h
index 0feed9c..78c0b16 100644
--- a/include/asm-arm/arch-at91/at91sam9g45.h
+++ b/include/asm-arm/arch-at91/at91sam9g45.h
@@ -51,6 +51,19 @@
#define AT91SAM9G45_ID_VDEC 30 /* Video Decoder */
#define AT91SAM9G45_ID_IRQ0 31 /* Advanced Interrupt Controller */
+#define AT91_EMAC_BASE 0xfffbc000
+#define AT91_SMC_BASE 0xffffe800
+#define AT91_MATRIX_BASE 0xffffea00
+
+#define AT91_PIO_BASE 0xfffff200
+#define AT91_PMC_BASE 0xfffffc00
+#define AT91_RSTC_BASE 0xfffffd00
+
+#define AT91_PIT_BASE 0xfffffd30
+#define AT91_WDT_BASE 0xfffffd40
+
+#ifdef CONFIG_AT91_LEGACY
+
/*
* User Peripheral physical base addresses.
*/
@@ -114,6 +127,8 @@
#define AT91_USART2 AT91SAM9G45_BASE_US2
#define AT91_USART3 AT91SAM9G45_BASE_US3
+#endif
+
/*
* Internal Memory.
*/
diff --git a/include/asm-arm/arch-at91/at91sam9rl.h b/include/asm-arm/arch-at91/at91sam9rl.h
index 4dd8037..af0e434 100644
--- a/include/asm-arm/arch-at91/at91sam9rl.h
+++ b/include/asm-arm/arch-at91/at91sam9rl.h
@@ -44,6 +44,18 @@
#define AT91SAM9RL_ID_AC97C 24 /* AC97 Controller */
#define AT91SAM9RL_ID_IRQ0 31 /* Advanced Interrupt Controller (IRQ0) */
+#define AT91_SDRAMC_BASE 0xffffea00
+#define AT91_SMC_BASE 0xffffec00
+#define AT91_MATRIX_BASE 0xffffee00
+
+#define AT91_PIO_BASE 0xfffff400
+#define AT91_PMC_BASE 0xfffffc00
+#define AT91_RSTC_BASE 0xfffffd00
+
+#define AT91_PIT_BASE 0xfffffd30
+#define AT91_WDT_BASE 0xfffffd40
+
+#ifdef CONFIG_AT91_LEGACY
/*
* User Peripheral physical base addresses.
@@ -68,7 +80,6 @@
#define AT91SAM9RL_BASE_AC97C 0xfffd8000
#define AT91_BASE_SYS 0xffffc000
-
/*
* System Peripherals (offset from AT91_BASE_SYS)
*/
@@ -99,6 +110,7 @@
#define AT91_USART2 AT91SAM9RL_BASE_US2
#define AT91_USART3 AT91SAM9RL_BASE_US3
+#endif /* CONFIG_AT91_LEGACY */
/*
* Internal Memory.
diff --git a/include/asm-arm/arch-at91/gpio.h b/include/asm-arm/arch-at91/gpio.h
index e2d375b..bc53171 100644
--- a/include/asm-arm/arch-at91/gpio.h
+++ b/include/asm-arm/arch-at91/gpio.h
@@ -18,6 +18,8 @@
#include <asm/arch/at91_pio.h>
#include <asm/arch/hardware.h>
+#ifdef CONFIG_AT91_LEGACY
+
#define PIN_BASE 32
#define MAX_GPIO_BANKS 5
@@ -365,3 +367,4 @@ static inline int at91_get_gpio_value(unsigned pin)
}
#endif
+#endif
diff --git a/include/asm-arm/arch-at91/io.h b/include/asm-arm/arch-at91/io.h
index f09b2df..38d185e 100644
--- a/include/asm-arm/arch-at91/io.h
+++ b/include/asm-arm/arch-at91/io.h
@@ -23,6 +23,8 @@
#include <asm/io.h>
+#ifdef CONFIG_AT91_LEGACY
+
static inline unsigned int at91_sys_read(unsigned int reg_offset)
{
void *addr = (void *)AT91_BASE_SYS;
@@ -36,5 +38,6 @@ static inline void at91_sys_write(unsigned int reg_offset, unsigned long value)
__raw_writel(value, addr + reg_offset);
}
+#endif
#endif
2
3
The following changes since commit 111d6c6ad15d1425d3e5a678b2ff4b593e910fca:
Wolfgang Denk (1):
Merge branch 'master' of git://git.denx.de/u-boot-ppc4xx
are available in the git repository at:
git://git.denx.de/u-boot-usb.git master
Cliff Cai (1):
usb: musb: fix Blackfin DMA register padding
Prathap Srinivas (1):
musb: Add host support for DM365 EVM
Remy Bohmer (1):
USB: usb_control_msg wait for driver ISR to set status.
common/usb.c | 19 +++++++++++------
drivers/usb/musb/blackfin_usb.h | 2 +-
drivers/usb/musb/davinci.c | 21 ++++++++++++++++++-
drivers/usb/musb/davinci.h | 1 +
include/configs/davinci_dm365evm.h | 38 ++++++++++++++++++++++++++++++++++++
5 files changed, 71 insertions(+), 10 deletions(-)
2
1
Hi Wolfgang,
please pull some 4xx fixes into master:
The following changes since commit 9b208ece0a4e040774e24990b7cb6f0ad0ca4cc7:
Wolfgang Denk (1):
Merge branch 'master' of git://git.denx.de/u-boot-mpc85xx
are available in the git repository at:
git://www.denx.de/git/u-boot-ppc4xx.git master
Matthias Fuchs (3):
ppc4xx: Fix building of PMC440 board
ppc4xx: Fix building for PLU405 boards
ppc4xx: Remove unused feature from AR405 board
Stefan Roese (1):
ppc4xx: Fix compilation error on ML2 board
board/esd/plu405/plu405.c | 28 ++++++++++++++++++++++++++++
cpu/ppc4xx/traps.c | 1 +
include/configs/AR405.h | 1 +
include/configs/PMC440.h | 6 ------
4 files changed, 30 insertions(+), 6 deletions(-)
Thanks.
2
1
Hi Wolfgang,
please pull this fix into master:
The following changes since commit 9b208ece0a4e040774e24990b7cb6f0ad0ca4cc7:
Wolfgang Denk (1):
Merge branch 'master' of git://git.denx.de/u-boot-mpc85xx
are available in the git repository at:
git://www.denx.de/git/u-boot-cfi-flash.git master
Ladislav Michl (1):
CFI: fix eraseregions numblocks
drivers/mtd/cfi_mtd.c | 35 ++++++++++++++++++-----------------
1 files changed, 18 insertions(+), 17 deletions(-)
Thanks.
2
1
Wolfgang
The following changes since commit 9b208ece0a4e040774e24990b7cb6f0ad0ca4cc7:
Wolfgang Denk (1):
Merge branch 'master' of git://git.denx.de/u-boot-mpc85xx
are available in the git repository at:
git://git.denx.de/u-boot-net.git master
Heiko Schocher (1):
83xx, uec: split enet_interface in two variables
Jens Scharsig (1):
new at91_emac network driver (NET_MULTI api)
Matthias Kaehlcke (2):
cs8900_initialize() cleanup
Add EP93xx ethernet driver
Mike Frysinger (1):
smc91111_eeprom: fix linking error
Nick Thompson (1):
TI: DaVinci: Updating EMAC driver for DM365, DM646x and DA8XX
Peter Tyser (6):
tsec: Force TBI PHY to 1000Mbps full duplex in SGMII mode
tsec: Clean up Broadcom PHY status parsing
tsec: Make functions/data static when possible
tsec: General cleanup
tsec: Add support for using the BCM5482 PHY in fiber mode
tsec: Add TSEC_FIBER flag
Semih Hazar (1):
macb: Fix mii_phy_read and mii_phy_write functions
Seunghyeon Rhee (1):
NET: Fix MAC addr handling for smc911x
README | 10 +
board/atmel/at91rm9200dk/at91rm9200dk.c | 15 +
board/atmel/at91rm9200ek/at91rm9200ek.c | 14 +
board/cmc_pu2/cmc_pu2.c | 13 +
board/csb637/csb637.c | 13 +
board/eukrea/cpuat91/cpuat91.c | 14 +
board/freescale/mpc8360emds/mpc8360emds.c | 3 +-
board/kb9202/kb9202.c | 13 +
board/m501sk/m501sk.c | 14 +
board/mp2usb/mp2usb.c | 13 +
cpu/arm920t/at91rm9200/bcm5221.c | 4 +-
cpu/arm920t/at91rm9200/dm9161.c | 3 +-
drivers/net/Makefile | 2 +
drivers/net/at91_emac.c | 498 +++++++++++++++
drivers/net/cs8900.c | 3 +-
drivers/net/davinci_emac.c | 266 ++++++---
drivers/net/ep93xx_eth.c | 653 ++++++++++++++++++++
drivers/net/ep93xx_eth.h | 144 +++++
drivers/net/macb.c | 110 +---
drivers/net/smc911x.c | 15 +-
drivers/net/tsec.c | 941 ++++++++++++++++-------------
drivers/qe/uec.c | 122 +++--
drivers/qe/uec.h | 34 +-
drivers/qe/uec_phy.c | 84 ++--
examples/standalone/smc91111_eeprom.c | 5 +-
include/asm-arm/arch-at91/at91_emac.h | 145 +++++
include/asm-arm/arch-davinci/emac_defs.h | 59 ++-
include/common.h | 5 +
include/configs/MPC8323ERDB.h | 6 +-
include/configs/MPC832XEMDS.h | 6 +-
include/configs/MPC8360EMDS.h | 6 +-
include/configs/MPC8360ERDK.h | 6 +-
include/configs/MPC8568MDS.h | 6 +-
include/configs/MPC8569MDS.h | 30 +-
include/configs/at91rm9200dk.h | 9 +-
include/configs/at91rm9200ek.h | 8 +-
include/configs/cmc_pu2.h | 8 +-
include/configs/cpuat91.h | 8 +-
include/configs/csb637.h | 8 +-
include/configs/kb9202.h | 8 +-
include/configs/kmeter1.h | 3 +-
include/configs/m501sk.h | 9 +-
include/configs/mp2usb.h | 8 +-
include/netdev.h | 2 +
include/tsec.h | 20 +-
45 files changed, 2602 insertions(+), 764 deletions(-)
create mode 100644 drivers/net/at91_emac.c
create mode 100644 drivers/net/ep93xx_eth.c
create mode 100644 drivers/net/ep93xx_eth.h
create mode 100644 include/asm-arm/arch-at91/at91_emac.h
regards,
Ben
3
3
The following changes since commit 9b208ece0a4e040774e24990b7cb6f0ad0ca4cc7:
Wolfgang Denk (1):
Merge branch 'master' of git://git.denx.de/u-boot-mpc85xx
are available in the git repository at:
git://git.denx.de/u-boot-nand-flash.git master
John Rigby (3):
arm926ejs: add nand_spl boot support
Add MX25 support to nand_spl fsl nfc driver
Nand mxc_nand add v1.1 controller support
Liu Yu (1):
Nand boot: Add nand boot support for MPC8569mds board
Wolfgang Denk (1):
env_nand.c: print error message and fail gracefully
MAKEALL | 1 +
Makefile | 1 +
board/freescale/mpc8569mds/config.mk | 9 +
board/freescale/mpc8569mds/tlb.c | 11 +
common/env_nand.c | 7 +
cpu/arm926ejs/start.S | 42 ++-
drivers/mtd/nand/mxc_nand.c | 617 ++++++++++++++++++++---
include/configs/MPC8569MDS.h | 64 +++-
include/fsl_nfc.h | 86 +++-
nand_spl/board/freescale/mpc8569mds/Makefile | 133 +++++
nand_spl/board/freescale/mpc8569mds/nand_boot.c | 75 +++
nand_spl/nand_boot_fsl_nfc.c | 72 +++-
12 files changed, 1016 insertions(+), 102 deletions(-)
create mode 100644 nand_spl/board/freescale/mpc8569mds/Makefile
create mode 100644 nand_spl/board/freescale/mpc8569mds/nand_boot.c
2
1
Dear Wolfgang,
The following changes since commit 9b208ece0a4e040774e24990b7cb6f0ad0ca4cc7:
Wolfgang Denk (1):
Merge branch 'master' of git://git.denx.de/u-boot-mpc85xx
are available in the git repository at:
git://git.denx.de/u-boot-video.git master
Alessandro Rubini (2):
video: add amba-clcd prime-cell
include/nomadik.h: add physical address for cldc
Anatolij Gustschin (1):
lcd: remove CONFIG_ATMEL_LCD ifdefs from lcd_setfgcolor
common/lcd.c | 8 -----
drivers/video/Makefile | 1 +
drivers/video/amba.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++++
include/amba_clcd.h | 77 ++++++++++++++++++++++++++++++++++++++++++++++
include/nomadik.h | 1 +
5 files changed, 158 insertions(+), 8 deletions(-)
create mode 100644 drivers/video/amba.c
create mode 100644 include/amba_clcd.h
Best regards,
Anatolij
2
1
Fix compile error:
cmd_ximg.c: In function 'do_imgextract':
cmd_ximg.c:234: error: 'i' undeclared (first use in this function)
cmd_ximg.c:234: error: (Each undeclared identifier is reported only once
cmd_ximg.c:234: error: for each function it appears in.)
Signed-off-by: Wolfgang Denk <wd(a)denx.de>
---
common/cmd_ximg.c | 33 +++++++++++++++++++--------------
1 files changed, 19 insertions(+), 14 deletions(-)
diff --git a/common/cmd_ximg.c b/common/cmd_ximg.c
index 3e5fb44..b34c4d0 100644
--- a/common/cmd_ximg.c
+++ b/common/cmd_ximg.c
@@ -225,20 +225,25 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
break;
#if defined(CONFIG_BZIP2)
case IH_COMP_BZIP2:
- printf (" Uncompressing part %d ... ", part);
- /*
- * If we've got less than 4 MB of malloc() space,
- * use slower decompression algorithm which requires
- * at most 2300 KB of memory.
- */
- i = BZ2_bzBuffToBuffDecompress
- ((char*)ntohl(hdr->ih_load),
- &unc_len, (char *)data, len,
- CONFIG_SYS_MALLOC_LEN < (4096 * 1024), 0);
- if (i != BZ_OK) {
- printf ("BUNZIP2 ERROR %d - "
- "image not loaded\n", i);
- return 1;
+ {
+ int i;
+
+ printf (" Uncompressing part %d ... ", part);
+ /*
+ * If we've got less than 4 MB of malloc()
+ * space, use slower decompression algorithm
+ * which requires at most 2300 KB of memory.
+ */
+ i = BZ2_bzBuffToBuffDecompress(
+ (char*)ntohl(hdr->ih_load),
+ &unc_len, (char *)data, len,
+ CONFIG_SYS_MALLOC_LEN < (4096 * 1024),
+ 0);
+ if (i != BZ_OK) {
+ printf ("BUNZIP2 ERROR %d - "
+ "image not loaded\n", i);
+ return 1;
+ }
}
break;
#endif /* CONFIG_BZIP2 */
--
1.6.2.5
1
1

03 Feb '10
From: Vaibhav Hiremath <hvaibhav(a)ti.com>
AM3517 device is high-performance, industrial applications processor designed
and developed keeping Software Compatible with OMAP3 Processors.
Differances :-
===========
- The SDRC controller has been replaced with EMIF4.
- Some new IP's got added like, CAN, VPFE, etc...
- Removed ISP completely
This patch series adds support for AM3517EVM along with EMIF4 configuration.
Tested :-
===========
- OMAP3 EVM (both NAND and MMC boot mode)
- OMAP3 BEAGLE (MMC boot mode)
- AM3517 EVM (both NAND and MMC boot mode)
Below are some of the useful links :-
===========
AM3517 device is high-performance, industrial applications processor designed
and developed keeping Software Compatible with OMAP3 Processors.
Below are some of the useful links -
Migration from OMAP35x to AM35x :-
http://focus.ti.com/lit/an/sprab91/sprab91.pdf
Specs/TRM :-
http://focus.ti.com/docs/prod/folders/print/am3517.html
EVM Link -:
http://www.logicpd.com/products/development-kits/zoom-am3517-experimenter-k…
Vaibhav Hiremath (3):
OMAP3: Consolidate SDRC related operations
AM35x: Add support for AM3517EVM
AM35x: Add support for EMIF4
MAINTAINERS | 4 +
Makefile | 3 +
board/ti/am3517evm/Makefile | 47 ++++
board/ti/am3517evm/am3517evm.c | 76 ++++++
board/ti/am3517evm/am3517evm.h | 400 ++++++++++++++++++++++++++++++++
board/ti/am3517evm/config.mk | 29 +++
cpu/arm_cortexa8/omap3/Makefile | 6 +
cpu/arm_cortexa8/omap3/board.c | 34 +---
cpu/arm_cortexa8/omap3/emif4.c | 160 +++++++++++++
cpu/arm_cortexa8/omap3/mem.c | 90 -------
cpu/arm_cortexa8/omap3/sdrc.c | 186 +++++++++++++++
cpu/arm_cortexa8/omap3/sys_info.c | 42 +----
include/asm-arm/arch-omap3/cpu.h | 26 ++
include/asm-arm/arch-omap3/emif4.h | 77 ++++++
include/asm-arm/arch-omap3/mem.h | 24 ++
include/asm-arm/arch-omap3/mux.h | 35 +++
include/asm-arm/arch-omap3/sys_proto.h | 7 +-
include/configs/am3517_evm.h | 293 +++++++++++++++++++++++
include/configs/omap3_beagle.h | 2 +
include/configs/omap3_evm.h | 2 +
include/configs/omap3_overo.h | 2 +
include/configs/omap3_pandora.h | 2 +
include/configs/omap3_sdp3430.h | 2 +
include/configs/omap3_zoom1.h | 2 +
include/configs/omap3_zoom2.h | 2 +
25 files changed, 1387 insertions(+), 166 deletions(-)
create mode 100644 board/ti/am3517evm/Makefile
create mode 100644 board/ti/am3517evm/am3517evm.c
create mode 100644 board/ti/am3517evm/am3517evm.h
create mode 100644 board/ti/am3517evm/config.mk
create mode 100644 cpu/arm_cortexa8/omap3/emif4.c
create mode 100644 cpu/arm_cortexa8/omap3/sdrc.c
create mode 100644 include/asm-arm/arch-omap3/emif4.h
create mode 100644 include/configs/am3517_evm.h
3
3

[U-Boot] unassigned-patches/51: [PATCH] S5PC100: Moved the #defines for PLLs to common header file
by u-bootï¼ bugs.denx.de 03 Feb '10
by u-bootï¼ bugs.denx.de 03 Feb '10
03 Feb '10
The get_pll_clk(int) API returns the PLL frequency based on
the (int) argument which is defined locally in clock.c
Moving that #define to common header file (clk.h) would
be helpful when using the API from other files.
Signed-off-by: Naveen Krishna Ch <ch.naveen(a)samsung.com>
---
Added to GNATS database as unassigned-patches/51
>Responsible: patch-coord
>Message-Id: <1265200544-26547-1-git-send-email-ch.naveen(a)samsung.com>
>In-Reply-To:
>References:
>Patch-Date: Wed Feb 03 13:35:44 +0100 2010
---
cpu/arm_cortexa8/s5pc1xx/clock.c | 7 +------
include/asm-arm/arch-s5pc1xx/clk.h | 6 ++++++
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/cpu/arm_cortexa8/s5pc1xx/clock.c b/cpu/arm_cortexa8/s5pc1xx/clock.c
index a9e78dd..19619f9 100644
--- a/cpu/arm_cortexa8/s5pc1xx/clock.c
+++ b/cpu/arm_cortexa8/s5pc1xx/clock.c
@@ -25,12 +25,7 @@
#include <common.h>
#include <asm/io.h>
#include <asm/arch/clock.h>
-
-#define APLL 0
-#define MPLL 1
-#define EPLL 2
-#define HPLL 3
-#define VPLL 4
+#include <asm/arch/clk.h>
#define CLK_M 0
#define CLK_D 1
diff --git a/include/asm-arm/arch-s5pc1xx/clk.h b/include/asm-arm/arch-s5pc1xx/clk.h
index f1aa44f..3e59abe 100644
--- a/include/asm-arm/arch-s5pc1xx/clk.h
+++ b/include/asm-arm/arch-s5pc1xx/clk.h
@@ -23,6 +23,12 @@
#ifndef __ASM_ARM_ARCH_CLK_H_
#define __ASM_ARM_ARCH_CLK_H_
+#define APLL 0
+#define MPLL 1
+#define EPLL 2
+#define HPLL 3
+#define VPLL 4
+
void s5pc1xx_clock_init(void);
extern unsigned long (*get_pll_clk)(int pllreg);
--
1.6.6
1
0

03 Feb '10
This patch fixes building for AR405 boards by remove an unused feature.
Signed-off-by: Matthias Fuchs <matthias.fuchs(a)esd.eu>
---
include/configs/AR405.h | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/include/configs/AR405.h b/include/configs/AR405.h
index 73e34bd..52ead43 100644
--- a/include/configs/AR405.h
+++ b/include/configs/AR405.h
@@ -93,6 +93,7 @@
#define CONFIG_CMD_IRQ
#define CONFIG_CMD_ELF
#define CONFIG_CMD_MII
+#undef CONFIG_CMD_NFS
#define CONFIG_CMD_PING
#define CONFIG_CMD_BSP
--
1.6.1
2
1
The init_coupler() function from board/esd/plu405/plu405.c
got lost somehow! This patch readds it.
Signed-off-by: Matthias Fuchs <matthias.fuchs(a)esd.eu>
---
board/esd/plu405/plu405.c | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/board/esd/plu405/plu405.c b/board/esd/plu405/plu405.c
index e385a78..0f7fa69 100644
--- a/board/esd/plu405/plu405.c
+++ b/board/esd/plu405/plu405.c
@@ -46,6 +46,34 @@ const unsigned char fpgadata[] =
*/
#include "../common/fpga.c"
+/*
+ * generate a short spike on the CAN tx line
+ * to bring the couplers in sync
+ */
+void init_coupler(u32 addr)
+{
+ struct sja1000_basic_s *ctrl = (struct sja1000_basic_s *)addr;
+
+ /* reset */
+ out_8(&ctrl->cr, CR_RR);
+
+ /* dominant */
+ out_8(&ctrl->btr0, 0x00); /* btr setup is required */
+ out_8(&ctrl->btr1, 0x14); /* we use 1Mbit/s */
+ out_8(&ctrl->oc, OC_TP1 | OC_TN1 | OC_POL1 |
+ OC_TP0 | OC_TN0 | OC_POL0 | OC_MODE1);
+ out_8(&ctrl->cr, 0x00);
+
+ /* delay */
+ in_8(&ctrl->cr);
+ in_8(&ctrl->cr);
+ in_8(&ctrl->cr);
+ in_8(&ctrl->cr);
+
+ /* reset */
+ out_8(&ctrl->cr, CR_RR);
+}
+
int board_early_init_f(void)
{
/*
--
1.6.1
2
1
Remove some unused features and default environment variable
to shrink the PMC440 u-boot.
Signed-off-by: Matthias Fuchs <matthias.fuchs(a)esd.eu>
---
include/configs/PMC440.h | 6 ------
1 files changed, 0 insertions(+), 6 deletions(-)
diff --git a/include/configs/PMC440.h b/include/configs/PMC440.h
index 6310cfc..89799af 100644
--- a/include/configs/PMC440.h
+++ b/include/configs/PMC440.h
@@ -287,12 +287,8 @@
"addtty=setenv bootargs ${bootargs} console=ttyS0,${baudrate}\0" \
"addmisc=setenv bootargs ${bootargs} mem=${mem}\0" \
"nandargs=setenv bootargs root=/dev/mtdblock6 rootfstype=jffs2 rw\0" \
- "nand_boot=run nandargs addip addtty addmisc;bootm ${kernel_addr}\0" \
"nand_boot_fdt=run nandargs addip addtty addmisc;" \
"bootm ${kernel_addr} - ${fdt_addr}\0" \
- "net_nfs=tftp ${kernel_addr_r} ${bootfile};" \
- "run nfsargs addip addtty addmisc;" \
- "bootm\0" \
"net_nfs_fdt=tftp ${kernel_addr_r} ${bootfile};" \
"tftp ${fdt_addr_r} ${fdt_file};" \
"run nfsargs addip addtty addmisc;" \
@@ -353,7 +349,6 @@
#define CONFIG_CMD_DATE
#define CONFIG_CMD_DHCP
#define CONFIG_CMD_DTT
-#define CONFIG_CMD_DIAG
#define CONFIG_CMD_EEPROM
#define CONFIG_CMD_ELF
#define CONFIG_CMD_FAT
@@ -366,7 +361,6 @@
#define CONFIG_CMD_PING
#define CONFIG_CMD_USB
#define CONFIG_CMD_REGINFO
-#define CONFIG_CMD_SDRAM
/* POST support */
#define CONFIG_POST (CONFIG_SYS_POST_MEMORY | \
--
1.6.1
2
1
Recently this compilation error occurs:
Configuring for ML2 board...
traps.c: In function 'MachineCheckException':
traps.c:159: error: 'debugger_exception_handler' undeclared (first use
in this function)
traps.c:159: error: (Each undeclared identifier is reported only once
traps.c:159: error: for each function it appears in.)
This patch now fixes it by including kgdb.h
Signed-off-by: Stefan Roese <sr(a)denx.de>
---
cpu/ppc4xx/traps.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/cpu/ppc4xx/traps.c b/cpu/ppc4xx/traps.c
index cb35faf..42e4221 100644
--- a/cpu/ppc4xx/traps.c
+++ b/cpu/ppc4xx/traps.c
@@ -34,6 +34,7 @@
#include <common.h>
#include <command.h>
+#include <kgdb.h>
#include <asm/processor.h>
DECLARE_GLOBAL_DATA_PTR;
--
1.6.6.1
1
1
Hi,
I'm using u-boot for a while now for my AVR (ap7000) project and while happy
with it as a developer tool I wonder how I can make it useful for end-user
firmware upgrades.
The way I think about it is that end-user can never be allowed to interact
directly with u-boot. It's something I don't want and the users of my devices
also. Unfortunately I can't find anything yet to how I can make it easy for my
end-users to upgrade firmware of the device.
I have only ethernet and USB available to end-users :
1) Using USB : This is easy for end-users because it doesn't depend on network
configuration. Unfortunately there's no USB support in u-boot (at least not for
my CPU). I found something at openmoko which may be suitable, but no other
valid solutions so far.
2) Ethernet : No idea how to do this in an easy way. If it can be done, I'd be
happy to hear about it.
Either way, I have no clue if there are any options in u-boot available
already to do what I want or must I implement this from scratch ?
Best regards,
Marcel
2
3

02 Feb '10
This patch adds support for esd gmbh OTC570 board.
The OTC570 is based on an Atmel AT91SAM9263 SoC.
Signed-off-by: Daniel Gorsulowski <Daniel.Gorsulowski(a)esd.eu>
---
MAINTAINERS | 1 +
MAKEALL | 1 +
Makefile | 3 +
board/esd/otc570/Makefile | 55 ++++++
board/esd/otc570/config.mk | 1 +
board/esd/otc570/otc570.c | 429 ++++++++++++++++++++++++++++++++++++++++++
board/esd/otc570/partition.c | 37 ++++
include/configs/otc570.h | 247 ++++++++++++++++++++++++
tools/Makefile | 3 +
tools/logos/esd.bmp | Bin 0 -> 35078 bytes
10 files changed, 777 insertions(+), 0 deletions(-)
create mode 100644 board/esd/otc570/Makefile
create mode 100644 board/esd/otc570/config.mk
create mode 100644 board/esd/otc570/otc570.c
create mode 100644 board/esd/otc570/partition.c
create mode 100644 include/configs/otc570.h
create mode 100644 tools/logos/esd.bmp
diff --git a/MAINTAINERS b/MAINTAINERS
index e8ba4bc..0c2b1b1 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -574,6 +574,7 @@ Peter Figuli <peposh(a)etc.sk>
Daniel Gorsulowski <daniel.gorsulowski(a)esd.eu>
meesc ARM926EJS (AT91SAM9263 SoC)
+ otc570 ARM926EJS (AT91SAM9263 SoC)
Sedji Gaouaou<sedji.gaouaou(a)atmel.com>
at91sam9g10ek ARM926EJS (AT91SAM9G10 SoC)
diff --git a/MAKEALL b/MAKEALL
index dd635bd..eefd3dd 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -654,6 +654,7 @@ LIST_at91=" \
meesc \
mp2usb \
m501sk \
+ otc570 \
pm9261 \
pm9263 \
SBC35_A9G20 \
diff --git a/Makefile b/Makefile
index 1ab197b..5fda1b9 100644
--- a/Makefile
+++ b/Makefile
@@ -2862,6 +2862,9 @@ at91sam9g45ekes_config : unconfig
fi;
@$(MKCONFIG) -a at91sam9m10g45ek arm arm926ejs at91sam9m10g45ek atmel at91
+otc570_config : unconfig
+ @$(MKCONFIG) $(@:_config=) arm arm926ejs otc570 esd at91
+
pm9263_config : unconfig
@$(MKCONFIG) $(@:_config=) arm arm926ejs pm9263 ronetix at91
diff --git a/board/esd/otc570/Makefile b/board/esd/otc570/Makefile
new file mode 100644
index 0000000..755c5ee
--- /dev/null
+++ b/board/esd/otc570/Makefile
@@ -0,0 +1,55 @@
+#
+# (C) Copyright 2003-2008
+# Wolfgang Denk, DENX Software Engineering, wd(a)denx.de.
+#
+# (C) Copyright 2008
+# Stelian Pop <stelian.pop(a)leadtechdesign.com>
+# Lead Tech Design <www.leadtechdesign.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 $(TOPDIR)/config.mk
+
+LIB = $(obj)lib$(BOARD).a
+
+COBJS-y += $(BOARD).o
+COBJS-$(CONFIG_HAS_DATAFLASH) += partition.o
+
+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/esd/otc570/config.mk b/board/esd/otc570/config.mk
new file mode 100644
index 0000000..ff2cfd1
--- /dev/null
+++ b/board/esd/otc570/config.mk
@@ -0,0 +1 @@
+TEXT_BASE = 0x23f00000
diff --git a/board/esd/otc570/otc570.c b/board/esd/otc570/otc570.c
new file mode 100644
index 0000000..fee27ca
--- /dev/null
+++ b/board/esd/otc570/otc570.c
@@ -0,0 +1,429 @@
+/*
+ * (C) Copyright 2007-2008
+ * Stelian Pop <stelian.pop(a)leadtechdesign.com>
+ * Lead Tech Design <www.leadtechdesign.com>
+ *
+ * (C) Copyright 2010
+ * Daniel Gorsulowski <daniel.gorsulowski(a)esd.eu>
+ * esd electronic system design gmbh <www.esd.eu>
+ *
+ * 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/at91sam9263.h>
+#include <asm/arch/at91sam9_matrix.h>
+#include <asm/arch/at91sam9_smc.h>
+#include <asm/arch/at91_common.h>
+#include <asm/arch/at91_pmc.h>
+#include <asm/arch/at91_rstc.h>
+#include <asm/arch/clk.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/hardware.h>
+#include <asm/arch/io.h>
+#include <atmel_lcdc.h>
+#include <lcd.h>
+#include <netdev.h>
+#ifdef CONFIG_LCD_INFO
+#include <nand.h>
+#include <version.h>
+#endif
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/*
+ * Miscelaneous platform dependent initialisations
+ */
+
+static int hw_rev = -1; /* hardware revision */
+
+int get_hw_rev(void)
+{
+ if (hw_rev >= 0)
+ return hw_rev;
+
+ hw_rev = at91_get_gpio_value(AT91_PIN_PB19);
+ hw_rev |= at91_get_gpio_value(AT91_PIN_PB20) << 1;
+ hw_rev |= at91_get_gpio_value(AT91_PIN_PB21) << 2;
+ hw_rev |= at91_get_gpio_value(AT91_PIN_PB22) << 3;
+
+ if (hw_rev == 15)
+ hw_rev = 0;
+
+ return hw_rev;
+}
+
+#ifdef CONFIG_CMD_NAND
+static void otc570_nand_hw_init(void)
+{
+ unsigned long csa;
+
+ /* Enable CS3 */
+ csa = at91_sys_read(AT91_MATRIX_EBI0CSA);
+ at91_sys_write(AT91_MATRIX_EBI0CSA,
+ csa | AT91_MATRIX_EBI0_CS3A_SMC_SMARTMEDIA);
+
+ /* Configure SMC CS3 for NAND/SmartMedia */
+ at91_sys_write(AT91_SMC_SETUP(3),
+ AT91_SMC_NWESETUP_(1) | AT91_SMC_NCS_WRSETUP_(0) |
+ AT91_SMC_NRDSETUP_(1) | AT91_SMC_NCS_RDSETUP_(0));
+ at91_sys_write(AT91_SMC_PULSE(3),
+ AT91_SMC_NWEPULSE_(3) | AT91_SMC_NCS_WRPULSE_(3) |
+ AT91_SMC_NRDPULSE_(3) | AT91_SMC_NCS_RDPULSE_(3));
+ at91_sys_write(AT91_SMC_CYCLE(3),
+ AT91_SMC_NWECYCLE_(5) | AT91_SMC_NRDCYCLE_(5));
+ at91_sys_write(AT91_SMC_MODE(3),
+ AT91_SMC_READMODE | AT91_SMC_WRITEMODE |
+ AT91_SMC_EXNWMODE_DISABLE |
+#ifdef CONFIG_SYS_NAND_DBW_16
+ AT91_SMC_DBW_16 |
+#else /* CONFIG_SYS_NAND_DBW_8 */
+ AT91_SMC_DBW_8 |
+#endif
+ AT91_SMC_TDF_(2));
+
+ /* Configure RDY/BSY */
+ at91_set_gpio_input(CONFIG_SYS_NAND_READY_PIN, 1);
+
+ /* Enable NandFlash */
+ at91_set_gpio_output(CONFIG_SYS_NAND_ENABLE_PIN, 1);
+}
+#endif /* CONFIG_CMD_NAND */
+
+#ifdef CONFIG_MACB
+static void otc570_macb_hw_init(void)
+{
+ /* Enable clock */
+ at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_EMAC);
+ at91_macb_hw_init();
+}
+#endif
+
+/*
+ * Static memory controller initialization to enable Beckhoff ET1100 EtherCAT
+ * controller debugging
+ * The ET1100 is located at physical address 0x70000000
+ * Its process memory is located at physical address 0x70001000
+ */
+static void otc570_ethercat_hw_init(void)
+{
+ /* Configure SMC EBI1_CS0 for EtherCAT */
+ at91_sys_write(AT91_SMC1_SETUP(0),
+ AT91_SMC_NWESETUP_(0) | AT91_SMC_NCS_WRSETUP_(0) |
+ AT91_SMC_NRDSETUP_(0) | AT91_SMC_NCS_RDSETUP_(0));
+ at91_sys_write(AT91_SMC1_PULSE(0),
+ AT91_SMC_NWEPULSE_(4) | AT91_SMC_NCS_WRPULSE_(9) |
+ AT91_SMC_NRDPULSE_(5) | AT91_SMC_NCS_RDPULSE_(9));
+ at91_sys_write(AT91_SMC1_CYCLE(0),
+ AT91_SMC_NWECYCLE_(10) | AT91_SMC_NRDCYCLE_(6));
+ /*
+ * Configure behavior at external wait signal, byte-select mode, 16 bit
+ * data bus width, none data float wait states and TDF optimization
+ */
+ at91_sys_write(AT91_SMC1_MODE(0),
+ AT91_SMC_READMODE | AT91_SMC_EXNWMODE_READY |
+ AT91_SMC_BAT_SELECT | AT91_SMC_DBW_16 | AT91_SMC_TDF_(0) |
+ AT91_SMC_TDFMODE);
+
+ /* Configure RDY/BSY */
+ at91_set_B_periph(AT91_PIN_PE20, 0); /* EBI1_NWAIT */
+}
+
+#ifdef CONFIG_LCD
+/* Number of columns and rows, pixel clock in Hz and hsync/vsync polarity */
+vidinfo_t panel_info = {
+ vl_col: 640,
+ vl_row: 480,
+ vl_clk: 25175000,
+ vl_sync: ATMEL_LCDC_INVLINE_INVERTED |
+ ATMEL_LCDC_INVFRAME_INVERTED,
+
+ vl_bpix: 3, /* Bits per pixel, 0 = 1bit, 3 = 8bit */
+ vl_tft: 1, /* 0 = passive, 1 = TFT */
+ vl_vsync_len: 1, /* Length of vertical sync in number of lines */
+ vl_upper_margin:35, /* Idle lines at the beginning of the frame */
+ vl_lower_margin:5, /* Idle lines at the end of the frame */
+ vl_hsync_len: 5, /* Width of the LCDHSYNC pulse */
+ vl_left_margin: 112, /* Idle cycles at the beginning of the line */
+ vl_right_margin:1, /* Idle cycles at the end of the line */
+
+ mmio: AT91SAM9263_LCDC_BASE, /* Memory mapped registers */
+};
+
+void lcd_enable(void)
+{
+ at91_set_gpio_value(AT91_PIN_PA30, 0); /* power up */
+}
+
+void lcd_disable(void)
+{
+ at91_set_gpio_value(AT91_PIN_PA30, 1); /* power down */
+}
+
+static void otc570_lcd_hw_init(void)
+{
+ at91_set_A_periph(AT91_PIN_PC0, 0); /* LCDVSYNC */
+ at91_set_A_periph(AT91_PIN_PC1, 0); /* LCDHSYNC */
+ at91_set_A_periph(AT91_PIN_PC2, 0); /* LCDDOTCK */
+ at91_set_A_periph(AT91_PIN_PC3, 0); /* LCDDEN */
+ at91_set_B_periph(AT91_PIN_PB9, 0); /* LCDCC */
+ at91_set_A_periph(AT91_PIN_PC6, 0); /* LCDD2 */
+ at91_set_A_periph(AT91_PIN_PC7, 0); /* LCDD3 */
+ at91_set_A_periph(AT91_PIN_PC8, 0); /* LCDD4 */
+ at91_set_A_periph(AT91_PIN_PC9, 0); /* LCDD5 */
+ at91_set_A_periph(AT91_PIN_PC10, 0); /* LCDD6 */
+ at91_set_A_periph(AT91_PIN_PC11, 0); /* LCDD7 */
+ at91_set_A_periph(AT91_PIN_PC14, 0); /* LCDD10 */
+ at91_set_A_periph(AT91_PIN_PC15, 0); /* LCDD11 */
+ at91_set_A_periph(AT91_PIN_PC16, 0); /* LCDD12 */
+ at91_set_B_periph(AT91_PIN_PC12, 0); /* LCDD13 */
+ at91_set_A_periph(AT91_PIN_PC18, 0); /* LCDD14 */
+ at91_set_A_periph(AT91_PIN_PC19, 0); /* LCDD15 */
+ at91_set_A_periph(AT91_PIN_PC22, 0); /* LCDD18 */
+ at91_set_A_periph(AT91_PIN_PC23, 0); /* LCDD19 */
+ at91_set_A_periph(AT91_PIN_PC24, 0); /* LCDD20 */
+ at91_set_B_periph(AT91_PIN_PC17, 0); /* LCDD21 */
+ at91_set_A_periph(AT91_PIN_PC26, 0); /* LCDD22 */
+ at91_set_A_periph(AT91_PIN_PC27, 0); /* LCDD23 */
+ at91_set_gpio_output(AT91_PIN_PA30, 1); /* PCI */
+
+ at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_LCDC);
+
+#ifndef CONFIG_FB_TO_SDRAM
+ gd->fb_base = AT91SAM9263_SRAM0_BASE;
+#endif
+}
+
+#ifdef CONFIG_LCD_INFO
+void lcd_show_board_info(void)
+{
+ ulong dram_size, nand_size;
+ int i;
+ char temp[32];
+
+ dram_size = 0;
+ for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++)
+ dram_size += gd->bd->bi_dram[i].size;
+ nand_size = 0;
+ for (i = 0; i < CONFIG_SYS_MAX_NAND_DEVICE; i++)
+ nand_size += nand_info[i].size;
+
+ lcd_printf("\n%s\n", U_BOOT_VERSION);
+ lcd_printf("%s CPU at %s MHz\n", AT91_CPU_NAME,
+ strmhz(temp, get_cpu_clk_rate()));
+ lcd_printf(" %ld MB SDRAM, %ld MB NAND\n",
+ dram_size >> 20,
+ nand_size >> 20 );
+ lcd_printf(" Board : esd ARM9 HMI Panel - OTC570\n");
+ lcd_printf(" Hardware-revision: 1.%d\n", get_hw_rev());
+ lcd_printf(" Mach-type : %lu\n", gd->bd->bi_arch_number);
+}
+#endif /* CONFIG_LCD_INFO */
+#endif /* CONFIG_LCD */
+
+int dram_init(void)
+{
+ gd->bd->bi_dram[0].start = PHYS_SDRAM;
+ gd->bd->bi_dram[0].size = get_ram_size((long *) PHYS_SDRAM, (1 << 27));
+ return 0;
+}
+
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+#ifdef CONFIG_MACB
+ rc = macb_eth_initialize(0, (void *)AT91SAM9263_BASE_EMAC, 0x00);
+#endif
+ return rc;
+}
+
+int checkboard(void)
+{
+ char str[32];
+
+ puts("Board: esd ARM9 HMI Panel - OTC570");
+ if (getenv_r("serial#", str, sizeof(str)) > 0) {
+ puts(", serial# ");
+ puts(str);
+ }
+ printf("\nHardware-revision: 1.%d\n", get_hw_rev());
+ printf("Mach-type: %lu\n", gd->bd->bi_arch_number);
+ return 0;
+}
+
+#ifdef CONFIG_SERIAL_TAG
+void get_board_serial(struct tag_serialnr *serialnr)
+{
+ char *str;
+
+ char *serial = getenv("serial#");
+ if (serial) {
+ str = strchr(serial, '_');
+ if (str && (strlen(str) >= 4)) {
+ serialnr->high = (*(str + 1) << 8) | *(str + 2);
+ serialnr->low = simple_strtoul(str + 3, NULL, 16);
+ }
+ } else {
+ serialnr->high = 0;
+ serialnr->low = 0;
+ }
+}
+#endif
+
+#ifdef CONFIG_REVISION_TAG
+u32 get_board_rev(void)
+{
+ return hw_rev | 0x100;
+}
+#endif
+
+#ifdef CONFIG_MISC_INIT_R
+int misc_init_r(void)
+{
+ char str[64];
+
+ at91_set_gpio_output(AT91_PIN_PA29, 1);
+ at91_set_A_periph(AT91_PIN_PA26, 1); /* TXD0 */
+ at91_set_A_periph(AT91_PIN_PA27, 0); /* RXD0 */
+ at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_US0);
+ /* Set USART_MODE = 1 (RS485) */
+ at91_sys_write((0xFFF8C004 - AT91_BASE_SYS), 1);
+
+ puts("USART0: ");
+
+ if (getenv_r("usart0", str, sizeof(str)) == -1) {
+ puts("No entry - assuming 1-wire\n");
+ /* CTS pin, works as mode select pin (0 = 1-wire; 1 = RS485) */
+ at91_set_gpio_output(AT91_PIN_PA29, 0);
+ } else {
+ if (strcmp(str, "1-wire") == 0) {
+ printf("%s\n", str);
+ at91_set_gpio_output(AT91_PIN_PA29, 0);
+ } else if (strcmp(str, "rs485") == 0) {
+ printf("%s\n", str);
+ at91_set_gpio_output(AT91_PIN_PA29, 1);
+ } else {
+ puts("Wrong entry - assuming 1-wire ");
+ puts("(valid values are '1-wire' or 'rs485')\n");
+ at91_set_gpio_output(AT91_PIN_PA29, 0);
+ }
+ }
+ printf("Display memory address: 0x%08lX\n", gd->fb_base);
+
+ return 0;
+}
+#endif /* CONFIG_MISC_INIT_R */
+
+int board_init(void)
+{
+ /* Peripheral Clock Enable Register */
+ at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_PIOA |
+ 1 << AT91SAM9263_ID_PIOB |
+ 1 << AT91SAM9263_ID_PIOCDE |
+ 1 << AT91SAM9263_ID_TWI |
+ 1 << AT91SAM9263_ID_SPI0 |
+ 1 << AT91SAM9263_ID_LCDC |
+ 1 << AT91SAM9263_ID_UHP);
+
+ /* arch number of OTC570-Board */
+ gd->bd->bi_arch_number = MACH_TYPE_OTC570;
+
+ /* adress of boot parameters */
+ gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
+
+ at91_serial_hw_init();
+#ifdef CONFIG_CMD_NAND
+ otc570_nand_hw_init();
+#endif
+ otc570_ethercat_hw_init();
+#ifdef CONFIG_HAS_DATAFLASH
+ at91_spi0_hw_init(1 << 0);
+#endif
+#ifdef CONFIG_MACB
+ otc570_macb_hw_init();
+#endif
+#ifdef CONFIG_AT91_CAN
+ at91_can_hw_init();
+#endif
+#ifdef CONFIG_USB_OHCI_NEW
+ at91_uhp_hw_init();
+#endif
+#ifdef CONFIG_LCD
+ otc570_lcd_hw_init();
+#endif
+ return 0;
+}
+
+/*
+ * U-Boot commands
+ */
+
+/* Set brightness */
+int do_blbright(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+ unsigned long value = 0xff;
+
+ if (argc > 1) {
+ value = simple_strtoul(argv[1], NULL, 0);
+ if ((value >= 0) && (value <= 255)) {
+ printf("Writing value %02lX ...", value);
+ __raw_writel(value, (panel_info.mmio +
+ ATMEL_LCDC_CONTRAST_VAL));
+ puts("done\n");
+ } else {
+ puts("Invalid value! ");
+ puts("Valid values are 0 ... 255 or 0x0 ... 0xFF\n");
+ return -1;
+ }
+ } else {
+ puts("No value given! ");
+ puts("Valid values are 0 ... 255 or 0x0 ... 0xFF\n");
+ return -1;
+ }
+ return 0;
+}
+U_BOOT_CMD(
+ blbright, 2, 1, do_blbright,
+ "sets display brightness",
+ "\n"
+);
+
+/* Switch backlight power */
+int do_blpower(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+ int i = 0;
+ if (argc > 1) {
+ i = argv[1][0] == '0';
+ if (i) {
+ puts("Switching backlight off... ");
+ lcd_disable();
+ } else {
+ puts("Switching backlight on... ");
+ lcd_enable();
+ }
+ puts("done\n");
+ } else
+ puts("No value given!\n");
+ return 0;
+}
+U_BOOT_CMD(
+ blpower, 2, 1, do_blpower,
+ "switches display-backlight on or off",
+ "\n"
+);
diff --git a/board/esd/otc570/partition.c b/board/esd/otc570/partition.c
new file mode 100644
index 0000000..df0e1db
--- /dev/null
+++ b/board/esd/otc570/partition.c
@@ -0,0 +1,37 @@
+/*
+ * (C) Copyright 2008
+ * Ulf Samuelsson <ulf(a)atmel.com>
+ *
+ * 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 */
+};
+
+/* 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"},
+};
diff --git a/include/configs/otc570.h b/include/configs/otc570.h
new file mode 100644
index 0000000..bb04abd
--- /dev/null
+++ b/include/configs/otc570.h
@@ -0,0 +1,247 @@
+/*
+ * (C) Copyright 2007-2008
+ * Stelian Pop <stelian.pop(a)leadtechdesign.com>
+ * Lead Tech Design <www.leadtechdesign.com>
+ *
+ * (C) Copyright 2009
+ * Daniel Gorsulowski <daniel.gorsulowski(a)esd.eu>
+ * esd electronic system design gmbh <www.esd.eu>
+ *
+ * Configuation settings for the esd OTC570 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
+
+/* Common stuff */
+#define CONFIG_SYS_HZ 1000 /* decrementer freq */
+#define CONFIG_OTC570 1 /* Board is esd OTC570 */
+#define CONFIG_ARM926EJS 1 /* This is an ARM926EJS Core */
+#define CONFIG_AT91SAM9263 1 /* It's an AT91SAM9263 SoC */
+#define CONFIG_DISPLAY_BOARDINFO 1
+#define CONFIG_DISPLAY_CPUINFO 1 /* display cpu info and speed */
+#define CONFIG_PREBOOT /* enable preboot variable */
+#define CONFIG_CMDLINE_TAG 1 /* enable passing of ATAGs */
+#define CONFIG_SETUP_MEMORY_TAGS 1
+#define CONFIG_INITRD_TAG 1
+#define CONFIG_SERIAL_TAG 1
+#define CONFIG_REVISION_TAG 1
+#undef CONFIG_USE_IRQ /* don't need IRQ/FIQ stuff */
+
+#define CONFIG_SKIP_LOWLEVEL_INIT
+#define CONFIG_SKIP_RELOCATE_UBOOT
+#define CONFIG_MISC_INIT_R 1 /* Call misc_init_r */
+
+#define CONFIG_ARCH_CPU_INIT
+
+/*
+ * Hardware drivers
+ */
+
+/* Console output */
+#define CONFIG_ATMEL_USART 1
+#undef CONFIG_USART0
+#undef CONFIG_USART1
+#undef CONFIG_USART2
+#define CONFIG_USART3 1 /* USART 3 is DBGU */
+
+#define CONFIG_BOOTDELAY 3
+#define CONFIG_ZERO_BOOTDELAY_CHECK 1
+
+/* LCD */
+#define CONFIG_LCD 1
+#define LCD_BPP LCD_COLOR8
+
+#undef CONFIG_SPLASH_SCREEN
+
+#ifndef CONFIG_SPLASH_SCREEN
+#define CONFIG_LCD_LOGO 1
+#define CONFIG_LCD_INFO 1
+#undef CONFIG_LCD_INFO_BELOW_LOGO
+#endif /* CONFIG_SPLASH_SCREEN */
+
+#undef LCD_TEST_PATTERN
+#define CONFIG_SYS_WHITE_ON_BLACK 1
+#define CONFIG_ATMEL_LCD 1
+#define CONFIG_SYS_CONSOLE_IS_IN_ENV 1
+#define CONFIG_FB_TO_SDRAM 1
+#define CONFIG_CMD_BMP 1
+
+/* RTC and I2C stuff */
+#define CONFIG_RTC_DS1338 1
+#define CONFIG_SYS_I2C_RTC_ADDR 0x68
+#undef CONFIG_HARD_I2C
+#define CONFIG_SOFT_I2C 1
+#define CONFIG_SYS_I2C_SPEED 100000
+#define CONFIG_SYS_I2C_SLAVE 0x7F
+
+#ifdef CONFIG_SOFT_I2C
+#define CONFIG_I2C_CMD_TREE 1
+#define CONFIG_I2C_MULTI_BUS 1
+/* Enable peripheral clock and configure data and clock pins for pio */
+#define I2C_INIT { \
+ at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_PIOB | \
+ 1 << AT91SAM9263_ID_PIOCDE); \
+ at91_set_gpio_output(AT91_PIN_PB4, 0); \
+ at91_set_gpio_output(AT91_PIN_PB5, 0); \
+}
+/* Configure data pin as output */
+#define I2C_ACTIVE at91_set_gpio_output(AT91_PIN_PB4, 0)
+/* Configure data pin as input */
+#define I2C_TRISTATE at91_set_gpio_input(AT91_PIN_PB4, 0)
+/* Read data pin */
+#define I2C_READ at91_get_gpio_value(AT91_PIN_PB4)
+/* Set data pin */
+#define I2C_SDA(bit) at91_set_gpio_value(AT91_PIN_PB4, bit)
+/* Set clock pin */
+#define I2C_SCL(bit) at91_set_gpio_value(AT91_PIN_PB5, bit)
+#define I2C_DELAY udelay(2) /* 1/4 I2C clock duration */
+#endif /* CONFIG_SOFT_I2C */
+
+#define CONFIG_BOOTDELAY 3
+#define CONFIG_ZERO_BOOTDELAY_CHECK 1
+
+/*
+ * BOOTP options
+ */
+#define CONFIG_BOOTP_BOOTFILESIZE 1
+#define CONFIG_BOOTP_BOOTPATH 1
+#define CONFIG_BOOTP_GATEWAY 1
+#define CONFIG_BOOTP_HOSTNAME 1
+
+/*
+ * Command line configuration.
+ */
+#include <config_cmd_default.h>
+#undef CONFIG_CMD_BDI
+#undef CONFIG_CMD_AUTOSCRIPT
+#undef CONFIG_CMD_FPGA
+#undef CONFIG_CMD_LOADS
+#undef CONFIG_CMD_IMLS
+
+#define CONFIG_CMD_PING 1
+#define CONFIG_CMD_DHCP 1
+#define CONFIG_CMD_NAND 1
+#define CONFIG_CMD_USB 1
+#define CONFIG_CMD_I2C 1
+#define CONFIG_CMD_DATE 1
+
+/* LED */
+#define CONFIG_AT91_LED 1
+
+/* SDRAM */
+#define CONFIG_NR_DRAM_BANKS 1
+#define PHYS_SDRAM 0x20000000
+
+/* 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
+#define CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 0xC0000000 /* CS0 */
+#define AT91_SPI_CLK 15000000
+#define DATAFLASH_TCSS (0x1a << 16)
+#define DATAFLASH_TCHS (0x1 << 24)
+
+/* NOR flash is not populated, disable it */
+#define CONFIG_SYS_NO_FLASH 1
+
+/* NAND flash */
+#ifdef CONFIG_CMD_NAND
+#define CONFIG_NAND_ATMEL
+#define CONFIG_SYS_MAX_NAND_DEVICE 1
+#define CONFIG_SYS_NAND_BASE 0x40000000
+#define CONFIG_SYS_NAND_DBW_8 1
+/* our ALE is AD21 */
+#define CONFIG_SYS_NAND_MASK_ALE (1 << 21)
+/* our CLE is AD22 */
+#define CONFIG_SYS_NAND_MASK_CLE (1 << 22)
+#define CONFIG_SYS_NAND_ENABLE_PIN AT91_PIN_PD15
+#define CONFIG_SYS_NAND_READY_PIN AT91_PIN_PA22
+#define CONFIG_SYS_64BIT_VSPRINTF /* needed for nand_util.c */
+#endif
+
+/* Ethernet */
+#define CONFIG_MACB 1
+#define CONFIG_RMII 1
+#define CONFIG_NET_MULTI 1
+#define CONFIG_NET_RETRY_COUNT 20
+#undef CONFIG_RESET_PHY_R
+
+/* USB */
+#define CONFIG_USB_ATMEL
+#define CONFIG_USB_OHCI_NEW 1
+#define CONFIG_DOS_PARTITION 1
+#define CONFIG_SYS_USB_OHCI_CPU_INIT 1
+#define CONFIG_SYS_USB_OHCI_REGS_BASE 0x00a00000
+#define CONFIG_SYS_USB_OHCI_SLOT_NAME "at91sam9263"
+#define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS 2
+#define CONFIG_USB_STORAGE 1
+#define CONFIG_CMD_FAT 1
+
+#define CONFIG_SYS_LOAD_ADDR 0x22000000 /* load address */
+
+#define CONFIG_SYS_MEMTEST_START PHYS_SDRAM
+#define CONFIG_SYS_MEMTEST_END 0x23e00000
+
+#define CONFIG_SYS_USE_DATAFLASH 1
+#undef CONFIG_SYS_USE_NANDFLASH
+
+/* CAN */
+#define CONFIG_AT91_CAN 1
+
+/* hw-controller addresses */
+#define CONFIG_ET1100_BASE 0x70000000
+
+/* bootstrap + u-boot + env in dataflash on CS0 */
+#define CONFIG_ENV_IS_IN_DATAFLASH 1
+#define CONFIG_SYS_MONITOR_BASE (CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 + \
+ 0x8400)
+#define CONFIG_ENV_OFFSET 0x4200
+#define CONFIG_ENV_ADDR (CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 + \
+ CONFIG_ENV_OFFSET)
+#define CONFIG_ENV_SIZE 0x4200
+
+#define CONFIG_BAUDRATE 115200
+#define CONFIG_SYS_BAUDRATE_TABLE {115200 , 19200, 38400, 57600, 9600 }
+
+#define CONFIG_SYS_PROMPT "=> "
+#define CONFIG_SYS_CBSIZE 256
+#define CONFIG_SYS_MAXARGS 16
+#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \
+ sizeof(CONFIG_SYS_PROMPT) + 16)
+#define CONFIG_SYS_LONGHELP 1
+#define CONFIG_CMDLINE_EDITING 1
+
+/*
+ * Size of malloc() pool
+ */
+#define CONFIG_SYS_MALLOC_LEN ROUND(3 * CONFIG_ENV_SIZE + \
+ 128*1024, 0x1000)
+#define CONFIG_SYS_GBL_DATA_SIZE 128 /* 128 bytes for initial data */
+
+#define CONFIG_STACKSIZE (32 * 1024) /* regular stack */
+
+#ifdef CONFIG_USE_IRQ
+#error CONFIG_USE_IRQ not supported
+#endif
+
+#endif
diff --git a/tools/Makefile b/tools/Makefile
index 5b8c3c3..c91e19d 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -102,6 +102,9 @@ endif
ifeq ($(VENDOR),atmel)
LOGO_BMP= logos/atmel.bmp
endif
+ifeq ($(VENDOR),esd)
+LOGO_BMP= logos/esd.bmp
+endif
ifeq ($(VENDOR),ronetix)
LOGO_BMP= logos/ronetix.bmp
endif
diff --git a/tools/logos/esd.bmp b/tools/logos/esd.bmp
new file mode 100644
index 0000000000000000000000000000000000000000..a6b403024fbd92952c6fac576d215b49afdb6626
GIT binary patch
literal 35078
zcmeHQy>BDO6<^6@L|+U_;sGaGS5Q1L(1(GG1W9K|q-MoCRtC~s>DHx7mu}qzNSV@Y
zngA(Nx(!kV`H!66Z@zZke(#E+#S0&>+}WA;X5M@A=FRMUEZ_g>cYlsFyz4~KDMJ6o
z^><ubQBTMJ_opa2{=K;n$pj5d?crw+R}X<bTtnUwF~l|IHS9%axQ2Us(Qvqj=RG{{
zMVGvfamRJb>ufK2kLz|kM0kksF#3kq<uLk)>s#J$amV%Xa*Xg8;c@gGulM8Vdt5*8
z`i9q8^dqm2XVFi%{=)0qv*@q5e)@QcXI$T2;`uWAnfLE-$MrW}-(N=m!1YgDKYw?N
zI9%V~BJLJ(xPG{ee!=xGUO(PO|H1XkkM9wFkMR5G*I$3#TpJyH@-|>Rfc?F>zP{G3
zVi$o+pLB?)Q~h*~(9p-@!JzLW;LwrBjm7AWXEEU7m3@ABuK29Zc5Oueg3l+tQ_vqE
zZi4&RAzu)AHtw3|-D~sI0m_+0DY|tZfP2T(Lj=^o;ho}XzR#yAqOV<a57DuHB6|GN
z!~-QZqV~WDc~K_M=r&f$2ofJ_+`*g}0EnX|h+;l7lMSQr1keRX=1Hl2sAgeM3V(M&
zrD7^;%nWRfQAAZ3hVL1o<_Hp9O-(F?)(Y#AkNHf2Q%(GqfyH#XU?EzNsm55$HOs8e
z&w(7HGl`-zBCDxRB16m-`q0mYMPe1e0gz*Lj?{@JJG6K=EKkwkh!86qouHrSc!T~L
z;d^2*@&-hM8CaS`ufT&55IiaBXdn0ZVkd%ip#bLE1<IUkzn~bSDC(ReNum3rfzCS7
z)+tfr*FY%&vJk8J7g0oVZ$Vo#W)@$8a<1d81zGf+D1xd{urat!AHYJ8!(1D8Kfb>h
zMaQ#yW!g}O5<x(%W6cgLoW(|@WqnLQY+B^){p|#~+yR4@7afyDlf=hd0JVbP7g2N>
z$E<W?=i9I**mm5Hdd$Qd9MES59el7^xc00w?}J<0l(tQ2TU{*{bPRyjZ*eoNT1(~{
zIFZRVBu#*o3%&r?V1Ozu0TeKM2~Im~&tq_`?IZdOlm|BoS{NYi1ed8-px+&!9y(P0
z$fMf=hA8>^)zE>iA`FKPFIlIGwnApD^P?j(m1U?uAnCx74uM1)Hug+k;4Hg97SzI3
z1m(YFI~dSoXqUxW=tHbU7kQ{I_%M1#EnL!Y&!R>AunXeE!=V7m5r9@^SNmDoK0N^_
z;v>V#2*mG9Q2#;>Nao-H^@!S?n;Jssfi_qS;OQI&sN&v2&3Ctvjdoe&s2d^ca~S6|
zIz<UujT(Id^!{AU`yGdF^EckiumTF^bjW5#4i`s6qBF5w0jwatx8}zr*h3%(ESfQ~
zaU`t9&<2Sw0j#1e-NS;k@N^?21^4Q+=qOhAZ&_h|MAIx#3q+@K1-i=<#l_<T!U!3_
z6t>`l2^U9f%4pPlFxUeIg9dR%$zN&WuaSbr^c7<0N#O?(vJKA=r+;@)V-VE%T)3M3
z2V+4nhS_%11;dcwt+8tu+!q49gT~_w&SZQE{1Y7{!*^&Kq`xsr)$x=I&J{qTw?X~<
z3W6(BKQ~B$gy71WGt5J~ZH<`s!?uJ{x(j3<&!IDN0t>?L4El%G0pLt~Ez<yi-ead6
z&ynF30<Mq5;~{u4j^ay0M{$fIkH@;%!wFfANNW9&=4=}h8#CIvM^At_GG{twZLr$&
zY1Hh`7^v(Tbg#BRfbI#jV3Z@KEtaJ_;%ijRYwgMDX#;du6k-8aK%c@S1|)<^w?U@J
z05tmW0X4eCD!$u|y4n*v8`HG(gEWo~Oqn(i?ND9X9=qU5eXg<cf0!FP(;l<`KpZkK
zU?;0berPqu!LVkp(fJwl9inSb$h#kufd@DO6{FDsLAxvTu4;Y<@rX#P(aj>B!$6rw
z*g()pA`0$?!!NCTA{Z~tkTFN{m<4NzW;~@Cdj$$bbI@$SE!oPZ^BA%dMqh5wb(JS|
zZ!+JWYW_fFZJqtT2BkD5YDPz>cmSD0ql}_AIti+un-)d0X2lo-FnyvaCjEOkolbSz
z>LFmd%qxUWaGCMx8A4j$Lj-P-W(=0-CSRflEhLJ*yj;xZb9Id7rQzT!Xn#JxKXJZk
z_Z$d|i+;p0+#A8s?ui2G;w?=CaDcqcP;}r!CS^6hy}oRd-Tvps?YiQ7y3JGF#;>|~
z+&g_IZxH#sgY0Zg^*(PtE4f3jYKF&^n9my_8F)NzKC8H+*UvPNDxznYKEeco@vF~}
zxeZGj4Qw>9(ZEIn8x3qUu+hLq19=+gA5PA%G1>H?6(}{mIzPrzb^#0*IoT>TyFQ;B
z>Q}`Ax@OVaFHSh)fkE{nVLlrdh=Mn$VmNtWrsJA%oxwi6hX_lMLT938n32i?=c@~V
zg)1{DnWd{8)5E*XQe;TDoK4)+Ny5drybPqC7Sv>tM@gtNS?JlZgo)*Z%w$?nu$hf3
z&-}Qxb-ltASb5%UQ)gxl&P&3H&PoU;Dm`V502WLu^KOkGC*1VHR8?Net{2u|JwVyv
zH06^4R!l@I8PzEXi`Q~OFJQMQ$SK{Y1-sa880ge2>%O5N`<UadnRRQlX}}W}w(Ehi
zbG=3Sm+`w#*)$x(Y8uS)a;2mWs1FS~_+C!``UKUZ+-@2ukt;|Z%F0sVVyM)9<_U`y
zK2IN5TunyFdUmtW(aGJyEY$eybRbzU*ZTl`qFy*3O|GENEGJm0tOq%xgqumQ%2Y3x
zG}gf>H+Kk7Zt)zroZNLV_qH=Q$q@OK>U06=XU^YCn2GHcY5e-nW2{)poD+`q8ly{`
z1bH6n9Y!t%cU8Ki<|(-rD?zL;dAv4(?J*bTLh#Grq4w-<8e78FC?!2t;;X^zSaW4z
zeKK&5)znoOyXm&)#=pIg+0=5*i|a5EtR?NLusm+kNdTK-3Nc$INS+k-dl(QE<r|1i
zOcALUm4&}cgkZ?2tCFrhg5KGclwuZ8%_a&To6(+M=QSwa9E*y55vqlo*q#8SKjgLv
z!V5110@)T|_6b=W^-$$L1$wwo!W6cY-_#()R>-y(nq*#^WU}6RSi+2OR(8W<33|(<
zUf2eGul_DH1-o%DC_u0#c5nnpE+~cvaaH9xs>b(8XhX5x5*GF#d2i%ldR4;}rdz|i
zHI~2-aD!R`c5PF5%4`FPBvHyWrx*z<ys|B&Xq!Ch-BwPLd;3Zi+EvogC)ti10q%C|
zOp+)<VW(QY<4lk>f6!af99w!{F!B&Ruye;j-hxQ)O9~Q2kQ<RaWM(x4>LVYxRmg*F
zhetjF`pz?I?o0HLBdF(z`<6VUU7y}*$IVcL;H?yU%36Rg1_8?wx4C)9v;Vs0A|1Pz
z&IR;tKUYvPb7S{Tx`Y;Yx0MRhuL-2pNG_7p(yjX3Htpf9W8dG!yQi;KDZD3d5^&Cm
z8#6p)h9=-6w3m`CHTryj%jn4S?*hWf_<9$@JK{!nwXh|KX+<ZTE1h>S+DMNj6GZMq
z^pNcYd78sP;`fB`F1gv=4Y9(kl=ET<dptZ4K$by=D&)v+yx!)_y94Fa5f<(e8{WN%
zgiS4P8k8HkJruvBipjUnoOH=uG!QqlxePg+(-3x(GuHlt7XpFe*Hlp-PTz?ba^t;g
zAj^=$y-RVssfU~fBI+YMlys~LIr7ZUmw}GT8N)K<u&*G(u_}AGz%j>r&Gx}#9v<@E
z1bKqQgWaaSM1N)Wq5A@|9Ef3Tj=@-&1xv1T3iTm|&Zj0tzTkK!ngpDQre1Ep3X9fZ
zG0EjCF@qL%Y092w5J<v)-K=KlWSVfF;J)>RaQn80L_C-7lMwjeB6IFxe;Ma(gb&B{
zbDM#1GP8Frz#LLycAbzOr_&^iLOJpVk`CP*jIh|&{#}~B3j?(~<-=jB-G44<miHju
z;IpkKDM(anFr@VuVrXI~UvOM10q4a$#S#Ph6ofCTxS69!kHtXF3y2t+xEcJg^(}wi
zE>T4IR-cTElJp>?Pv$ydawfZY5XFNV0foI&`FWq9q~<|6VUlMpNuDFmBm+4WB8Dcm
z1>xjOKxW->lIOBQq7$?y*NXBMJ$f?tnxKnUGIK&iTB9mG@RMZJI5Y^GVda#&6gtPU
z0?q4_VB|-5tS37AkQ)9})q2>FVJ`NNVxT-RL12f@Vj@F5$zJ=8a3(l(8L*Ta6nwhl
ze*vZ#nz*60m}jZI@D=1*72FmhJ9kW~j7rSCqDGQ2gP{tCCduSX*wAx`$_lKLhA~`N
zLhid_I-k?91%TXqe<8sVYtk;7M{*O$5;?qf_hC5y!D6af2a6Fdi$wF+Vxd<IO}u9o
zLk3bwqIUcns@_>@QL$zpH3<7UaD?4U;ZREqP5j^<-&GKR$FhTp4dfCH(v(sBMl147
zwOZ27&b{VCjulVc8W;;P^uz4pwR>T8SPk#pBOLHeX~<7MR_7&G6)l5{yR+l*(b19E
zgJ%wm>Ks$ceuiqUE>4a?)Er)qC+9PMI3NQ#omzoN9U4<T2&y=}qFgV7##rS8D=Cp!
z%q}e{aLb*vS1BcInW$!sOtptk0@NyL5h_5uPSzrCjFjHl7#5!w-pOfSxrOeB)Hk*5
zF*mQONOKB4EU-GfEf!6ROOUUZPr5g=<;acS!KeiFN2!ugeHT%gcLqV~Ocq@7)R&{0
zOtv~AJ$u=$S&#X-mBsQ)LG57cDA$3@!bAgMIT%USs7RSfji=)2^%}x;`Q?)GLb7AF
zt)n^>S)Qv%#kVfTVvJXV^9;%{y=k#5;$t?R_>dndC?*nImOn6`@QWwDh~|Or8*)^{
zm7D!Z<-2{zH@G6Aa^6Mi^zhMDk+9Yqygs?Wft(yDUXbq&%qgB6qB>FfIL@F^_nk1j
z32ij6(ZEIntJ1(1ht<$}oU$q*P)^>F2hpwI!B29mkgvu?WhRo+Qs4t%ev+ec?yDof
zrx~jtnB-U;UrkFAdw&WfdejiODMKys>r8d5MFXj}tE$b&Ej74gGQ9azLf#&jCA0D9
z>@xG^Ia0lObSW#ypoZsNiw44PP*%YT)cNQla%S)|Vy%Pc<;PB|U@Z(wEYaplq`rQ1
zt*;=1Pi1KGGPe$7WU&6S0?oE7VyDKm(ONW+8a>Foor+dVRqc84nb_5`)T*>PLz9+k
z39a~PO;lqm>RL1qv3Ei`D)&^j{k66JmQ7gQK+3l3FPoe8`H8Klt_D)~VCB1gK~GIt
zy-4SewLUc~kIKK!&}1EEe?FC=Nu3Wdt%c{U9=pf!IvAGRQk!yB_Oa0?e;(Cb+Y{Fq
zny91p*{_T;JX(`q8?jo822x{al6P`wWs0s_P@M*{4ljirv0pgfwASLI@2QRIIg+f&
z&?JZRRFwYDp}L0pTj6~&Lz9Q<dET-!c)ykYGv!tfO;o(ZEkT*`mlZKewT8UMwHTUI
z+tsqp1T0JSx%s$1Gs~+77q=Eelj<I%^8Y$>6}0L|apJ_)K<d5@Llge<U=^&#(4@Mh
z*FO}pYHJG0t21j7pg-GSouP?8_w;O~z*holG?29znpAt<^%$De@w}BMZl8g{)tEJ@
xIFSAfgdhw2x8w>~hh3M?M4KBnHX7JyV55PJ2L3-ZkpAveD0Nv{h`0Li{{S%4%!vR1
literal 0
HcmV?d00001
--
1.6.1
3
3
it seems CFI flash support is somehow broken. mtd->eraseregions is
filled as bellow:
erase size blocks correct blocks
00004000 01 01
00002000 01 02
00008000 00 01
00010000 0f 0f
'blocks' is actual numblocks field value while 'correct blocks' is expected
value. flinfo gives correct results (it is AM29LV800BB). It seems to be
related to cfi_mtd_set_erasesize function, but I'm too tired to debug it
further. Just reporting in case anyone has time to look at it. Otherwise
I'll do so at Friday.
Best regards,
ladis
2
2

02 Feb '10
Hi Folks,
I would like to know Which all boards
are tested with the C100 support in the Mainline.
I have a C100 Single, Pop, EVT1, EVT2, EVT0 boards
When i build the Mainline u-boot for "smdkc100_config"; make
The u-boot.bin is not working out of the box.
Am i missing anything, Any kinda help is greatly appreciated.
--
Shine bright,
(: Naveen Krishna Ch :)
2
2
Added support for the following EDB93xx boards:
EDB9301
EDB9302
EDB9302A
EDB9307
EDB9307A
EDB93012
EDB9315
EDB9315A
Signed-off-by: Matthias Kaehlcke <matthias(a)kaehlcke.net>
---
Changes with respect to rev5:
* fixed whitespace issues
* simplified copying of exception vectors in dram_init()
* added comment about programming of SDRAM mode registers
* simplified definition of CONFIG_SYS_LOAD_ADDR
MAINTAINERS | 10 ++
MAKEALL | 8 ++
Makefile | 10 ++
board/edb93xx/Makefile | 50 ++++++++
board/edb93xx/config.mk | 33 +++++
board/edb93xx/early_udelay.h | 34 ++++++
board/edb93xx/edb93xx.c | 104 ++++++++++++++++
board/edb93xx/flash_cfg.c | 38 ++++++
board/edb93xx/pll_cfg.c | 58 +++++++++
board/edb93xx/pll_cfg.h | 72 +++++++++++
board/edb93xx/sdram_cfg.c | 123 +++++++++++++++++++
board/edb93xx/sdram_cfg.h | 144 ++++++++++++++++++++++
include/configs/edb93xx.h | 270 ++++++++++++++++++++++++++++++++++++++++++
13 files changed, 954 insertions(+), 0 deletions(-)
create mode 100644 board/edb93xx/Makefile
create mode 100644 board/edb93xx/config.mk
create mode 100644 board/edb93xx/early_udelay.h
create mode 100644 board/edb93xx/edb93xx.c
create mode 100644 board/edb93xx/flash_cfg.c
create mode 100644 board/edb93xx/pll_cfg.c
create mode 100644 board/edb93xx/pll_cfg.h
create mode 100644 board/edb93xx/sdram_cfg.c
create mode 100644 board/edb93xx/sdram_cfg.h
create mode 100644 include/configs/edb93xx.h
diff --git a/MAINTAINERS b/MAINTAINERS
index e8ba4bc..12a742e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -598,6 +598,16 @@ Gary Jennejohn <garyj(a)denx.de>
smdk2400 ARM920T
trab ARM920T
+Matthias Kaehlcke <matthias(a)kaehlcke.net>
+ edb9301 ARM920T (EP9301)
+ edb9302 ARM920T (EP9302)
+ edb9302a ARM920T (EP9302)
+ edb9307 ARM920T (EP9307)
+ edb9307a ARM920T (EP9307)
+ edb9312 ARM920T (EP9312)
+ edb9315 ARM920T (EP9315)
+ edb9315a ARM920T (EP9315)
+
Konstantin Kletschke <kletschke(a)synertronixx.de>
scb9328 ARM920T
diff --git a/MAKEALL b/MAKEALL
index afdc1b5..864f1fe 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -554,6 +554,14 @@ LIST_ARM9=" \
cp946es \
cp966 \
da830evm \
+ edb9301 \
+ edb9302 \
+ edb9302a \
+ edb9307 \
+ edb9307a \
+ edb9312 \
+ edb9315 \
+ edb9315a \
imx27lite \
lpd7a400 \
mv88f6281gtw_ge \
diff --git a/Makefile b/Makefile
index 0f60925..5b4ab56 100644
--- a/Makefile
+++ b/Makefile
@@ -2412,6 +2412,16 @@ caddy2_config \
vme8349_config: unconfig
@$(MKCONFIG) -t $(@:_config=) vme8349 ppc mpc83xx vme8349 esd
+edb9301_config \
+edb9302_config \
+edb9302a_config \
+edb9307_config \
+edb9307a_config \
+edb9312_config \
+edb9315_config \
+edb9315a_config: unconfig
+ @$(MKCONFIG) -t $(@:_config=) edb93xx arm arm920t edb93xx NULL ep93xx
+
#########################################################################
## MPC85xx Systems
#########################################################################
diff --git a/board/edb93xx/Makefile b/board/edb93xx/Makefile
new file mode 100644
index 0000000..e2e2636
--- /dev/null
+++ b/board/edb93xx/Makefile
@@ -0,0 +1,50 @@
+#
+# (C) Copyright 2003-2006
+# Wolfgang Denk, DENX Software Engineering, wd(a)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 := edb93xx.o flash_cfg.o pll_cfg.o sdram_cfg.o
+
+SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS := $(addprefix $(obj),$(COBJS))
+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 .depend
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/edb93xx/config.mk b/board/edb93xx/config.mk
new file mode 100644
index 0000000..b2fc6fa
--- /dev/null
+++ b/board/edb93xx/config.mk
@@ -0,0 +1,33 @@
+LDSCRIPT := $(SRCTREE)/cpu/arm920t/ep93xx/u-boot.lds
+
+ifdef CONFIG_EDB9301
+TEXT_BASE = 0x05700000
+endif
+
+ifdef CONFIG_EDB9302
+TEXT_BASE = 0x05700000
+endif
+
+ifdef CONFIG_EDB9302A
+TEXT_BASE = 0xc5700000
+endif
+
+ifdef CONFIG_EDB9307
+TEXT_BASE = 0x01f00000
+endif
+
+ifdef CONFIG_EDB9307A
+TEXT_BASE = 0xc1f00000
+endif
+
+ifdef CONFIG_EDB9312
+TEXT_BASE = 0x01f00000
+endif
+
+ifdef CONFIG_EDB9315
+TEXT_BASE = 0x01f00000
+endif
+
+ifdef CONFIG_EDB9315A
+TEXT_BASE = 0xc1f00000
+endif
diff --git a/board/edb93xx/early_udelay.h b/board/edb93xx/early_udelay.h
new file mode 100644
index 0000000..3b26b3f
--- /dev/null
+++ b/board/edb93xx/early_udelay.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2009 Matthias Kaehlcke <matthias(a)kaehlcke.net>
+ *
+ * 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>
+
+/* delay execution before timers are initialized */
+static inline void early_udelay(uint32_t usecs)
+{
+ /* loop takes 4 cycles at 5.0ns (fastest case, running at 200MHz) */
+ register uint32_t loops = (usecs * 1000) / 20;
+
+ __asm__ volatile ("1:\n"
+ "subs %0, %1, #1\n"
+ "bne 1b":"=r" (loops):"0" (loops));
+}
diff --git a/board/edb93xx/edb93xx.c b/board/edb93xx/edb93xx.c
new file mode 100644
index 0000000..4df2246
--- /dev/null
+++ b/board/edb93xx/edb93xx.c
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2009 Matthias Kaehlcke <matthias(a)kaehlcke.net>
+ *
+ * (C) Copyright 2002 2003
+ * Network Audio Technologies, Inc. <www.netaudiotech.com>
+ * Adam Bezanson <bezanson(a)netaudiotech.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 <netdev.h>
+#include <asm/arch/ep93xx.h>
+#include <asm/io.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#define MAX_BANK_SIZE 0x04000000 /* 64 MB */
+
+static ulong const bank_addr[CONFIG_NR_DRAM_BANKS] = {
+ PHYS_SDRAM_1,
+#ifdef PHYS_SDRAM_2
+ PHYS_SDRAM_2,
+#endif
+#ifdef PHYS_SDRAM_3
+ PHYS_SDRAM_3,
+#endif
+#ifdef PHYS_SDRAM_4
+ PHYS_SDRAM_4
+#endif
+};
+
+int board_init(void)
+{
+ struct syscon_regs *syscon = (struct syscon_regs *)SYSCON_BASE;
+
+ icache_enable();
+
+#ifdef USE_920T_MMU
+ dcache_enable();
+#endif
+
+ /*
+ * set UARTBAUD bit to drive UARTs with 14.7456MHz instead of
+ * 14.7456/2 MHz
+ */
+ uint32_t value = readl(&syscon->pwrcnt);
+ value |= SYSCON_PWRCNT_UART_BAUD;
+ writel(value, &syscon->pwrcnt);
+
+ /* Machine number, as defined in linux/arch/arm/tools/mach-types */
+ gd->bd->bi_arch_number = CONFIG_MACH_TYPE;
+
+ /* adress of boot parameters */
+ gd->bd->bi_boot_params = LINUX_BOOT_PARAM_ADDR;
+
+ /* We have a console */
+ gd->have_console = 1;
+
+ return 0;
+}
+
+int board_eth_init(bd_t *bd)
+{
+ return ep93xx_eth_initialize(0, MAC_BASE);
+}
+
+int dram_init(void)
+{
+ unsigned int *src, *dst;
+ int i;
+
+ for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
+ const ulong bank_size = get_ram_size((long *)bank_addr[i],
+ MAX_BANK_SIZE);
+ if (bank_size) {
+ gd->bd->bi_dram[i].start = bank_addr[i];
+ gd->bd->bi_dram[i].size = bank_size;
+ }
+ }
+
+ /* copy exception vectors */
+ src = (unsigned int *)_armboot_start;
+ dst = (unsigned int *)PHYS_SDRAM_1;
+ memcpy(dst, src, 16 * sizeof(unsigned int));
+
+ return 0;
+}
diff --git a/board/edb93xx/flash_cfg.c b/board/edb93xx/flash_cfg.c
new file mode 100644
index 0000000..a4c2048
--- /dev/null
+++ b/board/edb93xx/flash_cfg.c
@@ -0,0 +1,38 @@
+/*
+ * Flash setup for Cirrus edb93xx boards
+ *
+ * Copyright (C) 2009 Matthias Kaehlcke <matthias(a)kaehlcke.net>
+ *
+ * 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/ep93xx.h>
+#include <asm/io.h>
+
+#define SMC_BCR6_VALUE (2 << SMC_BCR_IDCY_SHIFT | 5 << SMC_BCR_WST1_SHIFT | \
+ SMC_BCR_BLE | 2 << SMC_BCR_WST2_SHIFT | \
+ 1 << SMC_BCR_MW_SHIFT)
+
+void flash_cfg(void)
+{
+ struct smc_regs *smc = (struct smc_regs *)SMC_BASE;
+
+ writel(SMC_BCR6_VALUE, &smc->bcr6);
+}
diff --git a/board/edb93xx/pll_cfg.c b/board/edb93xx/pll_cfg.c
new file mode 100644
index 0000000..a687af0
--- /dev/null
+++ b/board/edb93xx/pll_cfg.c
@@ -0,0 +1,58 @@
+/*
+ * PLL setup for Cirrus edb93xx boards
+ *
+ * Copyright (C) 2009 Matthias Kaehlcke <matthias(a)kaehlcke.net>
+ *
+ * Copyright (C) 2006 Dominic Rath <Dominic.Rath(a)gmx.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/io.h>
+#include "pll_cfg.h"
+#include "early_udelay.h"
+
+void pll_cfg(void)
+{
+ struct syscon_regs *syscon = (struct syscon_regs *)SYSCON_BASE;
+
+ /* setup PLL1 */
+ writel(CLKSET1_VAL, &syscon->clkset1);
+
+ /*
+ * flush the pipeline
+ * writing to CLKSET1 causes the EP93xx to enter standby for between
+ * 8 ms to 16 ms, until PLL1 stabilizes
+ */
+ asm("nop");
+ asm("nop");
+ asm("nop");
+ asm("nop");
+ asm("nop");
+
+ /* setup PLL2 */
+ writel(CLKSET2_VAL, &syscon->clkset2);
+
+ /*
+ * the user's guide recommends to wait at least 1 ms for PLL2 to
+ * stabilize
+ */
+ early_udelay(1000);
+}
diff --git a/board/edb93xx/pll_cfg.h b/board/edb93xx/pll_cfg.h
new file mode 100644
index 0000000..0b6f469
--- /dev/null
+++ b/board/edb93xx/pll_cfg.h
@@ -0,0 +1,72 @@
+/*
+ * PLL register values for Cirrus edb93xx boards
+ *
+ * Copyright (C) 2009 Matthias Kaehlcke <matthias(a)kaehlcke.net>
+ *
+ * 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 <config.h>
+#include <asm/arch/ep93xx.h>
+
+#if defined(CONFIG_EDB9301) || defined(CONFIG_EDB9302) || \
+ defined(CONFIG_EDB9302A)
+/*
+ * fclk_div: 2, nbyp1: 1, hclk_div: 5, pclk_div: 2
+ * pll1_x1: 294912000.000000, pll1_x2ip: 36864000.000000,
+ * pll1_x2: 331776000.000000, pll1_out: 331776000.000000
+ */
+#define CLKSET1_VAL (7 << SYSCON_CLKSET_PLL_X2IPD_SHIFT | \
+ 8 << SYSCON_CLKSET_PLL_X2FBD2_SHIFT | \
+ 19 << SYSCON_CLKSET_PLL_X1FBD1_SHIFT | \
+ 1 << SYSCON_CLKSET1_PCLK_DIV_SHIFT | \
+ 3 << SYSCON_CLKSET1_HCLK_DIV_SHIFT | \
+ SYSCON_CLKSET1_NBYP1 | \
+ 1 << SYSCON_CLKSET1_FCLK_DIV_SHIFT)
+#elif defined(CONFIG_EDB9307) || defined(CONFIG_EDB9307A) || \
+ defined CONFIG_EDB9312 || defined(CONFIG_EDB9315) || \
+ defined(CONFIG_EDB9315A)
+/*
+ * fclk_div: 2, nbyp1: 1, hclk_div: 4, pclk_div: 2
+ * pll1_x1: 3096576000.000000, pll1_x2ip: 129024000.000000,
+ * pll1_x2: 3999744000.000000, pll1_out: 1999872000.000000
+ */
+#define CLKSET1_VAL (23 << SYSCON_CLKSET_PLL_X2IPD_SHIFT | \
+ 30 << SYSCON_CLKSET_PLL_X2FBD2_SHIFT | \
+ 20 << SYSCON_CLKSET_PLL_X1FBD1_SHIFT | \
+ 1 << SYSCON_CLKSET1_PCLK_DIV_SHIFT | \
+ 2 << SYSCON_CLKSET1_HCLK_DIV_SHIFT | \
+ SYSCON_CLKSET1_NBYP1 | \
+ 1 << SYSCON_CLKSET1_FCLK_DIV_SHIFT)
+#else
+#error "Undefined board"
+#endif
+
+/*
+ * usb_div: 4, nbyp2: 1, pll2_en: 1
+ * pll2_x1: 368640000.000000, pll2_x2ip: 15360000.000000,
+ * pll2_x2: 384000000.000000, pll2_out: 192000000.000000
+ */
+#define CLKSET2_VAL (23 << SYSCON_CLKSET_PLL_X2IPD_SHIFT | \
+ 24 << SYSCON_CLKSET_PLL_X2FBD2_SHIFT | \
+ 24 << SYSCON_CLKSET_PLL_X1FBD1_SHIFT | \
+ 1 << SYSCON_CLKSET_PLL_PS_SHIFT | \
+ SYSCON_CLKSET2_PLL2_EN | \
+ SYSCON_CLKSET2_NBYP2 | \
+ 3 << SYSCON_CLKSET2_USB_DIV_SHIFT)
diff --git a/board/edb93xx/sdram_cfg.c b/board/edb93xx/sdram_cfg.c
new file mode 100644
index 0000000..6155f0e
--- /dev/null
+++ b/board/edb93xx/sdram_cfg.c
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2009 Matthias Kaehlcke <matthias(a)kaehlcke.net>
+ *
+ * Copyright (C) 2006 Dominic Rath <Dominic.Rath(a)gmx.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 <asm/io.h>
+#include "sdram_cfg.h"
+#include "early_udelay.h"
+
+#define PROGRAM_MODE_REG(bank) (*(volatile uint32_t *) \
+ (SDRAM_BASE_ADDR | SDRAM_BANK_SEL_##bank | SDRAM_MODE_REG_VAL))
+
+#define PRECHARGE_BANK(bank) (*(volatile uint32_t *) \
+ (SDRAM_BASE_ADDR | SDRAM_BANK_SEL_##bank))
+
+static void force_precharge(void);
+static void setup_refresh_timer(void);
+static void program_mode_registers(void);
+
+void sdram_cfg(void)
+{
+ struct sdram_regs *sdram = (struct sdram_regs *)SDRAM_BASE;
+
+ writel(SDRAM_DEVCFG_VAL, &sdram->SDRAM_DEVCFG_REG);
+
+ /* Issue continous NOP commands */
+ writel(GLCONFIG_INIT | GLCONFIG_MRS | GLCONFIG_CKE, &sdram->glconfig);
+
+ early_udelay(200);
+
+ force_precharge();
+
+ setup_refresh_timer();
+
+ program_mode_registers();
+
+ /* Select normal operation mode */
+ writel(GLCONFIG_CKE, &sdram->glconfig);
+}
+
+static void force_precharge(void)
+{
+ /*
+ * Errata most EP93xx revisions say that PRECHARGE ALL isn't always
+ * issued.
+ *
+ * Do a read from each bank to make sure they're precharged
+ */
+
+ PRECHARGE_BANK(0);
+ PRECHARGE_BANK(1);
+ PRECHARGE_BANK(2);
+ PRECHARGE_BANK(3);
+}
+
+static void setup_refresh_timer(void)
+{
+ struct sdram_regs *sdram = (struct sdram_regs *)SDRAM_BASE;
+
+ /* Load refresh timer with 10 to issue refresh every 10 cycles */
+ writel(0x0a, &sdram->refrshtimr);
+
+ /*
+ * Wait at least 80 clock cycles to provide 8 refresh cycles
+ * to all SDRAMs
+ */
+ early_udelay(1);
+
+ /*
+ * Program refresh timer with normal value
+ * We need 8192 refresh cycles every 64ms
+ * at 15ns (HCLK >= 66MHz) per cycle:
+ * 64ms / 8192 = 7.8125us
+ * 7.8125us / 15ns = 520 (0x208)
+ */
+ /*
+ * TODO: redboot uses 0x1e0 for the slowest possible device
+ * but i don't understand how this value is calculated
+ */
+ writel(0x208, &sdram->refrshtimr);
+}
+
+static void program_mode_registers(void)
+{
+ /*
+ * The mode registers are programmed by performing a read from each
+ * SDRAM bank. The value of the address that is read defines the value
+ * that is written into the mode register
+ */
+
+ PROGRAM_MODE_REG(0);
+
+#if (CONFIG_NR_DRAM_BANKS >= 2)
+ PROGRAM_MODE_REG(1);
+#endif
+
+#if (CONFIG_NR_DRAM_BANKS >= 3)
+ PROGRAM_MODE_REG(2);
+#endif
+
+#if (CONFIG_NR_DRAM_BANKS == 4)
+ PROGRAM_MODE_REG(3);
+#endif
+}
diff --git a/board/edb93xx/sdram_cfg.h b/board/edb93xx/sdram_cfg.h
new file mode 100644
index 0000000..757b63c
--- /dev/null
+++ b/board/edb93xx/sdram_cfg.h
@@ -0,0 +1,144 @@
+/*
+ * Copyright (C) 2009 Matthias Kaehlcke <matthias(a)kaehlcke.net>
+ *
+ * Copyright (C) 2006 Dominic Rath <Dominic.Rath(a)gmx.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 <config.h>
+#include <asm/arch/ep93xx.h>
+
+#define SDRAM_BASE_ADDR PHYS_SDRAM_1
+
+#ifdef CONFIG_EDB93XX_SDCS0
+#define SDRAM_DEVCFG_REG devcfg0
+#elif defined(CONFIG_EDB93XX_SDCS3)
+#define SDRAM_DEVCFG_REG devcfg3
+#else
+#error "SDRAM bank configuration"
+#endif
+
+#if defined(CONFIG_EDB9301) || defined(CONFIG_EDB9302) || \
+ defined(CONFIG_EDB9302A)
+/*
+ * 1x Samsung K4S561632C-TC/L75 4M x 16bit x 4 banks SDRAM
+ *
+ * CLK cycle time min:
+ * @ CAS latency = 3: 7.5ns
+ * @ CAS latency = 2: 10ns
+ * We're running at 66MHz (15ns cycle time) external bus speed (HCLK),
+ * so it's safe to use CAS latency = 2
+ *
+ * RAS-to-CAS delay min:
+ * 20ns
+ * At 15ns cycle time, we use RAS-to-CAS delay = 2
+ *
+ * SROMLL = 1: Swap BA[1:0] with A[13:12], making the SDRAM appear
+ * as four blocks of 8MB size, instead of eight blocks of 4MB size:
+ *
+ * EDB9301/EDB9302:
+ *
+ * 0x00000000 - 0x007fffff
+ * 0x01000000 - 0x017fffff
+ * 0x04000000 - 0x047fffff
+ * 0x05000000 - 0x057fffff
+ *
+ *
+ * EDB9302a:
+ *
+ * 0xc0000000 - 0xc07fffff
+ * 0xc1000000 - 0xc17fffff
+ * 0xc4000000 - 0xc47fffff
+ * 0xc5000000 - 0xc57fffff
+ *
+ * BANKCOUNT = 1: This is a device with four banks
+ */
+
+#define SDRAM_DEVCFG_VAL (SDRAM_DEVCFG_BANKCOUNT | \
+ SDRAM_DEVCFG_SROMLL | \
+ SDRAM_DEVCFG_CASLAT_2 | \
+ SDRAM_DEVCFG_RASTOCAS_2 | \
+ SDRAM_DEVCFG_EXTBUSWIDTH)
+
+/*
+ * 16 bit ext. bus
+ *
+ * A[22:09] is output as SYA[13:0]
+ * CAS latency: 2
+ * Burst type: sequential
+ * Burst length: 8 (required for 16 bit ext. bus)
+ * SYA[13:0] = 0x0023
+ */
+#define SDRAM_MODE_REG_VAL 0x4600
+
+#define SDRAM_BANK_SEL_0 0x00000000 /* A[22:21] = b00 */
+#define SDRAM_BANK_SEL_1 0x00200000 /* A[22:21] = b01 */
+#define SDRAM_BANK_SEL_2 0x00400000 /* A[22:21] = b10 */
+#define SDRAM_BANK_SEL_3 0x00600000 /* A[22:21] = b11 */
+
+#elif defined(CONFIG_EDB9307) || defined(CONFIG_EDB9307A) || \
+ defined CONFIG_EDB9312 || defined(CONFIG_EDB9315) || \
+ defined(CONFIG_EDB9315A)
+/*
+ * 2x Samsung K4S561632C-TC/L75 4M x 16bit x 4 banks SDRAM
+ *
+ * CLK cycle time min:
+ * @ CAS latency = 3: 7.5ns
+ * @ CAS latency = 2: 10ns
+ * We're running at 100MHz (10ns cycle time) external bus speed (HCLK),
+ * so it's safe to use CAS latency = 2
+ *
+ * RAS-to-CAS delay min:
+ * 20ns
+ * At 10ns cycle time, we use RAS-to-CAS delay = 2
+ *
+ * EDB9307, EDB9312, EDB9315:
+ *
+ * 0x00000000 - 0x01ffffff
+ * 0x04000000 - 0x05ffffff
+ *
+ *
+ * EDB9307a, EDB9315a:
+ *
+ * 0xc0000000 - 0xc1ffffff
+ * 0xc4000000 - 0xc5ffffff
+ */
+
+#define SDRAM_DEVCFG_VAL (SDRAM_DEVCFG_BANKCOUNT | \
+ SDRAM_DEVCFG_SROMLL | \
+ SDRAM_DEVCFG_CASLAT_2 | \
+ SDRAM_DEVCFG_RASTOCAS_2)
+
+/*
+ * 32 bit ext. bus
+ *
+ * A[23:10] is output as SYA[13:0]
+ * CAS latency: 2
+ * Burst type: sequential
+ * Burst length: 4
+ * SYA[13:0] = 0x0022
+ */
+#define SDRAM_MODE_REG_VAL 0x8800
+
+#define SDRAM_BANK_SEL_0 0x00000000 /* A[23:22] = b00 */
+#define SDRAM_BANK_SEL_1 0x00400000 /* A[23:22] = b01 */
+#define SDRAM_BANK_SEL_2 0x00800000 /* A[23:22] = b10 */
+#define SDRAM_BANK_SEL_3 0x00c00000 /* A[23:22] = b11 */
+#endif
diff --git a/include/configs/edb93xx.h b/include/configs/edb93xx.h
new file mode 100644
index 0000000..4b00391
--- /dev/null
+++ b/include/configs/edb93xx.h
@@ -0,0 +1,270 @@
+/*
+ * U-boot - Configuration file for Cirrus Logic EDB93xx boards
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#ifdef CONFIG_MK_edb9301
+#define CONFIG_EDB9301
+#elif defined(CONFIG_MK_edb9302)
+#define CONFIG_EDB9302
+#elif defined(CONFIG_MK_edb9302a)
+#define CONFIG_EDB9302A
+#elif defined(CONFIG_MK_edb9307)
+#define CONFIG_EDB9307
+#elif defined(CONFIG_MK_edb9307a)
+#define CONFIG_EDB9307A
+#elif defined(CONFIG_MK_edb9312)
+#define CONFIG_EDB9312
+#elif defined(CONFIG_MK_edb9315)
+#define CONFIG_EDB9315
+#elif defined(CONFIG_MK_edb9315a)
+#define CONFIG_EDB9315A
+#else
+#error "no board defined"
+#endif
+
+/* Initial environment and monitor configuration options. */
+#define CONFIG_BOOTDELAY 2
+#define CONFIG_CMDLINE_TAG 1
+#define CONFIG_INITRD_TAG 1
+#define CONFIG_SETUP_MEMORY_TAGS 1
+#define CONFIG_BOOTARGS "root=/dev/nfs console=ttyAM0,115200 ip=dhcp"
+#define CONFIG_BOOTFILE "edb93xx.img"
+
+#define CONFIG_SYS_HUSH_PARSER 1
+#define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
+
+#ifdef CONFIG_EDB9301
+#define CONFIG_EP9301
+#define CONFIG_MACH_TYPE MACH_TYPE_EDB9301
+#define CONFIG_SYS_PROMPT "EDB9301> "
+#define CONFIG_ENV_SECT_SIZE 0x00020000
+#elif defined(CONFIG_EDB9302)
+#define CONFIG_EP9302
+#define CONFIG_MACH_TYPE MACH_TYPE_EDB9302
+#define CONFIG_SYS_PROMPT "EDB9302> "
+#define CONFIG_ENV_SECT_SIZE 0x00020000
+#elif defined(CONFIG_EDB9302A)
+#define CONFIG_EP9302
+#define CONFIG_MACH_TYPE MACH_TYPE_EDB9302A
+#define CONFIG_SYS_PROMPT "EDB9302A> "
+#define CONFIG_ENV_SECT_SIZE 0x00020000
+#elif defined(CONFIG_EDB9307)
+#define CONFIG_EP9307
+#define CONFIG_MACH_TYPE MACH_TYPE_EDB9307
+#define CONFIG_SYS_PROMPT "EDB9307> "
+#define CONFIG_ENV_SECT_SIZE 0x00040000
+#elif defined(CONFIG_EDB9307A)
+#define CONFIG_EP9307
+#define CONFIG_MACH_TYPE MACH_TYPE_EDB9307A
+#define CONFIG_SYS_PROMPT "EDB9307A> "
+#define CONFIG_ENV_SECT_SIZE 0x00040000
+#elif defined(CONFIG_EDB9312)
+#define CONFIG_EP9312
+#define CONFIG_MACH_TYPE MACH_TYPE_EDB9312
+#define CONFIG_SYS_PROMPT "EDB9312> "
+#define CONFIG_ENV_SECT_SIZE 0x00040000
+#elif defined(CONFIG_EDB9315)
+#define CONFIG_EP9315
+#define CONFIG_MACH_TYPE MACH_TYPE_EDB9315
+#define CONFIG_SYS_PROMPT "EDB9315> "
+#define CONFIG_ENV_SECT_SIZE 0x00040000
+#elif defined(CONFIG_EDB9315A)
+#define CONFIG_EP9315
+#define CONFIG_MACH_TYPE MACH_TYPE_EDB9315A
+#define CONFIG_SYS_PROMPT "EDB9315A> "
+#define CONFIG_ENV_SECT_SIZE 0x00040000
+#else
+#error "no board defined"
+#endif
+
+/* High-level configuration options */
+#define CONFIG_ARM920T 1 /* This is an ARM920T core... */
+#define CONFIG_EP93XX 1 /* in a Cirrus Logic 93xx SoC */
+
+#define CONFIG_SYS_CLK_FREQ 14745600 /* EP93xx has a 14.7456 clock */
+#define CONFIG_SYS_HZ 1000 /* decr freq: 1 ms ticks */
+#undef CONFIG_USE_IRQ /* Don't need IRQ/FIQ */
+
+/* Monitor configuration */
+#include <config_cmd_default.h>
+#undef CONFIG_CMD_FPGA
+#undef CONFIG_CMD_SETGETDCR
+#undef CONFIG_CMD_XIMG
+
+#undef CONFIG_CMD_DATE
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_FAT
+#define CONFIG_CMD_JFFS2
+
+#define CONFIG_SYS_LONGHELP /* Enable "long" help in mon */
+#define CONFIG_SYS_CBSIZE 1024 /* Console I/O buffer size */
+/* Print buffer size */
+#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16)
+/* Boot argument buffer size */
+#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
+#define CONFIG_SYS_MAXARGS 16 /* Max number of command args */
+
+/* Serial port hardware configuration */
+#define CONFIG_PL010_SERIAL
+#define CONFIG_CONS_INDEX 0
+#define CONFIG_BAUDRATE 115200
+#define CONFIG_SYS_BAUDRATE_TABLE {9600, 19200, 38400, 57600, 115200}
+#define CONFIG_SYS_SERIAL0 0x808C0000
+#define CONFIG_SYS_SERIAL1 0x808D0000
+#define CONFIG_PL01x_PORTS {(void *)CONFIG_SYS_SERIAL0, \
+ (void *)CONFIG_SYS_SERIAL1}
+
+/* Status LED */
+#define CONFIG_STATUS_LED 1 /* Status LED enabled */
+#define CONFIG_BOARD_SPECIFIC_LED 1
+#define STATUS_LED_GREEN 0
+#define STATUS_LED_RED 1
+/* Green */
+#define STATUS_LED_BIT STATUS_LED_GREEN
+#define STATUS_LED_STATE STATUS_LED_ON
+#define STATUS_LED_PERIOD (CONFIG_SYS_HZ / 2)
+/* Red */
+#define STATUS_LED_BIT1 STATUS_LED_RED
+#define STATUS_LED_STATE1 STATUS_LED_OFF
+#define STATUS_LED_PERIOD1 (CONFIG_SYS_HZ / 2)
+/* Optional value */
+#define STATUS_LED_BOOT STATUS_LED_BIT
+
+/* Network hardware configuration */
+#define CONFIG_DRIVER_EP93XX_MAC
+#define CONFIG_MII_SUPPRESS_PREAMBLE
+#define CONFIG_MII
+#define CONFIG_PHY_ADDR 1
+#define CONFIG_NET_MULTI
+#undef CONFIG_NETCONSOLE
+
+/* SDRAM configuration */
+#if defined(CONFIG_EDB9301) || defined(CONFIG_EDB9302)
+/*
+ * EDB9301/2 has 4 banks of SDRAM consisting of 1x Samsung K4S561632E-TC75
+ * 256 Mbit SDRAM on a 16-bit data bus, for a total of 32MB of SDRAM. We set
+ * the SROMLL bit on the processor, resulting in this non-contiguous memory map.
+ */
+#define CONFIG_NR_DRAM_BANKS 4
+#define PHYS_SDRAM_1 0x00000000
+#define PHYS_SDRAM_SIZE_1 0x00800000
+#define PHYS_SDRAM_2 0x01000000
+#define PHYS_SDRAM_SIZE_2 0x00800000
+#define PHYS_SDRAM_3 0x04000000
+#define PHYS_SDRAM_SIZE_3 0x00800000
+#define PHYS_SDRAM_4 0x05000000
+#define PHYS_SDRAM_SIZE_4 0x00800000
+#define CONFIG_EDB93XX_SDCS3
+#define CONFIG_SYS_MEMTEST_START 0x00100000
+#define CONFIG_SYS_MEMTEST_END 0x007fffff
+
+#elif defined(CONFIG_EDB9302A)
+/*
+ * EDB9302a has 4 banks of SDRAM consisting of 1x Samsung K4S561632E-TC75
+ * 256 Mbit SDRAM on a 16-bit data bus, for a total of 32MB of SDRAM. We set
+ * the SROMLL bit on the processor, resulting in this non-contiguous memory map.
+ */
+#define CONFIG_NR_DRAM_BANKS 4
+#define PHYS_SDRAM_1 0xc0000000
+#define PHYS_SDRAM_SIZE_1 0x00800000
+#define PHYS_SDRAM_2 0xc1000000
+#define PHYS_SDRAM_SIZE_2 0x00800000
+#define PHYS_SDRAM_3 0xc4000000
+#define PHYS_SDRAM_SIZE_3 0x00800000
+#define PHYS_SDRAM_4 0xc5000000
+#define PHYS_SDRAM_SIZE_4 0x00800000
+#define CONFIG_EDB93XX_SDCS0
+#define CONFIG_SYS_MEMTEST_START 0xc0100000
+#define CONFIG_SYS_MEMTEST_END 0xc07fffff
+
+#elif defined(CONFIG_EDB9307) || defined CONFIG_EDB9312 || \
+ defined(CONFIG_EDB9315)
+/*
+ * The EDB9307, EDB9312, and EDB9315 have 2 banks of SDRAM consisting of
+ * 2x Samsung K4S561632E-TC75 256 Mbit on a 32-bit data bus, for a total of
+ * 64 MB of SDRAM.
+ */
+#define CONFIG_NR_DRAM_BANKS 2
+#define PHYS_SDRAM_1 0x00000000
+#define PHYS_SDRAM_SIZE_1 0x02000000
+#define PHYS_SDRAM_2 0x04000000
+#define PHYS_SDRAM_SIZE_2 0x02000000
+#define CONFIG_EDB93XX_SDCS3
+#define CONFIG_SYS_MEMTEST_START 0x00100000
+#define CONFIG_SYS_MEMTEST_END 0x01e00000
+
+#elif defined(CONFIG_EDB9307A) || defined(CONFIG_EDB9315A)
+/*
+ * The EDB9307A and EDB9315A have 2 banks of SDRAM consisting of 2x Samsung
+ * K4S561632E-TC75 256 Mbit on a 32-bit data bus, for a total of 64 MB of SDRAM.
+ */
+#define CONFIG_NR_DRAM_BANKS 2
+#define PHYS_SDRAM_1 0xc0000000
+#define PHYS_SDRAM_SIZE_1 0x02000000
+#define PHYS_SDRAM_2 0xc4000000
+#define PHYS_SDRAM_SIZE_2 0x02000000
+#define CONFIG_EDB93XX_SDCS0
+#define CONFIG_SYS_MEMTEST_START 0xc0100000
+#define CONFIG_SYS_MEMTEST_END 0xc1e00000
+#endif
+
+/* Default load address */
+#define CONFIG_SYS_LOAD_ADDR (PHYS_SDRAM_1 + 0x01000000)
+
+/* Must match kernel config */
+#define LINUX_BOOT_PARAM_ADDR (PHYS_SDRAM_1 + 0x100)
+
+/* Run-time memory allocatons */
+#define CONFIG_SYS_GBL_DATA_SIZE 128
+#define CONFIG_STACKSIZE (128 * 1024)
+
+#if defined(CONFIG_USE_IRQ)
+#define CONFIG_STACKSIZE_IRQ (4 * 1024)
+#define CONFIG_STACKSIZE_FIQ (4 * 1024)
+#endif
+
+#define CONFIG_SYS_MALLOC_LEN (512 * 1024)
+
+/* -----------------------------------------------------------------------------
+ * FLASH and environment organization
+ *
+ * The EDB9301 and EDB9302(a) have 1 bank of flash memory at 0x60000000
+ * consisting of 1x Intel TE28F128J3C-150 128 Mbit flash on a 16-bit data bus,
+ * for a total of 16 MB of CFI-compatible flash.
+ *
+ * The EDB9307(a), EDB9312, and EDB9315(a) have 1 bank of flash memory at
+ * 0x60000000 consisting of 2x Micron MT28F128J3-12 128 Mbit flash on a 32-bit
+ * data bus, for a total of 32 MB of CFI-compatible flash.
+ *
+ * EDB9301/02(a) EDB9307(a)/12/15(a)
+ * 0x60000000 - 0x0003FFFF u-boot u-boot
+ * 0x60040000 - 0x0005FFFF environment #1 environment #1
+ * 0x60060000 - 0x0007FFFF environment #2 environment #1 (continued)
+ * 0x60080000 - 0x0009FFFF unused environment #2
+ * 0x600A0000 - 0x000BFFFF unused environment #2 (continued)
+ * 0x600C0000 - 0x00FFFFFF unused unused
+ * 0x61000000 - 0x01FFFFFF not present unused
+ */
+#define CONFIG_SYS_FLASH_CFI
+#define CONFIG_FLASH_CFI_DRIVER
+#define CONFIG_SYS_MAX_FLASH_BANKS 1
+#define CONFIG_SYS_MAX_FLASH_SECT 128
+
+#define PHYS_FLASH_1 0x60000000
+#define CONFIG_SYS_FLASH_BASE (PHYS_FLASH_1)
+#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_FLASH_BASE
+#define CONFIG_SYS_MONITOR_LEN (256 * 1024)
+
+#define CONFIG_ENV_OVERWRITE /* Vendor params unprotected */
+#define CONFIG_ENV_IS_IN_FLASH
+#define CONFIG_ENV_ADDR 0x60040000
+
+#define CONFIG_ENV_ADDR_REDUND (CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE)
+
+#define CONFIG_ENV_SIZE CONFIG_ENV_SECT_SIZE
+#define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE
+
+#endif /* !defined (__CONFIG_H) */
--
1.6.5
1
0