Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 319617
b: refs/heads/master
c: e5766ae
h: refs/heads/master
i:
  319615: e8b10a1
v: v3
  • Loading branch information
Jonas Gorski authored and Ralf Baechle committed Jul 24, 2012
1 parent e47ad6e commit bda7fc3
Show file tree
Hide file tree
Showing 14 changed files with 266 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 288752a8aa1be6cf89ee5066435a617efd97fb86
refs/heads/master: e5766aea5b9b7519654261c27b639f567b5415b4
3 changes: 3 additions & 0 deletions trunk/arch/mips/bcm63xx/Kconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
menu "CPU support"
depends on BCM63XX

config BCM63XX_CPU_6328
bool "support 6328 CPU"

config BCM63XX_CPU_6338
bool "support 6338 CPU"
select HW_HAS_PCI
Expand Down
12 changes: 9 additions & 3 deletions trunk/arch/mips/bcm63xx/boards/board_bcm963xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -708,9 +708,15 @@ void __init board_prom_init(void)
char cfe_version[32];
u32 val;

/* read base address of boot chip select (0) */
val = bcm_mpi_readl(MPI_CSBASE_REG(0));
val &= MPI_CSBASE_BASE_MASK;
/* read base address of boot chip select (0)
* 6328 does not have MPI but boots from a fixed address
*/
if (BCMCPU_IS_6328())
val = 0x18000000;
else {
val = bcm_mpi_readl(MPI_CSBASE_REG(0));
val &= MPI_CSBASE_BASE_MASK;
}
boot_addr = (u8 *)KSEG1ADDR(val);

/* dump cfe version */
Expand Down
43 changes: 43 additions & 0 deletions trunk/arch/mips/bcm63xx/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ static u16 bcm63xx_cpu_rev;
static unsigned int bcm63xx_cpu_freq;
static unsigned int bcm63xx_memory_size;

static const unsigned long bcm6328_regs_base[] = {
__GEN_CPU_REGS_TABLE(6328)
};

static const int bcm6328_irqs[] = {
__GEN_CPU_IRQ_TABLE(6328)
};

