Path: blob/master/arch/xtensa/platforms/s6105/setup.c
15116 views
/*1* s6105 control routines2*3* Copyright (c) 2009 emlix GmbH4*/5#include <linux/irq.h>6#include <linux/io.h>7#include <linux/gpio.h>89#include <asm/bootparam.h>1011#include <variant/hardware.h>12#include <variant/gpio.h>1314#include <platform/gpio.h>1516void platform_halt(void)17{18local_irq_disable();19while (1)20;21}2223void platform_power_off(void)24{25platform_halt();26}2728void platform_restart(void)29{30platform_halt();31}3233void __init platform_setup(char **cmdline)34{35unsigned long reg;3637reg = readl(S6_REG_GREG1 + S6_GREG1_PLLSEL);38reg &= ~(S6_GREG1_PLLSEL_GMAC_MASK << S6_GREG1_PLLSEL_GMAC |39S6_GREG1_PLLSEL_GMII_MASK << S6_GREG1_PLLSEL_GMII);40reg |= S6_GREG1_PLLSEL_GMAC_125MHZ << S6_GREG1_PLLSEL_GMAC |41S6_GREG1_PLLSEL_GMII_125MHZ << S6_GREG1_PLLSEL_GMII;42writel(reg, S6_REG_GREG1 + S6_GREG1_PLLSEL);4344reg = readl(S6_REG_GREG1 + S6_GREG1_CLKGATE);45reg &= ~(1 << S6_GREG1_BLOCK_SB);46reg &= ~(1 << S6_GREG1_BLOCK_GMAC);47writel(reg, S6_REG_GREG1 + S6_GREG1_CLKGATE);4849reg = readl(S6_REG_GREG1 + S6_GREG1_BLOCKENA);50reg |= 1 << S6_GREG1_BLOCK_SB;51reg |= 1 << S6_GREG1_BLOCK_GMAC;52writel(reg, S6_REG_GREG1 + S6_GREG1_BLOCKENA);5354printk(KERN_NOTICE "S6105 on Stretch S6000 - "55"Copyright (C) 2009 emlix GmbH <[email protected]>\n");56}5758void __init platform_init(bp_tag_t *first)59{60s6_gpio_init(0);61gpio_request(GPIO_LED1_NGREEN, "led1_green");62gpio_request(GPIO_LED1_RED, "led1_red");63gpio_direction_output(GPIO_LED1_NGREEN, 1);64}6566void platform_heartbeat(void)67{68static unsigned int c;6970if (!(++c & 0x4F))71gpio_direction_output(GPIO_LED1_RED, !(c & 0x10));72}737475