x86: Make sure i8254 is setup correctly before generating beeps
PATCH 1/4 x86: Make sure i8254 is setup correctly before generating beeps
The i8254 timer control IO port (0x43) should be setup correctly by using PIT counter 2 to generate beeps, however in U-Boot other codes like TSC driver utilizes PIT for TSC frequency calibration and configures the counter 2 to a different mode that does not beep. Fix this by always ensuring the PIT counter 2 is correctly initialized so that the i8254 beeper driver works as expected.
---
arch/x86/lib/i8254.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/x86/lib/i8254.c +4 -0
@@ -51,6 +51,10 @@ int i8254_enable_beep(uint frequency_hz)if (!frequency_hz)return -EINVAL ; +/* make sure i8254 is setup correctly before generating beeps */ +outb (PIT_CMD_CTR2 |PIT_CMD_BOTH |PIT_CMD_MODE3 , +PIT_BASE +PIT_COMMAND ); +i8254_set_beep_freq (frequency_hz);setio_8 (SYSCTL_PORTB ,PORTB_BEEP_ENABLE );
Signature · 1 line
2.7.4
PATCH 2/4 x86: Add a dtsi file for the pc speaker
The pc speaker driven by the i8254 is generic enough to deserve a single dtsi file to be included by boards that use it.
---
arch/x86/dts/pcspkr.dtsi | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 arch/x86/dts/pcspkr.dtsi
arch/x86/dts/pcspkr.dtsi new file +5 -0
@@ -0,0 +1,5 @@ +/ { + pcspkr { + compatible = "i8254,beeper"; + }; +};
Signature · 1 line
2.7.4
PATCH 2/4 x86: Add a dtsi file for the pc speaker
Quoted 10 lines · Bin Meng
The pc speaker driven by the i8254 is generic enough to deserve a single dtsi file to be included by boards that use it.
Signed-off-by Bin Meng <[email protected]>---
arch/x86/dts/pcspkr.dtsi | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 arch/x86/dts/pcspkr.dtsi
PATCH 2/4 x86: Add a dtsi file for the pc speaker
Quoted 6 lines · Simon Glass
Quoted 4 lines · Bin Meng
The pc speaker driven by the i8254 is generic enough to deserve a single dtsi file to be included by boards that use it.
Quoted 8 lines
Quoted 6 lines
Signed-off-by Bin Meng <[email protected]>---
arch/x86/dts/pcspkr.dtsi | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 arch/x86/dts/pcspkr.dtsiReviewed-by Simon Glass <[email protected]>
applied to u-boot-x86, thanks!
PATCH 3/4 x86: coreboot: Add the missing pc speaker node in the device tree
In reply to Bin MengThis is currently missing and without it the i8254 beeper driver won't work.
---
arch/x86/dts/coreboot.dts | 1 + 1 file changed, 1 insertion(+)
arch/x86/dts/coreboot.dts +1 -0
@@ -10,6 +10,7 @@ /include/ "skeleton.dtsi" /include/ "serial.dtsi" /include/ "keyboard.dtsi" +/include/ "pcspkr.dtsi" /include/ "reset.dtsi" /include/ "rtc.dtsi" /include/ "tsc_timer.dtsi"
Signature · 1 line
2.7.4
PATCH 3/4 x86: coreboot: Add the missing pc speaker node in the device tree
Quoted 9 lines · Bin Meng
This is currently missing and without it the i8254 beeper driver won't work.
Signed-off-by Bin Meng <[email protected]>---
arch/x86/dts/coreboot.dts | 1 + 1 file changed, 1 insertion(+)
PATCH 3/4 x86: coreboot: Add the missing pc speaker node in the device tree
Quoted 6 lines · Simon Glass
Quoted 4 lines · Bin Meng
This is currently missing and without it the i8254 beeper driver won't work.
Quoted 7 lines
Quoted 5 lines
Signed-off-by Bin Meng <[email protected]>---
arch/x86/dts/coreboot.dts | 1 + 1 file changed, 1 insertion(+)Reviewed-by Simon Glass <[email protected]>
applied to u-boot-x86, thanks!
PATCH 4/4 x86: crownbay: Enable the beeper sound driver
In reply to Bin MengUse the i8254 sound driver to support creating simple beeps.
---
arch/x86/dts/crownbay.dts | 1 + configs/crownbay_defconfig | 3 +++ 2 files changed, 4 insertions(+)
arch/x86/dts/crownbay.dts +1 -0
@@ -10,6 +10,7 @@ /include/ "skeleton.dtsi" /include/ "serial.dtsi" /include/ "keyboard.dtsi" +/include/ "pcspkr.dtsi" /include/ "reset.dtsi" /include/ "rtc.dtsi" /include/ "tsc_timer.dtsi"
configs/crownbay_defconfig +3 -0
@@ -28,6 +28,7 @@ CONFIG_CMD_DHCP=y # CONFIG_CMD_NFS is not set CONFIG_CMD_PING=y CONFIG_CMD_TIME=y +CONFIG_CMD_SOUND=y CONFIG_CMD_EXT2=y CONFIG_CMD_EXT4=y CONFIG_CMD_EXT4_WRITE=y
@@ -41,6 +42,8 @@ CONFIG_REGMAP=y CONFIG_SYSCON=y CONFIG_CPU=y CONFIG_E1000=y +CONFIG_SOUND=y +CONFIG_SOUND_I8254=y CONFIG_SPI=y CONFIG_USB_STORAGE=y CONFIG_USB_KEYBOARD=y
Signature · 1 line
2.7.4
PATCH 4/4 x86: crownbay: Enable the beeper sound driver
Quoted 9 lines · Bin Meng
Use the i8254 sound driver to support creating simple beeps.
Signed-off-by Bin Meng <[email protected]>---
arch/x86/dts/crownbay.dts | 1 + configs/crownbay_defconfig | 3 +++ 2 files changed, 4 insertions(+)
PATCH 4/4 x86: crownbay: Enable the beeper sound driver
Quoted 5 lines · Simon Glass
Quoted 3 lines · Bin Meng
Use the i8254 sound driver to support creating simple beeps.
Quoted 8 lines
Quoted 6 lines
Signed-off-by Bin Meng <[email protected]>---
arch/x86/dts/crownbay.dts | 1 + configs/crownbay_defconfig | 3 +++ 2 files changed, 4 insertions(+)Reviewed-by Simon Glass <[email protected]>
applied to u-boot-x86, thanks!
PATCH 1/4 x86: Make sure i8254 is setup correctly before generating beeps
In reply to Bin MengQuoted 8 lines · Bin Meng
The i8254 timer control IO port (
0x43) should be setup correctly by using PIT counter 2 to generate beeps, however in U-Boot other codes like TSC driver utilizes PIT for TSC frequency calibration and configures the counter 2 to a different mode that does not beep. Fix this by always ensuring the PIT counter 2 is correctly initialized so that the i8254 beeper driver works as expected.
Quoted 5 lines
Signed-off-by Bin Meng <[email protected]>---
arch/x86/lib/i8254.c | 4 ++++ 1 file changed, 4 insertions(+)
PATCH 1/4 x86: Make sure i8254 is setup correctly before generating beeps
Quoted 10 lines · Simon Glass
Quoted 8 lines · Bin Meng
The i8254 timer control IO port (
0x43) should be setup correctly by using PIT counter 2 to generate beeps, however in U-Boot other codes like TSC driver utilizes PIT for TSC frequency calibration and configures the counter 2 to a different mode that does not beep. Fix this by always ensuring the PIT counter 2 is correctly initialized so that the i8254 beeper driver works as expected.
Quoted 7 lines
Quoted 5 lines
Signed-off-by Bin Meng <[email protected]>---
arch/x86/lib/i8254.c | 4 ++++ 1 file changed, 4 insertions(+)Reviewed-by Simon Glass <[email protected]>
applied to u-boot-x86, thanks!