static const unsigned long bcm6338_regs_base[] = {
__GEN_CPU_REGS_TABLE(6338)
};
Expand Down Expand Up @@ -99,6 +107,33 @@ unsigned int bcm63xx_get_memory_size(void)
static unsigned int detect_cpu_clock(void)
{
switch (bcm63xx_get_cpu_id()) {
case BCM6328_CPU_ID:
{
unsigned int tmp, mips_pll_fcvo;

tmp = bcm_misc_readl(MISC_STRAPBUS_6328_REG);
mips_pll_fcvo = (tmp & STRAPBUS_6328_FCVO_MASK)
>> STRAPBUS_6328_FCVO_SHIFT;

switch (mips_pll_fcvo) {
case 0x12:
case 0x14:
case 0x19:
return 160000000;
case 0x1c:
return 192000000;
case 0x13:
case 0x15:
return 200000000;
case 0x1a:
return 384000000;
case 0x16:
return 400000000;
default:
return 320000000;
}

}
case BCM6338_CPU_ID:
/* BCM6338 has a fixed 240 Mhz frequency */
return 240000000;
Expand Down Expand Up @@ -170,6 +205,9 @@ static unsigned int detect_memory_size(void)
unsigned int cols = 0, rows = 0, is_32bits = 0, banks = 0;
u32 val;

if (BCMCPU_IS_6328())
return bcm_ddr_readl(DDR_CSEND_REG) << 24;

if (BCMCPU_IS_6345()) {
val = bcm_sdram_readl(SDRAM_MBASE_REG);
return (val * 8 * 1024 * 1024);
Expand Down Expand Up @@ -237,6 +275,11 @@ void __init bcm63xx_cpu_init(void)
u16 chip_id = bcm_readw(BCM_6368_PERF_BASE);

switch (chip_id) {
case BCM6328_CPU_ID:
expected_cpu_id = BCM6328_CPU_ID;
bcm63xx_regs_base = bcm6328_regs_base;
bcm63xx_irqs = bcm6328_irqs;
break;
case BCM6368_CPU_ID:
expected_cpu_id = BCM6368_CPU_ID;
bcm63xx_regs_base = bcm6368_regs_base;
Expand Down
6 changes: 6 additions & 0 deletions trunk/arch/mips/bcm63xx/dev-flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ static int __init bcm63xx_detect_flash_type(void)
u32 val;

switch (bcm63xx_get_cpu_id()) {
case BCM6328_CPU_ID:
val = bcm_misc_readl(MISC_STRAPBUS_6328_REG);
if (val & STRAPBUS_6328_BOOT_SEL_SERIAL)
return BCM63XX_FLASH_TYPE_SERIAL;
else
return BCM63XX_FLASH_TYPE_NAND;
case BCM6338_CPU_ID:
case BCM6345_CPU_ID:
case BCM6348_CPU_ID:
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/mips/bcm63xx/dev-spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ int __init bcm63xx_spi_register(void)
{
struct clk *periph_clk;

if (BCMCPU_IS_6345())
if (BCMCPU_IS_6328() || BCMCPU_IS_6345())
return -ENODEV;

periph_clk = clk_get(NULL, "periph");
Expand Down
21 changes: 21 additions & 0 deletions trunk/arch/mips/bcm63xx/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ static void __internal_irq_unmask_32(unsigned int irq) __maybe_unused;
static void __internal_irq_unmask_64(unsigned int irq) __maybe_unused;

#ifndef BCMCPU_RUNTIME_DETECT
#ifdef CONFIG_BCM63XX_CPU_6328
#define irq_stat_reg PERF_IRQSTAT_6328_REG
#define irq_mask_reg PERF_IRQMASK_6328_REG
#define irq_bits 64
#define is_ext_irq_cascaded 1
#define ext_irq_start (BCM_6328_EXT_IRQ0 - IRQ_INTERNAL_BASE)
#define ext_irq_end (BCM_6328_EXT_IRQ3 - IRQ_INTERNAL_BASE)
#define ext_irq_count 4
#define ext_irq_cfg_reg1 PERF_EXTIRQ_CFG_REG_6328
#define ext_irq_cfg_reg2 0
#endif
#ifdef CONFIG_BCM63XX_CPU_6338
#define irq_stat_reg PERF_IRQSTAT_6338_REG
#define irq_mask_reg PERF_IRQMASK_6338_REG
Expand Down Expand Up @@ -118,6 +129,16 @@ static void bcm63xx_init_irq(void)
irq_mask_addr = bcm63xx_regset_address(RSET_PERF);

switch (bcm63xx_get_cpu_id()) {
case BCM6328_CPU_ID:
irq_stat_addr += PERF_IRQSTAT_6328_REG;
irq_mask_addr += PERF_IRQMASK_6328_REG;
irq_bits = 64;
ext_irq_count = 4;
is_ext_irq_cascaded = 1;
ext_irq_start = BCM_6328_EXT_IRQ0 - IRQ_INTERNAL_BASE;
ext_irq_end = BCM_6328_EXT_IRQ3 - IRQ_INTERNAL_BASE;
ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6328;
break;
case BCM6338_CPU_ID:
irq_stat_addr += PERF_IRQSTAT_6338_REG;
irq_mask_addr += PERF_IRQMASK_6338_REG;
Expand Down
4 changes: 3 additions & 1 deletion trunk/arch/mips/bcm63xx/prom.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ void __init prom_init(void)
bcm_wdt_writel(WDT_STOP_2, WDT_CTL_REG);

/* disable all hardware blocks clock for now */
if (BCMCPU_IS_6338())
if (BCMCPU_IS_6328())
mask = CKCTL_6328_ALL_SAFE_EN;
else if (BCMCPU_IS_6338())
mask = CKCTL_6338_ALL_SAFE_EN;
else if (BCMCPU_IS_6345())
mask = CKCTL_6345_ALL_SAFE_EN;
Expand Down
13 changes: 10 additions & 3 deletions trunk/arch/mips/bcm63xx/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ void bcm63xx_machine_reboot(void)

/* mask and clear all external irq */
switch (bcm63xx_get_cpu_id()) {
case BCM6328_CPU_ID:
perf_regs[0] = PERF_EXTIRQ_CFG_REG_6328;
break;
case BCM6338_CPU_ID:
perf_regs[0] = PERF_EXTIRQ_CFG_REG_6338;
break;
Expand Down Expand Up @@ -95,9 +98,13 @@ void bcm63xx_machine_reboot(void)
bcm6348_a1_reboot();

printk(KERN_INFO "triggering watchdog soft-reset...\n");
reg = bcm_perf_readl(PERF_SYS_PLL_CTL_REG);
reg |= SYS_PLL_SOFT_RESET;
bcm_perf_writel(reg, PERF_SYS_PLL_CTL_REG);
if (BCMCPU_IS_6328()) {
bcm_wdt_writel(1, WDT_SOFTRESET_REG);
} else {
reg = bcm_perf_readl(PERF_SYS_PLL_CTL_REG);
reg |= SYS_PLL_SOFT_RESET;
bcm_perf_writel(reg, PERF_SYS_PLL_CTL_REG);
}
while (1)
;
}
Expand Down
Loading

0 comments on commit bda7fc3

Please sign in to comment.