Цитата(nill @ Apr 8 2016, 09:53)

Покажите код Вашего драйвера (если он не слишком длинный).
Там просто стандартный шаблон, который сгенерировала команда
petalinux-create -t modules --name axi_gpio0 --enable:
CODE
/* axi_gpio0.c - The simplest kernel module.
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/io.h>
#include <linux/interrupt.h>
#include <linux/of_address.h>
#include <linux/of_device.h>
#include <linux/of_platform.h>
/* Standard module information, edit as appropriate */
MODULE_LICENSE("GPL");
MODULE_AUTHOR ("Xilinx corp.");
MODULE_DESCRIPTION ("axi_gpio0 - loadable module for axi_gpio control");
#define DRIVER_NAME "axi_gpio0"
int test_value = 0;
struct axi_gpio0_local {
int irq;
unsigned long mem_start;
unsigned long mem_end;
void __iomem *base_addr;
};
static irqreturn_t axi_gpio0_irq(int irq, void *lp)
{
printk("axi_gpio0 interrupt\n");
return IRQ_HANDLED;
}
static int axi_gpio0_probe(struct platform_device *pdev)
{
struct resource *r_irq; /* Interrupt resources */
struct resource *r_mem; /* IO mem resources */
struct device *dev = &pdev->dev;
struct axi_gpio0_local *lp = NULL;
int rc = 0;
int counter = 0;
test_value = 111;
printk("<1>Hello module world.\n");
printk(KERN_ERR "In probe() function\n");
dev_info(dev, "Device Tree Probing\n");
test_value = 222;
/*
// Get iospace for the device
r_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!r_mem) {
dev_err(dev, "invalid address\n");
return -ENODEV;
}
lp = (struct axi_gpio0_local *) kmalloc(sizeof(struct axi_gpio0_local), GFP_KERNEL);
if (!lp) {
dev_err(dev, "Cound not allocate axi_gpio0 device\n");
return -ENOMEM;
}
dev_set_drvdata(dev, lp);
lp->mem_start = r_mem->start;
lp->mem_end = r_mem->end;
printk("lp->mem_start = %x\n", lp->mem_start);
printk("lp->mem_end = %x\n", lp->mem_end);
if (!request_mem_region(lp->mem_start,
lp->mem_end - lp->mem_start + 1,
DRIVER_NAME)) {
dev_err(dev, "Couldn't lock memory region at %p\n",
(void *)lp->mem_start);
rc = -EBUSY;
goto error1;
}
lp->base_addr = ioremap(lp->mem_start, lp->mem_end - lp->mem_start + 1);
if (!lp->base_addr) {
dev_err(dev, "axi_gpio0: Could not allocate iomem\n");
rc = -EIO;
goto error2;
}
// Get IRQ for the device
r_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (!r_irq) {
dev_info(dev, "no IRQ found\n");
dev_info(dev, "axi_gpio0 at 0x%08x mapped to 0x%08x\n",
(unsigned int __force)lp->mem_start,
(unsigned int __force)lp->base_addr);
return 0;
}
lp->irq = r_irq->start;
rc = request_irq(lp->irq, &axi_gpio0_irq, 0, DRIVER_NAME, lp);
if (rc) {
dev_err(dev, "testmodule: Could not allocate interrupt %d.\n",
lp->irq);
goto error3;
}
dev_info(dev,"axi_gpio0 at 0x%08x mapped to 0x%08x, irq=%d\n",
(unsigned int __force)lp->mem_start,
(unsigned int __force)lp->base_addr,
lp->irq);
return 0;
error3:
free_irq(lp->irq, lp);
error2:
release_mem_region(lp->mem_start, lp->mem_end - lp->mem_start + 1);
error1:
kfree(lp);
dev_set_drvdata(dev, NULL);
*/
return rc;
}
static int axi_gpio0_remove(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct axi_gpio0_local *lp = dev_get_drvdata(dev);
free_irq(lp->irq, lp);
release_mem_region(lp->mem_start, lp->mem_end - lp->mem_start + 1);
kfree(lp);
dev_set_drvdata(dev, NULL);
test_value = 333;
return 0;
}
//#ifdef CONFIG_OF
static struct of_device_id axi_gpio0_of_match[] = {
{ .compatible = "vendor,axi_gpio0", },
{ /* end of list */ },
};
MODULE_DEVICE_TABLE(of, axi_gpio0_of_match);
//#else
//# define axi_gpio0_of_match
//#endif
static struct platform_driver axi_gpio0_driver = {
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,
.of_match_table = axi_gpio0_of_match,
},
.probe = axi_gpio0_probe,
.remove = axi_gpio0_remove,
};
static int __init axi_gpio0_init(void)
{
int result = 12;
printk(KERN_INFO "Hello module world.\n");
printk(KERN_INFO "Hello module world.\n");
printk(KERN_INFO "In init() function 10:14.\n");
//dev_info(dev, "<1>Hello module world.\n");
//printk("<1>Module parameters were (0x%08x) and \"%s\"\n", myint,
// mystr);
printk(KERN_INFO "result = %d\n", result);
//test_counter();
printk(KERN_ERR "axi_gpio0_driver.probe = %p\n", axi_gpio0_driver.probe);
printk(KERN_ERR "axi_gpio0_probe = %p\n", axi_gpio0_probe);
result = platform_driver_register(&axi_gpio0_driver);
printk(KERN_INFO "result = %d\n", result);
printk(KERN_INFO "test_value = %d\n", test_value);
return result;
}
static void __exit axi_gpio0_exit(void)
{
platform_driver_unregister(&axi_gpio0_driver);
printk(KERN_INFO "Goodbye module world.\n");
printk(KERN_INFO "test_value = %d\n", test_value);
}
module_init(axi_gpio0_init);
module_exit(axi_gpio0_exit);
, в теле axi_gpio0_probe() только printk, хочу увидеть что оно в неё заходит.
Цитата(nill @ Apr 8 2016, 10:36)

Вам же говорят, что это каталог

Зайдите внутрь, там всё дерево разложено по каталогам и файлам.
Ссори, не то закопипастил в посте выше, исправил, не даёт зайти в каталог, переходит сразу в каталог
/sys/firmware/devicetree/base (или так и надо?).