PM: add omapdev code
Subsystems (3)
cover PM: add omapdev code
This patch series provides an initial representation for most on-chip devices on OMAP2/3 chips, 'struct omapdev'. Currently, it is used to map platform_devices to the corresponding powerdomains for the OMAP PM code. In the future, the intention is to use these structures to initialize on-chip devices at boot and to clean up device registration. Detailed notes are in the patch descriptions, and in the code comments in the final patch.
Tested on 3430SDP and 2430SDP.
(This patchset was formerly known as the "tiocp" patchset.)
- Paul
---
text data bss dec hex filename
3459409 159880 105744 3725033 38d6e9 vmlinux.3430sdp.orig 3461481 163344 105744 3730569 38ec89 vmlinux.3430sdp
arch/arm/mach-omap2/Makefile | 2 arch/arm/mach-omap2/io.c | 3 arch/arm/mach-omap2/omapdev-common.h | 309 +++++++++++ arch/arm/mach-omap2/omapdev.c | 177 ++++++ arch/arm/mach-omap2/omapdev242x.h | 581 +++++++++++++++++++++ arch/arm/mach-omap2/omapdev243x.h | 661 ++++++++++++++++++++++++ arch/arm/mach-omap2/omapdev3xxx.h | 802 +++++++++++++++++++++++++++++ arch/arm/plat-omap/include/mach/omapdev.h | 58 ++ 8 files changed, 2592 insertions(+), 1 deletions(-) create mode 100644 arch/arm/mach-omap2/omapdev-common.h create mode 100644 arch/arm/mach-omap2/omapdev.c create mode 100644 arch/arm/mach-omap2/omapdev242x.h create mode 100644 arch/arm/mach-omap2/omapdev243x.h create mode 100644 arch/arm/mach-omap2/omapdev3xxx.h create mode 100644 arch/arm/plat-omap/include/mach/omapdev.h
PATCH 1/5 OMAP2/3 omapdev: add basic omapdev structure
Add a structure 'omapdev' to represent on-chip hardware peripherals. Currently the only additional information stored are the powerdomains for each on-chip peripheral, although the long-term intention is to use this to handle device reset at boot time and to clean up device registration.
Use platform_device name and id fields to link this structure back to the corresponding platform_device. In the medium- to long-term, it may be best to use a generic device pointer so system devices can be linked also; but for now, most cases can be handled via platform_device.
struct omapdev differs in purpose from struct platform_device in that platform_device is currently used to represent "logical" devices in the Linux driver model, whereas this struct omapdev is used to represent physical on-chip devices in the OMAP memory map. An example is the OMAP2xxx camera driver. It uses only one platform_device, "omap24xxcam.-1", but on the hardware, that platform_device covers several independent on-chip devices with their own address space and control parameters. Other examples of multiple omapdevs per platform_device include the display subsystem and UARTs.
struct omapdev entries are only for on-chip devices. Off-chip peripherals are not included in omapdev. So, smc91x and onenand, for example, will not be included. What belongs in those two cases would be some sort of GPMC platform_device.
--- arch/arm/mach-omap2/omapdev-common.h | 27 +++++++++++++++ arch/arm/plat-omap/include/mach/omapdev.h | 51 +++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-omap2/omapdev-common.h create mode 100644 arch/arm/plat-omap/include/mach/omapdev.h
arch/arm/mach-omap2/omapdev-common.h new file +27 -0
@@ -0,0 +1,27 @@ +/* +* OMAP on-chip devices present on OMAP2/3 +* +* Copyright (C) 2007-2008 Texas Instruments, Inc. +* Copyright (C) 2007-2008 Nokia Corporation +* Paul Walmsley +* +* 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. +* +*/ + +#ifndef ARCH_ARM_MACH_OMAP2_OMAPDEV_COMMON_H +#define ARCH_ARM_MACH_OMAP2_OMAPDEV_COMMON_H + +#include <mach/omapdev.h> + +#include "omapdev242x.h" +#include "omapdev243x.h" +#include "omapdev3xxx.h" + +static struct omapdev *omapdevs[] = { +NULL , +}; + +#endif
arch/arm/plat-omap/include/mach/omapdev.h new file +51 -0
51 lines not on this page · raw message
PATCH 2/5 OMAP242x omapdev: add OMAP242x omapdev records
In reply to Paul WalmsleyAdd records for most of the OMAP242x physical on-chip devices. Include platform_device name and id fields for most of the devices currently in use by the codebase.
--- arch/arm/mach-omap2/omapdev-common.h | 81 +++++ arch/arm/mach-omap2/omapdev242x.h | 581 ++++++++++++++++++++++++++++++++++ 2 files changed, 662 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-omap2/omapdev242x.h
arch/arm/mach-omap2/omapdev-common.h +81 -0
@@ -21,6 +21,87 @@#include "omapdev3xxx.h" static struct omapdev *omapdevs[] = { + +#ifdef CONFIG_ARCH_OMAP2420 + &mpu_242x_omapdev, + &iva_242x_omapdev, + &gfx_242x_omapdev, + &prcm_242x_omapdev, + &l3_242x_omapdev, + &l4_core_242x_omapdev, + &dsp_242x_omapdev, + &dsp_mmu_242x_omapdev, + &control_242x_omapdev, + &tap_242x_omapdev, + &gpio2_242x_omapdev, + &gpio3_242x_omapdev, + &gpio4_242x_omapdev, + &gptimer12_242x_omapdev, + &uart3_242x_omapdev, + &mcbsp2_242x_omapdev, + &wdtimer4_242x_omapdev, + &gptimer2_242x_omapdev, + &gptimer3_242x_omapdev, + &gptimer4_242x_omapdev, + &gptimer5_242x_omapdev, + &gptimer6_242x_omapdev, + &gptimer7_242x_omapdev, + &gptimer8_242x_omapdev, + &gptimer9_242x_omapdev, + &etb_242x_omapdev, + &cwt_242x_omapdev, + &xti_242x_omapdev, + &dap_242x_omapdev, + &dsi_242x_omapdev, + &dsi_pll_242x_omapdev, + &dss_242x_omapdev, + &dispc_242x_omapdev, + &rfbi_242x_omapdev, + &venc_242x_omapdev, + &fac_242x_omapdev, + &cam_242x_omapdev, + &cam_core_242x_omapdev, + &cam_dma_242x_omapdev, + &cam_mmu_242x_omapdev, + &mpu_intc_242x_omapdev, + &sms_242x_omapdev, + &gpmc_242x_omapdev, + &sdrc_242x_omapdev, + &ocm_ram_242x_omapdev, + &ocm_rom_242x_omapdev, + &ssi_242x_omapdev, + &ohci_242x_omapdev, + &otg_242x_omapdev, + &sdma_242x_omapdev, + &i2c1_242x_omapdev, + &i2c2_242x_omapdev, + &uart1_242x_omapdev, + &uart2_242x_omapdev, + &mcbsp1_242x_omapdev, + &gptimer10_242x_omapdev, + &gptimer11_242x_omapdev, + &mailbox_242x_omapdev, + &mcspi1_242x_omapdev, + &mcspi2_242x_omapdev, + &mg_242x_omapdev, + &hdq_242x_omapdev, + &mspro_242x_omapdev, + &wdtimer3_242x_omapdev, + &vlynq_242x_omapdev, + &eac_242x_omapdev, + &mmc_242x_omapdev, + &gptimer1_242x_omapdev, + &omap_32ksynct_242x_omapdev, + &gpio1_242x_omapdev, + &wdtimer2_242x_omapdev, + &wdtimer1_242x_omapdev, + &rng_242x_omapdev, + &sha1md5_242x_omapdev, + &des_242x_omapdev, + &aes_242x_omapdev, + &pka_242x_omapdev, +#endif +NULL , };
arch/arm/mach-omap2/omapdev242x.h new file +581 -0
581 lines not on this page · raw message
PATCH 3/5 OMAP243x omapdev: add OMAP243x omapdev records
In reply to Paul WalmsleyAdd records for most of the OMAP243x/OMAP253x physical on-chip devices. Include platform_device name and id fields for most of the devices currently in use by the codebase.
--- arch/arm/mach-omap2/omapdev-common.h | 90 +++++ arch/arm/mach-omap2/omapdev243x.h | 661 ++++++++++++++++++++++++++++++++++ 2 files changed, 751 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-omap2/omapdev243x.h
arch/arm/mach-omap2/omapdev-common.h +90 -0
@@ -102,6 +102,96 @@ static struct omapdev *omapdevs[] = { &pka_242x_omapdev,#endif +#ifdef CONFIG_ARCH_OMAP2430 + &mpu_243x_omapdev, + &iva2_243x_omapdev, + &iva2_mmu_243x_omapdev, + &gfx_243x_omapdev, + &l3_243x_omapdev, + &l4_core_243x_omapdev, + &l4_wkup_243x_omapdev, + &dsp_243x_omapdev, + &control_243x_omapdev, + &tap_243x_omapdev, + &gpio2_243x_omapdev, + &gpio3_243x_omapdev, + &gpio4_243x_omapdev, + &gptimer12_243x_omapdev, + &uart3_243x_omapdev, + &mcbsp2_243x_omapdev, + &wdtimer4_243x_omapdev, + &gptimer2_243x_omapdev, + &gptimer3_243x_omapdev, + &gptimer4_243x_omapdev, + &gptimer5_243x_omapdev, + &gptimer6_243x_omapdev, + &gptimer7_243x_omapdev, + &gptimer8_243x_omapdev, + &gptimer9_243x_omapdev, + &etb_243x_omapdev, + &cwt_243x_omapdev, + &xti_243x_omapdev, + &dap_243x_omapdev, + &dsi_243x_omapdev, + &dsi_pll_243x_omapdev, + &dss_243x_omapdev, + &dispc_243x_omapdev, + &rfbi_243x_omapdev, + &venc_243x_omapdev, + &fac_243x_omapdev, + &cam_243x_omapdev, + &cam_core_243x_omapdev, + &cam_dma_243x_omapdev, + &cam_mmu_243x_omapdev, + &mpu_intc_243x_omapdev, + &modem_intc_243x_omapdev, + &sms_243x_omapdev, + &gpmc_243x_omapdev, + &sdrc_243x_omapdev, + &ocm_ram_243x_omapdev, + &ocm_rom_243x_omapdev, + &sad2d_243x_omapdev, + &ssi_243x_omapdev, + &ohci_243x_omapdev, + &fsotg_243x_omapdev, + &hsotg_243x_omapdev, + &sdma_243x_omapdev, + &i2c1_243x_omapdev, + &i2c2_243x_omapdev, + &uart1_243x_omapdev, + &uart2_243x_omapdev, + &mcbsp1_243x_omapdev, + &gptimer10_243x_omapdev, + &gptimer11_243x_omapdev, + &mailbox_243x_omapdev, + &mcspi1_243x_omapdev, + &mcspi2_243x_omapdev, + &mg_243x_omapdev, + &hdq_243x_omapdev, + &mspro_243x_omapdev, + &mcbsp5_243x_omapdev, + &hsmmc1_243x_omapdev, + &hsmmc2_243x_omapdev, + &mcspi3_243x_omapdev, + &gptimer1_243x_omapdev, + &prm_243x_omapdev, + &cm_243x_omapdev, + &omap_32ksynct_243x_omapdev, + &gpio1_243x_omapdev, + &wdtimer2_243x_omapdev, + &wdtimer1_243x_omapdev, + &rng_243x_omapdev, + &sha1md5_243x_omapdev, + &des_243x_omapdev, + &aes_243x_omapdev, + &pka_243x_omapdev, + &modem_243x_omapdev, + &icr_243x_omapdev, + &mcbsp3_243x_omapdev, + &mcbsp4_243x_omapdev, + &gpio5_243x_omapdev, +#endif + NULL, };
arch/arm/mach-omap2/omapdev243x.h new file +661 -0
661 lines not on this page · raw message
PATCH 4/5 OMAP3xxx omapdev: add OMAP3xxx omapdev records
In reply to Paul WalmsleyAdd records for most of the OMAP3xxx physical on-chip devices. OMAP3430 is used as the reference here. Include platform_device name and id fields for most of the devices currently in use by the codebase.
--- arch/arm/mach-omap2/omapdev-common.h | 111 +++++ arch/arm/mach-omap2/omapdev3xxx.h | 802 ++++++++++++++++++++++++++++++++++ 2 files changed, 913 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-omap2/omapdev3xxx.h
arch/arm/mach-omap2/omapdev-common.h +111 -0
@@ -192,6 +192,117 @@ static struct omapdev *omapdevs[] = { &gpio5_243x_omapdev,#endif +#ifdef CONFIG_ARCH_OMAP3 + &mpu_3xxx_omapdev, + &iva2_3xxx_omapdev, + &iva2_mmu_3xxx_omapdev, + &gfx_3xxx_omapdev, + &l3_3xxx_omapdev, + &l4_core_3xxx_omapdev, + &l4_wkup_3xxx_omapdev, + &mpu_intc_3xxx_omapdev, + &modem_intc_3xxx_omapdev, + &sms_3xxx_omapdev, + &gpmc_3xxx_omapdev, + &sdrc_3xxx_omapdev, + &ocm_ram_3xxx_omapdev, + &ocm_rom_3xxx_omapdev, + &sad2d_3xxx_omapdev, + &ssi_3xxx_omapdev, + &sdma_3xxx_omapdev, + &i2c1_3xxx_omapdev, + &i2c2_3xxx_omapdev, + &uart1_3xxx_omapdev, + &uart2_3xxx_omapdev, + &mcbsp1_3xxx_omapdev, + &gptimer10_3xxx_omapdev, + &gptimer11_3xxx_omapdev, + &mailbox_3xxx_omapdev, + &mcspi1_3xxx_omapdev, + &mcspi2_3xxx_omapdev, + &mg_3xxx_omapdev, + &hdq_3xxx_omapdev, + &mspro_3xxx_omapdev, + &mcbsp5_3xxx_omapdev, + &hsmmc1_3xxx_omapdev, + &hsmmc2_3xxx_omapdev, + &mcspi3_3xxx_omapdev, + &gptimer1_3xxx_omapdev, + &prm_3xxx_omapdev, + &cm_3xxx_omapdev, + &omap_32ksynct_3xxx_omapdev, + &gpio1_3xxx_omapdev, + &wdtimer2_3xxx_omapdev, + &wdtimer1_3xxx_omapdev, + &rng_3xxx_omapdev, + &sha1md5_3xxx_omapdev, + &des_3xxx_omapdev, + &aes_3xxx_omapdev, + &pka_3xxx_omapdev, + &neon_3xxx_omapdev, + &sgx_3xxx_omapdev, + &l4_per_3xxx_omapdev, + &l4_emu_3xxx_omapdev, + &icr_3xxx_omapdev, + &wugen_3xxx_omapdev, + &mad2d_3xxx_omapdev, + &control_3xxx_omapdev, + &i2c3_3xxx_omapdev, + &hsmmc3_3xxx_omapdev, + &mcspi4_3xxx_omapdev, + &sr1_3xxx_omapdev, + &sr2_3xxx_omapdev, + &usbhost_es1_3xxx_omapdev, + &usbotg_es1_3xxx_omapdev, + &uart3_3xxx_omapdev, + &mcbsp2_3xxx_omapdev, + &mcbsp3_3xxx_omapdev, + &mcbsp4_3xxx_omapdev, + &mcbsp2_sidetone_3xxx_omapdev, + &mcbsp3_sidetone_3xxx_omapdev, + &wdtimer3_3xxx_omapdev, + &gptimer2_3xxx_omapdev, + &gptimer3_3xxx_omapdev, + &gptimer4_3xxx_omapdev, + &gptimer5_3xxx_omapdev, + &gptimer6_3xxx_omapdev, + &gptimer7_3xxx_omapdev, + &gptimer8_3xxx_omapdev, + &gptimer9_3xxx_omapdev, + &gpio2_3xxx_omapdev, + &gpio3_3xxx_omapdev, + &gpio4_3xxx_omapdev, + &gpio5_3xxx_omapdev, + &gpio6_3xxx_omapdev, + &tap_3xxx_omapdev, + &mpuemu_3xxx_omapdev, + &tpiu_3xxx_omapdev, + &etb_3xxx_omapdev, + &dapctl_3xxx_omapdev, + &sdti_3xxx_omapdev, + &dap_3xxx_omapdev, + &usbhost_3xxx_omapdev, + &usbotg_3xxx_omapdev, + &usbtll_3xxx_omapdev, + &dsi_3xxx_omapdev, + &dsi_phy_3xxx_omapdev, + &dsi_pll_3xxx_omapdev, + &dss_3xxx_omapdev, + &dispc_3xxx_omapdev, + &rfbi_3xxx_omapdev, + &venc_3xxx_omapdev, + &isp_3xxx_omapdev, + &isp_cbuff_3xxx_omapdev, + &ccp2_3xxx_omapdev, + &ccdc_3xxx_omapdev, + &hist_3xxx_omapdev, + &h3a_3xxx_omapdev, + &prv_3xxx_omapdev, + &rsz_3xxx_omapdev, + &sbl_3xxx_omapdev, + &csi2_3xxx_omapdev, +#endif + NULL, };
arch/arm/mach-omap2/omapdev3xxx.h new file +802 -0
802 lines not on this page · raw message
PATCH 5/5 OMAP2/3 omapdev: add code to walk the omapdev records
In reply to Paul WalmsleyRegister the omapdevs early in the boot process. Also provide functions for other code (primarily the OMAP PM layer at the moment) to look up an omapdev given a platform_device name and id.
--- arch/arm/mach-omap2/Makefile | 2 arch/arm/mach-omap2/io.c | 3 arch/arm/mach-omap2/omapdev.c | 177 +++++++++++++++++++++++++++++ arch/arm/plat-omap/include/mach/omapdev.h | 7 + 4 files changed, 188 insertions(+), 1 deletions(-) create mode 100644 arch/arm/mach-omap2/omapdev.c
arch/arm/mach-omap2/Makefile +1 -1
@@ -5,7 +5,7 @@ # Common support obj-y := irq.o id.o io.o sdrc.o control.o prcm.o clock.o mux.o \ devices.o serial.o gpmc.o timer-gp.o powerdomain.o \ - clockdomain.o + clockdomain.o omapdev.o obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
arch/arm/mach-omap2/io.c +3 -0
@@ -29,6 +29,8 @@#include <mach/sdrc.h> #include <mach/gpmc.h> +#include "omapdev-common.h" +#include "clock.h" #include <mach/powerdomain.h>
@@ -202,6 +204,7 @@ void __init omap2_init_common_hw(struct omap_sdrc_params *sp)omap_pm_if_early_init ();pwrdm_init (powerdomains_omap);clkdm_init (clockdomains_omap, clkdm_pwrdm_autodeps); +omapdev_init (omapdevs);omap2_clk_init ();omap_pm_if_init (NULL ,NULL );omap2_sdrc_init (sp);
arch/arm/mach-omap2/omapdev.c new file +177 -0
177 lines not on this page · raw message
arch/arm/plat-omap/include/mach/omapdev.h +7 -0
@@ -15,6 +15,7 @@#include <linux/types.h> #include <linux/list.h> +#include <linux/platform_device.h> #include <mach/cpu.h> #include <mach/powerdomain.h>
@@ -47,5 +48,11 @@ struct omapdev { }; +void omapdev_init (struct omapdev **odev_list); + +struct powerdomain *omapdev_get_pwrdm (struct omapdev *odev); + +struct omapdev *omapdev_find_pdev (struct platform_device *pdev); +#endif
Re: [PATCH 1/5] OMAP2/3 omapdev: add basic omapdev structure
In reply to Paul WalmsleyQuoted 2 lines · Paul Walmsley
In the medium- to long-term, it may be best
to use a generic device pointer so system devices can be linked also;
Best IMO to start phasing out system devices; they're superfluous, given some power management changes from late last year.
Re: [PATCH 2/5] OMAP242x omapdev: add OMAP242x omapdev records
In reply to Paul Walmsleyarch/arm/mach-omap2/omapdev-common.h line 28
Quoted 12 lines · Paul Walmsley
arch/arm/mach-omap2/omapdev-common.h +0
-0@@ -21,6 +21,87 @@ #include "omapdev3xxx.h"
static struct omapdev *omapdevs[] = {arch/arm/mach-omap2/omapdev-common.h +5
-0+ +#ifdef CONFIG_ARCH_OMAP2420 + &mpu_242x_omapdev, + &iva_242x_omapdev, + &gfx_242x_omapdev,
Urgh, this is unpleasant style: declaration of a large static data structure in a header file.
Cleaner: just have some omap2420-specific C file declare the struct, and hand it off to whatever code uses it.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/5] OMAP242x omapdev: add OMAP242x omapdev records
Hi David,
Quoted 17 lines · David Brownell
arch/arm/mach-omap2/omapdev-common.h line 28
Quoted 12 lines · Paul Walmsley
arch/arm/mach-omap2/omapdev-common.h +0
-0@@ -21,6 +21,87 @@ #include "omapdev3xxx.h"
static struct omapdev *omapdevs[] = {arch/arm/mach-omap2/omapdev-common.h +5
-0+ +#ifdef CONFIG_ARCH_OMAP2420 + &mpu_242x_omapdev, + &iva_242x_omapdev, + &gfx_242x_omapdev,Urgh, this is unpleasant style: declaration of a large static data structure in a header file.
Quoted 2 lines
Cleaner: just have some omap2420-specific C file declare the struct, and hand it off to whatever code uses it.
Not sure I understand what you'd like to see. Could you send a short code snippet as an example? One caveat is that whatever we go with here will need to work for a multi-OMAP kernel.
- Paul
Re: [PATCH 2/5] OMAP242x omapdev: add OMAP242x omapdev records
Quoted 21 lines · Paul Walmsley
Hi David,
Quoted 17 lines · David Brownell
arch/arm/mach-omap2/omapdev-common.h line 28
Quoted 12 lines · Paul Walmsley
arch/arm/mach-omap2/omapdev-common.h +0
-0@@ -21,6 +21,87 @@ #include "omapdev3xxx.h"
static struct omapdev *omapdevs[] = {arch/arm/mach-omap2/omapdev-common.h +5
-0+ +#ifdef CONFIG_ARCH_OMAP2420 + &mpu_242x_omapdev, + &iva_242x_omapdev, + &gfx_242x_omapdev,Urgh, this is unpleasant style: declaration of a large static data structure in a header file.
Quoted 6 lines
Quoted 2 lines
Cleaner: just have some omap2420-specific C file declare the struct, and hand it off to whatever code uses it.
Not sure I understand what you'd like to see. Could you send a short code snippet as an example? One caveat is that whatever we go with here will need to work for a multi-OMAP kernel.
I think dave is saying that you could move static struct omapdev to a C-file and probably have separate tables for each omap version, then you can pass a reference to it to a function which would do all the magic.
Something like platform_add_devices(), then you pass the reference to the table and the table size.
Signature · 5 lines
balbi -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html