From e0e06499ca566922181234ab2f4698d4024f7f64 Mon Sep 17 00:00:00 2001 From: Koen Kooi Date: Fri, 8 Aug 2008 12:50:02 +0000 Subject: openzaurus pxa 2.4.18: update SRC_URI to point to oz.org, the ezaurus URL seems to be corrupt --- packages/linux/openzaurus-pxa_2.4.18-rmk7-pxa3-embedix20031107.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages/linux') diff --git a/packages/linux/openzaurus-pxa_2.4.18-rmk7-pxa3-embedix20031107.inc b/packages/linux/openzaurus-pxa_2.4.18-rmk7-pxa3-embedix20031107.inc index b56746880f..7e7548491f 100644 --- a/packages/linux/openzaurus-pxa_2.4.18-rmk7-pxa3-embedix20031107.inc +++ b/packages/linux/openzaurus-pxa_2.4.18-rmk7-pxa3-embedix20031107.inc @@ -14,7 +14,7 @@ FILESDIR = "${@os.path.dirname(bb.data.getVar('FILE',d,1))}/openzaurus-pxa-${KV} SRC_URI = "${KERNELORG_MIRROR}/pub/linux/kernel/v2.4/linux-${KV}.tar.bz2 \ ftp://ftp.linux.org.uk/pub/armlinux/source/kernel-patches/v2.4/patch-${KV}-rmk${RMKV}.gz;patch=1 \ ftp://source.mvista.com/pub/xscale/pxa/diff-${KV}-rmk${RMKV}-pxa${PXAV}.gz;patch=1 \ - http://developer.ezaurus.com/sl_j/source/c860/${SHARPV}/linux-${PV}-slc860-${SHARPV}-rom1_10.bz2;patch=1 \ + http://openzaurus.org/mirror/linux-${PV}-slc860-${SHARPV}-rom1_10.bz2;patch=1 \ file://piro.patch;patch=1 \ file://swap-performance.patch;patch=1 \ file://bluetooth-2.4.18-mh15.patch;patch=1 \ -- cgit v1.2.3 From a6e1e173fd4995c4daad7948a73577fe082fd963 Mon Sep 17 00:00:00 2001 From: Koen Kooi Date: Fri, 8 Aug 2008 14:59:16 +0000 Subject: linux-omap2 git: bump SRCREV to get GPTIMER irq fix --- packages/linux/linux-omap2_git.bb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'packages/linux') diff --git a/packages/linux/linux-omap2_git.bb b/packages/linux/linux-omap2_git.bb index 1c47bd95b4..4008102f09 100644 --- a/packages/linux/linux-omap2_git.bb +++ b/packages/linux/linux-omap2_git.bb @@ -2,11 +2,11 @@ require linux-omap.inc FILESDIR = "${@os.path.dirname(bb.data.getVar('FILE',d,1))}/linux-omap2-git/${MACHINE}" -SRCREV = "040378c1b24ace3b8945318a8c24ef218200912c" +SRCREV = "d6daf8d8cc5ccf90247def5551ee9c3e8555e848" PV = "2.6.26" #PV = "2.6.26+2.6.27-rc1+${PR}+git${SRCREV}" -PR = "r57" +PR = "r58" SRC_URI = "git://source.mvista.com/git/linux-omap-2.6.git;protocol=git \ file://defconfig" -- cgit v1.2.3 From 19d7a70af1f98b1e498930d522c31910b0662799 Mon Sep 17 00:00:00 2001 From: Koen Kooi Date: Fri, 8 Aug 2008 20:45:58 +0000 Subject: linux-openmoko.inc: sync with openmoko so package upgrade doesn't &*$(*@$(@ erase my kernel partition again --- packages/linux/linux-handhelds-2.6-2.6.21/h2200/defconfig | 8 ++++++-- packages/linux/linux-openmoko.inc | 10 +++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) (limited to 'packages/linux') diff --git a/packages/linux/linux-handhelds-2.6-2.6.21/h2200/defconfig b/packages/linux/linux-handhelds-2.6-2.6.21/h2200/defconfig index 7c8e756060..e5d3cd1a07 100644 --- a/packages/linux/linux-handhelds-2.6-2.6.21/h2200/defconfig +++ b/packages/linux/linux-handhelds-2.6-2.6.21/h2200/defconfig @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit # Linux kernel version: 2.6.21-hh20 -# Fri Feb 15 01:08:07 2008 +# Thu Aug 7 19:32:15 2008 # CONFIG_ARM=y CONFIG_SYS_SUPPORTS_APM_EMULATION=y @@ -938,7 +938,11 @@ CONFIG_HW_CONSOLE=y # # Serial drivers # -# CONFIG_SERIAL_8250 is not set +CONFIG_SERIAL_8250=m +CONFIG_SERIAL_8250_CS=m +CONFIG_SERIAL_8250_NR_UARTS=4 +CONFIG_SERIAL_8250_RUNTIME_UARTS=4 +# CONFIG_SERIAL_8250_EXTENDED is not set # # Non-8250 serial port support diff --git a/packages/linux/linux-openmoko.inc b/packages/linux/linux-openmoko.inc index b4863ca0c8..3a6589791e 100644 --- a/packages/linux/linux-openmoko.inc +++ b/packages/linux/linux-openmoko.inc @@ -4,12 +4,12 @@ KERNEL_IMAGETYPE = "uImage" UBOOT_ENTRYPOINT = "30008000" -FILES_kernel-image = "" -ALLOW_EMPTY = "1" - COMPATIBLE_HOST = "arm.*-linux" COMPATIBLE_MACHINE = 'om-gta01|om-gta02' +CONFIG_NAME_om-gta01 = "gta01" +CONFIG_NAME_om-gta02 = "gta02" + CMDLINE = "unused -- bootloader passes ATAG list" ############################################################### @@ -66,6 +66,10 @@ else exit 1 fi + if [ ! -f /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE}-${KERNEL_VERSION} ] ; then + exit 1 + fi + ${bindir}/flash_eraseall $MTD_KERNEL_PARTITION ${bindir}/nandwrite -p $MTD_KERNEL_PARTITION /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE}-${KERNEL_VERSION} else -- cgit v1.2.3 From 1f651e7bfd7409c8db96d530b74b31af2a79cf15 Mon Sep 17 00:00:00 2001 From: Philip Balister Date: Fri, 8 Aug 2008 22:01:19 +0000 Subject: linux-davinci : Add patch to solve strange serial console behavior. --- packages/linux/linux-davinci/8250_davinci.patch | 28 +++++++++++++++++++++++ packages/linux/linux-davinci_2.6.x+git-davinci.bb | 1 + 2 files changed, 29 insertions(+) create mode 100644 packages/linux/linux-davinci/8250_davinci.patch (limited to 'packages/linux') diff --git a/packages/linux/linux-davinci/8250_davinci.patch b/packages/linux/linux-davinci/8250_davinci.patch new file mode 100644 index 0000000000..3625ded357 --- /dev/null +++ b/packages/linux/linux-davinci/8250_davinci.patch @@ -0,0 +1,28 @@ +--- linux-2.6/drivers/serial/8250.c 2008-08-06 15:56:53.000000000 -0500 ++++ linux-2.6-vanilla/drivers/serial/8250.c 2008-08-07 12:24:29.000000000 -0500 +@@ -1867,7 +1867,6 @@ + } + + if (is_real_interrupt(up->port.irq)) { +- unsigned char iir1; + /* + * Test for UARTs that do not reassert THRE when the + * transmitter is idle and the interrupt has already +@@ -1881,7 +1880,7 @@ + wait_for_xmitr(up, UART_LSR_THRE); + serial_out_sync(up, UART_IER, UART_IER_THRI); + udelay(1); /* allow THRE to set */ +- iir1 = serial_in(up, UART_IIR); ++ serial_in(up, UART_IIR); + serial_out(up, UART_IER, 0); + serial_out_sync(up, UART_IER, UART_IER_THRI); + udelay(1); /* allow a working UART time to re-assert THRE */ +@@ -1894,7 +1893,7 @@ + * If the interrupt is not reasserted, setup a timer to + * kick the UART on a regular basis. + */ +- if (!(iir1 & UART_IIR_NO_INT) && (iir & UART_IIR_NO_INT)) { ++ if (iir & UART_IIR_NO_INT) { + pr_debug("ttyS%d - using backup timer\n", port->line); + up->timer.function = serial8250_backup_timeout; + up->timer.data = (unsigned long)up; diff --git a/packages/linux/linux-davinci_2.6.x+git-davinci.bb b/packages/linux/linux-davinci_2.6.x+git-davinci.bb index 5b5a55aaf3..6560fc9fbb 100644 --- a/packages/linux/linux-davinci_2.6.x+git-davinci.bb +++ b/packages/linux/linux-davinci_2.6.x+git-davinci.bb @@ -13,6 +13,7 @@ PR = "r2" COMPATIBLE_MACHINE = "(davinci-dvevm|davinci-sffsdr)" SRC_URI = "git://source.mvista.com/git/linux-davinci-2.6.git;protocol=git \ + file://8250_davinci.patch;patch=1 \ file://defconfig" SRC_URI_append_davinci-sffsdr = " file://sffsdr.patch;patch=1" -- cgit v1.2.3 From 495376665c836f453510890e20579252a1d0323c Mon Sep 17 00:00:00 2001 From: Koen Kooi Date: Sat, 9 Aug 2008 08:01:13 +0000 Subject: linux-openmoko 2.6.24+git: make bt and sound builtin, stash PR between version and git rev to get something monotonically increasing --- packages/linux/linux-openmoko/defconfig-oe | 48 ++++++++++++++--------------- packages/linux/linux-openmoko_2.6.24+git.bb | 4 +-- 2 files changed, 26 insertions(+), 26 deletions(-) (limited to 'packages/linux') diff --git a/packages/linux/linux-openmoko/defconfig-oe b/packages/linux/linux-openmoko/defconfig-oe index 4154639d3e..174f0a544d 100644 --- a/packages/linux/linux-openmoko/defconfig-oe +++ b/packages/linux/linux-openmoko/defconfig-oe @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit # Linux kernel version: 2.6.24 -# Mon Feb 25 07:03:56 2008 +# Sat Aug 9 09:51:30 2008 # CONFIG_ARM=y CONFIG_SYS_SUPPORTS_APM_EMULATION=y @@ -569,20 +569,20 @@ CONFIG_NET_SCH_FIFO=y # CONFIG_NET_PKTGEN is not set # CONFIG_HAMRADIO is not set # CONFIG_IRDA is not set -CONFIG_BT=m -CONFIG_BT_L2CAP=m -CONFIG_BT_SCO=m -CONFIG_BT_RFCOMM=m +CONFIG_BT=y +CONFIG_BT_L2CAP=y +CONFIG_BT_SCO=y +CONFIG_BT_RFCOMM=y CONFIG_BT_RFCOMM_TTY=y -CONFIG_BT_BNEP=m +CONFIG_BT_BNEP=y CONFIG_BT_BNEP_MC_FILTER=y CONFIG_BT_BNEP_PROTO_FILTER=y -CONFIG_BT_HIDP=m +CONFIG_BT_HIDP=y # # Bluetooth device drivers # -CONFIG_BT_HCIUSB=m +CONFIG_BT_HCIUSB=y CONFIG_BT_HCIUSB_SCO=y # CONFIG_BT_HCIBTSDIO is not set # CONFIG_BT_HCIUART is not set @@ -891,9 +891,6 @@ CONFIG_INPUT_MOUSE=y # CONFIG_INPUT_JOYSTICK is not set # CONFIG_INPUT_TABLET is not set CONFIG_INPUT_TOUCHSCREEN=y -CONFIG_TOUCHSCREEN_FILTER=y -CONFIG_TOUCHSCREEN_FILTER_MEDIAN=y -CONFIG_TOUCHSCREEN_FILTER_MEAN=y # CONFIG_TOUCHSCREEN_ADS7846 is not set # CONFIG_TOUCHSCREEN_FUJITSU is not set CONFIG_TOUCHSCREEN_S3C2410=y @@ -1137,13 +1134,13 @@ CONFIG_SOUND=y # # Advanced Linux Sound Architecture # -CONFIG_SND=m -CONFIG_SND_TIMER=m -CONFIG_SND_PCM=m +CONFIG_SND=y +CONFIG_SND_TIMER=y +CONFIG_SND_PCM=y # CONFIG_SND_SEQUENCER is not set CONFIG_SND_OSSEMUL=y -CONFIG_SND_MIXER_OSS=m -CONFIG_SND_PCM_OSS=m +CONFIG_SND_MIXER_OSS=y +CONFIG_SND_PCM_OSS=y CONFIG_SND_PCM_OSS_PLUGINS=y # CONFIG_SND_DYNAMIC_MINORS is not set CONFIG_SND_SUPPORT_OLD_API=y @@ -1176,16 +1173,17 @@ CONFIG_SND_VERBOSE_PROCFS=y # # System on Chip audio support # -CONFIG_SND_SOC=m -CONFIG_SND_S3C24XX_SOC=m -CONFIG_SND_S3C24XX_SOC_I2S=m -CONFIG_SND_S3C24XX_SOC_NEO1973_WM8753=m -CONFIG_SND_S3C24XX_SOC_NEO1973_GTA02_WM8753=m +CONFIG_SND_SOC=y +CONFIG_SND_S3C24XX_SOC=y +CONFIG_SND_S3C24XX_SOC_I2S=y +CONFIG_SND_S3C24XX_SOC_NEO1973_WM8753=y +# CONFIG_SND_S3C24XX_SOC_NEO1973_WM8753_DEBUG is not set +CONFIG_SND_S3C24XX_SOC_NEO1973_GTA02_WM8753=y # # SoC Audio support for SuperH # -CONFIG_SND_SOC_WM8753=m +CONFIG_SND_SOC_WM8753=y # # Open Sound System @@ -1230,7 +1228,7 @@ CONFIG_USB_SUSPEND=y # USB Host Controller Drivers # # CONFIG_USB_ISP116X_HCD is not set -CONFIG_USB_OHCI_HCD=m +CONFIG_USB_OHCI_HCD=y # CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set # CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set CONFIG_USB_OHCI_LITTLE_ENDIAN=y @@ -1568,6 +1566,9 @@ CONFIG_JFFS2_ZLIB=y CONFIG_JFFS2_RTIME=y # CONFIG_JFFS2_RUBIN is not set CONFIG_CRAMFS=y +CONFIG_SQUASHFS=m +# CONFIG_SQUASHFS_EMBEDDED is not set +CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 # CONFIG_VXFS_FS is not set # CONFIG_HPFS_FS is not set # CONFIG_QNX4FS_FS is not set @@ -1604,7 +1605,6 @@ CONFIG_CIFS_WEAK_PW_HASH=y # CONFIG_NCP_FS is not set # CONFIG_CODA_FS is not set # CONFIG_AFS_FS is not set -CONFIG_SQUASHFS=m # # Partition Types diff --git a/packages/linux/linux-openmoko_2.6.24+git.bb b/packages/linux/linux-openmoko_2.6.24+git.bb index 79e2cde8dc..8520adc3e1 100644 --- a/packages/linux/linux-openmoko_2.6.24+git.bb +++ b/packages/linux/linux-openmoko_2.6.24+git.bb @@ -6,8 +6,8 @@ DESCRIPTION = "Linux 2.6.x (development) kernel for FIC SmartPhones shipping w/ KERNEL_RELEASE = "2.6.24" KERNEL_VERSION = "${KERNEL_RELEASE}" -PV = "${KERNEL_RELEASE}+gitr${SRCREV}" -PR = "r4" +PV = "${KERNEL_RELEASE}+${PR}+gitr${SRCREV}" +PR = "r5" SRC_URI = "\ git://git.openmoko.org/git/kernel.git;protocol=git;branch=stable \ -- cgit v1.2.3 From 062946db8225c9062f1853ef4fccfb5975fc3b48 Mon Sep 17 00:00:00 2001 From: Koen Kooi Date: Sun, 10 Aug 2008 10:47:20 +0000 Subject: linux-omap2 git: update to latest git, add Pauls latest serial hang patch set --- .../beagleboard/01-gptimer_clear_isrs_on_init | 25 ----- .../beagleboard/01-make_tick_gptimer_configurable | 58 +++++++++++ .../beagleboard/02-gptimer_use_match_for_tick | 97 ------------------ .../beagleboard/03-gptimer_match_plus_ovf | 94 ------------------ .../beagleboard/04-gptimer_add_debug_to_sysrq_q | 110 --------------------- .../linux/linux-omap2-git/beagleboard/defconfig | 5 +- packages/linux/linux-omap2_git.bb | 9 +- 7 files changed, 64 insertions(+), 334 deletions(-) delete mode 100644 packages/linux/linux-omap2-git/beagleboard/01-gptimer_clear_isrs_on_init create mode 100644 packages/linux/linux-omap2-git/beagleboard/01-make_tick_gptimer_configurable delete mode 100644 packages/linux/linux-omap2-git/beagleboard/02-gptimer_use_match_for_tick delete mode 100644 packages/linux/linux-omap2-git/beagleboard/03-gptimer_match_plus_ovf delete mode 100644 packages/linux/linux-omap2-git/beagleboard/04-gptimer_add_debug_to_sysrq_q (limited to 'packages/linux') diff --git a/packages/linux/linux-omap2-git/beagleboard/01-gptimer_clear_isrs_on_init b/packages/linux/linux-omap2-git/beagleboard/01-gptimer_clear_isrs_on_init deleted file mode 100644 index 5123bafe54..0000000000 --- a/packages/linux/linux-omap2-git/beagleboard/01-gptimer_clear_isrs_on_init +++ /dev/null @@ -1,25 +0,0 @@ -clear - -From: Paul Walmsley - - ---- - - arch/arm/plat-omap/dmtimer.c | 4 ++++ - 1 files changed, 4 insertions(+), 0 deletions(-) - -diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c -index f22506a..e38a11e 100644 ---- a/arch/arm/plat-omap/dmtimer.c -+++ b/arch/arm/plat-omap/dmtimer.c -@@ -703,6 +703,10 @@ int __init omap_dm_timer_init(void) - timer->fclk = clk_get(NULL, clk_name); - } - #endif -+ omap_dm_timer_write_status(timer, OMAP_TIMER_INT_OVERFLOW | -+ OMAP_TIMER_INT_MATCH | -+ OMAP_TIMER_INT_CAPTURE); -+ - } - - return 0; diff --git a/packages/linux/linux-omap2-git/beagleboard/01-make_tick_gptimer_configurable b/packages/linux/linux-omap2-git/beagleboard/01-make_tick_gptimer_configurable new file mode 100644 index 0000000000..bcf0fa79f8 --- /dev/null +++ b/packages/linux/linux-omap2-git/beagleboard/01-make_tick_gptimer_configurable @@ -0,0 +1,58 @@ +OMAP2/3 GPTIMER: allow system tick GPTIMER to be configurable at build + +From: Paul Walmsley + +Add Kbuild code to allow the builder to select which GPTIMER block to use +for the Linux clockevents timer. Practical choices at this point are +GPTIMER1 or GPTIMER12. Both of these timers are in the WKUP powerdomain, +and so are unaffected by chip power management. GPTIMER1 can use sys_clk +as a source, for applications where a high-resolution timer is more important +than power management. GPTIMER12 has the special property that it has +the secure 32kHz oscillator as its source clock, which may be less prone +to glitches than the off-chip 32kHz oscillator. + +At this point, it appears that most boards are fine with GPTIMER1, +but Beagle should use GPTIMER12. +--- + + arch/arm/mach-omap2/Kconfig | 16 ++++++++++++++++ + arch/arm/mach-omap2/timer-gp.c | 2 +- + 2 files changed, 17 insertions(+), 1 deletions(-) + +diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig +index bb6d695..0002cb6 100644 +--- a/arch/arm/mach-omap2/Kconfig ++++ b/arch/arm/mach-omap2/Kconfig +@@ -122,3 +122,19 @@ config MACH_OMAP3EVM + config MACH_OMAP3_BEAGLE + bool "OMAP3 BEAGLE board" + depends on ARCH_OMAP3 && ARCH_OMAP34XX ++ ++config OMAP_TICK_GPTIMER ++ int "GPTIMER used for system tick timer" ++ depends on ARCH_OMAP2 || ARCH_OMAP3 ++ range 1 12 ++ default 1 ++ help ++ Linux uses one of the twelve on-board OMAP GPTIMER blocks to generate ++ system tick interrupts. The twelve GPTIMERs have slightly ++ different powerdomain, source clock, and security properties ++ (mostly documented in the OMAP3 TRMs) that can affect the selection ++ of which GPTIMER to use. The historical default is GPTIMER1. ++ If CONFIG_OMAP_32K_TIMER is selected, Beagle may require GPTIMER12 ++ due to hardware sensitivity to glitches on the OMAP 32kHz clock ++ input. ++ +diff --git a/arch/arm/mach-omap2/timer-gp.c b/arch/arm/mach-omap2/timer-gp.c +index 557603f..ec80af5 100644 +--- a/arch/arm/mach-omap2/timer-gp.c ++++ b/arch/arm/mach-omap2/timer-gp.c +@@ -99,7 +99,7 @@ static void __init omap2_gp_clockevent_init(void) + { + u32 tick_rate; + +- gptimer = omap_dm_timer_request_specific(1); ++ gptimer = omap_dm_timer_request_specific(CONFIG_OMAP_TICK_GPTIMER); + BUG_ON(gptimer == NULL); + + #if defined(CONFIG_OMAP_32K_TIMER) diff --git a/packages/linux/linux-omap2-git/beagleboard/02-gptimer_use_match_for_tick b/packages/linux/linux-omap2-git/beagleboard/02-gptimer_use_match_for_tick deleted file mode 100644 index 6eb6c9b477..0000000000 --- a/packages/linux/linux-omap2-git/beagleboard/02-gptimer_use_match_for_tick +++ /dev/null @@ -1,97 +0,0 @@ -OMAP2/3 system tick GPTIMER: use match interrupts rather than overflow interrupts - -From: Paul Walmsley - -On some OMAP3 chips, GPTIMER1 will occasionally decline to interrupt -the MPU when a timer overflow event occurs. The timer stops running; -and TOCR is sometimes incremented; but the MPU apparently never receives -the interrupt. This patch was an experiment in using the GPTIMER -match interrupt to determine if it resolves the problem. -Unfortunately, it does not; the same problem occurs with match -interrupts; but this patch is preserved as the base for a -match+overflow interrupt workaround used in a following patch. ---- - - arch/arm/mach-omap2/timer-gp.c | 32 ++++++++++---------------------- - 1 files changed, 10 insertions(+), 22 deletions(-) - -diff --git a/arch/arm/mach-omap2/timer-gp.c b/arch/arm/mach-omap2/timer-gp.c -index 557603f..51996ba 100644 ---- a/arch/arm/mach-omap2/timer-gp.c -+++ b/arch/arm/mach-omap2/timer-gp.c -@@ -36,6 +36,8 @@ - #include - #include - -+#define GPTIMER_MATCH_VAL 0xffff0000 -+ - static struct omap_dm_timer *gptimer; - static struct clock_event_device clockevent_gpt; - -@@ -44,7 +46,7 @@ static irqreturn_t omap2_gp_timer_interrupt(int irq, void *dev_id) - struct omap_dm_timer *gpt = (struct omap_dm_timer *)dev_id; - struct clock_event_device *evt = &clockevent_gpt; - -- omap_dm_timer_write_status(gpt, OMAP_TIMER_INT_OVERFLOW); -+ omap_dm_timer_write_status(gpt, OMAP_TIMER_INT_MATCH); - - evt->event_handler(evt); - return IRQ_HANDLED; -@@ -59,7 +61,7 @@ static struct irqaction omap2_gp_timer_irq = { - static int omap2_gp_timer_set_next_event(unsigned long cycles, - struct clock_event_device *evt) - { -- omap_dm_timer_set_load_start(gptimer, 0, 0xffffffff - cycles); -+ omap_dm_timer_set_load_start(gptimer, 0, GPTIMER_MATCH_VAL - cycles); - - return 0; - } -@@ -67,29 +69,12 @@ static int omap2_gp_timer_set_next_event(unsigned long cycles, - static void omap2_gp_timer_set_mode(enum clock_event_mode mode, - struct clock_event_device *evt) - { -- u32 period; -- - omap_dm_timer_stop(gptimer); -- -- switch (mode) { -- case CLOCK_EVT_MODE_PERIODIC: -- period = clk_get_rate(omap_dm_timer_get_fclk(gptimer)) / HZ; -- period -= 1; -- -- omap_dm_timer_set_load_start(gptimer, 1, 0xffffffff - period); -- break; -- case CLOCK_EVT_MODE_ONESHOT: -- break; -- case CLOCK_EVT_MODE_UNUSED: -- case CLOCK_EVT_MODE_SHUTDOWN: -- case CLOCK_EVT_MODE_RESUME: -- break; -- } - } - - static struct clock_event_device clockevent_gpt = { - .name = "gp timer", -- .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, -+ .features = CLOCK_EVT_FEAT_ONESHOT, - .shift = 32, - .set_next_event = omap2_gp_timer_set_next_event, - .set_mode = omap2_gp_timer_set_mode, -@@ -111,12 +96,15 @@ static void __init omap2_gp_clockevent_init(void) - - omap2_gp_timer_irq.dev_id = (void *)gptimer; - setup_irq(omap_dm_timer_get_irq(gptimer), &omap2_gp_timer_irq); -- omap_dm_timer_set_int_enable(gptimer, OMAP_TIMER_INT_OVERFLOW); -+ omap_dm_timer_stop(gptimer); -+ /* omap_dm_timer_set_load(gptimer, 0, 0);*/ -+ omap_dm_timer_set_match(gptimer, 1, GPTIMER_MATCH_VAL); -+ omap_dm_timer_set_int_enable(gptimer, OMAP_TIMER_INT_MATCH); - - clockevent_gpt.mult = div_sc(tick_rate, NSEC_PER_SEC, - clockevent_gpt.shift); - clockevent_gpt.max_delta_ns = -- clockevent_delta2ns(0xffffffff, &clockevent_gpt); -+ clockevent_delta2ns(GPTIMER_MATCH_VAL, &clockevent_gpt); - clockevent_gpt.min_delta_ns = - clockevent_delta2ns(1, &clockevent_gpt); - diff --git a/packages/linux/linux-omap2-git/beagleboard/03-gptimer_match_plus_ovf b/packages/linux/linux-omap2-git/beagleboard/03-gptimer_match_plus_ovf deleted file mode 100644 index 3de6e05042..0000000000 --- a/packages/linux/linux-omap2-git/beagleboard/03-gptimer_match_plus_ovf +++ /dev/null @@ -1,94 +0,0 @@ -OMAP2/3 system tick GPTIMER: use overflow interrupts to detect missing match interrupts - -From: Paul Walmsley - -GPTIMER1 on some OMAP3 chips occasionally misses match conditions -between the timer counter and the target register value, and does not -interrupt to the MPU. This patch adds another line of defense by -setting the timer to generate an overflow interrupt 0.5 seconds after the -timer passes the original comparison value. - -If interrupts are masked for a long period of time, one would expect -both a match and an overflow interrupt to be logged. This is considered -a normal condition. However, if only an overflow interrupt is logged, -this is considered evidence of a hardware bug and the kernel will issue -a warning. - -This workaround is unlikely to be 100% effective, since GPTIMER1 has -also been observed to lose overflow interrupts occasionally. It is -hoped that the probability of losing both will be significantly lower -than the probability of losing either one. ---- - - arch/arm/mach-omap2/timer-gp.c | 36 ++++++++++++++++++++++++++++++++---- - 1 files changed, 32 insertions(+), 4 deletions(-) - -diff --git a/arch/arm/mach-omap2/timer-gp.c b/arch/arm/mach-omap2/timer-gp.c -index 51996ba..ce5c2b4 100644 ---- a/arch/arm/mach-omap2/timer-gp.c -+++ b/arch/arm/mach-omap2/timer-gp.c -@@ -36,17 +36,43 @@ - #include - #include - --#define GPTIMER_MATCH_VAL 0xffff0000 -+/* -+ * The number of timer ticks to delay will be subtracted from -+ * GPTIMER_MATCH_VAL before loading into the timer. So GPTIMER_MATCH_VAL -+ * constrains the longest delay that can be generated with the timer. -+ * Since the current code uses overflow interrupts as protection against -+ * missed comparison interrupts, this value should also be sufficiently -+ * large such that there is not an excessively long delay between ticks -+ * if the comparison interrupt fails to arrive. The 0xfffff800 value -+ * below results in a half-second delay in such a case when using -+ * the 32kHz timer as source. -+ */ -+#define GPTIMER_MATCH_VAL (0xffffffff - (32768/2)) - - static struct omap_dm_timer *gptimer; - static struct clock_event_device clockevent_gpt; - -+static u32 last_load; -+ - static irqreturn_t omap2_gp_timer_interrupt(int irq, void *dev_id) - { - struct omap_dm_timer *gpt = (struct omap_dm_timer *)dev_id; - struct clock_event_device *evt = &clockevent_gpt; -- -- omap_dm_timer_write_status(gpt, OMAP_TIMER_INT_MATCH); -+ u32 v; -+ -+ v = omap_dm_timer_read_status(gpt); -+ if ((v & OMAP_TIMER_INT_OVERFLOW) && !(v & OMAP_TIMER_INT_MATCH)) { -+ /* -+ * Should never happen. Current belief is that this is -+ * due to a hardware bug in the GPTIMER block on some -+ * OMAP3 revisions. -+ */ -+ pr_err("*** GPTIMER missed match interrupt! last load: %08x\n", -+ last_load); -+ WARN_ON(1); -+ } -+ -+ omap_dm_timer_write_status(gpt, v); - - evt->event_handler(evt); - return IRQ_HANDLED; -@@ -61,6 +87,7 @@ static struct irqaction omap2_gp_timer_irq = { - static int omap2_gp_timer_set_next_event(unsigned long cycles, - struct clock_event_device *evt) - { -+ last_load = GPTIMER_MATCH_VAL - cycles; - omap_dm_timer_set_load_start(gptimer, 0, GPTIMER_MATCH_VAL - cycles); - - return 0; -@@ -99,7 +126,8 @@ static void __init omap2_gp_clockevent_init(void) - omap_dm_timer_stop(gptimer); - /* omap_dm_timer_set_load(gptimer, 0, 0);*/ - omap_dm_timer_set_match(gptimer, 1, GPTIMER_MATCH_VAL); -- omap_dm_timer_set_int_enable(gptimer, OMAP_TIMER_INT_MATCH); -+ omap_dm_timer_set_int_enable(gptimer, OMAP_TIMER_INT_MATCH | -+ OMAP_TIMER_INT_OVERFLOW); - - clockevent_gpt.mult = div_sc(tick_rate, NSEC_PER_SEC, - clockevent_gpt.shift); diff --git a/packages/linux/linux-omap2-git/beagleboard/04-gptimer_add_debug_to_sysrq_q b/packages/linux/linux-omap2-git/beagleboard/04-gptimer_add_debug_to_sysrq_q deleted file mode 100644 index aa9f09811a..0000000000 --- a/packages/linux/linux-omap2-git/beagleboard/04-gptimer_add_debug_to_sysrq_q +++ /dev/null @@ -1,110 +0,0 @@ -Add extra debug for the q_d_w_o() when work fn is already active. - -From: Paul Walmsley - - ---- - - arch/arm/mach-omap2/timer-gp.c | 3 ++- - arch/arm/plat-omap/dmtimer.c | 20 ++++++++++++++++++++ - include/asm-arm/arch-omap/dmtimer.h | 1 + - kernel/time/timer_list.c | 8 ++++++++ - 4 files changed, 31 insertions(+), 1 deletions(-) - -diff --git a/arch/arm/mach-omap2/timer-gp.c b/arch/arm/mach-omap2/timer-gp.c -index ce5c2b4..e3ed368 100644 ---- a/arch/arm/mach-omap2/timer-gp.c -+++ b/arch/arm/mach-omap2/timer-gp.c -@@ -50,6 +50,7 @@ - #define GPTIMER_MATCH_VAL (0xffffffff - (32768/2)) - - static struct omap_dm_timer *gptimer; -+struct omap_dm_timer *gptimer_pub; - static struct clock_event_device clockevent_gpt; - - static u32 last_load; -@@ -111,7 +112,7 @@ static void __init omap2_gp_clockevent_init(void) - { - u32 tick_rate; - -- gptimer = omap_dm_timer_request_specific(1); -+ gptimer = gptimer_pub = omap_dm_timer_request_specific(1); - BUG_ON(gptimer == NULL); - - #if defined(CONFIG_OMAP_32K_TIMER) -diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c -index e38a11e..b10f8ac 100644 ---- a/arch/arm/plat-omap/dmtimer.c -+++ b/arch/arm/plat-omap/dmtimer.c -@@ -614,6 +614,26 @@ void omap_dm_timer_set_int_enable(struct omap_dm_timer *timer, - omap_dm_timer_write_reg(timer, OMAP_TIMER_WAKEUP_EN_REG, value); - } - -+void omap_dm_timer_dump_int_enable(struct omap_dm_timer *timer) -+{ -+ u32 l; -+ l = omap_dm_timer_read_reg(timer, OMAP_TIMER_COUNTER_REG); -+ pr_err("GPT TCRR: %08x\n", l); -+ l = omap_dm_timer_read_reg(timer, OMAP_TIMER_MATCH_REG); -+ pr_err("GPT TMAT: %08x\n", l); -+ l = omap_dm_timer_read_reg(timer, OMAP_TIMER_STAT_REG); -+ pr_err("GPT TISR: %08x\n", l); -+ l = omap_dm_timer_read_reg(timer, OMAP_TIMER_INT_EN_REG); -+ pr_err("GPT TIER: %08x\n", l); -+ l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG); -+ pr_err("GPT TCLR: %08x\n", l); -+ l = omap_dm_timer_read_reg(timer, OMAP_TIMER_TICK_INT_MASK_SET_REG); -+ pr_err("GPT TOCR: %08x\n", l); -+ l = omap_dm_timer_read_reg(timer, OMAP_TIMER_TICK_INT_MASK_COUNT_REG); -+ pr_err("GPT TOWR: %08x\n", l); -+} -+ -+ - unsigned int omap_dm_timer_read_status(struct omap_dm_timer *timer) - { - unsigned int l; -diff --git a/include/asm-arm/arch-omap/dmtimer.h b/include/asm-arm/arch-omap/dmtimer.h -index 02b29e8..a8123e9 100644 ---- a/include/asm-arm/arch-omap/dmtimer.h -+++ b/include/asm-arm/arch-omap/dmtimer.h -@@ -73,6 +73,7 @@ void omap_dm_timer_set_prescaler(struct omap_dm_timer *timer, int prescaler); - - void omap_dm_timer_set_int_enable(struct omap_dm_timer *timer, unsigned int value); - -+void omap_dm_timer_dump_int_enable(struct omap_dm_timer *timer); - unsigned int omap_dm_timer_read_status(struct omap_dm_timer *timer); - void omap_dm_timer_write_status(struct omap_dm_timer *timer, unsigned int value); - unsigned int omap_dm_timer_read_counter(struct omap_dm_timer *timer); -diff --git a/kernel/time/timer_list.c b/kernel/time/timer_list.c -index a40e20f..452eab7 100644 ---- a/kernel/time/timer_list.c -+++ b/kernel/time/timer_list.c -@@ -18,6 +18,8 @@ - #include - #include - -+#include -+ - #include - - typedef void (*print_fn_t)(struct seq_file *m, unsigned int *classes); -@@ -239,6 +241,8 @@ static void timer_list_show_tickdevices(struct seq_file *m) - static void timer_list_show_tickdevices(struct seq_file *m) { } - #endif - -+extern struct omap_dm_timer *gptimer_pub; -+ - static int timer_list_show(struct seq_file *m, void *v) - { - u64 now = ktime_to_ns(ktime_get()); -@@ -254,6 +258,10 @@ static int timer_list_show(struct seq_file *m, void *v) - SEQ_printf(m, "\n"); - timer_list_show_tickdevices(m); - -+ SEQ_printf(m, "\n"); -+ -+ omap_dm_timer_dump_int_enable(gptimer_pub); -+ - return 0; - } - diff --git a/packages/linux/linux-omap2-git/beagleboard/defconfig b/packages/linux/linux-omap2-git/beagleboard/defconfig index d01d473ed5..c07d0ab5e2 100644 --- a/packages/linux/linux-omap2-git/beagleboard/defconfig +++ b/packages/linux/linux-omap2-git/beagleboard/defconfig @@ -187,8 +187,8 @@ CONFIG_OMAP_BOOT_REASON=y CONFIG_OMAP_MCBSP=y # CONFIG_OMAP_MMU_FWK is not set # CONFIG_OMAP_MBOX_FWK is not set -CONFIG_OMAP_MPU_TIMER=y -# CONFIG_OMAP_32K_TIMER is not set +# CONFIG_OMAP_MPU_TIMER is not set +CONFIG_OMAP_32K_TIMER=y CONFIG_OMAP_DM_TIMER=y # CONFIG_OMAP_LL_DEBUG_UART1 is not set # CONFIG_OMAP_LL_DEBUG_UART2 is not set @@ -203,6 +203,7 @@ CONFIG_ARCH_OMAP3430=y # CONFIG_MACH_OMAP_3430SDP is not set # CONFIG_MACH_OMAP3EVM is not set CONFIG_MACH_OMAP3_BEAGLE=y +CONFIG_OMAP_TICK_GPTIMER=12 # # Boot options diff --git a/packages/linux/linux-omap2_git.bb b/packages/linux/linux-omap2_git.bb index 4008102f09..5749d4fc0c 100644 --- a/packages/linux/linux-omap2_git.bb +++ b/packages/linux/linux-omap2_git.bb @@ -6,9 +6,9 @@ SRCREV = "d6daf8d8cc5ccf90247def5551ee9c3e8555e848" PV = "2.6.26" #PV = "2.6.26+2.6.27-rc1+${PR}+git${SRCREV}" -PR = "r58" +PR = "r59" -SRC_URI = "git://source.mvista.com/git/linux-omap-2.6.git;protocol=git \ +SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6.git;protocol=git \ file://defconfig" SRC_URI_append_beagleboard = " file://no-harry-potter.diff;patch=1 \ @@ -35,10 +35,7 @@ SRC_URI_append_beagleboard = " file://no-harry-potter.diff;patch=1 \ file://mru-clocks3.diff;patch=1 \ file://4bitmmc.diff;patch=1 \ file://no-cortex-deadlock.patch;patch=1 \ - file://01-gptimer_clear_isrs_on_init;patch=1 \ - file://02-gptimer_use_match_for_tick;patch=1 \ - file://03-gptimer_match_plus_ovf;patch=1 \ - file://04-gptimer_add_debug_to_sysrq_q;patch=1 \ + file://01-make_tick_gptimer_configurable;patch=1 \ file://read_die_ids.patch;patch=1 \ " -- cgit v1.2.3 From 5cf49c96a744508ff2dcbb49c86f709096a8f39e Mon Sep 17 00:00:00 2001 From: Koen Kooi Date: Mon, 11 Aug 2008 14:39:50 +0000 Subject: linux-omap2 git: check in WIP cpufreq patches for beagleboard --- .../beagleboard/01-beagle-cpufreq.diff | 178 ++++ .../beagleboard/01-omap3-cpufreq.eml | 319 ++++++++ .../linux-omap2-git/beagleboard/01-omappm-srf.eml | 513 ++++++++++++ .../beagleboard/01-postrate-notifier.eml | 392 +++++++++ .../beagleboard/02-beagle_use_gptimer12 | 38 + .../beagleboard/02-omappm-mpu-latency-modeling.eml | 245 ++++++ .../beagleboard/02-postrate-notifier.eml | 186 +++++ .../beagleboard/03-omappm-omap3srf.eml | 167 ++++ .../beagleboard/04-omappm-srf-noop.eml | 497 ++++++++++++ .../beagleboard/05-omappm-virtualclocks.eml | 456 +++++++++++ .../06-omappm-opp-resource-modeling.eml | 228 ++++++ .../beagleboard/07-omappm-srf-updates.eml | 173 ++++ .../beagleboard/08-omappm-voltagescaling.eml | 96 +++ .../beagleboard/09-omappm-vdd2-scaling.eml | 102 +++ .../beagleboard/10-omappm-off-mode.eml | 35 + .../linux/linux-omap2-git/beagleboard/defconfig | 18 +- .../linux-omap2-git/beagleboard/omap23-pm-noop.eml | 894 +++++++++++++++++++++ packages/linux/linux-omap2_git.bb | 17 +- 18 files changed, 4546 insertions(+), 8 deletions(-) create mode 100644 packages/linux/linux-omap2-git/beagleboard/01-beagle-cpufreq.diff create mode 100644 packages/linux/linux-omap2-git/beagleboard/01-omap3-cpufreq.eml create mode 100644 packages/linux/linux-omap2-git/beagleboard/01-omappm-srf.eml create mode 100644 packages/linux/linux-omap2-git/beagleboard/01-postrate-notifier.eml create mode 100644 packages/linux/linux-omap2-git/beagleboard/02-beagle_use_gptimer12 create mode 100644 packages/linux/linux-omap2-git/beagleboard/02-omappm-mpu-latency-modeling.eml create mode 100644 packages/linux/linux-omap2-git/beagleboard/02-postrate-notifier.eml create mode 100644 packages/linux/linux-omap2-git/beagleboard/03-omappm-omap3srf.eml create mode 100644 packages/linux/linux-omap2-git/beagleboard/04-omappm-srf-noop.eml create mode 100644 packages/linux/linux-omap2-git/beagleboard/05-omappm-virtualclocks.eml create mode 100644 packages/linux/linux-omap2-git/beagleboard/06-omappm-opp-resource-modeling.eml create mode 100644 packages/linux/linux-omap2-git/beagleboard/07-omappm-srf-updates.eml create mode 100644 packages/linux/linux-omap2-git/beagleboard/08-omappm-voltagescaling.eml create mode 100644 packages/linux/linux-omap2-git/beagleboard/09-omappm-vdd2-scaling.eml create mode 100644 packages/linux/linux-omap2-git/beagleboard/10-omappm-off-mode.eml create mode 100644 packages/linux/linux-omap2-git/beagleboard/omap23-pm-noop.eml (limited to 'packages/linux') diff --git a/packages/linux/linux-omap2-git/beagleboard/01-beagle-cpufreq.diff b/packages/linux/linux-omap2-git/beagleboard/01-beagle-cpufreq.diff new file mode 100644 index 0000000000..5343f3276b --- /dev/null +++ b/packages/linux/linux-omap2-git/beagleboard/01-beagle-cpufreq.diff @@ -0,0 +1,178 @@ +--- /tmp/board-omap3beagle.h 2008-08-11 15:40:17.000000000 +0200 ++++ git/include/asm-arm/arch-omap/board-omap3beagle.h 2008-08-11 15:41:32.433198000 +0200 +@@ -29,5 +29,41 @@ + #ifndef __ASM_ARCH_OMAP3_BEAGLE_H + #define __ASM_ARCH_OMAP3_BEAGLE_H + ++/* MPU speeds */ ++#define S600M 600000000 ++#define S550M 550000000 ++#define S500M 500000000 ++#define S250M 250000000 ++#define S125M 125000000 ++ ++/* IVA speeds */ ++#define S430M 430000000 ++#define S400M 400000000 ++#define S360M 360000000 ++#define S180M 180000000 ++#define S90M 90000000 ++ ++/* L3 speeds */ ++#define S83M 83000000 ++#define S166M 166000000 ++ ++/* VDD1 OPPS */ ++#define VDD1_OPP1 0x1 ++#define VDD1_OPP2 0x2 ++#define VDD1_OPP3 0x3 ++#define VDD1_OPP4 0x4 ++#define VDD1_OPP5 0x5 ++ ++/* VDD2 OPPS */ ++#define VDD2_OPP1 0x1 ++#define VDD2_OPP2 0x2 ++#define VDD2_OPP3 0x3 ++ ++#define MIN_VDD1_OPP VDD1_OPP1 ++#define MAX_VDD1_OPP VDD1_OPP5 ++#define MIN_VDD2_OPP VDD2_OPP1 ++#define MAX_VDD2_OPP VDD2_OPP3 ++ ++ + #endif /* __ASM_ARCH_OMAP3_BEAGLE_H */ + +--- /tmp/resource34xx.c 2008-08-11 16:11:28.000000000 +0200 ++++ git/arch/arm/mach-omap2/resource34xx.c 2008-08-11 16:20:18.803198000 +0200 +@@ -173,7 +173,7 @@ + + int set_opp(struct shared_resource *resp, u32 target_level) + { +-#ifdef CONFIG_MACH_OMAP_3430SDP ++#if defined(CONFIG_MACH_OMAP_3430SDP) || defined(CONFIG_MACH_OMAP3_BEAGLE) + unsigned long mpu_freq, l3_freq, tput; + int ind; + struct bus_throughput_db *tput_db; +@@ -248,7 +248,7 @@ + */ + void init_freq(struct shared_resource *resp) + { +-#ifdef CONFIG_MACH_OMAP_3430SDP ++#if defined(CONFIG_MACH_OMAP_3430SDP) || defined(CONFIG_MACH_OMAP3_BEAGLE) + char *linked_res_name; + resp->no_of_users = 0; + +@@ -269,7 +269,7 @@ + + int set_freq(struct shared_resource *resp, u32 target_level) + { +-#ifdef CONFIG_MACH_OMAP_3430SDP ++#if defined(CONFIG_MACH_OMAP_3430SDP) || defined(CONFIG_MACH_OMAP3_BEAGLE) + unsigned int vdd1_opp; + + if (strcmp(resp->name, "mpu_freq") == 0) +--- /tmp/clock34xx.c 2008-08-11 15:57:48.000000000 +0200 ++++ git/arch/arm/mach-omap2/clock34xx.c 2008-08-11 16:22:43.093198000 +0200 +@@ -773,7 +773,7 @@ + dpll2_clk = clk_get(NULL, "dpll2_ck"); + dpll3_clk = clk_get(NULL, "dpll3_ck"); + +-#ifdef CONFIG_MACH_OMAP_3430SDP ++#if defined(CONFIG_MACH_OMAP_3430SDP) || defined(CONFIG_MACH_OMAP3_BEAGLE) + mpu_speed = dpll1_clk->rate; + prcm_vdd = vdd1_rate_table + MAX_VDD1_OPP; + for (; prcm_vdd->speed; prcm_vdd--) { +@@ -836,7 +836,7 @@ + return (prcm_config+1)->opp; + } + +-#ifdef CONFIG_MACH_OMAP_3430SDP ++#if defined(CONFIG_MACH_OMAP_3430SDP) || defined(CONFIG_MACH_OMAP3_BEAGLE) + static void omap3_table_recalc(struct clk *clk) + { + if ((clk != &virt_vdd1_prcm_set) && (clk != &virt_vdd2_prcm_set)) +--- /tmp/board-omap3beagle.c 2008-08-11 15:54:04.000000000 +0200 ++++ git/arch/arm/mach-omap2/board-omap3beagle.c 2008-08-11 16:25:11.333198000 +0200 +@@ -39,9 +39,62 @@ + #include + #include + ++#include ++ + #define GPMC_CS0_BASE 0x60 + #define GPMC_CS_SIZE 0x30 + ++struct vdd_prcm_config vdd1_rate_table[] = { ++ {0, 0, 0}, ++ /*OPP1*/ ++ {S125M, VDD1_OPP1, 0}, ++ /*OPP2*/ ++ {S250M, VDD1_OPP2, 0}, ++ /*OPP3*/ ++ {S500M, VDD1_OPP3, 0}, ++ /*OPP4*/ ++ {S550M, VDD1_OPP4, 0}, ++ /*OPP5*/ ++ {S600M, VDD1_OPP5, 0}, ++}; ++ ++struct vdd_prcm_config vdd2_rate_table[] = { ++ {0, 0, 0}, ++ /*OPP1*/ ++ {0, VDD2_OPP1, 0}, ++ /*OPP2*/ ++ {S83M, VDD2_OPP2, 0}, ++ /*OPP3*/ ++ {S166M, VDD2_OPP3, 0}, ++}; ++ ++struct vdd_prcm_config iva2_rate_table[] = { ++ {0, 0, 0}, ++ /*OPP1*/ ++ {S90M, VDD1_OPP1, 0}, ++ /*OPP2*/ ++ {S180M, VDD1_OPP2, 0}, ++ /*OPP3*/ ++ {S360M, VDD1_OPP3, 0}, ++ /*OPP4*/ ++ {S400M, VDD1_OPP4, 0}, ++ /*OPP5*/ ++ {S430M, VDD1_OPP5, 0}, ++}; ++ ++u8 vdd1_volts[MAX_VDD1_OPP] = { ++ /* Vsel corresponding to 0.9V (OPP1), 1.00V (OPP2), ++ * 1.20V (OPP3), 1.27V (OPP4), 1.35 (OPP5) ++ */ ++ 0x18, 0x20, 0x30, 0x36, 0x3C ++}; ++ ++u8 vdd2_volts[MAX_VDD2_OPP] = { ++ /* Vsel corresponding to 0.9V (OPP1), 1.00V (OPP2), 1.15 (OPP3) */ ++ 0x18, 0x20, 0x2C ++}; ++ ++ + static struct mtd_partition omap3beagle_nand_partitions[] = { + /* All the partition sizes are listed in terms of NAND block size */ + { +--- /tmp/cpu-omap.c 2008-08-11 15:43:01.000000000 +0200 ++++ git/arch/arm/plat-omap/cpu-omap.c 2008-08-11 16:31:24.943198000 +0200 +@@ -47,7 +47,7 @@ + + static struct clk *mpu_clk; + +-#ifdef CONFIG_MACH_OMAP_3430SDP ++#if defined(CONFIG_MACH_OMAP_3430SDP) || defined(CONFIG_MACH_OMAP3_BEAGLE) + extern struct vdd_prcm_config vdd1_rate_table[]; + extern struct vdd_prcm_config vdd2_rate_table[]; + extern struct vdd_prcm_config iva2_rate_table[]; +@@ -127,7 +127,7 @@ + ret = clk_set_rate(mpu_clk, freqs.new * 1000); + cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); + #elif defined(CONFIG_ARCH_OMAP3) && !defined(CONFIG_OMAP_PM_NONE)\ +- && defined(CONFIG_MACH_OMAP_3430SDP) ++ && (defined(CONFIG_MACH_OMAP_3430SDP) || defined(CONFIG_MACH_OMAP3_BEAGLE)) + { + int ind; + for (ind = 1; ind <= MAX_VDD1_OPP; ind++) { diff --git a/packages/linux/linux-omap2-git/beagleboard/01-omap3-cpufreq.eml b/packages/linux/linux-omap2-git/beagleboard/01-omap3-cpufreq.eml new file mode 100644 index 0000000000..b45a81edce --- /dev/null +++ b/packages/linux/linux-omap2-git/beagleboard/01-omap3-cpufreq.eml @@ -0,0 +1,319 @@ +CPUFreq driver for OMAP3 + +Signed-off-by: Rajendra Nayak +--- + arch/arm/configs/omap_3430sdp_defconfig | 19 +++++++ + arch/arm/mach-omap2/clock34xx.c | 42 ++++++++++++++++- + arch/arm/mach-omap2/resource34xx.c | 6 -- + arch/arm/plat-omap/cpu-omap.c | 78 ++++++++++++++++++++++++++++++-- + drivers/cpufreq/cpufreq.c | 2 + 5 files changed, 136 insertions(+), 11 deletions(-) + +Index: linux-omap-2.6/arch/arm/mach-omap2/clock34xx.c +=================================================================== +--- linux-omap-2.6.orig/arch/arm/mach-omap2/clock34xx.c 2008-08-11 +17:21:57.000000000 +0530 ++++ linux-omap-2.6/arch/arm/mach-omap2/clock34xx.c 2008-08-11 +17:36:53.000000000 +0530 +@@ -31,6 +31,7 @@ + #include + #include + #include ++#include + + #include + #include "clock.h" +@@ -637,6 +638,35 @@ static void omap3_clkoutx2_recalc(struct + */ + #if defined(CONFIG_ARCH_OMAP3) + ++#ifdef CONFIG_CPU_FREQ ++static struct cpufreq_frequency_table freq_table[MAX_VDD1_OPP+1]; ++ ++void omap2_clk_init_cpufreq_table(struct cpufreq_frequency_table **table) ++{ ++ struct vdd_prcm_config *prcm; ++ int i = 0; ++ ++ prcm = vdd1_rate_table + MAX_VDD1_OPP; ++ for (; prcm->speed; prcm--) { ++ freq_table[i].index = i; ++ freq_table[i].frequency = prcm->speed / 1000; ++ i++; ++ } ++ ++ if (i == 0) { ++ printk(KERN_WARNING "%s: failed to initialize frequency \ ++ table\n", ++ __func__); ++ return; ++ } ++ ++ freq_table[i].index = i; ++ freq_table[i].frequency = CPUFREQ_TABLE_END; ++ ++ *table = &freq_table[0]; ++} ++#endif ++ + static struct clk_functions omap2_clk_functions = { + .clk_enable = omap2_clk_enable, + .clk_disable = omap2_clk_disable, +@@ -644,6 +674,9 @@ static struct clk_functions omap2_clk_fu + .clk_set_rate = omap2_clk_set_rate, + .clk_set_parent = omap2_clk_set_parent, + .clk_disable_unused = omap2_clk_disable_unused, ++#ifdef CONFIG_CPU_FREQ ++ .clk_init_cpufreq_table = omap2_clk_init_cpufreq_table, ++#endif + }; + + /* +@@ -793,12 +826,11 @@ inline unsigned int get_opp(struct vdd_p + + if (prcm_config->speed <= freq) + return prcm_config->opp; /* Return the Highest OPP */ +- for (; prcm_config->speed; prcm_config--) { ++ for (; prcm_config->speed; prcm_config--) + if (prcm_config->speed < freq) + return (prcm_config+1)->opp; + else if (prcm_config->speed == freq) + return prcm_config->opp; +- } + /* Return the least OPP */ + return (prcm_config+1)->opp; + } +@@ -878,6 +910,10 @@ static int omap3_select_table_rate(struc + clk_set_rate(dpll1_clk, prcm_vdd->speed); + clk_set_rate(dpll2_clk, iva2_rate_table[index].speed); + curr_vdd1_prcm_set = prcm_vdd; ++ omap2_clksel_recalc(&mpu_ck); ++ propagate_rate(&mpu_ck); ++ omap2_clksel_recalc(&iva2_ck); ++ propagate_rate(&iva2_ck); + #ifndef CONFIG_CPU_FREQ + /*Update loops_per_jiffy if processor speed is being changed*/ + loops_per_jiffy = compute_lpj(loops_per_jiffy, +@@ -886,6 +922,8 @@ static int omap3_select_table_rate(struc + } else { + clk_set_rate(dpll3_clk, prcm_vdd->speed); + curr_vdd2_prcm_set = prcm_vdd; ++ omap2_clksel_recalc(&core_ck); ++ propagate_rate(&core_ck); + } + return 0; + } +Index: linux-omap-2.6/arch/arm/mach-omap2/resource34xx.c +=================================================================== +--- linux-omap-2.6.orig/arch/arm/mach-omap2/resource34xx.c 2008-08-11 +17:36:52.000000000 +0530 ++++ linux-omap-2.6/arch/arm/mach-omap2/resource34xx.c 2008-08-11 +17:36:53.000000000 +0530 +@@ -278,11 +278,7 @@ int set_freq(struct shared_resource *res + else if (strcmp(resp->name, "dsp_freq") == 0) + vdd1_opp = get_opp(iva2_rate_table + MAX_VDD1_OPP, + target_level); +- +- if (vdd1_opp == MIN_VDD1_OPP) +- resource_release("vdd1_opp", &dummy_srf_dev); +- else +- resource_request("vdd1_opp", &dummy_srf_dev, vdd1_opp); ++ resource_request("vdd1_opp", &dummy_srf_dev, vdd1_opp); + + resp->curr_level = target_level; + #endif +Index: linux-omap-2.6/arch/arm/plat-omap/cpu-omap.c +=================================================================== +--- linux-omap-2.6.orig/arch/arm/plat-omap/cpu-omap.c 2008-08-11 +17:21:57.000000000 +0530 ++++ linux-omap-2.6/arch/arm/plat-omap/cpu-omap.c 2008-08-11 17:36:53.000000000 ++0530 +@@ -8,6 +8,10 @@ + * + * Based on cpu-sa1110.c, Copyright (C) 2001 Russell King + * ++ * Copyright (C) 2007-2008 Texas Instruments, Inc. ++ * Updated to support OMAP3 ++ * Rajendra Nayak ++ * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. +@@ -25,6 +29,9 @@ + #include + #include + #include ++#if defined(CONFIG_ARCH_OMAP3) && !defined(CONFIG_OMAP_PM_NONE) ++#include ++#endif + + #define VERY_HI_RATE 900000000 + +@@ -32,12 +39,34 @@ static struct cpufreq_frequency_table *f + + #ifdef CONFIG_ARCH_OMAP1 + #define MPU_CLK "mpu" ++#elif CONFIG_ARCH_OMAP3 ++#define MPU_CLK "virt_vdd1_prcm_set" + #else + #define MPU_CLK "virt_prcm_set" + #endif + + static struct clk *mpu_clk; + ++#ifdef CONFIG_MACH_OMAP_3430SDP ++extern struct vdd_prcm_config vdd1_rate_table[]; ++extern struct vdd_prcm_config vdd2_rate_table[]; ++extern struct vdd_prcm_config iva2_rate_table[]; ++#endif ++ ++#if defined(CONFIG_ARCH_OMAP3) && !defined(CONFIG_OMAP_PM_NONE) ++int cpufreq_pre_func(struct notifier_block *n, unsigned long event, void *ptr); ++int cpufreq_post_func(struct notifier_block *n, unsigned long event, void *ptr); ++static struct notifier_block cpufreq_pre = { ++ cpufreq_pre_func, ++ NULL, ++}; ++ ++static struct notifier_block cpufreq_post = { ++ cpufreq_post_func, ++ NULL, ++}; ++#endif ++ + /* TODO: Add support for SDRAM timing changes */ + + int omap_verify_speed(struct cpufreq_policy *policy) +@@ -89,7 +118,7 @@ static int omap_target(struct cpufreq_po + + if (freqs.old == freqs.new) + return ret; +- ++#ifdef CONFIG_ARCH_OMAP1 + cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); + #ifdef CONFIG_CPU_FREQ_DEBUG + printk(KERN_DEBUG "cpufreq-omap: transition: %u --> %u\n", +@@ -97,10 +126,50 @@ static int omap_target(struct cpufreq_po + #endif + ret = clk_set_rate(mpu_clk, freqs.new * 1000); + cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); +- ++#elif defined(CONFIG_ARCH_OMAP3) && !defined(CONFIG_OMAP_PM_NONE)\ ++ && defined(CONFIG_MACH_OMAP_3430SDP) ++ { ++ int ind; ++ for (ind = 1; ind <= MAX_VDD1_OPP; ind++) { ++ if (vdd1_rate_table[ind].speed/1000 >= freqs.new) { ++ omap_pm_cpu_set_freq ++ (vdd1_rate_table[ind].speed); ++ break; ++ } ++ } ++ } ++#endif + return ret; + } + ++#if defined(CONFIG_ARCH_OMAP3) && !defined(CONFIG_OMAP_PM_NONE) ++static struct cpufreq_freqs freqs_notify; ++int cpufreq_pre_func(struct notifier_block *n, unsigned long event, void *ptr) ++{ ++ struct clk_notifier_data *cnd; ++ ++ cnd = (struct clk_notifier_data *)ptr; ++ freqs_notify.old = cnd->old_rate/1000; ++ freqs_notify.new = cnd->new_rate/1000; ++ /* HACK: The clk_notify_post_rate_chg currently ++ * returns a zero for old_rate at bootup ++ */ ++ if (freqs_notify.old == 0) ++ freqs_notify.old = 500000; ++ cpufreq_notify_transition(&freqs_notify, CPUFREQ_PRECHANGE); ++ return 0; ++} ++ ++int cpufreq_post_func(struct notifier_block *n, unsigned long event, void *ptr) ++{ ++ struct clk_notifier_data *cnd; ++ ++ cnd = (struct clk_notifier_data *)ptr; ++ cpufreq_notify_transition(&freqs_notify, CPUFREQ_POSTCHANGE); ++ return 0; ++} ++#endif ++ + static int __init omap_cpu_init(struct cpufreq_policy *policy) + { + int result = 0; +@@ -128,7 +197,10 @@ static int __init omap_cpu_init(struct c + + /* FIXME: what's the actual transition time? */ + policy->cpuinfo.transition_latency = 10 * 1000 * 1000; +- ++#if defined(CONFIG_ARCH_OMAP3) && !defined(CONFIG_OMAP_PM_NONE) ++ clk_notifier_register(mpu_clk, &cpufreq_pre); ++ clk_notifier_register(mpu_clk, &cpufreq_post); ++#endif + return 0; + } + +Index: linux-omap-2.6/drivers/cpufreq/cpufreq.c +=================================================================== +--- linux-omap-2.6.orig/drivers/cpufreq/cpufreq.c 2008-08-11 17:21:57.000000000 ++0530 ++++ linux-omap-2.6/drivers/cpufreq/cpufreq.c 2008-08-11 17:36:53.000000000 +0530 +@@ -321,7 +321,9 @@ void cpufreq_notify_transition(struct cp + { + struct cpufreq_policy *policy; + ++#if 0 /*This causes an issue if clk_notify_post_rate_chg is used*/ + BUG_ON(irqs_disabled()); ++#endif + + freqs->flags = cpufreq_driver->flags; + dprintk("notification %u of frequency transition to %u kHz\n", +Index: linux-omap-2.6/arch/arm/configs/omap_3430sdp_defconfig +=================================================================== +--- linux-omap-2.6.orig/arch/arm/configs/omap_3430sdp_defconfig 2008-08-11 +17:36:43.000000000 +0530 ++++ linux-omap-2.6/arch/arm/configs/omap_3430sdp_defconfig 2008-08-11 +17:37:33.000000000 +0530 +@@ -193,6 +193,9 @@ CONFIG_OMAP_LL_DEBUG_UART1=y + # CONFIG_OMAP_LL_DEBUG_UART2 is not set + # CONFIG_OMAP_LL_DEBUG_UART3 is not set + CONFIG_OMAP_SERIAL_WAKE=y ++# CONFIG_OMAP_PM_NONE is not set ++# CONFIG_OMAP_PM_NOOP is not set ++CONFIG_OMAP_PM_SRF=y + CONFIG_ARCH_OMAP34XX=y + CONFIG_ARCH_OMAP3430=y + +@@ -288,7 +291,21 @@ CONFIG_CMDLINE="root=/dev/nfs nfsroot=19 + # + # CPU Frequency scaling + # +-# CONFIG_CPU_FREQ is not set ++CONFIG_CPU_FREQ=y ++CONFIG_CPU_FREQ_TABLE=y ++# CONFIG_CPU_FREQ_DEBUG is not set ++CONFIG_CPU_FREQ_STAT=y ++CONFIG_CPU_FREQ_STAT_DETAILS=y ++CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y ++# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set ++# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set ++# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set ++# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set ++CONFIG_CPU_FREQ_GOV_PERFORMANCE=y ++# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set ++# CONFIG_CPU_FREQ_GOV_USERSPACE is not set ++CONFIG_CPU_FREQ_GOV_ONDEMAND=y ++# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set + + # + # Floating point emulation + + +-- +To unsubscribe from this list: send the line "unsubscribe linux-omap" in +the body of a message to majordomo@vger.kernel.org +More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/packages/linux/linux-omap2-git/beagleboard/01-omappm-srf.eml b/packages/linux/linux-omap2-git/beagleboard/01-omappm-srf.eml new file mode 100644 index 0000000000..8b8b183808 --- /dev/null +++ b/packages/linux/linux-omap2-git/beagleboard/01-omappm-srf.eml @@ -0,0 +1,513 @@ +Adds Generic Shared Resource Framework structures and API's + +Signed-off-by: Rajendra Nayak +--- + arch/arm/plat-omap/resource.c | 389 +++++++++++++++++++++++++++++++++++ + include/asm-arm/arch-omap/resource.h | 97 ++++++++ + 2 files changed, 486 insertions(+) + +Index: linux-omap-2.6/arch/arm/plat-omap/resource.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-omap-2.6/arch/arm/plat-omap/resource.c 2008-08-07 15:06:58.000000000 ++0530 +@@ -0,0 +1,389 @@ ++/* ++ * linux/arch/arm/plat-omap/resource.c ++ * Shared Resource Framework API implementation ++ * ++ * Copyright (C) 2007-2008 Texas Instruments, Inc. ++ * Written by Rajendra Nayak ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR ++ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED ++ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. ++ * History: ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++ ++/* res_list contains all registered struct shared_resource */ ++static LIST_HEAD(res_list); ++ ++/* res_mutex protects res_list add and del ops */ ++static DEFINE_MUTEX(res_mutex); ++ ++/* Static Pool of users for a resource */ ++/* used till kmalloc becomes availabel */ ++struct users_list usr_list[MAX_USERS]; ++ ++/* Private/Internal functions */ ++ ++/** ++ * resource_lookup - loop up a resource by its name, return a pointer ++ * @name: The name of the resource to lookup ++ * ++ * Looks for a registered resource by its name. Returns a pointer to ++ * the struct shared_resource if found, else returns NULL. ++ */ ++static struct shared_resource *resource_lookup(const char *name) ++{ ++ struct shared_resource *res, *tmp_res; ++ ++ if (!name) ++ return NULL; ++ ++ res = NULL; ++ ++ srf_mutex_lock(&res_mutex); ++ list_for_each_entry(tmp_res, &res_list, node) { ++ if (!strcmp(name, tmp_res->name)) { ++ res = tmp_res; ++ break; ++ } ++ } ++ srf_mutex_unlock(&res_mutex); ++ return res; ++} ++ ++/** ++ * update_resource_level - Regenerates and updates the curr_level of the res ++ * @resp: Pointer to the resource ++ * ++ * This function looks at all the users of the given resource and the levels ++ * requested by each of them, and recomputes a target level for the resource ++ * acceptable to all its current usres. It then calls platform specific ++ * change_level to change the level of the resource. ++ * Returns 0 on success, else a non-zero value returned by the platform ++ * specific change_level function. ++ **/ ++static int update_resource_level(struct shared_resource *resp) ++{ ++ struct users_list *user; ++ unsigned long target_level; ++ int ret; ++ ++ /* Regenerate the target_value for the resource */ ++ target_level = RES_DEFAULTLEVEL; ++ list_for_each_entry(user, &resp->users_list, node) ++ if (user->level > target_level) ++ target_level = user->level; ++ ++ pr_debug("SRF: Changing Level for resource %s to %ld\n", ++ resp->name, target_level); ++ ret = resp->ops->change_level(resp, target_level); ++ if (ret) { ++ printk(KERN_ERR "Unable to Change" ++ "level for resource %s to %ld\n", ++ resp->name, target_level); ++ return ret; ++ } ++ return ret; ++} ++ ++/** ++ * get_user - gets a new users_list struct from static pool or dynamically ++ * ++ * This function initally looks for availability in the static pool and ++ * tries to dynamcially allocate only once the static pool is empty. ++ * We hope that during bootup by the time we hit a case of dynamic allocation ++ * slab initialization would have happened. ++ * Returns a pointer users_list struct on success. On dynamic allocation failure ++ * returns a ERR_PTR(-ENOMEM). ++ */ ++static struct users_list *get_user(void) ++{ ++ int ind = 0; ++ struct users_list *user; ++ ++ /* See if something available in the static pool */ ++ while (ind < MAX_USERS) { ++ if (usr_list[ind].usage == UNUSED) ++ break; ++ else ++ ind++; ++ } ++ if (ind < MAX_USERS) { ++ /* Pick from the static pool */ ++ user = &usr_list[ind]; ++ user->usage = STATIC_ALLOC; ++ } else { ++ /* By this time we hope slab is initialized */ ++ if (slab_is_available()) { ++ user = kmalloc(sizeof(struct users_list), GFP_KERNEL); ++ if (!user) { ++ printk(KERN_ERR "SRF:FATAL ERROR: kmalloc" ++ "failed\n"); ++ return ERR_PTR(-ENOMEM); ++ } ++ user->usage = DYNAMIC_ALLOC; ++ } else { ++ /* Dynamic alloc not available yet */ ++ printk(KERN_ERR "SRF: FATAL ERROR: users_list" ++ "initial POOL EMPTY before slab init\n"); ++ return ERR_PTR(-ENOMEM); ++ } ++ } ++ return user; ++} ++ ++/** ++ * free_user - frees the dynamic users_list and marks the static one unused ++ * @user: The struct users_list to be freed ++ * ++ * Looks at the usage flag and either frees the users_list if it was ++ * dynamically allocated, and if its from the static pool, marks it unused. ++ * No return value. ++ */ ++void free_user(struct users_list *user) ++{ ++ if (user->usage == DYNAMIC_ALLOC) ++ kfree(user); ++ else { ++ user->usage = UNUSED; ++ user->level = RES_DEFAULTLEVEL; ++ user->dev = NULL; ++ } ++} ++ ++/** ++ * resource_init - Initializes the Shared resource framework. ++ * @resources: List of all the resources modelled ++ * ++ * Loops through the list of resources and registers all that ++ * are available for the current CPU. ++ * No return value ++ */ ++void resource_init(struct shared_resource **resources) ++{ ++ struct shared_resource **resp; ++ int ind; ++ ++ pr_debug("Initializing Shared Resource Framework\n"); ++ ++ if (!cpu_is_omap343x()) { ++ /* This CPU is not supported */ ++ printk(KERN_WARNING "Shared Resource Framework does not" ++ "support this CPU type.\n"); ++ WARN_ON(1); ++ } ++ ++ /* Init the users_list POOL */ ++ for (ind = 0; ind < MAX_USERS; ind++) { ++ usr_list[ind].usage = UNUSED; ++ usr_list[ind].dev = NULL; ++ usr_list[ind].level = RES_DEFAULTLEVEL; ++ } ++ ++ if (resources) ++ for (resp = resources; *resp; resp++) ++ resource_register(*resp); ++} ++ ++/** ++ * resource_register - registers and initializes a resource ++ * @res: struct shared_resource * to register ++ * ++ * Initializes the given resource and adds it to the resource list ++ * for the current CPU. ++ * Returns 0 on success, -EINVAL if given a NULL pointer, -EEXIST if the ++ * resource is already registered. ++ */ ++int resource_register(struct shared_resource *resp) ++{ ++ if (!resp) ++ return -EINVAL; ++ ++ if (!omap_chip_is(resp->omap_chip)) ++ return -EINVAL; ++ ++ /* Verify that the resource is not already registered */ ++ if (resource_lookup(resp->name)) ++ return -EEXIST; ++ ++ INIT_LIST_HEAD(&resp->users_list); ++ mutex_init(&resp->res_mutex); ++ ++ srf_mutex_lock(&res_mutex); ++ /* Add the resource to the resource list */ ++ list_add(&resp->node, &res_list); ++ srf_mutex_unlock(&res_mutex); ++ ++ /* Call the resource specific init*/ ++ if (resp->ops->init) ++ resp->ops->init(resp); ++ ++ pr_debug("resource: registered %s\n", resp->name); ++ ++ return 0; ++} ++EXPORT_SYMBOL(resource_register); ++ ++/** ++ * resource_unregister - unregister a resource ++ * @res: struct shared_resource * to unregister ++ * ++ * Removes a resource from the resource list. ++ * Returns 0 on success, -EINVAL if passed a NULL pointer. ++ */ ++int resource_unregister(struct shared_resource *resp) ++{ ++ if (!resp) ++ return -EINVAL; ++ ++ srf_mutex_lock(&res_mutex); ++ /* delete the resource from the resource list */ ++ list_del(&resp->node); ++ srf_mutex_unlock(&res_mutex); ++ ++ pr_debug("resource: unregistered %s\n", resp->name); ++ ++ return 0; ++} ++EXPORT_SYMBOL(resource_unregister); ++ ++/** ++ * resource_request - Request for a required level of a resource ++ * @name: The name of the resource requested ++ * @dev: Uniquely identifes the caller ++ * @level: The requested level for the resource ++ * ++ * This function recomputes the target level of the resource based on ++ * the level requested by the user. The level of the resource is ++ * changed to the target level, if it is not the same as the existing level ++ * of the resource. Multiple calls to this function by the same device will ++ * replace the previous level requested ++ * Returns 0 on success, -EINVAL if the resource name passed in invalid. ++ * -ENOMEM if no static pool available or dynamic allocations fails. ++ * Else returns a non-zero error value returned by one of the failing ++ * shared_resource_ops. ++ */ ++int resource_request(const char *name, struct device *dev, ++ unsigned long level) ++{ ++ struct shared_resource *resp; ++ struct users_list *user; ++ int found = 0, ret = 0; ++ ++ resp = resource_lookup(name); ++ if (!resp) { ++ printk(KERN_ERR "resource_request: Invalid resource name\n"); ++ return -EINVAL; ++ } ++ ++ /* Call the resource specific validate function */ ++ if (resp->ops->validate_level) ++ ret = resp->ops->validate_level(resp, level); ++ if (ret) ++ return ret; ++ ++ srf_mutex_lock(&resp->res_mutex); ++ list_for_each_entry(user, &(resp->users_list), node) ++ if (user->dev == dev) { ++ found = 1; ++ break; ++ } ++ if (!found) { ++ /* First time user */ ++ user = get_user(); ++ if (IS_ERR(user)) { ++ srf_mutex_unlock(&resp->res_mutex); ++ return -ENOMEM; ++ } ++ user->dev = dev; ++ list_add(&user->node, &resp->users_list); ++ resp->no_of_users++; ++ } ++ user->level = level; ++ srf_mutex_unlock(&resp->res_mutex); ++ ++ /* Recompute and set the current level for the resource */ ++ return update_resource_level(resp); ++} ++EXPORT_SYMBOL(resource_request); ++ ++/** ++ * resource_release - Release a previously requested level of a resource ++ * @name: The name of the resource to be released ++ * @dev: Uniquely identifes the caller ++ * ++ * This function recomputes the target level of the resource after removing ++ * the level requested by the user. The level of the resource is ++ * changed to the target level, if it is not the same as the existing level ++ * of the resource. ++ * Returns 0 on success, -EINVAL if the resource name or dev structure ++ * is invalid. ++ */ ++int resource_release(const char *name, struct device *dev) ++{ ++ struct shared_resource *resp; ++ struct users_list *user; ++ int found = 0; ++ ++ resp = resource_lookup(name); ++ if (!resp) { ++ printk(KERN_ERR "resource_release: Invalid resource name\n"); ++ return -EINVAL; ++ } ++ ++ srf_mutex_lock(&resp->res_mutex); ++ list_for_each_entry(user, &(resp->users_list), node) ++ if (user->dev == dev) { ++ found = 1; ++ break; ++ } ++ ++ if (!found) { ++ srf_mutex_unlock(&resp->res_mutex); ++ /* No such user exists */ ++ return -EINVAL; ++ } ++ ++ resp->no_of_users--; ++ list_del(&user->node); ++ free_user(user); ++ srf_mutex_unlock(&resp->res_mutex); ++ ++ /* Recompute and set the current level for the resource */ ++ return update_resource_level(resp); ++} ++EXPORT_SYMBOL(resource_release); ++ ++/** ++ * resource_get_level - Returns the current level of the resource ++ * @name: Name of the resource ++ * ++ * Returns the current level of the resource if found, else returns ++ * -EINVAL if the resource name is invalid. ++ */ ++int resource_get_level(const char *name) ++{ ++ struct shared_resource *resp; ++ u32 ret; ++ ++ resp = resource_lookup(name); ++ if (!resp) { ++ printk(KERN_ERR "resource_release: Invalid resource name\n"); ++ return -EINVAL; ++ } ++ ++ srf_mutex_lock(&resp->res_mutex); ++ ret = resp->curr_level; ++ srf_mutex_unlock(&resp->res_mutex); ++ return ret; ++} ++EXPORT_SYMBOL(resource_get_level); +Index: linux-omap-2.6/include/asm-arm/arch-omap/resource.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-omap-2.6/include/asm-arm/arch-omap/resource.h 2008-08-07 +15:06:58.000000000 +0530 +@@ -0,0 +1,97 @@ ++/* ++ * linux/include/asm-arm/arch-omap/resource.h ++ * Structure definitions for Shared resource Framework ++ * ++ * Copyright (C) 2007-2008 Texas Instruments, Inc. ++ * Written by Rajendra Nayak ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR ++ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED ++ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. ++ * ++ * History: ++ * ++ */ ++ ++#ifndef __ARCH_ARM_OMAP_RESOURCE_H ++#define __ARCH_ARM_OMAP_RESOURCE_H ++ ++#include ++#include ++#include ++#include ++ ++#define srf_mutex_lock(x) { \ ++ if (!(in_atomic() || irqs_disabled())) \ ++ mutex_lock(x); \ ++ } ++#define srf_mutex_unlock(x) { \ ++ if (!(in_atomic() || irqs_disabled())) \ ++ mutex_unlock(x); \ ++ } ++ ++#define RES_DEFAULTLEVEL 0x0 ++ ++struct shared_resource_ops; /* forward declaration */ ++ ++/* Used to model a Shared Multilevel Resource */ ++struct shared_resource { ++ /* Resource name */ ++ const char *name; ++ /* Used to represent the OMAP chip types containing this res */ ++ const struct omap_chip_id omap_chip; ++ /* Total no of users at any point of this resource */ ++ u8 no_of_users; ++ /* Current level of this resource */ ++ u32 curr_level; ++ /* Used to store any resource specific data */ ++ void *resource_data; ++ /* List of all the current users for this resource */ ++ struct list_head users_list; ++ /* Used to guard the resource */ ++ struct mutex res_mutex; ++ /* Shared resource operations */ ++ struct shared_resource_ops *ops; ++ struct list_head node; ++}; ++ ++struct shared_resource_ops { ++ /* Init function for the resource */ ++ void (*init)(struct shared_resource *res); ++ /* Function to change the level of the resource */ ++ int (*change_level)(struct shared_resource *res, u32 target_level); ++ /* Function to validate the requested level of the resource */ ++ int (*validate_level)(struct shared_resource *res, u32 target_level); ++}; ++ ++/* This is to statically defining the users pool */ ++/* This static pool is used till kmalloc becomes available */ ++#define MAX_USERS 10 ++#define UNUSED 0x0 ++#define DYNAMIC_ALLOC 0x1 ++#define STATIC_ALLOC 0x2 ++ ++/* Used to represent a user of a shared resource */ ++struct users_list { ++ /* Device pointer used to uniquely identify the user */ ++ struct device *dev; ++ /* Current level as requested for the resource by the user */ ++ u32 level; ++ struct list_head node; ++ u8 usage; ++}; ++ ++/* Shared resource Framework API's */ ++void reso