···11+/*22+ * Copyright (c) 2014, Patrik Jakobsson33+ * All Rights Reserved.44+ *55+ * This program is free software; you can redistribute it and/or modify it66+ * under the terms and conditions of the GNU General Public License,77+ * version 2, as published by the Free Software Foundation.88+ *99+ * This program is distributed in the hope it will be useful, but WITHOUT1010+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or1111+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for1212+ * more details.1313+ *1414+ * Authors: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>1515+ */1616+1717+#include "psb_drv.h"1818+1919+#include "blitter.h"2020+#include "psb_reg.h"2121+2222+/* Wait for the blitter to be completely idle */2323+int gma_blt_wait_idle(struct drm_psb_private *dev_priv)2424+{2525+ unsigned long stop = jiffies + HZ;2626+ int busy = 1;2727+2828+ /* NOP for Cedarview */2929+ if (IS_CDV(dev_priv->dev))3030+ return 0;3131+3232+ /* First do a quick check */3333+ if ((PSB_RSGX32(PSB_CR_2D_SOCIF) == _PSB_C2_SOCIF_EMPTY) &&3434+ ((PSB_RSGX32(PSB_CR_2D_BLIT_STATUS) & _PSB_C2B_STATUS_BUSY) == 0))3535+ return 0;3636+3737+ do {3838+ busy = (PSB_RSGX32(PSB_CR_2D_SOCIF) != _PSB_C2_SOCIF_EMPTY);3939+ } while (busy && !time_after_eq(jiffies, stop));4040+4141+ if (busy)4242+ return -EBUSY;4343+4444+ do {4545+ busy = ((PSB_RSGX32(PSB_CR_2D_BLIT_STATUS) &4646+ _PSB_C2B_STATUS_BUSY) != 0);4747+ } while (busy && !time_after_eq(jiffies, stop));4848+4949+ /* If still busy, we probably have a hang */5050+ return (busy) ? -EBUSY : 0;5151+}
+22
drivers/gpu/drm/gma500/blitter.h
···11+/*22+ * Copyright (c) 2014, Patrik Jakobsson33+ * All Rights Reserved.44+ *55+ * This program is free software; you can redistribute it and/or modify it66+ * under the terms and conditions of the GNU General Public License,77+ * version 2, as published by the Free Software Foundation.88+ *99+ * This program is distributed in the hope it will be useful, but WITHOUT1010+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or1111+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for1212+ * more details.1313+ *1414+ * Authors: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>1515+ */1616+1717+#ifndef __BLITTER_H1818+#define __BLITTER_H1919+2020+extern int gma_blt_wait_idle(struct drm_psb_private *dev_priv);2121+2222+#endif