Source
static void asic3_set_register(struct asic3 *asic, u32 reg, u32 bits, bool set)
// SPDX-License-Identifier: GPL-2.0-only
/*
* driver/mfd/asic3.c
*
* Compaq ASIC3 support.
*
* Copyright 2001 Compaq Computer Corporation.
* Copyright 2004-2005 Phil Blundell
* Copyright 2007-2008 OpenedHand Ltd.
*
* Authors: Phil Blundell <pb@handhelds.org>,
* Samuel Ortiz <sameo@openedhand.com>
*/
enum {
ASIC3_CLOCK_SPI,
ASIC3_CLOCK_OWM,
ASIC3_CLOCK_PWM0,
ASIC3_CLOCK_PWM1,
ASIC3_CLOCK_LED0,
ASIC3_CLOCK_LED1,
ASIC3_CLOCK_LED2,
ASIC3_CLOCK_SD_HOST,
ASIC3_CLOCK_SD_BUS,
ASIC3_CLOCK_SMBUS,
ASIC3_CLOCK_EX0,
ASIC3_CLOCK_EX1,
};
struct asic3_clk {
int enabled;
unsigned int cdex;
unsigned long rate;
};
static struct asic3_clk asic3_clk_init[] __initdata = {
INIT_CDEX(SPI, 0),
INIT_CDEX(OWM, 5000000),
INIT_CDEX(PWM0, 0),
INIT_CDEX(PWM1, 0),
INIT_CDEX(LED0, 0),
INIT_CDEX(LED1, 0),
INIT_CDEX(LED2, 0),
INIT_CDEX(SD_HOST, 24576000),
INIT_CDEX(SD_BUS, 12288000),
INIT_CDEX(SMBUS, 0),
INIT_CDEX(EX0, 32768),
INIT_CDEX(EX1, 24576000),
};
struct asic3 {
void __iomem *mapping;
unsigned int bus_shift;
unsigned int irq_nr;
unsigned int irq_base;
raw_spinlock_t lock;
u16 irq_bothedge[4];
struct gpio_chip gpio;
struct device *dev;
void __iomem *tmio_cnf;
struct asic3_clk clocks[ARRAY_SIZE(asic3_clk_init)];
};
static int asic3_gpio_get(struct gpio_chip *chip, unsigned offset);
void asic3_write_register(struct asic3 *asic, unsigned int reg, u32 value)
{
iowrite16(value, asic->mapping +