mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2025-04-21 12:27:27 +03:00
AR7: Cleanups (closes: #2323)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@8756 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
@@ -1,18 +1,16 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2006, 2007 OpenWrt.org
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
@@ -23,53 +21,54 @@
|
||||
|
||||
#include <linux/delay.h>
|
||||
#include <asm/addrspace.h>
|
||||
#include <asm/io.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#define AR7_REGS_BASE 0x08610000
|
||||
#define AR7_REGS_BASE 0x08610000
|
||||
|
||||
#define AR7_REGS_MAC0 (AR7_REGS_BASE + 0x0000)
|
||||
#define AR7_REGS_GPIO (AR7_REGS_BASE + 0x0900)
|
||||
#define AR7_REGS_POWER (AR7_REGS_BASE + 0x0a00) // 0x08610A00 - 0x08610BFF (512 bytes, 128 bytes / clock)
|
||||
#define AR7_REGS_UART0 (AR7_REGS_BASE + 0x0e00)
|
||||
#define AR7_REGS_RESET (AR7_REGS_BASE + 0x1600)
|
||||
#define AR7_REGS_VLYNQ0 (AR7_REGS_BASE + 0x1800)
|
||||
#define AR7_REGS_DCL (AR7_REGS_BASE + 0x1a00)
|
||||
#define AR7_REGS_VLYNQ1 (AR7_REGS_BASE + 0x1c00)
|
||||
#define AR7_REGS_MDIO (AR7_REGS_BASE + 0x1e00)
|
||||
#define AR7_REGS_IRQ (AR7_REGS_BASE + 0x2400)
|
||||
#define AR7_REGS_MAC1 (AR7_REGS_BASE + 0x2800)
|
||||
#define AR7_REGS_MAC0 (AR7_REGS_BASE + 0x0000)
|
||||
#define AR7_REGS_GPIO (AR7_REGS_BASE + 0x0900)
|
||||
/* 0x08610A00 - 0x08610BFF (512 bytes, 128 bytes / clock) */
|
||||
#define AR7_REGS_POWER (AR7_REGS_BASE + 0x0a00)
|
||||
#define AR7_REGS_UART0 (AR7_REGS_BASE + 0x0e00)
|
||||
#define AR7_REGS_RESET (AR7_REGS_BASE + 0x1600)
|
||||
#define AR7_REGS_VLYNQ0 (AR7_REGS_BASE + 0x1800)
|
||||
#define AR7_REGS_DCL (AR7_REGS_BASE + 0x1a00)
|
||||
#define AR7_REGS_VLYNQ1 (AR7_REGS_BASE + 0x1c00)
|
||||
#define AR7_REGS_MDIO (AR7_REGS_BASE + 0x1e00)
|
||||
#define AR7_REGS_IRQ (AR7_REGS_BASE + 0x2400)
|
||||
#define AR7_REGS_MAC1 (AR7_REGS_BASE + 0x2800)
|
||||
|
||||
#define AR7_REGS_WDT (AR7_REGS_BASE + 0x1f00)
|
||||
#define UR8_REGS_WDT (AR7_REGS_BASE + 0x0b00)
|
||||
#define UR8_REGS_UART1 (AR7_REGS_BASE + 0x0f00)
|
||||
#define AR7_REGS_WDT (AR7_REGS_BASE + 0x1f00)
|
||||
#define UR8_REGS_WDT (AR7_REGS_BASE + 0x0b00)
|
||||
#define UR8_REGS_UART1 (AR7_REGS_BASE + 0x0f00)
|
||||
|
||||
#define AR7_RESET_PEREPHERIAL 0x0
|
||||
#define AR7_RESET_SOFTWARE 0x4
|
||||
#define AR7_RESET_STATUS 0x8
|
||||
#define AR7_RESET_PEREPHERIAL 0x0
|
||||
#define AR7_RESET_SOFTWARE 0x4
|
||||
#define AR7_RESET_STATUS 0x8
|
||||
|
||||
#define AR7_RESET_BIT_CPMAC_LO 17
|
||||
#define AR7_RESET_BIT_CPMAC_HI 21
|
||||
#define AR7_RESET_BIT_MDIO 22
|
||||
#define AR7_RESET_BIT_EPHY 26
|
||||
#define AR7_RESET_BIT_CPMAC_LO 17
|
||||
#define AR7_RESET_BIT_CPMAC_HI 21
|
||||
#define AR7_RESET_BIT_MDIO 22
|
||||
#define AR7_RESET_BIT_EPHY 26
|
||||
|
||||
/* GPIO control registers */
|
||||
#define AR7_GPIO_INPUT 0x0
|
||||
#define AR7_GPIO_OUTPUT 0x4
|
||||
#define AR7_GPIO_DIR 0x8
|
||||
#define AR7_GPIO_ENABLE 0xc
|
||||
#define AR7_GPIO_INPUT 0x0
|
||||
#define AR7_GPIO_OUTPUT 0x4
|
||||
#define AR7_GPIO_DIR 0x8
|
||||
#define AR7_GPIO_ENABLE 0xc
|
||||
|
||||
#define AR7_CHIP_7100 0x18
|
||||
#define AR7_CHIP_7200 0x2b
|
||||
#define AR7_CHIP_7300 0x05
|
||||
#define AR7_CHIP_7100 0x18
|
||||
#define AR7_CHIP_7200 0x2b
|
||||
#define AR7_CHIP_7300 0x05
|
||||
|
||||
/* Interrupts */
|
||||
#define AR7_IRQ_UART0 15
|
||||
#define AR7_IRQ_UART1 16
|
||||
#define AR7_IRQ_UART0 15
|
||||
#define AR7_IRQ_UART1 16
|
||||
|
||||
/* Clocks */
|
||||
#define AR7_AFE_CLOCK 35328000
|
||||
#define AR7_REF_CLOCK 25000000
|
||||
#define AR7_XTAL_CLOCK 24000000
|
||||
#define AR7_AFE_CLOCK 35328000
|
||||
#define AR7_REF_CLOCK 25000000
|
||||
#define AR7_XTAL_CLOCK 24000000
|
||||
|
||||
struct plat_cpmac_data {
|
||||
int reset_bit;
|
||||
@@ -132,14 +131,16 @@ static inline int ar7_has_high_cpmac(void)
|
||||
|
||||
static inline void ar7_device_enable(u32 bit)
|
||||
{
|
||||
void *reset_reg = (void *)KSEG1ADDR(AR7_REGS_RESET + AR7_RESET_PEREPHERIAL);
|
||||
void *reset_reg =
|
||||
(void *)KSEG1ADDR(AR7_REGS_RESET + AR7_RESET_PEREPHERIAL);
|
||||
writel(readl(reset_reg) | (1 << bit), reset_reg);
|
||||
mdelay(20);
|
||||
}
|
||||
|
||||
static inline void ar7_device_disable(u32 bit)
|
||||
{
|
||||
void *reset_reg = (void *)KSEG1ADDR(AR7_REGS_RESET + AR7_RESET_PEREPHERIAL);
|
||||
void *reset_reg =
|
||||
(void *)KSEG1ADDR(AR7_REGS_RESET + AR7_RESET_PEREPHERIAL);
|
||||
writel(readl(reset_reg) & ~(1 << bit), reset_reg);
|
||||
mdelay(20);
|
||||
}
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
/*
|
||||
* $Id: gpio.h 6693 2007-03-25 05:42:16Z ejka $
|
||||
*
|
||||
* Copyright (C) 2007 OpenWrt.org
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
@@ -30,7 +28,8 @@ extern void gpio_free(unsigned gpio);
|
||||
/* Common GPIO layer */
|
||||
static inline int gpio_direction_input(unsigned gpio)
|
||||
{
|
||||
void __iomem *gpio_dir = (void __iomem *)KSEG1ADDR(AR7_REGS_GPIO + AR7_GPIO_DIR);
|
||||
void __iomem *gpio_dir =
|
||||
(void __iomem *)KSEG1ADDR(AR7_REGS_GPIO + AR7_GPIO_DIR);
|
||||
|
||||
if (gpio >= AR7_GPIO_MAX)
|
||||
return -EINVAL;
|
||||
@@ -42,7 +41,8 @@ static inline int gpio_direction_input(unsigned gpio)
|
||||
|
||||
static inline int gpio_direction_output(unsigned gpio)
|
||||
{
|
||||
void __iomem *gpio_dir = (void __iomem *)KSEG1ADDR(AR7_REGS_GPIO + AR7_GPIO_DIR);
|
||||
void __iomem *gpio_dir =
|
||||
(void __iomem *)KSEG1ADDR(AR7_REGS_GPIO + AR7_GPIO_DIR);
|
||||
|
||||
if (gpio >= AR7_GPIO_MAX)
|
||||
return -EINVAL;
|
||||
@@ -54,7 +54,8 @@ static inline int gpio_direction_output(unsigned gpio)
|
||||
|
||||
static inline int gpio_get_value(unsigned gpio)
|
||||
{
|
||||
void __iomem *gpio_in = (void __iomem *)KSEG1ADDR(AR7_REGS_GPIO + AR7_GPIO_INPUT);
|
||||
void __iomem *gpio_in =
|
||||
(void __iomem *)KSEG1ADDR(AR7_REGS_GPIO + AR7_GPIO_INPUT);
|
||||
|
||||
if (gpio >= AR7_GPIO_MAX)
|
||||
return -EINVAL;
|
||||
@@ -64,14 +65,15 @@ static inline int gpio_get_value(unsigned gpio)
|
||||
|
||||
static inline void gpio_set_value(unsigned gpio, int value)
|
||||
{
|
||||
void __iomem *gpio_out = (void __iomem *)KSEG1ADDR(AR7_REGS_GPIO + AR7_GPIO_OUTPUT);
|
||||
void __iomem *gpio_out =
|
||||
(void __iomem *)KSEG1ADDR(AR7_REGS_GPIO + AR7_GPIO_OUTPUT);
|
||||
volatile unsigned tmp;
|
||||
|
||||
if (gpio >= AR7_GPIO_MAX)
|
||||
return;
|
||||
|
||||
tmp = readl(gpio_out) & ~(1 << gpio);
|
||||
if (value)
|
||||
if (value)
|
||||
tmp |= 1 << gpio;
|
||||
writel(tmp, gpio_out);
|
||||
}
|
||||
@@ -89,7 +91,8 @@ static inline int irq_to_gpio(unsigned irq)
|
||||
/* Board specific GPIO functions */
|
||||
static inline int ar7_gpio_enable(unsigned gpio)
|
||||
{
|
||||
void __iomem *gpio_en = (void __iomem *)KSEG1ADDR(AR7_REGS_GPIO + AR7_GPIO_ENABLE);
|
||||
void __iomem *gpio_en =
|
||||
(void __iomem *)KSEG1ADDR(AR7_REGS_GPIO + AR7_GPIO_ENABLE);
|
||||
|
||||
if (gpio >= AR7_GPIO_MAX)
|
||||
return -EINVAL;
|
||||
@@ -101,7 +104,8 @@ static inline int ar7_gpio_enable(unsigned gpio)
|
||||
|
||||
static inline int ar7_gpio_disable(unsigned gpio)
|
||||
{
|
||||
void __iomem *gpio_en = (void __iomem *)KSEG1ADDR(AR7_REGS_GPIO + AR7_GPIO_ENABLE);
|
||||
void __iomem *gpio_en =
|
||||
(void __iomem *)KSEG1ADDR(AR7_REGS_GPIO + AR7_GPIO_ENABLE);
|
||||
|
||||
if (gpio >= AR7_GPIO_MAX)
|
||||
return -EINVAL;
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2007 OpenWrt.org
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
@@ -22,8 +20,8 @@
|
||||
#define _ASM_MACH_MMZONE_H
|
||||
|
||||
extern pg_data_t __node_data[];
|
||||
#define NODE_DATA(nid) (&__node_data[nid])
|
||||
#define NODE_MEM_MAP(nid) (NODE_DATA(nid)->node_mem_map)
|
||||
#define pa_to_nid(addr) (((addr) >= ARCH_PFN_OFFSET << PAGE_SHIFT) ? 0 : -1)
|
||||
#define NODE_DATA(nid) (&__node_data[nid])
|
||||
#define NODE_MEM_MAP(nid) (NODE_DATA(nid)->node_mem_map)
|
||||
#define pa_to_nid(addr) (((addr) >= ARCH_PFN_OFFSET << PAGE_SHIFT) ? 0 : -1)
|
||||
|
||||
#endif /* _ASM_MACH_MMZONE_H */
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2006, 2007 OpenWrt.org
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2006, 2007 OpenWrt.org
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
@@ -65,7 +63,7 @@ struct plat_vlynq_ops {
|
||||
|
||||
extern struct bus_type vlynq_bus_type;
|
||||
|
||||
extern int __vlynq_register_driver(struct vlynq_driver *driver,
|
||||
extern int __vlynq_register_driver(struct vlynq_driver *driver,
|
||||
struct module *owner);
|
||||
|
||||
static inline int vlynq_register_driver(struct vlynq_driver *driver)
|
||||
@@ -80,8 +78,8 @@ extern u32 vlynq_remote_id(struct vlynq_device *dev);
|
||||
extern void vlynq_set_local_mapping(struct vlynq_device *dev,
|
||||
u32 tx_offset,
|
||||
struct vlynq_mapping *mapping);
|
||||
extern void vlynq_set_remote_mapping(struct vlynq_device *dev,
|
||||
u32 tx_offset,
|
||||
extern void vlynq_set_remote_mapping(struct vlynq_device *dev,
|
||||
u32 tx_offset,
|
||||
struct vlynq_mapping *mapping);
|
||||
extern int vlynq_virq_to_irq(struct vlynq_device *dev, int virq);
|
||||
extern int vlynq_irq_to_virq(struct vlynq_device *dev, int irq);
|
||||
|
||||
Reference in New Issue
Block a user