OK, so lets see if we can get a better understanding of what you need to do 
because this has been confusing to me also. Read 
Documentation/bus-virt-phys-mapping.txt and you will see they reference ioremap 
under PCI Memory access; however, accessing physical memory/registers, they 
talk about using phys-to-virt(phys_addr). 

Also, in arch/arm/include/asm/io.h, line 328

/*
* ioremap and friends
* 
* ioremap takes a PCI memory address, as specified in 
* Documentation/io-mapping.txt
*/

I also agree with Charles about enabling McASP through the DT, but you also 
need to make sure you have a codec defined to enable the McASP driver. 

Regards,
John




> On Jan 21, 2016, at 1:46 PM, [email protected] wrote:
> 
> Thanks for the help everyone, I think I know where to go from here now. 
> John, I am fairly certain ioremap works with physical addresses. Its 
> declaration is ioremap(phys_addr_t phys_addr, size_t size). I did try 
> 0xFD038000 anyway and it gave the wrong result for the revision number of the 
> McASP.
> 
> Charles, after some additional googling, I think you are correct. Because I 
> have the McASP disabled in the device tree, it is turned off and cannot be 
> accessed. I'm not exactly sure how to turn the McASP/clocks on, but will 
> start looking in the TRM.
> 
> On Thursday, December 17, 2015 at 3:39:57 PM UTC-5, [email protected] wrote:
> I am trying to access the McASP control registers. Reading from the first one 
> fails with the  kernel oops stating "external abort on non-linefetch 
> (0x1028)". I dont know what that means. A minimum failing example of the code 
> is below:
> 
> #include <linux/module.h>
> #include <linux/printk.h>
> #include <asm/io.h>
> 
> #define MCASP_START 0x48038000
> #define MCASP_LENGTH    0x2000
> #define PFUNC_REG_OFFSET 0x10
> 
> static int start(void)
> {
>    pr_info("Calling for ioremap\n");
>    void *mcasp = ioremap(MCASP_START, MCASP_LENGTH);
>    if(mcasp == NULL) {
>       pr_info("ioremap failed!\n");
>       return -1;
>    }
> 
>    u32 pfunc_reg = ioread32(mcasp + PFUNC_REG_OFFSET); // Kernel Oops here!
>    pr_info("Success! PFUNC=%08X\n", test);
>    iounmap(mcasp);
>    return 0;
> }
> module_init(start);
> 
> I have also tried request_mem_region around it, but that changes nothing. The 
> sound drivers are not loaded, and the devicetree entry for the McASP is 
> disabled, so there shouldn't be any problems with conflicts.
> 
> Any help is greatly appreciated.
> Marc
> 
> On Thursday, December 17, 2015 at 3:39:57 PM UTC-5, [email protected] wrote:
> I am trying to access the McASP control registers. Reading from the first one 
> fails with the  kernel oops stating "external abort on non-linefetch 
> (0x1028)". I dont know what that means. A minimum failing example of the code 
> is below:
> 
> #include <linux/module.h>
> #include <linux/printk.h>
> #include <asm/io.h>
> 
> #define MCASP_START 0x48038000
> #define MCASP_LENGTH    0x2000
> #define PFUNC_REG_OFFSET 0x10
> 
> static int start(void)
> {
>    pr_info("Calling for ioremap\n");
>    void *mcasp = ioremap(MCASP_START, MCASP_LENGTH);
>    if(mcasp == NULL) {
>       pr_info("ioremap failed!\n");
>       return -1;
>    }
> 
>    u32 pfunc_reg = ioread32(mcasp + PFUNC_REG_OFFSET); // Kernel Oops here!
>    pr_info("Success! PFUNC=%08X\n", test);
>    iounmap(mcasp);
>    return 0;
> }
> module_init(start);
> 
> I have also tried request_mem_region around it, but that changes nothing. The 
> sound drivers are not loaded, and the devicetree entry for the McASP is 
> disabled, so there shouldn't be any problems with conflicts.
> 
> Any help is greatly appreciated.
> Marc
> 
> -- 
> For more options, visit http://beagleboard.org/discuss 
> <http://beagleboard.org/discuss>
> --- 
> You received this message because you are subscribed to the Google Groups 
> "BeagleBoard" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to