ARM: mach-shmobile: add 3.3V and 1.8V fixed regulators to mackerel
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Tue, 26 Jun 2012 22:32:23 +0000 (00:32 +0200)
committerRafael J. Wysocki <rjw@sisk.pl>
Sat, 30 Jun 2012 20:36:59 +0000 (22:36 +0200)
Drivers for several devices on mackerel, including all SDHI instances, the
MMCIF controller and the SMSC9220 ethernet chip use regulators to control
power supply to their devices. MMC drivers need to be able to at least
retrieve voltage values from supplying regulators, whereas the smsc911x
driver only enables and disables chip power supplies without further looking
at them. This patch adds two fixed voltage regulators to describe 1.8V and
3.3V supplies on the board and a dummy regulator for SMSC9220.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
arch/arm/mach-shmobile/board-mackerel.c

index 30d06b5..b3af57a 100644 (file)
@@ -41,6 +41,8 @@
 #include <linux/mtd/physmap.h>
 #include <linux/mtd/sh_flctl.h>
 #include <linux/pm_clock.h>
+#include <linux/regulator/fixed.h>
+#include <linux/regulator/machine.h>
 #include <linux/smsc911x.h>
 #include <linux/sh_intc.h>
 #include <linux/tca6416_keypad.h>
  * amixer set "HPOUTR Mixer DACH" on
  */
 
+/* Fixed 3.3V and 1.8V regulators to be used by multiple devices */
+static struct regulator_consumer_supply fixed1v8_power_consumers[] =
+{
+       /*
+        * J22 on mackerel switches mmcif.0 and sdhi.1 between 1.8V and 3.3V
+        * Since we cannot support both voltages, we support the default 1.8V
+        */
+       REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"),
+       REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.1"),
+       REGULATOR_SUPPLY("vmmc", "sh_mmcif.0"),
+       REGULATOR_SUPPLY("vqmmc", "sh_mmcif.0"),
+};
+
+static struct regulator_consumer_supply fixed3v3_power_consumers[] =
+{
+       REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
+       REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
+       REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.2"),
+       REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.2"),
+};
+
+/* Dummy supplies, where voltage doesn't matter */
+static struct regulator_consumer_supply dummy_supplies[] = {
+       REGULATOR_SUPPLY("vddvario", "smsc911x"),
+       REGULATOR_SUPPLY("vdd33a", "smsc911x"),
+};
+
 /* MTD */
 static struct mtd_partition nor_flash_partitions[] = {
        {
@@ -1383,6 +1412,12 @@ static void __init mackerel_init(void)
        u32 srcr4;
        struct clk *clk;
 
+       regulator_register_always_on(0, "fixed-1.8V", fixed1v8_power_consumers,
+                                    ARRAY_SIZE(fixed1v8_power_consumers), 1800000);
+       regulator_register_always_on(1, "fixed-3.3V", fixed3v3_power_consumers,
+                                    ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
+       regulator_register_fixed(2, dummy_supplies, ARRAY_SIZE(dummy_supplies));
+
        /* External clock source */
        clk_set_rate(&sh7372_dv_clki_clk, 27000000);