Merge branch 'for_3.2/3_omap_devicetree' of git://gitorious.org/omap-pm/linux into dt
This commit is contained in:
14
Documentation/devicetree/bindings/arm/omap/dsp.txt
Normal file
14
Documentation/devicetree/bindings/arm/omap/dsp.txt
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
* TI - DSP (Digital Signal Processor)
|
||||||
|
|
||||||
|
TI DSP included in OMAP SoC
|
||||||
|
|
||||||
|
Required properties:
|
||||||
|
- compatible : Should be "ti,omap3-c64" for OMAP3 & 4
|
||||||
|
- ti,hwmods: "dsp"
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
dsp {
|
||||||
|
compatible = "ti,omap3-c64";
|
||||||
|
ti,hwmods = "dsp";
|
||||||
|
};
|
19
Documentation/devicetree/bindings/arm/omap/iva.txt
Normal file
19
Documentation/devicetree/bindings/arm/omap/iva.txt
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
* TI - IVA (Imaging and Video Accelerator) subsystem
|
||||||
|
|
||||||
|
The IVA contain various audio, video or imaging HW accelerator
|
||||||
|
depending of the version.
|
||||||
|
|
||||||
|
Required properties:
|
||||||
|
- compatible : Should be:
|
||||||
|
- "ti,ivahd" for OMAP4
|
||||||
|
- "ti,iva2.2" for OMAP3
|
||||||
|
- "ti,iva2.1" for OMAP2430
|
||||||
|
- "ti,iva1" for OMAP2420
|
||||||
|
- ti,hwmods: "iva"
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
iva {
|
||||||
|
compatible = "ti,ivahd", "ti,iva";
|
||||||
|
ti,hwmods = "iva";
|
||||||
|
};
|
19
Documentation/devicetree/bindings/arm/omap/l3-noc.txt
Normal file
19
Documentation/devicetree/bindings/arm/omap/l3-noc.txt
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
* TI - L3 Network On Chip (NoC)
|
||||||
|
|
||||||
|
This version is an implementation of the generic NoC IP
|
||||||
|
provided by Arteris.
|
||||||
|
|
||||||
|
Required properties:
|
||||||
|
- compatible : Should be "ti,omap3-l3-smx" for OMAP3 family
|
||||||
|
Should be "ti,omap4-l3-noc" for OMAP4 family
|
||||||
|
- ti,hwmods: "l3_main_1", ... One hwmod for each noc domain.
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
ocp {
|
||||||
|
compatible = "ti,omap4-l3-noc", "simple-bus";
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <1>;
|
||||||
|
ranges;
|
||||||
|
ti,hwmods = "l3_main_1", "l3_main_2", "l3_main_3";
|
||||||
|
};
|
27
Documentation/devicetree/bindings/arm/omap/mpu.txt
Normal file
27
Documentation/devicetree/bindings/arm/omap/mpu.txt
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
* TI - MPU (Main Processor Unit) subsystem
|
||||||
|
|
||||||
|
The MPU subsystem contain one or several ARM cores
|
||||||
|
depending of the version.
|
||||||
|
The MPU contain CPUs, GIC, L2 cache and a local PRCM.
|
||||||
|
|
||||||
|
Required properties:
|
||||||
|
- compatible : Should be "ti,omap3-mpu" for OMAP3
|
||||||
|
Should be "ti,omap4-mpu" for OMAP4
|
||||||
|
- ti,hwmods: "mpu"
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
- For an OMAP4 SMP system:
|
||||||
|
|
||||||
|
mpu {
|
||||||
|
compatible = "ti,omap4-mpu";
|
||||||
|
ti,hwmods = "mpu";
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
- For an OMAP3 monocore system:
|
||||||
|
|
||||||
|
mpu {
|
||||||
|
compatible = "ti,omap3-mpu";
|
||||||
|
ti,hwmods = "mpu";
|
||||||
|
};
|
43
Documentation/devicetree/bindings/arm/omap/omap.txt
Normal file
43
Documentation/devicetree/bindings/arm/omap/omap.txt
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
* Texas Instruments OMAP
|
||||||
|
|
||||||
|
OMAP is currently using a static file per SoC family to describe the
|
||||||
|
IPs present in the SoC.
|
||||||
|
On top of that an omap_device is created to extend the platform_device
|
||||||
|
capabilities and to allow binding with one or several hwmods.
|
||||||
|
The hwmods will contain all the information to build the device:
|
||||||
|
adresse range, irq lines, dma lines, interconnect, PRCM register,
|
||||||
|
clock domain, input clocks.
|
||||||
|
For the moment just point to the existing hwmod, the next step will be
|
||||||
|
to move data from hwmod to device-tree representation.
|
||||||
|
|
||||||
|
|
||||||
|
Required properties:
|
||||||
|
- compatible: Every devices present in OMAP SoC should be in the
|
||||||
|
form: "ti,XXX"
|
||||||
|
- ti,hwmods: list of hwmod names (ascii strings), that comes from the OMAP
|
||||||
|
HW documentation, attached to a device. Must contain at least
|
||||||
|
one hwmod.
|
||||||
|
|
||||||
|
Optional properties:
|
||||||
|
- ti,no_idle_on_suspend: When present, it prevents the PM to idle the module
|
||||||
|
during suspend.
|
||||||
|
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
spinlock@1 {
|
||||||
|
compatible = "ti,omap4-spinlock";
|
||||||
|
ti,hwmods = "spinlock";
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Boards:
|
||||||
|
|
||||||
|
- OMAP3 BeagleBoard : Low cost community board
|
||||||
|
compatible = "ti,omap3-beagle", "ti,omap3"
|
||||||
|
|
||||||
|
- OMAP4 SDP : Software Developement Board
|
||||||
|
compatible = "ti,omap4-sdp", "ti,omap4430"
|
||||||
|
|
||||||
|
- OMAP4 PandaBoard : Low cost community board
|
||||||
|
compatible = "ti,omap4-panda", "ti,omap4430"
|
29
arch/arm/boot/dts/omap3-beagle.dts
Normal file
29
arch/arm/boot/dts/omap3-beagle.dts
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
/dts-v1/;
|
||||||
|
|
||||||
|
/include/ "omap3.dtsi"
|
||||||
|
|
||||||
|
/ {
|
||||||
|
model = "TI OMAP3 BeagleBoard";
|
||||||
|
compatible = "ti,omap3-beagle", "ti,omap3";
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Since the initial device tree board file does not create any
|
||||||
|
* devices (MMC, network...), the only way to boot is to provide a
|
||||||
|
* ramdisk.
|
||||||
|
*/
|
||||||
|
chosen {
|
||||||
|
bootargs = "root=/dev/ram0 rw console=ttyO2,115200n8 initrd=0x81600000,20M ramdisk_size=20480 no_console_suspend debug earlyprintk";
|
||||||
|
};
|
||||||
|
|
||||||
|
memory {
|
||||||
|
device_type = "memory";
|
||||||
|
reg = <0x80000000 0x20000000>; /* 512 MB */
|
||||||
|
};
|
||||||
|
};
|
63
arch/arm/boot/dts/omap3.dtsi
Normal file
63
arch/arm/boot/dts/omap3.dtsi
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
* Device Tree Source for OMAP3 SoC
|
||||||
|
*
|
||||||
|
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
|
||||||
|
*
|
||||||
|
* This file is licensed under the terms of the GNU General Public License
|
||||||
|
* version 2. This program is licensed "as is" without any warranty of any
|
||||||
|
* kind, whether express or implied.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/include/ "skeleton.dtsi"
|
||||||
|
|
||||||
|
/ {
|
||||||
|
compatible = "ti,omap3430", "ti,omap3";
|
||||||
|
|
||||||
|
cpus {
|
||||||
|
cpu@0 {
|
||||||
|
compatible = "arm,cortex-a8";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The soc node represents the soc top level view. It is uses for IPs
|
||||||
|
* that are not memory mapped in the MPU view or for the MPU itself.
|
||||||
|
*/
|
||||||
|
soc {
|
||||||
|
compatible = "ti,omap-infra";
|
||||||
|
mpu {
|
||||||
|
compatible = "ti,omap3-mpu";
|
||||||
|
ti,hwmods = "mpu";
|
||||||
|
};
|
||||||
|
|
||||||
|
iva {
|
||||||
|
compatible = "ti,iva2.2";
|
||||||
|
ti,hwmods = "iva";
|
||||||
|
|
||||||
|
dsp {
|
||||||
|
compatible = "ti,omap3-c64";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XXX: Use a flat representation of the OMAP3 interconnect.
|
||||||
|
* The real OMAP interconnect network is quite complex.
|
||||||
|
* Since that will not bring real advantage to represent that in DT for
|
||||||
|
* the moment, just use a fake OCP bus entry to represent the whole bus
|
||||||
|
* hierarchy.
|
||||||
|
*/
|
||||||
|
ocp {
|
||||||
|
compatible = "simple-bus";
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <1>;
|
||||||
|
ranges;
|
||||||
|
ti,hwmods = "l3_main";
|
||||||
|
|
||||||
|
intc: interrupt-controller@1 {
|
||||||
|
compatible = "ti,omap3-intc";
|
||||||
|
interrupt-controller;
|
||||||
|
#interrupt-cells = <1>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
29
arch/arm/boot/dts/omap4-panda.dts
Normal file
29
arch/arm/boot/dts/omap4-panda.dts
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
/dts-v1/;
|
||||||
|
|
||||||
|
/include/ "omap4.dtsi"
|
||||||
|
|
||||||
|
/ {
|
||||||
|
model = "TI OMAP4 PandaBoard";
|
||||||
|
compatible = "ti,omap4-panda", "ti,omap4430", "ti,omap4";
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Since the initial device tree board file does not create any
|
||||||
|
* devices (MMC, network...), the only way to boot is to provide a
|
||||||
|
* ramdisk.
|
||||||
|
*/
|
||||||
|
chosen {
|
||||||
|
bootargs = "root=/dev/ram0 rw console=ttyO2,115200n8 initrd=0x81600000,20M ramdisk_size=20480 no_console_suspend debug";
|
||||||
|
};
|
||||||
|
|
||||||
|
memory {
|
||||||
|
device_type = "memory";
|
||||||
|
reg = <0x80000000 0x40000000>; /* 1 GB */
|
||||||
|
};
|
||||||
|
};
|
29
arch/arm/boot/dts/omap4-sdp.dts
Normal file
29
arch/arm/boot/dts/omap4-sdp.dts
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
/dts-v1/;
|
||||||
|
|
||||||
|
/include/ "omap4.dtsi"
|
||||||
|
|
||||||
|
/ {
|
||||||
|
model = "TI OMAP4 SDP board";
|
||||||
|
compatible = "ti,omap4-sdp", "ti,omap4430", "ti,omap4";
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Since the initial device tree board file does not create any
|
||||||
|
* devices (MMC, network...), the only way to boot is to provide a
|
||||||
|
* ramdisk.
|
||||||
|
*/
|
||||||
|
chosen {
|
||||||
|
bootargs = "root=/dev/ram0 rw console=ttyO2,115200n8 initrd=0x81600000,20M ramdisk_size=20480 no_console_suspend debug";
|
||||||
|
};
|
||||||
|
|
||||||
|
memory {
|
||||||
|
device_type = "memory";
|
||||||
|
reg = <0x80000000 0x40000000>; /* 1 GB */
|
||||||
|
};
|
||||||
|
};
|
103
arch/arm/boot/dts/omap4.dtsi
Normal file
103
arch/arm/boot/dts/omap4.dtsi
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Carveout for multimedia usecases
|
||||||
|
* It should be the last 48MB of the first 512MB memory part
|
||||||
|
* In theory, it should not even exist. That zone should be reserved
|
||||||
|
* dynamically during the .reserve callback.
|
||||||
|
*/
|
||||||
|
/memreserve/ 0x9d000000 0x03000000;
|
||||||
|
|
||||||
|
/include/ "skeleton.dtsi"
|
||||||
|
|
||||||
|
/ {
|
||||||
|
compatible = "ti,omap4430", "ti,omap4";
|
||||||
|
interrupt-parent = <&gic>;
|
||||||
|
|
||||||
|
aliases {
|
||||||
|
};
|
||||||
|
|
||||||
|
cpus {
|
||||||
|
cpu@0 {
|
||||||
|
compatible = "arm,cortex-a9";
|
||||||
|
};
|
||||||
|
cpu@1 {
|
||||||
|
compatible = "arm,cortex-a9";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The soc node represents the soc top level view. It is uses for IPs
|
||||||
|
* that are not memory mapped in the MPU view or for the MPU itself.
|
||||||
|
*/
|
||||||
|
soc {
|
||||||
|
compatible = "ti,omap-infra";
|
||||||
|
mpu {
|
||||||
|
compatible = "ti,omap4-mpu";
|
||||||
|
ti,hwmods = "mpu";
|
||||||
|
};
|
||||||
|
|
||||||
|
dsp {
|
||||||
|
compatible = "ti,omap3-c64";
|
||||||
|
ti,hwmods = "dsp";
|
||||||
|
};
|
||||||
|
|
||||||
|
iva {
|
||||||
|
compatible = "ti,ivahd";
|
||||||
|
ti,hwmods = "iva";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XXX: Use a flat representation of the OMAP4 interconnect.
|
||||||
|
* The real OMAP interconnect network is quite complex.
|
||||||
|
*
|
||||||
|
* MPU -+-- MPU_PRIVATE - GIC, L2
|
||||||
|
* |
|
||||||
|
* +----------------+----------+
|
||||||
|
* | | |
|
||||||
|
* + +- EMIF - DDR |
|
||||||
|
* | | |
|
||||||
|
* | + +--------+
|
||||||
|
* | | |
|
||||||
|
* | +- L4_ABE - AESS, MCBSP, TIMERs...
|
||||||
|
* | |
|
||||||
|
* +- L3_MAIN --+- L4_CORE - IPs...
|
||||||
|
* |
|
||||||
|
* +- L4_PER - IPs...
|
||||||
|
* |
|
||||||
|
* +- L4_CFG -+- L4_WKUP - IPs...
|
||||||
|
* | |
|
||||||
|
* | +- IPs...
|
||||||
|
* +- IPU ----+
|
||||||
|
* | |
|
||||||
|
* +- DSP ----+
|
||||||
|
* | |
|
||||||
|
* +- DSS ----+
|
||||||
|
*
|
||||||
|
* Since that will not bring real advantage to represent that in DT for
|
||||||
|
* the moment, just use a fake OCP bus entry to represent the whole bus
|
||||||
|
* hierarchy.
|
||||||
|
*/
|
||||||
|
ocp {
|
||||||
|
compatible = "ti,omap4-l3-noc", "simple-bus";
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <1>;
|
||||||
|
ranges;
|
||||||
|
ti,hwmods = "l3_main_1", "l3_main_2", "l3_main_3";
|
||||||
|
|
||||||
|
gic: interrupt-controller@48241000 {
|
||||||
|
compatible = "arm,cortex-a9-gic";
|
||||||
|
interrupt-controller;
|
||||||
|
#interrupt-cells = <1>;
|
||||||
|
reg = <0x48241000 0x1000>,
|
||||||
|
<0x48240100 0x0100>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
@@ -106,9 +106,13 @@ comment "OMAP Board Type"
|
|||||||
depends on ARCH_OMAP2PLUS
|
depends on ARCH_OMAP2PLUS
|
||||||
|
|
||||||
config MACH_OMAP_GENERIC
|
config MACH_OMAP_GENERIC
|
||||||
bool "Generic OMAP board"
|
bool "Generic OMAP2+ board"
|
||||||
depends on ARCH_OMAP2
|
depends on ARCH_OMAP2PLUS
|
||||||
|
select USE_OF
|
||||||
default y
|
default y
|
||||||
|
help
|
||||||
|
Support for generic TI OMAP2+ boards using Flattened Device Tree.
|
||||||
|
More information at Documentation/devicetree
|
||||||
|
|
||||||
config MACH_OMAP2_TUSB6010
|
config MACH_OMAP2_TUSB6010
|
||||||
bool
|
bool
|
||||||
|
@@ -1,76 +1,154 @@
|
|||||||
/*
|
/*
|
||||||
* linux/arch/arm/mach-omap2/board-generic.c
|
|
||||||
*
|
|
||||||
* Copyright (C) 2005 Nokia Corporation
|
* Copyright (C) 2005 Nokia Corporation
|
||||||
* Author: Paul Mundt <paul.mundt@nokia.com>
|
* Author: Paul Mundt <paul.mundt@nokia.com>
|
||||||
*
|
*
|
||||||
* Modified from mach-omap/omap1/board-generic.c
|
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
|
||||||
*
|
*
|
||||||
* Code for generic OMAP2 board. Should work on many OMAP2 systems where
|
* Modified from the original mach-omap/omap2/board-generic.c did by Paul
|
||||||
* the bootloader passes the board-specific data to the kernel.
|
* to support the OMAP2+ device tree boards with an unique board file.
|
||||||
* Do not put any board specific code to this file; create a new machine
|
|
||||||
* type if you need custom low-level initializations.
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
* published by the Free Software Foundation.
|
* published by the Free Software Foundation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/kernel.h>
|
#include <linux/io.h>
|
||||||
#include <linux/init.h>
|
#include <linux/of_platform.h>
|
||||||
#include <linux/device.h>
|
#include <linux/irqdomain.h>
|
||||||
|
#include <linux/i2c/twl.h>
|
||||||
|
|
||||||
#include <mach/hardware.h>
|
#include <mach/hardware.h>
|
||||||
#include <asm/mach-types.h>
|
|
||||||
#include <asm/mach/arch.h>
|
#include <asm/mach/arch.h>
|
||||||
#include <asm/mach/map.h>
|
|
||||||
|
|
||||||
#include <mach/gpio.h>
|
|
||||||
#include <plat/usb.h>
|
|
||||||
#include <plat/board.h>
|
#include <plat/board.h>
|
||||||
#include <plat/common.h>
|
#include <plat/common.h>
|
||||||
|
#include <mach/omap4-common.h>
|
||||||
|
#include "common-board-devices.h"
|
||||||
|
|
||||||
static struct omap_board_config_kernel generic_config[] = {
|
/*
|
||||||
|
* XXX: Still needed to boot until the i2c & twl driver is adapted to
|
||||||
|
* device-tree
|
||||||
|
*/
|
||||||
|
static struct twl4030_platform_data sdp4430_twldata = {
|
||||||
|
.irq_base = TWL6030_IRQ_BASE,
|
||||||
|
.irq_end = TWL6030_IRQ_END,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void __init omap_generic_init_early(void)
|
static void __init omap4_i2c_init(void)
|
||||||
{
|
{
|
||||||
omap2_init_common_infrastructure();
|
omap4_pmic_init("twl6030", &sdp4430_twldata);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct twl4030_platform_data beagle_twldata = {
|
||||||
|
.irq_base = TWL4030_IRQ_BASE,
|
||||||
|
.irq_end = TWL4030_IRQ_END,
|
||||||
|
};
|
||||||
|
|
||||||
|
static void __init omap3_i2c_init(void)
|
||||||
|
{
|
||||||
|
omap3_pmic_init("twl4030", &beagle_twldata);
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct of_device_id omap_dt_match_table[] __initdata = {
|
||||||
|
{ .compatible = "simple-bus", },
|
||||||
|
{ .compatible = "ti,omap-infra", },
|
||||||
|
{ }
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct of_device_id intc_match[] __initdata = {
|
||||||
|
{ .compatible = "ti,omap3-intc", },
|
||||||
|
{ .compatible = "arm,cortex-a9-gic", },
|
||||||
|
{ }
|
||||||
|
};
|
||||||
|
|
||||||
static void __init omap_generic_init(void)
|
static void __init omap_generic_init(void)
|
||||||
{
|
{
|
||||||
|
struct device_node *node = of_find_matching_node(NULL, intc_match);
|
||||||
|
if (node)
|
||||||
|
irq_domain_add_simple(node, 0);
|
||||||
|
|
||||||
omap_serial_init();
|
omap_serial_init();
|
||||||
omap_sdrc_init(NULL, NULL);
|
omap_sdrc_init(NULL, NULL);
|
||||||
omap_board_config = generic_config;
|
|
||||||
omap_board_config_size = ARRAY_SIZE(generic_config);
|
of_platform_populate(NULL, omap_dt_match_table, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __init omap_generic_map_io(void)
|
static void __init omap4_init(void)
|
||||||
{
|
{
|
||||||
if (cpu_is_omap242x()) {
|
omap4_i2c_init();
|
||||||
omap2_set_globals_242x();
|
omap_generic_init();
|
||||||
omap242x_map_common_io();
|
|
||||||
} else if (cpu_is_omap243x()) {
|
|
||||||
omap2_set_globals_243x();
|
|
||||||
omap243x_map_common_io();
|
|
||||||
} else if (cpu_is_omap34xx()) {
|
|
||||||
omap2_set_globals_3xxx();
|
|
||||||
omap34xx_map_common_io();
|
|
||||||
} else if (cpu_is_omap44xx()) {
|
|
||||||
omap2_set_globals_443x();
|
|
||||||
omap44xx_map_common_io();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX This machine entry name should be updated */
|
static void __init omap3_init(void)
|
||||||
MACHINE_START(OMAP_GENERIC, "Generic OMAP24xx")
|
{
|
||||||
/* Maintainer: Paul Mundt <paul.mundt@nokia.com> */
|
omap3_i2c_init();
|
||||||
.boot_params = 0x80000100,
|
omap_generic_init();
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(CONFIG_SOC_OMAP2420)
|
||||||
|
static const char *omap242x_boards_compat[] __initdata = {
|
||||||
|
"ti,omap2420",
|
||||||
|
NULL,
|
||||||
|
};
|
||||||
|
|
||||||
|
DT_MACHINE_START(OMAP242X_DT, "Generic OMAP2420 (Flattened Device Tree)")
|
||||||
.reserve = omap_reserve,
|
.reserve = omap_reserve,
|
||||||
.map_io = omap_generic_map_io,
|
.map_io = omap242x_map_io,
|
||||||
.init_early = omap_generic_init_early,
|
.init_early = omap2420_init_early,
|
||||||
.init_irq = omap2_init_irq,
|
.init_irq = omap2_init_irq,
|
||||||
.init_machine = omap_generic_init,
|
.init_machine = omap_generic_init,
|
||||||
.timer = &omap2_timer,
|
.timer = &omap2_timer,
|
||||||
|
.dt_compat = omap242x_boards_compat,
|
||||||
MACHINE_END
|
MACHINE_END
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_SOC_OMAP2430)
|
||||||
|
static const char *omap243x_boards_compat[] __initdata = {
|
||||||
|
"ti,omap2430",
|
||||||
|
NULL,
|
||||||
|
};
|
||||||
|
|
||||||
|
DT_MACHINE_START(OMAP243X_DT, "Generic OMAP2430 (Flattened Device Tree)")
|
||||||
|
.reserve = omap_reserve,
|
||||||
|
.map_io = omap243x_map_io,
|
||||||
|
.init_early = omap2430_init_early,
|
||||||
|
.init_irq = omap2_init_irq,
|
||||||
|
.init_machine = omap_generic_init,
|
||||||
|
.timer = &omap2_timer,
|
||||||
|
.dt_compat = omap243x_boards_compat,
|
||||||
|
MACHINE_END
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_ARCH_OMAP3)
|
||||||
|
static const char *omap3_boards_compat[] __initdata = {
|
||||||
|
"ti,omap3",
|
||||||
|
NULL,
|
||||||
|
};
|
||||||
|
|
||||||
|
DT_MACHINE_START(OMAP3_DT, "Generic OMAP3 (Flattened Device Tree)")
|
||||||
|
.reserve = omap_reserve,
|
||||||
|
.map_io = omap3_map_io,
|
||||||
|
.init_early = omap3430_init_early,
|
||||||
|
.init_irq = omap3_init_irq,
|
||||||
|
.init_machine = omap3_init,
|
||||||
|
.timer = &omap3_timer,
|
||||||
|
.dt_compat = omap3_boards_compat,
|
||||||
|
MACHINE_END
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_ARCH_OMAP4)
|
||||||
|
static const char *omap4_boards_compat[] __initdata = {
|
||||||
|
"ti,omap4",
|
||||||
|
NULL,
|
||||||
|
};
|
||||||
|
|
||||||
|
DT_MACHINE_START(OMAP4_DT, "Generic OMAP4 (Flattened Device Tree)")
|
||||||
|
.reserve = omap_reserve,
|
||||||
|
.map_io = omap4_map_io,
|
||||||
|
.init_early = omap4430_init_early,
|
||||||
|
.init_irq = gic_init_irq,
|
||||||
|
.init_machine = omap4_init,
|
||||||
|
.timer = &omap4_timer,
|
||||||
|
.dt_compat = omap4_boards_compat,
|
||||||
|
MACHINE_END
|
||||||
|
#endif
|
||||||
|
@@ -486,8 +486,8 @@ static void __init beagle_opp_init(void)
|
|||||||
if (cpu_is_omap3630()) {
|
if (cpu_is_omap3630()) {
|
||||||
struct device *mpu_dev, *iva_dev;
|
struct device *mpu_dev, *iva_dev;
|
||||||
|
|
||||||
mpu_dev = omap2_get_mpuss_device();
|
mpu_dev = omap_device_get_by_hwmod_name("mpu");
|
||||||
iva_dev = omap2_get_iva_device();
|
iva_dev = omap_device_get_by_hwmod_name("iva");
|
||||||
|
|
||||||
if (!mpu_dev || !iva_dev) {
|
if (!mpu_dev || !iva_dev) {
|
||||||
pr_err("%s: Aiee.. no mpu/dsp devices? %p %p\n",
|
pr_err("%s: Aiee.. no mpu/dsp devices? %p %p\n",
|
||||||
|
@@ -16,6 +16,7 @@
|
|||||||
#include <linux/clk.h>
|
#include <linux/clk.h>
|
||||||
#include <linux/err.h>
|
#include <linux/err.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
|
#include <linux/of.h>
|
||||||
|
|
||||||
#include <mach/hardware.h>
|
#include <mach/hardware.h>
|
||||||
#include <mach/irqs.h>
|
#include <mach/irqs.h>
|
||||||
@@ -77,6 +78,10 @@ static int __init omap4_l3_init(void)
|
|||||||
struct platform_device *pdev;
|
struct platform_device *pdev;
|
||||||
char oh_name[L3_MODULES_MAX_LEN];
|
char oh_name[L3_MODULES_MAX_LEN];
|
||||||
|
|
||||||
|
/* If dtb is there, the devices will be created dynamically */
|
||||||
|
if (of_have_populated_dt())
|
||||||
|
return -ENODEV;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* To avoid code running on other OMAPs in
|
* To avoid code running on other OMAPs in
|
||||||
* multi-omap builds
|
* multi-omap builds
|
||||||
@@ -221,14 +226,6 @@ static inline void omap_init_camera(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
struct omap_device_pm_latency omap_keyboard_latency[] = {
|
|
||||||
{
|
|
||||||
.deactivate_func = omap_device_idle_hwmods,
|
|
||||||
.activate_func = omap_device_enable_hwmods,
|
|
||||||
.flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
int __init omap4_keyboard_init(struct omap4_keypad_platform_data
|
int __init omap4_keyboard_init(struct omap4_keypad_platform_data
|
||||||
*sdp4430_keypad_data, struct omap_board_data *bdata)
|
*sdp4430_keypad_data, struct omap_board_data *bdata)
|
||||||
{
|
{
|
||||||
@@ -248,9 +245,7 @@ int __init omap4_keyboard_init(struct omap4_keypad_platform_data
|
|||||||
keypad_data = sdp4430_keypad_data;
|
keypad_data = sdp4430_keypad_data;
|
||||||
|
|
||||||
pdev = omap_device_build(name, id, oh, keypad_data,
|
pdev = omap_device_build(name, id, oh, keypad_data,
|
||||||
sizeof(struct omap4_keypad_platform_data),
|
sizeof(struct omap4_keypad_platform_data), NULL, 0, 0);
|
||||||
omap_keyboard_latency,
|
|
||||||
ARRAY_SIZE(omap_keyboard_latency), 0);
|
|
||||||
|
|
||||||
if (IS_ERR(pdev)) {
|
if (IS_ERR(pdev)) {
|
||||||
WARN(1, "Can't build omap_device for %s:%s.\n",
|
WARN(1, "Can't build omap_device for %s:%s.\n",
|
||||||
@@ -263,14 +258,6 @@ int __init omap4_keyboard_init(struct omap4_keypad_platform_data
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
|
#if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
|
||||||
static struct omap_device_pm_latency mbox_latencies[] = {
|
|
||||||
[0] = {
|
|
||||||
.activate_func = omap_device_enable_hwmods,
|
|
||||||
.deactivate_func = omap_device_idle_hwmods,
|
|
||||||
.flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline void omap_init_mbox(void)
|
static inline void omap_init_mbox(void)
|
||||||
{
|
{
|
||||||
struct omap_hwmod *oh;
|
struct omap_hwmod *oh;
|
||||||
@@ -282,8 +269,7 @@ static inline void omap_init_mbox(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pdev = omap_device_build("omap-mailbox", -1, oh, NULL, 0,
|
pdev = omap_device_build("omap-mailbox", -1, oh, NULL, 0, NULL, 0, 0);
|
||||||
mbox_latencies, ARRAY_SIZE(mbox_latencies), 0);
|
|
||||||
WARN(IS_ERR(pdev), "%s: could not build device, err %ld\n",
|
WARN(IS_ERR(pdev), "%s: could not build device, err %ld\n",
|
||||||
__func__, PTR_ERR(pdev));
|
__func__, PTR_ERR(pdev));
|
||||||
}
|
}
|
||||||
@@ -334,14 +320,6 @@ static inline void omap_init_audio(void) {}
|
|||||||
|
|
||||||
#include <plat/mcspi.h>
|
#include <plat/mcspi.h>
|
||||||
|
|
||||||
struct omap_device_pm_latency omap_mcspi_latency[] = {
|
|
||||||
[0] = {
|
|
||||||
.deactivate_func = omap_device_idle_hwmods,
|
|
||||||
.activate_func = omap_device_enable_hwmods,
|
|
||||||
.flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
static int omap_mcspi_init(struct omap_hwmod *oh, void *unused)
|
static int omap_mcspi_init(struct omap_hwmod *oh, void *unused)
|
||||||
{
|
{
|
||||||
struct platform_device *pdev;
|
struct platform_device *pdev;
|
||||||
@@ -372,8 +350,7 @@ static int omap_mcspi_init(struct omap_hwmod *oh, void *unused)
|
|||||||
|
|
||||||
spi_num++;
|
spi_num++;
|
||||||
pdev = omap_device_build(name, spi_num, oh, pdata,
|
pdev = omap_device_build(name, spi_num, oh, pdata,
|
||||||
sizeof(*pdata), omap_mcspi_latency,
|
sizeof(*pdata), NULL, 0, 0);
|
||||||
ARRAY_SIZE(omap_mcspi_latency), 0);
|
|
||||||
WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s\n",
|
WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s\n",
|
||||||
name, oh->name);
|
name, oh->name);
|
||||||
kfree(pdata);
|
kfree(pdata);
|
||||||
@@ -698,14 +675,6 @@ static int __init omap2_init_devices(void)
|
|||||||
arch_initcall(omap2_init_devices);
|
arch_initcall(omap2_init_devices);
|
||||||
|
|
||||||
#if defined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE)
|
#if defined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE)
|
||||||
static struct omap_device_pm_latency omap_wdt_latency[] = {
|
|
||||||
[0] = {
|
|
||||||
.deactivate_func = omap_device_idle_hwmods,
|
|
||||||
.activate_func = omap_device_enable_hwmods,
|
|
||||||
.flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
static int __init omap_init_wdt(void)
|
static int __init omap_init_wdt(void)
|
||||||
{
|
{
|
||||||
int id = -1;
|
int id = -1;
|
||||||
@@ -723,9 +692,7 @@ static int __init omap_init_wdt(void)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pdev = omap_device_build(dev_name, id, oh, NULL, 0,
|
pdev = omap_device_build(dev_name, id, oh, NULL, 0, NULL, 0, 0);
|
||||||
omap_wdt_latency,
|
|
||||||
ARRAY_SIZE(omap_wdt_latency), 0);
|
|
||||||
WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s.\n",
|
WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s.\n",
|
||||||
dev_name, oh->name);
|
dev_name, oh->name);
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -35,14 +35,6 @@ static struct platform_device omap_display_device = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct omap_device_pm_latency omap_dss_latency[] = {
|
|
||||||
[0] = {
|
|
||||||
.deactivate_func = omap_device_idle_hwmods,
|
|
||||||
.activate_func = omap_device_enable_hwmods,
|
|
||||||
.flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
struct omap_dss_hwmod_data {
|
struct omap_dss_hwmod_data {
|
||||||
const char *oh_name;
|
const char *oh_name;
|
||||||
const char *dev_name;
|
const char *dev_name;
|
||||||
@@ -111,8 +103,7 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
|
|||||||
pdev = omap_device_build(curr_dss_hwmod[i].dev_name,
|
pdev = omap_device_build(curr_dss_hwmod[i].dev_name,
|
||||||
curr_dss_hwmod[i].id, oh, &pdata,
|
curr_dss_hwmod[i].id, oh, &pdata,
|
||||||
sizeof(struct omap_display_platform_data),
|
sizeof(struct omap_display_platform_data),
|
||||||
omap_dss_latency,
|
NULL, 0, 0);
|
||||||
ARRAY_SIZE(omap_dss_latency), 0);
|
|
||||||
|
|
||||||
if (WARN((IS_ERR(pdev)), "Could not build omap_device for %s\n",
|
if (WARN((IS_ERR(pdev)), "Could not build omap_device for %s\n",
|
||||||
curr_dss_hwmod[i].oh_name))
|
curr_dss_hwmod[i].oh_name))
|
||||||
|
@@ -87,14 +87,6 @@ static u16 reg_map[] = {
|
|||||||
[CCDN] = 0xd8,
|
[CCDN] = 0xd8,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct omap_device_pm_latency omap2_dma_latency[] = {
|
|
||||||
{
|
|
||||||
.deactivate_func = omap_device_idle_hwmods,
|
|
||||||
.activate_func = omap_device_enable_hwmods,
|
|
||||||
.flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
static void __iomem *dma_base;
|
static void __iomem *dma_base;
|
||||||
static inline void dma_write(u32 val, int reg, int lch)
|
static inline void dma_write(u32 val, int reg, int lch)
|
||||||
{
|
{
|
||||||
@@ -258,8 +250,7 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
|
|||||||
|
|
||||||
p->errata = configure_dma_errata();
|
p->errata = configure_dma_errata();
|
||||||
|
|
||||||
pdev = omap_device_build(name, 0, oh, p, sizeof(*p),
|
pdev = omap_device_build(name, 0, oh, p, sizeof(*p), NULL, 0, 0);
|
||||||
omap2_dma_latency, ARRAY_SIZE(omap2_dma_latency), 0);
|
|
||||||
kfree(p);
|
kfree(p);
|
||||||
if (IS_ERR(pdev)) {
|
if (IS_ERR(pdev)) {
|
||||||
pr_err("%s: Can't build omap_device for %s:%s.\n",
|
pr_err("%s: Can't build omap_device for %s:%s.\n",
|
||||||
|
@@ -24,14 +24,6 @@
|
|||||||
#include <plat/omap_hwmod.h>
|
#include <plat/omap_hwmod.h>
|
||||||
#include <plat/omap_device.h>
|
#include <plat/omap_device.h>
|
||||||
|
|
||||||
static struct omap_device_pm_latency omap_gpio_latency[] = {
|
|
||||||
[0] = {
|
|
||||||
.deactivate_func = omap_device_idle_hwmods,
|
|
||||||
.activate_func = omap_device_enable_hwmods,
|
|
||||||
.flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
|
static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
|
||||||
{
|
{
|
||||||
struct platform_device *pdev;
|
struct platform_device *pdev;
|
||||||
@@ -108,9 +100,7 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
|
|||||||
}
|
}
|
||||||
|
|
||||||
pdev = omap_device_build(name, id - 1, oh, pdata,
|
pdev = omap_device_build(name, id - 1, oh, pdata,
|
||||||
sizeof(*pdata), omap_gpio_latency,
|
sizeof(*pdata), NULL, 0, false);
|
||||||
ARRAY_SIZE(omap_gpio_latency),
|
|
||||||
false);
|
|
||||||
kfree(pdata);
|
kfree(pdata);
|
||||||
|
|
||||||
if (IS_ERR(pdev)) {
|
if (IS_ERR(pdev)) {
|
||||||
|
@@ -409,31 +409,17 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct omap_device_pm_latency omap_hsmmc_latency[] = {
|
|
||||||
[0] = {
|
|
||||||
.deactivate_func = omap_device_idle_hwmods,
|
|
||||||
.activate_func = omap_device_enable_hwmods,
|
|
||||||
.flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
|
|
||||||
},
|
|
||||||
/*
|
|
||||||
* XXX There should also be an entry here to power off/on the
|
|
||||||
* MMC regulators/PBIAS cells, etc.
|
|
||||||
*/
|
|
||||||
};
|
|
||||||
|
|
||||||
#define MAX_OMAP_MMC_HWMOD_NAME_LEN 16
|
#define MAX_OMAP_MMC_HWMOD_NAME_LEN 16
|
||||||
|
|
||||||
void __init omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr)
|
void __init omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr)
|
||||||
{
|
{
|
||||||
struct omap_hwmod *oh;
|
struct omap_hwmod *oh;
|
||||||
struct platform_device *pdev;
|
struct platform_device *pdev;
|
||||||
struct omap_device_pm_latency *ohl;
|
|
||||||
char oh_name[MAX_OMAP_MMC_HWMOD_NAME_LEN];
|
char oh_name[MAX_OMAP_MMC_HWMOD_NAME_LEN];
|
||||||
struct omap_mmc_platform_data *mmc_data;
|
struct omap_mmc_platform_data *mmc_data;
|
||||||
struct omap_mmc_dev_attr *mmc_dev_attr;
|
struct omap_mmc_dev_attr *mmc_dev_attr;
|
||||||
char *name;
|
char *name;
|
||||||
int l;
|
int l;
|
||||||
int ohl_cnt = 0;
|
|
||||||
|
|
||||||
mmc_data = kzalloc(sizeof(struct omap_mmc_platform_data), GFP_KERNEL);
|
mmc_data = kzalloc(sizeof(struct omap_mmc_platform_data), GFP_KERNEL);
|
||||||
if (!mmc_data) {
|
if (!mmc_data) {
|
||||||
@@ -448,8 +434,6 @@ void __init omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr)
|
|||||||
omap_hsmmc_mux(mmc_data, (ctrl_nr - 1));
|
omap_hsmmc_mux(mmc_data, (ctrl_nr - 1));
|
||||||
|
|
||||||
name = "omap_hsmmc";
|
name = "omap_hsmmc";
|
||||||
ohl = omap_hsmmc_latency;
|
|
||||||
ohl_cnt = ARRAY_SIZE(omap_hsmmc_latency);
|
|
||||||
|
|
||||||
l = snprintf(oh_name, MAX_OMAP_MMC_HWMOD_NAME_LEN,
|
l = snprintf(oh_name, MAX_OMAP_MMC_HWMOD_NAME_LEN,
|
||||||
"mmc%d", ctrl_nr);
|
"mmc%d", ctrl_nr);
|
||||||
@@ -468,7 +452,7 @@ void __init omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
pdev = omap_device_build(name, ctrl_nr - 1, oh, mmc_data,
|
pdev = omap_device_build(name, ctrl_nr - 1, oh, mmc_data,
|
||||||
sizeof(struct omap_mmc_platform_data), ohl, ohl_cnt, false);
|
sizeof(struct omap_mmc_platform_data), NULL, 0, false);
|
||||||
if (IS_ERR(pdev)) {
|
if (IS_ERR(pdev)) {
|
||||||
WARN(1, "Can't build omap_device for %s:%s.\n", name, oh->name);
|
WARN(1, "Can't build omap_device for %s:%s.\n", name, oh->name);
|
||||||
kfree(mmc_data->slots[0].name);
|
kfree(mmc_data->slots[0].name);
|
||||||
|
@@ -23,14 +23,6 @@
|
|||||||
#include <plat/omap_hwmod.h>
|
#include <plat/omap_hwmod.h>
|
||||||
#include <plat/omap_device.h>
|
#include <plat/omap_device.h>
|
||||||
|
|
||||||
struct omap_device_pm_latency omap_spinlock_latency[] = {
|
|
||||||
{
|
|
||||||
.deactivate_func = omap_device_idle_hwmods,
|
|
||||||
.activate_func = omap_device_enable_hwmods,
|
|
||||||
.flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
int __init hwspinlocks_init(void)
|
int __init hwspinlocks_init(void)
|
||||||
{
|
{
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
@@ -48,9 +40,7 @@ int __init hwspinlocks_init(void)
|
|||||||
if (oh == NULL)
|
if (oh == NULL)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
pdev = omap_device_build(dev_name, 0, oh, NULL, 0,
|
pdev = omap_device_build(dev_name, 0, oh, NULL, 0, NULL, 0, false);
|
||||||
omap_spinlock_latency,
|
|
||||||
ARRAY_SIZE(omap_spinlock_latency), false);
|
|
||||||
if (IS_ERR(pdev)) {
|
if (IS_ERR(pdev)) {
|
||||||
pr_err("Can't build omap_device for %s:%s\n", dev_name,
|
pr_err("Can't build omap_device for %s:%s\n", dev_name,
|
||||||
oh_name);
|
oh_name);
|
||||||
|
@@ -122,14 +122,6 @@ static int omap3_enable_st_clock(unsigned int id, bool enable)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct omap_device_pm_latency omap2_mcbsp_latency[] = {
|
|
||||||
{
|
|
||||||
.deactivate_func = omap_device_idle_hwmods,
|
|
||||||
.activate_func = omap_device_enable_hwmods,
|
|
||||||
.flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
|
static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
|
||||||
{
|
{
|
||||||
int id, count = 1;
|
int id, count = 1;
|
||||||
@@ -175,8 +167,7 @@ static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
|
|||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
pdev = omap_device_build_ss(name, id, oh_device, count, pdata,
|
pdev = omap_device_build_ss(name, id, oh_device, count, pdata,
|
||||||
sizeof(*pdata), omap2_mcbsp_latency,
|
sizeof(*pdata), NULL, 0, false);
|
||||||
ARRAY_SIZE(omap2_mcbsp_latency), false);
|
|
||||||
kfree(pdata);
|
kfree(pdata);
|
||||||
if (IS_ERR(pdev)) {
|
if (IS_ERR(pdev)) {
|
||||||
pr_err("%s: Can't build omap_device for %s:%s.\n", __func__,
|
pr_err("%s: Can't build omap_device for %s:%s.\n", __func__,
|
||||||
|
@@ -127,7 +127,7 @@ static irqreturn_t l3_interrupt_handler(int irq, void *_l3)
|
|||||||
return IRQ_HANDLED;
|
return IRQ_HANDLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __init omap4_l3_probe(struct platform_device *pdev)
|
static int __devinit omap4_l3_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
static struct omap4_l3 *l3;
|
static struct omap4_l3 *l3;
|
||||||
struct resource *res;
|
struct resource *res;
|
||||||
@@ -218,7 +218,7 @@ err0:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __exit omap4_l3_remove(struct platform_device *pdev)
|
static int __devexit omap4_l3_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct omap4_l3 *l3 = platform_get_drvdata(pdev);
|
struct omap4_l3 *l3 = platform_get_drvdata(pdev);
|
||||||
|
|
||||||
@@ -232,16 +232,29 @@ static int __exit omap4_l3_remove(struct platform_device *pdev)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(CONFIG_OF)
|
||||||
|
static const struct of_device_id l3_noc_match[] = {
|
||||||
|
{.compatible = "ti,omap4-l3-noc", },
|
||||||
|
{},
|
||||||
|
}
|
||||||
|
MODULE_DEVICE_TABLE(of, l3_noc_match);
|
||||||
|
#else
|
||||||
|
#define l3_noc_match NULL
|
||||||
|
#endif
|
||||||
|
|
||||||
static struct platform_driver omap4_l3_driver = {
|
static struct platform_driver omap4_l3_driver = {
|
||||||
.remove = __exit_p(omap4_l3_remove),
|
.probe = omap4_l3_probe,
|
||||||
.driver = {
|
.remove = __devexit_p(omap4_l3_remove),
|
||||||
.name = "omap_l3_noc",
|
.driver = {
|
||||||
|
.name = "omap_l3_noc",
|
||||||
|
.owner = THIS_MODULE,
|
||||||
|
.of_match_table = l3_noc_match,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static int __init omap4_l3_init(void)
|
static int __init omap4_l3_init(void)
|
||||||
{
|
{
|
||||||
return platform_driver_probe(&omap4_l3_driver, omap4_l3_probe);
|
return platform_driver_register(&omap4_l3_driver);
|
||||||
}
|
}
|
||||||
postcore_initcall_sync(omap4_l3_init);
|
postcore_initcall_sync(omap4_l3_init);
|
||||||
|
|
||||||
|
@@ -26,38 +26,7 @@
|
|||||||
|
|
||||||
static struct omap_device_pm_latency *pm_lats;
|
static struct omap_device_pm_latency *pm_lats;
|
||||||
|
|
||||||
static struct device *mpu_dev;
|
static int _init_omap_device(char *name)
|
||||||
static struct device *iva_dev;
|
|
||||||
static struct device *l3_dev;
|
|
||||||
static struct device *dsp_dev;
|
|
||||||
|
|
||||||
struct device *omap2_get_mpuss_device(void)
|
|
||||||
{
|
|
||||||
WARN_ON_ONCE(!mpu_dev);
|
|
||||||
return mpu_dev;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct device *omap2_get_iva_device(void)
|
|
||||||
{
|
|
||||||
WARN_ON_ONCE(!iva_dev);
|
|
||||||
return iva_dev;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct device *omap2_get_l3_device(void)
|
|
||||||
{
|
|
||||||
WARN_ON_ONCE(!l3_dev);
|
|
||||||
return l3_dev;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct device *omap4_get_dsp_device(void)
|
|
||||||
{
|
|
||||||
WARN_ON_ONCE(!dsp_dev);
|
|
||||||
return dsp_dev;
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL(omap4_get_dsp_device);
|
|
||||||
|
|
||||||
/* static int _init_omap_device(struct omap_hwmod *oh, void *user) */
|
|
||||||
static int _init_omap_device(char *name, struct device **new_dev)
|
|
||||||
{
|
{
|
||||||
struct omap_hwmod *oh;
|
struct omap_hwmod *oh;
|
||||||
struct platform_device *pdev;
|
struct platform_device *pdev;
|
||||||
@@ -72,8 +41,6 @@ static int _init_omap_device(char *name, struct device **new_dev)
|
|||||||
__func__, name))
|
__func__, name))
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
*new_dev = &pdev->dev;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,16 +49,16 @@ static int _init_omap_device(char *name, struct device **new_dev)
|
|||||||
*/
|
*/
|
||||||
static void omap2_init_processor_devices(void)
|
static void omap2_init_processor_devices(void)
|
||||||
{
|
{
|
||||||
_init_omap_device("mpu", &mpu_dev);
|
_init_omap_device("mpu");
|
||||||
if (omap3_has_iva())
|
if (omap3_has_iva())
|
||||||
_init_omap_device("iva", &iva_dev);
|
_init_omap_device("iva");
|
||||||
|
|
||||||
if (cpu_is_omap44xx()) {
|
if (cpu_is_omap44xx()) {
|
||||||
_init_omap_device("l3_main_1", &l3_dev);
|
_init_omap_device("l3_main_1");
|
||||||
_init_omap_device("dsp", &dsp_dev);
|
_init_omap_device("dsp");
|
||||||
_init_omap_device("iva", &iva_dev);
|
_init_omap_device("iva");
|
||||||
} else {
|
} else {
|
||||||
_init_omap_device("l3_main", &l3_dev);
|
_init_omap_device("l3_main");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,18 +136,26 @@ err:
|
|||||||
* in the opp entry
|
* in the opp entry
|
||||||
*/
|
*/
|
||||||
static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name,
|
static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name,
|
||||||
struct device *dev)
|
const char *oh_name)
|
||||||
{
|
{
|
||||||
struct voltagedomain *voltdm;
|
struct voltagedomain *voltdm;
|
||||||
struct clk *clk;
|
struct clk *clk;
|
||||||
struct opp *opp;
|
struct opp *opp;
|
||||||
unsigned long freq, bootup_volt;
|
unsigned long freq, bootup_volt;
|
||||||
|
struct device *dev;
|
||||||
|
|
||||||
if (!vdd_name || !clk_name || !dev) {
|
if (!vdd_name || !clk_name || !oh_name) {
|
||||||
pr_err("%s: invalid parameters\n", __func__);
|
pr_err("%s: invalid parameters\n", __func__);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dev = omap_device_get_by_hwmod_name(oh_name);
|
||||||
|
if (IS_ERR(dev)) {
|
||||||
|
pr_err("%s: Unable to get dev pointer for hwmod %s\n",
|
||||||
|
__func__, oh_name);
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
voltdm = voltdm_lookup(vdd_name);
|
voltdm = voltdm_lookup(vdd_name);
|
||||||
if (IS_ERR(voltdm)) {
|
if (IS_ERR(voltdm)) {
|
||||||
pr_err("%s: unable to get vdd pointer for vdd_%s\n",
|
pr_err("%s: unable to get vdd pointer for vdd_%s\n",
|
||||||
@@ -224,8 +199,8 @@ static void __init omap3_init_voltages(void)
|
|||||||
if (!cpu_is_omap34xx())
|
if (!cpu_is_omap34xx())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
omap2_set_init_voltage("mpu_iva", "dpll1_ck", mpu_dev);
|
omap2_set_init_voltage("mpu_iva", "dpll1_ck", "mpu");
|
||||||
omap2_set_init_voltage("core", "l3_ick", l3_dev);
|
omap2_set_init_voltage("core", "l3_ick", "l3_main");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __init omap4_init_voltages(void)
|
static void __init omap4_init_voltages(void)
|
||||||
@@ -233,14 +208,15 @@ static void __init omap4_init_voltages(void)
|
|||||||
if (!cpu_is_omap44xx())
|
if (!cpu_is_omap44xx())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
omap2_set_init_voltage("mpu", "dpll_mpu_ck", mpu_dev);
|
omap2_set_init_voltage("mpu", "dpll_mpu_ck", "mpu");
|
||||||
omap2_set_init_voltage("core", "l3_div_ck", l3_dev);
|
omap2_set_init_voltage("core", "l3_div_ck", "l3_main_1");
|
||||||
omap2_set_init_voltage("iva", "dpll_iva_m5x2_ck", iva_dev);
|
omap2_set_init_voltage("iva", "dpll_iva_m5x2_ck", "iva");
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __init omap2_common_pm_init(void)
|
static int __init omap2_common_pm_init(void)
|
||||||
{
|
{
|
||||||
omap2_init_processor_devices();
|
if (!of_have_populated_dt())
|
||||||
|
omap2_init_processor_devices();
|
||||||
omap_pm_if_init();
|
omap_pm_if_init();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -107,28 +107,6 @@ struct omap_uart_state {
|
|||||||
static LIST_HEAD(uart_list);
|
static LIST_HEAD(uart_list);
|
||||||
static u8 num_uarts;
|
static u8 num_uarts;
|
||||||
|
|
||||||
static int uart_idle_hwmod(struct omap_device *od)
|
|
||||||
{
|
|
||||||
omap_hwmod_idle(od->hwmods[0]);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int uart_enable_hwmod(struct omap_device *od)
|
|
||||||
{
|
|
||||||
omap_hwmod_enable(od->hwmods[0]);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct omap_device_pm_latency omap_uart_latency[] = {
|
|
||||||
{
|
|
||||||
.deactivate_func = uart_idle_hwmod,
|
|
||||||
.activate_func = uart_enable_hwmod,
|
|
||||||
.flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline unsigned int __serial_read_reg(struct uart_port *up,
|
static inline unsigned int __serial_read_reg(struct uart_port *up,
|
||||||
int offset)
|
int offset)
|
||||||
{
|
{
|
||||||
@@ -800,8 +778,7 @@ void __init omap_serial_init_port(struct omap_board_data *bdata)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
pdev = omap_device_build(name, uart->num, oh, pdata, pdata_size,
|
pdev = omap_device_build(name, uart->num, oh, pdata, pdata_size,
|
||||||
omap_uart_latency,
|
NULL, 0, false);
|
||||||
ARRAY_SIZE(omap_uart_latency), false);
|
|
||||||
WARN(IS_ERR(pdev), "Could not build omap_device for %s: %s.\n",
|
WARN(IS_ERR(pdev), "Could not build omap_device for %s: %s.\n",
|
||||||
name, oh->name);
|
name, oh->name);
|
||||||
|
|
||||||
|
@@ -31,14 +31,6 @@
|
|||||||
|
|
||||||
static bool sr_enable_on_init;
|
static bool sr_enable_on_init;
|
||||||
|
|
||||||
static struct omap_device_pm_latency omap_sr_latency[] = {
|
|
||||||
{
|
|
||||||
.deactivate_func = omap_device_idle_hwmods,
|
|
||||||
.activate_func = omap_device_enable_hwmods,
|
|
||||||
.flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Read EFUSE values from control registers for OMAP3430 */
|
/* Read EFUSE values from control registers for OMAP3430 */
|
||||||
static void __init sr_set_nvalues(struct omap_volt_data *volt_data,
|
static void __init sr_set_nvalues(struct omap_volt_data *volt_data,
|
||||||
struct omap_sr_data *sr_data)
|
struct omap_sr_data *sr_data)
|
||||||
@@ -121,8 +113,7 @@ static int sr_dev_init(struct omap_hwmod *oh, void *user)
|
|||||||
sr_data->enable_on_init = sr_enable_on_init;
|
sr_data->enable_on_init = sr_enable_on_init;
|
||||||
|
|
||||||
pdev = omap_device_build(name, i, oh, sr_data, sizeof(*sr_data),
|
pdev = omap_device_build(name, i, oh, sr_data, sizeof(*sr_data),
|
||||||
omap_sr_latency,
|
NULL, 0, 0);
|
||||||
ARRAY_SIZE(omap_sr_latency), 0);
|
|
||||||
if (IS_ERR(pdev))
|
if (IS_ERR(pdev))
|
||||||
pr_warning("%s: Could not build omap_device for %s: %s.\n\n",
|
pr_warning("%s: Could not build omap_device for %s: %s.\n\n",
|
||||||
__func__, name, oh->name);
|
__func__, name, oh->name);
|
||||||
|
@@ -60,14 +60,6 @@ static struct musb_hdrc_platform_data musb_plat = {
|
|||||||
|
|
||||||
static u64 musb_dmamask = DMA_BIT_MASK(32);
|
static u64 musb_dmamask = DMA_BIT_MASK(32);
|
||||||
|
|
||||||
static struct omap_device_pm_latency omap_musb_latency[] = {
|
|
||||||
{
|
|
||||||
.deactivate_func = omap_device_idle_hwmods,
|
|
||||||
.activate_func = omap_device_enable_hwmods,
|
|
||||||
.flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
static void usb_musb_mux_init(struct omap_musb_board_data *board_data)
|
static void usb_musb_mux_init(struct omap_musb_board_data *board_data)
|
||||||
{
|
{
|
||||||
switch (board_data->interface_type) {
|
switch (board_data->interface_type) {
|
||||||
@@ -150,8 +142,7 @@ void __init usb_musb_init(struct omap_musb_board_data *musb_board_data)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
pdev = omap_device_build(name, bus_id, oh, &musb_plat,
|
pdev = omap_device_build(name, bus_id, oh, &musb_plat,
|
||||||
sizeof(musb_plat), omap_musb_latency,
|
sizeof(musb_plat), NULL, 0, false);
|
||||||
ARRAY_SIZE(omap_musb_latency), false);
|
|
||||||
if (IS_ERR(pdev)) {
|
if (IS_ERR(pdev)) {
|
||||||
pr_err("Could not build omap_device for %s %s\n",
|
pr_err("Could not build omap_device for %s %s\n",
|
||||||
name, oh_name);
|
name, oh_name);
|
||||||
|
@@ -123,14 +123,6 @@ static void omap_pm_set_max_mpu_wakeup_lat_compat(struct device *dev, long t)
|
|||||||
omap_pm_set_max_mpu_wakeup_lat(dev, t);
|
omap_pm_set_max_mpu_wakeup_lat(dev, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct omap_device_pm_latency omap_i2c_latency[] = {
|
|
||||||
[0] = {
|
|
||||||
.deactivate_func = omap_device_idle_hwmods,
|
|
||||||
.activate_func = omap_device_enable_hwmods,
|
|
||||||
.flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline int omap2_i2c_add_bus(int bus_id)
|
static inline int omap2_i2c_add_bus(int bus_id)
|
||||||
{
|
{
|
||||||
int l;
|
int l;
|
||||||
@@ -162,7 +154,7 @@ static inline int omap2_i2c_add_bus(int bus_id)
|
|||||||
pdata->set_mpu_wkup_lat = omap_pm_set_max_mpu_wakeup_lat_compat;
|
pdata->set_mpu_wkup_lat = omap_pm_set_max_mpu_wakeup_lat_compat;
|
||||||
pdev = omap_device_build(name, bus_id, oh, pdata,
|
pdev = omap_device_build(name, bus_id, oh, pdata,
|
||||||
sizeof(struct omap_i2c_bus_platform_data),
|
sizeof(struct omap_i2c_bus_platform_data),
|
||||||
omap_i2c_latency, ARRAY_SIZE(omap_i2c_latency), 0);
|
NULL, 0, 0);
|
||||||
WARN(IS_ERR(pdev), "Could not build omap_device for %s\n", name);
|
WARN(IS_ERR(pdev), "Could not build omap_device for %s\n", name);
|
||||||
|
|
||||||
return PTR_ERR(pdev);
|
return PTR_ERR(pdev);
|
||||||
|
@@ -101,6 +101,7 @@ struct platform_device *omap_device_build_ss(const char *pdev_name, int pdev_id,
|
|||||||
int pm_lats_cnt, int is_early_device);
|
int pm_lats_cnt, int is_early_device);
|
||||||
|
|
||||||
void __iomem *omap_device_get_rt_va(struct omap_device *od);
|
void __iomem *omap_device_get_rt_va(struct omap_device *od);
|
||||||
|
struct device *omap_device_get_by_hwmod_name(const char *oh_name);
|
||||||
|
|
||||||
/* OMAP PM interface */
|
/* OMAP PM interface */
|
||||||
int omap_device_align_pm_lat(struct platform_device *pdev,
|
int omap_device_align_pm_lat(struct platform_device *pdev,
|
||||||
|
@@ -85,6 +85,8 @@
|
|||||||
#include <linux/clk.h>
|
#include <linux/clk.h>
|
||||||
#include <linux/clkdev.h>
|
#include <linux/clkdev.h>
|
||||||
#include <linux/pm_runtime.h>
|
#include <linux/pm_runtime.h>
|
||||||
|
#include <linux/of.h>
|
||||||
|
#include <linux/notifier.h>
|
||||||
|
|
||||||
#include <plat/omap_device.h>
|
#include <plat/omap_device.h>
|
||||||
#include <plat/omap_hwmod.h>
|
#include <plat/omap_hwmod.h>
|
||||||
@@ -96,6 +98,20 @@
|
|||||||
|
|
||||||
static int omap_device_register(struct platform_device *pdev);
|
static int omap_device_register(struct platform_device *pdev);
|
||||||
static int omap_early_device_register(struct platform_device *pdev);
|
static int omap_early_device_register(struct platform_device *pdev);
|
||||||
|
static struct omap_device *omap_device_alloc(struct platform_device *pdev,
|
||||||
|
struct omap_hwmod **ohs, int oh_cnt,
|
||||||
|
struct omap_device_pm_latency *pm_lats,
|
||||||
|
int pm_lats_cnt);
|
||||||
|
static void omap_device_delete(struct omap_device *od);
|
||||||
|
|
||||||
|
|
||||||
|
static struct omap_device_pm_latency omap_default_latency[] = {
|
||||||
|
{
|
||||||
|
.deactivate_func = omap_device_idle_hwmods,
|
||||||
|
.activate_func = omap_device_enable_hwmods,
|
||||||
|
.flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/* Private functions */
|
/* Private functions */
|
||||||
|
|
||||||
@@ -303,6 +319,96 @@ static void _add_hwmod_clocks_clkdev(struct omap_device *od,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static struct dev_pm_domain omap_device_pm_domain;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* omap_device_build_from_dt - build an omap_device with multiple hwmods
|
||||||
|
* @pdev_name: name of the platform_device driver to use
|
||||||
|
* @pdev_id: this platform_device's connection ID
|
||||||
|
* @oh: ptr to the single omap_hwmod that backs this omap_device
|
||||||
|
* @pdata: platform_data ptr to associate with the platform_device
|
||||||
|
* @pdata_len: amount of memory pointed to by @pdata
|
||||||
|
* @pm_lats: pointer to a omap_device_pm_latency array for this device
|
||||||
|
* @pm_lats_cnt: ARRAY_SIZE() of @pm_lats
|
||||||
|
* @is_early_device: should the device be registered as an early device or not
|
||||||
|
*
|
||||||
|
* Function for building an omap_device already registered from device-tree
|
||||||
|
*
|
||||||
|
* Returns 0 or PTR_ERR() on error.
|
||||||
|
*/
|
||||||
|
static int omap_device_build_from_dt(struct platform_device *pdev)
|
||||||
|
{
|
||||||
|
struct omap_hwmod **hwmods;
|
||||||
|
struct omap_device *od;
|
||||||
|
struct omap_hwmod *oh;
|
||||||
|
struct device_node *node = pdev->dev.of_node;
|
||||||
|
const char *oh_name;
|
||||||
|
int oh_cnt, i, ret = 0;
|
||||||
|
|
||||||
|
oh_cnt = of_property_count_strings(node, "ti,hwmods");
|
||||||
|
if (!oh_cnt || IS_ERR_VALUE(oh_cnt)) {
|
||||||
|
dev_warn(&pdev->dev, "No 'hwmods' to build omap_device\n");
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
|
hwmods = kzalloc(sizeof(struct omap_hwmod *) * oh_cnt, GFP_KERNEL);
|
||||||
|
if (!hwmods) {
|
||||||
|
ret = -ENOMEM;
|
||||||
|
goto odbfd_exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < oh_cnt; i++) {
|
||||||
|
of_property_read_string_index(node, "ti,hwmods", i, &oh_name);
|
||||||
|
oh = omap_hwmod_lookup(oh_name);
|
||||||
|
if (!oh) {
|
||||||
|
dev_err(&pdev->dev, "Cannot lookup hwmod '%s'\n",
|
||||||
|
oh_name);
|
||||||
|
ret = -EINVAL;
|
||||||
|
goto odbfd_exit1;
|
||||||
|
}
|
||||||
|
hwmods[i] = oh;
|
||||||
|
}
|
||||||
|
|
||||||
|
od = omap_device_alloc(pdev, hwmods, oh_cnt, NULL, 0);
|
||||||
|
if (!od) {
|
||||||
|
dev_err(&pdev->dev, "Cannot allocate omap_device for :%s\n",
|
||||||
|
oh_name);
|
||||||
|
ret = PTR_ERR(od);
|
||||||
|
goto odbfd_exit1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (of_get_property(node, "ti,no_idle_on_suspend", NULL))
|
||||||
|
omap_device_disable_idle_on_suspend(pdev);
|
||||||
|
|
||||||
|
pdev->dev.pm_domain = &omap_device_pm_domain;
|
||||||
|
|
||||||
|
odbfd_exit1:
|
||||||
|
kfree(hwmods);
|
||||||
|
odbfd_exit:
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int _omap_device_notifier_call(struct notifier_block *nb,
|
||||||
|
unsigned long event, void *dev)
|
||||||
|
{
|
||||||
|
struct platform_device *pdev = to_platform_device(dev);
|
||||||
|
|
||||||
|
switch (event) {
|
||||||
|
case BUS_NOTIFY_ADD_DEVICE:
|
||||||
|
if (pdev->dev.of_node)
|
||||||
|
omap_device_build_from_dt(pdev);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BUS_NOTIFY_DEL_DEVICE:
|
||||||
|
if (pdev->archdata.od)
|
||||||
|
omap_device_delete(pdev->archdata.od);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NOTIFY_DONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Public functions for use by core code */
|
/* Public functions for use by core code */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -388,6 +494,113 @@ static int omap_device_fill_resources(struct omap_device *od,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* omap_device_alloc - allocate an omap_device
|
||||||
|
* @pdev: platform_device that will be included in this omap_device
|
||||||
|
* @oh: ptr to the single omap_hwmod that backs this omap_device
|
||||||
|
* @pdata: platform_data ptr to associate with the platform_device
|
||||||
|
* @pdata_len: amount of memory pointed to by @pdata
|
||||||
|
* @pm_lats: pointer to a omap_device_pm_latency array for this device
|
||||||
|
* @pm_lats_cnt: ARRAY_SIZE() of @pm_lats
|
||||||
|
*
|
||||||
|
* Convenience function for allocating an omap_device structure and filling
|
||||||
|
* hwmods, resources and pm_latency attributes.
|
||||||
|
*
|
||||||
|
* Returns an struct omap_device pointer or ERR_PTR() on error;
|
||||||
|
*/
|
||||||
|
static struct omap_device *omap_device_alloc(struct platform_device *pdev,
|
||||||
|
struct omap_hwmod **ohs, int oh_cnt,
|
||||||
|
struct omap_device_pm_latency *pm_lats,
|
||||||
|
int pm_lats_cnt)
|
||||||
|
{
|
||||||
|
int ret = -ENOMEM;
|
||||||
|
struct omap_device *od;
|
||||||
|
struct resource *res = NULL;
|
||||||
|
int i, res_count;
|
||||||
|
struct omap_hwmod **hwmods;
|
||||||
|
|
||||||
|
od = kzalloc(sizeof(struct omap_device), GFP_KERNEL);
|
||||||
|
if (!od) {
|
||||||
|
ret = -ENOMEM;
|
||||||
|
goto oda_exit1;
|
||||||
|
}
|
||||||
|
od->hwmods_cnt = oh_cnt;
|
||||||
|
|
||||||
|
hwmods = kmemdup(ohs, sizeof(struct omap_hwmod *) * oh_cnt, GFP_KERNEL);
|
||||||
|
if (!hwmods)
|
||||||
|
goto oda_exit2;
|
||||||
|
|
||||||
|
od->hwmods = hwmods;
|
||||||
|
od->pdev = pdev;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* HACK: Ideally the resources from DT should match, and hwmod
|
||||||
|
* should just add the missing ones. Since the name is not
|
||||||
|
* properly populated by DT, stick to hwmod resources only.
|
||||||
|
*/
|
||||||
|
if (pdev->num_resources && pdev->resource)
|
||||||
|
dev_warn(&pdev->dev, "%s(): resources already allocated %d\n",
|
||||||
|
__func__, pdev->num_resources);
|
||||||
|
|
||||||
|
res_count = omap_device_count_resources(od);
|
||||||
|
if (res_count > 0) {
|
||||||
|
dev_dbg(&pdev->dev, "%s(): resources allocated from hwmod %d\n",
|
||||||
|
__func__, res_count);
|
||||||
|
res = kzalloc(sizeof(struct resource) * res_count, GFP_KERNEL);
|
||||||
|
if (!res)
|
||||||
|
goto oda_exit3;
|
||||||
|
|
||||||
|
omap_device_fill_resources(od, res);
|
||||||
|
|
||||||
|
ret = platform_device_add_resources(pdev, res, res_count);
|
||||||
|
kfree(res);
|
||||||
|
|
||||||
|
if (ret)
|
||||||
|
goto oda_exit3;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!pm_lats) {
|
||||||
|
pm_lats = omap_default_latency;
|
||||||
|
pm_lats_cnt = ARRAY_SIZE(omap_default_latency);
|
||||||
|
}
|
||||||
|
|
||||||
|
od->pm_lats_cnt = pm_lats_cnt;
|
||||||
|
od->pm_lats = kmemdup(pm_lats,
|
||||||
|
sizeof(struct omap_device_pm_latency) * pm_lats_cnt,
|
||||||
|
GFP_KERNEL);
|
||||||
|
if (!od->pm_lats)
|
||||||
|
goto oda_exit3;
|
||||||
|
|
||||||
|
pdev->archdata.od = od;
|
||||||
|
|
||||||
|
for (i = 0; i < oh_cnt; i++) {
|
||||||
|
hwmods[i]->od = od;
|
||||||
|
_add_hwmod_clocks_clkdev(od, hwmods[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return od;
|
||||||
|
|
||||||
|
oda_exit3:
|
||||||
|
kfree(hwmods);
|
||||||
|
oda_exit2:
|
||||||
|
kfree(od);
|
||||||
|
oda_exit1:
|
||||||
|
dev_err(&pdev->dev, "omap_device: build failed (%d)\n", ret);
|
||||||
|
|
||||||
|
return ERR_PTR(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void omap_device_delete(struct omap_device *od)
|
||||||
|
{
|
||||||
|
if (!od)
|
||||||
|
return;
|
||||||
|
|
||||||
|
od->pdev->archdata.od = NULL;
|
||||||
|
kfree(od->pm_lats);
|
||||||
|
kfree(od->hwmods);
|
||||||
|
kfree(od);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* omap_device_build - build and register an omap_device with one omap_hwmod
|
* omap_device_build - build and register an omap_device with one omap_hwmod
|
||||||
* @pdev_name: name of the platform_device driver to use
|
* @pdev_name: name of the platform_device driver to use
|
||||||
@@ -447,9 +660,6 @@ struct platform_device *omap_device_build_ss(const char *pdev_name, int pdev_id,
|
|||||||
int ret = -ENOMEM;
|
int ret = -ENOMEM;
|
||||||
struct platform_device *pdev;
|
struct platform_device *pdev;
|
||||||
struct omap_device *od;
|
struct omap_device *od;
|
||||||
struct resource *res = NULL;
|
|
||||||
int i, res_count;
|
|
||||||
struct omap_hwmod **hwmods;
|
|
||||||
|
|
||||||
if (!ohs || oh_cnt == 0 || !pdev_name)
|
if (!ohs || oh_cnt == 0 || !pdev_name)
|
||||||
return ERR_PTR(-EINVAL);
|
return ERR_PTR(-EINVAL);
|
||||||
@@ -463,67 +673,31 @@ struct platform_device *omap_device_build_ss(const char *pdev_name, int pdev_id,
|
|||||||
goto odbs_exit;
|
goto odbs_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
pr_debug("omap_device: %s: building with %d hwmods\n", pdev_name,
|
/* Set the dev_name early to allow dev_xxx in omap_device_alloc */
|
||||||
oh_cnt);
|
if (pdev->id != -1)
|
||||||
|
dev_set_name(&pdev->dev, "%s.%d", pdev->name, pdev->id);
|
||||||
|
else
|
||||||
|
dev_set_name(&pdev->dev, "%s", pdev->name);
|
||||||
|
|
||||||
od = kzalloc(sizeof(struct omap_device), GFP_KERNEL);
|
od = omap_device_alloc(pdev, ohs, oh_cnt, pm_lats, pm_lats_cnt);
|
||||||
if (!od) {
|
if (!od)
|
||||||
ret = -ENOMEM;
|
|
||||||
goto odbs_exit1;
|
goto odbs_exit1;
|
||||||
}
|
|
||||||
od->hwmods_cnt = oh_cnt;
|
|
||||||
|
|
||||||
hwmods = kzalloc(sizeof(struct omap_hwmod *) * oh_cnt,
|
|
||||||
GFP_KERNEL);
|
|
||||||
if (!hwmods)
|
|
||||||
goto odbs_exit2;
|
|
||||||
|
|
||||||
memcpy(hwmods, ohs, sizeof(struct omap_hwmod *) * oh_cnt);
|
|
||||||
od->hwmods = hwmods;
|
|
||||||
od->pdev = pdev;
|
|
||||||
|
|
||||||
res_count = omap_device_count_resources(od);
|
|
||||||
if (res_count > 0) {
|
|
||||||
res = kzalloc(sizeof(struct resource) * res_count, GFP_KERNEL);
|
|
||||||
if (!res)
|
|
||||||
goto odbs_exit3;
|
|
||||||
|
|
||||||
omap_device_fill_resources(od, res);
|
|
||||||
|
|
||||||
ret = platform_device_add_resources(pdev, res, res_count);
|
|
||||||
kfree(res);
|
|
||||||
|
|
||||||
if (ret)
|
|
||||||
goto odbs_exit3;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = platform_device_add_data(pdev, pdata, pdata_len);
|
ret = platform_device_add_data(pdev, pdata, pdata_len);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto odbs_exit3;
|
goto odbs_exit2;
|
||||||
|
|
||||||
pdev->archdata.od = od;
|
|
||||||
|
|
||||||
if (is_early_device)
|
if (is_early_device)
|
||||||
ret = omap_early_device_register(pdev);
|
ret = omap_early_device_register(pdev);
|
||||||
else
|
else
|
||||||
ret = omap_device_register(pdev);
|
ret = omap_device_register(pdev);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto odbs_exit3;
|
goto odbs_exit2;
|
||||||
|
|
||||||
od->pm_lats = pm_lats;
|
|
||||||
od->pm_lats_cnt = pm_lats_cnt;
|
|
||||||
|
|
||||||
for (i = 0; i < oh_cnt; i++) {
|
|
||||||
hwmods[i]->od = od;
|
|
||||||
_add_hwmod_clocks_clkdev(od, hwmods[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return pdev;
|
return pdev;
|
||||||
|
|
||||||
odbs_exit3:
|
|
||||||
kfree(hwmods);
|
|
||||||
odbs_exit2:
|
odbs_exit2:
|
||||||
kfree(od);
|
omap_device_delete(od);
|
||||||
odbs_exit1:
|
odbs_exit1:
|
||||||
platform_device_put(pdev);
|
platform_device_put(pdev);
|
||||||
odbs_exit:
|
odbs_exit:
|
||||||
@@ -844,6 +1018,42 @@ void __iomem *omap_device_get_rt_va(struct omap_device *od)
|
|||||||
return omap_hwmod_get_mpu_rt_va(od->hwmods[0]);
|
return omap_hwmod_get_mpu_rt_va(od->hwmods[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* omap_device_get_by_hwmod_name() - convert a hwmod name to
|
||||||
|
* device pointer.
|
||||||
|
* @oh_name: name of the hwmod device
|
||||||
|
*
|
||||||
|
* Returns back a struct device * pointer associated with a hwmod
|
||||||
|
* device represented by a hwmod_name
|
||||||
|
*/
|
||||||
|
struct device *omap_device_get_by_hwmod_name(const char *oh_name)
|
||||||
|
{
|
||||||
|
struct omap_hwmod *oh;
|
||||||
|
|
||||||
|
if (!oh_name) {
|
||||||
|
WARN(1, "%s: no hwmod name!\n", __func__);
|
||||||
|
return ERR_PTR(-EINVAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
oh = omap_hwmod_lookup(oh_name);
|
||||||
|
if (IS_ERR_OR_NULL(oh)) {
|
||||||
|
WARN(1, "%s: no hwmod for %s\n", __func__,
|
||||||
|
oh_name);
|
||||||
|
return ERR_PTR(oh ? PTR_ERR(oh) : -ENODEV);
|
||||||
|
}
|
||||||
|
if (IS_ERR_OR_NULL(oh->od)) {
|
||||||
|
WARN(1, "%s: no omap_device for %s\n", __func__,
|
||||||
|
oh_name);
|
||||||
|
return ERR_PTR(oh->od ? PTR_ERR(oh->od) : -ENODEV);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IS_ERR_OR_NULL(oh->od->pdev))
|
||||||
|
return ERR_PTR(oh->od->pdev ? PTR_ERR(oh->od->pdev) : -ENODEV);
|
||||||
|
|
||||||
|
return &oh->od->pdev->dev;
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL(omap_device_get_by_hwmod_name);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Public functions intended for use in omap_device_pm_latency
|
* Public functions intended for use in omap_device_pm_latency
|
||||||
* .activate_func and .deactivate_func function pointers
|
* .activate_func and .deactivate_func function pointers
|
||||||
@@ -924,8 +1134,13 @@ struct device omap_device_parent = {
|
|||||||
.parent = &platform_bus,
|
.parent = &platform_bus,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct notifier_block platform_nb = {
|
||||||
|
.notifier_call = _omap_device_notifier_call,
|
||||||
|
};
|
||||||
|
|
||||||
static int __init omap_device_init(void)
|
static int __init omap_device_init(void)
|
||||||
{
|
{
|
||||||
|
bus_register_notifier(&platform_bus_type, &platform_nb);
|
||||||
return device_register(&omap_device_parent);
|
return device_register(&omap_device_parent);
|
||||||
}
|
}
|
||||||
core_initcall(omap_device_init);
|
core_initcall(omap_device_init);
|
||||||
|
@@ -661,6 +661,90 @@ int of_property_read_string(struct device_node *np, const char *propname,
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(of_property_read_string);
|
EXPORT_SYMBOL_GPL(of_property_read_string);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* of_property_read_string_index - Find and read a string from a multiple
|
||||||
|
* strings property.
|
||||||
|
* @np: device node from which the property value is to be read.
|
||||||
|
* @propname: name of the property to be searched.
|
||||||
|
* @index: index of the string in the list of strings
|
||||||
|
* @out_string: pointer to null terminated return string, modified only if
|
||||||
|
* return value is 0.
|
||||||
|
*
|
||||||
|
* Search for a property in a device tree node and retrieve a null
|
||||||
|
* terminated string value (pointer to data, not a copy) in the list of strings
|
||||||
|
* contained in that property.
|
||||||
|
* Returns 0 on success, -EINVAL if the property does not exist, -ENODATA if
|
||||||
|
* property does not have a value, and -EILSEQ if the string is not
|
||||||
|
* null-terminated within the length of the property data.
|
||||||
|
*
|
||||||
|
* The out_string pointer is modified only if a valid string can be decoded.
|
||||||
|
*/
|
||||||
|
int of_property_read_string_index(struct device_node *np, const char *propname,
|
||||||
|
int index, const char **output)
|
||||||
|
{
|
||||||
|
struct property *prop = of_find_property(np, propname, NULL);
|
||||||
|
int i = 0;
|
||||||
|
size_t l = 0, total = 0;
|
||||||
|
const char *p;
|
||||||
|
|
||||||
|
if (!prop)
|
||||||
|
return -EINVAL;
|
||||||
|
if (!prop->value)
|
||||||
|
return -ENODATA;
|
||||||
|
if (strnlen(prop->value, prop->length) >= prop->length)
|
||||||
|
return -EILSEQ;
|
||||||
|
|
||||||
|
p = prop->value;
|
||||||
|
|
||||||
|
for (i = 0; total < prop->length; total += l, p += l) {
|
||||||
|
l = strlen(p) + 1;
|
||||||
|
if ((*p != 0) && (i++ == index)) {
|
||||||
|
*output = p;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -ENODATA;
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(of_property_read_string_index);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* of_property_count_strings - Find and return the number of strings from a
|
||||||
|
* multiple strings property.
|
||||||
|
* @np: device node from which the property value is to be read.
|
||||||
|
* @propname: name of the property to be searched.
|
||||||
|
*
|
||||||
|
* Search for a property in a device tree node and retrieve the number of null
|
||||||
|
* terminated string contain in it. Returns the number of strings on
|
||||||
|
* success, -EINVAL if the property does not exist, -ENODATA if property
|
||||||
|
* does not have a value, and -EILSEQ if the string is not null-terminated
|
||||||
|
* within the length of the property data.
|
||||||
|
*/
|
||||||
|
int of_property_count_strings(struct device_node *np, const char *propname)
|
||||||
|
{
|
||||||
|
struct property *prop = of_find_property(np, propname, NULL);
|
||||||
|
int i = 0;
|
||||||
|
size_t l = 0, total = 0;
|
||||||
|
const char *p;
|
||||||
|
|
||||||
|
if (!prop)
|
||||||
|
return -EINVAL;
|
||||||
|
if (!prop->value)
|
||||||
|
return -ENODATA;
|
||||||
|
if (strnlen(prop->value, prop->length) >= prop->length)
|
||||||
|
return -EILSEQ;
|
||||||
|
|
||||||
|
p = prop->value;
|
||||||
|
|
||||||
|
for (i = 0; total < prop->length; total += l, p += l) {
|
||||||
|
l = strlen(p) + 1;
|
||||||
|
if (*p != 0)
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(of_property_count_strings);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* of_parse_phandle - Resolve a phandle property to a device_node pointer
|
* of_parse_phandle - Resolve a phandle property to a device_node pointer
|
||||||
* @np: Pointer to device node holding phandle property
|
* @np: Pointer to device node holding phandle property
|
||||||
|
@@ -203,6 +203,11 @@ extern int of_property_read_u32_array(const struct device_node *np,
|
|||||||
extern int of_property_read_string(struct device_node *np,
|
extern int of_property_read_string(struct device_node *np,
|
||||||
const char *propname,
|
const char *propname,
|
||||||
const char **out_string);
|
const char **out_string);
|
||||||
|
extern int of_property_read_string_index(struct device_node *np,
|
||||||
|
const char *propname,
|
||||||
|
int index, const char **output);
|
||||||
|
extern int of_property_count_strings(struct device_node *np,
|
||||||
|
const char *propname);
|
||||||
extern int of_device_is_compatible(const struct device_node *device,
|
extern int of_device_is_compatible(const struct device_node *device,
|
||||||
const char *);
|
const char *);
|
||||||
extern int of_device_is_available(const struct device_node *device);
|
extern int of_device_is_available(const struct device_node *device);
|
||||||
@@ -256,6 +261,19 @@ static inline int of_property_read_string(struct device_node *np,
|
|||||||
return -ENOSYS;
|
return -ENOSYS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int of_property_read_string_index(struct device_node *np,
|
||||||
|
const char *propname, int index,
|
||||||
|
const char **out_string)
|
||||||
|
{
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int of_property_count_strings(struct device_node *np,
|
||||||
|
const char *propname)
|
||||||
|
{
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
static inline const void *of_get_property(const struct device_node *node,
|
static inline const void *of_get_property(const struct device_node *node,
|
||||||
const char *name,
|
const char *name,
|
||||||
int *lenp)
|
int *lenp)
|
||||||
|
Reference in New Issue
Block a user