aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-clps711x
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-10-08 17:13:04 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-10-08 17:13:04 -0400
commitcf377ad7d42c566356d79049536d9cb37499cb77 (patch)
tree266371ff3a9462dcbaa9567e20c9a34722e3b32f /arch/arm/mach-clps711x
parent212fe84a6f215c39795a76517c1c02114d428681 (diff)
parentd8f0faa339b0beff6e055218e10b2982422db540 (diff)
Merge tag 'soc-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC platform changes from Arnd Bergmann: "New and updated SoC support. Among the things new for this release are: - at91: Added support for the new SAMA5D4 SoC, following the earlier SAMA5D3 - bcm: Added support for BCM63XX family of DSL SoCs - hisi: Added support for HiP04 server-class SoC - meson: Initial support for the Amlogic Meson6 (aka 8726MX) platform - shmobile: added support for new r8a7794 (R-Car E2) automotive SoC Noteworthy changes to existing SoC support are: - imx: convert i.MX1 to device tree - omap: lots of power management work - omap: base support to enable moving to standard UART driver - shmobile: lots of progress for multiplatform support, still ongoing" * tag 'soc-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (171 commits) ARM: hisi: depend on ARCH_MULTI_V7 CNS3xxx: Fix debug UART. ARM: at91: fix nommu build regression ARM: meson: add basic support for MesonX SoCs ARM: meson: debug: add debug UART for earlyprintk support irq: Export handle_fasteoi_irq ARM: mediatek: Add earlyprintk support for mt6589 ARM: hisi: Fix platmcpm compilation when ARMv6 is selected ARM: debug: fix alphanumerical order on debug uarts ARM: at91: document Atmel SMART compatibles ARM: at91: add sama5d4 support to sama5_defconfig ARM: at91: dt: add device tree file for SAMA5D4ek board ARM: at91: dt: add device tree file for SAMA5D4 SoC ARM: at91: SAMA5D4 SoC detection code and low level routines ARM: at91: introduce basic SAMA5D4 support clk: at91: add a driver for the h32mx clock ARM: pxa3xx: provide specific platform_devices for all ssp ports ARM: pxa: ssp: provide platform_device_id for PXA3xx ARM: OMAP4+: Remove static iotable mappings for SRAM ARM: OMAP4+: Move SRAM data to DT ...
Diffstat (limited to 'arch/arm/mach-clps711x')
-rw-r--r--arch/arm/mach-clps711x/board-edb7211.c37
-rw-r--r--arch/arm/mach-clps711x/devices.c52
2 files changed, 73 insertions, 16 deletions
diff --git a/arch/arm/mach-clps711x/board-edb7211.c b/arch/arm/mach-clps711x/board-edb7211.c
index fdf54d40909a..f33979784f38 100644
--- a/arch/arm/mach-clps711x/board-edb7211.c
+++ b/arch/arm/mach-clps711x/board-edb7211.c
@@ -14,8 +14,9 @@
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/i2c-gpio.h> 15#include <linux/i2c-gpio.h>
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/backlight.h>
18#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/pwm.h>
19#include <linux/pwm_backlight.h>
19#include <linux/memblock.h> 20#include <linux/memblock.h>
20 21
21#include <linux/mtd/physmap.h> 22#include <linux/mtd/physmap.h>
@@ -108,23 +109,23 @@ static struct plat_lcd_data edb7211_lcd_power_pdata = {
108 .set_power = edb7211_lcd_power_set, 109 .set_power = edb7211_lcd_power_set,
109}; 110};
110 111
111static void edb7211_lcd_backlight_set_intensity(int intensity) 112static struct pwm_lookup edb7211_pwm_lookup[] = {
112{ 113 PWM_LOOKUP("clps711x-pwm", 0, "pwm-backlight.0", NULL,
113 gpio_set_value(EDB7211_LCDBL, !!intensity); 114 0, PWM_POLARITY_NORMAL),
114 clps_writel((clps_readl(PMPCON) & 0xf0ff) | (intensity << 8), PMPCON); 115};
115}
116 116
117static struct generic_bl_info edb7211_lcd_backlight_pdata = { 117static struct platform_pwm_backlight_data pwm_bl_pdata = {
118 .name = "lcd-backlight.0", 118 .dft_brightness = 0x01,
119 .default_intensity = 0x01, 119 .max_brightness = 0x0f,
120 .max_intensity = 0x0f, 120 .enable_gpio = EDB7211_LCDBL,
121 .set_bl_intensity = edb7211_lcd_backlight_set_intensity,
122}; 121};
123 122
123static struct resource clps711x_pwm_res =
124 DEFINE_RES_MEM(CLPS711X_PHYS_BASE + PMPCON, SZ_4);
125
124static struct gpio edb7211_gpios[] __initconst = { 126static struct gpio edb7211_gpios[] __initconst = {
125 { EDB7211_LCD_DC_DC_EN, GPIOF_OUT_INIT_LOW, "LCD DC-DC" }, 127 { EDB7211_LCD_DC_DC_EN, GPIOF_OUT_INIT_LOW, "LCD DC-DC" },
126 { EDB7211_LCDEN, GPIOF_OUT_INIT_LOW, "LCD POWER" }, 128 { EDB7211_LCDEN, GPIOF_OUT_INIT_LOW, "LCD POWER" },
127 { EDB7211_LCDBL, GPIOF_OUT_INIT_LOW, "LCD BACKLIGHT" },
128}; 129};
129 130
130/* Reserve screen memory region at the start of main system memory. */ 131/* Reserve screen memory region at the start of main system memory. */
@@ -153,12 +154,18 @@ static void __init edb7211_init_late(void)
153 gpio_request_array(edb7211_gpios, ARRAY_SIZE(edb7211_gpios)); 154 gpio_request_array(edb7211_gpios, ARRAY_SIZE(edb7211_gpios));
154 155
155 platform_device_register(&edb7211_flash_pdev); 156 platform_device_register(&edb7211_flash_pdev);
157
156 platform_device_register_data(NULL, "platform-lcd", 0, 158 platform_device_register_data(NULL, "platform-lcd", 0,
157 &edb7211_lcd_power_pdata, 159 &edb7211_lcd_power_pdata,
158 sizeof(edb7211_lcd_power_pdata)); 160 sizeof(edb7211_lcd_power_pdata));
159 platform_device_register_data(NULL, "generic-bl", 0, 161
160 &edb7211_lcd_backlight_pdata, 162 platform_device_register_simple("clps711x-pwm", PLATFORM_DEVID_NONE,
161 sizeof(edb7211_lcd_backlight_pdata)); 163 &clps711x_pwm_res, 1);
164 pwm_add_table(edb7211_pwm_lookup, ARRAY_SIZE(edb7211_pwm_lookup));
165
166 platform_device_register_data(&platform_bus, "pwm-backlight", 0,
167 &pwm_bl_pdata, sizeof(pwm_bl_pdata));
168
162 platform_device_register_simple("video-clps711x", 0, NULL, 0); 169 platform_device_register_simple("video-clps711x", 0, NULL, 0);
163 platform_device_register_simple("cs89x0", 0, edb7211_cs8900_resource, 170 platform_device_register_simple("cs89x0", 0, edb7211_cs8900_resource,
164 ARRAY_SIZE(edb7211_cs8900_resource)); 171 ARRAY_SIZE(edb7211_cs8900_resource));
diff --git a/arch/arm/mach-clps711x/devices.c b/arch/arm/mach-clps711x/devices.c
index 0c689d3a6710..77a9617c216d 100644
--- a/arch/arm/mach-clps711x/devices.c
+++ b/arch/arm/mach-clps711x/devices.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * CLPS711X common devices definitions 2 * CLPS711X common devices definitions
3 * 3 *
4 * Author: Alexander Shiyan <shc_work@mail.ru>, 2013 4 * Author: Alexander Shiyan <shc_work@mail.ru>, 2013-2014
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
@@ -9,8 +9,15 @@
9 * (at your option) any later version. 9 * (at your option) any later version.
10 */ 10 */
11 11
12#include <linux/io.h>
13#include <linux/of_fdt.h>
12#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/random.h>
13#include <linux/sizes.h> 16#include <linux/sizes.h>
17#include <linux/slab.h>
18#include <linux/sys_soc.h>
19
20#include <asm/system_info.h>
14 21
15#include <mach/hardware.h> 22#include <mach/hardware.h>
16 23
@@ -90,10 +97,53 @@ static void __init clps711x_add_uart(void)
90 ARRAY_SIZE(clps711x_uart2_res)); 97 ARRAY_SIZE(clps711x_uart2_res));
91}; 98};
92 99
100static void __init clps711x_soc_init(void)
101{
102 struct soc_device_attribute *soc_dev_attr;
103 struct soc_device *soc_dev;
104 void __iomem *base;
105 u32 id[5];
106
107 base = ioremap(CLPS711X_PHYS_BASE, SZ_32K);
108 if (!base)
109 return;
110
111 id[0] = readl(base + UNIQID);
112 id[1] = readl(base + RANDID0);
113 id[2] = readl(base + RANDID1);
114 id[3] = readl(base + RANDID2);
115 id[4] = readl(base + RANDID3);
116 system_rev = SYSFLG1_VERID(readl(base + SYSFLG1));
117
118 add_device_randomness(id, sizeof(id));
119
120 system_serial_low = id[0];
121
122 soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
123 if (!soc_dev_attr)
124 goto out_unmap;
125
126 soc_dev_attr->machine = of_flat_dt_get_machine_name();
127 soc_dev_attr->family = "Cirrus Logic CLPS711X";
128 soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%u", system_rev);
129 soc_dev_attr->soc_id = kasprintf(GFP_KERNEL, "%08x", id[0]);
130
131 soc_dev = soc_device_register(soc_dev_attr);
132 if (IS_ERR(soc_dev)) {
133 kfree(soc_dev_attr->revision);
134 kfree(soc_dev_attr->soc_id);
135 kfree(soc_dev_attr);
136 }
137
138out_unmap:
139 iounmap(base);
140}
141
93void __init clps711x_devices_init(void) 142void __init clps711x_devices_init(void)
94{ 143{
95 clps711x_add_cpuidle(); 144 clps711x_add_cpuidle();
96 clps711x_add_gpio(); 145 clps711x_add_gpio();
97 clps711x_add_syscon(); 146 clps711x_add_syscon();
98 clps711x_add_uart(); 147 clps711x_add_uart();
148 clps711x_soc_init();
99} 149}