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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs