Home | History | Annotate | Download | only in modules

Lines Matching defs:pld

2  *  kempld_wdt.c - Kontron PLD watchdog driver
8 * Note: From the PLD watchdog point of view timeout and pretimeout are
41 struct kempld_device_data pld;
67 * kempld_set_index - change the current register index of the PLD
68 * @pld: kempld_device_data structure describing the PLD
71 * This function changes the register index of the PLD.
73 void kempld_set_index(struct kempld_device_data *pld, uint8_t index)
75 if (pld->last_index != index) {
76 iowrite8(index, pld->io_index);
77 pld->last_index = index;
82 uint8_t kempld_read8(struct kempld_device_data *pld, uint8_t index) {
83 kempld_set_index(pld, index);
84 return ioread8(pld->io_data);
88 void kempld_write8(struct kempld_device_data *pld, uint8_t index, uint8_t data) {
89 kempld_set_index(pld, index);
90 iowrite8(data, pld->io_data);
94 uint16_t kempld_read16(struct kempld_device_data *pld, uint8_t index)
96 return kempld_read8(pld, index) | kempld_read8(pld, index+1) << 8;
100 void kempld_write16(struct kempld_device_data *pld, uint8_t index, uint16_t data)
102 kempld_write8(pld, index, (uint8_t)data);
103 kempld_write8(pld, index+1, (uint8_t)(data>>8));
106 uint32_t kempld_read32(struct kempld_device_data *pld, uint8_t index)
108 return kempld_read16(pld, index) | kempld_read16(pld, index+2) << 16;
111 void kempld_write32(struct kempld_device_data *pld, uint8_t index, uint32_t data)
113 kempld_write16(pld, index, (uint16_t)data);
114 kempld_write16(pld, index+2, (uint16_t)(data>>16));
117 static void kempld_release_mutex(struct kempld_device_data *pld)
119 iowrite8(pld->last_index | KEMPLD_MUTEX_KEY, pld->io_index);
126 memset(&pld,0,sizeof(pld));
130 wdt.pld = &pld;
132 pld.io_base=KEMPLD_IOPORT;
133 pld.io_index=KEMPLD_IOPORT;
134 pld.io_data=KEMPLD_IODATA;
135 pld.pld_clock=33333333;
141 uint8_t index_reg = ioread8(pld.io_index);
142 if ((index_reg == 0xff) && (ioread8(pld.io_data) == 0xff)) {
146 printf("Kempld structure found at 0x%X (data @ 0x%X)\n",pld.io_base,pld.io_data);
156 struct kempld_device_data *pld = wdt->pld;
168 timeout = kempld_read32(pld, KEMPLD_WDT_STAGE_TIMEOUT(i));
169 kempld_write32(pld, KEMPLD_WDT_STAGE_TIMEOUT(i), 0x00000000);
170 timeout_mask = kempld_read32(pld, KEMPLD_WDT_STAGE_TIMEOUT(i));
171 kempld_write32(pld, KEMPLD_WDT_STAGE_TIMEOUT(i), timeout);
198 kempld_release_mutex(pld);
205 struct kempld_device_data *pld = wdt->pld;
207 kempld_write8(pld, KEMPLD_WDT_KICK, 'K');
216 struct kempld_device_data *pld = wdt->pld;
222 stage_cfg = kempld_read8(pld, KEMPLD_WDT_STAGE_CFG(stage->num));
230 kempld_write8(pld, KEMPLD_WDT_STAGE_CFG(stage->num), stage_cfg);
231 stage_cfg = kempld_read8(pld, KEMPLD_WDT_STAGE_CFG(stage->num));
240 struct kempld_device_data *pld = wdt->pld;
251 stage_timeout64 = ((uint64_t)timeout*pld->pld_clock);
258 stage_cfg = kempld_read8(pld, KEMPLD_WDT_STAGE_CFG(stage->num));
261 kempld_write8(pld, KEMPLD_WDT_STAGE_CFG(stage->num), stage_cfg);
262 kempld_write32(pld, KEMPLD_WDT_STAGE_TIMEOUT(stage->num),
328 struct kempld_device_data *pld = wdt->pld;
331 status = kempld_read8(pld, KEMPLD_WDT_CFG);
333 kempld_write8(pld, KEMPLD_WDT_CFG, status);
334 status = kempld_read8(pld, KEMPLD_WDT_CFG);
376 wdt.ident.firmware_version = KEMPLD_WDT_REV_GET(kempld_read8(&pld, KEMPLD_WDT_REV));
378 status = kempld_read8(&pld, KEMPLD_WDT_CFG);
405 kempld_release_mutex(&pld);