Lines Matching +full:3 +full:base +full:- +full:x
1 // SPDX-License-Identifier: GPL-2.0+
16 #include "gpio-samsung.h"
18 #include "gpio-core.h"
29 chip->pm_save[0] = __raw_readl(chip->base + OFFS_CON); in samsung_gpio_pm_1bit_save()
30 chip->pm_save[1] = __raw_readl(chip->base + OFFS_DAT); in samsung_gpio_pm_1bit_save()
35 void __iomem *base = chip->base; in samsung_gpio_pm_1bit_resume() local
36 u32 old_gpcon = __raw_readl(base + OFFS_CON); in samsung_gpio_pm_1bit_resume()
37 u32 old_gpdat = __raw_readl(base + OFFS_DAT); in samsung_gpio_pm_1bit_resume()
38 u32 gps_gpcon = chip->pm_save[0]; in samsung_gpio_pm_1bit_resume()
39 u32 gps_gpdat = chip->pm_save[1]; in samsung_gpio_pm_1bit_resume()
43 * GPACON[x] = 0 => Output, 1 => SFN */ in samsung_gpio_pm_1bit_resume()
48 __raw_writel(gpcon, base + OFFS_CON); in samsung_gpio_pm_1bit_resume()
52 __raw_writel(gps_gpdat, base + OFFS_DAT); in samsung_gpio_pm_1bit_resume()
53 __raw_writel(gps_gpcon, base + OFFS_CON); in samsung_gpio_pm_1bit_resume()
55 S3C_PMDBG("%s: CON %08x => %08x, DAT %08x => %08x\n", in samsung_gpio_pm_1bit_resume()
56 chip->chip.label, old_gpcon, gps_gpcon, old_gpdat, gps_gpdat); in samsung_gpio_pm_1bit_resume()
66 chip->pm_save[0] = __raw_readl(chip->base + OFFS_CON); in samsung_gpio_pm_2bit_save()
67 chip->pm_save[1] = __raw_readl(chip->base + OFFS_DAT); in samsung_gpio_pm_2bit_save()
68 chip->pm_save[2] = __raw_readl(chip->base + OFFS_UP); in samsung_gpio_pm_2bit_save()
94 * samsung_gpio_pm_2bit_resume() - restore the given GPIO bank
122 void __iomem *base = chip->base; in samsung_gpio_pm_2bit_resume() local
123 u32 old_gpcon = __raw_readl(base + OFFS_CON); in samsung_gpio_pm_2bit_resume()
124 u32 old_gpdat = __raw_readl(base + OFFS_DAT); in samsung_gpio_pm_2bit_resume()
125 u32 gps_gpcon = chip->pm_save[0]; in samsung_gpio_pm_2bit_resume()
126 u32 gps_gpdat = chip->pm_save[1]; in samsung_gpio_pm_2bit_resume()
131 /* restore GPIO pull-up settings */ in samsung_gpio_pm_2bit_resume()
132 __raw_writel(chip->pm_save[2], base + OFFS_UP); in samsung_gpio_pm_2bit_resume()
175 __raw_writel(gpcon, base + OFFS_CON); in samsung_gpio_pm_2bit_resume()
179 __raw_writel(gps_gpdat, base + OFFS_DAT); in samsung_gpio_pm_2bit_resume()
180 __raw_writel(gps_gpcon, base + OFFS_CON); in samsung_gpio_pm_2bit_resume()
182 S3C_PMDBG("%s: CON %08x => %08x, DAT %08x => %08x\n", in samsung_gpio_pm_2bit_resume()
183 chip->chip.label, old_gpcon, gps_gpcon, old_gpdat, gps_gpdat); in samsung_gpio_pm_2bit_resume()
194 chip->pm_save[1] = __raw_readl(chip->base + OFFS_CON); in samsung_gpio_pm_4bit_save()
195 chip->pm_save[2] = __raw_readl(chip->base + OFFS_DAT); in samsung_gpio_pm_4bit_save()
196 chip->pm_save[3] = __raw_readl(chip->base + OFFS_UP); in samsung_gpio_pm_4bit_save()
198 if (chip->chip.ngpio > 8) in samsung_gpio_pm_4bit_save()
199 chip->pm_save[0] = __raw_readl(chip->base - 4); in samsung_gpio_pm_4bit_save()
243 void __iomem *con = chip->base + (index * 4); in samsung_gpio_pm_4bit_con()
245 u32 gps_gpcon = chip->pm_save[index + 1]; in samsung_gpio_pm_4bit_con()
258 void __iomem *base = chip->base; in samsung_gpio_pm_4bit_resume() local
260 u32 old_gpdat = __raw_readl(base + OFFS_DAT); in samsung_gpio_pm_4bit_resume()
261 u32 gps_gpdat = chip->pm_save[2]; in samsung_gpio_pm_4bit_resume()
266 old_gpcon[1] = __raw_readl(base + OFFS_CON); in samsung_gpio_pm_4bit_resume()
269 if (chip->chip.ngpio > 8) { in samsung_gpio_pm_4bit_resume()
270 old_gpcon[0] = __raw_readl(base - 4); in samsung_gpio_pm_4bit_resume()
271 samsung_gpio_pm_4bit_con(chip, -1); in samsung_gpio_pm_4bit_resume()
276 __raw_writel(chip->pm_save[2], base + OFFS_DAT); in samsung_gpio_pm_4bit_resume()
277 __raw_writel(chip->pm_save[1], base + OFFS_CON); in samsung_gpio_pm_4bit_resume()
278 if (chip->chip.ngpio > 8) in samsung_gpio_pm_4bit_resume()
279 __raw_writel(chip->pm_save[0], base - 4); in samsung_gpio_pm_4bit_resume()
281 __raw_writel(chip->pm_save[2], base + OFFS_DAT); in samsung_gpio_pm_4bit_resume()
282 __raw_writel(chip->pm_save[3], base + OFFS_UP); in samsung_gpio_pm_4bit_resume()
284 if (chip->chip.ngpio > 8) { in samsung_gpio_pm_4bit_resume()
285 S3C_PMDBG("%s: CON4 %08x,%08x => %08x,%08x, DAT %08x => %08x\n", in samsung_gpio_pm_4bit_resume()
286 chip->chip.label, old_gpcon[0], old_gpcon[1], in samsung_gpio_pm_4bit_resume()
287 __raw_readl(base - 4), in samsung_gpio_pm_4bit_resume()
288 __raw_readl(base + OFFS_CON), in samsung_gpio_pm_4bit_resume()
291 S3C_PMDBG("%s: CON4 %08x => %08x, DAT %08x => %08x\n", in samsung_gpio_pm_4bit_resume()
292 chip->chip.label, old_gpcon[1], in samsung_gpio_pm_4bit_resume()
293 __raw_readl(base + OFFS_CON), in samsung_gpio_pm_4bit_resume()
304 * samsung_pm_save_gpio() - save gpio chip data for suspend
309 struct samsung_gpio_pm *pm = ourchip->pm; in samsung_pm_save_gpio()
311 if (pm == NULL || pm->save == NULL) in samsung_pm_save_gpio()
312 S3C_PMDBG("%s: no pm for %s\n", __func__, ourchip->chip.label); in samsung_pm_save_gpio()
314 pm->save(ourchip); in samsung_pm_save_gpio()
318 * samsung_pm_save_gpios() - Save the state of the GPIO banks.
337 S3C_PMDBG("%s: save %08x,%08x,%08x,%08x\n", in samsung_pm_save_gpios()
338 ourchip->chip.label, in samsung_pm_save_gpios()
339 ourchip->pm_save[0], in samsung_pm_save_gpios()
340 ourchip->pm_save[1], in samsung_pm_save_gpios()
341 ourchip->pm_save[2], in samsung_pm_save_gpios()
342 ourchip->pm_save[3]); in samsung_pm_save_gpios()
344 gpio_nr += ourchip->chip.ngpio; in samsung_pm_save_gpios()
350 * samsung_pm_resume_gpio() - restore gpio chip data after suspend
355 struct samsung_gpio_pm *pm = ourchip->pm; in samsung_pm_resume_gpio()
357 if (pm == NULL || pm->resume == NULL) in samsung_pm_resume_gpio()
358 S3C_PMDBG("%s: no pm for %s\n", __func__, ourchip->chip.label); in samsung_pm_resume_gpio()
360 pm->resume(ourchip); in samsung_pm_resume_gpio()
377 gpio_nr += ourchip->chip.ngpio; in samsung_pm_restore_gpios()