Microchip-Ethernet / EVB-KSZ9477

Repository for using Microchip EVB-KSZ9477 board. Product Supported: KSZ9477, KSZ9567, KSZ9897, KSZ9896, KSZ8567, KSZ8565, KSZ9893, KSZ9563, KSZ8563, LAN9646, Phys(KSZ9031/9131, LAN8770
76 stars 78 forks source link

ksz8462: integration #33

Closed texierp closed 3 years ago

texierp commented 4 years ago

Hello,

I am in a process of integrating ksz8462 on a raspberry interface. After some tests, it seems I am stuck ...

I have modified the sample program to load the device driver with something like that:

#define IRQ_KSZ8462HLI      44  /* INTRN */

static struct resource ksz8462hli_resource[] = {
    [0] = {
        .start = KSZ8462HLI_PA_DATA,
        .end   = KSZ8462HLI_PA_DATA + KSZ8462HLI_SZ - 1,
        .flags = IORESOURCE_MEM,
    },
    [1] = {
        .start = KSZ8462HLI_PA_CMD,
        .end   = KSZ8462HLI_PA_CMD + KSZ8462HLI_SZ - 1,
        .flags = IORESOURCE_MEM,
    },
    [2] = {
        .start = IRQ_KSZ8462HLI,
        .end   = IRQ_KSZ8462HLI,
        .flags = IORESOURCE_IRQ,
    },
};

static struct platform_device *pdev;

static int __init ksz8462_add(void)
{   
    int inst_id = -1;
    int err;
    pdev = platform_device_alloc("ksz8462_hli", inst_id);
    if (!pdev) {
        err = -ENOMEM;
        pr_err("Device allocation failed\n");
        goto exit;
    }
    err = platform_device_add_resources(pdev, ksz8462hli_resource,
        ARRAY_SIZE(ksz8462hli_resource));
    if (err) {
        pr_err("Device resources addition failed (%d)\n", err);
        goto exit_device_put;
    }
    err = platform_device_add(pdev);
    if (err) {
        pr_err("Device addition failed (%d)\n", err);
        goto exit_device_put;
    }
    return 0;

The driver is loaded, but I have a problem when the driver get the device ID:

[   19.758130] ksz8462_hli ksz8462_hli: failed to read device ID(0x0f)

Iin fact, I am not sure on how to drive the logic (CSN, RDN, WRN) from the device driver itself and for sure, also about both define KSZ8462HLI_PA_DATA & KSZ8462HLI_PA_CMD regarding the raspberry registers.

Any help will be appreciated :)

Thanks!

/Pierre-Jean