Commit a727eaf6 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'drivers-for-3.16' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc into next

Pull ARM SoC driver changes from Olof Johansson:
 "SoC-near driver changes that we're merging through our tree.  Mostly
  because they depend on other changes we have staged, but in some cases
  because the driver maintainers preferred that we did it this way.

  This contains a largeish cleanup series of the omap_l3_noc bus driver,
  cpuidle rework for Exynos, some reset driver conversions and a long
  branch of TI EDMA fixes and cleanups, with more to come next release.

  The TI EDMA cleanups is a shared branch with the dmaengine tree, with
  a handful of Davinci-specific fixes on top.

  After discussion at last year's KS (and some more on the mailing
  lists), we are here adding a drivers/soc directory.  The purpose of
  this is to keep per-vendor shared code that's needed by different
  drivers but that doesn't fit into the MFD (nor drivers/platform)
  model.  We expect to keep merging contents for this hierarchy through
  arm-soc so we can keep an eye on what the vendors keep adding here and
  not making it a free-for-all to shove in crazy stuff"

* tag 'drivers-for-3.16' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (101 commits)
  cpufreq: exynos: Fix driver compilation with ARCH_MULTIPLATFORM
  tty: serial: msm: Remove direct access to GSBI
  power: reset: keystone-reset: introduce keystone reset driver
  Documentation: dt: add bindings for keystone pll control controller
  Documentation: dt: add bindings for keystone reset driver
  soc: qcom: fix of_device_id table
  ARM: EXYNOS: Fix kernel panic when unplugging CPU1 on exynos
  ARM: EXYNOS: Move the driver to drivers/cpuidle directory
  ARM: EXYNOS: Cleanup all unneeded headers from cpuidle.c
  ARM: EXYNOS: Pass the AFTR callback to the platform_data
  ARM: EXYNOS: Move S5P_CHECK_SLEEP into pm.c
  ARM: EXYNOS: Move the power sequence call in the cpu_pm notifier
  ARM: EXYNOS: Move the AFTR state function into pm.c
  ARM: EXYNOS: Encapsulate the AFTR code into a function
  ARM: EXYNOS: Disable cpuidle for exynos5440
  ARM: EXYNOS: Encapsulate boot vector code into a function for cpuidle
  ARM: EXYNOS: Pass wakeup mask parameter to function for cpuidle
  ARM: EXYNOS: Remove ifdef for scu_enable in pm
  ARM: EXYNOS: Move scu_enable in the cpu_pm notifier
  ARM: EXYNOS: Use the cpu_pm notifier for pm
  ...
