Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Dell z9332f platform modules for Bullseye and 5.10 kernel. (#5)
Browse files Browse the repository at this point in the history
Also add out of tree pca9548 mux driver to use platform data to mapping i2c bus with front panel port.

Signed-off-by: Jakkapan Jangmuang <jjangmua@celestica.com>

Co-authored-by: Saikrishna Arcot <sarcot@microsoft.com>
jjangmua and saiarcot895 committed Oct 29, 2021
1 parent ca227c7 commit 87c6056
Showing 7 changed files with 669 additions and 45 deletions.
4 changes: 2 additions & 2 deletions platform/broadcom/sonic-platform-modules-dell/debian/control
Original file line number Diff line number Diff line change
@@ -57,10 +57,10 @@ Description: kernel modules for platform devices such as fan, led, sfp

Package: platform-modules-n3248pxe
Architecture: amd64
Depends: linux-image-4.19.0-12-2-amd64-unsigned
Depends: linux-image-5.10.0-8-2-amd64-unsigned
Description: kernel modules for platform devices such as fan, led, sfp

Package: platform-modules-s5296f
Architecture: amd64
Depends: linux-image-4.9.0-9-2-amd64
Depends: linux-image-5.10.0-8-2-amd64-unsigned
Description: kernel modules for platform devices such as fan, led, sfp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
obj-m += cls-switchboard.o
obj-m += cls-i2c-ocore.o
obj-m += cls-i2c-mux-pca954x.o
obj-m += mc24lc64t.o

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -722,7 +722,7 @@ static int ocores_i2c_probe(struct platform_device *pdev)

init_waitqueue_head(&i2c->wait);

irq = platform_get_irq(pdev, 0);
irq = platform_get_irq_optional(pdev, 0);
if (irq == -ENXIO) {
i2c->flags |= OCORES_FLAG_POLL;
} else {
@@ -758,7 +758,7 @@ static int ocores_i2c_probe(struct platform_device *pdev)
/* add in known devices to the bus */
if (pdata) {
for (i = 0; i < pdata->num_devices; i++)
i2c_new_device(&i2c->adap, pdata->devices + i);
i2c_new_client_device(&i2c->adap, pdata->devices + i);
}

return 0;
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
*
* cls-pca954x.h - I2C multiplexer/switch support
*
* Copyright (c) 2008-2009 Rodolfo Giometti <giometti@linux.it>
* Copyright (c) 2008-2009 Eurotech S.p.A. <info@eurotech.it>
* Michael Lawnick <michael.lawnick.ext@nsn.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/


#ifndef _LINUX_I2C_PCA954X_H
#define _LINUX_I2C_PCA954X_H

/* Platform data for the PCA954x I2C multiplexers */

/* Per channel initialisation data:
* @adap_id: bus number for the adapter. 0 = don't care
*
*/
struct pca954x_platform_mode {
int adap_id;
};

/* Per mux/switch data, used with i2c_register_board_info */
struct pca954x_platform_data {
struct pca954x_platform_mode *modes;
int num_modes;
};

#endif /* _LINUX_I2C_PCA954X_H */
Original file line number Diff line number Diff line change
@@ -21,14 +21,14 @@
#include <linux/interrupt.h>
#include <linux/i2c.h>
#include <linux/platform_device.h>
#include <linux/platform_data/pca954x.h>
#include "cls-i2c-ocore.h"
#include "cls-pca954x.h"

#define MOD_VERSION "2.1.0-1"
#define MOD_VERSION "2.2.0"
#define DRV_NAME "cls-switchboard"

#define I2C_MUX_CHANNEL(_ch, _adap_id, _deselect) \
[_ch] = { .adap_id = _adap_id, .deselect_on_exit = _deselect }
#define I2C_MUX_CHANNEL(_ch, _adap_id) \
[_ch] = { .adap_id = _adap_id }

#define FPGA_PCIE_DEVICE_ID 0x7021
#define MMIO_BAR 0
@@ -72,47 +72,47 @@ struct switchbrd_priv {
// NOTE: Silverstone i2c channel mapping is very wierd!!!
/* PCA9548 channel config on MASTER BUS 3 */
static struct pca954x_platform_mode i2c_mux_70_modes[] = {
I2C_MUX_CHANNEL(5, I2C_BUS_OFS + 23, true),
I2C_MUX_CHANNEL(6, I2C_BUS_OFS + 26, true),
I2C_MUX_CHANNEL(0, I2C_BUS_OFS + 27, true),
I2C_MUX_CHANNEL(7, I2C_BUS_OFS + 28, true),
I2C_MUX_CHANNEL(2, I2C_BUS_OFS + 29, true),
I2C_MUX_CHANNEL(4, I2C_BUS_OFS + 30, true),
I2C_MUX_CHANNEL(3, I2C_BUS_OFS + 31, true),
I2C_MUX_CHANNEL(1, I2C_BUS_OFS + 32, true),
I2C_MUX_CHANNEL(5, I2C_BUS_OFS + 23),
I2C_MUX_CHANNEL(6, I2C_BUS_OFS + 26),
I2C_MUX_CHANNEL(0, I2C_BUS_OFS + 27),
I2C_MUX_CHANNEL(7, I2C_BUS_OFS + 28),
I2C_MUX_CHANNEL(2, I2C_BUS_OFS + 29),
I2C_MUX_CHANNEL(4, I2C_BUS_OFS + 30),
I2C_MUX_CHANNEL(3, I2C_BUS_OFS + 31),
I2C_MUX_CHANNEL(1, I2C_BUS_OFS + 32),
};

static struct pca954x_platform_mode i2c_mux_71_modes[] = {
I2C_MUX_CHANNEL(2, I2C_BUS_OFS + 1, true),
I2C_MUX_CHANNEL(3, I2C_BUS_OFS + 2, true),
I2C_MUX_CHANNEL(0, I2C_BUS_OFS + 3, true),
I2C_MUX_CHANNEL(1, I2C_BUS_OFS + 4, true),
I2C_MUX_CHANNEL(6, I2C_BUS_OFS + 5, true),
I2C_MUX_CHANNEL(5, I2C_BUS_OFS + 6, true),
I2C_MUX_CHANNEL(7, I2C_BUS_OFS + 15, true),
I2C_MUX_CHANNEL(4, I2C_BUS_OFS + 8, true),
I2C_MUX_CHANNEL(2, I2C_BUS_OFS + 1),
I2C_MUX_CHANNEL(3, I2C_BUS_OFS + 2),
I2C_MUX_CHANNEL(0, I2C_BUS_OFS + 3),
I2C_MUX_CHANNEL(1, I2C_BUS_OFS + 4),
I2C_MUX_CHANNEL(6, I2C_BUS_OFS + 5),
I2C_MUX_CHANNEL(5, I2C_BUS_OFS + 6),
I2C_MUX_CHANNEL(7, I2C_BUS_OFS + 15),
I2C_MUX_CHANNEL(4, I2C_BUS_OFS + 8),
};

static struct pca954x_platform_mode i2c_mux_72_modes[] = {
I2C_MUX_CHANNEL(1, I2C_BUS_OFS + 17, true),
I2C_MUX_CHANNEL(7, I2C_BUS_OFS + 18, true),
I2C_MUX_CHANNEL(4, I2C_BUS_OFS + 19, true),
I2C_MUX_CHANNEL(0, I2C_BUS_OFS + 20, true),
I2C_MUX_CHANNEL(5, I2C_BUS_OFS + 21, true),
I2C_MUX_CHANNEL(2, I2C_BUS_OFS + 22, true),
I2C_MUX_CHANNEL(3, I2C_BUS_OFS + 25, true),
I2C_MUX_CHANNEL(6, I2C_BUS_OFS + 24, true),
I2C_MUX_CHANNEL(1, I2C_BUS_OFS + 17),
I2C_MUX_CHANNEL(7, I2C_BUS_OFS + 18),
I2C_MUX_CHANNEL(4, I2C_BUS_OFS + 19),
I2C_MUX_CHANNEL(0, I2C_BUS_OFS + 20),
I2C_MUX_CHANNEL(5, I2C_BUS_OFS + 21),
I2C_MUX_CHANNEL(2, I2C_BUS_OFS + 22),
I2C_MUX_CHANNEL(3, I2C_BUS_OFS + 25),
I2C_MUX_CHANNEL(6, I2C_BUS_OFS + 24),
};

static struct pca954x_platform_mode i2c_mux_73_modes[] = {
I2C_MUX_CHANNEL(4, I2C_BUS_OFS + 9, true),
I2C_MUX_CHANNEL(3, I2C_BUS_OFS + 10, true),
I2C_MUX_CHANNEL(6, I2C_BUS_OFS + 11, true),
I2C_MUX_CHANNEL(2, I2C_BUS_OFS + 12, true),
I2C_MUX_CHANNEL(1, I2C_BUS_OFS + 13, true),
I2C_MUX_CHANNEL(5, I2C_BUS_OFS + 14, true),
I2C_MUX_CHANNEL(7, I2C_BUS_OFS + 7, true),
I2C_MUX_CHANNEL(0, I2C_BUS_OFS + 16, true),
I2C_MUX_CHANNEL(4, I2C_BUS_OFS + 9),
I2C_MUX_CHANNEL(3, I2C_BUS_OFS + 10),
I2C_MUX_CHANNEL(6, I2C_BUS_OFS + 11),
I2C_MUX_CHANNEL(2, I2C_BUS_OFS + 12),
I2C_MUX_CHANNEL(1, I2C_BUS_OFS + 13),
I2C_MUX_CHANNEL(5, I2C_BUS_OFS + 14),
I2C_MUX_CHANNEL(7, I2C_BUS_OFS + 7),
I2C_MUX_CHANNEL(0, I2C_BUS_OFS + 16),
};

static struct pca954x_platform_data om_muxes[] = {
@@ -137,19 +137,19 @@ static struct pca954x_platform_data om_muxes[] = {
/* Optical Module bus 3 i2c muxes info */
static struct i2c_board_info i2c_info_3[] = {
{
I2C_BOARD_INFO("pca9548", 0x70),
I2C_BOARD_INFO("cls_pca9548", 0x70),
.platform_data = &om_muxes[0],
},
{
I2C_BOARD_INFO("pca9548", 0x71),
I2C_BOARD_INFO("cls_pca9548", 0x71),
.platform_data = &om_muxes[1],
},
{
I2C_BOARD_INFO("pca9548", 0x72),
I2C_BOARD_INFO("cls_pca9548", 0x72),
.platform_data = &om_muxes[2],
},
{
I2C_BOARD_INFO("pca9548", 0x73),
I2C_BOARD_INFO("cls_pca9548", 0x73),
.platform_data = &om_muxes[3],
},
};
Original file line number Diff line number Diff line change
@@ -94,7 +94,7 @@ static int mc24lc64t_probe(struct i2c_client *client,
sizeof(struct mc24lc64t_data), GFP_KERNEL)))
return -ENOMEM;

drvdata->fake_client = i2c_new_dummy(client->adapter, client->addr + 1);
drvdata->fake_client = i2c_new_dummy_device(client->adapter, client->addr + 1);
if (!drvdata->fake_client)
return -ENOMEM;

0 comments on commit 87c6056

Please sign in to comment.