Commit b2e5add3b2a27accbf4ca649bcd2b763640cea01

Authored by Stefano Babic
Committed by Albert ARIBAUD
1 parent 2a7dd9d71c

misc: pmic: Freescale PMIC switches to generic PMIC driver

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Stefano Babic <sbabic@denx.de>

Showing 3 changed files with 59 additions and 4 deletions Side-by-side Diff

drivers/misc/Makefile
... ... @@ -36,6 +36,7 @@
36 36 COBJS-$(CONFIG_STATUS_LED) += status_led.o
37 37 COBJS-$(CONFIG_TWL4030_LED) += twl4030_led.o
38 38 COBJS-$(CONFIG_PMIC) += pmic_core.o
  39 +COBJS-$(CONFIG_PMIC_FSL) += pmic_fsl.o
39 40 COBJS-$(CONFIG_PMIC_I2C) += pmic_i2c.o
40 41 COBJS-$(CONFIG_PMIC_SPI) += pmic_spi.o
41 42 COBJS-$(CONFIG_PMIC_MAX8998) += pmic_max8998.o
drivers/misc/pmic_fsl.c
  1 +/*
  2 + * Copyright (C) 2011 Samsung Electronics
  3 + * Lukasz Majewski <l.majewski@samsung.com>
  4 + *
  5 + * See file CREDITS for list of people who contributed to this
  6 + * project.
  7 + *
  8 + * This program is free software; you can redistribute it and/or
  9 + * modify it under the terms of the GNU General Public License as
  10 + * published by the Free Software Foundation; either version 2 of
  11 + * the License, or (at your option) any later version.
  12 + *
  13 + * This program is distributed in the hope that it will be useful,
  14 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16 + * GNU General Public License for more details.
  17 + *
  18 + * You should have received a copy of the GNU General Public License
  19 + * along with this program; if not, write to the Free Software
  20 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21 + * MA 02111-1307 USA
  22 + */
  23 +
  24 +#include <common.h>
  25 +#include <spi.h>
  26 +#include <pmic.h>
  27 +#include <fsl_pmic.h>
  28 +
  29 +static u32 pmic_spi_prepare_tx(u32 reg, u32 *val, u32 write)
  30 +{
  31 + if ((val == NULL) && (write))
  32 + return *val & ~(1 << 31);
  33 + else
  34 + return (write << 31) | (reg << 25) | (*val & 0x00FFFFFF);
  35 +}
  36 +
  37 +int pmic_init(void)
  38 +{
  39 + struct pmic *p = get_pmic();
  40 + static const char name[] = "FSL_PMIC";
  41 +
  42 + puts("Board PMIC init\n");
  43 +
  44 + p->name = name;
  45 + p->interface = PMIC_SPI;
  46 + p->number_of_regs = PMIC_NUM_OF_REGS;
  47 + p->bus = CONFIG_FSL_PMIC_BUS;
  48 +
  49 + p->hw.spi.cs = CONFIG_FSL_PMIC_CS;
  50 + p->hw.spi.clk = CONFIG_FSL_PMIC_CLK;
  51 + p->hw.spi.mode = CONFIG_FSL_PMIC_MODE;
  52 + p->hw.spi.bitlen = CONFIG_FSL_PMIC_BITLEN;
  53 + p->hw.spi.flags = SPI_XFER_BEGIN | SPI_XFER_END;
  54 + p->hw.spi.prepare_tx = pmic_spi_prepare_tx;
  55 +
  56 + return 0;
  57 +}
... ... @@ -99,6 +99,7 @@
99 99 REG_TEST2,
100 100 REG_TEST3,
101 101 REG_TEST4,
  102 + PMIC_NUM_OF_REGS,
102 103 };
103 104  
104 105 /* REG_POWER_MISC */
... ... @@ -120,10 +121,6 @@
120 121  
121 122 /* Interrupt status 1 */
122 123 #define RTCRSTI (1 << 7)
123   -
124   -void pmic_show_pmic_info(void);
125   -void pmic_reg_write(u32 reg, u32 value);
126   -u32 pmic_reg_read(u32 reg);
127 124  
128 125 #endif