mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
MIPS: Alchemy: Extended DB1200 board support.
Create own directory for DB1200 code and update it with new features. - SPI support: - tmp121 temperature sensor - SPI flash on DB1200 - I2C support - NE1619 sensor - AT24 eeprom - I2C/SPI can be selected at boot time via switch S6.8 - Carddetect IRQs for SD cards. - gen_nand based NAND support. - hexleds count sleep/wake transitions. Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com> Cc: Linux-MIPS <linux-mips@linux-mips.org> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
This commit is contained in:
committed by
Ralf Baechle
parent
206aa6cdad
commit
63323ec54a
@@ -164,9 +164,6 @@ void au1000_halt(void)
|
||||
#ifdef CONFIG_MIPS_MIRAGE
|
||||
gpio_direction_output(210, 1);
|
||||
#endif
|
||||
#ifdef CONFIG_MIPS_DB1200
|
||||
au_writew(au_readw(0xB980001C) | (1 << 14), 0xB980001C);
|
||||
#endif
|
||||
#ifdef CONFIG_PM
|
||||
au_sleep();
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ obj-$(CONFIG_MIPS_PB1500) += pb1500/
|
||||
obj-$(CONFIG_MIPS_PB1550) += pb1550/
|
||||
obj-$(CONFIG_MIPS_DB1000) += db1x00/
|
||||
obj-$(CONFIG_MIPS_DB1100) += db1x00/
|
||||
obj-$(CONFIG_MIPS_DB1200) += pb1200/
|
||||
obj-$(CONFIG_MIPS_DB1200) += db1200/
|
||||
obj-$(CONFIG_MIPS_DB1500) += db1x00/
|
||||
obj-$(CONFIG_MIPS_DB1550) += db1x00/
|
||||
obj-$(CONFIG_MIPS_BOSPORUS) += db1x00/
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
obj-y += setup.o platform.o
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,137 @@
|
||||
/*
|
||||
* Alchemy/AMD/RMI DB1200 board setup.
|
||||
*
|
||||
* Licensed under the terms outlined in the file COPYING in the root of
|
||||
* this source archive.
|
||||
*/
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/pm.h>
|
||||
#include <asm/mach-au1x00/au1000.h>
|
||||
#include <asm/mach-db1x00/bcsr.h>
|
||||
#include <asm/mach-db1x00/db1200.h>
|
||||
#include <asm/processor.h>
|
||||
#include <asm/reboot.h>
|
||||
|
||||
const char *get_system_type(void)
|
||||
{
|
||||
return "Alchemy Db1200";
|
||||
}
|
||||
|
||||
static void board_power_off(void)
|
||||
{
|
||||
bcsr_write(BCSR_RESETS, 0);
|
||||
bcsr_write(BCSR_SYSTEM, BCSR_SYSTEM_PWROFF | BCSR_SYSTEM_RESET);
|
||||
}
|
||||
|
||||
void board_reset(void)
|
||||
{
|
||||
bcsr_write(BCSR_RESETS, 0);
|
||||
bcsr_write(BCSR_SYSTEM, 0);
|
||||
}
|
||||
|
||||
void __init board_setup(void)
|
||||
{
|
||||
unsigned long freq0, clksrc, div, pfc;
|
||||
unsigned short whoami;
|
||||
|
||||
bcsr_init(DB1200_BCSR_PHYS_ADDR,
|
||||
DB1200_BCSR_PHYS_ADDR + DB1200_BCSR_HEXLED_OFS);
|
||||
|
||||
whoami = bcsr_read(BCSR_WHOAMI);
|
||||
printk(KERN_INFO "Alchemy/AMD/RMI DB1200 Board, CPLD Rev %d"
|
||||
" Board-ID %d Daughtercard ID %d\n",
|
||||
(whoami >> 4) & 0xf, (whoami >> 8) & 0xf, whoami & 0xf);
|
||||
|
||||
/* SMBus/SPI on PSC0, Audio on PSC1 */
|
||||
pfc = __raw_readl((void __iomem *)SYS_PINFUNC);
|
||||
pfc &= ~(SYS_PINFUNC_P0A | SYS_PINFUNC_P0B);
|
||||
pfc &= ~(SYS_PINFUNC_P1A | SYS_PINFUNC_P1B | SYS_PINFUNC_FS3);
|
||||
pfc |= SYS_PINFUNC_P1C; /* SPI is configured later */
|
||||
__raw_writel(pfc, (void __iomem *)SYS_PINFUNC);
|
||||
wmb();
|
||||
|
||||
/* Clock configurations: PSC0: ~50MHz via Clkgen0, derived from
|
||||
* CPU clock; all other clock generators off/unused.
|
||||
*/
|
||||
div = (get_au1x00_speed() + 25000000) / 50000000;
|
||||
if (div & 1)
|
||||
div++;
|
||||
div = ((div >> 1) - 1) & 0xff;
|
||||
|
||||
freq0 = div << SYS_FC_FRDIV0_BIT;
|
||||
__raw_writel(freq0, (void __iomem *)SYS_FREQCTRL0);
|
||||
wmb();
|
||||
freq0 |= SYS_FC_FE0; /* enable F0 */
|
||||
__raw_writel(freq0, (void __iomem *)SYS_FREQCTRL0);
|
||||
wmb();
|
||||
|
||||
/* psc0_intclk comes 1:1 from F0 */
|
||||
clksrc = SYS_CS_MUX_FQ0 << SYS_CS_ME0_BIT;
|
||||
__raw_writel(clksrc, (void __iomem *)SYS_CLKSRC);
|
||||
wmb();
|
||||
|
||||
pm_power_off = board_power_off;
|
||||
_machine_halt = board_power_off;
|
||||
_machine_restart = (void(*)(char *))board_reset;
|
||||
}
|
||||
|
||||
/* use the hexleds to count the number of times the cpu has entered
|
||||
* wait, the dots to indicate whether the CPU is currently idle or
|
||||
* active (dots off = sleeping, dots on = working) for cases where
|
||||
* the number doesn't change for a long(er) period of time.
|
||||
*/
|
||||
static void db1200_wait(void)
|
||||
{
|
||||
__asm__(" .set push \n"
|
||||
" .set mips3 \n"
|
||||
" .set noreorder \n"
|
||||
" cache 0x14, 0(%0) \n"
|
||||
" cache 0x14, 32(%0) \n"
|
||||
" cache 0x14, 64(%0) \n"
|
||||
/* dots off: we're about to call wait */
|
||||
" lui $26, 0xb980 \n"
|
||||
" ori $27, $0, 3 \n"
|
||||
" sb $27, 0x18($26) \n"
|
||||
" sync \n"
|
||||
" nop \n"
|
||||
" wait \n"
|
||||
" nop \n"
|
||||
" nop \n"
|
||||
" nop \n"
|
||||
" nop \n"
|
||||
" nop \n"
|
||||
/* dots on: there's work to do, increment cntr */
|
||||
" lui $26, 0xb980 \n"
|
||||
" sb $0, 0x18($26) \n"
|
||||
" lui $26, 0xb9c0 \n"
|
||||
" lb $27, 0($26) \n"
|
||||
" addiu $27, $27, 1 \n"
|
||||
" sb $27, 0($26) \n"
|
||||
" sync \n"
|
||||
" .set pop \n"
|
||||
: : "r" (db1200_wait));
|
||||
}
|
||||
|
||||
static int __init db1200_arch_init(void)
|
||||
{
|
||||
/* GPIO7 is low-level triggered CPLD cascade */
|
||||
set_irq_type(AU1200_GPIO7_INT, IRQF_TRIGGER_LOW);
|
||||
bcsr_init_irq(DB1200_INT_BEGIN, DB1200_INT_END, AU1200_GPIO7_INT);
|
||||
|
||||
/* do not autoenable these: CPLD has broken edge int handling,
|
||||
* and the CD handler setup requires manual enabling to work
|
||||
* around that.
|
||||
*/
|
||||
irq_to_desc(DB1200_SD0_INSERT_INT)->status |= IRQ_NOAUTOEN;
|
||||
irq_to_desc(DB1200_SD0_EJECT_INT)->status |= IRQ_NOAUTOEN;
|
||||
|
||||
if (cpu_wait)
|
||||
cpu_wait = db1200_wait;
|
||||
|
||||
return 0;
|
||||
}
|
||||
arch_initcall(db1200_arch_init);
|
||||
@@ -58,16 +58,9 @@ void __init board_setup(void)
|
||||
{
|
||||
char *argptr;
|
||||
|
||||
#ifdef CONFIG_MIPS_PB1200
|
||||
printk(KERN_INFO "AMD Alchemy Pb1200 Board\n");
|
||||
bcsr_init(PB1200_BCSR_PHYS_ADDR,
|
||||
PB1200_BCSR_PHYS_ADDR + PB1200_BCSR_HEXLED_OFS);
|
||||
#endif
|
||||
#ifdef CONFIG_MIPS_DB1200
|
||||
printk(KERN_INFO "AMD Alchemy Db1200 Board\n");
|
||||
bcsr_init(DB1200_BCSR_PHYS_ADDR,
|
||||
DB1200_BCSR_PHYS_ADDR + DB1200_BCSR_HEXLED_OFS);
|
||||
#endif
|
||||
|
||||
argptr = prom_getcmdline();
|
||||
#ifdef CONFIG_SERIAL_8250_CONSOLE
|
||||
@@ -149,7 +142,6 @@ void __init board_setup(void)
|
||||
|
||||
static int __init pb1200_init_irq(void)
|
||||
{
|
||||
#ifdef CONFIG_MIPS_PB1200
|
||||
/* We have a problem with CPLD rev 3. */
|
||||
if (BCSR_WHOAMI_CPLD(bcsr_read(BCSR_WHOAMI)) <= 3) {
|
||||
printk(KERN_ERR "WARNING!!!\n");
|
||||
@@ -169,7 +161,6 @@ static int __init pb1200_init_irq(void)
|
||||
printk(KERN_ERR "WARNING!!!\n");
|
||||
panic("Game over. Your score is 0.");
|
||||
}
|
||||
#endif
|
||||
|
||||
set_irq_type(AU1200_GPIO7_INT, IRQF_TRIGGER_LOW);
|
||||
bcsr_init_irq(PB1200_INT_BEGIN, PB1200_INT_END, AU1200_GPIO7_INT);
|
||||
|
||||
@@ -68,7 +68,6 @@ static struct led_classdev pb1200mmc_led = {
|
||||
.brightness_set = pb1200_mmcled_set,
|
||||
};
|
||||
|
||||
#ifndef CONFIG_MIPS_DB1200
|
||||
static void pb1200mmc1_set_power(void *mmc_host, int state)
|
||||
{
|
||||
if (state)
|
||||
@@ -88,7 +87,6 @@ static int pb1200mmc1_card_inserted(void *mmc_host)
|
||||
{
|
||||
return (bcsr_read(BCSR_SIGSTAT) & BCSR_INT_SD1INSERT) ? 1 : 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
const struct au1xmmc_platform_data au1xmmc_platdata[2] = {
|
||||
[0] = {
|
||||
@@ -98,7 +96,6 @@ const struct au1xmmc_platform_data au1xmmc_platdata[2] = {
|
||||
.cd_setup = NULL, /* use poll-timer in driver */
|
||||
.led = &pb1200mmc_led,
|
||||
},
|
||||
#ifndef CONFIG_MIPS_DB1200
|
||||
[1] = {
|
||||
.set_power = pb1200mmc1_set_power,
|
||||
.card_inserted = pb1200mmc1_card_inserted,
|
||||
@@ -106,7 +103,6 @@ const struct au1xmmc_platform_data au1xmmc_platdata[2] = {
|
||||
.cd_setup = NULL, /* use poll-timer in driver */
|
||||
.led = &pb1200mmc_led,
|
||||
},
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct resource ide_resources[] = {
|
||||
@@ -174,7 +170,6 @@ static int __init board_register_devices(void)
|
||||
{
|
||||
int swapped;
|
||||
|
||||
#ifdef CONFIG_MIPS_PB1200
|
||||
db1x_register_pcmcia_socket(PCMCIA_ATTR_PSEUDO_PHYS,
|
||||
PCMCIA_ATTR_PSEUDO_PHYS + 0x00040000 - 1,
|
||||
PCMCIA_MEM_PSEUDO_PHYS,
|
||||
@@ -198,38 +193,9 @@ static int __init board_register_devices(void)
|
||||
/*PB1200_PC1_STSCHG_INT*/0,
|
||||
PB1200_PC1_EJECT_INT,
|
||||
1);
|
||||
#else
|
||||
db1x_register_pcmcia_socket(PCMCIA_ATTR_PSEUDO_PHYS,
|
||||
PCMCIA_ATTR_PSEUDO_PHYS + 0x00040000 - 1,
|
||||
PCMCIA_MEM_PSEUDO_PHYS,
|
||||
PCMCIA_MEM_PSEUDO_PHYS + 0x00040000 - 1,
|
||||
PCMCIA_IO_PSEUDO_PHYS,
|
||||
PCMCIA_IO_PSEUDO_PHYS + 0x00001000 - 1,
|
||||
DB1200_PC0_INT,
|
||||
DB1200_PC0_INSERT_INT,
|
||||
/*DB1200_PC0_STSCHG_INT*/0,
|
||||
DB1200_PC0_EJECT_INT,
|
||||
0);
|
||||
|
||||
db1x_register_pcmcia_socket(PCMCIA_ATTR_PSEUDO_PHYS + 0x00400000,
|
||||
PCMCIA_ATTR_PSEUDO_PHYS + 0x00440000 - 1,
|
||||
PCMCIA_MEM_PSEUDO_PHYS + 0x00400000,
|
||||
PCMCIA_MEM_PSEUDO_PHYS + 0x00440000 - 1,
|
||||
PCMCIA_IO_PSEUDO_PHYS + 0x00400000,
|
||||
PCMCIA_IO_PSEUDO_PHYS + 0x00401000 - 1,
|
||||
DB1200_PC1_INT,
|
||||
DB1200_PC1_INSERT_INT,
|
||||
/*DB1200_PC1_STSCHG_INT*/0,
|
||||
DB1200_PC1_EJECT_INT,
|
||||
1);
|
||||
#endif
|
||||
|
||||
swapped = bcsr_read(BCSR_STATUS) & BCSR_STATUS_DB1200_SWAPBOOT;
|
||||
#ifdef CONFIG_MIPS_PB1200
|
||||
db1x_register_norflash(128 * 1024 * 1024, 2, swapped);
|
||||
#else
|
||||
db1x_register_norflash(64 * 1024 * 1024, 2, swapped);
|
||||
#endif
|
||||
|
||||
return platform_add_devices(board_platform_devices,
|
||||
ARRAY_SIZE(board_platform_devices));
|
||||
|
||||
@@ -28,24 +28,6 @@
|
||||
#include <asm/mach-au1x00/au1000.h>
|
||||
#include <asm/mach-au1x00/au1xxx_psc.h>
|
||||
|
||||
#define DBDMA_AC97_TX_CHAN DSCR_CMD0_PSC1_TX
|
||||
#define DBDMA_AC97_RX_CHAN DSCR_CMD0_PSC1_RX
|
||||
#define DBDMA_I2S_TX_CHAN DSCR_CMD0_PSC1_TX
|
||||
#define DBDMA_I2S_RX_CHAN DSCR_CMD0_PSC1_RX
|
||||
|
||||
/*
|
||||
* SPI and SMB are muxed on the DBAu1200 board.
|
||||
* Refer to board documentation.
|
||||
*/
|
||||
#define SPI_PSC_BASE PSC0_BASE_ADDR
|
||||
#define SMBUS_PSC_BASE PSC0_BASE_ADDR
|
||||
/*
|
||||
* AC'97 and I2S are muxed on the DBAu1200 board.
|
||||
* Refer to board documentation.
|
||||
*/
|
||||
#define AC97_PSC_BASE PSC1_BASE_ADDR
|
||||
#define I2S_PSC_BASE PSC1_BASE_ADDR
|
||||
|
||||
/* Bit positions for the different interrupt sources */
|
||||
#define BCSR_INT_IDE 0x0001
|
||||
#define BCSR_INT_ETH 0x0002
|
||||
@@ -62,17 +44,15 @@
|
||||
#define BCSR_INT_SD0INSERT 0x1000
|
||||
#define BCSR_INT_SD0EJECT 0x2000
|
||||
|
||||
#define SMC91C111_PHYS_ADDR 0x19000300
|
||||
#define SMC91C111_INT DB1200_ETH_INT
|
||||
|
||||
#define IDE_PHYS_ADDR 0x18800000
|
||||
#define IDE_REG_SHIFT 5
|
||||
#define IDE_PHYS_LEN (16 << IDE_REG_SHIFT)
|
||||
#define IDE_INT DB1200_IDE_INT
|
||||
#define IDE_DDMA_REQ DSCR_CMD0_DMA_REQ1
|
||||
#define IDE_RQSIZE 128
|
||||
|
||||
#define NAND_PHYS_ADDR 0x20000000
|
||||
#define DB1200_IDE_PHYS_ADDR IDE_PHYS_ADDR
|
||||
#define DB1200_IDE_PHYS_LEN (16 << IDE_REG_SHIFT)
|
||||
#define DB1200_ETH_PHYS_ADDR 0x19000300
|
||||
#define DB1200_NAND_PHYS_ADDR 0x20000000
|
||||
|
||||
/*
|
||||
* External Interrupts for DBAu1200 as of 8/6/2004.
|
||||
@@ -82,7 +62,7 @@
|
||||
* Example: IDE bis pos is = 64 - 64
|
||||
* ETH bit pos is = 65 - 64
|
||||
*/
|
||||
enum external_pb1200_ints {
|
||||
enum external_db1200_ints {
|
||||
DB1200_INT_BEGIN = AU1000_MAX_INTR + 1,
|
||||
|
||||
DB1200_IDE_INT = DB1200_INT_BEGIN,
|
||||
@@ -103,7 +83,4 @@ enum external_pb1200_ints {
|
||||
DB1200_INT_END = DB1200_INT_BEGIN + 15,
|
||||
};
|
||||
|
||||
/* NAND chip select */
|
||||
#define NAND_CS 1
|
||||
|
||||
#endif /* __ASM_DB1200_H */
|
||||
|
||||
Reference in New Issue
Block a user