Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[SOLVED] Kernel Object PowerPC Register

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
User avatar
Damotclese
Posts: 406
Joined: 2007-07-12 18:22
Location: http://www.crystallake.name/

[SOLVED] Kernel Object PowerPC Register

#1 Post by Damotclese »

This is really frustrating since this should be working! :(

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;
Last edited by Damotclese on 2010-04-21 17:27, edited 1 time in total.
Looks like I picked the wrong week to stop sniffing glue. And snorting coke.

User avatar
Damotclese
Posts: 406
Joined: 2007-07-12 18:22
Location: http://www.crystallake.name/

Re: Kernel Object PowerPC Register -- Frustrating bad pizza!

#2 Post by Damotclese »

This was solved.

SCCR1 is at address 0x80000F04, not 0x80000004. Other than that, everything worked. :)

Post Reply