Add the final glue bits required to enable the SPI interface on the
DBAU1550. This is parameterized somewhat as machdep pluggable code, so different boards can supply different implementations. At the moment, the DBAU1550 is the only Au1550 board I know of with SPI connected devices. I have not enabled I2C on the DBAU1550, as we do not have drivers for either of the I2C connected devices (a different temperature/voltage sensor and a serial eeprom.)
This commit is contained in:
parent
bcad08160c
commit
118d36b6e7
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: board.h,v 1.3 2006/02/23 03:51:40 gdamore Exp $ */
|
||||
/* $NetBSD: board.h,v 1.4 2006/10/02 08:13:53 gdamore Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2006 Itronix Inc.
|
||||
|
@ -48,6 +48,8 @@ struct alchemy_board {
|
|||
|
||||
struct aupcmcia_machdep *ab_pcmcia;
|
||||
|
||||
const struct auspi_machdep *(*ab_spi)(bus_addr_t);
|
||||
|
||||
/*
|
||||
* XXX: csb250 (and perhaps others) will require pci_idsel
|
||||
* entry point
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: dbau1550.c,v 1.6 2006/03/25 07:28:20 gdamore Exp $ */
|
||||
/* $NetBSD: dbau1550.c,v 1.7 2006/10/02 08:13:53 gdamore Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2006 Itronix Inc.
|
||||
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: dbau1550.c,v 1.6 2006/03/25 07:28:20 gdamore Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: dbau1550.c,v 1.7 2006/10/02 08:13:53 gdamore Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
|
@ -45,10 +45,13 @@ __KERNEL_RCSID(0, "$NetBSD: dbau1550.c,v 1.6 2006/03/25 07:28:20 gdamore Exp $")
|
|||
#include <mips/alchemy/dev/aupcmciavar.h>
|
||||
#include <mips/alchemy/dev/aupcmciareg.h>
|
||||
#include <mips/alchemy/dev/augpioreg.h>
|
||||
#include <mips/alchemy/dev/auspivar.h>
|
||||
#include <evbmips/alchemy/obiovar.h>
|
||||
#include <evbmips/alchemy/board.h>
|
||||
#include <evbmips/alchemy/dbau1550reg.h>
|
||||
|
||||
#include "auspi.h"
|
||||
|
||||
/*
|
||||
* This should be converted to use bus_space routines.
|
||||
*/
|
||||
|
@ -72,13 +75,9 @@ static void dbau1550_slot_enable(int);
|
|||
static void dbau1550_slot_disable(int);
|
||||
static int dbau1550_slot_status(int);
|
||||
static const char *dbau1550_slot_name(int);
|
||||
static const struct auspi_machdep *dbau1550_spi(bus_addr_t);
|
||||
|
||||
static const struct obiodev dbau1550_devices[] = {
|
||||
#if 0
|
||||
{ "aupsc", -1, -1 },
|
||||
{ "aupsc", -1, -1 },
|
||||
{ "aupsc", -1, -1 },
|
||||
#endif
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
|
@ -93,13 +92,14 @@ static struct aupcmcia_machdep dbau1550_pcmcia = {
|
|||
};
|
||||
|
||||
static struct alchemy_board dbau1550_info = {
|
||||
"AMD Alchemy DBAu1550",
|
||||
dbau1550_devices,
|
||||
dbau1550_init,
|
||||
dbau1550_pci_intr_map,
|
||||
dbau1550_reboot,
|
||||
dbau1550_poweroff,
|
||||
&dbau1550_pcmcia,
|
||||
.ab_name = "AMD Alchemy DBAu1550",
|
||||
.ab_devices = dbau1550_devices,
|
||||
.ab_init = dbau1550_init,
|
||||
.ab_pci_intr_map =dbau1550_pci_intr_map,
|
||||
.ab_reboot = dbau1550_reboot,
|
||||
.ab_poweroff = dbau1550_poweroff,
|
||||
.ab_pcmcia = &dbau1550_pcmcia,
|
||||
.ab_spi = dbau1550_spi,
|
||||
};
|
||||
|
||||
const struct alchemy_board *
|
||||
|
@ -113,6 +113,8 @@ void
|
|||
dbau1550_init(void)
|
||||
{
|
||||
uint16_t whoami;
|
||||
uint32_t sysclk;
|
||||
uint32_t pinfunc;
|
||||
|
||||
if (MIPS_PRID_COPTS(cpu_id) != MIPS_AU1550)
|
||||
panic("dbau1550: CPU not Au1550");
|
||||
|
@ -133,6 +135,35 @@ dbau1550_init(void)
|
|||
printf("no daughtercard\n");
|
||||
|
||||
/* leave console and clocks alone -- YAMON should have got it right! */
|
||||
|
||||
/*
|
||||
* Initialize PSC clocks.
|
||||
*
|
||||
* PSC0 is SPI. Use 48MHz FREQ1.
|
||||
* PSC1 is AC97.
|
||||
* PSC2 is SMBus, and must be 48MHz. (Configured by YAMON)
|
||||
* PSC3 is I2S.
|
||||
*
|
||||
* FREQ2 is 48MHz for USBH/USBD.
|
||||
*/
|
||||
sysclk = GET32(SYS_CLKSRC);
|
||||
sysclk &= ~(SCS_MP0(7) | SCS_DP0 | SCS_CP0);
|
||||
sysclk |= SCS_MP0(3);
|
||||
PUT32(SYS_CLKSRC, sysclk);
|
||||
|
||||
/*
|
||||
* Configure pin function for PSC devices.
|
||||
*/
|
||||
pinfunc = GET32(SYS_PINFUNC);
|
||||
/* configure PSC0 SYNC1 */
|
||||
pinfunc |= SPF_S0;
|
||||
/* configure PSC2 for SMBus (YAMON default) */
|
||||
pinfunc &= ~SPF_PSC2_MASK;
|
||||
pinfunc |= SPF_PSC2_SMBUS;
|
||||
/* configure PSC3 for I2S (YAMON default) */
|
||||
pinfunc &= ~SPF_PSC3_MASK;
|
||||
pinfunc |= SPF_PSC3_I2S;
|
||||
PUT32(SYS_PINFUNC, pinfunc);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -337,3 +368,40 @@ dbau1550_slot_name(int slot)
|
|||
return "???";
|
||||
}
|
||||
}
|
||||
|
||||
#if NAUSPI > 0
|
||||
|
||||
static int
|
||||
dbau1550_spi_select(void *arg, int slave)
|
||||
{
|
||||
uint16_t status;
|
||||
if ((slave < 0) || (slave > 1))
|
||||
return EINVAL;
|
||||
status = GET16(DBAU1550_BOARD_SPECIFIC);
|
||||
|
||||
if (slave) {
|
||||
status |= DBAU1550_SPI_DEV_SEL;
|
||||
} else {
|
||||
status &= ~DBAU1550_SPI_DEV_SEL;
|
||||
}
|
||||
PUT16(DBAU1550_BOARD_SPECIFIC, status);
|
||||
return 0;
|
||||
}
|
||||
|
||||
const struct auspi_machdep *
|
||||
dbau1550_spi(bus_addr_t ba)
|
||||
{
|
||||
static const struct auspi_machdep md = {
|
||||
.am_nslaves = 2,
|
||||
.am_cookie = NULL,
|
||||
.am_select = dbau1550_spi_select,
|
||||
};
|
||||
|
||||
/* DBAU1550 only has SPI on PSC0 */
|
||||
if (ba != PSC0_BASE)
|
||||
return NULL;
|
||||
|
||||
return &md;
|
||||
}
|
||||
|
||||
#endif /* NAUSPI > 0 */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: dbau1550reg.h,v 1.4 2006/02/23 03:51:40 gdamore Exp $ */
|
||||
/* $NetBSD: dbau1550reg.h,v 1.5 2006/10/02 08:13:53 gdamore Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2006 Itronix Inc.
|
||||
|
@ -81,7 +81,7 @@
|
|||
/*
|
||||
* DBAU1550_BOARD_SPECIFIC
|
||||
*/
|
||||
#define DBAU1550_PCI_SPI_DEV_SEL (1 << 13)
|
||||
#define DBAU1550_SPI_DEV_SEL (1 << 13)
|
||||
#define DBAU1550_PCI_CFG_HOST (1 << 12)
|
||||
#define DBAU1550_PCI_EN_GPIO200_RST (1 << 10)
|
||||
#define DBAU1550_PCI_M33 (1 << 8)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.c,v 1.30 2006/09/09 03:58:46 simonb Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.31 2006/10/02 08:13:53 gdamore Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2006 Itronix Inc.
|
||||
|
@ -107,7 +107,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.30 2006/09/09 03:58:46 simonb Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.31 2006/10/02 08:13:53 gdamore Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_kgdb.h"
|
||||
|
@ -148,6 +148,7 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.30 2006/09/09 03:58:46 simonb Exp $");
|
|||
#include <evbmips/alchemy/board.h>
|
||||
#include <mips/alchemy/dev/aupcivar.h>
|
||||
#include <mips/alchemy/dev/aupcmciavar.h>
|
||||
#include <mips/alchemy/dev/auspivar.h>
|
||||
#include <mips/alchemy/include/aureg.h>
|
||||
#include <mips/alchemy/include/auvar.h>
|
||||
#include <mips/alchemy/include/aubusvar.h>
|
||||
|
@ -556,3 +557,14 @@ aupcmcia_machdep(void)
|
|||
board = board_info();
|
||||
return (board->ab_pcmcia);
|
||||
}
|
||||
|
||||
const struct auspi_machdep *
|
||||
auspi_machdep(bus_addr_t ba)
|
||||
{
|
||||
const struct alchemy_board *board;
|
||||
|
||||
board = board_info();
|
||||
if (board->ab_spi != NULL)
|
||||
return (board->ab_spi(ba));
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: DBAU1550,v 1.8 2006/04/04 04:30:28 gdamore Exp $
|
||||
# $NetBSD: DBAU1550,v 1.9 2006/10/02 08:13:53 gdamore Exp $
|
||||
#
|
||||
# Kernel config for the AMD Alchemy DBAu1550 evaluation board.
|
||||
|
||||
|
@ -57,3 +57,17 @@ atapibus* at atabus?
|
|||
cd* at atapibus? drive ? flags 0x0000 # ATAPI CD-ROM drives
|
||||
sd* at atapibus? drive ? flags 0x0000 # ATAPI disk drives
|
||||
uk* at atapibus? drive ? flags 0x0000 # ATAPI unknown
|
||||
|
||||
# Alchemy On-chip Programmable Serial Controllers
|
||||
aupsc0 at aubus0 addr 0x11a00000
|
||||
aupsc1 at aubus0 addr 0x11b00000
|
||||
aupsc2 at aubus0 addr 0x10a00000
|
||||
aupsc3 at aubus0 addr 0x10b00000
|
||||
|
||||
# Serial Peripheral Interface
|
||||
auspi0 at aupsc0
|
||||
spi0 at auspi0
|
||||
tmp121temp* at spi0 slave 0
|
||||
|
||||
#ausmbus0 at aupsc2
|
||||
#iic0 at ausmbus0
|
||||
|
|
Loading…
Reference in New Issue