example for hotplug:
################ Step 1. add kernel hotplug config ################
CONFIG_HOTPLUG=y
CONFIG_HOTPLUG_PCI_PCIE=y
CONFIG_HOTPLUG_PCI=y
CONFIG_HOTPLUG_PCI_FAKE=y
CONFIG_HOTPLUG_PCI_CPCI=y
CONFIG_HOTPLUG_PCI_SHPC=y
CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
for this sdk case ,it using ueven,some system may using busybox mdev.
################ step 2.add follow hotplug script on your rootfs ################
-----------------------------------------------------------------------
#! /bin/sh
#mount sysfs on /sys
sysfs=/sys
#firmware path
fwpath=/tmp
lpath=$sysfs/$DEVPATH
fw=$fwpath/$FIRMWARE
#
# We only support firmware subsystem
#
if [ "$1" != "firmware" ]
then
exit 0
fi
case "$ACTION" in
add)
if [ ! -e $lpath/loading ]
then
sleep 1
fi
if [ -f $fw ]
then
echo 1 > $lpath/loading
cp $fw $lpath/data
echo 0 > $lpath/loading
else
echo -1 > $lpath/loading
fi
;;
remove)
;;
*)
exit 1
;;
esac
exit 0
--------------------------------------------------------------------------------------
add above script on your rcS or any initial script when system up.
echo "/tmp/hotplug" > /sys/kernel/uevent_helper
################ step 3 ################
on kernel driver ,you can using folloe kernel api to get firmware on local flash file system .
if ((result = request_firmware(&fw, XXXXXXXX_YYYYYYYY_IMG, &pdev->dev)) == -ENOENT) {
/*
* No firmware found in the firmware directory, skip firmware downloading process
* boot from flash directly on target
*/
printk( "firmware NOT found , image downloading error code : %d\n",result);
// error handle .
}
搜尋此網誌
ERROR:"yyyy" [drivers/net/xxx/xx/xx/xx/xxxx.ko] undefined! Solve way!
Modify /kernel_source/script/Makefile.modpost
Set KBUILD_MODPOST_WARN =1 to solved ERROR .
ERROR: "ifx_mei_atm_showtime_check" [drivers/net/ifxmips_ppa/platform/vr9/e5/ifxmips_ppa_datapath_vr9_e5.ko] undefined!
ERROR: "ifx_mei_atm_showtime_exit" [drivers/net/ifxmips_ppa/platform/vr9/e5/ifxmips_ppa_datapath_vr9_e5.ko] undefined!
ERROR: "ifx_mei_atm_showtime_enter" [drivers/net/ifxmips_ppa/platform/vr9/e5/ifxmips_ppa_datapath_vr9_e5.ko] undefined!
ERROR: "ifx_mei_atm_showtime_check" [drivers/net/ifxmips_ppa/platform/vr9/a5/ifxmips_ppa_datapath_vr9_a5.ko] undefined!
ERROR: "ifx_mei_atm_showtime_exit" [drivers/net/ifxmips_ppa/platform/vr9/a5/ifxmips_ppa_datapath_vr9_a5.ko] undefined!
ERROR: "ifx_mei_atm_showtime_enter" [drivers/net/ifxmips_ppa/platform/vr9/a5/ifxmips_ppa_datapath_vr9_a5.ko] undefined!
Set KBUILD_MODPOST_WARN =1 to solved ERROR .
ERROR: "ifx_mei_atm_showtime_check" [drivers/net/ifxmips_ppa/platform/vr9/e5/ifxmips_ppa_datapath_vr9_e5.ko] undefined!
ERROR: "ifx_mei_atm_showtime_exit" [drivers/net/ifxmips_ppa/platform/vr9/e5/ifxmips_ppa_datapath_vr9_e5.ko] undefined!
ERROR: "ifx_mei_atm_showtime_enter" [drivers/net/ifxmips_ppa/platform/vr9/e5/ifxmips_ppa_datapath_vr9_e5.ko] undefined!
ERROR: "ifx_mei_atm_showtime_check" [drivers/net/ifxmips_ppa/platform/vr9/a5/ifxmips_ppa_datapath_vr9_a5.ko] undefined!
ERROR: "ifx_mei_atm_showtime_exit" [drivers/net/ifxmips_ppa/platform/vr9/a5/ifxmips_ppa_datapath_vr9_a5.ko] undefined!
ERROR: "ifx_mei_atm_showtime_enter" [drivers/net/ifxmips_ppa/platform/vr9/a5/ifxmips_ppa_datapath_vr9_a5.ko] undefined!
Linux kernel 2.6 LED module HOW TO
1. Add kernel define
CONFIG_NEW_LEDS -> using kernel led driver code.
CONFIG_LEDS_CLASS-> enable led control by /sys/class/leds
CONFIG_LEDS_BL2348-> privacy arch and board led define
CONFIG_LEDS_TRIGGERS -> enable kernel led modue trigger feature
CONFIG_LEDS_TRIGGER_TIMER-> enable timer trigger
CONFIG_LEDS_TRIGGER_HEARTBEAT-> enable heartbeat trigger
#
# LED devices
#
CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y
#
# LED drivers
#
CONFIG_LEDS_BL2348=y
#
# LED Triggers
#
CONFIG_LEDS_TRIGGERS=y
CONFIG_LEDS_TRIGGER_TIMER=y
CONFIG_LEDS_TRIGGER_HEARTBEAT=y
2. write driver body:
(1) in module init -> add bl2348_led_init
in bl2348_led_init init platform device add.
platform driver as follow:
static struct platform_driver bl2348_led_driver = {
.probe = bl2348_led_probe,
.remove = bl2348_led_remove,
#ifdef CONFIG_PM
.suspend = bl2348_led_suspend,
.resume = bl2348_led_resume,
#else
.suspend = bl2348_led_suspend,
.resume = bl2348_led_resume,
#endif
.driver = {
.name = BL_2348_LED_DEV_NAME,
.owner = THIS_MODULE,
}
};
(2).write probe ,remove function.
in probe function register led class by kernel _api :
led_classdev_register
static struct led_classdev bl2348_power_led = {
.name = "power",
.default_trigger = "none",
.brightness_set = bl2348_power_set,
.color_set = bl2348_power_color_set,
.default_delay_on = 500,
.default_delay_off = 500,
.color = LED_RED,
.trigger_data = (void*) &bl2348_power_timer_default_on_off,
};
static struct led_classdev bl2348_gpon_link_led = {
.name = "gpon",
.default_trigger = "none",
.brightness_set = bl2348_gpon_link_set,
.default_delay_on = 500,
.default_delay_off = 500,
.color = LED_GREEN , /*Only LED_GREEN is valid,other value is no effect*/
.trigger_data = (void* )&bl2348_gpon_link_timer_default_on_off,
};
implement brightness_set ,color_set callback functions.
brightness_set will set led on or off,you need know how to call CPU r/w basic routine to
enable/disable specific led.
.default_trigger will choose default trigger mode ,we have enable timer and heartbeat ,
so possible value have "none" ,"timer" and "heartbeat"
(3) Control in user space.
if your led module initialize successfully.
you will find files on
/sys/class/leds
Aspen@192.168.1.1:/sys/class/leds> ls -al
drwxr-xr-x 4 root root 0 Jan 1 2000 .
drwxr-xr-x 9 root root 0 Jan 1 2000 ..
drwxr-xr-x 2 root root 0 Jan 1 2000 gpon
drwxr-xr-x 2 root root 0 Jan 1 2000 power
Aspen@192.168.1.1:/sys/class/leds/power> ls -al
drwxr-xr-x 2 root root 0 Jan 1 2000 .
drwxr-xr-x 4 root root 0 Jan 1 2000 ..
-rw-r--r-- 1 root root 0 Jan 1 2000 brightness
-rw-r--r-- 1 root root 0 Jan 1 2000 color
-rw-r--r-- 1 root root 0 Jan 1 2000 delay_off
-rw-r--r-- 1 root root 0 Jan 1 2000 delay_on
lrwxrwxrwx 1 root root 0 Jan 1 2000 device -> ../../../devices/platform/bl2348led
lrwxrwxrwx 1 root root 0 Jan 1 2000 subsystem -> ../../../class/leds
-rw-r--r-- 1 root root 0 Jan 1 2000 trigger
--w------- 1 root root 4096
check current trigger mode :
Aspen@192.168.1.1:/sys/class/leds/power> cat trigger
none [timer] heartbeat
--------> see , using timer mode now.
want to change trigger mode jsut :
echo heartbeat > trigger
Aspen@192.168.1.1:/sys/class/leds/power> cat trigger
none timer [heartbeat]
--------> see , using heartbeat mode now.
delay_off and delay_on will valid when trigger mode is timer.
CONFIG_NEW_LEDS -> using kernel led driver code.
CONFIG_LEDS_CLASS-> enable led control by /sys/class/leds
CONFIG_LEDS_BL2348-> privacy arch and board led define
CONFIG_LEDS_TRIGGERS -> enable kernel led modue trigger feature
CONFIG_LEDS_TRIGGER_TIMER-> enable timer trigger
CONFIG_LEDS_TRIGGER_HEARTBEAT-> enable heartbeat trigger
#
# LED devices
#
CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y
#
# LED drivers
#
CONFIG_LEDS_BL2348=y
#
# LED Triggers
#
CONFIG_LEDS_TRIGGERS=y
CONFIG_LEDS_TRIGGER_TIMER=y
CONFIG_LEDS_TRIGGER_HEARTBEAT=y
2. write driver body:
(1) in module init -> add bl2348_led_init
in bl2348_led_init init platform device add.
platform driver as follow:
static struct platform_driver bl2348_led_driver = {
.probe = bl2348_led_probe,
.remove = bl2348_led_remove,
#ifdef CONFIG_PM
.suspend = bl2348_led_suspend,
.resume = bl2348_led_resume,
#else
.suspend = bl2348_led_suspend,
.resume = bl2348_led_resume,
#endif
.driver = {
.name = BL_2348_LED_DEV_NAME,
.owner = THIS_MODULE,
}
};
(2).write probe ,remove function.
in probe function register led class by kernel _api :
led_classdev_register
static struct led_classdev bl2348_power_led = {
.name = "power",
.default_trigger = "none",
.brightness_set = bl2348_power_set,
.color_set = bl2348_power_color_set,
.default_delay_on = 500,
.default_delay_off = 500,
.color = LED_RED,
.trigger_data = (void*) &bl2348_power_timer_default_on_off,
};
static struct led_classdev bl2348_gpon_link_led = {
.name = "gpon",
.default_trigger = "none",
.brightness_set = bl2348_gpon_link_set,
.default_delay_on = 500,
.default_delay_off = 500,
.color = LED_GREEN , /*Only LED_GREEN is valid,other value is no effect*/
.trigger_data = (void* )&bl2348_gpon_link_timer_default_on_off,
};
implement brightness_set ,color_set callback functions.
brightness_set will set led on or off,you need know how to call CPU r/w basic routine to
enable/disable specific led.
.default_trigger will choose default trigger mode ,we have enable timer and heartbeat ,
so possible value have "none" ,"timer" and "heartbeat"
(3) Control in user space.
if your led module initialize successfully.
you will find files on
/sys/class/leds
Aspen@192.168.1.1:/sys/class/leds> ls -al
drwxr-xr-x 4 root root 0 Jan 1 2000 .
drwxr-xr-x 9 root root 0 Jan 1 2000 ..
drwxr-xr-x 2 root root 0 Jan 1 2000 gpon
drwxr-xr-x 2 root root 0 Jan 1 2000 power
Aspen@192.168.1.1:/sys/class/leds/power> ls -al
drwxr-xr-x 2 root root 0 Jan 1 2000 .
drwxr-xr-x 4 root root 0 Jan 1 2000 ..
-rw-r--r-- 1 root root 0 Jan 1 2000 brightness
-rw-r--r-- 1 root root 0 Jan 1 2000 color
-rw-r--r-- 1 root root 0 Jan 1 2000 delay_off
-rw-r--r-- 1 root root 0 Jan 1 2000 delay_on
lrwxrwxrwx 1 root root 0 Jan 1 2000 device -> ../../../devices/platform/bl2348led
lrwxrwxrwx 1 root root 0 Jan 1 2000 subsystem -> ../../../class/leds
-rw-r--r-- 1 root root 0 Jan 1 2000 trigger
--w------- 1 root root 4096
check current trigger mode :
Aspen@192.168.1.1:/sys/class/leds/power> cat trigger
none [timer] heartbeat
--------> see , using timer mode now.
want to change trigger mode jsut :
echo heartbeat > trigger
Aspen@192.168.1.1:/sys/class/leds/power> cat trigger
none timer [heartbeat]
--------> see , using heartbeat mode now.
delay_off and delay_on will valid when trigger mode is timer.
Kernel 2.6 platform device add method.
1.device_initcall
static struct platform_device bl23xx_dying_gasp_device = {
.name = BL_2348_DGASP_DEV_NAME,
.id = 0,
.num_resources = ARRAY_SIZE(bl2348_dying_gasp_resources),
.resource = bl2348_dying_gasp_resources,
};
static struct platform_device bl23xx_led_device = {
.name = BL_2348_LED_DEV_NAME,
.id = -1,
.num_resources = 0,
.resource = NULL ,
};static struct platform_device *bl2348_devices[] __initdata = {
&bl23xx_led_device,
&bl23xx_dying_gasp_device,
};
void bl2348_add_platform_device(void){
int ret;
ret =platform_add_devices(bl2348_devices, ARRAY_SIZE(bl2348_devices));
#ifdef PLATFORM_DEVICE_DEBUG
if(!ret)
printk(KERN_ALERT "========> bl2348 Platform device add success\n");
else
printk(KERN_ALERT "========> bl2348 Platform device add fail\n");
#endif
}
device_initcall(bl2348_add_platform_device);/*Jacky.Xue : extra device resource required */
2. kernel API : platform_device_register_simple
EXAMPLE:
led2348pdev = platform_device_register_simple(BL_2348_LED_DEV_NAME, -1, NULL, 0);
if (IS_ERR(led2348pdev)) {
ret = PTR_ERR(led2348pdev);
platform_driver_unregister(&bl2348_led_driver);
goto out;
static struct platform_device bl23xx_dying_gasp_device = {
.name = BL_2348_DGASP_DEV_NAME,
.id = 0,
.num_resources = ARRAY_SIZE(bl2348_dying_gasp_resources),
.resource = bl2348_dying_gasp_resources,
};
static struct platform_device bl23xx_led_device = {
.name = BL_2348_LED_DEV_NAME,
.id = -1,
.num_resources = 0,
.resource = NULL ,
};static struct platform_device *bl2348_devices[] __initdata = {
&bl23xx_led_device,
&bl23xx_dying_gasp_device,
};
void bl2348_add_platform_device(void){
int ret;
ret =platform_add_devices(bl2348_devices, ARRAY_SIZE(bl2348_devices));
#ifdef PLATFORM_DEVICE_DEBUG
if(!ret)
printk(KERN_ALERT "========> bl2348 Platform device add success\n");
else
printk(KERN_ALERT "========> bl2348 Platform device add fail\n");
#endif
}
device_initcall(bl2348_add_platform_device);/*Jacky.Xue : extra device resource required */
2. kernel API : platform_device_register_simple
EXAMPLE:
led2348pdev = platform_device_register_simple(BL_2348_LED_DEV_NAME, -1, NULL, 0);
if (IS_ERR(led2348pdev)) {
ret = PTR_ERR(led2348pdev);
platform_driver_unregister(&bl2348_led_driver);
goto out;
Build kernel module in kernel source tree,avoid external symbol reference WARNNING make exit!
export KBUILD_MODPOST_WARN
export KBUILD_MODPOST_WARN:=1
export KBUILD_MODPOST_WARN:=0
export KBUILD_MODPOST_WARN:=1
export KBUILD_MODPOST_WARN:=0
Kernel 2.6 Default config name rule.
Kernel 2.6 support
make -C $(KDIR) ARCH=mips xxxxxxxx_defconfig
the xxxxxxxx_defconfig should copy into $(KDIR)/arch/mips/configs
Here, the xxxxxxxx_defconfig ,xxxxxxxx can be any string, and _defconfig must be same string.
make -C $(KDIR) ARCH=mips xxxxxxxx_defconfig
the xxxxxxxx_defconfig should copy into $(KDIR)/arch/mips/configs
Here, the xxxxxxxx_defconfig ,xxxxxxxx can be any string, and _defconfig must be same string.
ST MPE812A driver porting.
1. Using Linux i2c utility confirm the H/W is ok or not.
root@skygem7105ref:~# i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: UU -- -- -- -- -- -- -- -- -- -- UU -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- -- 78 -- -- -- -- -- -- --
root@skygem7105ref:~#
For my case, the i2c detect is successfully.
2. Create platform data/init on your BSP.
ADD struct i2c_board_info :
i2c_register_board_info(1/*I2C bus no*/, &stmpe81xx_bd_info/*your bd info*/, 1);
ADD struct platform_device
static struct platform_device *XXXX_devices[] __initdata = {
&XXXXXXXX_physmap_flash,
&XXXXXXXX_leds,
&XXXXXXXX_phy_device,
&spi_pio_device[0],
&STMPE81XX_i2c_device,
};
root@skygem7105ref:~# i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: UU -- -- -- -- -- -- -- -- -- -- UU -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- -- 78 -- -- -- -- -- -- --
root@skygem7105ref:~#
For my case, the i2c detect is successfully.
2. Create platform data/init on your BSP.
ADD struct i2c_board_info :
i2c_register_board_info(1/*I2C bus no*/, &stmpe81xx_bd_info/*your bd info*/, 1);
ADD struct platform_device
static struct platform_device *XXXX_devices[] __initdata = {
&XXXXXXXX_physmap_flash,
&XXXXXXXX_leds,
&XXXXXXXX_phy_device,
&spi_pio_device[0],
&STMPE81XX_i2c_device,
};
I2C Address 10 bit an 7bit.
If you have never learn the I2C specification, you will confuse in your datasheet i2c slave
addrss is over 0x7e ,hince you got error retturn when using the i2c tools debug.
Start to keep in mind, if the data sheet address descript your slave device is 0x8a , then you need
left shift 1 bit to get the 7bit address to using the Linux i2c tools(Most linxu i2c tools using 7bit mode
to do ioctl query or detect your i2c slave deviec).
In this case ,0x8a (1000 1010) , will be 0x45 in 7bit format .
addrss is over 0x7e ,hince you got error retturn when using the i2c tools debug.
Start to keep in mind, if the data sheet address descript your slave device is 0x8a , then you need
left shift 1 bit to get the 7bit address to using the Linux i2c tools(Most linxu i2c tools using 7bit mode
to do ioctl query or detect your i2c slave deviec).
In this case ,0x8a (1000 1010) , will be 0x45 in 7bit format .
clean the fedora svn authentication data(RESET local svn account cache).
example user: root
rm -rf /root/.subversion
then try check out the source again.
svn server will ask your local username and new svn user name and password.
rm -rf /root/.subversion
then try check out the source again.
svn server will ask your local username and new svn user name and password.
conflicts with new declaration with 'C' linkage
Errors:
/root/bl/blgpon2k110515-check/pmp16sp1/SW-BL-OMCI-ONU_4612/gpon/onu/DNI/../bl_apps/RadVisionMTF4.0/appl/dnimtf/MtfSample/API_LIBS/PMC_VTSP_API/inc/pmc_vtsp_control.h:91: error: previous declaration of 'VTSP_Return PMC_VTSP_cidEnd(uvint)' with 'C++' linkage
/root/bl/blgpon2k110515-check/pmp16sp1/SW-BL-OMCI-ONU_4612/gpon/onu/DNI/../bl_apps/RadVisionMTF4.0/appl/dnimtf/MtfSample/Base/rvMtfSampleMindSpeed.h:249: error: conflicts with new declaration with 'C' linkage
make[2]: *** [/root/bl/blgpon2k110515-check/pmp16sp1/SW-BL-OMCI-ONU_4612/gpon/onu/ocssrc/uspace/omcidev/ont/obj.lx/meontg.o] Error 1
FIX:
goto each header file add :
#if defined(__cplusplus)
extern "C" {
#endif
......
#if defined(__cplusplus)
}
#endif
/root/bl/blgpon2k110515-check/pmp16sp1/SW-BL-OMCI-ONU_4612/gpon/onu/DNI/../bl_apps/RadVisionMTF4.0/appl/dnimtf/MtfSample/API_LIBS/PMC_VTSP_API/inc/pmc_vtsp_control.h:91: error: previous declaration of 'VTSP_Return PMC_VTSP_cidEnd(uvint)' with 'C++' linkage
/root/bl/blgpon2k110515-check/pmp16sp1/SW-BL-OMCI-ONU_4612/gpon/onu/DNI/../bl_apps/RadVisionMTF4.0/appl/dnimtf/MtfSample/Base/rvMtfSampleMindSpeed.h:249: error: conflicts with new declaration with 'C' linkage
make[2]: *** [/root/bl/blgpon2k110515-check/pmp16sp1/SW-BL-OMCI-ONU_4612/gpon/onu/ocssrc/uspace/omcidev/ont/obj.lx/meontg.o] Error 1
FIX:
goto each header file add :
#if defined(__cplusplus)
extern "C" {
#endif
......
#if defined(__cplusplus)
}
#endif
Linux kernel COMMAND_LINE_SIZE should same as UBOOT CFG_CBSIZE.
Under development,you maybe required set long loader command and kernel boot argument.In this kind of case, we should increase the CFG_CBSIZE in your uboot 's board's config.h.
Then modify kernel's COMMAND_LINE_SIZE value, suggest set same value for these 2 defiene Macro.
COMMAND_LINE_SIZE most under /kernel source/include/asm-xxx/setup.h
here xxx could be replace by mips,arm,ppc ....etc.
Then modify kernel's COMMAND_LINE_SIZE value, suggest set same value for these 2 defiene Macro.
COMMAND_LINE_SIZE most under /kernel source/include/asm-xxx/setup.h
here xxx could be replace by mips,arm,ppc ....etc.
訂閱:
文章 (Atom)