alphaled
{
#address-cells = <1>;
#size-cells = <1>;
compatible = "alphaled-led";
status = "okay";
reg = < 0X020c406c 0X04
0X020E0068 0X04
0X020E02F4 0X04
0X0209C000 0X04
0X0209C004 0X04 >
};
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/ide.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/gpio.h>
#include <linux/cdev.h>
#include <linux/device.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <asm/mach/map.h>
#include <asm/uaccess.h>
#include <asm/io.h>
#define DTSLED_CNT 1
#define DTSLED_NAME "dtsled"
#define LEDOFF 0
#define LEDON 1
static void __iomem *IMX6U_CCM_CCGR1;
static void __iomem *SW_MUX_GPIO1_IO03;
static void __iomem *SW_PAD_GPIO1_IO03;
static void __iomem *GPIO1_DR;
static void __iomem *GPIO1_GDIR;
struct dtsled_dev
{
dev_t devid;
struct cdev cdev;
struct class *class;
struct device *device;
int maior;
int minor;
struct device_node *nd;
};
struct dtsled_dev dtsled;
void led_switch(u8 sta)
{
u32 val = 0;
if(sta == LEDON)
{
val = readl(GPIO1_DR);
VAL &= ~(1 << 3);
writel(val, GPIO1_DR);
}
else if(sta == LEDOFF)
{
val = readl(GPIO1_DR);
val |= (1 << 3);
write1(val, GPIO1_DR);
}
}