summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--target/linux/adm8668/files/arch/mips/adm8668/Makefile2
-rw-r--r--target/linux/adm8668/files/arch/mips/adm8668/proc.c114
-rw-r--r--target/linux/adm8668/files/arch/mips/include/asm/mach-adm8668/adm8668.h34
3 files changed, 1 insertions, 149 deletions
diff --git a/target/linux/adm8668/files/arch/mips/adm8668/Makefile b/target/linux/adm8668/files/arch/mips/adm8668/Makefile
index e8f6d6bf22..515c3a4993 100644
--- a/target/linux/adm8668/files/arch/mips/adm8668/Makefile
+++ b/target/linux/adm8668/files/arch/mips/adm8668/Makefile
@@ -2,5 +2,5 @@
# something witty --neutronscott
#
-obj-y := irq.o prom.o platform.o proc.o \
+obj-y := irq.o prom.o platform.o gpio.o \
setup.o clock.o time.o early_printk.o \
diff --git a/target/linux/adm8668/files/arch/mips/adm8668/proc.c b/target/linux/adm8668/files/arch/mips/adm8668/proc.c
deleted file mode 100644
index 77dbb1faf8..0000000000
--- a/target/linux/adm8668/files/arch/mips/adm8668/proc.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (C) 2010 Scott Nicholas <neutronscott@scottn.us>
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/proc_fs.h>
-#include <asm/uaccess.h>
-#include <adm8668.h>
-
-int adm8668_sesled_write_proc(struct file *file, const char *buffer, unsigned long count, void *data)
-{
- char buf[8];
- int num;
-
- num = (count < 8) ? count : 8;
-
- if (copy_from_user(buf, buffer, num))
- {
- printk("copy_from_user failed");
- return -EFAULT;
- }
- num = simple_strtoul(buf, NULL, 16);
- switch (num)
- {
- case 0:
- GPIO_SET_LOW(0);
- CRGPIO_SET_LOW(2);
- break;
- case 1:
- GPIO_SET_LOW(0);
- CRGPIO_SET_HI(2);
- break;
- case 2:
- GPIO_SET_HI(0);
- CRGPIO_SET_HI(2);
- break;
- default:
- break;
- }
-
- return count;
-}
-
-int adm8668_sesled_read_proc(char *buf, char **start, off_t offset, int count, int *eof, void *data)
-{
- int len = 0;
- int led_state = 0;
-
- led_state = (ADM8668_CONFIG_REG(CRGPIO_REG) & 0x100) ? 1 : 0;
- led_state += (ADM8668_WLAN_REG(GPIO_REG) & 0x40) ? 2 : 0;
- len += sprintf(buf+len, "%s\n",
- (led_state&1) ?
- ((led_state&2) ? "ORANGE" : "GREEN") : "OFF");
-
- return len;
-}
-
-int adm8668_button_read_proc(char *buf, char **start, off_t offset,
- int count, int *eof, void *data)
-{
- int len = 0;
- int read_once = ADM8668_CONFIG_REG(CRGPIO_REG);
- int button_flip = (read_once >> 20) & 0x3;
- int button_state = read_once & 0x3;
-
- len += sprintf(buf+len, "SES: %s %s\nRESET: %s %s\n",
- (button_state&2) ? "UP" : "DOWN",
- (button_flip&2) ? "FLIP" : "",
- (button_state&1) ? "UP" : "DOWN",
- (button_flip&1) ? "FLIP" : "");
-
- return len;
-}
-
-int __init adm8668_init_proc(void)
-{
- struct proc_dir_entry *adm8668_proc_dir = NULL;
- struct proc_dir_entry *sesled = NULL;
- int __maybe_unused bogus;
-
- /* these are known to be lights. rest are input...? */
- ADM8668_CONFIG_REG(CRGPIO_REG) = GPIO2_OUTPUT_ENABLE;
- ADM8668_WLAN_REG(GPIO_REG) = GPIO0_OUTPUT_ENABLE;
-
- /* inital read off of the flipper switcher on the button thingie */
- bogus = ADM8668_CONFIG_REG(CRGPIO_REG);
-
- adm8668_proc_dir = proc_mkdir("adm8668", 0);
- if (adm8668_proc_dir == NULL) {
- printk(KERN_ERR "ADM8668 proc: unable to create proc dir.\n");
- return 0;
- }
- create_proc_read_entry("buttons", 0444, adm8668_proc_dir,
- adm8668_button_read_proc, NULL);
- sesled = create_proc_entry("sesled", S_IRUGO|S_IWUGO, adm8668_proc_dir);
- if (sesled) {
- sesled->read_proc = adm8668_sesled_read_proc;
- sesled->write_proc = adm8668_sesled_write_proc;
- }
-
- return 0;
-}
-
-module_init(adm8668_init_proc);
-
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Scott Nicholas <neutronscott@scottn.us>");
-MODULE_DESCRIPTION("ADM8668 ghetto button driver");
diff --git a/target/linux/adm8668/files/arch/mips/include/asm/mach-adm8668/adm8668.h b/target/linux/adm8668/files/arch/mips/include/asm/mach-adm8668/adm8668.h
index 65ed0b5d3e..e39addfd61 100644
--- a/target/linux/adm8668/files/arch/mips/include/asm/mach-adm8668/adm8668.h
+++ b/target/linux/adm8668/files/arch/mips/include/asm/mach-adm8668/adm8668.h
@@ -46,12 +46,6 @@
#define INT_LVL_MAX INT_LVL_USB
/* register access macros */
-#define ADM8668_LAN_REG(_reg) \
- (*((volatile unsigned int *)(KSEG1ADDR(ADM8668_LAN_BASE + (_reg)))))
-#define ADM8668_WAN_REG(_reg) \
- (*((volatile unsigned int *)(KSEG1ADDR(ADM8668_WAN_BASE + (_reg)))))
-#define ADM8668_WLAN_REG(_reg) \
- (*((volatile unsigned int *)(KSEG1ADDR(ADM8668_WLAN_BASE + (_reg)))))
#define ADM8668_CONFIG_REG(_reg) \
(*((volatile unsigned int *)(KSEG1ADDR(ADM8668_CONFIG_BASE + (_reg)))))
@@ -69,34 +63,6 @@
/** For GPIO control **/
#define GPIO_REG 0x5C /* on WLAN */
#define CRGPIO_REG 0x20 /* on CPU */
-#define GPIO0_OUTPUT_ENABLE 0x1000
-#define GPIO1_OUTPUT_ENABLE 0x2000
-#define GPIO2_OUTPUT_ENABLE 0x4000
-#define GPIO_OUTPUT_ENABLE_ALL 0x7000
-#define GPIO0_OUTPUT_1 0x40
-#define GPIO1_OUTPUT_1 0x80
-#define GPIO2_OUTPUT_1 0x100
-#define GPIO0_INPUT_1 0x1
-#define GPIO1_INPUT_1 0x2
-#define GPIO2_INPUT_1 0x4
-
-#define GPIO_SET_HI(num) \
- ADM8668_WLAN_REG(GPIO_REG) |= (1 << (6 + num))
-
-#define GPIO_SET_LOW(num) \
- ADM8668_WLAN_REG(GPIO_REG) &= ~(1 << (6 + num))
-
-#define GPIO_TOGGLE(num) \
- ADM8668_WLAN_REG(GPIO_REG) ^= (1 << (6 + num))
-
-#define CRGPIO_SET_HI(num) \
- ADM8668_CONFIG_REG(CRGPIO_REG) |= (1 << (6 + num))
-
-#define CRGPIO_SET_LOW(num) \
- ADM8668_CONFIG_REG(CRGPIO_REG) &= ~(1 << (6 + num))
-
-#define CRGPIO_TOGGLE(num) \
- ADM8668_CONFIG_REG(CRGPIO_REG) ^= (1 << (6 + num))
void adm8668_init_clocks(void);