Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) ==============================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) IPMB Driver for a Satellite MC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) ==============================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) The Intelligent Platform Management Bus or IPMB, is an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) I2C bus that provides a standardized interconnection between
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) different boards within a chassis. This interconnection is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) between the baseboard management (BMC) and chassis electronics.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) IPMB is also associated with the messaging protocol through the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) IPMB bus.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) The devices using the IPMB are usually management
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) controllers that perform management functions such as servicing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) the front panel interface, monitoring the baseboard,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) hot-swapping disk drivers in the system chassis, etc...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) When an IPMB is implemented in the system, the BMC serves as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) a controller to give system software access to the IPMB. The BMC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) sends IPMI requests to a device (usually a Satellite Management
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) Controller or Satellite MC) via IPMB and the device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) sends a response back to the BMC.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) For more information on IPMB and the format of an IPMB message,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) refer to the IPMB and IPMI specifications.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) IPMB driver for Satellite MC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) ----------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) ipmb-dev-int - This is the driver needed on a Satellite MC to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) receive IPMB messages from a BMC and send a response back.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) This driver works with the I2C driver and a userspace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) program such as OpenIPMI:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 1) It is an I2C slave backend driver. So, it defines a callback
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35)    function to set the Satellite MC as an I2C slave.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36)    This callback function handles the received IPMI requests.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 2) It defines the read and write functions to enable a user
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39)    space program (such as OpenIPMI) to communicate with the kernel.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) Load the IPMB driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) --------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) The driver needs to be loaded at boot time or manually first.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) First, make sure you have the following in your config file:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) CONFIG_IPMB_DEVICE_INTERFACE=y
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 1) If you want the driver to be loaded at boot time:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) a) Add this entry to your ACPI table, under the appropriate SMBus::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53)      Device (SMB0) // Example SMBus host controller
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54)      {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55)      Name (_HID, "<Vendor-Specific HID>") // Vendor-Specific HID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56)      Name (_UID, 0) // Unique ID of particular host controller
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57)      :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58)      :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59)        Device (IPMB)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60)        {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61)          Name (_HID, "IPMB0001") // IPMB device interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62)          Name (_UID, 0) // Unique device identifier
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63)        }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64)      }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) b) Example for device tree::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68)      &i2c2 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69)             status = "okay";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71)             ipmb@10 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72)                     compatible = "ipmb-dev";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73)                     reg = <0x10>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74)                     i2c-protocol;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75)             };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76)      };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) If xmit of data to be done using raw i2c block vs smbus
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) then "i2c-protocol" needs to be defined as above.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 2) Manually from Linux::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83)      modprobe ipmb-dev-int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) Instantiate the device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) ----------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) After loading the driver, you can instantiate the device as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) described in 'Documentation/i2c/instantiating-devices.rst'.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) If you have multiple BMCs, each connected to your Satellite MC via
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) a different I2C bus, you can instantiate a device for each of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) those BMCs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) The name of the instantiated device contains the I2C bus number
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) associated with it as follows::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98)   BMC1 ------ IPMB/I2C bus 1 ---------|   /dev/ipmb-1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 				Satellite MC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)   BMC1 ------ IPMB/I2C bus 2 ---------|   /dev/ipmb-2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) For instance, you can instantiate the ipmb-dev-int device from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) user space at the 7 bit address 0x10 on bus 2::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)   # echo ipmb-dev 0x1010 > /sys/bus/i2c/devices/i2c-2/new_device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) This will create the device file /dev/ipmb-2, which can be accessed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) by the user space program. The device needs to be instantiated
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) before running the user space program.