/** * struct ioh_gpio_reg_data - The register store data. * @ien_reg: To store contents of interrupt enable register. * @imask_reg: To store contents of interrupt mask regist * @po_reg: To store contents of PO register. * @pm_reg: To store contents of PM register. * @im0_reg: To store contents of interrupt mode regist0 * @im1_reg: To store contents of interrupt mode regist1 * @use_sel_reg: To store contents of GPIO_USE_SEL0~3
*/ struct ioh_gpio_reg_data {
u32 ien_reg;
u32 imask_reg;
u32 po_reg;
u32 pm_reg;
u32 im0_reg;
u32 im1_reg;
u32 use_sel_reg;
};
/** * struct ioh_gpio - GPIO private data structure. * @base: PCI base address of Memory mapped I/O register. * @reg: Memory mapped IOH GPIO register list. * @dev: Pointer to device structure. * @gpio: Data for GPIO infrastructure. * @ioh_gpio_reg: Memory mapped Register data is saved here * when suspend. * @gpio_use_sel: Save GPIO_USE_SEL1~4 register for PM * @ch: Indicate GPIO channel * @irq_base: Save base of IRQ number for interrupt * @spinlock: Used for register access protection
*/ struct ioh_gpio { void __iomem *base; struct ioh_regs __iomem *reg; struct device *dev; struct gpio_chip gpio; struct ioh_gpio_reg_data ioh_gpio_reg;
u32 gpio_use_sel; int ch; int irq_base;
spinlock_t spinlock;
};
/* * Save register configuration and disable interrupts.
*/ staticvoid __maybe_unused ioh_gpio_save_reg_conf(struct ioh_gpio *chip)
{ int i;
for (i = 0; i < 8; i ++, chip++) {
chip->ioh_gpio_reg.po_reg =
ioread32(&chip->reg->regs[chip->ch].po);
chip->ioh_gpio_reg.pm_reg =
ioread32(&chip->reg->regs[chip->ch].pm);
chip->ioh_gpio_reg.ien_reg =
ioread32(&chip->reg->regs[chip->ch].ien);
chip->ioh_gpio_reg.imask_reg =
ioread32(&chip->reg->regs[chip->ch].imask);
chip->ioh_gpio_reg.im0_reg =
ioread32(&chip->reg->regs[chip->ch].im_0);
chip->ioh_gpio_reg.im1_reg =
ioread32(&chip->reg->regs[chip->ch].im_1); if (i < 4)
chip->ioh_gpio_reg.use_sel_reg =
ioread32(&chip->reg->ioh_sel_reg[i]);
}
}
/* * This function restores the register configuration of the GPIO device.
*/ staticvoid __maybe_unused ioh_gpio_restore_reg_conf(struct ioh_gpio *chip)
{ int i;
for (i = 0; i < 8; i ++, chip++) {
iowrite32(chip->ioh_gpio_reg.po_reg,
&chip->reg->regs[chip->ch].po);
iowrite32(chip->ioh_gpio_reg.pm_reg,
&chip->reg->regs[chip->ch].pm);
iowrite32(chip->ioh_gpio_reg.ien_reg,
&chip->reg->regs[chip->ch].ien);
iowrite32(chip->ioh_gpio_reg.imask_reg,
&chip->reg->regs[chip->ch].imask);
iowrite32(chip->ioh_gpio_reg.im0_reg,
&chip->reg->regs[chip->ch].im_0);
iowrite32(chip->ioh_gpio_reg.im1_reg,
&chip->reg->regs[chip->ch].im_1); if (i < 4)
iowrite32(chip->ioh_gpio_reg.use_sel_reg,
&chip->reg->ioh_sel_reg[i]);
}
}
switch (type) { case IRQ_TYPE_EDGE_RISING:
val = IOH_EDGE_RISING; break; case IRQ_TYPE_EDGE_FALLING:
val = IOH_EDGE_FALLING; break; case IRQ_TYPE_EDGE_BOTH:
val = IOH_EDGE_BOTH; break; case IRQ_TYPE_LEVEL_HIGH:
val = IOH_LEVEL_H; break; case IRQ_TYPE_LEVEL_LOW:
val = IOH_LEVEL_L; break; case IRQ_TYPE_PROBE: goto end; default:
dev_warn(chip->dev, "%s: unknown type(%dd)",
__func__, type); goto end;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.