/* Calculate the divisor, and turn it into the correct control bits to set in the result, @v.  */
static unsigned int calc_0124(unsigned int cyc, unsigned long hclk_tns, unsigned long *v, int shift)
/* Calculate the divisor, and turn it into the correct control bits to set in the result, @v.  */
static unsigned int calc_0124(unsigned int cyc, unsigned long hclk_tns, unsigned long *v, int shift)
{
	unsigned int div = to_div(cyc, hclk_tns);
	unsigned long val;
	s3c_freq_iodbg("%s: cyc=%d, hclk=%lu, shift=%d => div %d\n",
		       __func__, cyc, hclk_tns, shift, div);
	switch (div) {
	case 0:
		val = 0;
		break;
	case 1:
		val = 1;
		break;
	case 2:
		val = 2;
		break;
	case 3:
	case 4:
		val = 3;
		break;
	default:
		return -1;
	}
	*v |= val << shift;
	return 0;
}