2009-03-04 23:21:33 +08:00
|
|
|
/*
|
|
|
|
* s6105 control routines
|
|
|
|
*
|
|
|
|
* Copyright (c) 2009 emlix GmbH
|
|
|
|
*/
|
|
|
|
#include <linux/irq.h>
|
|
|
|
#include <linux/io.h>
|
|
|
|
#include <linux/gpio.h>
|
|
|
|
|
|
|
|
#include <asm/bootparam.h>
|
|
|
|
|
|
|
|
#include <variant/hardware.h>
|
2009-05-11 21:43:34 +08:00
|
|
|
#include <variant/gpio.h>
|
|
|
|
|
2009-03-04 23:21:33 +08:00
|
|
|
#include <platform/gpio.h>
|
|
|
|
|
|
|
|
void platform_halt(void)
|
|
|
|
{
|
|
|
|
local_irq_disable();
|
|
|
|
while (1)
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
|
|
|
void platform_power_off(void)
|
|
|
|
{
|
|
|
|
platform_halt();
|
|
|
|
}
|
|
|
|
|
|
|
|
void platform_restart(void)
|
|
|
|
{
|
|
|
|
platform_halt();
|
|
|
|
}
|
|
|
|
|
|
|
|
void __init platform_setup(char **cmdline)
|
|
|
|
{
|
|
|
|
unsigned long reg;
|
|
|
|
|
2009-06-11 03:58:48 +08:00
|
|
|
reg = readl(S6_REG_GREG1 + S6_GREG1_PLLSEL);
|
|
|
|
reg &= ~(S6_GREG1_PLLSEL_GMAC_MASK << S6_GREG1_PLLSEL_GMAC |
|
|
|
|
S6_GREG1_PLLSEL_GMII_MASK << S6_GREG1_PLLSEL_GMII);
|
|
|
|
reg |= S6_GREG1_PLLSEL_GMAC_125MHZ << S6_GREG1_PLLSEL_GMAC |
|
|
|
|
S6_GREG1_PLLSEL_GMII_125MHZ << S6_GREG1_PLLSEL_GMII;
|
|
|
|
writel(reg, S6_REG_GREG1 + S6_GREG1_PLLSEL);
|
|
|
|
|
2009-03-04 23:21:33 +08:00
|
|
|
reg = readl(S6_REG_GREG1 + S6_GREG1_CLKGATE);
|
|
|
|
reg &= ~(1 << S6_GREG1_BLOCK_SB);
|
2009-06-11 03:58:48 +08:00
|
|
|
reg &= ~(1 << S6_GREG1_BLOCK_GMAC);
|
2009-03-04 23:21:33 +08:00
|
|
|
writel(reg, S6_REG_GREG1 + S6_GREG1_CLKGATE);
|
|
|
|
|
|
|
|
reg = readl(S6_REG_GREG1 + S6_GREG1_BLOCKENA);
|
|
|
|
reg |= 1 << S6_GREG1_BLOCK_SB;
|
2009-06-11 03:58:48 +08:00
|
|
|
reg |= 1 << S6_GREG1_BLOCK_GMAC;
|
2009-03-04 23:21:33 +08:00
|
|
|
writel(reg, S6_REG_GREG1 + S6_GREG1_BLOCKENA);
|
|
|
|
|
|
|
|
printk(KERN_NOTICE "S6105 on Stretch S6000 - "
|
|
|
|
"Copyright (C) 2009 emlix GmbH <info@emlix.com>\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
void __init platform_init(bp_tag_t *first)
|
|
|
|
{
|
2009-05-05 23:03:22 +08:00
|
|
|
s6_gpio_init(0);
|
2009-03-04 23:21:33 +08:00
|
|
|
gpio_request(GPIO_LED1_NGREEN, "led1_green");
|
|
|
|
gpio_request(GPIO_LED1_RED, "led1_red");
|
|
|
|
gpio_direction_output(GPIO_LED1_NGREEN, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void platform_heartbeat(void)
|
|
|
|
{
|
|
|
|
static unsigned int c;
|
|
|
|
|
|
|
|
if (!(++c & 0x4F))
|
|
|
|
gpio_direction_output(GPIO_LED1_RED, !(c & 0x10));
|
|
|
|
}
|