parents 755a9ba7 45e70b7d
What: /sys/devices/../../gisb_arb_timeout
Date: May 2014
KernelVersion: 3.17
Contact: Florian Fainelli <f.fainelli@gmail.com>
Description:
Returns the currently configured raw timeout value of the
Broadcom Set Top Box internal GISB bus arbiter. Minimum value
is 1, and maximum value is 0xffffffff.
...@@ -6,6 +6,8 @@ provided by Arteris. ...@@ -6,6 +6,8 @@ provided by Arteris.
Required properties: Required properties:
- compatible : Should be "ti,omap3-l3-smx" for OMAP3 family - compatible : Should be "ti,omap3-l3-smx" for OMAP3 family
Should be "ti,omap4-l3-noc" for OMAP4 family Should be "ti,omap4-l3-noc" for OMAP4 family
Should be "ti,dra7-l3-noc" for DRA7 family
Should be "ti,am4372-l3-noc" for AM43 family
- reg: Contains L3 register address range for each noc domain. - reg: Contains L3 register address range for each noc domain.
- ti,hwmods: "l3_main_1", ... One hwmod for each noc domain. - ti,hwmods: "l3_main_1", ... One hwmod for each noc domain.
......
Broadcom GISB bus Arbiter controller
Required properties:
- compatible: should be "brcm,gisb-arb"
- reg: specifies the base physical address and size of the registers
- interrupt-parent: specifies the phandle to the parent interrupt controller
this arbiter gets interrupt line from
- interrupts: specifies the two interrupts (timeout and TEA) to be used from
the parent interrupt controller
Optional properties:
- brcm,gisb-arb-master-mask: 32-bits wide bitmask used to specify which GISB
masters are valid at the system level
- brcm,gisb-arb-master-names: string list of the litteral name of the GISB
masters. Should match the number of bits set in brcm,gisb-master-mask and
the order in which they appear
Example:
gisb-arb@f0400000 {
compatible = "brcm,gisb-arb";
reg = <0xf0400000 0x800>;
interrupts = <0>, <2>;
interrupt-parent = <&sun_l2_intc>;
brcm,gisb-arb-master-mask = <0x7>;
brcm,gisb-arb-master-names = "bsp_0", "scpu_0", "cpu_0";
};
* Device tree bindings for Texas Instruments keystone pll controller
The main pll controller used to drive theC66x CorePacs, the switch fabric,
and a majority of the peripheral clocks (all but the ARM CorePacs, DDR3 and
the NETCP modules) requires a PLL Controller to manage the various clock
divisions, gating, and synchronization.
Required properties:
- compatible: "ti,keystone-pllctrl", "syscon"
- reg: contains offset/length value for pll controller
registers space.
Example:
pllctrl: pll-controller@0x02310000 {
compatible = "ti,keystone-pllctrl", "syscon";
reg = <0x02310000 0x200>;
};
...@@ -2,11 +2,8 @@ TI EDMA ...@@ -2,11 +2,8 @@ TI EDMA
Required properties: Required properties:
- compatible : "ti,edma3" - compatible : "ti,edma3"
- ti,edma-regions: Number of regions
- ti,edma-slots: Number of slots
- #dma-cells: Should be set to <1> - #dma-cells: Should be set to <1>
Clients should use a single channel number per DMA request. Clients should use a single channel number per DMA request.
- dma-channels: Specify total DMA channels per CC
- reg: Memory map for accessing module - reg: Memory map for accessing module
- interrupt-parent: Interrupt controller the interrupt is routed through - interrupt-parent: Interrupt controller the interrupt is routed through
- interrupts: Exactly 3 interrupts need to be specified in the order: - interrupts: Exactly 3 interrupts need to be specified in the order:
...@@ -17,6 +14,13 @@ Optional properties: ...@@ -17,6 +14,13 @@ Optional properties:
- ti,hwmods: Name of the hwmods associated to the EDMA - ti,hwmods: Name of the hwmods associated to the EDMA
- ti,edma-xbar-event-map: Crossbar event to channel map - ti,edma-xbar-event-map: Crossbar event to channel map
Deprecated properties:
Listed here in case one wants to boot an old kernel with new DTB. These
properties might need to be added to the new DTS files.
- ti,edma-regions: Number of regions
- ti,edma-slots: Number of slots
- dma-channels: Specify total DMA channels per CC
Example: Example:
edma: edma@49000000 { edma: edma@49000000 {
...@@ -26,9 +30,6 @@ edma: edma@49000000 { ...@@ -26,9 +30,6 @@ edma: edma@49000000 {
compatible = "ti,edma3"; compatible = "ti,edma3";
ti,hwmods = "tpcc", "tptc0", "tptc1", "tptc2"; ti,hwmods = "tpcc", "tptc0", "tptc1", "tptc2";
#dma-cells = <1>; #dma-cells = <1>;
dma-channels = <64>;
ti,edma-regions = <4>;
ti,edma-slots = <256>;
ti,edma-xbar-event-map = /bits/ 16 <1 12 ti,edma-xbar-event-map = /bits/ 16 <1 12
2 13>; 2 13>;
}; };
...@@ -6,10 +6,11 @@ The actual devices are instantiated from the child nodes of a Device Bus node. ...@@ -6,10 +6,11 @@ The actual devices are instantiated from the child nodes of a Device Bus node.
Required properties: Required properties:
- compatible: Currently only Armada 370/XP SoC are supported, - compatible: Armada 370/XP SoC are supported using the
with this compatible string: "marvell,mvebu-devbus" compatible string.
marvell,mvebu-devbus Orion5x SoC are supported using the
"marvell,orion-devbus" compatible string.
- reg: A resource specifier for the register space. - reg: A resource specifier for the register space.
This is the base address of a chip select within This is the base address of a chip select within
...@@ -22,7 +23,14 @@ Required properties: ...@@ -22,7 +23,14 @@ Required properties:
integer values for each chip-select line in use: integer values for each chip-select line in use:
0 <physical address of mapping> <size> 0 <physical address of mapping> <size>
Mandatory timing properties for child nodes: Optional properties:
- devbus,keep-config This property can optionally be used to keep
using the timing parameters set by the
bootloader. It makes all the timing properties
described below unused.
Timing properties for child nodes:
Read parameters: Read parameters:
...@@ -30,21 +38,26 @@ Read parameters: ...@@ -30,21 +38,26 @@ Read parameters:
drive the AD bus after the completion of a device read. drive the AD bus after the completion of a device read.
This prevents contentions on the Device Bus after a read This prevents contentions on the Device Bus after a read
cycle from a slow device. cycle from a slow device.
Mandatory, except if devbus,keep-config is used.
- devbus,bus-width: Defines the bus width (e.g. <16>) - devbus,bus-width: Defines the bus width, in bits (e.g. <16>).
Mandatory, except if devbus,keep-config is used.
- devbus,badr-skew-ps: Defines the time delay from from A[2:0] toggle, - devbus,badr-skew-ps: Defines the time delay from from A[2:0] toggle,
to read data sample. This parameter is useful for to read data sample. This parameter is useful for
synchronous pipelined devices, where the address synchronous pipelined devices, where the address
precedes the read data by one or two cycles. precedes the read data by one or two cycles.
Mandatory, except if devbus,keep-config is used.
- devbus,acc-first-ps: Defines the time delay from the negation of - devbus,acc-first-ps: Defines the time delay from the negation of
ALE[0] to the cycle that the first read data is sampled ALE[0] to the cycle that the first read data is sampled
by the controller. by the controller.
Mandatory, except if devbus,keep-config is used.
- devbus,acc-next-ps: Defines the time delay between the cycle that - devbus,acc-next-ps: Defines the time delay between the cycle that
samples data N and the cycle that samples data N+1 samples data N and the cycle that samples data N+1
(in burst accesses). (in burst accesses).
Mandatory, except if devbus,keep-config is used.
- devbus,rd-setup-ps: Defines the time delay between DEV_CSn assertion to - devbus,rd-setup-ps: Defines the time delay between DEV_CSn assertion to
DEV_OEn assertion. If set to 0 (default), DEV_OEn assertion. If set to 0 (default),
...@@ -52,6 +65,8 @@ Read parameters: ...@@ -52,6 +65,8 @@ Read parameters:
This parameter has no affect on <acc-first-ps> parameter This parameter has no affect on <acc-first-ps> parameter
(no affect on first data sample). Set <rd-setup-ps> (no affect on first data sample). Set <rd-setup-ps>
to a value smaller than <acc-first-ps>. to a value smaller than <acc-first-ps>.
Mandatory for "marvell,mvebu-devbus" compatible string,
except if devbus,keep-config is used.
- devbus,rd-hold-ps: Defines the time between the last data sample to the - devbus,rd-hold-ps: Defines the time between the last data sample to the
de-assertion of DEV_CSn. If set to 0 (default), de-assertion of DEV_CSn. If set to 0 (default),
...@@ -62,16 +77,20 @@ Read parameters: ...@@ -62,16 +77,20 @@ Read parameters:
last data sampled. Also this parameter has no last data sampled. Also this parameter has no
affect on <turn-off-ps> parameter. affect on <turn-off-ps> parameter.
Set <rd-hold-ps> to a value smaller than <turn-off-ps>. Set <rd-hold-ps> to a value smaller than <turn-off-ps>.
Mandatory for "marvell,mvebu-devbus" compatible string,
except if devbus,keep-config is used.
Write parameters: Write parameters:
- devbus,ale-wr-ps: Defines the time delay from the ALE[0] negation cycle - devbus,ale-wr-ps: Defines the time delay from the ALE[0] negation cycle
to the DEV_WEn assertion. to the DEV_WEn assertion.
Mandatory.
- devbus,wr-low-ps: Defines the time during which DEV_WEn is active. - devbus,wr-low-ps: Defines the time during which DEV_WEn is active.
A[2:0] and Data are kept valid as long as DEV_WEn A[2:0] and Data are kept valid as long as DEV_WEn
is active. This parameter defines the setup time of is active. This parameter defines the setup time of
address and data to DEV_WEn rise. address and data to DEV_WEn rise.
Mandatory.
- devbus,wr-high-ps: Defines the time during which DEV_WEn is kept - devbus,wr-high-ps: Defines the time during which DEV_WEn is kept
inactive (high) between data beats of a burst write. inactive (high) between data beats of a burst write.
...@@ -79,10 +98,13 @@ Write parameters: ...@@ -79,10 +98,13 @@ Write parameters:
<wr-high-ps> - <tick> ps. <wr-high-ps> - <tick> ps.
This parameter defines the hold time of address and This parameter defines the hold time of address and
data after DEV_WEn rise. data after DEV_WEn rise.
Mandatory.
- devbus,sync-enable: Synchronous device enable. - devbus,sync-enable: Synchronous device enable.
1: True 1: True
0: False 0: False
Mandatory for "marvell,mvebu-devbus" compatible string,
except if devbus,keep-config is used.
An example for an Armada XP GP board, with a 16 MiB NOR device as child An example for an Armada XP GP board, with a 16 MiB NOR device as child
is showed below. Note that the Device Bus driver is in charge of allocating is showed below. Note that the Device Bus driver is in charge of allocating
......
* Device tree bindings for Texas Instruments keystone reset
This node is intended to allow SoC reset in case of software reset
of selected watchdogs.
The Keystone SoCs can contain up to 4 watchdog timers to reset
SoC. Each watchdog timer event input is connected to the Reset Mux
block. The Reset Mux block can be configured to cause reset or not.
Additionally soft or hard reset can be configured.
Required properties:
- compatible: ti,keystone-reset
- ti,syscon-pll: phandle/offset pair. The phandle to syscon used to
access pll controller registers and the offset to use
reset control registers.
- ti,syscon-dev: phandle/offset pair. The phandle to syscon used to
access device state control registers and the offset
in order to use mux block registers for all watchdogs.
Optional properties:
- ti,soft-reset: Boolean option indicating soft reset.
By default hard reset is used.
- ti,wdt-list: WDT list that can cause SoC reset. It's not related
to WDT driver, it's just needed to enable a SoC related
reset that's triggered by one of WDTs. The list is
in format: <0>, <2>; It can be in random order and
begins from 0 to 3, as keystone can contain up to 4 SoC
reset watchdogs and can be in random order.
Example 1:
Setup keystone reset so that in case software reset or
WDT0 is triggered it issues hard reset for SoC.
pllctrl: pll-controller@02310000 {
compatible = "ti,keystone-pllctrl", "syscon";
reg = <0x02310000 0x200>;
};
devctrl: device-state-control@02620000 {
compatible = "ti,keystone-devctrl", "syscon";
reg = <0x02620000 0x1000>;
};
rstctrl: reset-controller {
compatible = "ti,keystone-reset";
ti,syscon-pll = <&pllctrl 0xe4>;
ti,syscon-dev = <&devctrl 0x328>;
ti,wdt-list = <0>;
};
Example 2:
Setup keystone reset so that in case of software reset or
WDT0 or WDT2 is triggered it issues soft reset for SoC.
rstctrl: reset-controller {
compatible = "ti,keystone-reset";
ti,syscon-pll = <&pllctrl 0xe4>;
ti,syscon-dev = <&devctrl 0x328>;
ti,wdt-list = <0>, <2>;
ti,soft-reset;
};
Allwinner sunxi Peripheral Reset Controller
===========================================
Please also refer to reset.txt in this directory for common reset
controller binding usage.
Required properties:
- compatible: Should be one of the following:
"allwinner,sun6i-a31-ahb1-reset"
"allwinner,sun6i-a31-clock-reset"
- reg: should be register base and length as documented in the
datasheet
- #reset-cells: 1, see below
example:
ahb1_rst: reset@01c202c0 {
#reset-cells = <1>;
compatible = "allwinner,sun6i-a31-ahb1-reset";
reg = <0x01c202c0 0xc>;
};
...@@ -147,9 +147,6 @@ edma: edma@49000000 { ...@@ -147,9 +147,6 @@ edma: edma@49000000 {
<0x44e10f90 0x40>; <0x44e10f90 0x40>;
interrupts = <12 13 14>; interrupts = <12 13 14>;
#dma-cells = <1>; #dma-cells = <1>;
dma-channels = <64>;
ti,edma-regions = <4>;
ti,edma-slots = <256>;
}; };
gpio0: gpio@44e07000 { gpio0: gpio@44e07000 {
......
...@@ -112,9 +112,6 @@ edma: edma@49000000 { ...@@ -112,9 +112,6 @@ edma: edma@49000000 {
<GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>; <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
#dma-cells = <1>; #dma-cells = <1>;
dma-channels = <64>;
ti,edma-regions = <4>;
ti,edma-slots = <256>;
}; };
uart0: serial@44e09000 { uart0: serial@44e09000 {
......
...@@ -102,7 +102,13 @@ ...@@ -102,7 +102,13 @@
#define PARM_OFFSET(param_no) (EDMA_PARM + ((param_no) << 5)) #define PARM_OFFSET(param_no) (EDMA_PARM + ((param_no) << 5))
#define EDMA_DCHMAP 0x0100 /* 64 registers */ #define EDMA_DCHMAP 0x0100 /* 64 registers */
#define CHMAP_EXIST BIT(24)
/* CCCFG register */
#define GET_NUM_DMACH(x) (x & 0x7) /* bits 0-2 */
#define GET_NUM_PAENTRY(x) ((x & 0x7000) >> 12) /* bits 12-14 */
#define GET_NUM_EVQUE(x) ((x & 0x70000) >> 16) /* bits 16-18 */
#define GET_NUM_REGN(x) ((x & 0x300000) >> 20) /* bits 20-21 */
#define CHMAP_EXIST BIT(24)
#define EDMA_MAX_DMACH 64 #define EDMA_MAX_DMACH 64
#define EDMA_MAX_PARAMENTRY 512 #define EDMA_MAX_PARAMENTRY 512
...@@ -233,7 +239,6 @@ struct edma { ...@@ -233,7 +239,6 @@ struct edma {
unsigned num_region; unsigned num_region;
unsigned num_slots; unsigned num_slots;
unsigned num_tc; unsigned num_tc;
unsigned num_cc;
enum dma_event_q default_queue; enum dma_event_q default_queue;
/* list of channels with no even trigger; terminated by "-1" */ /* list of channels with no even trigger; terminated by "-1" */
...@@ -290,12 +295,6 @@ static void map_dmach_queue(unsigned ctlr, unsigned ch_no, ...@@ -290,12 +295,6 @@ static void map_dmach_queue(unsigned ctlr, unsigned ch_no,
~(0x7 << bit), queue_no << bit); ~(0x7 << bit), queue_no << bit);
} }
static void __init map_queue_tc(unsigned ctlr, int queue_no, int tc_no)
{
int bit = queue_no * 4;
edma_modify(ctlr, EDMA_QUETCMAP, ~(0x7 << bit), ((tc_no & 0x7) << bit));
}
static void __init assign_priority_to_queue(unsigned ctlr, int queue_no, static void __init assign_priority_to_queue(unsigned ctlr, int queue_no,
int priority) int priority)
{ {
...@@ -994,29 +993,23 @@ void edma_set_dest(unsigned slot, dma_addr_t dest_port, ...@@ -994,29 +993,23 @@ void edma_set_dest(unsigned slot, dma_addr_t dest_port,
EXPORT_SYMBOL(edma_set_dest); EXPORT_SYMBOL(edma_set_dest);
/** /**
* edma_get_position - returns the current transfer points * edma_get_position - returns the current transfer point
* @slot: parameter RAM slot being examined * @slot: parameter RAM slot being examined
* @src: pointer to source port position * @dst: true selects the dest position, false the source
* @dst: pointer to destination port position
* *
* Returns current source and destination addresses for a particular * Returns the position of the current active slot
* parameter RAM slot. Its channel should not be active when this is called.
*/ */
void edma_get_position(unsigned slot, dma_addr_t *src, dma_addr_t *dst) dma_addr_t edma_get_position(unsigned slot, bool dst)
{ {
struct edmacc_param temp; u32 offs, ctlr = EDMA_CTLR(slot);
unsigned ctlr;
ctlr = EDMA_CTLR(slot);
slot = EDMA_CHAN_SLOT(slot); slot = EDMA_CHAN_SLOT(slot);
edma_read_slot(EDMA_CTLR_CHAN(ctlr, slot), &temp); offs = PARM_OFFSET(slot);
if (src != NULL) offs += dst ? PARM_DST : PARM_SRC;
*src = temp.src;
if (dst != NULL) return edma_read(ctlr, offs);
*dst = temp.dst;
} }
EXPORT_SYMBOL(edma_get_position);
/** /**
* edma_set_src_index - configure DMA source address indexing * edma_set_src_index - configure DMA source address indexing
...@@ -1421,6 +1414,67 @@ void edma_clear_event(unsigned channel) ...@@ -1421,6 +1414,67 @@ void edma_clear_event(unsigned channel)
} }
EXPORT_SYMBOL(edma_clear_event); EXPORT_SYMBOL(edma_clear_event);
static int edma_setup_from_hw(struct device *dev, struct edma_soc_info *pdata,
struct edma *edma_cc)
{
int i;
u32 value, cccfg;
s8 (*queue_priority_map)[2];
/* Decode the eDMA3 configuration from CCCFG register */
cccfg = edma_read(0, EDMA_CCCFG);
value = GET_NUM_REGN(cccfg);
edma_cc->num_region = BIT(value);
value = GET_NUM_DMACH(cccfg);
edma_cc->num_channels = BIT(value + 1);
value = GET_NUM_PAENTRY(cccfg);
edma_cc->num_slots = BIT(value + 4);
value = GET_NUM_EVQUE(cccfg);
edma_cc->num_tc = value + 1;
dev_dbg(dev, "eDMA3 HW configuration (cccfg: 0x%08x):\n", cccfg);
dev_dbg(dev, "num_region: %u\n", edma_cc->num_region);
dev_dbg(dev, "num_channel: %u\n", edma_cc->num_channels);
dev_dbg(dev, "num_slot: %u\n", edma_cc->num_slots);
dev_dbg(dev, "num_tc: %u\n", edma_cc->num_tc);
/* Nothing need to be done if queue priority is provided */
if (pdata->queue_priority_mapping)
return 0;
/*
* Configure TC/queue priority as follows:
* Q0 - priority 0
* Q1 - priority 1
* Q2 - priority 2
* ...
* The meaning of priority numbers: 0 highest priority, 7 lowest
* priority. So Q0 is the highest priority queue and the last queue has
* the lowest priority.
*/
queue_priority_map = devm_kzalloc(dev,
(edma_cc->num_tc + 1) * sizeof(s8),
GFP_KERNEL);
if (!queue_priority_map)
return -ENOMEM;
for (i = 0; i < edma_cc->num_tc; i++) {
queue_priority_map[i][0] = i;
queue_priority_map[i][1] = i;
}
queue_priority_map[i][0] = -1;
queue_priority_map[i][1] = -1;
pdata->queue_priority_mapping = queue_priority_map;
pdata->default_queue = 0;
return 0;
}
#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_DMADEVICES) #if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_DMADEVICES)
static int edma_xbar_event_map(struct device *dev, struct device_node *node, static int edma_xbar_event_map(struct device *dev, struct device_node *node,
...@@ -1471,65 +1525,16 @@ static int edma_of_parse_dt(struct device *dev, ...@@ -1471,65 +1525,16 @@ static int edma_of_parse_dt(struct device *dev,
struct device_node *node, struct device_node *node,
struct edma_soc_info *pdata) struct edma_soc_info *pdata)
{ {
int ret = 0, i; int ret = 0;
u32 value;
struct property *prop; struct property *prop;
size_t sz; size_t sz;
struct edma_rsv_info *rsv_info; struct edma_rsv_info *rsv_info;
s8 (*queue_tc_map)[2], (*queue_priority_map)[2];
memset(pdata, 0, sizeof(struct edma_soc_info));
ret = of_property_read_u32(node, "dma-channels", &value);
if (ret < 0)
return ret;
pdata->n_channel = value;
ret = of_property_read_u32(node, "ti,edma-regions", &value);
if (ret < 0)
return ret;
pdata->n_region = value;
ret = of_property_read_u32(node, "ti,edma-slots", &value);
if (ret < 0)
return ret;
pdata->n_slot = value;
pdata->n_cc = 1;
rsv_info = devm_kzalloc(dev, sizeof(struct edma_rsv_info), GFP_KERNEL); rsv_info = devm_kzalloc(dev, sizeof(struct edma_rsv_info), GFP_KERNEL);
if (!rsv_info) if (!rsv_info)
return -ENOMEM; return -ENOMEM;
pdata->rsv = rsv_info; pdata->rsv = rsv_info;
queue_tc_map = devm_kzalloc(dev, 8*sizeof(s8), GFP_KERNEL);
if (!queue_tc_map)
return -ENOMEM;
for (i = 0; i < 3; i++) {
queue_tc_map[i][0] = i;
queue_tc_map[i][1] = i;
}
queue_tc_map[i][0] = -1;
queue_tc_map[i][1] = -1;
pdata->queue_tc_mapping = queue_tc_map;
queue_priority_map = devm_kzalloc(dev, 8*sizeof(s8), GFP_KERNEL);
if (!queue_priority_map)
return -ENOMEM;
for (i = 0; i < 3; i++) {
queue_priority_map[i][0] = i;
queue_priority_map[i][1] = i;
}
queue_priority_map[i][0] = -1;
queue_priority_map[i][1] = -1;
pdata->queue_priority_mapping = queue_priority_map;
pdata->default_queue = 0;
prop = of_find_property(node, "ti,edma-xbar-event-map", &sz); prop = of_find_property(node, "ti,edma-xbar-event-map", &sz);
if (prop) if (prop)
ret = edma_xbar_event_map(dev, node, pdata, sz); ret = edma_xbar_event_map(dev, node, pdata, sz);
...@@ -1556,6 +1561,7 @@ static struct edma_soc_info *edma_setup_info_from_dt(struct device *dev, ...@@ -1556,6 +1561,7 @@ static struct edma_soc_info *edma_setup_info_from_dt(struct device *dev,
return ERR_PTR(ret); return ERR_PTR(ret);
dma_cap_set(DMA_SLAVE, edma_filter_info.dma_cap); dma_cap_set(DMA_SLAVE, edma_filter_info.dma_cap);
dma_cap_set(DMA_CYCLIC, edma_filter_info.dma_cap);
of_dma_controller_register(dev->of_node, of_dma_simple_xlate, of_dma_controller_register(dev->of_node, of_dma_simple_xlate,
&edma_filter_info); &edma_filter_info);
...@@ -1574,7 +1580,6 @@ static int edma_probe(struct platform_device *pdev) ...@@ -1574,7 +1580,6 @@ static int edma_probe(struct platform_device *pdev)
struct edma_soc_info **info = pdev->dev.platform_data; struct edma_soc_info **info = pdev->dev.platform_data;
struct edma_soc_info *ninfo[EDMA_MAX_CC] = {NULL}; struct edma_soc_info *ninfo[EDMA_MAX_CC] = {NULL};
s8 (*queue_priority_mapping)[2]; s8 (*queue_priority_mapping)[2];
s8 (*queue_tc_mapping)[2];
int i, j, off, ln, found = 0; int i, j, off, ln, found = 0;
int status = -1; int status = -1;
const s16 (*rsv_chans)[2]; const s16 (*rsv_chans)[2];
...@@ -1585,7 +1590,6 @@ static int edma_probe(struct platform_device *pdev) ...@@ -1585,7 +1590,6 @@ static int edma_probe(struct platform_device *pdev)
struct resource *r[EDMA_MAX_CC] = {NULL}; struct resource *r[EDMA_MAX_CC] = {NULL};
struct resource res[EDMA_MAX_CC]; struct resource res[EDMA_MAX_CC];
char res_name[10]; char res_name[10];
char irq_name[10];
struct device_node *node = pdev->dev.of_node; struct device_node *node = pdev->dev.of_node;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
int ret; int ret;
...@@ -1650,12 +1654,10 @@ static int edma_probe(struct platform_device *pdev) ...@@ -1650,12 +1654,10 @@ static int edma_probe(struct platform_device *pdev)
if (!edma_cc[j]) if (!edma_cc[j])
return -ENOMEM; return -ENOMEM;
edma_cc[j]->num_channels = min_t(unsigned, info[j]->n_channel, /* Get eDMA3 configuration from IP */
EDMA_MAX_DMACH); ret = edma_setup_from_hw(dev, info[j], edma_cc[j]);
edma_cc[j]->num_slots = min_t(unsigned, info[j]->n_slot, if (ret)
EDMA_MAX_PARAMENTRY); return ret;
edma_cc[j]->num_cc = min_t(unsigned, info[j]->n_cc,
EDMA_MAX_CC);
edma_cc[j]->default_queue = info[j]->default_queue; edma_cc[j]->default_queue = info[j]->default_queue;
...@@ -1707,14 +1709,21 @@ static int edma_probe(struct platform_device *pdev) ...@@ -1707,14 +1709,21 @@ static int edma_probe(struct platform_device *pdev)
if (node) { if (node) {
irq[j] = irq_of_parse_and_map(node, 0); irq[j] = irq_of_parse_and_map(node, 0);
err_irq[j] = irq_of_parse_and_map(node, 2);
} else { } else {
char irq_name[10];
sprintf(irq_name, "edma%d", j); sprintf(irq_name, "edma%d", j);
irq[j] = platform_get_irq_byname(pdev, irq_name); irq[j] = platform_get_irq_byname(pdev, irq_name);
sprintf(irq_name, "edma%d_err", j);
err_irq[j] = platform_get_irq_byname(pdev, irq_name);
} }
edma_cc[j]->irq_res_start = irq[j]; edma_cc[j]->irq_res_start = irq[j];
status = devm_request_irq(&pdev->dev, irq[j], edma_cc[j]->irq_res_end = err_irq[j];
dma_irq_handler, 0, "edma",
&pdev->dev); status = devm_request_irq(dev, irq[j], dma_irq_handler, 0,
"edma", dev);
if (status < 0) { if (status < 0) {
dev_dbg(&pdev->dev, dev_dbg(&pdev->dev,
"devm_request_irq %d failed --> %d\n", "devm_request_irq %d failed --> %d\n",
...@@ -1722,16 +1731,8 @@ static int edma_probe(struct platform_device *pdev) ...@@ -1722,16 +1731,8 @@ static int edma_probe(struct platform_device *pdev)
return status; return status;
} }
if (node) { status = devm_request_irq(dev, err_irq[j], dma_ccerr_handler, 0,
err_irq[j] = irq_of_parse_and_map(node, 2); "edma_error", dev);
} else {
sprintf(irq_name, "edma%d_err", j);
err_irq[j] = platform_get_irq_byname(pdev, irq_name);
}
edma_cc[j]->irq_res_end = err_irq[j];
status = devm_request_irq(&pdev->dev, err_irq[j],
dma_ccerr_handler, 0,
"edma_error", &pdev->dev);
if (status < 0) { if (status < 0) {
dev_dbg(&pdev->dev, dev_dbg(&pdev->dev,
"devm_request_irq %d failed --> %d\n", "devm_request_irq %d failed --> %d\n",
...@@ -1742,14 +1743,8 @@ static int edma_probe(struct platform_device *pdev) ...@@ -1742,14 +1743,8 @@ static int edma_probe(struct platform_device *pdev)
for (i = 0; i < edma_cc[j]->num_channels; i++) for (i = 0; i < edma_cc[j]->num_channels; i++)
map_dmach_queue(j, i, info[j]->default_queue); map_dmach_queue(j, i, info[j]->default_queue);
queue_tc_mapping = info[j]->queue_tc_mapping;
queue_priority_mapping = info[j]->queue_priority_mapping; queue_priority_mapping = info[j]->queue_priority_mapping;
/* Event queue to TC mapping */
for (i = 0; queue_tc_mapping[i][0] != -1; i++)
map_queue_tc(j, queue_tc_mapping[i][0],
queue_tc_mapping[i][1]);
/* Event queue priority mapping */ /* Event queue priority mapping */
for (i = 0; queue_priority_mapping[i][0] != -1; i++) for (i = 0; queue_priority_mapping[i][0] != -1; i++)
assign_priority_to_queue(j, assign_priority_to_queue(j,
...@@ -1762,7 +1757,7 @@ static int edma_probe(struct platform_device *pdev) ...@@ -1762,7 +1757,7 @@ static int edma_probe(struct platform_device *pdev)
if (edma_read(j, EDMA_CCCFG) & CHMAP_EXIST) if (edma_read(j, EDMA_CCCFG) & CHMAP_EXIST)
map_dmach_param(j); map_dmach_param(j);
for (i = 0; i < info[j]->n_region; i++) { for (i = 0; i < edma_cc[j]->num_region; i++) {
edma_write_array2(j, EDMA_DRAE, i, 0, 0x0); edma_write_array2(j, EDMA_DRAE, i, 0, 0x0);
edma_write_array2(j, EDMA_DRAE, i, 1, 0x0); edma_write_array2(j, EDMA_DRAE, i, 1, 0x0);
edma_write_array(j, EDMA_QRAE, i, 0x0); edma_write_array(j, EDMA_QRAE, i, 0x0);
......
...@@ -134,13 +134,6 @@ struct platform_device da8xx_serial_device[] = { ...@@ -134,13 +134,6 @@ struct platform_device da8xx_serial_device[] = {
} }
}; };
static s8 da8xx_queue_tc_mapping[][2] = {
/* {event queue no, TC no} */
{0, 0},
{1, 1},
{-1, -1}
};
static s8 da8xx_queue_priority_mapping[][2] = { static s8 da8xx_queue_priority_mapping[][2] = {
/* {event queue no, Priority} */ /* {event queue no, Priority} */
{0, 3}, {0, 3},
...@@ -148,12 +141,6 @@ static s8 da8xx_queue_priority_mapping[][2] = { ...@@ -148,12 +141,6 @@ static s8 da8xx_queue_priority_mapping[][2] = {
{-1, -1} {-1, -1}
}; };
static s8 da850_queue_tc_mapping[][2] = {
/* {event queue no, TC no} */
{0, 0},
{-1, -1}
};
static s8 da850_queue_priority_mapping[][2] = { static s8 da850_queue_priority_mapping[][2] = {
/* {event queue no, Priority} */ /* {event queue no, Priority} */
{0, 3}, {0, 3},
...@@ -161,12 +148,6 @@ static s8 da850_queue_priority_mapping[][2] = { ...@@ -161,12 +148,6 @@ static s8 da850_queue_priority_mapping[][2] = {
}; };
static struct edma_soc_info da830_edma_cc0_info = { static struct edma_soc_info da830_edma_cc0_info = {
.n_channel = 32,
.n_region = 4,
.n_slot = 128,
.n_tc = 2,
.n_cc = 1,
.queue_tc_mapping = da8xx_queue_tc_mapping,
.queue_priority_mapping = da8xx_queue_priority_mapping, .queue_priority_mapping = da8xx_queue_priority_mapping,
.default_queue = EVENTQ_1, .default_queue = EVENTQ_1,
}; };
...@@ -177,22 +158,10 @@ static struct edma_soc_info *da830_edma_info[EDMA_MAX_CC] = { ...@@ -177,22 +158,10 @@ static struct edma_soc_info *da830_edma_info[EDMA_MAX_CC] = {
static struct edma_soc_info da850_edma_cc_info[] = { static struct edma_soc_info da850_edma_cc_info[] = {
{ {
.n_channel = 32,
.n_region = 4,
.n_slot = 128,
.n_tc = 2,
.n_cc = 1,
.queue_tc_mapping = da8xx_queue_tc_mapping,
.queue_priority_mapping = da8xx_queue_priority_mapping, .queue_priority_mapping = da8xx_queue_priority_mapping,
.default_queue = EVENTQ_1, .default_queue = EVENTQ_1,
}, },
{ {
.n_channel = 32,
.n_region = 4,
.n_slot = 128,
.n_tc = 1,
.n_cc = 1,
.queue_tc_mapping = da850_queue_tc_mapping,
.queue_priority_mapping = da850_queue_priority_mapping, .queue_priority_mapping = da850_queue_priority_mapping,
.default_queue = EVENTQ_0, .default_queue = EVENTQ_0,
}, },
......
...@@ -568,14 +568,6 @@ static u8 dm355_default_priorities[DAVINCI_N_AINTC_IRQ] = { ...@@ -568,14 +568,6 @@ static u8 dm355_default_priorities[DAVINCI_N_AINTC_IRQ] = {
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/
static s8
queue_tc_mapping[][2] = {
/* {event queue no, TC no} */
{0, 0},
{1, 1},
{-1, -1},
};
static s8 static s8
queue_priority_mapping[][2] = { queue_priority_mapping[][2] = {
/* {event queue no, Priority} */ /* {event queue no, Priority} */
...@@ -585,12 +577,6 @@ queue_priority_mapping[][2] = { ...@@ -585,12 +577,6 @@ queue_priority_mapping[][2] = {
}; };
static struct edma_soc_info edma_cc0_info = { static struct edma_soc_info edma_cc0_info = {
.n_channel = 64,
.n_region = 4,
.n_slot = 128,
.n_tc = 2,
.n_cc = 1,
.queue_tc_mapping = queue_tc_mapping,
.queue_priority_mapping = queue_priority_mapping, .queue_priority_mapping = queue_priority_mapping,
.default_queue = EVENTQ_1, .default_queue = EVENTQ_1,
}; };
......
...@@ -852,16 +852,6 @@ static u8 dm365_default_priorities[DAVINCI_N_AINTC_IRQ] = { ...@@ -852,16 +852,6 @@ static u8 dm365_default_priorities[DAVINCI_N_AINTC_IRQ] = {
}; };
/* Four Transfer Controllers on DM365 */ /* Four Transfer Controllers on DM365 */
static s8
dm365_queue_tc_mapping[][2] = {
/* {event queue no, TC no} */
{0, 0},
{1, 1},
{2, 2},
{3, 3},
{-1, -1},
};
static s8 static s8
dm365_queue_priority_mapping[][2] = { dm365_queue_priority_mapping[][2] = {
/* {event queue no, Priority} */ /* {event queue no, Priority} */
...@@ -873,12 +863,6 @@ dm365_queue_priority_mapping[][2] = { ...@@ -873,12 +863,6 @@ dm365_queue_priority_mapping[][2] = {
}; };
static struct edma_soc_info edma_cc0_info = { static struct edma_soc_info edma_cc0_info = {
.n_channel = 64,
.n_region = 4,
.n_slot = 256,
.n_tc = 4,
.n_cc = 1,
.queue_tc_mapping = dm365_queue_tc_mapping,
.queue_priority_mapping = dm365_queue_priority_mapping, .queue_priority_mapping = dm365_queue_priority_mapping,
.default_queue = EVENTQ_3, .default_queue = EVENTQ_3,
}; };
......
...@@ -498,14 +498,6 @@ static u8 dm644x_default_priorities[DAVINCI_N_AINTC_IRQ] = { ...@@ -498,14 +498,6 @@ static u8 dm644x_default_priorities[DAVINCI_N_AINTC_IRQ] = {
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/
static s8
queue_tc_mapping[][2] = {
/* {event queue no, TC no} */
{0, 0},
{1, 1},
{-1, -1},
};
static s8 static s8
queue_priority_mapping[][2] = { queue_priority_mapping[][2] = {
/* {event queue no, Priority} */ /* {event queue no, Priority} */
...@@ -515,12 +507,6 @@ queue_priority_mapping[][2] = { ...@@ -515,12 +507,6 @@ queue_priority_mapping[][2] = {
}; };
static struct edma_soc_info edma_cc0_info = { static struct edma_soc_info edma_cc0_info = {
.n_channel = 64,
.n_region = 4,
.n_slot = 128,
.n_tc = 2,
.n_cc = 1,
.queue_tc_mapping = queue_tc_mapping,
.queue_priority_mapping = queue_priority_mapping, .queue_priority_mapping = queue_priority_mapping,
.default_queue = EVENTQ_1, .default_queue = EVENTQ_1,
}; };
......
...@@ -532,16 +532,6 @@ static u8 dm646x_default_priorities[DAVINCI_N_AINTC_IRQ] = { ...@@ -532,16 +532,6 @@ static u8 dm646x_default_priorities[DAVINCI_N_AINTC_IRQ] = {
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/
/* Four Transfer Controllers on DM646x */ /* Four Transfer Controllers on DM646x */
static s8
dm646x_queue_tc_mapping[][2] = {
/* {event queue no, TC no} */
{0, 0},
{1, 1},
{2, 2},
{3, 3},
{-1, -1},
};
static s8 static s8
dm646x_queue_priority_mapping[][2] = { dm646x_queue_priority_mapping[][2] = {
/* {event queue no, Priority} */ /* {event queue no, Priority} */
...@@ -553,12 +543,6 @@ dm646x_queue_priority_mapping[][2] = { ...@@ -553,12 +543,6 @@ dm646x_queue_priority_mapping[][2] = {
}; };
static struct edma_soc_info edma_cc0_info = { static struct edma_soc_info edma_cc0_info = {
.n_channel = 64,
.n_region = 6, /* 0-1, 4-7 */
.n_slot = 512,
.n_tc = 4,
.n_cc = 1,
.queue_tc_mapping = dm646x_queue_tc_mapping,
.queue_priority_mapping = dm646x_queue_priority_mapping, .queue_priority_mapping = dm646x_queue_priority_mapping,
.default_queue = EVENTQ_1, .default_queue = EVENTQ_1,
}; };
......
...@@ -18,7 +18,6 @@ obj-$(CONFIG_ARCH_EXYNOS) += exynos.o pmu.o exynos-smc.o firmware.o ...@@ -18,7 +18,6 @@ obj-$(CONFIG_ARCH_EXYNOS) += exynos.o pmu.o exynos-smc.o firmware.o
obj-$(CONFIG_PM_SLEEP) += pm.o sleep.o obj-$(CONFIG_PM_SLEEP) += pm.o sleep.o
obj-$(CONFIG_PM_GENERIC_DOMAINS) += pm_domains.o obj-$(CONFIG_PM_GENERIC_DOMAINS) += pm_domains.o
obj-$(CONFIG_CPU_IDLE) += cpuidle.o
obj-$(CONFIG_SMP) += platsmp.o headsmp.o obj-$(CONFIG_SMP) += platsmp.o headsmp.o
......
...@@ -115,6 +115,7 @@ void mct_init(void __iomem *base, int irq_g0, int irq_l0, int irq_l1); ...@@ -115,6 +115,7 @@ void mct_init(void __iomem *base, int irq_g0, int irq_l0, int irq_l1);
struct map_desc; struct map_desc;
extern void __iomem *sysram_ns_base_addr; extern void __iomem *sysram_ns_base_addr;
extern void __iomem *sysram_base_addr;
void exynos_init_io(void); void exynos_init_io(void);
void exynos_restart(enum reboot_mode mode, const char *cmd); void exynos_restart(enum reboot_mode mode, const char *cmd);
void exynos_cpuidle_init(void); void exynos_cpuidle_init(void);
...@@ -165,6 +166,7 @@ extern int exynos_cpu_power_state(int cpu); ...@@ -165,6 +166,7 @@ extern int exynos_cpu_power_state(int cpu);
extern void exynos_cluster_power_down(int cluster); extern void exynos_cluster_power_down(int cluster);
extern void exynos_cluster_power_up(int cluster); extern void exynos_cluster_power_up(int cluster);
extern int exynos_cluster_power_state(int cluster); extern int exynos_cluster_power_state(int cluster);
extern void exynos_enter_aftr(void);
extern void s5p_init_cpu(void __iomem *cpuid_addr); extern void s5p_init_cpu(void __iomem *cpuid_addr);
extern unsigned int samsung_rev(void); extern unsigned int samsung_rev(void);
......
/* linux/arch/arm/mach-exynos4/cpuidle.c
*
* Copyright (c) 2011 Samsung Electronics Co., Ltd.
* http://www.samsung.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.
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/cpuidle.h>
#include <linux/cpu_pm.h>
#include <linux/io.h>
#include <linux/export.h>
#include <linux/module.h>
#include <linux/time.h>
#include <linux/platform_device.h>
#include <asm/proc-fns.h>
#include <asm/smp_scu.h>
#include <asm/suspend.h>
#include <asm/unified.h>
#include <asm/cpuidle.h>
#include <plat/pm.h>
#include <mach/map.h>
#include "common.h"
#include "regs-pmu.h"
#define REG_DIRECTGO_ADDR (samsung_rev() == EXYNOS4210_REV_1_1 ? \
S5P_INFORM7 : (samsung_rev() == EXYNOS4210_REV_1_0 ? \
(S5P_VA_SYSRAM + 0x24) : S5P_INFORM0))
#define REG_DIRECTGO_FLAG (samsung_rev() == EXYNOS4210_REV_1_1 ? \
S5P_INFORM6 : (samsung_rev() == EXYNOS4210_REV_1_0 ? \
(S5P_VA_SYSRAM + 0x20) : S5P_INFORM1))
#define S5P_CHECK_AFTR 0xFCBA0D10
#define EXYNOS5_PWR_CTRL1 (S5P_VA_CMU + 0x01020)
#define EXYNOS5_PWR_CTRL2 (S5P_VA_CMU + 0x01024)
#define PWR_CTRL1_CORE2_DOWN_RATIO (7 << 28)
#define PWR_CTRL1_CORE1_DOWN_RATIO (7 << 16)
#define PWR_CTRL1_DIV2_DOWN_EN (1 << 9)
#define PWR_CTRL1_DIV1_DOWN_EN (1 << 8)
#define PWR_CTRL1_USE_CORE1_WFE (1 << 5)
#define PWR_CTRL1_USE_CORE0_WFE (1 << 4)
#define PWR_CTRL1_USE_CORE1_WFI (1 << 1)
#define PWR_CTRL1_USE_CORE0_WFI (1 << 0)
#define PWR_CTRL2_DIV2_UP_EN (1 << 25)
#define PWR_CTRL2_DIV1_UP_EN (1 << 24)
#define PWR_CTRL2_DUR_STANDBY2_VAL (1 << 16)
#define PWR_CTRL2_DUR_STANDBY1_VAL (1 << 8)
#define PWR_CTRL2_CORE2_UP_RATIO (1 << 4)
#define PWR_CTRL2_CORE1_UP_RATIO (1 << 0)
static int exynos4_enter_lowpower(struct cpuidle_device *dev,
struct cpuidle_driver *drv,
int index);
static DEFINE_PER_CPU(struct cpuidle_device, exynos4_cpuidle_device);
static struct cpuidle_driver exynos4_idle_driver = {
.name = "exynos4_idle",
.owner = THIS_MODULE,
.states = {
[0] = ARM_CPUIDLE_WFI_STATE,
[1] = {
.enter = exynos4_enter_lowpower,
.exit_latency = 300,
.target_residency = 100000,
.flags = CPUIDLE_FLAG_TIME_VALID,
.name = "C1",
.desc = "ARM power down",
},
},
.state_count = 2,
.safe_state_index = 0,
};
/* Ext-GIC nIRQ/nFIQ is the only wakeup source in AFTR */
static void exynos4_set_wakeupmask(void)
{
__raw_writel(0x0000ff3e, S5P_WAKEUP_MASK);
}
static unsigned int g_pwr_ctrl, g_diag_reg;
static void save_cpu_arch_register(void)
{
/*read power control register*/
asm("mrc p15, 0, %0, c15, c0, 0" : "=r"(g_pwr_ctrl) : : "cc");
/*read diagnostic register*/
asm("mrc p15, 0, %0, c15, c0, 1" : "=r"(g_diag_reg) : : "cc");
return;
}
static void restore_cpu_arch_register(void)
{
/*write power control register*/
asm("mcr p15, 0, %0, c15, c0, 0" : : "r"(g_pwr_ctrl) : "cc");
/*write diagnostic register*/
asm("mcr p15, 0, %0, c15, c0, 1" : : "r"(g_diag_reg) : "cc");
return;
}
static int idle_finisher(unsigned long flags)
{
cpu_do_idle();
return 1;
}
static int exynos4_enter_core0_aftr(struct cpuidle_device *dev,
struct cpuidle_driver *drv,
int index)
{
unsigned long tmp;
exynos4_set_wakeupmask();
/* Set value of power down register for aftr mode */
exynos_sys_powerdown_conf(SYS_AFTR);
__raw_writel(virt_to_phys(exynos_cpu_resume), REG_DIRECTGO_ADDR);
__raw_writel(S5P_CHECK_AFTR, REG_DIRECTGO_FLAG);
save_cpu_arch_register();
/* Setting Central Sequence Register for power down mode */
tmp = __raw_readl(S5P_CENTRAL_SEQ_CONFIGURATION);
tmp &= ~S5P_CENTRAL_LOWPWR_CFG;
__raw_writel(tmp, S5P_CENTRAL_SEQ_CONFIGURATION);
cpu_pm_enter();
cpu_suspend(0, idle_finisher);
#ifdef CONFIG_SMP
if (!soc_is_exynos5250())
scu_enable(S5P_VA_SCU);
#endif
cpu_pm_exit();
restore_cpu_arch_register();
/*
* If PMU failed while entering sleep mode, WFI will be
* ignored by PMU and then exiting cpu_do_idle().
* S5P_CENTRAL_LOWPWR_CFG bit will not be set automatically
* in this situation.
*/
tmp = __raw_readl(S5P_CENTRAL_SEQ_CONFIGURATION);
if (!(tmp & S5P_CENTRAL_LOWPWR_CFG)) {
tmp |= S5P_CENTRAL_LOWPWR_CFG;
__raw_writel(tmp, S5P_CENTRAL_SEQ_CONFIGURATION);
}
/* Clear wakeup state register */
__raw_writel(0x0, S5P_WAKEUP_STAT);
return index;
}
static int exynos4_enter_lowpower(struct cpuidle_device *dev,
struct cpuidle_driver *drv,
int index)
{
int new_index = index;
/* AFTR can only be entered when cores other than CPU0 are offline */
if (num_online_cpus() > 1 || dev->cpu != 0)
new_index = drv->safe_state_index;
if (new_index == 0)
return arm_cpuidle_simple_enter(dev, drv, new_index);
else
return exynos4_enter_core0_aftr(dev, drv, new_index);
}
static void __init exynos5_core_down_clk(void)
{
unsigned int tmp;
/*
* Enable arm clock down (in idle) and set arm divider
* ratios in WFI/WFE state.
*/
tmp = PWR_CTRL1_CORE2_DOWN_RATIO | \
PWR_CTRL1_CORE1_DOWN_RATIO | \
PWR_CTRL1_DIV2_DOWN_EN | \
PWR_CTRL1_DIV1_DOWN_EN | \
PWR_CTRL1_USE_CORE1_WFE | \
PWR_CTRL1_USE_CORE0_WFE | \
PWR_CTRL1_USE_CORE1_WFI | \
PWR_CTRL1_USE_CORE0_WFI;
__raw_writel(tmp, EXYNOS5_PWR_CTRL1);
/*
* Enable arm clock up (on exiting idle). Set arm divider
* ratios when not in idle along with the standby duration
* ratios.
*/
tmp = PWR_CTRL2_DIV2_UP_EN | \
PWR_CTRL2_DIV1_UP_EN | \
PWR_CTRL2_DUR_STANDBY2_VAL | \
PWR_CTRL2_DUR_STANDBY1_VAL | \
PWR_CTRL2_CORE2_UP_RATIO | \
PWR_CTRL2_CORE1_UP_RATIO;
__raw_writel(tmp, EXYNOS5_PWR_CTRL2);
}
static int exynos_cpuidle_probe(struct platform_device *pdev)
{
int cpu_id, ret;
struct cpuidle_device *device;
if (soc_is_exynos5250())
exynos5_core_down_clk();
if (soc_is_exynos5440())
exynos4_idle_driver.state_count = 1;
ret = cpuidle_register_driver(&exynos4_idle_driver);
if (ret) {
dev_err(&pdev->dev, "failed to register cpuidle driver\n");
return ret;
}
for_each_online_cpu(cpu_id) {
device = &per_cpu(exynos4_cpuidle_device, cpu_id);
device->cpu = cpu_id;
ret = cpuidle_register_device(device);
if (ret) {
dev_err(&pdev->dev, "failed to register cpuidle device\n");
return ret;
}
}
return 0;
}
static struct platform_driver exynos_cpuidle_driver = {
.probe = exynos_cpuidle_probe,
.driver = {
.name = "exynos_cpuidle",
.owner = THIS_MODULE,
},
};
module_platform_driver(exynos_cpuidle_driver);
...@@ -169,12 +169,16 @@ void exynos_restart(enum reboot_mode mode, const char *cmd) ...@@ -169,12 +169,16 @@ void exynos_restart(enum reboot_mode mode, const char *cmd)
} }
static struct platform_device exynos_cpuidle = { static struct platform_device exynos_cpuidle = {
.name = "exynos_cpuidle", .name = "exynos_cpuidle",
.id = -1, .dev.platform_data = exynos_enter_aftr,
.id = -1,
}; };
void __init exynos_cpuidle_init(void) void __init exynos_cpuidle_init(void)
{ {
if (soc_is_exynos5440())
return;
platform_device_register(&exynos_cpuidle); platform_device_register(&exynos_cpuidle);
} }
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
extern void exynos4_secondary_startup(void); extern void exynos4_secondary_startup(void);
static void __iomem *sysram_base_addr; void __iomem *sysram_base_addr;
void __iomem *sysram_ns_base_addr; void __iomem *sysram_ns_base_addr;
static void __init exynos_smp_prepare_sysram(void) static void __init exynos_smp_prepare_sysram(void)
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/suspend.h> #include <linux/suspend.h>
#include <linux/syscore_ops.h> #include <linux/syscore_ops.h>
#include <linux/cpu_pm.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/irqchip/arm-gic.h> #include <linux/irqchip/arm-gic.h>
#include <linux/err.h> #include <linux/err.h>
...@@ -165,9 +166,75 @@ int exynos_cluster_power_state(int cluster) ...@@ -165,9 +166,75 @@ int exynos_cluster_power_state(int cluster)
S5P_CORE_LOCAL_PWR_EN); S5P_CORE_LOCAL_PWR_EN);
} }
#define EXYNOS_BOOT_VECTOR_ADDR (samsung_rev() == EXYNOS4210_REV_1_1 ? \
S5P_INFORM7 : (samsung_rev() == EXYNOS4210_REV_1_0 ? \
(sysram_base_addr + 0x24) : S5P_INFORM0))
#define EXYNOS_BOOT_VECTOR_FLAG (samsung_rev() == EXYNOS4210_REV_1_1 ? \
S5P_INFORM6 : (samsung_rev() == EXYNOS4210_REV_1_0 ? \
(sysram_base_addr + 0x20) : S5P_INFORM1))
#define S5P_CHECK_AFTR 0xFCBA0D10
#define S5P_CHECK_SLEEP 0x00000BAD
/* Ext-GIC nIRQ/nFIQ is the only wakeup source in AFTR */
static void exynos_set_wakeupmask(long mask)
{
__raw_writel(mask, S5P_WAKEUP_MASK);
}
static void exynos_cpu_set_boot_vector(long flags)
{
__raw_writel(virt_to_phys(exynos_cpu_resume), EXYNOS_BOOT_VECTOR_ADDR);
__raw_writel(flags, EXYNOS_BOOT_VECTOR_FLAG);
}
void exynos_enter_aftr(void)
{
exynos_set_wakeupmask(0x0000ff3e);
exynos_cpu_set_boot_vector(S5P_CHECK_AFTR);
/* Set value of power down register for aftr mode */
exynos_sys_powerdown_conf(SYS_AFTR);
}
/* For Cortex-A9 Diagnostic and Power control register */ /* For Cortex-A9 Diagnostic and Power control register */
static unsigned int save_arm_register[2]; static unsigned int save_arm_register[2];
static void exynos_cpu_save_register(void)
{
unsigned long tmp;
/* Save Power control register */
asm ("mrc p15, 0, %0, c15, c0, 0"
: "=r" (tmp) : : "cc");
save_arm_register[0] = tmp;
/* Save Diagnostic register */
asm ("mrc p15, 0, %0, c15, c0, 1"
: "=r" (tmp) : : "cc");
save_arm_register[1] = tmp;
}
static void exynos_cpu_restore_register(void)
{
unsigned long tmp;
/* Restore Power control register */
tmp = save_arm_register[0];
asm volatile ("mcr p15, 0, %0, c15, c0, 0"
: : "r" (tmp)
: "cc");
/* Restore Diagnostic register */
tmp = save_arm_register[1];
asm volatile ("mcr p15, 0, %0, c15, c0, 1"
: : "r" (tmp)
: "cc");
}
static int exynos_cpu_suspend(unsigned long arg) static int exynos_cpu_suspend(unsigned long arg)
{ {
#ifdef CONFIG_CACHE_L2X0 #ifdef CONFIG_CACHE_L2X0
...@@ -212,37 +279,34 @@ static void exynos_pm_prepare(void) ...@@ -212,37 +279,34 @@ static void exynos_pm_prepare(void)
__raw_writel(virt_to_phys(exynos_cpu_resume), S5P_INFORM0); __raw_writel(virt_to_phys(exynos_cpu_resume), S5P_INFORM0);
} }
static int exynos_pm_suspend(void) static void exynos_pm_central_suspend(void)
{ {
unsigned long tmp; unsigned long tmp;
/* Setting Central Sequence Register for power down mode */ /* Setting Central Sequence Register for power down mode */
tmp = __raw_readl(S5P_CENTRAL_SEQ_CONFIGURATION); tmp = __raw_readl(S5P_CENTRAL_SEQ_CONFIGURATION);
tmp &= ~S5P_CENTRAL_LOWPWR_CFG; tmp &= ~S5P_CENTRAL_LOWPWR_CFG;
__raw_writel(tmp, S5P_CENTRAL_SEQ_CONFIGURATION); __raw_writel(tmp, S5P_CENTRAL_SEQ_CONFIGURATION);
}
static int exynos_pm_suspend(void)
{
unsigned long tmp;
exynos_pm_central_suspend();
/* Setting SEQ_OPTION register */ /* Setting SEQ_OPTION register */
tmp = (S5P_USE_STANDBY_WFI0 | S5P_USE_STANDBY_WFE0); tmp = (S5P_USE_STANDBY_WFI0 | S5P_USE_STANDBY_WFE0);
__raw_writel(tmp, S5P_CENTRAL_SEQ_OPTION); __raw_writel(tmp, S5P_CENTRAL_SEQ_OPTION);
if (!soc_is_exynos5250()) { if (!soc_is_exynos5250())
/* Save Power control register */ exynos_cpu_save_register();
asm ("mrc p15, 0, %0, c15, c0, 0"
: "=r" (tmp) : : "cc");
save_arm_register[0] = tmp;
/* Save Diagnostic register */
asm ("mrc p15, 0, %0, c15, c0, 1"
: "=r" (tmp) : : "cc");
save_arm_register[1] = tmp;
}
return 0; return 0;
} }
static void exynos_pm_resume(void) static int exynos_pm_central_resume(void)
{ {
unsigned long tmp; unsigned long tmp;
...@@ -259,22 +323,20 @@ static void exynos_pm_resume(void) ...@@ -259,22 +323,20 @@ static void exynos_pm_resume(void)
/* clear the wakeup state register */ /* clear the wakeup state register */
__raw_writel(0x0, S5P_WAKEUP_STAT); __raw_writel(0x0, S5P_WAKEUP_STAT);
/* No need to perform below restore code */ /* No need to perform below restore code */
goto early_wakeup; return -1;
}
if (!soc_is_exynos5250()) {
/* Restore Power control register */
tmp = save_arm_register[0];
asm volatile ("mcr p15, 0, %0, c15, c0, 0"
: : "r" (tmp)
: "cc");
/* Restore Diagnostic register */
tmp = save_arm_register[1];
asm volatile ("mcr p15, 0, %0, c15, c0, 1"
: : "r" (tmp)
: "cc");
} }
return 0;
}
static void exynos_pm_resume(void)
{
if (exynos_pm_central_resume())
goto early_wakeup;
if (!soc_is_exynos5250())
exynos_cpu_restore_register();
/* For release retention */ /* For release retention */
__raw_writel((1 << 28), S5P_PAD_RET_MAUDIO_OPTION); __raw_writel((1 << 28), S5P_PAD_RET_MAUDIO_OPTION);
...@@ -291,7 +353,7 @@ static void exynos_pm_resume(void) ...@@ -291,7 +353,7 @@ static void exynos_pm_resume(void)
s3c_pm_do_restore_core(exynos_core_save, ARRAY_SIZE(exynos_core_save)); s3c_pm_do_restore_core(exynos_core_save, ARRAY_SIZE(exynos_core_save));
if (IS_ENABLED(CONFIG_SMP) && !soc_is_exynos5250()) if (!soc_is_exynos5250())
scu_enable(S5P_VA_SCU); scu_enable(S5P_VA_SCU);
early_wakeup: early_wakeup:
...@@ -369,10 +431,42 @@ static const struct platform_suspend_ops exynos_suspend_ops = { ...@@ -369,10 +431,42 @@ static const struct platform_suspend_ops exynos_suspend_ops = {
.valid = suspend_valid_only_mem, .valid = suspend_valid_only_mem,
}; };
static int exynos_cpu_pm_notifier(struct notifier_block *self,
unsigned long cmd, void *v)
{
int cpu = smp_processor_id();
switch (cmd) {
case CPU_PM_ENTER:
if (cpu == 0) {
exynos_pm_central_suspend();
exynos_cpu_save_register();
}
break;
case CPU_PM_EXIT:
if (cpu == 0) {
if (!soc_is_exynos5250())
scu_enable(S5P_VA_SCU);
exynos_cpu_restore_register();
exynos_pm_central_resume();
}
break;
}
return NOTIFY_OK;
}
static struct notifier_block exynos_cpu_pm_notifier_block = {
.notifier_call = exynos_cpu_pm_notifier,
};
void __init exynos_pm_init(void) void __init exynos_pm_init(void)
{ {
u32 tmp; u32 tmp;
cpu_pm_register_notifier(&exynos_cpu_pm_notifier_block);
/* Platform-specific GIC callback */ /* Platform-specific GIC callback */
gic_arch_extn.irq_set_wake = exynos_irq_set_wake; gic_arch_extn.irq_set_wake = exynos_irq_set_wake;
......
...@@ -129,8 +129,6 @@ ...@@ -129,8 +129,6 @@
#define S5P_CORE_LOCAL_PWR_EN 0x3 #define S5P_CORE_LOCAL_PWR_EN 0x3
#define S5P_INT_LOCAL_PWR_EN 0x7 #define S5P_INT_LOCAL_PWR_EN 0x7
#define S5P_CHECK_SLEEP 0x00000BAD
/* Only for EXYNOS4210 */ /* Only for EXYNOS4210 */
#define S5P_CMU_CLKSTOP_LCD1_LOWPWR S5P_PMUREG(0x1154) #define S5P_CMU_CLKSTOP_LCD1_LOWPWR S5P_PMUREG(0x1154)
#define S5P_CMU_RESET_LCD1_LOWPWR S5P_PMUREG(0x1174) #define S5P_CMU_RESET_LCD1_LOWPWR S5P_PMUREG(0x1174)
......
...@@ -132,6 +132,8 @@ source "drivers/staging/Kconfig" ...@@ -132,6 +132,8 @@ source "drivers/staging/Kconfig"
source "drivers/platform/Kconfig" source "drivers/platform/Kconfig"
source "drivers/soc/Kconfig"
source "drivers/clk/Kconfig" source "drivers/clk/Kconfig"
source "drivers/hwspinlock/Kconfig" source "drivers/hwspinlock/Kconfig"
......
...@@ -33,6 +33,9 @@ obj-y += amba/ ...@@ -33,6 +33,9 @@ obj-y += amba/
# really early. # really early.
obj-$(CONFIG_DMADEVICES) += dma/ obj-$(CONFIG_DMADEVICES) += dma/
# SOC specific infrastructure drivers.
obj-y += soc/
obj-$(CONFIG_VIRTIO) += virtio/ obj-$(CONFIG_VIRTIO) += virtio/
obj-$(CONFIG_XEN) += xen/ obj-$(CONFIG_XEN) += xen/
......
...@@ -4,6 +4,14 @@ ...@@ -4,6 +4,14 @@
menu "Bus devices" menu "Bus devices"
config BRCMSTB_GISB_ARB
bool "Broadcom STB GISB bus arbiter"
depends on ARM
help
Driver for the Broadcom Set Top Box System-on-a-chip internal bus
arbiter. This driver provides timeout and target abort error handling
and internal bus master decoding.
config IMX_WEIM config IMX_WEIM
bool "Freescale EIM DRIVER" bool "Freescale EIM DRIVER"
depends on ARCH_MXC depends on ARCH_MXC
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
# Makefile for the bus drivers. # Makefile for the bus drivers.
# #
obj-$(CONFIG_BRCMSTB_GISB_ARB) += brcmstb_gisb.o
obj-$(CONFIG_IMX_WEIM) += imx-weim.o obj-$(CONFIG_IMX_WEIM) += imx-weim.o
obj-$(CONFIG_MVEBU_MBUS) += mvebu-mbus.o obj-$(CONFIG_MVEBU_MBUS) += mvebu-mbus.o
obj-$(CONFIG_OMAP_OCP2SCP) += omap-ocp2scp.o obj-$(CONFIG_OMAP_OCP2SCP) += omap-ocp2scp.o
......
/*
* Copyright (C) 2014 Broadcom Corporation
*
* 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 program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <linux/init.h>
#include <linux/types.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/interrupt.h>
#include <linux/sysfs.h>
#include <linux/io.h>
#include <linux/string.h>
#include <linux/device.h>
#include <linux/list.h>
#include <linux/of.h>
#include <linux/bitops.h>
#include <asm/bug.h>
#include <asm/signal.h>
#define ARB_TIMER 0x008
#define ARB_ERR_CAP_CLR 0x7e4
#define ARB_ERR_CAP_CLEAR (1 << 0)
#define ARB_ERR_CAP_HI_ADDR 0x7e8
#define ARB_ERR_CAP_ADDR 0x7ec
#define ARB_ERR_CAP_DATA 0x7f0
#define ARB_ERR_CAP_STATUS 0x7f4
#define ARB_ERR_CAP_STATUS_TIMEOUT (1 << 12)
#define ARB_ERR_CAP_STATUS_TEA (1 << 11)
#define ARB_ERR_CAP_STATUS_BS_SHIFT (1 << 2)
#define ARB_ERR_CAP_STATUS_BS_MASK 0x3c
#define ARB_ERR_CAP_STATUS_WRITE (1 << 1)
#define ARB_ERR_CAP_STATUS_VALID (1 << 0)
#define ARB_ERR_CAP_MASTER 0x7f8
struct brcmstb_gisb_arb_device {
void __iomem *base;
struct mutex lock;
struct list_head next;
u32 valid_mask;
const char *master_names[sizeof(u32) * BITS_PER_BYTE];
};
static LIST_HEAD(brcmstb_gisb_arb_device_list);
static ssize_t gisb_arb_get_timeout(struct device *dev,
struct device_attribute *attr,
char *buf)
{
struct platform_device *pdev = to_platform_device(dev);
struct brcmstb_gisb_arb_device *gdev = platform_get_drvdata(pdev);
u32 timeout;
mutex_lock(&gdev->lock);
timeout = ioread32(gdev->base + ARB_TIMER);
mutex_unlock(&gdev->lock);
return sprintf(buf, "%d", timeout);
}
static ssize_t gisb_arb_set_timeout(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct platform_device *pdev = to_platform_device(dev);
struct brcmstb_gisb_arb_device *gdev = platform_get_drvdata(pdev);
int val, ret;
ret = kstrtoint(buf, 10, &val);
if (ret < 0)
return ret;
if (val == 0 || val >= 0xffffffff)
return -EINVAL;
mutex_lock(&gdev->lock);
iowrite32(val, gdev->base + ARB_TIMER);
mutex_unlock(&gdev->lock);
return count;
}
static const char *
brcmstb_gisb_master_to_str(struct brcmstb_gisb_arb_device *gdev,
u32 masters)
{
u32 mask = gdev->valid_mask & masters;
if (hweight_long(mask) != 1)
return NULL;
return gdev->master_names[ffs(mask) - 1];
}
static int brcmstb_gisb_arb_decode_addr(struct brcmstb_gisb_arb_device *gdev,
const char *reason)
{
u32 cap_status;
unsigned long arb_addr;
u32 master;
const char *m_name;
char m_fmt[11];
cap_status = ioread32(gdev->base + ARB_ERR_CAP_STATUS);
/* Invalid captured address, bail out */
if (!(cap_status & ARB_ERR_CAP_STATUS_VALID))
return 1;
/* Read the address and master */
arb_addr = ioread32(gdev->base + ARB_ERR_CAP_ADDR) & 0xffffffff;
#if (IS_ENABLED(CONFIG_PHYS_ADDR_T_64BIT))
arb_addr |= (u64)ioread32(gdev->base + ARB_ERR_CAP_HI_ADDR) << 32;
#endif
master = ioread32(gdev->base + ARB_ERR_CAP_MASTER);
m_name = brcmstb_gisb_master_to_str(gdev, master);
if (!m_name) {
snprintf(m_fmt, sizeof(m_fmt), "0x%08x", master);
m_name = m_fmt;
}
pr_crit("%s: %s at 0x%lx [%c %s], core: %s\n",
__func__, reason, arb_addr,
cap_status & ARB_ERR_CAP_STATUS_WRITE ? 'W' : 'R',
cap_status & ARB_ERR_CAP_STATUS_TIMEOUT ? "timeout" : "",
m_name);
/* clear the GISB error */
iowrite32(ARB_ERR_CAP_CLEAR, gdev->base + ARB_ERR_CAP_CLR);
return 0;
}
static int brcmstb_bus_error_handler(unsigned long addr, unsigned int fsr,
struct pt_regs *regs)
{
int ret = 0;
struct brcmstb_gisb_arb_device *gdev;
/* iterate over each GISB arb registered handlers */
list_for_each_entry(gdev, &brcmstb_gisb_arb_device_list, next)
ret |= brcmstb_gisb_arb_decode_addr(gdev, "bus error");
/*
* If it was an imprecise abort, then we need to correct the
* return address to be _after_ the instruction.
*/
if (fsr & (1 << 10))
regs->ARM_pc += 4;
return ret;
}
void __init brcmstb_hook_fault_code(void)
{
hook_fault_code(22, brcmstb_bus_error_handler, SIGBUS, 0,
"imprecise external abort");
}
static irqreturn_t brcmstb_gisb_timeout_handler(int irq, void *dev_id)
{
brcmstb_gisb_arb_decode_addr(dev_id, "timeout");
return IRQ_HANDLED;
}
static irqreturn_t brcmstb_gisb_tea_handler(int irq, void *dev_id)
{
brcmstb_gisb_arb_decode_addr(dev_id, "target abort");
return IRQ_HANDLED;
}
static DEVICE_ATTR(gisb_arb_timeout, S_IWUSR | S_IRUGO,
gisb_arb_get_timeout, gisb_arb_set_timeout);
static struct attribute *gisb_arb_sysfs_attrs[] = {
&dev_attr_gisb_arb_timeout.attr,
NULL,
};
static struct attribute_group gisb_arb_sysfs_attr_group = {
.attrs = gisb_arb_sysfs_attrs,
};
static int brcmstb_gisb_arb_probe(struct platform_device *pdev)
{
struct device_node *dn = pdev->dev.of_node;
struct brcmstb_gisb_arb_device *gdev;
struct resource *r;
int err, timeout_irq, tea_irq;
unsigned int num_masters, j = 0;
int i, first, last;
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
timeout_irq = platform_get_irq(pdev, 0);
tea_irq = platform_get_irq(pdev, 1);
gdev = devm_kzalloc(&pdev->dev, sizeof(*gdev), GFP_KERNEL);
if (!gdev)
return -ENOMEM;
mutex_init(&gdev->lock);
INIT_LIST_HEAD(&gdev->next);
gdev->base = devm_request_and_ioremap(&pdev->dev, r);
if (!gdev->base)
return -ENOMEM;
err = devm_request_irq(&pdev->dev, timeout_irq,
brcmstb_gisb_timeout_handler, 0, pdev->name,
gdev);
if (err < 0)
return err;
err = devm_request_irq(&pdev->dev, tea_irq,
brcmstb_gisb_tea_handler, 0, pdev->name,
gdev);
if (err < 0)
return err;
/* If we do not have a valid mask, assume all masters are enabled */
if (of_property_read_u32(dn, "brcm,gisb-arb-master-mask",
&gdev->valid_mask))
gdev->valid_mask = 0xffffffff;
/* Proceed with reading the litteral names if we agree on the
* number of masters
*/
num_masters = of_property_count_strings(dn,
"brcm,gisb-arb-master-names");
if (hweight_long(gdev->valid_mask) == num_masters) {
first = ffs(gdev->valid_mask) - 1;
last = fls(gdev->valid_mask) - 1;
for (i = first; i < last; i++) {
if (!(gdev->valid_mask & BIT(i)))
continue;
of_property_read_string_index(dn,
"brcm,gisb-arb-master-names", j,
&gdev->master_names[i]);
j++;
}
}
err = sysfs_create_group(&pdev->dev.kobj, &gisb_arb_sysfs_attr_group);
if (err)
return err;
platform_set_drvdata(pdev, gdev);
list_add_tail(&gdev->next, &brcmstb_gisb_arb_device_list);
dev_info(&pdev->dev, "registered mem: %p, irqs: %d, %d\n",
gdev->base, timeout_irq, tea_irq);
return 0;
}
static const struct of_device_id brcmstb_gisb_arb_of_match[] = {
{ .compatible = "brcm,gisb-arb" },
{ },
};
static struct platform_driver brcmstb_gisb_arb_driver = {
.probe = brcmstb_gisb_arb_probe,
.driver = {
.name = "brcm-gisb-arb",
.owner = THIS_MODULE,
.of_match_table = brcmstb_gisb_arb_of_match,
},
};
static int __init brcm_gisb_driver_init(void)
{
return platform_driver_register(&brcmstb_gisb_arb_driver);
}
module_init(brcm_gisb_driver_init);
This diff is collapsed.
This diff is collapsed.
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
#define APLL_CON0 0x100 #define APLL_CON0 0x100
#define SRC_CPU 0x200 #define SRC_CPU 0x200
#define DIV_CPU0 0x500 #define DIV_CPU0 0x500
#define PWR_CTRL1 0x1020
#define PWR_CTRL2 0x1024
#define MPLL_LOCK 0x4000 #define MPLL_LOCK 0x4000
#define MPLL_CON0 0x4100 #define MPLL_CON0 0x4100
#define SRC_CORE1 0x4204 #define SRC_CORE1 0x4204
...@@ -84,6 +86,23 @@ ...@@ -84,6 +86,23 @@
#define SRC_CDREX 0x20200 #define SRC_CDREX 0x20200
#define PLL_DIV2_SEL 0x20a24 #define PLL_DIV2_SEL 0x20a24
/*Below definitions are used for PWR_CTRL settings*/
#define PWR_CTRL1_CORE2_DOWN_RATIO (7 << 28)
#define PWR_CTRL1_CORE1_DOWN_RATIO (7 << 16)
#define PWR_CTRL1_DIV2_DOWN_EN (1 << 9)
#define PWR_CTRL1_DIV1_DOWN_EN (1 << 8)
#define PWR_CTRL1_USE_CORE1_WFE (1 << 5)
#define PWR_CTRL1_USE_CORE0_WFE (1 << 4)
#define PWR_CTRL1_USE_CORE1_WFI (1 << 1)
#define PWR_CTRL1_USE_CORE0_WFI (1 << 0)
#define PWR_CTRL2_DIV2_UP_EN (1 << 25)
#define PWR_CTRL2_DIV1_UP_EN (1 << 24)
#define PWR_CTRL2_DUR_STANDBY2_VAL (1 << 16)
#define PWR_CTRL2_DUR_STANDBY1_VAL (1 << 8)
#define PWR_CTRL2_CORE2_UP_RATIO (1 << 4)
#define PWR_CTRL2_CORE1_UP_RATIO (1 << 0)
/* list of PLLs to be registered */ /* list of PLLs to be registered */
enum exynos5250_plls { enum exynos5250_plls {
apll, mpll, cpll, epll, vpll, gpll, bpll, apll, mpll, cpll, epll, vpll, gpll, bpll,
...@@ -102,6 +121,8 @@ static struct samsung_clk_reg_dump *exynos5250_save; ...@@ -102,6 +121,8 @@ static struct samsung_clk_reg_dump *exynos5250_save;
static unsigned long exynos5250_clk_regs[] __initdata = { static unsigned long exynos5250_clk_regs[] __initdata = {
SRC_CPU, SRC_CPU,
DIV_CPU0, DIV_CPU0,
PWR_CTRL1,
PWR_CTRL2,
SRC_CORE1, SRC_CORE1,
SRC_TOP0, SRC_TOP0,
SRC_TOP1, SRC_TOP1,
...@@ -736,6 +757,7 @@ static struct of_device_id ext_clk_match[] __initdata = { ...@@ -736,6 +757,7 @@ static struct of_device_id ext_clk_match[] __initdata = {
static void __init exynos5250_clk_init(struct device_node *np) static void __init exynos5250_clk_init(struct device_node *np)
{ {
struct samsung_clk_provider *ctx; struct samsung_clk_provider *ctx;
unsigned int tmp;
if (np) { if (np) {
reg_base = of_iomap(np, 0); reg_base = of_iomap(np, 0);
...@@ -776,6 +798,26 @@ static void __init exynos5250_clk_init(struct device_node *np) ...@@ -776,6 +798,26 @@ static void __init exynos5250_clk_init(struct device_node *np)
samsung_clk_register_gate(ctx, exynos5250_gate_clks, samsung_clk_register_gate(ctx, exynos5250_gate_clks,
ARRAY_SIZE(exynos5250_gate_clks)); ARRAY_SIZE(exynos5250_gate_clks));
/*
* Enable arm clock down (in idle) and set arm divider
* ratios in WFI/WFE state.
*/
tmp = (PWR_CTRL1_CORE2_DOWN_RATIO | PWR_CTRL1_CORE1_DOWN_RATIO |
PWR_CTRL1_DIV2_DOWN_EN | PWR_CTRL1_DIV1_DOWN_EN |
PWR_CTRL1_USE_CORE1_WFE | PWR_CTRL1_USE_CORE0_WFE |
PWR_CTRL1_USE_CORE1_WFI | PWR_CTRL1_USE_CORE0_WFI);
__raw_writel(tmp, reg_base + PWR_CTRL1);
/*
* Enable arm clock up (on exiting idle). Set arm divider
* ratios when not in idle along with the standby duration
* ratios.
*/
tmp = (PWR_CTRL2_DIV2_UP_EN | PWR_CTRL2_DIV1_UP_EN |
PWR_CTRL2_DUR_STANDBY2_VAL | PWR_CTRL2_DUR_STANDBY1_VAL |
PWR_CTRL2_CORE2_UP_RATIO | PWR_CTRL2_CORE1_UP_RATIO);
__raw_writel(tmp, reg_base + PWR_CTRL2);
exynos5250_clk_sleep_init(); exynos5250_clk_sleep_init();
pr_info("Exynos5250: clock setup completed, armclk=%ld\n", pr_info("Exynos5250: clock setup completed, armclk=%ld\n",
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <linux/of_irq.h> #include <linux/of_irq.h>
#include <linux/of_address.h> #include <linux/of_address.h>
#include <linux/clocksource.h> #include <linux/clocksource.h>
#include <linux/sched_clock.h>
#define EXYNOS4_MCTREG(x) (x) #define EXYNOS4_MCTREG(x) (x)
#define EXYNOS4_MCT_G_CNT_L EXYNOS4_MCTREG(0x100) #define EXYNOS4_MCT_G_CNT_L EXYNOS4_MCTREG(0x100)
...@@ -192,12 +193,19 @@ struct clocksource mct_frc = { ...@@ -192,12 +193,19 @@ struct clocksource mct_frc = {
.resume = exynos4_frc_resume, .resume = exynos4_frc_resume,
}; };
static u64 notrace exynos4_read_sched_clock(void)
{
return exynos4_frc_read(&mct_frc);
}
static void __init exynos4_clocksource_init(void) static void __init exynos4_clocksource_init(void)
{ {
exynos4_mct_frc_start(0, 0); exynos4_mct_frc_start(0, 0);
if (clocksource_register_hz(&mct_frc, clk_rate)) if (clocksource_register_hz(&mct_frc, clk_rate))
panic("%s: can't register clocksource\n", mct_frc.name); panic("%s: can't register clocksource\n", mct_frc.name);
sched_clock_register(exynos4_read_sched_clock, 64, clk_rate);
} }
static void exynos4_mct_comp0_stop(void) static void exynos4_mct_comp0_stop(void)
......
...@@ -30,7 +30,7 @@ config ARM_EXYNOS_CPUFREQ ...@@ -30,7 +30,7 @@ config ARM_EXYNOS_CPUFREQ
config ARM_EXYNOS4210_CPUFREQ config ARM_EXYNOS4210_CPUFREQ
bool "SAMSUNG EXYNOS4210" bool "SAMSUNG EXYNOS4210"
depends on CPU_EXYNOS4210 && !ARCH_MULTIPLATFORM depends on CPU_EXYNOS4210
default y default y
select ARM_EXYNOS_CPUFREQ select ARM_EXYNOS_CPUFREQ
help help
...@@ -41,7 +41,7 @@ config ARM_EXYNOS4210_CPUFREQ ...@@ -41,7 +41,7 @@ config ARM_EXYNOS4210_CPUFREQ
config ARM_EXYNOS4X12_CPUFREQ config ARM_EXYNOS4X12_CPUFREQ
bool "SAMSUNG EXYNOS4x12" bool "SAMSUNG EXYNOS4x12"
depends on (SOC_EXYNOS4212 || SOC_EXYNOS4412) && !ARCH_MULTIPLATFORM depends on SOC_EXYNOS4212 || SOC_EXYNOS4412
default y default y
select ARM_EXYNOS_CPUFREQ select ARM_EXYNOS_CPUFREQ
help help
...@@ -52,7 +52,7 @@ config ARM_EXYNOS4X12_CPUFREQ ...@@ -52,7 +52,7 @@ config ARM_EXYNOS4X12_CPUFREQ
config ARM_EXYNOS5250_CPUFREQ config ARM_EXYNOS5250_CPUFREQ
bool "SAMSUNG EXYNOS5250" bool "SAMSUNG EXYNOS5250"
depends on SOC_EXYNOS5250 && !ARCH_MULTIPLATFORM depends on SOC_EXYNOS5250
default y default y
select ARM_EXYNOS_CPUFREQ select ARM_EXYNOS_CPUFREQ
help help
......
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/of.h> #include <linux/of.h>
#include <plat/cpu.h>
#include "exynos-cpufreq.h" #include "exynos-cpufreq.h"
static struct exynos_dvfs_info *exynos_info; static struct exynos_dvfs_info *exynos_info;
......
...@@ -49,6 +49,7 @@ struct exynos_dvfs_info { ...@@ -49,6 +49,7 @@ struct exynos_dvfs_info {
struct cpufreq_frequency_table *freq_table; struct cpufreq_frequency_table *freq_table;
void (*set_freq)(unsigned int, unsigned int); void (*set_freq)(unsigned int, unsigned int);
bool (*need_apll_change)(unsigned int, unsigned int); bool (*need_apll_change)(unsigned int, unsigned int);
void __iomem *cmu_regs;
}; };
#ifdef CONFIG_ARM_EXYNOS4210_CPUFREQ #ifdef CONFIG_ARM_EXYNOS4210_CPUFREQ
...@@ -76,24 +77,21 @@ static inline int exynos5250_cpufreq_init(struct exynos_dvfs_info *info) ...@@ -76,24 +77,21 @@ static inline int exynos5250_cpufreq_init(struct exynos_dvfs_info *info)
} }
#endif #endif
#include <plat/cpu.h> #define EXYNOS4_CLKSRC_CPU 0x14200
#include <mach/map.h> #define EXYNOS4_CLKMUX_STATCPU 0x14400
#define EXYNOS4_CLKSRC_CPU (S5P_VA_CMU + 0x14200) #define EXYNOS4_CLKDIV_CPU 0x14500
#define EXYNOS4_CLKMUX_STATCPU (S5P_VA_CMU + 0x14400) #define EXYNOS4_CLKDIV_CPU1 0x14504
#define EXYNOS4_CLKDIV_STATCPU 0x14600
#define EXYNOS4_CLKDIV_CPU (S5P_VA_CMU + 0x14500) #define EXYNOS4_CLKDIV_STATCPU1 0x14604
#define EXYNOS4_CLKDIV_CPU1 (S5P_VA_CMU + 0x14504)
#define EXYNOS4_CLKDIV_STATCPU (S5P_VA_CMU + 0x14600)
#define EXYNOS4_CLKDIV_STATCPU1 (S5P_VA_CMU + 0x14604)
#define EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT (16) #define EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT (16)
#define EXYNOS4_CLKMUX_STATCPU_MUXCORE_MASK (0x7 << EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT) #define EXYNOS4_CLKMUX_STATCPU_MUXCORE_MASK (0x7 << EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT)
#define EXYNOS5_APLL_LOCK (S5P_VA_CMU + 0x00000) #define EXYNOS5_APLL_LOCK 0x00000
#define EXYNOS5_APLL_CON0 (S5P_VA_CMU + 0x00100) #define EXYNOS5_APLL_CON0 0x00100
#define EXYNOS5_CLKMUX_STATCPU (S5P_VA_CMU + 0x00400) #define EXYNOS5_CLKMUX_STATCPU 0x00400
#define EXYNOS5_CLKDIV_CPU0 (S5P_VA_CMU + 0x00500) #define EXYNOS5_CLKDIV_CPU0 0x00500
#define EXYNOS5_CLKDIV_CPU1 (S5P_VA_CMU + 0x00504) #define EXYNOS5_CLKDIV_CPU1 0x00504
#define EXYNOS5_CLKDIV_STATCPU0 (S5P_VA_CMU + 0x00600) #define EXYNOS5_CLKDIV_STATCPU0 0x00600
#define EXYNOS5_CLKDIV_STATCPU1 (S5P_VA_CMU + 0x00604) #define EXYNOS5_CLKDIV_STATCPU1 0x00604
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
#include <linux/io.h> #include <linux/io.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/cpufreq.h> #include <linux/cpufreq.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include "exynos-cpufreq.h" #include "exynos-cpufreq.h"
...@@ -23,6 +25,7 @@ static struct clk *cpu_clk; ...@@ -23,6 +25,7 @@ static struct clk *cpu_clk;
static struct clk *moutcore; static struct clk *moutcore;
static struct clk *mout_mpll; static struct clk *mout_mpll;
static struct clk *mout_apll; static struct clk *mout_apll;
static struct exynos_dvfs_info *cpufreq;
static unsigned int exynos4210_volt_table[] = { static unsigned int exynos4210_volt_table[] = {
1250000, 1150000, 1050000, 975000, 950000, 1250000, 1150000, 1050000, 975000, 950000,
...@@ -60,20 +63,20 @@ static void exynos4210_set_clkdiv(unsigned int div_index) ...@@ -60,20 +63,20 @@ static void exynos4210_set_clkdiv(unsigned int div_index)
tmp = apll_freq_4210[div_index].clk_div_cpu0; tmp = apll_freq_4210[div_index].clk_div_cpu0;
__raw_writel(tmp, EXYNOS4_CLKDIV_CPU); __raw_writel(tmp, cpufreq->cmu_regs + EXYNOS4_CLKDIV_CPU);
do { do {
tmp = __raw_readl(EXYNOS4_CLKDIV_STATCPU); tmp = __raw_readl(cpufreq->cmu_regs + EXYNOS4_CLKDIV_STATCPU);
} while (tmp & 0x1111111); } while (tmp & 0x1111111);
/* Change Divider - CPU1 */ /* Change Divider - CPU1 */
tmp = apll_freq_4210[div_index].clk_div_cpu1; tmp = apll_freq_4210[div_index].clk_div_cpu1;
__raw_writel(tmp, EXYNOS4_CLKDIV_CPU1); __raw_writel(tmp, cpufreq->cmu_regs + EXYNOS4_CLKDIV_CPU1);
do { do {
tmp = __raw_readl(EXYNOS4_CLKDIV_STATCPU1); tmp = __raw_readl(cpufreq->cmu_regs + EXYNOS4_CLKDIV_STATCPU1);
} while (tmp & 0x11); } while (tmp & 0x11);
} }
...@@ -85,7 +88,7 @@ static void exynos4210_set_apll(unsigned int index) ...@@ -85,7 +88,7 @@ static void exynos4210_set_apll(unsigned int index)
clk_set_parent(moutcore, mout_mpll); clk_set_parent(moutcore, mout_mpll);
do { do {
tmp = (__raw_readl(EXYNOS4_CLKMUX_STATCPU) tmp = (__raw_readl(cpufreq->cmu_regs + EXYNOS4_CLKMUX_STATCPU)
>> EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT); >> EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT);
tmp &= 0x7; tmp &= 0x7;
} while (tmp != 0x2); } while (tmp != 0x2);
...@@ -96,7 +99,7 @@ static void exynos4210_set_apll(unsigned int index) ...@@ -96,7 +99,7 @@ static void exynos4210_set_apll(unsigned int index)
clk_set_parent(moutcore, mout_apll); clk_set_parent(moutcore, mout_apll);
do { do {
tmp = __raw_readl(EXYNOS4_CLKMUX_STATCPU); tmp = __raw_readl(cpufreq->cmu_regs + EXYNOS4_CLKMUX_STATCPU);
tmp &= EXYNOS4_CLKMUX_STATCPU_MUXCORE_MASK; tmp &= EXYNOS4_CLKMUX_STATCPU_MUXCORE_MASK;
} while (tmp != (0x1 << EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT)); } while (tmp != (0x1 << EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT));
} }
...@@ -115,8 +118,30 @@ static void exynos4210_set_frequency(unsigned int old_index, ...@@ -115,8 +118,30 @@ static void exynos4210_set_frequency(unsigned int old_index,
int exynos4210_cpufreq_init(struct exynos_dvfs_info *info) int exynos4210_cpufreq_init(struct exynos_dvfs_info *info)
{ {
struct device_node *np;
unsigned long rate; unsigned long rate;
/*
* HACK: This is a temporary workaround to get access to clock
* controller registers directly and remove static mappings and
* dependencies on platform headers. It is necessary to enable
* Exynos multi-platform support and will be removed together with
* this whole driver as soon as Exynos gets migrated to use
* cpufreq-cpu0 driver.
*/
np = of_find_compatible_node(NULL, NULL, "samsung,exynos4210-clock");
if (!np) {
pr_err("%s: failed to find clock controller DT node\n",
__func__);
return -ENODEV;
}
info->cmu_regs = of_iomap(np, 0);
if (!info->cmu_regs) {
pr_err("%s: failed to map CMU registers\n", __func__);
return -EFAULT;
}
cpu_clk = clk_get(NULL, "armclk"); cpu_clk = clk_get(NULL, "armclk");
if (IS_ERR(cpu_clk)) if (IS_ERR(cpu_clk))
return PTR_ERR(cpu_clk); return PTR_ERR(cpu_clk);
...@@ -143,6 +168,8 @@ int exynos4210_cpufreq_init(struct exynos_dvfs_info *info) ...@@ -143,6 +168,8 @@ int exynos4210_cpufreq_init(struct exynos_dvfs_info *info)
info->freq_table = exynos4210_freq_table; info->freq_table = exynos4210_freq_table;
info->set_freq = exynos4210_set_frequency; info->set_freq = exynos4210_set_frequency;
cpufreq = info;
return 0; return 0;
err_mout_apll: err_mout_apll:
......
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
#include <linux/io.h> #include <linux/io.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/cpufreq.h> #include <linux/cpufreq.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include "exynos-cpufreq.h" #include "exynos-cpufreq.h"
...@@ -23,6 +25,7 @@ static struct clk *cpu_clk; ...@@ -23,6 +25,7 @@ static struct clk *cpu_clk;
static struct clk *moutcore; static struct clk *moutcore;
static struct clk *mout_mpll; static struct clk *mout_mpll;
static struct clk *mout_apll; static struct clk *mout_apll;
static struct exynos_dvfs_info *cpufreq;
static unsigned int exynos4x12_volt_table[] = { static unsigned int exynos4x12_volt_table[] = {
1350000, 1287500, 1250000, 1187500, 1137500, 1087500, 1037500, 1350000, 1287500, 1250000, 1187500, 1137500, 1087500, 1037500,
...@@ -105,19 +108,20 @@ static void exynos4x12_set_clkdiv(unsigned int div_index) ...@@ -105,19 +108,20 @@ static void exynos4x12_set_clkdiv(unsigned int div_index)
tmp = apll_freq_4x12[div_index].clk_div_cpu0; tmp = apll_freq_4x12[div_index].clk_div_cpu0;
__raw_writel(tmp, EXYNOS4_CLKDIV_CPU); __raw_writel(tmp, cpufreq->cmu_regs + EXYNOS4_CLKDIV_CPU);
while (__raw_readl(EXYNOS4_CLKDIV_STATCPU) & 0x11111111) while (__raw_readl(cpufreq->cmu_regs + EXYNOS4_CLKDIV_STATCPU)
& 0x11111111)
cpu_relax(); cpu_relax();
/* Change Divider - CPU1 */ /* Change Divider - CPU1 */
tmp = apll_freq_4x12[div_index].clk_div_cpu1; tmp = apll_freq_4x12[div_index].clk_div_cpu1;
__raw_writel(tmp, EXYNOS4_CLKDIV_CPU1); __raw_writel(tmp, cpufreq->cmu_regs + EXYNOS4_CLKDIV_CPU1);
do { do {
cpu_relax(); cpu_relax();
tmp = __raw_readl(EXYNOS4_CLKDIV_STATCPU1); tmp = __raw_readl(cpufreq->cmu_regs + EXYNOS4_CLKDIV_STATCPU1);
} while (tmp != 0x0); } while (tmp != 0x0);
} }
...@@ -130,7 +134,7 @@ static void exynos4x12_set_apll(unsigned int index) ...@@ -130,7 +134,7 @@ static void exynos4x12_set_apll(unsigned int index)
do { do {
cpu_relax(); cpu_relax();
tmp = (__raw_readl(EXYNOS4_CLKMUX_STATCPU) tmp = (__raw_readl(cpufreq->cmu_regs + EXYNOS4_CLKMUX_STATCPU)
>> EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT); >> EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT);
tmp &= 0x7; tmp &= 0x7;
} while (tmp != 0x2); } while (tmp != 0x2);
...@@ -142,7 +146,7 @@ static void exynos4x12_set_apll(unsigned int index) ...@@ -142,7 +146,7 @@ static void exynos4x12_set_apll(unsigned int index)
do { do {
cpu_relax(); cpu_relax();
tmp = __raw_readl(EXYNOS4_CLKMUX_STATCPU); tmp = __raw_readl(cpufreq->cmu_regs + EXYNOS4_CLKMUX_STATCPU);
tmp &= EXYNOS4_CLKMUX_STATCPU_MUXCORE_MASK; tmp &= EXYNOS4_CLKMUX_STATCPU_MUXCORE_MASK;
} while (tmp != (0x1 << EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT)); } while (tmp != (0x1 << EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT));
} }
...@@ -161,8 +165,30 @@ static void exynos4x12_set_frequency(unsigned int old_index, ...@@ -161,8 +165,30 @@ static void exynos4x12_set_frequency(unsigned int old_index,
int exynos4x12_cpufreq_init(struct exynos_dvfs_info *info) int exynos4x12_cpufreq_init(struct exynos_dvfs_info *info)
{ {
struct device_node *np;
unsigned long rate; unsigned long rate;
/*
* HACK: This is a temporary workaround to get access to clock
* controller registers directly and remove static mappings and
* dependencies on platform headers. It is necessary to enable
* Exynos multi-platform support and will be removed together with
* this whole driver as soon as Exynos gets migrated to use
* cpufreq-cpu0 driver.
*/
np = of_find_compatible_node(NULL, NULL, "samsung,exynos4412-clock");
if (!np) {
pr_err("%s: failed to find clock controller DT node\n",
__func__);
return -ENODEV;
}
info->cmu_regs = of_iomap(np, 0);
if (!info->cmu_regs) {
pr_err("%s: failed to map CMU registers\n", __func__);
return -EFAULT;
}
cpu_clk = clk_get(NULL, "armclk"); cpu_clk = clk_get(NULL, "armclk");
if (IS_ERR(cpu_clk)) if (IS_ERR(cpu_clk))
return PTR_ERR(cpu_clk); return PTR_ERR(cpu_clk);
...@@ -194,6 +220,8 @@ int exynos4x12_cpufreq_init(struct exynos_dvfs_info *info) ...@@ -194,6 +220,8 @@ int exynos4x12_cpufreq_init(struct exynos_dvfs_info *info)
info->freq_table = exynos4x12_freq_table; info->freq_table = exynos4x12_freq_table;
info->set_freq = exynos4x12_set_frequency; info->set_freq = exynos4x12_set_frequency;
cpufreq = info;
return 0; return 0;
err_mout_apll: err_mout_apll:
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
#include <linux/io.h> #include <linux/io.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/cpufreq.h> #include <linux/cpufreq.h>
#include <linux/of.h>
#include <mach/map.h> #include <linux/of_address.h>
#include "exynos-cpufreq.h" #include "exynos-cpufreq.h"
...@@ -25,6 +25,7 @@ static struct clk *cpu_clk; ...@@ -25,6 +25,7 @@ static struct clk *cpu_clk;
static struct clk *moutcore; static struct clk *moutcore;
static struct clk *mout_mpll; static struct clk *mout_mpll;
static struct clk *mout_apll; static struct clk *mout_apll;
static struct exynos_dvfs_info *cpufreq;
static unsigned int exynos5250_volt_table[] = { static unsigned int exynos5250_volt_table[] = {
1300000, 1250000, 1225000, 1200000, 1150000, 1300000, 1250000, 1225000, 1200000, 1150000,
...@@ -87,17 +88,18 @@ static void set_clkdiv(unsigned int div_index) ...@@ -87,17 +88,18 @@ static void set_clkdiv(unsigned int div_index)
tmp = apll_freq_5250[div_index].clk_div_cpu0; tmp = apll_freq_5250[div_index].clk_div_cpu0;
__raw_writel(tmp, EXYNOS5_CLKDIV_CPU0); __raw_writel(tmp, cpufreq->cmu_regs + EXYNOS5_CLKDIV_CPU0);
while (__raw_readl(EXYNOS5_CLKDIV_STATCPU0) & 0x11111111) while (__raw_readl(cpufreq->cmu_regs + EXYNOS5_CLKDIV_STATCPU0)
& 0x11111111)
cpu_relax(); cpu_relax();
/* Change Divider - CPU1 */ /* Change Divider - CPU1 */
tmp = apll_freq_5250[div_index].clk_div_cpu1; tmp = apll_freq_5250[div_index].clk_div_cpu1;
__raw_writel(tmp, EXYNOS5_CLKDIV_CPU1); __raw_writel(tmp, cpufreq->cmu_regs + EXYNOS5_CLKDIV_CPU1);
while (__raw_readl(EXYNOS5_CLKDIV_STATCPU1) & 0x11) while (__raw_readl(cpufreq->cmu_regs + EXYNOS5_CLKDIV_STATCPU1) & 0x11)
cpu_relax(); cpu_relax();
} }
...@@ -111,7 +113,8 @@ static void set_apll(unsigned int index) ...@@ -111,7 +113,8 @@ static void set_apll(unsigned int index)
do { do {
cpu_relax(); cpu_relax();
tmp = (__raw_readl(EXYNOS5_CLKMUX_STATCPU) >> 16); tmp = (__raw_readl(cpufreq->cmu_regs + EXYNOS5_CLKMUX_STATCPU)
>> 16);
tmp &= 0x7; tmp &= 0x7;
} while (tmp != 0x2); } while (tmp != 0x2);
...@@ -122,7 +125,7 @@ static void set_apll(unsigned int index) ...@@ -122,7 +125,7 @@ static void set_apll(unsigned int index)
do { do {
cpu_relax(); cpu_relax();
tmp = __raw_readl(EXYNOS5_CLKMUX_STATCPU); tmp = __raw_readl(cpufreq->cmu_regs + EXYNOS5_CLKMUX_STATCPU);
tmp &= (0x7 << 16); tmp &= (0x7 << 16);
} while (tmp != (0x1 << 16)); } while (tmp != (0x1 << 16));
} }
...@@ -141,8 +144,30 @@ static void exynos5250_set_frequency(unsigned int old_index, ...@@ -141,8 +144,30 @@ static void exynos5250_set_frequency(unsigned int old_index,
int exynos5250_cpufreq_init(struct exynos_dvfs_info *info) int exynos5250_cpufreq_init(struct exynos_dvfs_info *info)
{ {
struct device_node *np;
unsigned long rate; unsigned long rate;
/*
* HACK: This is a temporary workaround to get access to clock
* controller registers directly and remove static mappings and
* dependencies on platform headers. It is necessary to enable
* Exynos multi-platform support and will be removed together with
* this whole driver as soon as Exynos gets migrated to use
* cpufreq-cpu0 driver.
*/
np = of_find_compatible_node(NULL, NULL, "samsung,exynos5250-clock");
if (!np) {
pr_err("%s: failed to find clock controller DT node\n",
__func__);
return -ENODEV;
}
info->cmu_regs = of_iomap(np, 0);
if (!info->cmu_regs) {
pr_err("%s: failed to map CMU registers\n", __func__);
return -EFAULT;
}
cpu_clk = clk_get(NULL, "armclk"); cpu_clk = clk_get(NULL, "armclk");
if (IS_ERR(cpu_clk)) if (IS_ERR(cpu_clk))
return PTR_ERR(cpu_clk); return PTR_ERR(cpu_clk);
...@@ -169,6 +194,8 @@ int exynos5250_cpufreq_init(struct exynos_dvfs_info *info) ...@@ -169,6 +194,8 @@ int exynos5250_cpufreq_init(struct exynos_dvfs_info *info)
info->freq_table = exynos5250_freq_table; info->freq_table = exynos5250_freq_table;
info->set_freq = exynos5250_set_frequency; info->set_freq = exynos5250_set_frequency;
cpufreq = info;
return 0; return 0;
err_mout_apll: err_mout_apll:
......
...@@ -49,3 +49,9 @@ config ARM_AT91_CPUIDLE ...@@ -49,3 +49,9 @@ config ARM_AT91_CPUIDLE
depends on ARCH_AT91 depends on ARCH_AT91
help help
Select this to enable cpuidle for AT91 processors Select this to enable cpuidle for AT91 processors
config ARM_EXYNOS_CPUIDLE
bool "Cpu Idle Driver for the Exynos processors"
depends on ARCH_EXYNOS
help
Select this to enable cpuidle for Exynos processors
...@@ -14,6 +14,7 @@ obj-$(CONFIG_ARM_KIRKWOOD_CPUIDLE) += cpuidle-kirkwood.o ...@@ -14,6 +14,7 @@ obj-$(CONFIG_ARM_KIRKWOOD_CPUIDLE) += cpuidle-kirkwood.o
obj-$(CONFIG_ARM_ZYNQ_CPUIDLE) += cpuidle-zynq.o obj-$(CONFIG_ARM_ZYNQ_CPUIDLE) += cpuidle-zynq.o
obj-$(CONFIG_ARM_U8500_CPUIDLE) += cpuidle-ux500.o obj-$(CONFIG_ARM_U8500_CPUIDLE) += cpuidle-ux500.o
obj-$(CONFIG_ARM_AT91_CPUIDLE) += cpuidle-at91.o obj-$(CONFIG_ARM_AT91_CPUIDLE) += cpuidle-at91.o
obj-$(CONFIG_ARM_EXYNOS_CPUIDLE) += cpuidle-exynos.o
############################################################################### ###############################################################################
# POWERPC drivers # POWERPC drivers
......
/* linux/arch/arm/mach-exynos/cpuidle.c
*
* Copyright (c) 2011 Samsung Electronics Co., Ltd.
* http://www.samsung.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.
*/
#include <linux/cpuidle.h>
#include <linux/cpu_pm.h>
#include <linux/export.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <asm/proc-fns.h>
#include <asm/suspend.h>
#include <asm/cpuidle.h>
static void (*exynos_enter_aftr)(void);
static int idle_finisher(unsigned long flags)
{
exynos_enter_aftr();
cpu_do_idle();
return 1;
}
static int exynos_enter_core0_aftr(struct cpuidle_device *dev,
struct cpuidle_driver *drv,
int index)
{
cpu_pm_enter();
cpu_suspend(0, idle_finisher);
cpu_pm_exit();
return index;
}
static int exynos_enter_lowpower(struct cpuidle_device *dev,
struct cpuidle_driver *drv,
int index)
{
int new_index = index;
/* AFTR can only be entered when cores other than CPU0 are offline */
if (num_online_cpus() > 1 || dev->cpu != 0)
new_index = drv->safe_state_index;
if (new_index == 0)
return arm_cpuidle_simple_enter(dev, drv, new_index);
else
return exynos_enter_core0_aftr(dev, drv, new_index);
}
static struct cpuidle_driver exynos_idle_driver = {
.name = "exynos_idle",
.owner = THIS_MODULE,
.states = {
[0] = ARM_CPUIDLE_WFI_STATE,
[1] = {
.enter = exynos_enter_lowpower,
.exit_latency = 300,
.target_residency = 100000,
.flags = CPUIDLE_FLAG_TIME_VALID,
.name = "C1",
.desc = "ARM power down",
},
},
.state_count = 2,
.safe_state_index = 0,
};
static int exynos_cpuidle_probe(struct platform_device *pdev)
{
int ret;
exynos_enter_aftr = (void *)(pdev->dev.platform_data);
ret = cpuidle_register(&exynos_idle_driver, NULL);
if (ret) {
dev_err(&pdev->dev, "failed to register cpuidle driver\n");
return ret;
}
return 0;
}
static struct platform_driver exynos_cpuidle_driver = {
.probe = exynos_cpuidle_probe,
.driver = {
.name = "exynos_cpuidle",
.owner = THIS_MODULE,
},
};
module_platform_driver(exynos_cpuidle_driver);
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* Marvell EBU SoC Device Bus Controller * Marvell EBU SoC Device Bus Controller
* (memory controller for NOR/NAND/SRAM/FPGA devices) * (memory controller for NOR/NAND/SRAM/FPGA devices)
* *
* Copyright (C) 2013 Marvell * Copyright (C) 2013-2014 Marvell
* *
* 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 as published by * it under the terms of the GNU General Public License as published by
...@@ -30,19 +30,47 @@ ...@@ -30,19 +30,47 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
/* Register definitions */ /* Register definitions */
#define DEV_WIDTH_BIT 30 #define ARMADA_DEV_WIDTH_SHIFT 30
#define BADR_SKEW_BIT 28 #define ARMADA_BADR_SKEW_SHIFT 28
#define RD_HOLD_BIT 23 #define ARMADA_RD_HOLD_SHIFT 23
#define ACC_NEXT_BIT 17 #define ARMADA_ACC_NEXT_SHIFT 17
#define RD_SETUP_BIT 12 #define ARMADA_RD_SETUP_SHIFT 12
#define ACC_FIRST_BIT 6 #define ARMADA_ACC_FIRST_SHIFT 6
#define SYNC_ENABLE_BIT 24 #define ARMADA_SYNC_ENABLE_SHIFT 24
#define WR_HIGH_BIT 16 #define ARMADA_WR_HIGH_SHIFT 16
#define WR_LOW_BIT 8 #define ARMADA_WR_LOW_SHIFT 8
#define READ_PARAM_OFFSET 0x0 #define ARMADA_READ_PARAM_OFFSET 0x0
#define WRITE_PARAM_OFFSET 0x4 #define ARMADA_WRITE_PARAM_OFFSET 0x4
#define ORION_RESERVED (0x2 << 30)
#define ORION_BADR_SKEW_SHIFT 28
#define ORION_WR_HIGH_EXT_BIT BIT(27)
#define ORION_WR_HIGH_EXT_MASK 0x8
#define ORION_WR_LOW_EXT_BIT BIT(26)
#define ORION_WR_LOW_EXT_MASK 0x8
#define ORION_ALE_WR_EXT_BIT BIT(25)
#define ORION_ALE_WR_EXT_MASK 0x8
#define ORION_ACC_NEXT_EXT_BIT BIT(24)
#define ORION_ACC_NEXT_EXT_MASK 0x10
#define ORION_ACC_FIRST_EXT_BIT BIT(23)
#define ORION_ACC_FIRST_EXT_MASK 0x10
#define ORION_TURN_OFF_EXT_BIT BIT(22)
#define ORION_TURN_OFF_EXT_MASK 0x8
#define ORION_DEV_WIDTH_SHIFT 20
#define ORION_WR_HIGH_SHIFT 17
#define ORION_WR_HIGH_MASK 0x7
#define ORION_WR_LOW_SHIFT 14
#define ORION_WR_LOW_MASK 0x7
#define ORION_ALE_WR_SHIFT 11
#define ORION_ALE_WR_MASK 0x7
#define ORION_ACC_NEXT_SHIFT 7
#define ORION_ACC_NEXT_MASK 0xF
#define ORION_ACC_FIRST_SHIFT 3
#define ORION_ACC_FIRST_MASK 0xF
#define ORION_TURN_OFF_SHIFT 0
#define ORION_TURN_OFF_MASK 0x7
struct devbus_read_params { struct devbus_read_params {
u32 bus_width; u32 bus_width;
...@@ -89,19 +117,14 @@ static int get_timing_param_ps(struct devbus *devbus, ...@@ -89,19 +117,14 @@ static int get_timing_param_ps(struct devbus *devbus,
return 0; return 0;
} }
static int devbus_set_timing_params(struct devbus *devbus, static int devbus_get_timing_params(struct devbus *devbus,
struct device_node *node) struct device_node *node,
struct devbus_read_params *r,
struct devbus_write_params *w)
{ {
struct devbus_read_params r;
struct devbus_write_params w;
u32 value;
int err; int err;
dev_dbg(devbus->dev, "Setting timing parameter, tick is %lu ps\n", err = of_property_read_u32(node, "devbus,bus-width", &r->bus_width);
devbus->tick_ps);
/* Get read timings */
err = of_property_read_u32(node, "devbus,bus-width", &r.bus_width);
if (err < 0) { if (err < 0) {
dev_err(devbus->dev, dev_err(devbus->dev,
"%s has no 'devbus,bus-width' property\n", "%s has no 'devbus,bus-width' property\n",
...@@ -113,104 +136,148 @@ static int devbus_set_timing_params(struct devbus *devbus, ...@@ -113,104 +136,148 @@ static int devbus_set_timing_params(struct devbus *devbus,
* The bus width is encoded into the register as 0 for 8 bits, * The bus width is encoded into the register as 0 for 8 bits,
* and 1 for 16 bits, so we do the necessary conversion here. * and 1 for 16 bits, so we do the necessary conversion here.
*/ */
if (r.bus_width == 8) if (r->bus_width == 8)
r.bus_width = 0; r->bus_width = 0;
else if (r.bus_width == 16) else if (r->bus_width == 16)
r.bus_width = 1; r->bus_width = 1;
else { else {
dev_err(devbus->dev, "invalid bus width %d\n", r.bus_width); dev_err(devbus->dev, "invalid bus width %d\n", r->bus_width);
return -EINVAL; return -EINVAL;
} }
err = get_timing_param_ps(devbus, node, "devbus,badr-skew-ps", err = get_timing_param_ps(devbus, node, "devbus,badr-skew-ps",
&r.badr_skew); &r->badr_skew);
if (err < 0) if (err < 0)
return err; return err;
err = get_timing_param_ps(devbus, node, "devbus,turn-off-ps", err = get_timing_param_ps(devbus, node, "devbus,turn-off-ps",
&r.turn_off); &r->turn_off);
if (err < 0) if (err < 0)
return err; return err;
err = get_timing_param_ps(devbus, node, "devbus,acc-first-ps", err = get_timing_param_ps(devbus, node, "devbus,acc-first-ps",
&r.acc_first); &r->acc_first);
if (err < 0) if (err < 0)
return err; return err;
err = get_timing_param_ps(devbus, node, "devbus,acc-next-ps", err = get_timing_param_ps(devbus, node, "devbus,acc-next-ps",
&r.acc_next); &r->acc_next);
if (err < 0)
return err;
err = get_timing_param_ps(devbus, node, "devbus,rd-setup-ps",
&r.rd_setup);
if (err < 0) if (err < 0)
return err; return err;
err = get_timing_param_ps(devbus, node, "devbus,rd-hold-ps", if (of_device_is_compatible(devbus->dev->of_node, "marvell,mvebu-devbus")) {
&r.rd_hold); err = get_timing_param_ps(devbus, node, "devbus,rd-setup-ps",
if (err < 0) &r->rd_setup);
return err; if (err < 0)
return err;
/* Get write timings */
err = of_property_read_u32(node, "devbus,sync-enable", err = get_timing_param_ps(devbus, node, "devbus,rd-hold-ps",
&w.sync_enable); &r->rd_hold);
if (err < 0) { if (err < 0)
dev_err(devbus->dev, return err;
"%s has no 'devbus,sync-enable' property\n",
node->full_name); err = of_property_read_u32(node, "devbus,sync-enable",
return err; &w->sync_enable);
if (err < 0) {
dev_err(devbus->dev,
"%s has no 'devbus,sync-enable' property\n",
node->full_name);
return err;
}
} }
err = get_timing_param_ps(devbus, node, "devbus,ale-wr-ps", err = get_timing_param_ps(devbus, node, "devbus,ale-wr-ps",
&w.ale_wr); &w->ale_wr);
if (err < 0) if (err < 0)
return err; return err;
err = get_timing_param_ps(devbus, node, "devbus,wr-low-ps", err = get_timing_param_ps(devbus, node, "devbus,wr-low-ps",
&w.wr_low); &w->wr_low);
if (err < 0) if (err < 0)
return err; return err;
err = get_timing_param_ps(devbus, node, "devbus,wr-high-ps", err = get_timing_param_ps(devbus, node, "devbus,wr-high-ps",
&w.wr_high); &w->wr_high);
if (err < 0) if (err < 0)
return err; return err;
return 0;
}
static void devbus_orion_set_timing_params(struct devbus *devbus,
struct device_node *node,
struct devbus_read_params *r,
struct devbus_write_params *w)
{
u32 value;
/*
* The hardware designers found it would be a good idea to
* split most of the values in the register into two fields:
* one containing all the low-order bits, and another one
* containing just the high-order bit. For all of those
* fields, we have to split the value into these two parts.
*/
value = (r->turn_off & ORION_TURN_OFF_MASK) << ORION_TURN_OFF_SHIFT |
(r->acc_first & ORION_ACC_FIRST_MASK) << ORION_ACC_FIRST_SHIFT |
(r->acc_next & ORION_ACC_NEXT_MASK) << ORION_ACC_NEXT_SHIFT |
(w->ale_wr & ORION_ALE_WR_MASK) << ORION_ALE_WR_SHIFT |
(w->wr_low & ORION_WR_LOW_MASK) << ORION_WR_LOW_SHIFT |
(w->wr_high & ORION_WR_HIGH_MASK) << ORION_WR_HIGH_SHIFT |
r->bus_width << ORION_DEV_WIDTH_SHIFT |
((r->turn_off & ORION_TURN_OFF_EXT_MASK) ? ORION_TURN_OFF_EXT_BIT : 0) |
((r->acc_first & ORION_ACC_FIRST_EXT_MASK) ? ORION_ACC_FIRST_EXT_BIT : 0) |
((r->acc_next & ORION_ACC_NEXT_EXT_MASK) ? ORION_ACC_NEXT_EXT_BIT : 0) |
((w->ale_wr & ORION_ALE_WR_EXT_MASK) ? ORION_ALE_WR_EXT_BIT : 0) |
((w->wr_low & ORION_WR_LOW_EXT_MASK) ? ORION_WR_LOW_EXT_BIT : 0) |
((w->wr_high & ORION_WR_HIGH_EXT_MASK) ? ORION_WR_HIGH_EXT_BIT : 0) |
(r->badr_skew << ORION_BADR_SKEW_SHIFT) |
ORION_RESERVED;
writel(value, devbus->base);
}
static void devbus_armada_set_timing_params(struct devbus *devbus,
struct device_node *node,
struct devbus_read_params *r,
struct devbus_write_params *w)
{
u32 value;
/* Set read timings */ /* Set read timings */
value = r.bus_width << DEV_WIDTH_BIT | value = r->bus_width << ARMADA_DEV_WIDTH_SHIFT |
r.badr_skew << BADR_SKEW_BIT | r->badr_skew << ARMADA_BADR_SKEW_SHIFT |
r.rd_hold << RD_HOLD_BIT | r->rd_hold << ARMADA_RD_HOLD_SHIFT |
r.acc_next << ACC_NEXT_BIT | r->acc_next << ARMADA_ACC_NEXT_SHIFT |
r.rd_setup << RD_SETUP_BIT | r->rd_setup << ARMADA_RD_SETUP_SHIFT |
r.acc_first << ACC_FIRST_BIT | r->acc_first << ARMADA_ACC_FIRST_SHIFT |
r.turn_off; r->turn_off;
dev_dbg(devbus->dev, "read parameters register 0x%p = 0x%x\n", dev_dbg(devbus->dev, "read parameters register 0x%p = 0x%x\n",
devbus->base + READ_PARAM_OFFSET, devbus->base + ARMADA_READ_PARAM_OFFSET,
value); value);
writel(value, devbus->base + READ_PARAM_OFFSET); writel(value, devbus->base + ARMADA_READ_PARAM_OFFSET);
/* Set write timings */ /* Set write timings */
value = w.sync_enable << SYNC_ENABLE_BIT | value = w->sync_enable << ARMADA_SYNC_ENABLE_SHIFT |
w.wr_low << WR_LOW_BIT | w->wr_low << ARMADA_WR_LOW_SHIFT |
w.wr_high << WR_HIGH_BIT | w->wr_high << ARMADA_WR_HIGH_SHIFT |
w.ale_wr; w->ale_wr;
dev_dbg(devbus->dev, "write parameters register: 0x%p = 0x%x\n", dev_dbg(devbus->dev, "write parameters register: 0x%p = 0x%x\n",
devbus->base + WRITE_PARAM_OFFSET, devbus->base + ARMADA_WRITE_PARAM_OFFSET,
value); value);
writel(value, devbus->base + WRITE_PARAM_OFFSET); writel(value, devbus->base + ARMADA_WRITE_PARAM_OFFSET);
return 0;
} }
static int mvebu_devbus_probe(struct platform_device *pdev) static int mvebu_devbus_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct device_node *node = pdev->dev.of_node; struct device_node *node = pdev->dev.of_node;
struct devbus_read_params r;
struct devbus_write_params w;
struct devbus *devbus; struct devbus *devbus;
struct resource *res; struct resource *res;
struct clk *clk; struct clk *clk;
...@@ -240,10 +307,21 @@ static int mvebu_devbus_probe(struct platform_device *pdev) ...@@ -240,10 +307,21 @@ static int mvebu_devbus_probe(struct platform_device *pdev)
rate = clk_get_rate(clk) / 1000; rate = clk_get_rate(clk) / 1000;
devbus->tick_ps = 1000000000 / rate; devbus->tick_ps = 1000000000 / rate;
/* Read the device tree node and set the new timing parameters */ dev_dbg(devbus->dev, "Setting timing parameter, tick is %lu ps\n",
err = devbus_set_timing_params(devbus, node); devbus->tick_ps);
if (err < 0)
return err; if (!of_property_read_bool(node, "devbus,keep-config")) {
/* Read the Device Tree node */
err = devbus_get_timing_params(devbus, node, &r, &w);
if (err < 0)
return err;
/* Set the new timing parameters */
if (of_device_is_compatible(node, "marvell,orion-devbus"))
devbus_orion_set_timing_params(devbus, node, &r, &w);
else
devbus_armada_set_timing_params(devbus, node, &r, &w);
}
/* /*
* We need to create a child device explicitly from here to * We need to create a child device explicitly from here to
...@@ -259,6 +337,7 @@ static int mvebu_devbus_probe(struct platform_device *pdev) ...@@ -259,6 +337,7 @@ static int mvebu_devbus_probe(struct platform_device *pdev)
static const struct of_device_id mvebu_devbus_of_match[] = { static const struct of_device_id mvebu_devbus_of_match[] = {
{ .compatible = "marvell,mvebu-devbus" }, { .compatible = "marvell,mvebu-devbus" },
{ .compatible = "marvell,orion-devbus" },
{}, {},
}; };
MODULE_DEVICE_TABLE(of, mvebu_devbus_of_match); MODULE_DEVICE_TABLE(of, mvebu_devbus_of_match);
......
...@@ -51,6 +51,13 @@ config POWER_RESET_RESTART ...@@ -51,6 +51,13 @@ config POWER_RESET_RESTART
Instead they restart, and u-boot holds the SoC until the Instead they restart, and u-boot holds the SoC until the
user presses a key. u-boot then boots into Linux. user presses a key. u-boot then boots into Linux.
config POWER_RESET_SUN6I
bool "Allwinner A31 SoC reset driver"
depends on ARCH_SUNXI
depends on POWER_RESET
help
Reboot support for the Allwinner A31 SoCs.
config POWER_RESET_VEXPRESS config POWER_RESET_VEXPRESS
bool "ARM Versatile Express power-off and reset driver" bool "ARM Versatile Express power-off and reset driver"
depends on ARM || ARM64 depends on ARM || ARM64
...@@ -65,3 +72,11 @@ config POWER_RESET_XGENE ...@@ -65,3 +72,11 @@ config POWER_RESET_XGENE
depends on POWER_RESET depends on POWER_RESET
help help
Reboot support for the APM SoC X-Gene Eval boards. Reboot support for the APM SoC X-Gene Eval boards.
config POWER_RESET_KEYSTONE
bool "Keystone reset driver"
depends on ARCH_KEYSTONE
select MFD_SYSCON
help
Reboot support for the KEYSTONE SoCs.
...@@ -4,5 +4,7 @@ obj-$(CONFIG_POWER_RESET_GPIO) += gpio-poweroff.o ...@@ -4,5 +4,7 @@ obj-$(CONFIG_POWER_RESET_GPIO) += gpio-poweroff.o
obj-$(CONFIG_POWER_RESET_MSM) += msm-poweroff.o obj-$(CONFIG_POWER_RESET_MSM) += msm-poweroff.o
obj-$(CONFIG_POWER_RESET_QNAP) += qnap-poweroff.o obj-$(CONFIG_POWER_RESET_QNAP) += qnap-poweroff.o
obj-$(CONFIG_POWER_RESET_RESTART) += restart-poweroff.o obj-$(CONFIG_POWER_RESET_RESTART) += restart-poweroff.o
obj-$(CONFIG_POWER_RESET_SUN6I) += sun6i-reboot.o
obj-$(CONFIG_POWER_RESET_VEXPRESS) += vexpress-poweroff.o obj-$(CONFIG_POWER_RESET_VEXPRESS) += vexpress-poweroff.o
obj-$(CONFIG_POWER_RESET_XGENE) += xgene-reboot.o obj-$(CONFIG_POWER_RESET_XGENE) += xgene-reboot.o
obj-$(CONFIG_POWER_RESET_KEYSTONE) += keystone-reset.o
/*
* TI keystone reboot driver
*
* Copyright (C) 2014 Texas Instruments Incorporated. http://www.ti.com/
*
* Author: Ivan Khoronzhuk <ivan.khoronzhuk@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.
*/
#include <linux/io.h>
#include <linux/module.h>
#include <linux/reboot.h>
#include <linux/regmap.h>
#include <asm/system_misc.h>
#include <linux/mfd/syscon.h>
#include <linux/of_platform.h>
#define RSTYPE_RG 0x0
#define RSCTRL_RG 0x4
#define RSCFG_RG 0x8
#define RSISO_RG 0xc
#define RSCTRL_KEY_MASK 0x0000ffff
#define RSCTRL_RESET_MASK BIT(16)
#define RSCTRL_KEY 0x5a69
#define RSMUX_OMODE_MASK 0xe
#define RSMUX_OMODE_RESET_ON 0xa
#define RSMUX_OMODE_RESET_OFF 0x0
#define RSMUX_LOCK_MASK 0x1
#define RSMUX_LOCK_SET 0x1
#define RSCFG_RSTYPE_SOFT 0x300f
#define RSCFG_RSTYPE_HARD 0x0
#define WDT_MUX_NUMBER 0x4
static int rspll_offset;
static struct regmap *pllctrl_regs;
/**
* rsctrl_enable_rspll_write - enable access to RSCTRL, RSCFG
* To be able to access to RSCTRL, RSCFG registers
* we have to write a key before
*/
static inline int rsctrl_enable_rspll_write(void)
{
return regmap_update_bits(pllctrl_regs, rspll_offset + RSCTRL_RG,
RSCTRL_KEY_MASK, RSCTRL_KEY);
}
static void rsctrl_restart(enum reboot_mode mode, const char *cmd)
{
/* enable write access to RSTCTRL */
rsctrl_enable_rspll_write();
/* reset the SOC */
regmap_update_bits(pllctrl_regs, rspll_offset + RSCTRL_RG,
RSCTRL_RESET_MASK, 0);
}
static struct of_device_id rsctrl_of_match[] = {
{.compatible = "ti,keystone-reset", },
{},
};
static int rsctrl_probe(struct platform_device *pdev)
{
int i;
int ret;
u32 val;
unsigned int rg;
u32 rsmux_offset;
struct regmap *devctrl_regs;
struct device *dev = &pdev->dev;
struct device_node *np = dev->of_node;
if (!np)
return -ENODEV;
/* get regmaps */
pllctrl_regs = syscon_regmap_lookup_by_phandle(np, "ti,syscon-pll");
if (IS_ERR(pllctrl_regs))
return PTR_ERR(pllctrl_regs);
devctrl_regs = syscon_regmap_lookup_by_phandle(np, "ti,syscon-dev");
if (IS_ERR(devctrl_regs))
return PTR_ERR(devctrl_regs);
ret = of_property_read_u32_index(np, "ti,syscon-pll", 1, &rspll_offset);
if (ret) {
dev_err(dev, "couldn't read the reset pll offset!\n");
return -EINVAL;
}
ret = of_property_read_u32_index(np, "ti,syscon-dev", 1, &rsmux_offset);
if (ret) {
dev_err(dev, "couldn't read the rsmux offset!\n");
return -EINVAL;
}
/* set soft/hard reset */
val = of_property_read_bool(np, "ti,soft-reset");
val = val ? RSCFG_RSTYPE_SOFT : RSCFG_RSTYPE_HARD;
ret = rsctrl_enable_rspll_write();
if (ret)
return ret;
ret = regmap_write(pllctrl_regs, rspll_offset + RSCFG_RG, val);
if (ret)
return ret;
arm_pm_restart = rsctrl_restart;
/* disable a reset isolation for all module clocks */
ret = regmap_write(pllctrl_regs, rspll_offset + RSISO_RG, 0);
if (ret)
return ret;
/* enable a reset for watchdogs from wdt-list */
for (i = 0; i < WDT_MUX_NUMBER; i++) {
ret = of_property_read_u32_index(np, "ti,wdt-list", i, &val);
if (ret == -EOVERFLOW && !i) {
dev_err(dev, "ti,wdt-list property has to contain at"
"least one entry\n");
return -EINVAL;
} else if (ret) {
break;
}
if (val >= WDT_MUX_NUMBER) {
dev_err(dev, "ti,wdt-list property can contain"
"only numbers < 4\n");
return -EINVAL;
}
rg = rsmux_offset + val * 4;
ret = regmap_update_bits(devctrl_regs, rg, RSMUX_OMODE_MASK,
RSMUX_OMODE_RESET_ON |
RSMUX_LOCK_SET);
if (ret)
return ret;
}
return 0;
}
static struct platform_driver rsctrl_driver = {
.probe = rsctrl_probe,
.driver = {
.owner = THIS_MODULE,
.name = KBUILD_MODNAME,
.of_match_table = rsctrl_of_match,
},
};
module_platform_driver(rsctrl_driver);
MODULE_AUTHOR("Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>");
MODULE_DESCRIPTION("Texas Instruments keystone reset driver");
MODULE_LICENSE("GPL v2");
MODULE_ALIAS("platform:" KBUILD_MODNAME);
/*
* Allwinner A31 SoCs reset code
*
* Copyright (C) 2012-2014 Maxime Ripard
*
* Maxime Ripard <maxime.ripard@free-electrons.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 <linux/delay.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/of_address.h>
#include <linux/platform_device.h>
#include <linux/reboot.h>
#include <asm/system_misc.h>
#define SUN6I_WATCHDOG1_IRQ_REG 0x00
#define SUN6I_WATCHDOG1_CTRL_REG 0x10
#define SUN6I_WATCHDOG1_CTRL_RESTART BIT(0)
#define SUN6I_WATCHDOG1_CONFIG_REG 0x14
#define SUN6I_WATCHDOG1_CONFIG_RESTART BIT(0)
#define SUN6I_WATCHDOG1_CONFIG_IRQ BIT(1)
#define SUN6I_WATCHDOG1_MODE_REG 0x18
#define SUN6I_WATCHDOG1_MODE_ENABLE BIT(0)
static void __iomem *wdt_base;
static void sun6i_wdt_restart(enum reboot_mode mode, const char *cmd)
{
if (!wdt_base)
return;
/* Disable interrupts */
writel(0, wdt_base + SUN6I_WATCHDOG1_IRQ_REG);
/* We want to disable the IRQ and just reset the whole system */
writel(SUN6I_WATCHDOG1_CONFIG_RESTART,
wdt_base + SUN6I_WATCHDOG1_CONFIG_REG);
/* Enable timer. The default and lowest interval value is 0.5s */
writel(SUN6I_WATCHDOG1_MODE_ENABLE,
wdt_base + SUN6I_WATCHDOG1_MODE_REG);
/* Restart the watchdog. */
writel(SUN6I_WATCHDOG1_CTRL_RESTART,
wdt_base + SUN6I_WATCHDOG1_CTRL_REG);
while (1) {
mdelay(5);
writel(SUN6I_WATCHDOG1_MODE_ENABLE,
wdt_base + SUN6I_WATCHDOG1_MODE_REG);
}
}
static int sun6i_reboot_probe(struct platform_device *pdev)
{
wdt_base = of_iomap(pdev->dev.of_node, 0);
if (!wdt_base) {
WARN(1, "failed to map watchdog base address");
return -ENODEV;
}
arm_pm_restart = sun6i_wdt_restart;
return 0;
}
static struct of_device_id sun6i_reboot_of_match[] = {
{ .compatible = "allwinner,sun6i-a31-wdt" },
{}
};
static struct platform_driver sun6i_reboot_driver = {
.probe = sun6i_reboot_probe,
.driver = {
.name = "sun6i-reboot",
.of_match_table = sun6i_reboot_of_match,
},
};
module_platform_driver(sun6i_reboot_driver);
obj-$(CONFIG_RESET_CONTROLLER) += core.o obj-$(CONFIG_RESET_CONTROLLER) += core.o
obj-$(CONFIG_ARCH_SOCFPGA) += reset-socfpga.o
obj-$(CONFIG_ARCH_SUNXI) += reset-sunxi.o obj-$(CONFIG_ARCH_SUNXI) += reset-sunxi.o
obj-$(CONFIG_ARCH_STI) += sti/ obj-$(CONFIG_ARCH_STI) += sti/
/*
* Copyright 2014 Steffen Trumtrar <s.trumtrar@pengutronix.de>
*
* based on
* Allwinner SoCs Reset Controller driver
*
* Copyright 2013 Maxime Ripard
*
* Maxime Ripard <maxime.ripard@free-electrons.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#include <linux/err.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/reset-controller.h>
#include <linux/spinlock.h>
#include <linux/types.h>
#define NR_BANKS 4
#define OFFSET_MODRST 0x10
struct socfpga_reset_data {
spinlock_t lock;
void __iomem *membase;
struct reset_controller_dev rcdev;
};
static int socfpga_reset_assert(struct reset_controller_dev *rcdev,
unsigned long id)
{
struct socfpga_reset_data *data = container_of(rcdev,
struct socfpga_reset_data,
rcdev);
int bank = id / BITS_PER_LONG;
int offset = id % BITS_PER_LONG;
unsigned long flags;
u32 reg;
spin_lock_irqsave(&data->lock, flags);
reg = readl(data->membase + OFFSET_MODRST + (bank * NR_BANKS));
writel(reg | BIT(offset), data->membase + OFFSET_MODRST +
(bank * NR_BANKS));
spin_unlock_irqrestore(&data->lock, flags);
return 0;
}
static int socfpga_reset_deassert(struct reset_controller_dev *rcdev,
unsigned long id)
{
struct socfpga_reset_data *data = container_of(rcdev,
struct socfpga_reset_data,
rcdev);
int bank = id / BITS_PER_LONG;
int offset = id % BITS_PER_LONG;
unsigned long flags;
u32 reg;
spin_lock_irqsave(&data->lock, flags);
reg = readl(data->membase + OFFSET_MODRST + (bank * NR_BANKS));
writel(reg & ~BIT(offset), data->membase + OFFSET_MODRST +
(bank * NR_BANKS));
spin_unlock_irqrestore(&data->lock, flags);
return 0;
}
static struct reset_control_ops socfpga_reset_ops = {
.assert = socfpga_reset_assert,
.deassert = socfpga_reset_deassert,
};
static int socfpga_reset_probe(struct platform_device *pdev)
{
struct socfpga_reset_data *data;
struct resource *res;
/*
* The binding was mainlined without the required property.
* Do not continue, when we encounter an old DT.
*/
if (!of_find_property(pdev->dev.of_node, "#reset-cells", NULL)) {
dev_err(&pdev->dev, "%s missing #reset-cells property\n",
pdev->dev.of_node->full_name);
return -EINVAL;
}
data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
if (!data)
return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
data->membase = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(data->membase))
return PTR_ERR(data->membase);
spin_lock_init(&data->lock);
data->rcdev.owner = THIS_MODULE;
data->rcdev.nr_resets = NR_BANKS * BITS_PER_LONG;
data->rcdev.ops = &socfpga_reset_ops;
data->rcdev.of_node = pdev->dev.of_node;
reset_controller_register(&data->rcdev);
return 0;
}
static int socfpga_reset_remove(struct platform_device *pdev)
{
struct socfpga_reset_data *data = platform_get_drvdata(pdev);
reset_controller_unregister(&data->rcdev);
return 0;
}
static const struct of_device_id socfpga_reset_dt_ids[] = {
{ .compatible = "altr,rst-mgr", },
{ /* sentinel */ },
};
static struct platform_driver socfpga_reset_driver = {
.probe = socfpga_reset_probe,
.remove = socfpga_reset_remove,
.driver = {
.name = "socfpga-reset",
.owner = THIS_MODULE,
.of_match_table = socfpga_reset_dt_ids,
},
};
module_platform_driver(socfpga_reset_driver);
MODULE_AUTHOR("Steffen Trumtrar <s.trumtrar@pengutronix.de");
MODULE_DESCRIPTION("Socfpga Reset Controller Driver");
MODULE_LICENSE("GPL");
...@@ -145,7 +145,24 @@ MODULE_DEVICE_TABLE(of, sunxi_reset_dt_ids); ...@@ -145,7 +145,24 @@ MODULE_DEVICE_TABLE(of, sunxi_reset_dt_ids);
static int sunxi_reset_probe(struct platform_device *pdev) static int sunxi_reset_probe(struct platform_device *pdev)
{ {
return sunxi_reset_init(pdev->dev.of_node); struct sunxi_reset_data *data;
struct resource *res;
data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
if (!data)
return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
data->membase = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(data->membase))
return PTR_ERR(data->membase);
data->rcdev.owner = THIS_MODULE;
data->rcdev.nr_resets = resource_size(res) * 32;
data->rcdev.ops = &sunxi_reset_ops;
data->rcdev.of_node = pdev->dev.of_node;
return reset_controller_register(&data->rcdev);
} }
static int sunxi_reset_remove(struct platform_device *pdev) static int sunxi_reset_remove(struct platform_device *pdev)
...@@ -153,8 +170,6 @@ static int sunxi_reset_remove(struct platform_device *pdev) ...@@ -153,8 +170,6 @@ static int sunxi_reset_remove(struct platform_device *pdev)
struct sunxi_reset_data *data = platform_get_drvdata(pdev); struct sunxi_reset_data *data = platform_get_drvdata(pdev);
reset_controller_unregister(&data->rcdev); reset_controller_unregister(&data->rcdev);
iounmap(data->membase);
kfree(data);
return 0; return 0;
} }
......
menu "SOC (System On Chip) specific Drivers"
source "drivers/soc/qcom/Kconfig"
endmenu
#
# Makefile for the Linux Kernel SOC specific device drivers.
#
obj-$(CONFIG_ARCH_QCOM) += qcom/
#
# QCOM Soc drivers
#
config QCOM_GSBI
tristate "QCOM General Serial Bus Interface"
depends on ARCH_QCOM
help
Say y here to enable GSBI support. The GSBI provides control
functions for connecting the underlying serial UART, SPI, and I2C
devices to the output pins.
obj-$(CONFIG_QCOM_GSBI) += qcom_gsbi.o
/*
* Copyright (c) 2014, The Linux foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License rev 2 and
* only rev 2 as published by the free Software foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or fITNESS fOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <linux/clk.h>
#include <linux/err.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#define GSBI_CTRL_REG 0x0000
#define GSBI_PROTOCOL_SHIFT 4
static int gsbi_probe(struct platform_device *pdev)
{
struct device_node *node = pdev->dev.of_node;
struct resource *res;
void __iomem *base;
struct clk *hclk;
u32 mode, crci = 0;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(base))
return PTR_ERR(base);
if (of_property_read_u32(node, "qcom,mode", &mode)) {
dev_err(&pdev->dev, "missing mode configuration\n");
return -EINVAL;
}
/* not required, so default to 0 if not present */
of_property_read_u32(node, "qcom,crci", &crci);
dev_info(&pdev->dev, "GSBI port protocol: %d crci: %d\n", mode, crci);
hclk = devm_clk_get(&pdev->dev, "iface");
if (IS_ERR(hclk))
return PTR_ERR(hclk);
clk_prepare_enable(hclk);
writel_relaxed((mode << GSBI_PROTOCOL_SHIFT) | crci,
base + GSBI_CTRL_REG);
/* make sure the gsbi control write is not reordered */
wmb();
clk_disable_unprepare(hclk);
return of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev);
}
static const struct of_device_id gsbi_dt_match[] = {
{ .compatible = "qcom,gsbi-v1.0.0", },
{ },
};
MODULE_DEVICE_TABLE(of, gsbi_dt_match);
static struct platform_driver gsbi_driver = {
.driver = {
.name = "gsbi",
.owner = THIS_MODULE,
.of_match_table = gsbi_dt_match,
},
.probe = gsbi_probe,
};
module_platform_driver(gsbi_driver);
MODULE_AUTHOR("Andy Gross <agross@codeaurora.org>");
MODULE_DESCRIPTION("QCOM GSBI driver");
MODULE_LICENSE("GPL v2");
...@@ -52,7 +52,6 @@ struct msm_port { ...@@ -52,7 +52,6 @@ struct msm_port {
struct clk *clk; struct clk *clk;
struct clk *pclk; struct clk *pclk;
unsigned int imr; unsigned int imr;
void __iomem *gsbi_base;
int is_uartdm; int is_uartdm;
unsigned int old_snap_state; unsigned int old_snap_state;
}; };
...@@ -599,9 +598,7 @@ static const char *msm_type(struct uart_port *port) ...@@ -599,9 +598,7 @@ static const char *msm_type(struct uart_port *port)
static void msm_release_port(struct uart_port *port) static void msm_release_port(struct uart_port *port)
{ {
struct platform_device *pdev = to_platform_device(port->dev); struct platform_device *pdev = to_platform_device(port->dev);
struct msm_port *msm_port = UART_TO_MSM(port);
struct resource *uart_resource; struct resource *uart_resource;
struct resource *gsbi_resource;
resource_size_t size; resource_size_t size;
uart_resource = platform_get_resource(pdev, IORESOURCE_MEM, 0); uart_resource = platform_get_resource(pdev, IORESOURCE_MEM, 0);
...@@ -612,28 +609,12 @@ static void msm_release_port(struct uart_port *port) ...@@ -612,28 +609,12 @@ static void msm_release_port(struct uart_port *port)
release_mem_region(port->mapbase, size); release_mem_region(port->mapbase, size);
iounmap(port->membase); iounmap(port->membase);
port->membase = NULL; port->membase = NULL;
if (msm_port->gsbi_base) {
writel_relaxed(GSBI_PROTOCOL_IDLE,
msm_port->gsbi_base + GSBI_CONTROL);
gsbi_resource = platform_get_resource(pdev, IORESOURCE_MEM, 1);
if (unlikely(!gsbi_resource))
return;
size = resource_size(gsbi_resource);
release_mem_region(gsbi_resource->start, size);
iounmap(msm_port->gsbi_base);
msm_port->gsbi_base = NULL;
}
} }
static int msm_request_port(struct uart_port *port) static int msm_request_port(struct uart_port *port)
{ {
struct msm_port *msm_port = UART_TO_MSM(port);
struct platform_device *pdev = to_platform_device(port->dev); struct platform_device *pdev = to_platform_device(port->dev);
struct resource *uart_resource; struct resource *uart_resource;
struct resource *gsbi_resource;
resource_size_t size; resource_size_t size;
int ret; int ret;
...@@ -652,30 +633,8 @@ static int msm_request_port(struct uart_port *port) ...@@ -652,30 +633,8 @@ static int msm_request_port(struct uart_port *port)
goto fail_release_port; goto fail_release_port;
} }
gsbi_resource = platform_get_resource(pdev, IORESOURCE_MEM, 1);
/* Is this a GSBI-based port? */
if (gsbi_resource) {
size = resource_size(gsbi_resource);
if (!request_mem_region(gsbi_resource->start, size,
"msm_serial")) {
ret = -EBUSY;
goto fail_release_port_membase;
}
msm_port->gsbi_base = ioremap(gsbi_resource->start, size);
if (!msm_port->gsbi_base) {
ret = -EBUSY;
goto fail_release_gsbi;
}
}
return 0; return 0;
fail_release_gsbi:
release_mem_region(gsbi_resource->start, size);
fail_release_port_membase:
iounmap(port->membase);
fail_release_port: fail_release_port:
release_mem_region(port->mapbase, size); release_mem_region(port->mapbase, size);
return ret; return ret;
...@@ -683,7 +642,6 @@ static int msm_request_port(struct uart_port *port) ...@@ -683,7 +642,6 @@ static int msm_request_port(struct uart_port *port)
static void msm_config_port(struct uart_port *port, int flags) static void msm_config_port(struct uart_port *port, int flags)
{ {
struct msm_port *msm_port = UART_TO_MSM(port);
int ret; int ret;
if (flags & UART_CONFIG_TYPE) { if (flags & UART_CONFIG_TYPE) {
port->type = PORT_MSM; port->type = PORT_MSM;
...@@ -691,9 +649,6 @@ static void msm_config_port(struct uart_port *port, int flags) ...@@ -691,9 +649,6 @@ static void msm_config_port(struct uart_port *port, int flags)
if (ret) if (ret)
return; return;
} }
if (msm_port->gsbi_base)
writel_relaxed(GSBI_PROTOCOL_UART,
msm_port->gsbi_base + GSBI_CONTROL);
} }
static int msm_verify_port(struct uart_port *port, struct serial_struct *ser) static int msm_verify_port(struct uart_port *port, struct serial_struct *ser)
...@@ -1110,6 +1065,7 @@ static struct of_device_id msm_match_table[] = { ...@@ -1110,6 +1065,7 @@ static struct of_device_id msm_match_table[] = {
static struct platform_driver msm_platform_driver = { static struct platform_driver msm_platform_driver = {
.remove = msm_serial_remove, .remove = msm_serial_remove,
.probe = msm_serial_probe,
.driver = { .driver = {
.name = "msm_serial", .name = "msm_serial",
.owner = THIS_MODULE, .owner = THIS_MODULE,
...@@ -1125,7 +1081,7 @@ static int __init msm_serial_init(void) ...@@ -1125,7 +1081,7 @@ static int __init msm_serial_init(void)
if (unlikely(ret)) if (unlikely(ret))
return ret; return ret;
ret = platform_driver_probe(&msm_platform_driver, msm_serial_probe); ret = platform_driver_register(&msm_platform_driver);
if (unlikely(ret)) if (unlikely(ret))
uart_unregister_driver(&msm_uart_driver); uart_unregister_driver(&msm_uart_driver);
......
...@@ -109,11 +109,6 @@ ...@@ -109,11 +109,6 @@
#define UART_ISR 0x0014 #define UART_ISR 0x0014
#define UART_ISR_TX_READY (1 << 7) #define UART_ISR_TX_READY (1 << 7)
#define GSBI_CONTROL 0x0
#define GSBI_PROTOCOL_CODE 0x30
#define GSBI_PROTOCOL_UART 0x40
#define GSBI_PROTOCOL_IDLE 0x0
#define UARTDM_RXFS 0x50 #define UARTDM_RXFS 0x50
#define UARTDM_RXFS_BUF_SHIFT 0x7 #define UARTDM_RXFS_BUF_SHIFT 0x7
#define UARTDM_RXFS_BUF_MASK 0x7 #define UARTDM_RXFS_BUF_MASK 0x7
......
...@@ -43,15 +43,15 @@ ...@@ -43,15 +43,15 @@
/* PaRAM slots are laid out like this */ /* PaRAM slots are laid out like this */
struct edmacc_param { struct edmacc_param {
unsigned int opt; u32 opt;
unsigned int src; u32 src;
unsigned int a_b_cnt; u32 a_b_cnt;
unsigned int dst; u32 dst;
unsigned int src_dst_bidx; u32 src_dst_bidx;
unsigned int link_bcntrld; u32 link_bcntrld;
unsigned int src_dst_cidx; u32 src_dst_cidx;
unsigned int ccnt; u32 ccnt;
}; } __packed;
/* fields in edmacc_param.opt */ /* fields in edmacc_param.opt */
#define SAM BIT(0) #define SAM BIT(0)
...@@ -130,7 +130,7 @@ void edma_set_src(unsigned slot, dma_addr_t src_port, ...@@ -130,7 +130,7 @@ void edma_set_src(unsigned slot, dma_addr_t src_port,
enum address_mode mode, enum fifo_width); enum address_mode mode, enum fifo_width);
void edma_set_dest(unsigned slot, dma_addr_t dest_port, void edma_set_dest(unsigned slot, dma_addr_t dest_port,
enum address_mode mode, enum fifo_width); enum address_mode mode, enum fifo_width);
void edma_get_position(unsigned slot, dma_addr_t *src, dma_addr_t *dst); dma_addr_t edma_get_position(unsigned slot, bool dst);
void edma_set_src_index(unsigned slot, s16 src_bidx, s16 src_cidx); void edma_set_src_index(unsigned slot, s16 src_bidx, s16 src_cidx);
void edma_set_dest_index(unsigned slot, s16 dest_bidx, s16 dest_cidx); void edma_set_dest_index(unsigned slot, s16 dest_bidx, s16 dest_cidx);
void edma_set_transfer_params(unsigned slot, u16 acnt, u16 bcnt, u16 ccnt, void edma_set_transfer_params(unsigned slot, u16 acnt, u16 bcnt, u16 ccnt,
...@@ -158,13 +158,6 @@ struct edma_rsv_info { ...@@ -158,13 +158,6 @@ struct edma_rsv_info {
/* platform_data for EDMA driver */ /* platform_data for EDMA driver */
struct edma_soc_info { struct edma_soc_info {
/* how many dma resources of each type */
unsigned n_channel;
unsigned n_region;
unsigned n_slot;
unsigned n_tc;
unsigned n_cc;
/* /*
* Default queue is expected to be a low-priority queue. * Default queue is expected to be a low-priority queue.
* This way, long transfers on the default queue started * This way, long transfers on the default queue started
...@@ -175,7 +168,6 @@ struct edma_soc_info { ...@@ -175,7 +168,6 @@ struct edma_soc_info {
/* Resource reservation for other cores */ /* Resource reservation for other cores */
struct edma_rsv_info *rsv; struct edma_rsv_info *rsv;
s8 (*queue_tc_mapping)[2];
s8 (*queue_priority_mapping)[2]; s8 (*queue_priority_mapping)[2];
const s16 (*xbar_chans)[2]; const s16 (*xbar_chans)[2];
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment