From: alex <afrat001@mail.de>
To: linux-newbie@vger.kernel.org
Subject: No probing in module while using devicetree
Date: Sun, 07 Jun 2015 00:24:47 +0200 [thread overview]
Message-ID: <5573732F.9060106@mail.de> (raw)
Hi,
I want to write my first driver. The target is the beaglebone black. For
my platform_driver need access to one simple gpio pin and one pwm pin so
i used the device tree model to access the drivers for pwm and gpio
chip. Now i have the issue that my probe function will never get called
and i cant identify the problem. I tried the driver as built-in and as
module, but in both cases i didn't find the probe-string in dmesg. The
entry in the dts looks like:
/ {
model = "TI AM335x BegleBone Black";
compatible = "ti,am335x-boneblack","ti,am335x-bone","ti,am33xx";
motor_left:motor@1 {
compatible ="alex,motor";
gpio=&gpio0;
pincrtl-names="default";
pincrtl-0=<&pwm_pins>;
gpio_out_pins=<&gpio0 1>;
pwms = <&ehrpwm0 0 500000>;
status = "okay";
};
};
and the module code:
...
static int motor_probe(struct platform_device *pdev)
{
pr_alert("motor_probe called!\n");
return 0;
}
static int motor_remove(struct platform_device *pdev)
{
pr_alert("motor_remove called!\n");
return 0;
}
...
static struct of_device_id motor_of_match[] =
{
{.compatible = "alex,motor"},
{}
};
MODULE_DEVICE_TABLE(of, motor_of_match);
static struct platform_driver motor_pdriver =
{
.probe = motor_probe,
.remove = motor_remove,
.driver = {
.name = "motor",
.of_match_table = of_match_ptr(motor_of_match),
.owner = THIS_MODULE,
},
};
static int __init motor_driver_init(void)
{
int ret;
pr_info("motor_dirver_init\n");
ret = platform_driver_register(&motor_pdriver);
if(ret < 0)
goto motor_driver_init_error;
return 0;
motor_driver_init_error:
return ret;
}
thx for your help.
static void __exit motor_driver_exit(void)
{
pr_alert("motor_dirver_exit\n");
platform_driver_unregister(&motor_pdriver);
}
module_init(motor_driver_init);
module_exit(motor_driver_exit);
--
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
reply other threads:[~2015-06-06 22:24 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5573732F.9060106@mail.de \
--to=afrat001@mail.de \
--cc=linux-newbie@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.