Can someone tell me what I'm doing wrong? I'm attempting to read and modify the SCCR1 register in the Power PC under Debian 2.6.24 in a Kernel Object device driver since I wish to set the PSC6 bit in the register. CPU+REG_BASE is set to 0x80000000 and SCCR1 is set to 0x04
What's curious is that I successfully request the memory region, successfully remap the memory region, yet the ioread32be returns a value of 0x00000000 when I know that the SCCR1 register contains a value of 0xC180BC00.
When I set bit 21 and write it back to the CPU register, I don't know whether it actually writes or not, I suppose I should check, but the fact that I'm not reading the Power PC's register is very strange.
I would expect that this code would work. After spending two days working on it (and related issues) I thought I'd ask.
Code: Select all
static uchar open_iproc_psc6_uart2(void)
{
ulong sccr1_value = 0UL;
// See if we can get the address space we want
if (! (mem_held_p = request_mem_region(CPU_REG_BASE, 0x1000, "EchDrv")))
{
DEBUG_PRN("<1>Unable to get CPU address space\n");
return(10);
}
// Remap the physical IO to a local block
ech_base_p = ioremap(CPU_REG_BASE, 0x1000);
if ((void __iomem *)NULL == ech_base_p)
{
DEBUG_PRN("<1>Unable to map CPU address space\n");
// Make sure to release that
release_mem_region(CPU_REG_BASE, 0x1000);
mem_held_p = 0;
return(10);
}
DEBUG_PRN("<1>Base IO CPU from %lx to %lx\n",
CPU_REG_BASE, (ulong)ech_base_p);
// Get the current value
sccr1_value = ioread32be(ech_base_p + SCCR1);
DEBUG_PRN("<1>SCCR1 %lx original value %lx\n",
(ulong)(ech_base_p + SCCR1), sccr1_value);
// Set bit 21, the PSC6 enable bit
sccr1_value |= (1 << 21);
// Set that bit
iowrite32be(sccr1_value, ech_base_p + SCCR1);
DEBUG_PRN("<1>SCCR1 new value %lx\n", sccr1_value);
// We're done with that block
iounmap((void *)ech_base_p);
ech_base_p = (void __iomem *)NULL;
release_mem_region(CPU_REG_BASE, 0x1000);
mem_held_p = 0;