summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--package/gpio_rtl819x/Makefile (renamed from package/gpio_rtl8196c/Makefile)20
-rw-r--r--package/gpio_rtl819x/src/Makefile (renamed from package/gpio_rtl8196c/src/Makefile)2
-rw-r--r--package/gpio_rtl819x/src/README7
-rw-r--r--package/gpio_rtl819x/src/gpio_rtl819x.c (renamed from package/gpio_rtl8196c/src/gpio_rtl8196c.c)118
-rwxr-xr-xtarget/linux/realtek/base-files/etc/init.d/sysled8
5 files changed, 86 insertions, 69 deletions
diff --git a/package/gpio_rtl8196c/Makefile b/package/gpio_rtl819x/Makefile
index 45dc5cffe..3795fa92e 100644
--- a/package/gpio_rtl8196c/Makefile
+++ b/package/gpio_rtl819x/Makefile
@@ -8,19 +8,19 @@
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
-PKG_NAME:=gpio_rtl8196c
-PKG_VERSION:=0.0.1
+PKG_NAME:=gpio_rtl819x
+PKG_VERSION:=0.0.2
PKG_RELEASE:=1
include $(INCLUDE_DIR)/package.mk
-define KernelPackage/gpio_rtl8196c
- SUBMENU:=gpio_rtl8196c
- TITLE:=gpio_rtl8196c
- FILES:=$(PKG_BUILD_DIR)/gpio_rtl8196c.ko
+define KernelPackage/gpio_rtl819x
+ SUBMENU:=gpio_rtl819x
+ TITLE:=gpio_rtl819x
+ FILES:=$(PKG_BUILD_DIR)/gpio_rtl819x.ko
DEPENDS:=
#KCONFIG:=
- KCONFIG:=CONFIG_GPIO_RTL8196C=y CONFIG_GPIOLIB=y CONFIG_GENERIC_GPIO=y CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
+ KCONFIG:=CONFIG_GPIO_RTL819X=y CONFIG_GPIOLIB=y CONFIG_GENERIC_GPIO=y CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
#AUTOLOAD:=$(call AutoLoad,01,sigb in)
endef
@@ -28,7 +28,7 @@ define KernelPackage/gpio_rtl8196c/description
GPIO for Realtek rtl8196c
endef
-EXTRA_KCONFIG:=CONFIG_GPIO_RTL8196C=y
+EXTRA_KCONFIG:=CONFIG_GPIO_RTL819X=y
EXTRA_KCONFIG+=CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
EXTRA_KCONFIG+=CONFIG_ARCH_REQUIRE_GPIOLIB=y
EXTRA_KCONFIG+=CONFIG_GENERIC_GPIO=y
@@ -56,7 +56,7 @@ define Build/Compile
$(MAKE) -C "$(LINUX_DIR)" \
$(MAKE_OPTS) \
modules
- $(CP) $(PKG_BUILD_DIR)/gpio_rtl8196c.ko /tmp
+ $(CP) $(PKG_BUILD_DIR)/gpio_rtl819x.ko /tmp
endef
-$(eval $(call KernelPackage,gpio_rtl8196c))
+$(eval $(call KernelPackage,gpio_rtl819x))
diff --git a/package/gpio_rtl8196c/src/Makefile b/package/gpio_rtl819x/src/Makefile
index 6740c78db..a9512057b 100644
--- a/package/gpio_rtl8196c/src/Makefile
+++ b/package/gpio_rtl819x/src/Makefile
@@ -3,6 +3,6 @@
#endif
-obj-$(if $(CONFIG_GPIO_RTL8196C),m) += gpio_rtl8196c.o
+obj-$(if $(CONFIG_GPIO_RTL819X),m) += gpio_rtl819x.o
diff --git a/package/gpio_rtl819x/src/README b/package/gpio_rtl819x/src/README
new file mode 100644
index 000000000..dc21a122a
--- /dev/null
+++ b/package/gpio_rtl819x/src/README
@@ -0,0 +1,7 @@
+GPIO driver for rtl chips.
+
+ChangeLog:
+v0.0.2:
+ Defines changed to compile under rtl819x family (96c,96e,96d,88)
+v0.0.1:
+ Added support for 96c
diff --git a/package/gpio_rtl8196c/src/gpio_rtl8196c.c b/package/gpio_rtl819x/src/gpio_rtl819x.c
index c2aae8d67..6f4814767 100644
--- a/package/gpio_rtl8196c/src/gpio_rtl8196c.c
+++ b/package/gpio_rtl819x/src/gpio_rtl819x.c
@@ -24,17 +24,27 @@
#endif
////////////////////////////////////////////////////////////////////////
-#define RTL8196C_BASE_ADDR 0xb8000000
-#define RTL8196C_GPIO_ADDR (RTL8196C_BASE_ADDR + 0x3500)
-#define RTL8196C_GPIO_PABCD_CNT_ADDR (RTL8196C_GPIO_ADDR + 0x00)
-#define RTL8196C_GPIO_PABCD_TYPE_ADDR (RTL8196C_GPIO_ADDR + 0x00)
-#define RTL8196C_GPIO_PABCD_DIR_ADDR (RTL8196C_GPIO_ADDR + 0x08)
-#define RTL8196C_GPIO_PABCD_DAT_ADDR (RTL8196C_GPIO_ADDR + 0x0c)
-#define RTL8196C_GPIO_PABCD_ISR_ADDR (RTL8196C_GPIO_ADDR + 0x10)
-#define RTL8196C_GPIO_PAB_IMR_ADDR (RTL8196C_GPIO_ADDR + 0x14)
-#define RTL8196C_GPIO_PCD_IMR_ADDR (RTL8196C_GPIO_ADDR + 0x18)
-
-#define RTL8196C_MUX_ADDR (RTL8196C_BASE_ADDR + 0x40)
+//SAME DEFINE FOR 8196C/8196E/8196D/8198
+#define RTL819X_BASE_ADDR 0xb8000000
+#define RTL819X_GPIO_ADDR (RTL819X_BASE_ADDR + 0x3500)
+#define RTL819X_GPIO_PABCD_CNT_ADDR (RTL819X_GPIO_ADDR + 0x00)
+#define RTL819X_GPIO_PABCD_TYPE_ADDR (RTL819X_GPIO_ADDR + 0x00)
+#define RTL819X_GPIO_PABCD_DIR_ADDR (RTL819X_GPIO_ADDR + 0x08)
+#define RTL819X_GPIO_PABCD_DAT_ADDR (RTL819X_GPIO_ADDR + 0x0c)
+#define RTL819X_GPIO_PABCD_ISR_ADDR (RTL819X_GPIO_ADDR + 0x10)
+#define RTL819X_GPIO_PAB_IMR_ADDR (RTL819X_GPIO_ADDR + 0x14)
+#define RTL819X_GPIO_PCD_IMR_ADDR (RTL819X_GPIO_ADDR + 0x18)
+
+#define RTL819X_MUX_ADDR0 (RTL819X_BASE_ADDR + 0x40)
+#define RTL819X_MUX_ADDR1 (RTL819X_MUX_ADDR + 0x4)
+
+#if defined(CONFIG_RTL_8196C)
+#define RTL8196X_MUX_DEF_VALUE 0x340FFF
+#elif defined(CONFIG_RTL_8196D)
+#define RTL8196X_MUX_DEF_VALUE 0x0
+#elif defined(CONFIG_RTL_8196E)
+#define RTL8196X_MUX_DEF_VALUE 0x0
+#endif
static int g_muxdummy;
@@ -51,7 +61,7 @@ static int g_muxdummy;
#define RTL8196C_GPIO_SPML_UART
#define RTL8196C_GPIO_SPML_PCIE
-static uint32_t rtl8196c_mux_value = 0x340FFF;
+static uint32_t rtl819x_mux_value = RTL8196X_MUX_DEF_VALUE;
struct rtl_gpio_chip
{
@@ -63,7 +73,7 @@ struct rtl_gpio_chip
spinlock_t lock;/* Lock used for synchronization */
};
-extern struct rtl_gpio_chip gpio_rtl8196c;
+extern struct rtl_gpio_chip gpio_rtl819x;
static inline struct rtl_gpio_chip *to_rtl_gpio_chip(struct gpio_chip *gc)
{
@@ -72,54 +82,54 @@ static inline struct rtl_gpio_chip *to_rtl_gpio_chip(struct gpio_chip *gc)
////////////////////////////////////////////////////////////////////////
//configure ports as GPIO
-static int param_set_rtl8196c_mux( const char *val, struct kernel_param *kp )
+static int param_set_rtl819x_mux( const char *val, struct kernel_param *kp )
{
- volatile uint32_t *mux = (uint32_t *)RTL8196C_MUX_ADDR;
+ volatile uint32_t *mux = (uint32_t *)RTL819X_MUX_ADDR0;
unsigned long flags;
- PRINT("param_set_rtl8196c_mux\n");
+ PRINT("param_set_rtl819x_mux\n");
if ( !val )
{
return -EINVAL;
}
- if ( sscanf( val, "0x%x", &rtl8196c_mux_value ) < 0 )
+ if ( sscanf( val, "0x%x", &rtl819x_mux_value ) < 0 )
{
PRINT("err val\n");
return -EINVAL;
}
- spin_lock_irqsave(&gpio_rtl8196c.lock, flags);
- PRINT("mux set 0x%08x\n",rtl8196c_mux_value);
- *mux = rtl8196c_mux_value;
- spin_unlock_irqrestore(&gpio_rtl8196c.lock, flags);
+ spin_lock_irqsave(&gpio_rtl819x.lock, flags);
+ PRINT("mux set 0x%08x\n",rtl819x_mux_value);
+ *mux = rtl819x_mux_value;
+ spin_unlock_irqrestore(&gpio_rtl819x.lock, flags);
return 0;
}
-#define param_check_rtl8196c_mux(a,b) ;;
+#define param_check_rtl819x_mux(a,b) ;;
////////////////////////////////////////////////////////////////////////
//get current configured port value
-static int param_get_rtl8196c_mux( char *buf, struct kernel_param *kp )
+static int param_get_rtl819x_mux( char *buf, struct kernel_param *kp )
{
- volatile uint32_t *mux = (uint32_t*)RTL8196C_MUX_ADDR;
+ volatile uint32_t *mux = (uint32_t*)RTL819X_MUX_ADDR0;
unsigned long flags;
- PRINT("param_get_rtl8196c_mux\n");
- spin_lock_irqsave(&gpio_rtl8196c.lock, flags);
+ PRINT("param_get_rtl819x_mux\n");
+ spin_lock_irqsave(&gpio_rtl819x.lock, flags);
sprintf( buf, "0x%x", *mux );
- spin_unlock_irqrestore(&gpio_rtl8196c.lock, flags);
+ spin_unlock_irqrestore(&gpio_rtl819x.lock, flags);
return strlen( buf );
}
-module_param_named(rtl8196c_mux, g_muxdummy, rtl8196c_mux, S_IRUGO | S_IWUSR);
+module_param_named(rtl819x_mux, g_muxdummy, rtl819x_mux, S_IRUGO | S_IWUSR);
////////////////////////////////////////////////////////////////////////
-static int gpio_rtl8196c_dir_in( struct gpio_chip *chip, unsigned int gpio )
+static int gpio_rtl819x_dir_in( struct gpio_chip *chip, unsigned int gpio )
{
- volatile uint32_t *dir = (uint32_t*)RTL8196C_GPIO_PABCD_DIR_ADDR;
+ volatile uint32_t *dir = (uint32_t*)RTL819X_GPIO_PABCD_DIR_ADDR;
unsigned long flags;
struct rtl_gpio_chip *rgc = to_rtl_gpio_chip( chip );
- PRINT("gpio_rtl8196c_dir_in\n");
+ PRINT("gpio_rtl819x_dir_in\n");
PRINT("offset = %d\n", gpio);
spin_lock_irqsave(rgc->lock, flags);
@@ -132,13 +142,13 @@ static int gpio_rtl8196c_dir_in( struct gpio_chip *chip, unsigned int gpio )
////////////////////////////////////////////////////////////////////////
-static int gpio_rtl8196c_dir_out( struct gpio_chip *chip, unsigned int gpio )
+static int gpio_rtl819x_dir_out( struct gpio_chip *chip, unsigned int gpio )
{
- volatile uint32_t *dir = (uint32_t*)RTL8196C_GPIO_PABCD_DIR_ADDR;
+ volatile uint32_t *dir = (uint32_t*)RTL819X_GPIO_PABCD_DIR_ADDR;
unsigned long flags;
struct rtl_gpio_chip *rgc = to_rtl_gpio_chip( chip );
- PRINT("gpio_rtl8196c_dir_out\n");
+ PRINT("gpio_rtl819x_dir_out\n");
PRINT("offset = %d\n", gpio);
spin_lock_irqsave(rgc->lock, flags);
@@ -151,14 +161,14 @@ static int gpio_rtl8196c_dir_out( struct gpio_chip *chip, unsigned int gpio )
////////////////////////////////////////////////////////////////////////
-static int gpio_rtl8196c_get( struct gpio_chip *chip, unsigned int gpio )
+static int gpio_rtl819x_get( struct gpio_chip *chip, unsigned int gpio )
{
- volatile uint32_t *dat = (uint32_t*)RTL8196C_GPIO_PABCD_DAT_ADDR;
+ volatile uint32_t *dat = (uint32_t*)RTL819X_GPIO_PABCD_DAT_ADDR;
int res=0;
unsigned long flags;
struct rtl_gpio_chip *rgc = to_rtl_gpio_chip( chip );
- PRINT("gpio_rtl8196c_get\n");
+ PRINT("gpio_rtl819x_get\n");
PRINT("offset = %d\n", gpio);
spin_lock_irqsave(rgc->lock, flags);
@@ -170,14 +180,14 @@ static int gpio_rtl8196c_get( struct gpio_chip *chip, unsigned int gpio )
////////////////////////////////////////////////////////////////////////
-static void gpio_rtl8196c_set( struct gpio_chip *chip, unsigned int gpio, int value )
+static void gpio_rtl819x_set( struct gpio_chip *chip, unsigned int gpio, int value )
{
- volatile uint32_t *dat = (uint32_t*)RTL8196C_GPIO_PABCD_DAT_ADDR;
+ volatile uint32_t *dat = (uint32_t*)RTL819X_GPIO_PABCD_DAT_ADDR;
int res=0;
unsigned long flags;
struct rtl_gpio_chip *rgc = to_rtl_gpio_chip( chip );
- PRINT("gpio_rtl8196c_set\n");
+ PRINT("gpio_rtl819x_set\n");
PRINT("offset = %d = %d\n", gpio, value);
spin_lock_irqsave(rgc->lock, flags);
@@ -191,41 +201,41 @@ static void gpio_rtl8196c_set( struct gpio_chip *chip, unsigned int gpio, int va
}
////////////////////////////////////////////////////////////////////////
-static int gpio_rtl8196c_to_irq(struct gpio_chip *chip, unsigned offset)
+static int gpio_rtl819x_to_irq(struct gpio_chip *chip, unsigned offset)
{
return -EINVAL;
}
////////////////////////////////////////////////////////////////////////
//init module
-struct rtl_gpio_chip gpio_rtl8196c =
+struct rtl_gpio_chip gpio_rtl819x =
{
.chip = {
- .label = "gpio_rtl8196c",
- .direction_input = gpio_rtl8196c_dir_in,
- .get = gpio_rtl8196c_get,
- .direction_output = gpio_rtl8196c_dir_out,
- .set = gpio_rtl8196c_set,
- .to_irq = gpio_rtl8196c_to_irq,
+ .label = "gpio_rtl819x",
+ .direction_input = gpio_rtl819x_dir_in,
+ .get = gpio_rtl819x_get,
+ .direction_output = gpio_rtl819x_dir_out,
+ .set = gpio_rtl819x_set,
+ .to_irq = gpio_rtl819x_to_irq,
.base = 0,
.ngpio = 32,
},
.gpio_dir = 0x0,
};
-static int __init gpio_rtl8196c_init( void )
+static int __init gpio_rtl819x_init( void )
{
PRINT("Start\n");
- gpiochip_add( &gpio_rtl8196c.chip );
+ gpiochip_add( &gpio_rtl819x.chip );
return 0;
}
////////////////////////////////////////////////////////////////////////
//exit from module
-static int gpio_rtl8196c_exit( void )
+static int gpio_rtl819x_exit( void )
{
PRINT("End\n");
- gpiochip_remove( &gpio_rtl8196c.chip );
+ gpiochip_remove( &gpio_rtl819x.chip );
return 0;
}
@@ -235,5 +245,5 @@ MODULE_AUTHOR("Artur Artamonov");
MODULE_DESCRIPTION("gpio_rtl8196c");
MODULE_LICENSE("GPL");
-module_init( gpio_rtl8196c_init );
-module_exit( gpio_rtl8196c_exit );
+module_init( gpio_rtl819x_init );
+module_exit( gpio_rtl819x_exit );
diff --git a/target/linux/realtek/base-files/etc/init.d/sysled b/target/linux/realtek/base-files/etc/init.d/sysled
index 9b0923496..3c632c261 100755
--- a/target/linux/realtek/base-files/etc/init.d/sysled
+++ b/target/linux/realtek/base-files/etc/init.d/sysled
@@ -3,13 +3,13 @@
START=99
start() {
- insmod /lib/modules/2.6.30.9/gpio_rtl8196c.ko
- echo 0x340c00 > /sys/module/gpio_rtl8196c/parameters/rtl8196c_mux
+ insmod /lib/modules/2.6.30.9/gpio_rtl819x.ko
+ echo 0x340c00 > /sys/module/gpio_rtl819x/parameters/rtl819x_mux
echo 6 > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio6/direction
echo "0" > /sys/class/gpio/gpio6/value
}
stop() {
- rmmod gpio_rtl8196c
-} \ No newline at end of file
+ rmmod gpio_rtl819x
+}