Lines Matching refs:mod
59 struct ttl_module *mod = dev_get_drvdata(gpio->parent); in ttl_get_value() local
64 shadow = &mod->porta_shadow; in ttl_get_value()
66 shadow = &mod->portb_shadow; in ttl_get_value()
69 shadow = &mod->portc_shadow; in ttl_get_value()
73 spin_lock(&mod->lock); in ttl_get_value()
75 spin_unlock(&mod->lock); in ttl_get_value()
81 struct ttl_module *mod = dev_get_drvdata(gpio->parent); in ttl_set_value() local
86 port = &mod->regs->porta; in ttl_set_value()
87 shadow = &mod->porta_shadow; in ttl_set_value()
89 port = &mod->regs->portb; in ttl_set_value()
90 shadow = &mod->portb_shadow; in ttl_set_value()
93 port = &mod->regs->portc; in ttl_set_value()
94 shadow = &mod->portc_shadow; in ttl_set_value()
98 spin_lock(&mod->lock); in ttl_set_value()
105 spin_unlock(&mod->lock); in ttl_set_value()
108 static void ttl_write_reg(struct ttl_module *mod, u8 reg, u16 val) in ttl_write_reg() argument
110 iowrite16be(reg, &mod->regs->control); in ttl_write_reg()
111 iowrite16be(val, &mod->regs->control); in ttl_write_reg()
114 static void ttl_setup_device(struct ttl_module *mod) in ttl_setup_device() argument
117 iowrite16be(0x0000, &mod->regs->control); in ttl_setup_device()
118 iowrite16be(0x0001, &mod->regs->control); in ttl_setup_device()
119 iowrite16be(0x0000, &mod->regs->control); in ttl_setup_device()
122 ttl_write_reg(mod, PORTA_IOCTL, 0x00ff); in ttl_setup_device()
123 ttl_write_reg(mod, PORTB_IOCTL, 0x00ff); in ttl_setup_device()
124 ttl_write_reg(mod, PORTC_IOCTL, 0x000f); in ttl_setup_device()
127 ttl_write_reg(mod, PORTA_DIRECTION, 0x0000); in ttl_setup_device()
128 ttl_write_reg(mod, PORTB_DIRECTION, 0x0000); in ttl_setup_device()
129 ttl_write_reg(mod, PORTC_DIRECTION, 0x0000); in ttl_setup_device()
132 iowrite16be(0x0000, &mod->regs->porta); in ttl_setup_device()
133 iowrite16be(0x0000, &mod->regs->portb); in ttl_setup_device()
134 iowrite16be(0x0000, &mod->regs->portc); in ttl_setup_device()
137 ttl_write_reg(mod, MASTER_CONF_CTL, CONF_PAE | CONF_PBE | CONF_PCE); in ttl_setup_device()
143 struct ttl_module *mod; in ttl_probe() local
153 mod = devm_kzalloc(&pdev->dev, sizeof(*mod), GFP_KERNEL); in ttl_probe()
154 if (!mod) in ttl_probe()
157 platform_set_drvdata(pdev, mod); in ttl_probe()
158 spin_lock_init(&mod->lock); in ttl_probe()
161 mod->regs = devm_platform_ioremap_resource(pdev, 0); in ttl_probe()
162 if (IS_ERR(mod->regs)) in ttl_probe()
163 return PTR_ERR(mod->regs); in ttl_probe()
165 ttl_setup_device(mod); in ttl_probe()
168 gpio = &mod->gpio; in ttl_probe()