svn commit: r236081 - stable/9/sys/arm/at91
Marius Strobl
marius at FreeBSD.org
Sat May 26 09:05:46 UTC 2012
Author: marius
Date: Sat May 26 09:05:45 2012
New Revision: 236081
URL: http://svn.freebsd.org/changeset/base/236081
Log:
MFC: r234291, r234292
Add support for the Atmel SAM9XE family of microcontrollers, which
consist of a ARM926EJ-S processor core with up to 512 Kbytes of on-chip
flash. Tested with SAM9XE512.
Modified:
stable/9/sys/arm/at91/at91_pit.c
stable/9/sys/arm/at91/at91_pmc.c
stable/9/sys/arm/at91/at91_rst.c
stable/9/sys/arm/at91/at91_twireg.h
stable/9/sys/arm/at91/at91_wdt.c
stable/9/sys/arm/at91/at91reg.h
stable/9/sys/arm/at91/at91sam9260.c
stable/9/sys/arm/at91/at91var.h
stable/9/sys/arm/at91/if_ate.c
Directory Properties:
stable/9/sys/ (props changed)
stable/9/sys/amd64/include/xen/ (props changed)
stable/9/sys/boot/ (props changed)
stable/9/sys/boot/i386/efi/ (props changed)
stable/9/sys/boot/ia64/efi/ (props changed)
stable/9/sys/boot/ia64/ski/ (props changed)
stable/9/sys/boot/powerpc/boot1.chrp/ (props changed)
stable/9/sys/boot/powerpc/ofw/ (props changed)
stable/9/sys/cddl/contrib/opensolaris/ (props changed)
stable/9/sys/conf/ (props changed)
stable/9/sys/contrib/dev/acpica/ (props changed)
stable/9/sys/contrib/octeon-sdk/ (props changed)
stable/9/sys/contrib/pf/ (props changed)
stable/9/sys/contrib/x86emu/ (props changed)
stable/9/sys/dev/ (props changed)
stable/9/sys/dev/e1000/ (props changed)
stable/9/sys/dev/ixgbe/ (props changed)
stable/9/sys/fs/ (props changed)
stable/9/sys/fs/ntfs/ (props changed)
stable/9/sys/modules/ (props changed)
Modified: stable/9/sys/arm/at91/at91_pit.c
==============================================================================
--- stable/9/sys/arm/at91/at91_pit.c Sat May 26 09:03:14 2012 (r236080)
+++ stable/9/sys/arm/at91/at91_pit.c Sat May 26 09:05:45 2012 (r236081)
@@ -90,7 +90,7 @@ static int
at91pit_probe(device_t dev)
{
- if (at91_is_sam9()) {
+ if (at91_is_sam9() || at91_is_sam9xe()) {
device_set_desc(dev, "AT91SAM9 PIT");
return (0);
}
Modified: stable/9/sys/arm/at91/at91_pmc.c
==============================================================================
--- stable/9/sys/arm/at91/at91_pmc.c Sat May 26 09:03:14 2012 (r236080)
+++ stable/9/sys/arm/at91/at91_pmc.c Sat May 26 09:05:45 2012 (r236081)
@@ -162,12 +162,14 @@ static const unsigned int at91_mainf_tbl
static inline uint32_t
RD4(struct at91_pmc_softc *sc, bus_size_t off)
{
+
return (bus_read_4(sc->mem_res, off));
}
static inline void
WR4(struct at91_pmc_softc *sc, bus_size_t off, uint32_t val)
{
+
bus_write_4(sc->mem_res, off, val);
}
@@ -225,7 +227,8 @@ at91_pmc_set_periph_mode(struct at91_pmc
}
struct at91_pmc_clock *
-at91_pmc_clock_add(const char *name, uint32_t irq, struct at91_pmc_clock *parent)
+at91_pmc_clock_add(const char *name, uint32_t irq,
+ struct at91_pmc_clock *parent)
{
struct at91_pmc_clock *clk;
int i, buflen;
@@ -299,11 +302,13 @@ at91_pmc_clock_ref(const char *name)
void
at91_pmc_clock_deref(struct at91_pmc_clock *clk)
{
+
}
void
at91_pmc_clock_enable(struct at91_pmc_clock *clk)
{
+
/* XXX LOCKING? XXX */
if (clk->parent)
at91_pmc_clock_enable(clk->parent);
@@ -314,6 +319,7 @@ at91_pmc_clock_enable(struct at91_pmc_cl
void
at91_pmc_clock_disable(struct at91_pmc_clock *clk)
{
+
/* XXX LOCKING? XXX */
if (--clk->refcnt == 0 && clk->set_mode)
clk->set_mode(clk, 0);
@@ -342,7 +348,6 @@ at91_pmc_pll_rate(struct at91_pmc_clock
freq = 0;
clk->hz = freq;
-
return (freq);
}
@@ -402,7 +407,7 @@ at91_pmc_init_clock(struct at91_pmc_soft
uint32_t mckr;
uint32_t mdiv;
- if (at91_is_sam9()) {
+ if (at91_is_sam9() || at91_is_sam9xe()) {
uhpck.pmc_mask = PMC_SCER_UHP_SAM9;
udpck.pmc_mask = PMC_SCER_UDP_SAM9;
}
@@ -446,7 +451,7 @@ at91_pmc_init_clock(struct at91_pmc_soft
(1 << ((mckr & PMC_MCKR_PRES_MASK) >> 2));
mdiv = (mckr & PMC_MCKR_MDIV_MASK) >> 8;
- if (at91_is_sam9()) {
+ if (at91_is_sam9() || at91_is_sam9xe()) {
if (mdiv > 0)
mck.hz /= mdiv * 2;
} else
@@ -486,7 +491,6 @@ at91_pmc_deactivate(device_t dev)
bus_release_resource(dev, SYS_RES_IOPORT,
rman_get_rid(sc->mem_res), sc->mem_res);
sc->mem_res = 0;
- return;
}
static int
Modified: stable/9/sys/arm/at91/at91_rst.c
==============================================================================
--- stable/9/sys/arm/at91/at91_rst.c Sat May 26 09:03:14 2012 (r236080)
+++ stable/9/sys/arm/at91/at91_rst.c Sat May 26 09:05:45 2012 (r236081)
@@ -71,7 +71,7 @@ static int
at91_rst_probe(device_t dev)
{
- if (at91_is_sam9()) {
+ if (at91_is_sam9() || at91_is_sam9xe()) {
device_set_desc(dev, "AT91SAM9 Reset Controller");
return (0);
}
Modified: stable/9/sys/arm/at91/at91_twireg.h
==============================================================================
--- stable/9/sys/arm/at91/at91_twireg.h Sat May 26 09:03:14 2012 (r236080)
+++ stable/9/sys/arm/at91/at91_twireg.h Sat May 26 09:05:45 2012 (r236081)
@@ -64,7 +64,7 @@
#define TWI_CWGR_CHDIV(x) ((x) << 8) /* Clock High Divider */
#define TWI_CWGR_CLDIV(x) ((x) << 0) /* Clock Low Divider */
#define TWI_CWGR_DIV(rate) \
- (at91_is_sam9() ? \
+ (at91_is_sam9() || at91_is_sam9xe() ? \
((at91_master_clock / (4 * (rate))) - 3) : \
((at91_master_clock / (4 * (rate))) - 2))
Modified: stable/9/sys/arm/at91/at91_wdt.c
==============================================================================
--- stable/9/sys/arm/at91/at91_wdt.c Sat May 26 09:03:14 2012 (r236080)
+++ stable/9/sys/arm/at91/at91_wdt.c Sat May 26 09:05:45 2012 (r236081)
@@ -132,7 +132,7 @@ static int
wdt_probe(device_t dev)
{
- if (at91_is_sam9()) {
+ if (at91_is_sam9() || at91_is_sam9xe()) {
device_set_desc(dev, "WDT");
return (0);
}
Modified: stable/9/sys/arm/at91/at91reg.h
==============================================================================
--- stable/9/sys/arm/at91/at91reg.h Sat May 26 09:03:14 2012 (r236080)
+++ stable/9/sys/arm/at91/at91reg.h Sat May 26 09:05:45 2012 (r236081)
@@ -61,6 +61,9 @@
#define AT91_CPU_SAM9G10 0x819903a0
#define AT91_CPU_SAM9G20 0x019905a0
#define AT91_CPU_SAM9G45 0x819b05a0
+#define AT91_CPU_SAM9XE128 0x329973a0
+#define AT91_CPU_SAM9XE256 0x329a93a0
+#define AT91_CPU_SAM9XE512 0x329aa3a0
#define AT91_ARCH(chipid) ((chipid >> 20) & 0xff)
#define AT91_CPU(chipid) (chipid & ~AT91_CPU_VERSION_MASK)
Modified: stable/9/sys/arm/at91/at91sam9260.c
==============================================================================
--- stable/9/sys/arm/at91/at91sam9260.c Sat May 26 09:03:14 2012 (r236080)
+++ stable/9/sys/arm/at91/at91sam9260.c Sat May 26 09:05:45 2012 (r236081)
@@ -197,21 +197,40 @@ static void
at91_identify(driver_t *drv, device_t parent)
{
- if (at91_cpu_is(AT91_CPU_SAM9260)) {
+ switch (AT91_CPU(at91_chip_id)) {
+ case AT91_CPU_SAM9260:
+ case AT91_CPU_SAM9XE128:
+ case AT91_CPU_SAM9XE256:
+ case AT91_CPU_SAM9XE512:
at91_add_child(parent, 0, "at91sam9260", 0, 0, 0, -1, 0, 0);
at91_cpu_add_builtin_children(parent);
+ break;
}
}
static int
at91_probe(device_t dev)
{
+ const char *desc;
- if (at91_cpu_is(AT91_CPU_SAM9260)) {
- device_set_desc(dev, "AT91SAM9260");
- return (0);
+ switch (AT91_CPU(at91_chip_id)) {
+ case AT91_CPU_SAM9260:
+ desc = "AT91SAM9260";
+ break;
+ case AT91_CPU_SAM9XE128:
+ desc = "AT91SAM9XE128";
+ break;
+ case AT91_CPU_SAM9XE256:
+ desc = "AT91SAM9XE256";
+ break;
+ case AT91_CPU_SAM9XE512:
+ desc = "AT91SAM9XE512";
+ break;
+ default:
+ return (ENXIO);
}
- return (ENXIO);
+ device_set_desc(dev, desc);
+ return (0);
}
static int
@@ -227,10 +246,6 @@ at91_attach(device_t dev)
sc->sc_sh = at91sc->sc_sh;
sc->dev = dev;
- /*
- * XXX These values work for the RM9200, SAM926[01], and SAM9260
- * will have to fix this when we want to support anything else. XXX
- */
if (bus_space_subregion(sc->sc_st, sc->sc_sh, AT91SAM9260_SYS_BASE,
AT91SAM9260_SYS_SIZE, &sc->sc_sys_sh) != 0)
panic("Enable to map system registers");
Modified: stable/9/sys/arm/at91/at91var.h
==============================================================================
--- stable/9/sys/arm/at91/at91var.h Sat May 26 09:03:14 2012 (r236080)
+++ stable/9/sys/arm/at91/at91var.h Sat May 26 09:05:45 2012 (r236081)
@@ -63,6 +63,7 @@ extern uint32_t at91_chip_id;
static inline int at91_is_rm92(void);
static inline int at91_is_sam9(void);
+static inline int at91_is_sam9xe(void);
static inline int at91_cpu_is(u_int cpu);
static inline int
@@ -80,6 +81,13 @@ at91_is_sam9(void)
}
static inline int
+at91_is_sam9xe(void)
+{
+
+ return (AT91_ARCH(at91_chip_id) == AT91_ARCH_SAM9XE);
+}
+
+static inline int
at91_cpu_is(u_int cpu)
{
Modified: stable/9/sys/arm/at91/if_ate.c
==============================================================================
--- stable/9/sys/arm/at91/if_ate.c Sat May 26 09:03:14 2012 (r236080)
+++ stable/9/sys/arm/at91/if_ate.c Sat May 26 09:05:45 2012 (r236081)
@@ -266,7 +266,7 @@ ate_attach(device_t dev)
}
/* New or old version, chooses buffer size. */
- sc->is_emacb = at91_is_sam9();
+ sc->is_emacb = at91_is_sam9() || at91_is_sam9xe();
sc->rx_buf_size = RX_BUF_SIZE(sc);
err = ate_activate(dev);
More information about the svn-src-stable-9
mailing list