Lines Matching +full:mmu +full:- +full:500 +full:s

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (c) 2007-2011, Intel Corporation.
44 * to the different groups of PowerVR 5-series chip designs
48 * PowerVR SGX535 - Poulsbo - Intel GMA 500, Intel Atom Z5xx
49 * PowerVR SGX535 - Moorestown - Intel GMA 600
50 * PowerVR SGX535 - Oaktrail - Intel GMA 600, Intel Atom Z6xx, E6xx
51 * PowerVR SGX545 - Cedartrail - Intel GMA 3600, Intel Atom D2500, N2600
52 * PowerVR SGX545 - Cedartrail - Intel GMA 3650, Intel Atom D2550, D2700,
97 * psb_spank - reset the 2D engine
123 PSB_WSGX32(dev_priv->gtt.gatt_start, PSB_CR_BIF_TWOD_REQ_BASE); in psb_spank()
129 struct psb_gtt *pg = &dev_priv->gtt; in psb_do_init()
133 if (pg->mmu_gatt_start & 0x0FFFFFFF) { in psb_do_init()
134 dev_err(dev->dev, "Gatt must be 256M aligned. This is a bug.\n"); in psb_do_init()
135 return -EINVAL; in psb_do_init()
138 stolen_gtt = (pg->stolen_size >> PAGE_SHIFT) * 4; in psb_do_init()
139 stolen_gtt = (stolen_gtt + PAGE_SIZE - 1) >> PAGE_SHIFT; in psb_do_init()
140 stolen_gtt = (stolen_gtt < pg->gtt_pages) ? stolen_gtt : pg->gtt_pages; in psb_do_init()
142 dev_priv->gatt_free_offset = pg->mmu_gatt_start + in psb_do_init()
145 spin_lock_init(&dev_priv->irqmask_lock); in psb_do_init()
151 /* Do not bypass any MMU access, let them pagefault instead */ in psb_do_init()
159 PSB_WSGX32(pg->gatt_start, PSB_CR_BIF_TWOD_REQ_BASE); in psb_do_init()
176 if (dev_priv->ops->chip_teardown) in psb_driver_unload()
177 dev_priv->ops->chip_teardown(dev); in psb_driver_unload()
181 if (dev_priv->pf_pd) { in psb_driver_unload()
182 psb_mmu_free_pagedir(dev_priv->pf_pd); in psb_driver_unload()
183 dev_priv->pf_pd = NULL; in psb_driver_unload()
185 if (dev_priv->mmu) { in psb_driver_unload()
186 struct psb_gtt *pg = &dev_priv->gtt; in psb_driver_unload()
190 (dev_priv->mmu), in psb_driver_unload()
191 pg->mmu_gatt_start, in psb_driver_unload()
192 dev_priv->vram_stolen_size >> PAGE_SHIFT); in psb_driver_unload()
193 psb_mmu_driver_takedown(dev_priv->mmu); in psb_driver_unload()
194 dev_priv->mmu = NULL; in psb_driver_unload()
198 if (dev_priv->scratch_page) { in psb_driver_unload()
199 set_pages_wb(dev_priv->scratch_page, 1); in psb_driver_unload()
200 __free_page(dev_priv->scratch_page); in psb_driver_unload()
201 dev_priv->scratch_page = NULL; in psb_driver_unload()
203 if (dev_priv->vdc_reg) { in psb_driver_unload()
204 iounmap(dev_priv->vdc_reg); in psb_driver_unload()
205 dev_priv->vdc_reg = NULL; in psb_driver_unload()
207 if (dev_priv->sgx_reg) { in psb_driver_unload()
208 iounmap(dev_priv->sgx_reg); in psb_driver_unload()
209 dev_priv->sgx_reg = NULL; in psb_driver_unload()
211 if (dev_priv->aux_reg) { in psb_driver_unload()
212 iounmap(dev_priv->aux_reg); in psb_driver_unload()
213 dev_priv->aux_reg = NULL; in psb_driver_unload()
215 pci_dev_put(dev_priv->aux_pdev); in psb_driver_unload()
216 pci_dev_put(dev_priv->lpc_pdev); in psb_driver_unload()
233 struct pci_dev *pdev = to_pci_dev(dev->dev); in psb_driver_load()
241 int ret = -ENOMEM; in psb_driver_load()
245 dev_priv->ops = (struct psb_ops *)flags; in psb_driver_load()
247 pg = &dev_priv->gtt; in psb_driver_load()
251 dev_priv->num_pipe = dev_priv->ops->pipes; in psb_driver_load()
255 dev_priv->vdc_reg = in psb_driver_load()
257 if (!dev_priv->vdc_reg) in psb_driver_load()
260 dev_priv->sgx_reg = ioremap(resource_start + dev_priv->ops->sgx_offset, in psb_driver_load()
262 if (!dev_priv->sgx_reg) in psb_driver_load()
266 int domain = pci_domain_nr(pdev->bus); in psb_driver_load()
268 dev_priv->aux_pdev = in psb_driver_load()
272 if (dev_priv->aux_pdev) { in psb_driver_load()
273 resource_start = pci_resource_start(dev_priv->aux_pdev, in psb_driver_load()
275 resource_len = pci_resource_len(dev_priv->aux_pdev, in psb_driver_load()
277 dev_priv->aux_reg = ioremap(resource_start, in psb_driver_load()
279 if (!dev_priv->aux_reg) in psb_driver_load()
285 dev_priv->aux_reg = dev_priv->vdc_reg; in psb_driver_load()
288 dev_priv->gmbus_reg = dev_priv->aux_reg; in psb_driver_load()
290 dev_priv->lpc_pdev = in psb_driver_load()
293 if (dev_priv->lpc_pdev) { in psb_driver_load()
294 pci_read_config_word(dev_priv->lpc_pdev, PSB_LPC_GBA, in psb_driver_load()
295 &dev_priv->lpc_gpio_base); in psb_driver_load()
296 pci_write_config_dword(dev_priv->lpc_pdev, PSB_LPC_GBA, in psb_driver_load()
297 (u32)dev_priv->lpc_gpio_base | (1L<<31)); in psb_driver_load()
298 pci_read_config_word(dev_priv->lpc_pdev, PSB_LPC_GBA, in psb_driver_load()
299 &dev_priv->lpc_gpio_base); in psb_driver_load()
300 dev_priv->lpc_gpio_base &= 0xffc0; in psb_driver_load()
301 if (dev_priv->lpc_gpio_base) in psb_driver_load()
303 dev_priv->lpc_gpio_base); in psb_driver_load()
305 pci_dev_put(dev_priv->lpc_pdev); in psb_driver_load()
306 dev_priv->lpc_pdev = NULL; in psb_driver_load()
310 dev_priv->gmbus_reg = dev_priv->vdc_reg; in psb_driver_load()
315 ret = dev_priv->ops->chip_setup(dev); in psb_driver_load()
322 ret = -ENOMEM; in psb_driver_load()
324 dev_priv->scratch_page = alloc_page(GFP_DMA32 | __GFP_ZERO); in psb_driver_load()
325 if (!dev_priv->scratch_page) in psb_driver_load()
328 set_pages_uc(dev_priv->scratch_page, 1); in psb_driver_load()
337 ret = -ENOMEM; in psb_driver_load()
339 dev_priv->mmu = psb_mmu_driver_init(dev, 1, 0, NULL); in psb_driver_load()
340 if (!dev_priv->mmu) in psb_driver_load()
343 dev_priv->pf_pd = psb_mmu_alloc_pd(dev_priv->mmu, 1, 0); in psb_driver_load()
344 if (!dev_priv->pf_pd) in psb_driver_load()
351 /* Add stolen memory to SGX MMU */ in psb_driver_load()
352 ret = psb_mmu_insert_pfn_sequence(psb_mmu_get_default_pd(dev_priv->mmu), in psb_driver_load()
353 dev_priv->stolen_base >> PAGE_SHIFT, in psb_driver_load()
354 pg->gatt_start, in psb_driver_load()
355 pg->stolen_size >> PAGE_SHIFT, 0); in psb_driver_load()
357 psb_mmu_set_pd_context(psb_mmu_get_default_pd(dev_priv->mmu), 0); in psb_driver_load()
358 psb_mmu_set_pd_context(dev_priv->pf_pd, 1); in psb_driver_load()
366 ret = drm_vblank_init(dev, dev_priv->num_pipe); in psb_driver_load()
374 dev_priv->vdc_irq_mask = 0; in psb_driver_load()
375 dev_priv->pipestat[0] = 0; in psb_driver_load()
376 dev_priv->pipestat[1] = 0; in psb_driver_load()
377 dev_priv->pipestat[2] = 0; in psb_driver_load()
378 spin_lock_irqsave(&dev_priv->irqmask_lock, irqflags); in psb_driver_load()
382 spin_unlock_irqrestore(&dev_priv->irqmask_lock, irqflags); in psb_driver_load()
386 dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */ in psb_driver_load()
396 if (gma_encoder->type == INTEL_OUTPUT_LVDS || in psb_driver_load()
397 gma_encoder->type == INTEL_OUTPUT_MIPI) { in psb_driver_load()
410 return devm_add_action_or_reset(dev->dev, psb_device_release, dev); in psb_driver_load()
427 * currently cannot easily find the framebuffer's location in stolen
439 const char *name = req_driver->name; in gma_remove_conflicting_framebuffers()
463 dev_priv = devm_drm_dev_alloc(&pdev->dev, &driver, struct drm_psb_private, dev); in psb_pci_probe()
466 dev = &dev_priv->dev; in psb_pci_probe()
470 ret = psb_driver_load(dev, ent->driver_data); in psb_pci_probe()
474 ret = drm_dev_register(dev, ent->driver_data); in psb_pci_probe()
531 return -ENODEV; in psb_init()